feat: add cadre agents subcommand for list, scaffold, and validate (#16) (#16)#19
Closed
feat: add cadre agents subcommand for list, scaffold, and validate (#16) (#16)#19
cadre agents subcommand for list, scaffold, and validate (#16) (#16)#19Conversation
This was referenced Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the
cadre agentssubcommand group with three sub-commands —list,scaffold, andvalidate— that let users inspect, generate, and verify the agent prompt template files that CADRE's runtime depends on. A formalAgentDefinitioninterface andAGENT_DEFINITIONSregistry (12 agents) were introduced as the canonical source of truth for agent metadata.Closes #16
Changes
src/agents/definitions.ts(new):AgentDefinitioninterface andAGENT_DEFINITIONSreadonly array with all 12 CADRE agents, covering phases 1–5 with name, phase, phaseName, description, hasStructuredOutput, and templateFile fields.src/cli/agents.ts(new):registerAgentsCommandfunction implementing three subcommands:cadre agents list— prints each agent with its phase, phaseName, and a✓/✗existence indicatorcadre agents scaffold— writes default template stubs for missing agent files; supports--forceto overwrite,--agent <name>to limit to one agent, and--backend(accepted as a no-op for non-Claude backends)cadre agents validate— exits 0 if all 12 agent templates exist and are non-empty, exits 1 with a descriptive list of missing/empty files otherwisesrc/index.ts: Imports and registersregisterAgentsCommandbeforeprogram.parse().tests/agent-definitions.test.ts(new): 13 vitest tests verifying completeness and shape ofAGENT_DEFINITIONS.tests/cli-agents.test.ts(new): 22 vitest tests covering list, scaffold, and validate logic with mocked filesystem and config.tests/github-issues.test.ts: Fixed a pre-existing test assertion that expected the oldget_issueMCP tool name; updated toissue_readwithmethod: 'get'to match the currentsrc/github/api.tsimplementation.Implementation Details
The agent directory is resolved relative to
config.repoPathwhenconfig.copilot.agentDiris a relative path, and used as-is when absolute. Template content is a minimal markdown stub containing the agent name, role, instructions, and output format headers — sufficient to bootstrap user-editable files. The--backendflag is accepted without error but is a no-op in this implementation, preserving forward-compatibility for a future multi-backend PR.Testing
tests/agent-definitions.test.ts(13 tests): validates count, uniqueness, required fields, phase range, and templateFile naming conventiontests/cli-agents.test.ts(22 tests): mocksloadConfig,exists,writeTextFile, andreadFileOrNullto cover list output, scaffold create/skip/force/single-agent flows, and validate success/failure pathsnpx vitest runIntegration Verification
tests/github-issues.test.tswas detected by the integration checker and fixed within this PR)Notes
--backendflag is a stub; full multi-backend template adaptation depends on issue Multi-backend agent launcher: native support for Copilot CLI, Claude CLI, and direct API #3.cadre runas an optional pre-flight check (--skip-agent-validation) is out of scope for this issue and should be addressed in thecadre runissue.scaffoldis intentionally minimal; richer templates depend on a future "agent templates" sub-issue referenced in the original issue description.Cadre Process Challenges
--backendflag had no concrete behavior defined for non-Claude backends, the "templates sub-issue" it depends on was not linked, and the exact canonical list of 12 agents had to be inferred from an example table in the issue body rather than from a definitive source.get_issue→issue_read) that was unrelated to this issue. This created an unclear boundary: should the code-writer ignore pre-existing failures, or fix them? The fix-surgeon made the right call but it introduced thefix-result-integration-fix-test.mdartifact into the working tree.AgentNametype values had to be discovered fromsrc/agents/types.tsat implementation time.Closes #16