Summary
The agentcore validate command has divergent behavior between CLI mode and TUI mode, missing schema validations in CLI mode, and duplicated business logic. The TUI validate screen also has UX issues (empty next steps, no suggested actions on success).
Current Behavior
CLI mode (agentcore validate)
- Only validates 3 files:
agentcore.json, aws-targets.json, .cli/state.json
- Missing validation of:
mcp.json and mcp-defs.json
- Returns on first error — doesn't report all validation failures
- No
--json flag for CI/CD usage
registerValidate not re-exported from src/cli/commands/index.ts (inconsistency with all other commands)
TUI mode (validate screen)
- Validates 5 files (correct set):
agentcore.json, aws-targets.json, mcp.json, mcp-defs.json, .cli/state.json
- Reimplements validation logic independently instead of calling
handleValidate() from action.ts
NextSteps component passes empty steps={[]} — no suggested actions after validation
- No tests for
ValidateScreen.tsx
The problem
Running agentcore validate from the command line reports success even when mcp.json or mcp-defs.json are malformed. Only the TUI catches those errors. This is especially bad for CI/CD pipelines (agentcore validate && agentcore deploy -y --json).
Expected Behavior
- CLI and TUI validate the same set of files (all 5 config files)
- Single source of truth: TUI screen calls
handleValidate() instead of reimplementing
- Report all errors instead of stopping on the first failure
- Suggest next steps in TUI (e.g., "Run
deploy to deploy your agent" on success)
Files to Modify
| File |
Change |
src/cli/commands/validate/action.ts |
Add mcp.json and mcp-defs.json validation. Return all errors (not just first). Export a step-level result type the TUI can consume. |
src/cli/commands/validate/command.tsx |
Display all errors, not just the first |
src/cli/tui/screens/validate/ValidateScreen.tsx |
Refactor to call handleValidate() instead of reimplementing. Map results to StepProgress UI. Add meaningful next steps (e.g., deploy). |
src/cli/commands/validate/index.ts |
Ensure all new types are exported |
src/cli/commands/index.ts |
Add missing registerValidate re-export |
src/cli/commands/validate/__tests__/action.test.ts |
Add tests for mcp.json and mcp-defs.json validation |
Acceptance Criteria
Technical Notes
ConfigIO already supports all 5 config types via readAndValidate() with Zod schemas
- The
StepProgress component in the TUI screen can be driven from handleValidate() results if the return type includes per-file status
- Consider making
handleValidate() return { results: Array<{ file: string, success: boolean, error?: string }> } instead of a single { success, error } — this gives both CLI and TUI granular results
mcp.json and mcp-defs.json may not exist in all projects (they're optional) — handle missing files gracefully (skip or warn, don't fail)
Summary
The
agentcore validatecommand has divergent behavior between CLI mode and TUI mode, missing schema validations in CLI mode, and duplicated business logic. The TUI validate screen also has UX issues (empty next steps, no suggested actions on success).Current Behavior
CLI mode (
agentcore validate)agentcore.json,aws-targets.json,.cli/state.jsonmcp.jsonandmcp-defs.json--jsonflag for CI/CD usageregisterValidatenot re-exported fromsrc/cli/commands/index.ts(inconsistency with all other commands)TUI mode (validate screen)
agentcore.json,aws-targets.json,mcp.json,mcp-defs.json,.cli/state.jsonhandleValidate()fromaction.tsNextStepscomponent passes emptysteps={[]}— no suggested actions after validationValidateScreen.tsxThe problem
Running
agentcore validatefrom the command line reports success even whenmcp.jsonormcp-defs.jsonare malformed. Only the TUI catches those errors. This is especially bad for CI/CD pipelines (agentcore validate && agentcore deploy -y --json).Expected Behavior
handleValidate()instead of reimplementingdeployto deploy your agent" on success)Files to Modify
src/cli/commands/validate/action.tsmcp.jsonandmcp-defs.jsonvalidation. Return all errors (not just first). Export a step-level result type the TUI can consume.src/cli/commands/validate/command.tsxsrc/cli/tui/screens/validate/ValidateScreen.tsxhandleValidate()instead of reimplementing. Map results to StepProgress UI. Add meaningful next steps (e.g., deploy).src/cli/commands/validate/index.tssrc/cli/commands/index.tsregisterValidatere-exportsrc/cli/commands/validate/__tests__/action.test.tsAcceptance Criteria
agentcore validatevalidates all 5 config files (agentcore.json, aws-targets.json, mcp.json, mcp-defs.json, .cli/state.json)handleValidate()— no duplicated validation logicregisterValidateis re-exported fromsrc/cli/commands/index.tsTechnical Notes
ConfigIOalready supports all 5 config types viareadAndValidate()with Zod schemasStepProgresscomponent in the TUI screen can be driven fromhandleValidate()results if the return type includes per-file statushandleValidate()return{ results: Array<{ file: string, success: boolean, error?: string }> }instead of a single{ success, error }— this gives both CLI and TUI granular resultsmcp.jsonandmcp-defs.jsonmay not exist in all projects (they're optional) — handle missing files gracefully (skip or warn, don't fail)