diff --git a/go/cmd/core-agent/commands.go b/go/cmd/core-agent/commands.go index 496e2777..4b54d947 100644 --- a/go/cmd/core-agent/commands.go +++ b/go/cmd/core-agent/commands.go @@ -40,27 +40,32 @@ func applyLogLevel(args []string) []string { return cleaned } -// c.Command("version", core.Command{Description: "Print version and build info", Action: commands.version}) -// c.Command("check", core.Command{Description: "Verify workspace, deps, and config", Action: commands.check}) -// c.Command("env", core.Command{Description: "Show all core.Env() keys and values", Action: commands.env}) -func registerApplicationCommands(c *core.Core) { +// result := registerApplicationCommands(c) +// core.Println(result.OK) +func registerApplicationCommands(c *core.Core) core.Result { commands := applicationCommandSet{coreApp: c} - c.Command("version", core.Command{ + if result := c.Command("version", core.Command{ Description: "Print version and build info", Action: commands.version, - }) + }); !result.OK { + return result + } - c.Command("check", core.Command{ + if result := c.Command("check", core.Command{ Description: "Verify workspace, deps, and config", Action: commands.check, - }) + }); !result.OK { + return result + } - c.Command("env", core.Command{ + if result := c.Command("env", core.Command{ Description: "Show all core.Env() keys and values", Action: commands.env, - }) - + }); !result.OK { + return result + } + return core.Result{OK: true} } func (commands applicationCommandSet) version(_ core.Options) core.Result { diff --git a/go/cmd/core-agent/main.go b/go/cmd/core-agent/main.go index 0fb2be79..0c5902b3 100644 --- a/go/cmd/core-agent/main.go +++ b/go/cmd/core-agent/main.go @@ -27,6 +27,14 @@ func main() { // core.Println(app.App().Name) // "core-agent" // core.Println(app.App().Version) // "dev" or linked version func newCoreAgent() *core.Core { + coreApp, result := newCoreAgentResult() + if !result.OK { + panic(result.Value) + } + return coreApp +} + +func newCoreAgentResult() (*core.Core, core.Result) { coreApp := core.New( core.WithOption("name", "core-agent"), core.WithService(agentic.ProcessRegister), @@ -43,9 +51,11 @@ func newCoreAgent() *core.Core { return core.Concat("core-agent ", coreApp.App().Version, " — agentic orchestration for the Core ecosystem") }) - registerApplicationCommands(coreApp) + if result := registerApplicationCommands(coreApp); !result.OK { + return coreApp, result + } - return coreApp + return coreApp, core.Result{OK: true} } // agentpkg.Version = "0.15.0" @@ -61,7 +71,11 @@ func applicationVersion() string { // core.Error("core-agent failed", "err", err) // } var runCoreAgent = func() error { - return runApp(newCoreAgent(), startupArgs()) + coreApp, result := newCoreAgentResult() + if !result.OK { + return resultError("main.newCoreAgent", "command registration failed", result) + } + return runApp(coreApp, startupArgs()) } // app := newCoreAgent() diff --git a/go/pkg/agentic/commands.go b/go/pkg/agentic/commands.go index 430923bd..55036c08 100644 --- a/go/pkg/agentic/commands.go +++ b/go/pkg/agentic/commands.go @@ -15,91 +15,232 @@ import ( // c.Command("run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask}) // c.Command("prep", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}) -func (s *PrepSubsystem) registerCommands(ctx context.Context) { +func (s *PrepSubsystem) registerCommands(ctx context.Context) core.Result { s.startupContext = ctx c := s.Core() - s.registerRepoSyncSupport() - _ = c.Command("run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask}) - _ = c.Command("agentic:run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask}) - _ = c.Command("run/flow", core.Command{Description: "Show a flow definition from disk or the embedded library", Action: s.cmdRunFlow}) - _ = c.Command("agentic:run/flow", core.Command{Description: "Show a flow definition from disk or the embedded library", Action: s.cmdRunFlow}) - _ = c.Command("flow/preview", core.Command{Description: "Preview a flow definition with optional variable substitution", Action: s.cmdFlowPreview}) - _ = c.Command("agentic:flow/preview", core.Command{Description: "Preview a flow definition with optional variable substitution", Action: s.cmdFlowPreview}) - _ = c.Command("dispatch/sync", core.Command{Description: "Dispatch a single task synchronously and block until it completes", Action: s.cmdDispatchSync}) - _ = c.Command("agentic:dispatch/sync", core.Command{Description: "Dispatch a single task synchronously and block until it completes", Action: s.cmdDispatchSync}) - _ = c.Command("run/orchestrator", core.Command{Description: "Run the queue orchestrator (standalone, no MCP)", Action: s.cmdOrchestrator}) - c.Command("agentic:run/orchestrator", core.Command{Description: "Run the queue orchestrator (standalone, no MCP)", Action: s.cmdOrchestrator}) - c.Command("dispatch", core.Command{Description: "Dispatch queued agents", Action: s.cmdDispatch}) - c.Command("agentic:dispatch", core.Command{Description: "Dispatch queued agents", Action: s.cmdDispatch}) - c.Command("dispatch/start", core.Command{Description: "Start the dispatch queue runner", Action: s.cmdDispatchStart}) - c.Command("agentic:dispatch/start", core.Command{Description: "Start the dispatch queue runner", Action: s.cmdDispatchStart}) - c.Command("dispatch/shutdown", core.Command{Description: "Freeze the dispatch queue gracefully", Action: s.cmdDispatchShutdown}) - c.Command("agentic:dispatch/shutdown", core.Command{Description: "Freeze the dispatch queue gracefully", Action: s.cmdDispatchShutdown}) - c.Command("dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow}) - c.Command("agentic:dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow}) - c.Command("poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke}) - c.Command("agentic:poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke}) - 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("agentic:prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}) - c.Command("resume", core.Command{Description: "Resume a blocked or completed workspace", Action: s.cmdResume}) - c.Command("agentic:resume", core.Command{Description: "Resume a blocked or completed workspace", Action: s.cmdResume}) - c.Command("generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}) - c.Command("agentic:generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}) - c.Command("content/generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}) - c.Command("agentic:content/generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}) - c.Command("content/schema/generate", core.Command{Description: "Generate SEO schema JSON-LD for article, FAQ, or how-to content", Action: s.cmdContentSchemaGenerate}) - c.Command("agentic:content/schema/generate", core.Command{Description: "Generate SEO schema JSON-LD for article, FAQ, or how-to content", Action: s.cmdContentSchemaGenerate}) - c.Command("complete", core.Command{Description: "Run the completion pipeline (QA → PR → Verify → Commit → Ingest → Poke)", Action: s.cmdComplete}) - c.Command("agentic:complete", core.Command{Description: "Run the completion pipeline (QA → PR → Verify → Commit → Ingest → Poke)", Action: s.cmdComplete}) - c.Command("scan", core.Command{Description: "Scan Forge repos for actionable issues", Action: s.cmdScan}) - c.Command("agentic:scan", core.Command{Description: "Scan Forge repos for actionable issues", Action: s.cmdScan}) - c.Command("mirror", core.Command{Description: "Mirror Forge repos to GitHub", Action: s.cmdMirror}) - c.Command("agentic:mirror", core.Command{Description: "Mirror Forge repos to GitHub", Action: s.cmdMirror}) - c.Command("brain/ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest}) - c.Command("brain:ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest}) - c.Command("brain/recall", core.Command{Description: "Recall memories from OpenBrain", Action: s.cmdBrainRecall}) - c.Command("brain:recall", core.Command{Description: "Recall memories from OpenBrain", Action: s.cmdBrainRecall}) - c.Command("brain/remember", core.Command{Description: "Store a memory in OpenBrain", Action: s.cmdBrainRemember}) - c.Command("brain:remember", core.Command{Description: "Store a memory in OpenBrain", Action: s.cmdBrainRemember}) - c.Command("brain/seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory file or directory", Action: s.cmdBrainSeedMemory}) - c.Command("brain:seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory file or directory", Action: s.cmdBrainSeedMemory}) - c.Command("brain/list", core.Command{Description: "List memories in OpenBrain", Action: s.cmdBrainList}) - c.Command("brain:list", core.Command{Description: "List memories in OpenBrain", Action: s.cmdBrainList}) - c.Command("brain/forget", core.Command{Description: "Forget a memory in OpenBrain", Action: s.cmdBrainForget}) - c.Command("brain:forget", core.Command{Description: "Forget a memory in OpenBrain", Action: s.cmdBrainForget}) - c.Command("lang/detect", core.Command{Description: "Detect the primary language for a repository or workspace", Action: s.cmdLangDetect}) - c.Command("lang/list", core.Command{Description: "List supported language identifiers", Action: s.cmdLangList}) - c.Command("epic", core.Command{Description: "Create sub-issues from an epic plan", Action: s.cmdEpic}) - c.Command("agentic:epic", core.Command{Description: "Create sub-issues from an epic plan", Action: s.cmdEpic}) - c.Command("plan-cleanup", core.Command{Description: "Archive old completed plans and delete stale archives past the retention period", Action: s.cmdPlanCleanup}) - c.Command("agentic:plan-cleanup", core.Command{Description: "Archive old completed plans and delete stale archives past the retention period", Action: s.cmdPlanCleanup}) - c.Command("pr-manage", core.Command{Description: "Manage open PRs (merge, close, review)", Action: s.cmdPRManage}) - c.Command("agentic:pr-manage", core.Command{Description: "Manage open PRs (merge, close, review)", Action: s.cmdPRManage}) - c.Command("review-queue", core.Command{Description: "Process the CodeRabbit review queue", Action: s.cmdReviewQueue}) - c.Command("agentic:review-queue", core.Command{Description: "Process the CodeRabbit review queue", Action: s.cmdReviewQueue}) - c.Command("status", core.Command{Description: "List agent workspace statuses", Action: s.cmdStatus}) - c.Command("agentic:status", core.Command{Description: "List agent workspace statuses", Action: s.cmdStatus}) - c.Command("prompt", core.Command{Description: "Build and display an agent prompt for a repo", Action: s.cmdPrompt}) - c.Command("agentic:prompt", core.Command{Description: "Build and display an agent prompt for a repo", Action: s.cmdPrompt}) - c.Command("prompt_version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}) - c.Command("agentic:prompt_version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}) - c.Command("prompt/version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}) - c.Command("agentic:prompt/version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}) - c.Command("extract", core.Command{Description: "Extract data from agent output or scaffold a workspace template", Action: s.cmdExtract}) - c.Command("agentic:extract", core.Command{Description: "Extract data from agent output or scaffold a workspace template", Action: s.cmdExtract}) - s.registerPlanCommands() - s.registerCommitCommands() - s.registerSessionCommands() - s.registerPhaseCommands() - s.registerTaskCommands() - s.registerSprintCommands() - s.registerStateCommands() - s.registerCoreCommands() - s.registerFleetCommands() - s.registerPipelineCommands() - s.registerLanguageCommands() - s.registerSetupCommands() + if result := s.registerRepoSyncSupport(); !result.OK { + return result + } + if r := c.Command("run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask}); !r.OK { + return r + } + if r := c.Command("agentic:run/task", core.Command{Description: "Run a single task end-to-end", Action: s.cmdRunTask}); !r.OK { + return r + } + if r := c.Command("run/flow", core.Command{Description: "Show a flow definition from disk or the embedded library", Action: s.cmdRunFlow}); !r.OK { + return r + } + if r := c.Command("agentic:run/flow", core.Command{Description: "Show a flow definition from disk or the embedded library", Action: s.cmdRunFlow}); !r.OK { + return r + } + if r := c.Command("flow/preview", core.Command{Description: "Preview a flow definition with optional variable substitution", Action: s.cmdFlowPreview}); !r.OK { + return r + } + if r := c.Command("agentic:flow/preview", core.Command{Description: "Preview a flow definition with optional variable substitution", Action: s.cmdFlowPreview}); !r.OK { + return r + } + if r := c.Command("dispatch/sync", core.Command{Description: "Dispatch a single task synchronously and block until it completes", Action: s.cmdDispatchSync}); !r.OK { + return r + } + if r := c.Command("agentic:dispatch/sync", core.Command{Description: "Dispatch a single task synchronously and block until it completes", Action: s.cmdDispatchSync}); !r.OK { + return r + } + if r := c.Command("run/orchestrator", core.Command{Description: "Run the queue orchestrator (standalone, no MCP)", Action: s.cmdOrchestrator}); !r.OK { + return r + } + if r := c.Command("agentic:run/orchestrator", core.Command{Description: "Run the queue orchestrator (standalone, no MCP)", Action: s.cmdOrchestrator}); !r.OK { + return r + } + if r := c.Command("dispatch", core.Command{Description: "Dispatch queued agents", Action: s.cmdDispatch}); !r.OK { + return r + } + if r := c.Command("agentic:dispatch", core.Command{Description: "Dispatch queued agents", Action: s.cmdDispatch}); !r.OK { + return r + } + if r := c.Command("dispatch/start", core.Command{Description: "Start the dispatch queue runner", Action: s.cmdDispatchStart}); !r.OK { + return r + } + if r := c.Command("agentic:dispatch/start", core.Command{Description: "Start the dispatch queue runner", Action: s.cmdDispatchStart}); !r.OK { + return r + } + if r := c.Command("dispatch/shutdown", core.Command{Description: "Freeze the dispatch queue gracefully", Action: s.cmdDispatchShutdown}); !r.OK { + return r + } + if r := c.Command("agentic:dispatch/shutdown", core.Command{Description: "Freeze the dispatch queue gracefully", Action: s.cmdDispatchShutdown}); !r.OK { + return r + } + if r := c.Command("dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow}); !r.OK { + return r + } + if r := c.Command("agentic:dispatch/shutdown-now", core.Command{Description: "Hard stop the dispatch queue and kill running agents", Action: s.cmdDispatchShutdownNow}); !r.OK { + return r + } + if r := c.Command("poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke}); !r.OK { + return r + } + if r := c.Command("agentic:poke", core.Command{Description: "Drain the dispatch queue immediately", Action: s.cmdPoke}); !r.OK { + return r + } + if r := c.Command("prep", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}); !r.OK { + return r + } + if r := c.Command("prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}); !r.OK { + return r + } + if r := c.Command("agentic:prep-workspace", core.Command{Description: "Prepare a workspace: clone repo, build prompt", Action: s.cmdPrep}); !r.OK { + return r + } + if r := c.Command("resume", core.Command{Description: "Resume a blocked or completed workspace", Action: s.cmdResume}); !r.OK { + return r + } + if r := c.Command("agentic:resume", core.Command{Description: "Resume a blocked or completed workspace", Action: s.cmdResume}); !r.OK { + return r + } + if r := c.Command("generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}); !r.OK { + return r + } + if r := c.Command("agentic:generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}); !r.OK { + return r + } + if r := c.Command("content/generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}); !r.OK { + return r + } + if r := c.Command("agentic:content/generate", core.Command{Description: "Generate content from a prompt using the platform content pipeline", Action: s.cmdGenerate}); !r.OK { + return r + } + if r := c.Command("content/schema/generate", core.Command{Description: "Generate SEO schema JSON-LD for article, FAQ, or how-to content", Action: s.cmdContentSchemaGenerate}); !r.OK { + return r + } + if r := c.Command("agentic:content/schema/generate", core.Command{Description: "Generate SEO schema JSON-LD for article, FAQ, or how-to content", Action: s.cmdContentSchemaGenerate}); !r.OK { + return r + } + if r := c.Command("complete", core.Command{Description: "Run the completion pipeline (QA → PR → Verify → Commit → Ingest → Poke)", Action: s.cmdComplete}); !r.OK { + return r + } + if r := c.Command("agentic:complete", core.Command{Description: "Run the completion pipeline (QA → PR → Verify → Commit → Ingest → Poke)", Action: s.cmdComplete}); !r.OK { + return r + } + if r := c.Command("scan", core.Command{Description: "Scan Forge repos for actionable issues", Action: s.cmdScan}); !r.OK { + return r + } + if r := c.Command("agentic:scan", core.Command{Description: "Scan Forge repos for actionable issues", Action: s.cmdScan}); !r.OK { + return r + } + if r := c.Command("mirror", core.Command{Description: "Mirror Forge repos to GitHub", Action: s.cmdMirror}); !r.OK { + return r + } + if r := c.Command("agentic:mirror", core.Command{Description: "Mirror Forge repos to GitHub", Action: s.cmdMirror}); !r.OK { + return r + } + if r := c.Command("brain/ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest}); !r.OK { + return r + } + if r := c.Command("brain:ingest", core.Command{Description: "Bulk ingest memories into OpenBrain", Action: s.cmdBrainIngest}); !r.OK { + return r + } + if r := c.Command("brain/recall", core.Command{Description: "Recall memories from OpenBrain", Action: s.cmdBrainRecall}); !r.OK { + return r + } + if r := c.Command("brain:recall", core.Command{Description: "Recall memories from OpenBrain", Action: s.cmdBrainRecall}); !r.OK { + return r + } + if r := c.Command("brain/remember", core.Command{Description: "Store a memory in OpenBrain", Action: s.cmdBrainRemember}); !r.OK { + return r + } + if r := c.Command("brain:remember", core.Command{Description: "Store a memory in OpenBrain", Action: s.cmdBrainRemember}); !r.OK { + return r + } + if r := c.Command("brain/seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory file or directory", Action: s.cmdBrainSeedMemory}); !r.OK { + return r + } + if r := c.Command("brain:seed-memory", core.Command{Description: "Import markdown memories into OpenBrain from a project memory file or directory", Action: s.cmdBrainSeedMemory}); !r.OK { + return r + } + if r := c.Command("brain/list", core.Command{Description: "List memories in OpenBrain", Action: s.cmdBrainList}); !r.OK { + return r + } + if r := c.Command("brain:list", core.Command{Description: "List memories in OpenBrain", Action: s.cmdBrainList}); !r.OK { + return r + } + if r := c.Command("brain/forget", core.Command{Description: "Forget a memory in OpenBrain", Action: s.cmdBrainForget}); !r.OK { + return r + } + if r := c.Command("brain:forget", core.Command{Description: "Forget a memory in OpenBrain", Action: s.cmdBrainForget}); !r.OK { + return r + } + if r := c.Command("epic", core.Command{Description: "Create sub-issues from an epic plan", Action: s.cmdEpic}); !r.OK { + return r + } + if r := c.Command("agentic:epic", core.Command{Description: "Create sub-issues from an epic plan", Action: s.cmdEpic}); !r.OK { + return r + } + if r := c.Command("plan-cleanup", core.Command{Description: "Archive old completed plans and delete stale archives past the retention period", Action: s.cmdPlanCleanup}); !r.OK { + return r + } + if r := c.Command("agentic:plan-cleanup", core.Command{Description: "Archive old completed plans and delete stale archives past the retention period", Action: s.cmdPlanCleanup}); !r.OK { + return r + } + if r := c.Command("pr-manage", core.Command{Description: "Manage open PRs (merge, close, review)", Action: s.cmdPRManage}); !r.OK { + return r + } + if r := c.Command("agentic:pr-manage", core.Command{Description: "Manage open PRs (merge, close, review)", Action: s.cmdPRManage}); !r.OK { + return r + } + if r := c.Command("review-queue", core.Command{Description: "Process the CodeRabbit review queue", Action: s.cmdReviewQueue}); !r.OK { + return r + } + if r := c.Command("agentic:review-queue", core.Command{Description: "Process the CodeRabbit review queue", Action: s.cmdReviewQueue}); !r.OK { + return r + } + if r := c.Command("status", core.Command{Description: "List agent workspace statuses", Action: s.cmdStatus}); !r.OK { + return r + } + if r := c.Command("agentic:status", core.Command{Description: "List agent workspace statuses", Action: s.cmdStatus}); !r.OK { + return r + } + if r := c.Command("prompt", core.Command{Description: "Build and display an agent prompt for a repo", Action: s.cmdPrompt}); !r.OK { + return r + } + if r := c.Command("agentic:prompt", core.Command{Description: "Build and display an agent prompt for a repo", Action: s.cmdPrompt}); !r.OK { + return r + } + if r := c.Command("prompt_version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}); !r.OK { + return r + } + if r := c.Command("agentic:prompt_version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}); !r.OK { + return r + } + if r := c.Command("prompt/version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}); !r.OK { + return r + } + if r := c.Command("agentic:prompt/version", core.Command{Description: "Read the current prompt snapshot for a workspace", Action: s.cmdPromptVersion}); !r.OK { + return r + } + if r := c.Command("extract", core.Command{Description: "Extract data from agent output or scaffold a workspace template", Action: s.cmdExtract}); !r.OK { + return r + } + if r := c.Command("agentic:extract", core.Command{Description: "Extract data from agent output or scaffold a workspace template", Action: s.cmdExtract}); !r.OK { + return r + } + for _, register := range []func() core.Result{ + s.registerPlanCommands, + s.registerCommitCommands, + s.registerSessionCommands, + s.registerPhaseCommands, + s.registerTaskCommands, + s.registerSprintCommands, + s.registerStateCommands, + s.registerCoreCommands, + s.registerFleetCommands, + s.registerPipelineCommands, + s.registerLanguageCommands, + s.registerSetupCommands, + } { + if result := register(); !result.OK { + return result + } + } + return core.Result{OK: true} } // ctx := s.commandContext() diff --git a/go/pkg/agentic/commands_commit.go b/go/pkg/agentic/commands_commit.go index 09a63f28..4ce2a9c1 100644 --- a/go/pkg/agentic/commands_commit.go +++ b/go/pkg/agentic/commands_commit.go @@ -4,10 +4,15 @@ package agentic import core "dappco.re/go" -func (s *PrepSubsystem) registerCommitCommands() { +func (s *PrepSubsystem) registerCommitCommands() core.Result { c := s.Core() - c.Command("commit", core.Command{Description: "Write the final dispatch record to the workspace journal", Action: s.cmdCommit}) - c.Command("agentic:commit", core.Command{Description: "Write the final dispatch record to the workspace journal", Action: s.cmdCommit}) + if r := c.Command("commit", core.Command{Description: "Write the final dispatch record to the workspace journal", Action: s.cmdCommit}); !r.OK { + return r + } + if r := c.Command("agentic:commit", core.Command{Description: "Write the final dispatch record to the workspace journal", Action: s.cmdCommit}); !r.OK { + return r + } + return core.Ok(nil) } // core-agent commit core/go-io/task-42 diff --git a/go/pkg/agentic/commands_core.go b/go/pkg/agentic/commands_core.go index 5f0be208..dd955d7b 100644 --- a/go/pkg/agentic/commands_core.go +++ b/go/pkg/agentic/commands_core.go @@ -165,8 +165,7 @@ var coreCommandSpecs = []coreCommandSpec{ }, } -func (s *PrepSubsystem) registerCoreCommands() { - c := s.Core() +func (s *PrepSubsystem) registerCoreCommands() core.Result { actions := map[string]core.CommandAction{ "core": s.cmdCore, "core/pipeline": s.cmdCorePipeline, @@ -193,11 +192,14 @@ func (s *PrepSubsystem) registerCoreCommands() { } for _, spec := range coreCommandSpecs { - c.Command(spec.Path, core.Command{ + if result := s.Core().Command(spec.Path, core.Command{ Description: spec.Description, Action: actions[spec.Path], - }) + }); !result.OK { + return result + } } + return core.Result{OK: true} } func (s *PrepSubsystem) cmdCore(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_forge.go b/go/pkg/agentic/commands_forge.go index a309d114..05397f3e 100644 --- a/go/pkg/agentic/commands_forge.go +++ b/go/pkg/agentic/commands_forge.go @@ -104,40 +104,109 @@ func formatIndex(n int64) string { return strconv.FormatInt(n, 10) } // c.Command("issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet}) // c.Command("pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge}) -func (s *PrepSubsystem) registerForgeCommands() { +func (s *PrepSubsystem) registerForgeCommands() core.Result { c := s.Core() - c.Command("issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet}) - c.Command("agentic:issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet}) - c.Command("issue/list", core.Command{Description: "List Forge issues for a repo", Action: s.cmdIssueList}) - c.Command("agentic:issue/list", core.Command{Description: "List Forge issues for a repo", Action: s.cmdIssueList}) - c.Command("issue/comment", core.Command{Description: "Comment on a Forge issue", Action: s.cmdIssueComment}) - c.Command("agentic:issue/comment", core.Command{Description: "Comment on a Forge issue", Action: s.cmdIssueComment}) - c.Command("issue/create", core.Command{Description: "Create a Forge issue", Action: s.cmdIssueCreate}) - c.Command("agentic:issue/create", core.Command{Description: "Create a Forge issue", Action: s.cmdIssueCreate}) - c.Command("issue/assign", core.Command{Description: "Assign a Forge issue", Action: s.cmdIssueAssign}) - c.Command("agentic:issue/assign", core.Command{Description: "Assign a Forge issue", Action: s.cmdIssueAssign}) - c.Command("issue/report", core.Command{Description: "Post a structured report to a Forge issue", Action: s.cmdIssueReport}) - c.Command("agentic:issue/report", core.Command{Description: "Post a structured report to a Forge issue", Action: s.cmdIssueReport}) - c.Command("issue/update", core.Command{Description: "Update a tracked platform issue", Action: s.cmdIssueUpdate}) - c.Command("agentic:issue/update", core.Command{Description: "Update a tracked platform issue", Action: s.cmdIssueUpdate}) - c.Command("issue/archive", core.Command{Description: "Archive a tracked platform issue", Action: s.cmdIssueArchive}) - c.Command("agentic:issue/archive", core.Command{Description: "Archive a tracked platform issue", Action: s.cmdIssueArchive}) - c.Command("pr/get", core.Command{Description: "Get a Forge PR", Action: s.cmdPRGet}) - c.Command("agentic:pr/get", core.Command{Description: "Get a Forge PR", Action: s.cmdPRGet}) - c.Command("pr/list", core.Command{Description: "List Forge PRs for a repo", Action: s.cmdPRList}) - c.Command("agentic:pr/list", core.Command{Description: "List Forge PRs for a repo", Action: s.cmdPRList}) - c.Command("pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge}) - c.Command("agentic:pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge}) - c.Command("pr/close", core.Command{Description: "Close a Forge PR", Action: s.cmdPRClose}) - c.Command("agentic:pr/close", core.Command{Description: "Close a Forge PR", Action: s.cmdPRClose}) - c.Command("repo/get", core.Command{Description: "Get Forge repo info", Action: s.cmdRepoGet}) - c.Command("agentic:repo/get", core.Command{Description: "Get Forge repo info", Action: s.cmdRepoGet}) - c.Command("repo/list", core.Command{Description: "List Forge repos for an org", Action: s.cmdRepoList}) - c.Command("agentic:repo/list", core.Command{Description: "List Forge repos for an org", Action: s.cmdRepoList}) - c.Command("repo/sync", core.Command{Description: "Fetch and optionally reset a local repo from origin", Action: s.cmdRepoSync}) - c.Command("agentic:repo/sync", core.Command{Description: "Fetch and optionally reset a local repo from origin", Action: s.cmdRepoSync}) - c.Command("branch/delete", core.Command{Description: "Delete a branch on Forge", Action: s.cmdBranchDelete}) - c.Command("agentic:branch/delete", core.Command{Description: "Delete a branch on Forge", Action: s.cmdBranchDelete}) + if r := c.Command("issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet}); !r.OK { + return r + } + if r := c.Command("agentic:issue/get", core.Command{Description: "Get a Forge issue", Action: s.cmdIssueGet}); !r.OK { + return r + } + if r := c.Command("issue/list", core.Command{Description: "List Forge issues for a repo", Action: s.cmdIssueList}); !r.OK { + return r + } + if r := c.Command("agentic:issue/list", core.Command{Description: "List Forge issues for a repo", Action: s.cmdIssueList}); !r.OK { + return r + } + if r := c.Command("issue/comment", core.Command{Description: "Comment on a Forge issue", Action: s.cmdIssueComment}); !r.OK { + return r + } + if r := c.Command("agentic:issue/comment", core.Command{Description: "Comment on a Forge issue", Action: s.cmdIssueComment}); !r.OK { + return r + } + if r := c.Command("issue/create", core.Command{Description: "Create a Forge issue", Action: s.cmdIssueCreate}); !r.OK { + return r + } + if r := c.Command("agentic:issue/create", core.Command{Description: "Create a Forge issue", Action: s.cmdIssueCreate}); !r.OK { + return r + } + if r := c.Command("issue/assign", core.Command{Description: "Assign a Forge issue", Action: s.cmdIssueAssign}); !r.OK { + return r + } + if r := c.Command("agentic:issue/assign", core.Command{Description: "Assign a Forge issue", Action: s.cmdIssueAssign}); !r.OK { + return r + } + if r := c.Command("issue/report", core.Command{Description: "Post a structured report to a Forge issue", Action: s.cmdIssueReport}); !r.OK { + return r + } + if r := c.Command("agentic:issue/report", core.Command{Description: "Post a structured report to a Forge issue", Action: s.cmdIssueReport}); !r.OK { + return r + } + if r := c.Command("issue/update", core.Command{Description: "Update a tracked platform issue", Action: s.cmdIssueUpdate}); !r.OK { + return r + } + if r := c.Command("agentic:issue/update", core.Command{Description: "Update a tracked platform issue", Action: s.cmdIssueUpdate}); !r.OK { + return r + } + if r := c.Command("issue/archive", core.Command{Description: "Archive a tracked platform issue", Action: s.cmdIssueArchive}); !r.OK { + return r + } + if r := c.Command("agentic:issue/archive", core.Command{Description: "Archive a tracked platform issue", Action: s.cmdIssueArchive}); !r.OK { + return r + } + if r := c.Command("pr/get", core.Command{Description: "Get a Forge PR", Action: s.cmdPRGet}); !r.OK { + return r + } + if r := c.Command("agentic:pr/get", core.Command{Description: "Get a Forge PR", Action: s.cmdPRGet}); !r.OK { + return r + } + if r := c.Command("pr/list", core.Command{Description: "List Forge PRs for a repo", Action: s.cmdPRList}); !r.OK { + return r + } + if r := c.Command("agentic:pr/list", core.Command{Description: "List Forge PRs for a repo", Action: s.cmdPRList}); !r.OK { + return r + } + if r := c.Command("pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge}); !r.OK { + return r + } + if r := c.Command("agentic:pr/merge", core.Command{Description: "Merge a Forge PR", Action: s.cmdPRMerge}); !r.OK { + return r + } + if r := c.Command("pr/close", core.Command{Description: "Close a Forge PR", Action: s.cmdPRClose}); !r.OK { + return r + } + if r := c.Command("agentic:pr/close", core.Command{Description: "Close a Forge PR", Action: s.cmdPRClose}); !r.OK { + return r + } + if r := c.Command("repo/get", core.Command{Description: "Get Forge repo info", Action: s.cmdRepoGet}); !r.OK { + return r + } + if r := c.Command("agentic:repo/get", core.Command{Description: "Get Forge repo info", Action: s.cmdRepoGet}); !r.OK { + return r + } + if r := c.Command("repo/list", core.Command{Description: "List Forge repos for an org", Action: s.cmdRepoList}); !r.OK { + return r + } + if r := c.Command("agentic:repo/list", core.Command{Description: "List Forge repos for an org", Action: s.cmdRepoList}); !r.OK { + return r + } + if r := c.Command("branch/delete", core.Command{Description: "Delete a branch on Forge", Action: s.cmdBranchDelete}); !r.OK { + return r + } + if r := c.Command("agentic:branch/delete", core.Command{Description: "Delete a branch on Forge", Action: s.cmdBranchDelete}); !r.OK { + return r + } + if !c.Command("repo/sync").OK { + if r := c.Command("repo/sync", core.Command{Description: "Fetch and optionally reset a local repo from origin", Action: s.cmdRepoSync}); !r.OK { + return r + } + } + if !c.Command("agentic:repo/sync").OK { + if r := c.Command("agentic:repo/sync", core.Command{Description: "Fetch and optionally reset a local repo from origin", Action: s.cmdRepoSync}); !r.OK { + return r + } + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdIssueGet(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_phase.go b/go/pkg/agentic/commands_phase.go index badf9bb1..d1d254bd 100644 --- a/go/pkg/agentic/commands_phase.go +++ b/go/pkg/agentic/commands_phase.go @@ -6,20 +6,45 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerPhaseCommands() { +func (s *PrepSubsystem) registerPhaseCommands() core.Result { c := s.Core() - c.Command("phase", core.Command{Description: "Manage plan phases", Action: s.cmdPhase}) - c.Command("agentic:phase", core.Command{Description: "Manage plan phases", Action: s.cmdPhase}) - c.Command("phase/get", core.Command{Description: "Read a plan phase by slug and order", Action: s.cmdPhaseGet}) - c.Command("agentic:phase/get", core.Command{Description: "Read a plan phase by slug and order", Action: s.cmdPhaseGet}) - c.Command("phase/update_status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}) - c.Command("agentic:phase/update_status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}) - c.Command("phase/update-status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}) - c.Command("agentic:phase/update-status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}) - c.Command("phase/add_checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}) - c.Command("agentic:phase/add_checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}) - c.Command("phase/add-checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}) - c.Command("agentic:phase/add-checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}) + if r := c.Command("phase", core.Command{Description: "Manage plan phases", Action: s.cmdPhase}); !r.OK { + return r + } + if r := c.Command("agentic:phase", core.Command{Description: "Manage plan phases", Action: s.cmdPhase}); !r.OK { + return r + } + if r := c.Command("phase/get", core.Command{Description: "Read a plan phase by slug and order", Action: s.cmdPhaseGet}); !r.OK { + return r + } + if r := c.Command("agentic:phase/get", core.Command{Description: "Read a plan phase by slug and order", Action: s.cmdPhaseGet}); !r.OK { + return r + } + if r := c.Command("phase/update_status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}); !r.OK { + return r + } + if r := c.Command("agentic:phase/update_status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}); !r.OK { + return r + } + if r := c.Command("phase/update-status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}); !r.OK { + return r + } + if r := c.Command("agentic:phase/update-status", core.Command{Description: "Update a plan phase status by slug and order", Action: s.cmdPhaseUpdateStatus}); !r.OK { + return r + } + if r := c.Command("phase/add_checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}); !r.OK { + return r + } + if r := c.Command("agentic:phase/add_checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}); !r.OK { + return r + } + if r := c.Command("phase/add-checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}); !r.OK { + return r + } + if r := c.Command("agentic:phase/add-checkpoint", core.Command{Description: "Append a checkpoint note to a plan phase", Action: s.cmdPhaseAddCheckpoint}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdPhase(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_plan.go b/go/pkg/agentic/commands_plan.go index 9bbd48b3..836f41a2 100644 --- a/go/pkg/agentic/commands_plan.go +++ b/go/pkg/agentic/commands_plan.go @@ -6,36 +6,93 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerPlanCommands() { +func (s *PrepSubsystem) registerPlanCommands() core.Result { c := s.Core() - c.Command("plan", core.Command{Description: "Manage implementation plans", Action: s.cmdPlan}) - c.Command("agentic:plan", core.Command{Description: "Manage implementation plans", Action: s.cmdPlan}) - c.Command("plan/templates", core.Command{Description: "List available plan templates", Action: s.cmdPlanTemplates}) - c.Command("agentic:plan/templates", core.Command{Description: "List available plan templates", Action: s.cmdPlanTemplates}) - c.Command("plan/create", core.Command{Description: "Create an implementation plan or create one from a template", Action: s.cmdPlanCreate}) - c.Command("agentic:plan/create", core.Command{Description: "Create an implementation plan or create one from a template", Action: s.cmdPlanCreate}) - c.Command("plan/from-issue", core.Command{Description: "Create an implementation plan from a tracked issue", Action: s.cmdPlanFromIssue}) - c.Command("agentic:plan/from-issue", core.Command{Description: "Create an implementation plan from a tracked issue", Action: s.cmdPlanFromIssue}) - c.Command("plan/list", core.Command{Description: "List implementation plans", Action: s.cmdPlanList}) - c.Command("agentic:plan/list", core.Command{Description: "List implementation plans", Action: s.cmdPlanList}) - c.Command("agentic:plan/get", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}) - c.Command("plan/get", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}) - c.Command("agentic:plan/read", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}) - c.Command("plan/read", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}) - c.Command("plan/show", core.Command{Description: "Show an implementation plan", Action: s.cmdPlanShow}) - c.Command("agentic:plan/show", core.Command{Description: "Show an implementation plan", Action: s.cmdPlanShow}) - c.Command("plan/update", core.Command{Description: "Update an implementation plan", Action: s.cmdPlanUpdate}) - c.Command("agentic:plan/update", core.Command{Description: "Update an implementation plan", Action: s.cmdPlanUpdate}) - c.Command("plan/status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}) - c.Command("agentic:plan/status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}) - c.Command("plan/update_status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}) - c.Command("agentic:plan/update_status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}) - c.Command("plan/check", core.Command{Description: "Check whether a plan or phase is complete", Action: s.cmdPlanCheck}) - c.Command("agentic:plan/check", core.Command{Description: "Check whether a plan or phase is complete", Action: s.cmdPlanCheck}) - c.Command("plan/archive", core.Command{Description: "Archive an implementation plan by slug or ID", Action: s.cmdPlanArchive}) - c.Command("agentic:plan/archive", core.Command{Description: "Archive an implementation plan by slug or ID", Action: s.cmdPlanArchive}) - c.Command("plan/delete", core.Command{Description: "Delete an implementation plan by ID", Action: s.cmdPlanDelete}) - c.Command("agentic:plan/delete", core.Command{Description: "Delete an implementation plan by ID", Action: s.cmdPlanDelete}) + if r := c.Command("plan", core.Command{Description: "Manage implementation plans", Action: s.cmdPlan}); !r.OK { + return r + } + if r := c.Command("agentic:plan", core.Command{Description: "Manage implementation plans", Action: s.cmdPlan}); !r.OK { + return r + } + if r := c.Command("plan/templates", core.Command{Description: "List available plan templates", Action: s.cmdPlanTemplates}); !r.OK { + return r + } + if r := c.Command("agentic:plan/templates", core.Command{Description: "List available plan templates", Action: s.cmdPlanTemplates}); !r.OK { + return r + } + if r := c.Command("plan/create", core.Command{Description: "Create an implementation plan or create one from a template", Action: s.cmdPlanCreate}); !r.OK { + return r + } + if r := c.Command("agentic:plan/create", core.Command{Description: "Create an implementation plan or create one from a template", Action: s.cmdPlanCreate}); !r.OK { + return r + } + if r := c.Command("plan/from-issue", core.Command{Description: "Create an implementation plan from a tracked issue", Action: s.cmdPlanFromIssue}); !r.OK { + return r + } + if r := c.Command("agentic:plan/from-issue", core.Command{Description: "Create an implementation plan from a tracked issue", Action: s.cmdPlanFromIssue}); !r.OK { + return r + } + if r := c.Command("plan/list", core.Command{Description: "List implementation plans", Action: s.cmdPlanList}); !r.OK { + return r + } + if r := c.Command("agentic:plan/list", core.Command{Description: "List implementation plans", Action: s.cmdPlanList}); !r.OK { + return r + } + if r := c.Command("agentic:plan/get", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("plan/get", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("agentic:plan/read", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("plan/read", core.Command{Description: "Read an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("plan/show", core.Command{Description: "Show an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("agentic:plan/show", core.Command{Description: "Show an implementation plan", Action: s.cmdPlanShow}); !r.OK { + return r + } + if r := c.Command("plan/update", core.Command{Description: "Update an implementation plan", Action: s.cmdPlanUpdate}); !r.OK { + return r + } + if r := c.Command("agentic:plan/update", core.Command{Description: "Update an implementation plan", Action: s.cmdPlanUpdate}); !r.OK { + return r + } + if r := c.Command("plan/status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}); !r.OK { + return r + } + if r := c.Command("agentic:plan/status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}); !r.OK { + return r + } + if r := c.Command("plan/update_status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}); !r.OK { + return r + } + if r := c.Command("agentic:plan/update_status", core.Command{Description: "Read or update an implementation plan status", Action: s.cmdPlanStatus}); !r.OK { + return r + } + if r := c.Command("plan/check", core.Command{Description: "Check whether a plan or phase is complete", Action: s.cmdPlanCheck}); !r.OK { + return r + } + if r := c.Command("agentic:plan/check", core.Command{Description: "Check whether a plan or phase is complete", Action: s.cmdPlanCheck}); !r.OK { + return r + } + if r := c.Command("plan/archive", core.Command{Description: "Archive an implementation plan by slug or ID", Action: s.cmdPlanArchive}); !r.OK { + return r + } + if r := c.Command("agentic:plan/archive", core.Command{Description: "Archive an implementation plan by slug or ID", Action: s.cmdPlanArchive}); !r.OK { + return r + } + if r := c.Command("plan/delete", core.Command{Description: "Delete an implementation plan by ID", Action: s.cmdPlanDelete}); !r.OK { + return r + } + if r := c.Command("agentic:plan/delete", core.Command{Description: "Delete an implementation plan by ID", Action: s.cmdPlanDelete}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdPlan(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_platform.go b/go/pkg/agentic/commands_platform.go index d2457074..1cd70892 100644 --- a/go/pkg/agentic/commands_platform.go +++ b/go/pkg/agentic/commands_platform.go @@ -6,69 +6,191 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerPlatformCommands() { +func (s *PrepSubsystem) registerPlatformCommands() core.Result { c := s.Core() - c.Command("sync/push", core.Command{Description: "Push completed dispatch state to the platform API", Action: s.cmdSyncPush}) - c.Command("agentic:sync/push", core.Command{Description: "Push completed dispatch state to the platform API", Action: s.cmdSyncPush}) - c.Command("sync/pull", core.Command{Description: "Pull shared fleet context from the platform API", Action: s.cmdSyncPull}) - c.Command("agentic:sync/pull", core.Command{Description: "Pull shared fleet context from the platform API", Action: s.cmdSyncPull}) - c.Command("sync/status", core.Command{Description: "Show platform sync status for the current or named agent", Action: s.cmdSyncStatus}) - c.Command("agentic:sync/status", core.Command{Description: "Show platform sync status for the current or named agent", Action: s.cmdSyncStatus}) - c.Command("auth/provision", core.Command{Description: "Provision a platform API key for an authenticated agent user", Action: s.cmdAuthProvision}) - c.Command("agentic:auth/provision", core.Command{Description: "Provision a platform API key for an authenticated agent user", Action: s.cmdAuthProvision}) - c.Command("auth/revoke", core.Command{Description: "Revoke a platform API key", Action: s.cmdAuthRevoke}) - c.Command("agentic:auth/revoke", core.Command{Description: "Revoke a platform API key", Action: s.cmdAuthRevoke}) - c.Command("login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}) - c.Command("auth/login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}) - c.Command("agentic:login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}) - c.Command("agentic:auth/login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}) - c.Command("message/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}) - c.Command("messages/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}) - c.Command("agentic:message/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}) - c.Command("agentic:messages/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}) - c.Command("message/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}) - c.Command("messages/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}) - c.Command("agentic:message/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}) - c.Command("agentic:messages/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}) - c.Command("message/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}) - c.Command("messages/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}) - c.Command("agentic:message/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}) - c.Command("agentic:messages/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}) - - c.Command("fleet/register", core.Command{Description: "Register a fleet node with the platform API", Action: s.cmdFleetRegister}) - c.Command("agentic:fleet/register", core.Command{Description: "Register a fleet node with the platform API", Action: s.cmdFleetRegister}) - c.Command("fleet/heartbeat", core.Command{Description: "Send a heartbeat for a registered fleet node", Action: s.cmdFleetHeartbeat}) - c.Command("agentic:fleet/heartbeat", core.Command{Description: "Send a heartbeat for a registered fleet node", Action: s.cmdFleetHeartbeat}) - c.Command("fleet/deregister", core.Command{Description: "Deregister a fleet node from the platform API", Action: s.cmdFleetDeregister}) - c.Command("agentic:fleet/deregister", core.Command{Description: "Deregister a fleet node from the platform API", Action: s.cmdFleetDeregister}) - c.Command("fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodes}) - c.Command("agentic:fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodes}) - c.Command("fleet/task/assign", core.Command{Description: "Assign a task to a fleet node", Action: s.cmdFleetTaskAssign}) - c.Command("agentic:fleet/task/assign", core.Command{Description: "Assign a task to a fleet node", Action: s.cmdFleetTaskAssign}) - c.Command("fleet/task/complete", core.Command{Description: "Complete a fleet task and report findings", Action: s.cmdFleetTaskComplete}) - c.Command("agentic:fleet/task/complete", core.Command{Description: "Complete a fleet task and report findings", Action: s.cmdFleetTaskComplete}) - c.Command("fleet/task/next", core.Command{Description: "Ask the platform for the next fleet task", Action: s.cmdFleetTaskNext}) - c.Command("agentic:fleet/task/next", core.Command{Description: "Ask the platform for the next fleet task", Action: s.cmdFleetTaskNext}) - c.Command("fleet/stats", core.Command{Description: "Show fleet activity statistics", Action: s.cmdFleetStats}) - c.Command("agentic:fleet/stats", core.Command{Description: "Show fleet activity statistics", Action: s.cmdFleetStats}) - c.Command("fleet/events", core.Command{Description: "Read the next fleet event from the platform SSE stream, falling back to polling when needed", Action: s.cmdFleetEvents}) - c.Command("agentic:fleet/events", core.Command{Description: "Read the next fleet event from the platform SSE stream, falling back to polling when needed", Action: s.cmdFleetEvents}) - - c.Command("credits/award", core.Command{Description: "Award credits to a fleet node", Action: s.cmdCreditsAward}) - c.Command("agentic:credits/award", core.Command{Description: "Award credits to a fleet node", Action: s.cmdCreditsAward}) - c.Command("credits/balance", core.Command{Description: "Show credit balance for a fleet node", Action: s.cmdCreditsBalance}) - c.Command("agentic:credits/balance", core.Command{Description: "Show credit balance for a fleet node", Action: s.cmdCreditsBalance}) - c.Command("credits/history", core.Command{Description: "Show credit history for a fleet node", Action: s.cmdCreditsHistory}) - c.Command("agentic:credits/history", core.Command{Description: "Show credit history for a fleet node", Action: s.cmdCreditsHistory}) - - c.Command("subscription/detect", core.Command{Description: "Detect available provider capabilities", Action: s.cmdSubscriptionDetect}) - c.Command("agentic:subscription/detect", core.Command{Description: "Detect available provider capabilities", Action: s.cmdSubscriptionDetect}) - c.Command("subscription/budget", core.Command{Description: "Show compute budget for a fleet node", Action: s.cmdSubscriptionBudget}) - c.Command("agentic:subscription/budget", core.Command{Description: "Show compute budget for a fleet node", Action: s.cmdSubscriptionBudget}) - c.Command("subscription/budget/update", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}) - c.Command("subscription/update-budget", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}) - c.Command("agentic:subscription/budget/update", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}) - c.Command("agentic:subscription/update-budget", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}) + if r := c.Command("sync/push", core.Command{Description: "Push completed dispatch state to the platform API", Action: s.cmdSyncPush}); !r.OK { + return r + } + if r := c.Command("agentic:sync/push", core.Command{Description: "Push completed dispatch state to the platform API", Action: s.cmdSyncPush}); !r.OK { + return r + } + if r := c.Command("sync/pull", core.Command{Description: "Pull shared fleet context from the platform API", Action: s.cmdSyncPull}); !r.OK { + return r + } + if r := c.Command("agentic:sync/pull", core.Command{Description: "Pull shared fleet context from the platform API", Action: s.cmdSyncPull}); !r.OK { + return r + } + if r := c.Command("sync/status", core.Command{Description: "Show platform sync status for the current or named agent", Action: s.cmdSyncStatus}); !r.OK { + return r + } + if r := c.Command("agentic:sync/status", core.Command{Description: "Show platform sync status for the current or named agent", Action: s.cmdSyncStatus}); !r.OK { + return r + } + if r := c.Command("auth/provision", core.Command{Description: "Provision a platform API key for an authenticated agent user", Action: s.cmdAuthProvision}); !r.OK { + return r + } + if r := c.Command("agentic:auth/provision", core.Command{Description: "Provision a platform API key for an authenticated agent user", Action: s.cmdAuthProvision}); !r.OK { + return r + } + if r := c.Command("auth/revoke", core.Command{Description: "Revoke a platform API key", Action: s.cmdAuthRevoke}); !r.OK { + return r + } + if r := c.Command("agentic:auth/revoke", core.Command{Description: "Revoke a platform API key", Action: s.cmdAuthRevoke}); !r.OK { + return r + } + if r := c.Command("auth/login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}); !r.OK { + return r + } + if r := c.Command("agentic:auth/login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}); !r.OK { + return r + } + if r := c.Command("message/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}); !r.OK { + return r + } + if r := c.Command("messages/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}); !r.OK { + return r + } + if r := c.Command("agentic:message/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}); !r.OK { + return r + } + if r := c.Command("agentic:messages/send", core.Command{Description: "Send a direct message to another agent", Action: s.cmdMessageSend}); !r.OK { + return r + } + if r := c.Command("message/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}); !r.OK { + return r + } + if r := c.Command("messages/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}); !r.OK { + return r + } + if r := c.Command("agentic:message/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}); !r.OK { + return r + } + if r := c.Command("agentic:messages/inbox", core.Command{Description: "List direct messages for an agent", Action: s.cmdMessageInbox}); !r.OK { + return r + } + if r := c.Command("message/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}); !r.OK { + return r + } + if r := c.Command("messages/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}); !r.OK { + return r + } + if r := c.Command("agentic:message/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}); !r.OK { + return r + } + if r := c.Command("agentic:messages/conversation", core.Command{Description: "List a direct conversation between two agents", Action: s.cmdMessageConversation}); !r.OK { + return r + } + if r := c.Command("fleet/register", core.Command{Description: "Register a fleet node with the platform API", Action: s.cmdFleetRegister}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/register", core.Command{Description: "Register a fleet node with the platform API", Action: s.cmdFleetRegister}); !r.OK { + return r + } + if r := c.Command("fleet/heartbeat", core.Command{Description: "Send a heartbeat for a registered fleet node", Action: s.cmdFleetHeartbeat}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/heartbeat", core.Command{Description: "Send a heartbeat for a registered fleet node", Action: s.cmdFleetHeartbeat}); !r.OK { + return r + } + if r := c.Command("fleet/deregister", core.Command{Description: "Deregister a fleet node from the platform API", Action: s.cmdFleetDeregister}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/deregister", core.Command{Description: "Deregister a fleet node from the platform API", Action: s.cmdFleetDeregister}); !r.OK { + return r + } + if r := c.Command("fleet/task/assign", core.Command{Description: "Assign a task to a fleet node", Action: s.cmdFleetTaskAssign}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/task/assign", core.Command{Description: "Assign a task to a fleet node", Action: s.cmdFleetTaskAssign}); !r.OK { + return r + } + if r := c.Command("fleet/task/complete", core.Command{Description: "Complete a fleet task and report findings", Action: s.cmdFleetTaskComplete}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/task/complete", core.Command{Description: "Complete a fleet task and report findings", Action: s.cmdFleetTaskComplete}); !r.OK { + return r + } + if r := c.Command("fleet/task/next", core.Command{Description: "Ask the platform for the next fleet task", Action: s.cmdFleetTaskNext}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/task/next", core.Command{Description: "Ask the platform for the next fleet task", Action: s.cmdFleetTaskNext}); !r.OK { + return r + } + if r := c.Command("fleet/stats", core.Command{Description: "Show fleet activity statistics", Action: s.cmdFleetStats}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/stats", core.Command{Description: "Show fleet activity statistics", Action: s.cmdFleetStats}); !r.OK { + return r + } + if r := c.Command("fleet/events", core.Command{Description: "Read the next fleet event from the platform SSE stream, falling back to polling when needed", Action: s.cmdFleetEvents}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/events", core.Command{Description: "Read the next fleet event from the platform SSE stream, falling back to polling when needed", Action: s.cmdFleetEvents}); !r.OK { + return r + } + if r := c.Command("credits/award", core.Command{Description: "Award credits to a fleet node", Action: s.cmdCreditsAward}); !r.OK { + return r + } + if r := c.Command("agentic:credits/award", core.Command{Description: "Award credits to a fleet node", Action: s.cmdCreditsAward}); !r.OK { + return r + } + if r := c.Command("credits/balance", core.Command{Description: "Show credit balance for a fleet node", Action: s.cmdCreditsBalance}); !r.OK { + return r + } + if r := c.Command("agentic:credits/balance", core.Command{Description: "Show credit balance for a fleet node", Action: s.cmdCreditsBalance}); !r.OK { + return r + } + if r := c.Command("credits/history", core.Command{Description: "Show credit history for a fleet node", Action: s.cmdCreditsHistory}); !r.OK { + return r + } + if r := c.Command("agentic:credits/history", core.Command{Description: "Show credit history for a fleet node", Action: s.cmdCreditsHistory}); !r.OK { + return r + } + if r := c.Command("subscription/detect", core.Command{Description: "Detect available provider capabilities", Action: s.cmdSubscriptionDetect}); !r.OK { + return r + } + if r := c.Command("agentic:subscription/detect", core.Command{Description: "Detect available provider capabilities", Action: s.cmdSubscriptionDetect}); !r.OK { + return r + } + if r := c.Command("subscription/budget", core.Command{Description: "Show compute budget for a fleet node", Action: s.cmdSubscriptionBudget}); !r.OK { + return r + } + if r := c.Command("agentic:subscription/budget", core.Command{Description: "Show compute budget for a fleet node", Action: s.cmdSubscriptionBudget}); !r.OK { + return r + } + if r := c.Command("subscription/budget/update", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}); !r.OK { + return r + } + if r := c.Command("subscription/update-budget", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}); !r.OK { + return r + } + if r := c.Command("agentic:subscription/budget/update", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}); !r.OK { + return r + } + if r := c.Command("agentic:subscription/update-budget", core.Command{Description: "Update compute budget for a fleet node", Action: s.cmdSubscriptionUpdateBudget}); !r.OK { + return r + } + if !c.Command("login").OK { + if r := c.Command("login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}); !r.OK { + return r + } + } + if !c.Command("agentic:login").OK { + if r := c.Command("agentic:login", core.Command{Description: "Exchange a 6-digit pairing code (from app.lthn.ai/device) for an AgentApiKey", Action: s.cmdAuthLogin}); !r.OK { + return r + } + } + if !c.Command("fleet/nodes").OK { + if r := c.Command("fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodes}); !r.OK { + return r + } + } + if !c.Command("agentic:fleet/nodes").OK { + if r := c.Command("agentic:fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodes}); !r.OK { + return r + } + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdAuthProvision(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_session.go b/go/pkg/agentic/commands_session.go index 560f24a5..f085ed2a 100644 --- a/go/pkg/agentic/commands_session.go +++ b/go/pkg/agentic/commands_session.go @@ -6,30 +6,75 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerSessionCommands() { +func (s *PrepSubsystem) registerSessionCommands() core.Result { c := s.Core() - c.Command("session/get", core.Command{Description: "Read a stored session by session ID", Action: s.cmdSessionGet}) - c.Command("agentic:session/get", core.Command{Description: "Read a stored session by session ID", Action: s.cmdSessionGet}) - c.Command("session/list", core.Command{Description: "List stored sessions with optional filters", Action: s.cmdSessionList}) - c.Command("agentic:session/list", core.Command{Description: "List stored sessions with optional filters", Action: s.cmdSessionList}) - c.Command("session/start", core.Command{Description: "Start a stored session for a plan", Action: s.cmdSessionStart}) - c.Command("agentic:session/start", core.Command{Description: "Start a stored session for a plan", Action: s.cmdSessionStart}) - c.Command("session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}) - c.Command("agentic:session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}) - c.Command("session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}) - c.Command("agentic:session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}) - c.Command("session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}) - c.Command("agentic:session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}) - c.Command("session/complete", core.Command{Description: "Mark a stored session completed with status, summary, and handoff notes", Action: s.cmdSessionEnd}) - c.Command("agentic:session/complete", core.Command{Description: "Mark a stored session completed with status, summary, and handoff notes", Action: s.cmdSessionEnd}) - c.Command("session/log", core.Command{Description: "Add a work log entry to a stored session", Action: s.cmdSessionLog}) - c.Command("agentic:session/log", core.Command{Description: "Add a work log entry to a stored session", Action: s.cmdSessionLog}) - c.Command("session/artifact", core.Command{Description: "Record a created, modified, deleted, or reviewed artifact for a stored session", Action: s.cmdSessionArtifact}) - c.Command("agentic:session/artifact", core.Command{Description: "Record a created, modified, deleted, or reviewed artifact for a stored session", Action: s.cmdSessionArtifact}) - c.Command("session/resume", core.Command{Description: "Resume a paused or handed-off session from local cache", Action: s.cmdSessionResume}) - c.Command("agentic:session/resume", core.Command{Description: "Resume a paused or handed-off session from local cache", Action: s.cmdSessionResume}) - c.Command("session/replay", core.Command{Description: "Build replay context for a stored session", Action: s.cmdSessionReplay}) - c.Command("agentic:session/replay", core.Command{Description: "Build replay context for a stored session", Action: s.cmdSessionReplay}) + if r := c.Command("session/get", core.Command{Description: "Read a stored session by session ID", Action: s.cmdSessionGet}); !r.OK { + return r + } + if r := c.Command("agentic:session/get", core.Command{Description: "Read a stored session by session ID", Action: s.cmdSessionGet}); !r.OK { + return r + } + if r := c.Command("session/list", core.Command{Description: "List stored sessions with optional filters", Action: s.cmdSessionList}); !r.OK { + return r + } + if r := c.Command("agentic:session/list", core.Command{Description: "List stored sessions with optional filters", Action: s.cmdSessionList}); !r.OK { + return r + } + if r := c.Command("session/start", core.Command{Description: "Start a stored session for a plan", Action: s.cmdSessionStart}); !r.OK { + return r + } + if r := c.Command("agentic:session/start", core.Command{Description: "Start a stored session for a plan", Action: s.cmdSessionStart}); !r.OK { + return r + } + if r := c.Command("session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}); !r.OK { + return r + } + if r := c.Command("agentic:session/continue", core.Command{Description: "Continue a stored session from saved context", Action: s.cmdSessionContinue}); !r.OK { + return r + } + if r := c.Command("session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}); !r.OK { + return r + } + if r := c.Command("agentic:session/handoff", core.Command{Description: "Hand off a stored session with context for the next agent", Action: s.cmdSessionHandoff}); !r.OK { + return r + } + if r := c.Command("session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}); !r.OK { + return r + } + if r := c.Command("agentic:session/end", core.Command{Description: "End a stored session with status, summary, and handoff notes", Action: s.cmdSessionEnd}); !r.OK { + return r + } + if r := c.Command("session/complete", core.Command{Description: "Mark a stored session completed with status, summary, and handoff notes", Action: s.cmdSessionEnd}); !r.OK { + return r + } + if r := c.Command("agentic:session/complete", core.Command{Description: "Mark a stored session completed with status, summary, and handoff notes", Action: s.cmdSessionEnd}); !r.OK { + return r + } + if r := c.Command("session/log", core.Command{Description: "Add a work log entry to a stored session", Action: s.cmdSessionLog}); !r.OK { + return r + } + if r := c.Command("agentic:session/log", core.Command{Description: "Add a work log entry to a stored session", Action: s.cmdSessionLog}); !r.OK { + return r + } + if r := c.Command("session/artifact", core.Command{Description: "Record a created, modified, deleted, or reviewed artifact for a stored session", Action: s.cmdSessionArtifact}); !r.OK { + return r + } + if r := c.Command("agentic:session/artifact", core.Command{Description: "Record a created, modified, deleted, or reviewed artifact for a stored session", Action: s.cmdSessionArtifact}); !r.OK { + return r + } + if r := c.Command("session/resume", core.Command{Description: "Resume a paused or handed-off session from local cache", Action: s.cmdSessionResume}); !r.OK { + return r + } + if r := c.Command("agentic:session/resume", core.Command{Description: "Resume a paused or handed-off session from local cache", Action: s.cmdSessionResume}); !r.OK { + return r + } + if r := c.Command("session/replay", core.Command{Description: "Build replay context for a stored session", Action: s.cmdSessionReplay}); !r.OK { + return r + } + if r := c.Command("agentic:session/replay", core.Command{Description: "Build replay context for a stored session", Action: s.cmdSessionReplay}); !r.OK { + return r + } + return core.Ok(nil) } // core-agent session get ses-abc123 diff --git a/go/pkg/agentic/commands_setup.go b/go/pkg/agentic/commands_setup.go index c5f8aadd..fec31a57 100644 --- a/go/pkg/agentic/commands_setup.go +++ b/go/pkg/agentic/commands_setup.go @@ -11,10 +11,15 @@ import ( "github.com/modelcontextprotocol/go-sdk/mcp" ) -func (s *PrepSubsystem) registerSetupCommands() { +func (s *PrepSubsystem) registerSetupCommands() core.Result { c := s.Core() - c.Command("setup", core.Command{Description: "Scaffold a workspace with .core config files and optional templates", Action: s.cmdSetup}) - c.Command("agentic:setup", core.Command{Description: "Scaffold a workspace with .core config files and optional templates", Action: s.cmdSetup}) + if r := c.Command("setup", core.Command{Description: "Scaffold a workspace with .core config files and optional templates", Action: s.cmdSetup}); !r.OK { + return r + } + if r := c.Command("agentic:setup", core.Command{Description: "Scaffold a workspace with .core config files and optional templates", Action: s.cmdSetup}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdSetup(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_sprint.go b/go/pkg/agentic/commands_sprint.go index ade3071c..113e7281 100644 --- a/go/pkg/agentic/commands_sprint.go +++ b/go/pkg/agentic/commands_sprint.go @@ -6,20 +6,45 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerSprintCommands() { +func (s *PrepSubsystem) registerSprintCommands() core.Result { c := s.Core() - c.Command("sprint", core.Command{Description: "Manage tracked platform sprints", Action: s.cmdSprint}) - c.Command("agentic:sprint", core.Command{Description: "Manage tracked platform sprints", Action: s.cmdSprint}) - c.Command("sprint/create", core.Command{Description: "Create a tracked platform sprint", Action: s.cmdSprintCreate}) - c.Command("agentic:sprint/create", core.Command{Description: "Create a tracked platform sprint", Action: s.cmdSprintCreate}) - c.Command("sprint/get", core.Command{Description: "Read a tracked platform sprint by slug or ID", Action: s.cmdSprintGet}) - c.Command("agentic:sprint/get", core.Command{Description: "Read a tracked platform sprint by slug or ID", Action: s.cmdSprintGet}) - c.Command("sprint/list", core.Command{Description: "List tracked platform sprints", Action: s.cmdSprintList}) - c.Command("agentic:sprint/list", core.Command{Description: "List tracked platform sprints", Action: s.cmdSprintList}) - c.Command("sprint/update", core.Command{Description: "Update a tracked platform sprint", Action: s.cmdSprintUpdate}) - c.Command("agentic:sprint/update", core.Command{Description: "Update a tracked platform sprint", Action: s.cmdSprintUpdate}) - c.Command("sprint/archive", core.Command{Description: "Archive a tracked platform sprint", Action: s.cmdSprintArchive}) - c.Command("agentic:sprint/archive", core.Command{Description: "Archive a tracked platform sprint", Action: s.cmdSprintArchive}) + if r := c.Command("sprint", core.Command{Description: "Manage tracked platform sprints", Action: s.cmdSprint}); !r.OK { + return r + } + if r := c.Command("agentic:sprint", core.Command{Description: "Manage tracked platform sprints", Action: s.cmdSprint}); !r.OK { + return r + } + if r := c.Command("sprint/create", core.Command{Description: "Create a tracked platform sprint", Action: s.cmdSprintCreate}); !r.OK { + return r + } + if r := c.Command("agentic:sprint/create", core.Command{Description: "Create a tracked platform sprint", Action: s.cmdSprintCreate}); !r.OK { + return r + } + if r := c.Command("sprint/get", core.Command{Description: "Read a tracked platform sprint by slug or ID", Action: s.cmdSprintGet}); !r.OK { + return r + } + if r := c.Command("agentic:sprint/get", core.Command{Description: "Read a tracked platform sprint by slug or ID", Action: s.cmdSprintGet}); !r.OK { + return r + } + if r := c.Command("sprint/list", core.Command{Description: "List tracked platform sprints", Action: s.cmdSprintList}); !r.OK { + return r + } + if r := c.Command("agentic:sprint/list", core.Command{Description: "List tracked platform sprints", Action: s.cmdSprintList}); !r.OK { + return r + } + if r := c.Command("sprint/update", core.Command{Description: "Update a tracked platform sprint", Action: s.cmdSprintUpdate}); !r.OK { + return r + } + if r := c.Command("agentic:sprint/update", core.Command{Description: "Update a tracked platform sprint", Action: s.cmdSprintUpdate}); !r.OK { + return r + } + if r := c.Command("sprint/archive", core.Command{Description: "Archive a tracked platform sprint", Action: s.cmdSprintArchive}); !r.OK { + return r + } + if r := c.Command("agentic:sprint/archive", core.Command{Description: "Archive a tracked platform sprint", Action: s.cmdSprintArchive}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdSprint(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_state.go b/go/pkg/agentic/commands_state.go index 9fc07747..9405095a 100644 --- a/go/pkg/agentic/commands_state.go +++ b/go/pkg/agentic/commands_state.go @@ -6,18 +6,39 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerStateCommands() { +func (s *PrepSubsystem) registerStateCommands() core.Result { c := s.Core() - c.Command("state", core.Command{Description: "Manage shared plan state", Action: s.cmdState}) - c.Command("agentic:state", core.Command{Description: "Manage shared plan state", Action: s.cmdState}) - c.Command("state/set", core.Command{Description: "Store shared plan state", Action: s.cmdStateSet}) - c.Command("agentic:state/set", core.Command{Description: "Store shared plan state", Action: s.cmdStateSet}) - c.Command("state/get", core.Command{Description: "Read shared plan state by key", Action: s.cmdStateGet}) - c.Command("agentic:state/get", core.Command{Description: "Read shared plan state by key", Action: s.cmdStateGet}) - c.Command("state/list", core.Command{Description: "List shared plan state for a plan", Action: s.cmdStateList}) - c.Command("agentic:state/list", core.Command{Description: "List shared plan state for a plan", Action: s.cmdStateList}) - c.Command("state/delete", core.Command{Description: "Delete shared plan state by key", Action: s.cmdStateDelete}) - c.Command("agentic:state/delete", core.Command{Description: "Delete shared plan state by key", Action: s.cmdStateDelete}) + if r := c.Command("state", core.Command{Description: "Manage shared plan state", Action: s.cmdState}); !r.OK { + return r + } + if r := c.Command("agentic:state", core.Command{Description: "Manage shared plan state", Action: s.cmdState}); !r.OK { + return r + } + if r := c.Command("state/set", core.Command{Description: "Store shared plan state", Action: s.cmdStateSet}); !r.OK { + return r + } + if r := c.Command("agentic:state/set", core.Command{Description: "Store shared plan state", Action: s.cmdStateSet}); !r.OK { + return r + } + if r := c.Command("state/get", core.Command{Description: "Read shared plan state by key", Action: s.cmdStateGet}); !r.OK { + return r + } + if r := c.Command("agentic:state/get", core.Command{Description: "Read shared plan state by key", Action: s.cmdStateGet}); !r.OK { + return r + } + if r := c.Command("state/list", core.Command{Description: "List shared plan state for a plan", Action: s.cmdStateList}); !r.OK { + return r + } + if r := c.Command("agentic:state/list", core.Command{Description: "List shared plan state for a plan", Action: s.cmdStateList}); !r.OK { + return r + } + if r := c.Command("state/delete", core.Command{Description: "Delete shared plan state by key", Action: s.cmdStateDelete}); !r.OK { + return r + } + if r := c.Command("agentic:state/delete", core.Command{Description: "Delete shared plan state by key", Action: s.cmdStateDelete}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdState(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_task.go b/go/pkg/agentic/commands_task.go index c33b1a85..fec50a6e 100644 --- a/go/pkg/agentic/commands_task.go +++ b/go/pkg/agentic/commands_task.go @@ -6,16 +6,33 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerTaskCommands() { +func (s *PrepSubsystem) registerTaskCommands() core.Result { c := s.Core() - c.Command("task", core.Command{Description: "Manage plan tasks", Action: s.cmdTask}) - c.Command("agentic:task", core.Command{Description: "Manage plan tasks", Action: s.cmdTask}) - c.Command("task/create", core.Command{Description: "Create a task in a plan phase", Action: s.cmdTaskCreate}) - c.Command("agentic:task/create", core.Command{Description: "Create a task in a plan phase", Action: s.cmdTaskCreate}) - c.Command("task/update", core.Command{Description: "Update a plan task status, notes, priority, or category", Action: s.cmdTaskUpdate}) - c.Command("agentic:task/update", core.Command{Description: "Update a plan task status, notes, priority, or category", Action: s.cmdTaskUpdate}) - c.Command("task/toggle", core.Command{Description: "Toggle a plan task between pending and completed", Action: s.cmdTaskToggle}) - c.Command("agentic:task/toggle", core.Command{Description: "Toggle a plan task between pending and completed", Action: s.cmdTaskToggle}) + if r := c.Command("task", core.Command{Description: "Manage plan tasks", Action: s.cmdTask}); !r.OK { + return r + } + if r := c.Command("agentic:task", core.Command{Description: "Manage plan tasks", Action: s.cmdTask}); !r.OK { + return r + } + if r := c.Command("task/create", core.Command{Description: "Create a task in a plan phase", Action: s.cmdTaskCreate}); !r.OK { + return r + } + if r := c.Command("agentic:task/create", core.Command{Description: "Create a task in a plan phase", Action: s.cmdTaskCreate}); !r.OK { + return r + } + if r := c.Command("task/update", core.Command{Description: "Update a plan task status, notes, priority, or category", Action: s.cmdTaskUpdate}); !r.OK { + return r + } + if r := c.Command("agentic:task/update", core.Command{Description: "Update a plan task status, notes, priority, or category", Action: s.cmdTaskUpdate}); !r.OK { + return r + } + if r := c.Command("task/toggle", core.Command{Description: "Toggle a plan task between pending and completed", Action: s.cmdTaskToggle}); !r.OK { + return r + } + if r := c.Command("agentic:task/toggle", core.Command{Description: "Toggle a plan task between pending and completed", Action: s.cmdTaskToggle}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdTask(options core.Options) core.Result { diff --git a/go/pkg/agentic/commands_workspace.go b/go/pkg/agentic/commands_workspace.go index 7dbd4ea7..0c32ccf3 100644 --- a/go/pkg/agentic/commands_workspace.go +++ b/go/pkg/agentic/commands_workspace.go @@ -8,20 +8,45 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerWorkspaceCommands() { +func (s *PrepSubsystem) registerWorkspaceCommands() core.Result { c := s.Core() - c.Command("workspace/list", core.Command{Description: "List all agent workspaces with status", Action: s.cmdWorkspaceList}) - c.Command("agentic:workspace/list", core.Command{Description: "List all agent workspaces with status", Action: s.cmdWorkspaceList}) - c.Command("workspace/clean", core.Command{Description: "Remove completed/failed/blocked workspaces", Action: s.cmdWorkspaceClean}) - c.Command("agentic:workspace/clean", core.Command{Description: "Remove completed/failed/blocked workspaces", Action: s.cmdWorkspaceClean}) - c.Command("workspace/stats", core.Command{Description: "List permanent dispatch stats from .core/workspace/db.duckdb", Action: s.cmdWorkspaceStats}) - c.Command("agentic:workspace/stats", core.Command{Description: "List permanent dispatch stats from .core/workspace/db.duckdb", Action: s.cmdWorkspaceStats}) - c.Command("workspace/dispatch", core.Command{Description: "Dispatch an agent to work on a repo task", Action: s.cmdWorkspaceDispatch}) - c.Command("agentic:workspace/dispatch", core.Command{Description: "Dispatch an agent to work on a repo task", Action: s.cmdWorkspaceDispatch}) - c.Command("workspace/watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}) - c.Command("agentic:workspace/watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}) - c.Command("watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}) - c.Command("agentic:watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}) + if r := c.Command("workspace/list", core.Command{Description: "List all agent workspaces with status", Action: s.cmdWorkspaceList}); !r.OK { + return r + } + if r := c.Command("agentic:workspace/list", core.Command{Description: "List all agent workspaces with status", Action: s.cmdWorkspaceList}); !r.OK { + return r + } + if r := c.Command("workspace/clean", core.Command{Description: "Remove completed/failed/blocked workspaces", Action: s.cmdWorkspaceClean}); !r.OK { + return r + } + if r := c.Command("agentic:workspace/clean", core.Command{Description: "Remove completed/failed/blocked workspaces", Action: s.cmdWorkspaceClean}); !r.OK { + return r + } + if r := c.Command("workspace/stats", core.Command{Description: "List permanent dispatch stats from .core/workspace/db.duckdb", Action: s.cmdWorkspaceStats}); !r.OK { + return r + } + if r := c.Command("agentic:workspace/stats", core.Command{Description: "List permanent dispatch stats from .core/workspace/db.duckdb", Action: s.cmdWorkspaceStats}); !r.OK { + return r + } + if r := c.Command("workspace/dispatch", core.Command{Description: "Dispatch an agent to work on a repo task", Action: s.cmdWorkspaceDispatch}); !r.OK { + return r + } + if r := c.Command("agentic:workspace/dispatch", core.Command{Description: "Dispatch an agent to work on a repo task", Action: s.cmdWorkspaceDispatch}); !r.OK { + return r + } + if r := c.Command("workspace/watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}); !r.OK { + return r + } + if r := c.Command("agentic:workspace/watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}); !r.OK { + return r + } + if r := c.Command("watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}); !r.OK { + return r + } + if r := c.Command("agentic:watch", core.Command{Description: "Watch workspaces until they complete", Action: s.cmdWorkspaceWatch}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdWorkspaceList(_ core.Options) core.Result { diff --git a/go/pkg/agentic/fleet_mode.go b/go/pkg/agentic/fleet_mode.go index 1905e824..bc1cacbc 100644 --- a/go/pkg/agentic/fleet_mode.go +++ b/go/pkg/agentic/fleet_mode.go @@ -9,16 +9,33 @@ import ( core "dappco.re/go" ) -func (s *PrepSubsystem) registerFleetCommands() { +func (s *PrepSubsystem) registerFleetCommands() core.Result { c := s.Core() - c.Command("login", core.Command{Description: "Exchange a 6-digit pairing code for a fleet api key", Action: s.cmdFleetLogin}) - c.Command("agentic:login", core.Command{Description: "Exchange a 6-digit pairing code for a fleet api key", Action: s.cmdFleetLogin}) - c.Command("fleet", core.Command{Description: "Run or inspect fleet mode", Action: s.cmdFleet}) - c.Command("agentic:fleet", core.Command{Description: "Run or inspect fleet mode", Action: s.cmdFleet}) - c.Command("fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodesCommand}) - c.Command("agentic:fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodesCommand}) - c.Command("fleet/status", core.Command{Description: "Show current fleet connection status", Action: s.cmdFleetStatus}) - c.Command("agentic:fleet/status", core.Command{Description: "Show current fleet connection status", Action: s.cmdFleetStatus}) + if r := c.Command("login", core.Command{Description: "Exchange a 6-digit pairing code for a fleet api key", Action: s.cmdFleetLogin}); !r.OK { + return r + } + if r := c.Command("agentic:login", core.Command{Description: "Exchange a 6-digit pairing code for a fleet api key", Action: s.cmdFleetLogin}); !r.OK { + return r + } + if r := c.Command("fleet", core.Command{Description: "Run or inspect fleet mode", Action: s.cmdFleet}); !r.OK { + return r + } + if r := c.Command("agentic:fleet", core.Command{Description: "Run or inspect fleet mode", Action: s.cmdFleet}); !r.OK { + return r + } + if r := c.Command("fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodesCommand}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/nodes", core.Command{Description: "List registered fleet nodes", Action: s.cmdFleetNodesCommand}); !r.OK { + return r + } + if r := c.Command("fleet/status", core.Command{Description: "Show current fleet connection status", Action: s.cmdFleetStatus}); !r.OK { + return r + } + if r := c.Command("agentic:fleet/status", core.Command{Description: "Show current fleet connection status", Action: s.cmdFleetStatus}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdFleet(options core.Options) core.Result { diff --git a/go/pkg/agentic/lang.go b/go/pkg/agentic/lang.go index d7a99020..ca93a6d6 100644 --- a/go/pkg/agentic/lang.go +++ b/go/pkg/agentic/lang.go @@ -33,12 +33,21 @@ type LanguageListOutput struct { type LanguageListInput struct{} -func (s *PrepSubsystem) registerLanguageCommands() { +func (s *PrepSubsystem) registerLanguageCommands() core.Result { c := s.Core() - c.Command("lang/detect", core.Command{Description: "Detect the primary language for a workspace or repository", Action: s.cmdLangDetect}) - c.Command("agentic:lang/detect", core.Command{Description: "Detect the primary language for a workspace or repository", Action: s.cmdLangDetect}) - c.Command("lang/list", core.Command{Description: "List supported language identifiers", Action: s.cmdLangList}) - c.Command("agentic:lang/list", core.Command{Description: "List supported language identifiers", Action: s.cmdLangList}) + if r := c.Command("lang/detect", core.Command{Description: "Detect the primary language for a workspace or repository", Action: s.cmdLangDetect}); !r.OK { + return r + } + if r := c.Command("agentic:lang/detect", core.Command{Description: "Detect the primary language for a workspace or repository", Action: s.cmdLangDetect}); !r.OK { + return r + } + if r := c.Command("lang/list", core.Command{Description: "List supported language identifiers", Action: s.cmdLangList}); !r.OK { + return r + } + if r := c.Command("agentic:lang/list", core.Command{Description: "List supported language identifiers", Action: s.cmdLangList}); !r.OK { + return r + } + return core.Ok(nil) } // result := c.Command("lang/detect").Run(ctx, core.NewOptions(core.Option{Key: `path`, Value: "."})) diff --git a/go/pkg/agentic/pipeline_commands.go b/go/pkg/agentic/pipeline_commands.go index 93583fc3..9f448e0b 100644 --- a/go/pkg/agentic/pipeline_commands.go +++ b/go/pkg/agentic/pipeline_commands.go @@ -11,51 +11,135 @@ import ( var pipelineNumberPattern = regexp.MustCompile(`^[0-9]+$`) -func (s *PrepSubsystem) registerPipelineCommands() { +func (s *PrepSubsystem) registerPipelineCommands() core.Result { c := s.Core() - - c.Command("pipeline", core.Command{Description: "Run the agent pipeline command tree", Action: s.cmdPipeline}) - c.Command("agentic:pipeline", core.Command{Description: "Run the agent pipeline command tree", Action: s.cmdPipeline}) - c.Command("pipeline/audit", core.Command{Description: "Stage 1: audit issues into implementation work", Action: s.cmdPipelineAudit}) - c.Command("agentic:pipeline/audit", core.Command{Description: "Stage 1: audit issues into implementation work", Action: s.cmdPipelineAudit}) - c.Command("pipeline/epic", core.Command{Description: "Stage 2 and 3 epic orchestration commands", Action: s.cmdPipelineEpic}) - c.Command("agentic:pipeline/epic", core.Command{Description: "Stage 2 and 3 epic orchestration commands", Action: s.cmdPipelineEpic}) - c.Command("pipeline/epic/create", core.Command{Description: "Group implementation issues into epics", Action: s.cmdPipelineEpicCreate}) - c.Command("agentic:pipeline/epic/create", core.Command{Description: "Group implementation issues into epics", Action: s.cmdPipelineEpicCreate}) - c.Command("pipeline/epic/run", core.Command{Description: "Dispatch and monitor an epic", Action: s.cmdPipelineEpicRun}) - c.Command("agentic:pipeline/epic/run", core.Command{Description: "Dispatch and monitor an epic", Action: s.cmdPipelineEpicRun}) - c.Command("pipeline/epic/status", core.Command{Description: "Show epic progress", Action: s.cmdPipelineEpicStatus}) - c.Command("agentic:pipeline/epic/status", core.Command{Description: "Show epic progress", Action: s.cmdPipelineEpicStatus}) - c.Command("pipeline/epic/sync", core.Command{Description: "Sync epic checklist state from child issues", Action: s.cmdPipelineEpicSync}) - c.Command("agentic:pipeline/epic/sync", core.Command{Description: "Sync epic checklist state from child issues", Action: s.cmdPipelineEpicSync}) - c.Command("pipeline/monitor", core.Command{Description: "Watch open PRs and auto-intervene", Action: s.cmdPipelineMonitor}) - c.Command("agentic:pipeline/monitor", core.Command{Description: "Watch open PRs and auto-intervene", Action: s.cmdPipelineMonitor}) - c.Command("pipeline/fix", core.Command{Description: "Pipeline fix-up commands", Action: s.cmdPipelineFix}) - c.Command("agentic:pipeline/fix", core.Command{Description: "Pipeline fix-up commands", Action: s.cmdPipelineFix}) - c.Command("pipeline/fix/reviews", core.Command{Description: "Ask the agent to fix code reviews on a pull request", Action: s.cmdPipelineFixReviews}) - c.Command("agentic:pipeline/fix/reviews", core.Command{Description: "Ask the agent to fix code reviews on a pull request", Action: s.cmdPipelineFixReviews}) - c.Command("pipeline/fix/conflicts", core.Command{Description: "Ask the agent to fix a merge conflict on a pull request", Action: s.cmdPipelineFixConflicts}) - c.Command("agentic:pipeline/fix/conflicts", core.Command{Description: "Ask the agent to fix a merge conflict on a pull request", Action: s.cmdPipelineFixConflicts}) - c.Command("pipeline/fix/format", core.Command{Description: "Apply formatting-only fixes in a workspace or repo checkout", Action: s.cmdPipelineFixFormat}) - c.Command("agentic:pipeline/fix/format", core.Command{Description: "Apply formatting-only fixes in a workspace or repo checkout", Action: s.cmdPipelineFixFormat}) - c.Command("pipeline/fix/threads", core.Command{Description: "Handle review-thread follow-up for a pull request", Action: s.cmdPipelineFixThreads}) - c.Command("agentic:pipeline/fix/threads", core.Command{Description: "Handle review-thread follow-up for a pull request", Action: s.cmdPipelineFixThreads}) - c.Command("pipeline/onboard", core.Command{Description: "Run audit, epic creation, and dispatch onboarding for a repo", Action: s.cmdPipelineOnboard}) - c.Command("agentic:pipeline/onboard", core.Command{Description: "Run audit, epic creation, and dispatch onboarding for a repo", Action: s.cmdPipelineOnboard}) - c.Command("pipeline/budget", core.Command{Description: "Budget planning commands", Action: s.cmdPipelineBudget}) - c.Command("agentic:pipeline/budget", core.Command{Description: "Budget planning commands", Action: s.cmdPipelineBudget}) - c.Command("pipeline/budget/plan", core.Command{Description: "Show daily dispatch budget planning", Action: s.cmdPipelineBudgetPlan}) - c.Command("agentic:pipeline/budget/plan", core.Command{Description: "Show daily dispatch budget planning", Action: s.cmdPipelineBudgetPlan}) - c.Command("pipeline/budget/log", core.Command{Description: "Append a dispatch event to the budget journal", Action: s.cmdPipelineBudgetLog}) - c.Command("agentic:pipeline/budget/log", core.Command{Description: "Append a dispatch event to the budget journal", Action: s.cmdPipelineBudgetLog}) - c.Command("pipeline/training", core.Command{Description: "Training journal commands", Action: s.cmdPipelineTraining}) - c.Command("agentic:pipeline/training", core.Command{Description: "Training journal commands", Action: s.cmdPipelineTraining}) - c.Command("pipeline/training/capture", core.Command{Description: "Capture a merged pull request for training", Action: s.cmdPipelineTrainingCapture}) - c.Command("agentic:pipeline/training/capture", core.Command{Description: "Capture a merged pull request for training", Action: s.cmdPipelineTrainingCapture}) - c.Command("pipeline/training/stats", core.Command{Description: "Summarise training journal data", Action: s.cmdPipelineTrainingStats}) - c.Command("agentic:pipeline/training/stats", core.Command{Description: "Summarise training journal data", Action: s.cmdPipelineTrainingStats}) - c.Command("pipeline/training/export", core.Command{Description: "Export training journal data", Action: s.cmdPipelineTrainingExport}) - c.Command("agentic:pipeline/training/export", core.Command{Description: "Export training journal data", Action: s.cmdPipelineTrainingExport}) + if r := c.Command("pipeline", core.Command{Description: "Run the agent pipeline command tree", Action: s.cmdPipeline}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline", core.Command{Description: "Run the agent pipeline command tree", Action: s.cmdPipeline}); !r.OK { + return r + } + if r := c.Command("pipeline/audit", core.Command{Description: "Stage 1: audit issues into implementation work", Action: s.cmdPipelineAudit}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/audit", core.Command{Description: "Stage 1: audit issues into implementation work", Action: s.cmdPipelineAudit}); !r.OK { + return r + } + if r := c.Command("pipeline/epic", core.Command{Description: "Stage 2 and 3 epic orchestration commands", Action: s.cmdPipelineEpic}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/epic", core.Command{Description: "Stage 2 and 3 epic orchestration commands", Action: s.cmdPipelineEpic}); !r.OK { + return r + } + if r := c.Command("pipeline/epic/create", core.Command{Description: "Group implementation issues into epics", Action: s.cmdPipelineEpicCreate}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/epic/create", core.Command{Description: "Group implementation issues into epics", Action: s.cmdPipelineEpicCreate}); !r.OK { + return r + } + if r := c.Command("pipeline/epic/run", core.Command{Description: "Dispatch and monitor an epic", Action: s.cmdPipelineEpicRun}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/epic/run", core.Command{Description: "Dispatch and monitor an epic", Action: s.cmdPipelineEpicRun}); !r.OK { + return r + } + if r := c.Command("pipeline/epic/status", core.Command{Description: "Show epic progress", Action: s.cmdPipelineEpicStatus}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/epic/status", core.Command{Description: "Show epic progress", Action: s.cmdPipelineEpicStatus}); !r.OK { + return r + } + if r := c.Command("pipeline/epic/sync", core.Command{Description: "Sync epic checklist state from child issues", Action: s.cmdPipelineEpicSync}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/epic/sync", core.Command{Description: "Sync epic checklist state from child issues", Action: s.cmdPipelineEpicSync}); !r.OK { + return r + } + if r := c.Command("pipeline/monitor", core.Command{Description: "Watch open PRs and auto-intervene", Action: s.cmdPipelineMonitor}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/monitor", core.Command{Description: "Watch open PRs and auto-intervene", Action: s.cmdPipelineMonitor}); !r.OK { + return r + } + if r := c.Command("pipeline/fix", core.Command{Description: "Pipeline fix-up commands", Action: s.cmdPipelineFix}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/fix", core.Command{Description: "Pipeline fix-up commands", Action: s.cmdPipelineFix}); !r.OK { + return r + } + if r := c.Command("pipeline/fix/reviews", core.Command{Description: "Ask the agent to fix code reviews on a pull request", Action: s.cmdPipelineFixReviews}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/fix/reviews", core.Command{Description: "Ask the agent to fix code reviews on a pull request", Action: s.cmdPipelineFixReviews}); !r.OK { + return r + } + if r := c.Command("pipeline/fix/conflicts", core.Command{Description: "Ask the agent to fix a merge conflict on a pull request", Action: s.cmdPipelineFixConflicts}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/fix/conflicts", core.Command{Description: "Ask the agent to fix a merge conflict on a pull request", Action: s.cmdPipelineFixConflicts}); !r.OK { + return r + } + if r := c.Command("pipeline/fix/format", core.Command{Description: "Apply formatting-only fixes in a workspace or repo checkout", Action: s.cmdPipelineFixFormat}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/fix/format", core.Command{Description: "Apply formatting-only fixes in a workspace or repo checkout", Action: s.cmdPipelineFixFormat}); !r.OK { + return r + } + if r := c.Command("pipeline/fix/threads", core.Command{Description: "Handle review-thread follow-up for a pull request", Action: s.cmdPipelineFixThreads}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/fix/threads", core.Command{Description: "Handle review-thread follow-up for a pull request", Action: s.cmdPipelineFixThreads}); !r.OK { + return r + } + if r := c.Command("pipeline/onboard", core.Command{Description: "Run audit, epic creation, and dispatch onboarding for a repo", Action: s.cmdPipelineOnboard}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/onboard", core.Command{Description: "Run audit, epic creation, and dispatch onboarding for a repo", Action: s.cmdPipelineOnboard}); !r.OK { + return r + } + if r := c.Command("pipeline/budget", core.Command{Description: "Budget planning commands", Action: s.cmdPipelineBudget}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/budget", core.Command{Description: "Budget planning commands", Action: s.cmdPipelineBudget}); !r.OK { + return r + } + if r := c.Command("pipeline/budget/plan", core.Command{Description: "Show daily dispatch budget planning", Action: s.cmdPipelineBudgetPlan}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/budget/plan", core.Command{Description: "Show daily dispatch budget planning", Action: s.cmdPipelineBudgetPlan}); !r.OK { + return r + } + if r := c.Command("pipeline/budget/log", core.Command{Description: "Append a dispatch event to the budget journal", Action: s.cmdPipelineBudgetLog}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/budget/log", core.Command{Description: "Append a dispatch event to the budget journal", Action: s.cmdPipelineBudgetLog}); !r.OK { + return r + } + if r := c.Command("pipeline/training", core.Command{Description: "Training journal commands", Action: s.cmdPipelineTraining}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/training", core.Command{Description: "Training journal commands", Action: s.cmdPipelineTraining}); !r.OK { + return r + } + if r := c.Command("pipeline/training/capture", core.Command{Description: "Capture a merged pull request for training", Action: s.cmdPipelineTrainingCapture}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/training/capture", core.Command{Description: "Capture a merged pull request for training", Action: s.cmdPipelineTrainingCapture}); !r.OK { + return r + } + if r := c.Command("pipeline/training/stats", core.Command{Description: "Summarise training journal data", Action: s.cmdPipelineTrainingStats}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/training/stats", core.Command{Description: "Summarise training journal data", Action: s.cmdPipelineTrainingStats}); !r.OK { + return r + } + if r := c.Command("pipeline/training/export", core.Command{Description: "Export training journal data", Action: s.cmdPipelineTrainingExport}); !r.OK { + return r + } + if r := c.Command("agentic:pipeline/training/export", core.Command{Description: "Export training journal data", Action: s.cmdPipelineTrainingExport}); !r.OK { + return r + } + return core.Ok(nil) } func (s *PrepSubsystem) cmdPipeline(options core.Options) core.Result { diff --git a/go/pkg/agentic/prep.go b/go/pkg/agentic/prep.go index a856cb32..0a716c44 100644 --- a/go/pkg/agentic/prep.go +++ b/go/pkg/agentic/prep.go @@ -113,19 +113,25 @@ func (s *PrepSubsystem) OnStartup(ctx context.Context) core.Result { return core.Entitlement{Allowed: true} }) - lib.MountData(c) + if result := lib.MountData(c); !result.OK { + return result + } RegisterHTTPTransport(c) - c.Drive().New(core.NewOptions( + if result := c.Drive().New(core.NewOptions( core.Option{Key: "name", Value: "forge"}, core.Option{Key: "transport", Value: s.forgeURL}, core.Option{Key: "token", Value: s.forgeToken}, - )) - c.Drive().New(core.NewOptions( + )); !result.OK { + return result + } + if result := c.Drive().New(core.NewOptions( core.Option{Key: "name", Value: "brain"}, core.Option{Key: "transport", Value: s.brainURL}, core.Option{Key: "token", Value: s.brainKey}, - )) + )); !result.OK { + return result + } c.Action("agentic.sync.push", s.handleSyncPush).Description = "Push completed dispatch state to the platform API" c.Action("agent.sync.push", s.handleSyncPush).Description = "Push completed dispatch state to the platform API" @@ -373,10 +379,18 @@ func (s *PrepSubsystem) OnStartup(ctx context.Context) core.Result { c.RegisterQuery(s.handleWorkspaceQuery) s.StartRunner() - s.registerCommands(ctx) - s.registerWorkspaceCommands() - s.registerForgeCommands() - s.registerPlatformCommands() + if result := s.registerCommands(ctx); !result.OK { + return result + } + if result := s.registerWorkspaceCommands(); !result.OK { + return result + } + if result := s.registerForgeCommands(); !result.OK { + return result + } + if result := s.registerPlatformCommands(); !result.OK { + return result + } return core.Result{OK: true} } diff --git a/go/pkg/agentic/process_register.go b/go/pkg/agentic/process_register.go index 8201fd7d..01da1628 100644 --- a/go/pkg/agentic/process_register.go +++ b/go/pkg/agentic/process_register.go @@ -98,7 +98,8 @@ type processOverrideService struct { // booted. The override is reapplied at the tail of the lifecycle so // the agent-side handlers win. // -// Usage: `_ = svc.OnStartup(ctx)` +// result := svc.OnStartup(context.Background()) +// core.Println(result.OK) func (s *processOverrideService) OnStartup(context.Context) core.Result { if s == nil || s.handlers == nil { return core.Result{OK: true} diff --git a/go/pkg/agentic/repo_sync.go b/go/pkg/agentic/repo_sync.go index ecfa7fb9..816dd5dc 100644 --- a/go/pkg/agentic/repo_sync.go +++ b/go/pkg/agentic/repo_sync.go @@ -43,17 +43,17 @@ const ( ) // s.registerRepoSyncSupport() -func (s *PrepSubsystem) registerRepoSyncSupport() { +func (s *PrepSubsystem) registerRepoSyncSupport() core.Result { if s == nil || s.ServiceRuntime == nil { - return + return core.Result{OK: true} } c := s.Core() if c == nil { - return + return core.Result{OK: true} } if c.Config().Bool("agentic.repo_sync.registered") { - return + return core.Result{OK: true} } c.Config().Set("agentic.repo_sync.registered", true) @@ -70,17 +70,22 @@ func (s *PrepSubsystem) registerRepoSyncSupport() { }) if !c.Command("repo/sync").OK { - c.Command("repo/sync", core.Command{ + if result := c.Command("repo/sync", core.Command{ Description: "Fetch and optionally reset tracked local repos from origin", Action: s.cmdRepoSyncLocal, - }) + }); !result.OK { + return result + } } if !c.Command("agentic:repo/sync").OK { - c.Command("agentic:repo/sync", core.Command{ + if result := c.Command("agentic:repo/sync", core.Command{ Description: "Fetch and optionally reset tracked local repos from origin", Action: s.cmdRepoSyncLocal, - }) + }); !result.OK { + return result + } } + return core.Result{OK: true} } func (s *PrepSubsystem) handleRepoSyncIPC(_ *core.Core, msg core.Message) core.Result { diff --git a/go/pkg/lib/lib.go b/go/pkg/lib/lib.go index e63f3ffb..5931f1f0 100644 --- a/go/pkg/lib/lib.go +++ b/go/pkg/lib/lib.go @@ -42,20 +42,30 @@ var ( mountResult core.Result ) -// lib.MountData(c) +// result := lib.MountData(c) // r := c.Data().ReadString("prompts/coding.md") // r := c.Data().ListNames("flows") -func MountData(c *core.Core) { +func MountData(c *core.Core) core.Result { if result := ensureMounted(); !result.OK { - return + return result } d := c.Data() - _ = d.Set("prompts", promptFS) - _ = d.Set("tasks", taskFS) - _ = d.Set("flows", flowFS) - _ = d.Set("personas", personaFS) - _ = d.Set("workspaces", workspaceFS) + for _, item := range []struct { + name string + mount *core.Embed + }{ + {name: "prompts", mount: promptFS}, + {name: "tasks", mount: taskFS}, + {name: "flows", mount: flowFS}, + {name: "personas", mount: personaFS}, + {name: "workspaces", mount: workspaceFS}, + } { + if result := d.Set(item.name, item.mount); !result.OK { + return result + } + } + return core.Result{OK: true} } func ensureMounted() core.Result {