import { getErrorMessage } from '../../errors'; import { COMMAND_DESCRIPTIONS } from '../../tui/copy'; import { handlePackage, loadPackageConfig } from './action'; import type { Command } from '@commander-js/extra-typings'; import { Text, render } from 'ink'; export const registerPackage = (program: Command) => { program .command('package') .alias('pkg') .option('-d, --directory ', 'Project directory containing agentcore config') .option('-r, --runtime ', 'Package only the specified runtime') .description(COMMAND_DESCRIPTIONS.package) .action(async options => { try { const context = await loadPackageConfig(options); const result = await handlePackage(context); // Report skipped agents for (const name of result.skipped) { render(Skipping {name}: ContainerImage artifacts not supported); } if (result.results.length === 0) { render(No agents to package); return; } // Report successful packages for (const { agentName, artifactPath, sizeMb } of result.results) { render( ✓ {agentName}: {artifactPath} ({sizeMb} MB) ); } } catch (error) { render(Error: {getErrorMessage(error)}); process.exit(1); } }); };