feat(v0.6): ctask agents check + doctor integration
ctask agents check [workspace] validates that a workspace's agent configuration can be launched without launching it: agent type known, command resolvable on PATH, launch_dir valid, AGENTS.md present, CLAUDE.md shim present (WARN only, claude type only). agent.env keys are displayed informationally, with a WARN line when any key shadows a ctask-exported CTASK_* var. Returns non-zero when any check FAILs. ctask doctor includes the same sweep when a workspace context is resolvable — the most-recently-active workspace via workspace.MostRecentActive. When no active workspace exists, doctor shows "Agent check: skipped (no workspace context)" without bumping the failure counter. runAgentsCheckOnWorkspace is shared between the standalone command and the doctor integration. TestCompletionSubcommandViaExecute is made order-independent: cobra's default completion command captures the root output writer on the first Execute() in the process, and the new agents-check tests now run an Execute() earlier in the suite.
This commit is contained in:
@@ -197,6 +197,17 @@ func TestCompletionSubcommandViaExecute(t *testing.T) {
|
||||
defer rootCmd.SetOut(os.Stdout)
|
||||
defer rootCmd.SetErr(os.Stderr)
|
||||
|
||||
// Cobra's default `completion` command captures the root's output
|
||||
// writer once, when it is first created on the first Execute() anywhere
|
||||
// in the process (see InitDefaultCompletionCmd). Drop any previously
|
||||
// created instance so the Execute() below re-creates it bound to buf —
|
||||
// keeps this test independent of which other test ran Execute() first.
|
||||
for _, c := range rootCmd.Commands() {
|
||||
if c.Name() == "completion" {
|
||||
rootCmd.RemoveCommand(c)
|
||||
}
|
||||
}
|
||||
|
||||
rootCmd.SetArgs([]string{"completion", "bash"})
|
||||
defer rootCmd.SetArgs(nil)
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user