Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions go/cmd/core-agent/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 17 additions & 3 deletions go/cmd/core-agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
// 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),
Expand All @@ -43,9 +51,11 @@
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"
Expand All @@ -61,7 +71,11 @@
// 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()
Expand All @@ -71,7 +85,7 @@
return core.E("main.runApp", "core is required", nil)
}

defer coreApp.ServiceShutdown(context.Background())

Check failure on line 88 in go/cmd/core-agent/main.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `coreApp.ServiceShutdown` is not checked (errcheck)

Check failure on line 88 in go/cmd/core-agent/main.go

View workflow job for this annotation

GitHub Actions / golangci-lint

Error return value of `coreApp.ServiceShutdown` is not checked (errcheck)

result := coreApp.ServiceStartup(coreApp.Context(), nil)
if !result.OK {
Expand Down
307 changes: 224 additions & 83 deletions go/pkg/agentic/commands.go

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions go/pkg/agentic/commands_commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions go/pkg/agentic/commands_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
135 changes: 102 additions & 33 deletions go/pkg/agentic/commands_forge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
51 changes: 38 additions & 13 deletions go/pkg/agentic/commands_phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading
Loading