diff --git a/pkg/agentic/commands.go b/pkg/agentic/commands.go index 042b012..341a577 100644 --- a/pkg/agentic/commands.go +++ b/pkg/agentic/commands.go @@ -22,6 +22,7 @@ func (s *PrepSubsystem) registerCommands(ctx context.Context) { c.Command("prep", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}) c.Command("prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}) c.Command("generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}) + c.Command("complete", core.Command{Description: "Run the completion pipeline (QA → PR → Verify → Ingest → Poke)", Action: s.cmdComplete}) c.Command("scan", core.Command{Description: "Scan Forge repos for actionable issues", Action: s.cmdScan}) c.Command("brain/ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest}) c.Command("brain/seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory directory", Action: s.cmdBrainSeedMemory}) @@ -211,6 +212,17 @@ func (s *PrepSubsystem) cmdGenerate(options core.Options) core.Result { return core.Result{OK: true} } +func (s *PrepSubsystem) cmdComplete(options core.Options) core.Result { + result := s.handleComplete(s.commandContext(), options) + if !result.OK { + err := commandResultError("agentic.cmdComplete", result) + core.Print(nil, "error: %v", err) + return core.Result{Value: err, OK: false} + } + + return result +} + func (s *PrepSubsystem) cmdScan(options core.Options) core.Result { result := s.handleScan(s.commandContext(), core.NewOptions( core.Option{Key: "org", Value: optionStringValue(options, "org")}, diff --git a/pkg/agentic/commands_test.go b/pkg/agentic/commands_test.go index 71513e8..f2e83a1 100644 --- a/pkg/agentic/commands_test.go +++ b/pkg/agentic/commands_test.go @@ -905,6 +905,32 @@ func TestCommands_CmdGenerate_Good_BriefTemplate(t *testing.T) { assert.Contains(t, output, "content: Template draft") } +func TestCommands_CmdComplete_Good(t *testing.T) { + s, c := testPrepWithCore(t, nil) + + c.Action("noop", func(_ context.Context, _ core.Options) core.Result { + return core.Result{OK: true} + }) + c.Task("agent.completion", core.Task{ + Description: "QA → PR → Verify → Ingest → Poke", + Steps: []core.Step{ + {Action: "noop"}, + }, + }) + + r := s.cmdComplete(core.NewOptions( + core.Option{Key: "workspace", Value: core.JoinPath(WorkspaceRoot(), "core/go-io/task-42")}, + )) + assert.True(t, r.OK) +} + +func TestCommands_CmdComplete_Bad_MissingTask(t *testing.T) { + s, _ := testPrepWithCore(t, nil) + + r := s.cmdComplete(core.NewOptions()) + assert.False(t, r.OK) +} + func TestCommands_CmdScan_Good(t *testing.T) { server := mockScanServer(t) s := &PrepSubsystem{ @@ -1131,6 +1157,7 @@ func TestCommands_RegisterCommands_Good_AllRegistered(t *testing.T) { assert.Contains(t, cmds, "run/task") assert.Contains(t, cmds, "run/orchestrator") assert.Contains(t, cmds, "prep") + assert.Contains(t, cmds, "complete") assert.Contains(t, cmds, "scan") assert.Contains(t, cmds, "status") assert.Contains(t, cmds, "prompt") diff --git a/pkg/agentic/prep_test.go b/pkg/agentic/prep_test.go index fc97d61..782669b 100644 --- a/pkg/agentic/prep_test.go +++ b/pkg/agentic/prep_test.go @@ -581,6 +581,7 @@ func TestPrep_OnStartup_Good_RegistersGenerateCommand(t *testing.T) { require.True(t, s.OnStartup(context.Background()).OK) assert.Contains(t, c.Commands(), "generate") + assert.Contains(t, c.Commands(), "complete") assert.Contains(t, c.Commands(), "prep-workspace") assert.Contains(t, c.Commands(), "brain/ingest") assert.Contains(t, c.Commands(), "brain/seed-memory")