Skip to content

Commit 63348c3

Browse files
committed
fix(import): show project context error before --code flag validation
Commander's requiredOption() for --code runs before the action handler, so users outside a project see "required option not specified" instead of "no agentcore project found". Change to option() so the handler's project context check (step 1) runs first. The --code validation at step 5 still catches missing values after project context is confirmed. Constraint: Commander validates requiredOption before action handlers execute Rejected: Moving project check into a Commander hook | adds complexity for one flag Confidence: high Scope-risk: narrow
1 parent 2bfb3d6 commit 63348c3

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/cli/commands/import/import-runtime.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,7 @@ export function registerImportRuntime(importCmd: Command): void {
507507
.command('runtime')
508508
.description('Import an existing AgentCore Runtime from your AWS account')
509509
.option('--arn <runtimeArn>', 'Runtime ARN to import')
510-
.requiredOption(
511-
'--code <path>',
512-
'Path to the directory containing the entrypoint file (e.g., the folder with main.py)'
513-
)
510+
.option('--code <path>', 'Path to the directory containing the entrypoint file (e.g., the folder with main.py)')
514511
.option('--entrypoint <file>', 'Entrypoint file (auto-detected from runtime, e.g. main.py)')
515512
.option('--target <target>', 'Deployment target name')
516513
.option('--name <name>', 'Local name for the imported runtime')

0 commit comments

Comments
 (0)