From e825550a90a0c76ac88f169a6d97c97cdd249dad Mon Sep 17 00:00:00 2001 From: Virgil Date: Mon, 30 Mar 2026 21:30:49 +0000 Subject: [PATCH] fix(ax): continue AX naming cleanup Co-Authored-By: Virgil --- cmd/core-agent/commands.go | 14 +++++++------- cmd/core-agent/commands_example_test.go | 6 +++--- cmd/core-agent/commands_test.go | 8 ++++---- cmd/core-agent/main.go | 12 ++++++------ cmd/core-agent/main_example_test.go | 4 ++-- cmd/core-agent/mcp_service_example_test.go | 2 +- cmd/core-agent/mcp_service_test.go | 4 ++-- cmd/core-agent/update_test.go | 8 ++++---- pkg/agentic/commands_workspace.go | 14 +++++++------- pkg/agentic/dispatch.go | 12 ++++++------ pkg/agentic/handlers_test.go | 10 +++++----- pkg/agentic/logic_test.go | 20 ++++++++++---------- pkg/agentic/prep.go | 8 ++++---- pkg/monitor/monitor.go | 14 +++++++------- pkg/runner/queue.go | 14 +++++++------- 15 files changed, 75 insertions(+), 75 deletions(-) diff --git a/cmd/core-agent/commands.go b/cmd/core-agent/commands.go index e6d5203..8351559 100644 --- a/cmd/core-agent/commands.go +++ b/cmd/core-agent/commands.go @@ -10,7 +10,7 @@ import ( "dappco.re/go/core" ) -type appCommandSet struct { +type applicationCommandSet struct { core *core.Core } @@ -67,14 +67,14 @@ func applyLogLevel(args []string) []string { return cleaned } -// registerAppCommands adds app-level CLI commands (version, check, env). +// registerApplicationCommands adds application-level CLI commands (version, check, env). // These are not owned by any service — they're the binary's own commands. // // core-agent version — build info // core-agent check — health check // core-agent env — environment variables -func registerAppCommands(c *core.Core) { - commands := appCommandSet{core: c} +func registerApplicationCommands(c *core.Core) { + commands := applicationCommandSet{core: c} c.Command("version", core.Command{ Description: "Print version and build info", @@ -92,7 +92,7 @@ func registerAppCommands(c *core.Core) { }) } -func (commands appCommandSet) version(_ core.Options) core.Result { +func (commands applicationCommandSet) version(_ core.Options) core.Result { core.Print(nil, "core-agent %s", commands.core.App().Version) core.Print(nil, " go: %s", core.Env("GO")) core.Print(nil, " os: %s/%s", core.Env("OS"), core.Env("ARCH")) @@ -103,7 +103,7 @@ func (commands appCommandSet) version(_ core.Options) core.Result { return core.Result{OK: true} } -func (commands appCommandSet) check(_ core.Options) core.Result { +func (commands applicationCommandSet) check(_ core.Options) core.Result { fs := commands.core.Fs() core.Print(nil, "core-agent %s health check", commands.core.App().Version) core.Print(nil, "") @@ -133,7 +133,7 @@ func (commands appCommandSet) check(_ core.Options) core.Result { return core.Result{OK: true} } -func (commands appCommandSet) env(_ core.Options) core.Result { +func (commands applicationCommandSet) env(_ core.Options) core.Result { keys := core.EnvKeys() for _, key := range keys { core.Print(nil, " %-15s %s", key, core.Env(key)) diff --git a/cmd/core-agent/commands_example_test.go b/cmd/core-agent/commands_example_test.go index 322349c..5808576 100644 --- a/cmd/core-agent/commands_example_test.go +++ b/cmd/core-agent/commands_example_test.go @@ -6,9 +6,9 @@ import ( "dappco.re/go/core" ) -func Example_registerAppCommands() { - c := core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"}))) - registerAppCommands(c) +func Example_registerApplicationCommands() { + c := core.New(core.WithOption("name", "core-agent")) + registerApplicationCommands(c) core.Println(len(c.Commands())) // Output: 3 diff --git a/cmd/core-agent/commands_test.go b/cmd/core-agent/commands_test.go index 64933e8..0b4cfbf 100644 --- a/cmd/core-agent/commands_test.go +++ b/cmd/core-agent/commands_test.go @@ -14,12 +14,12 @@ import ( "github.com/stretchr/testify/assert" ) -// newTestCore creates a minimal Core with app commands registered. +// newTestCore creates a minimal Core with application commands registered. func newTestCore(t *testing.T) *core.Core { t.Helper() - c := core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"}))) + c := core.New(core.WithOption("name", "core-agent")) c.App().Version = "test" - registerAppCommands(c) + registerApplicationCommands(c) c.Cli().SetOutput(&bytes.Buffer{}) return c } @@ -107,7 +107,7 @@ func TestCommands_StartupArgs_Ugly(t *testing.T) { assert.Equal(t, []string{"version"}, args) } -func TestCommands_RegisterAppCommands_Good(t *testing.T) { +func TestCommands_RegisterApplicationCommands_Good(t *testing.T) { c := newTestCore(t) cmds := c.Commands() assert.Contains(t, cmds, "version") diff --git a/cmd/core-agent/main.go b/cmd/core-agent/main.go index bce63bd..d05b602 100644 --- a/cmd/core-agent/main.go +++ b/cmd/core-agent/main.go @@ -29,7 +29,7 @@ func main() { // core.Println(c.App().Version) // "dev" or linked version func newCoreAgent() *core.Core { coreApp := core.New( - core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})), + core.WithOption("name", "core-agent"), core.WithService(agentic.ProcessRegister), core.WithService(agentic.Register), core.WithService(runner.Register), @@ -37,22 +37,22 @@ func newCoreAgent() *core.Core { core.WithService(brain.Register), core.WithService(registerMCPService), ) - coreApp.App().Version = appVersion() + coreApp.App().Version = applicationVersion() coreApp.Cli().SetBanner(func(_ *core.Cli) string { return core.Concat("core-agent ", coreApp.App().Version, " — agentic orchestration for the Core ecosystem") }) - registerAppCommands(coreApp) + registerApplicationCommands(coreApp) return coreApp } -// appVersion resolves the build version injected at link time. +// applicationVersion resolves the build version injected at link time. // // agentpkg.Version = "0.15.0" -// appVersion() // "0.15.0" -func appVersion() string { +// applicationVersion() // "0.15.0" +func applicationVersion() string { if agentpkg.Version != "" { return agentpkg.Version } diff --git a/cmd/core-agent/main_example_test.go b/cmd/core-agent/main_example_test.go index 72a7f41..8439c92 100644 --- a/cmd/core-agent/main_example_test.go +++ b/cmd/core-agent/main_example_test.go @@ -22,11 +22,11 @@ func Example_newCoreAgent() { // true } -func Example_appVersion() { +func Example_applicationVersion() { oldVersion := agentpkg.Version agentpkg.Version = "0.15.0" defer func() { agentpkg.Version = oldVersion }() - core.Println(appVersion()) + core.Println(applicationVersion()) // Output: 0.15.0 } diff --git a/cmd/core-agent/mcp_service_example_test.go b/cmd/core-agent/mcp_service_example_test.go index ad6c934..15a3d80 100644 --- a/cmd/core-agent/mcp_service_example_test.go +++ b/cmd/core-agent/mcp_service_example_test.go @@ -7,7 +7,7 @@ import ( ) func Example_registerMCPService() { - result := registerMCPService(core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})))) + result := registerMCPService(core.New(core.WithOption("name", "core-agent"))) core.Println(result.OK) // Output: true diff --git a/cmd/core-agent/mcp_service_test.go b/cmd/core-agent/mcp_service_test.go index 40b2ffe..cbf06bc 100644 --- a/cmd/core-agent/mcp_service_test.go +++ b/cmd/core-agent/mcp_service_test.go @@ -15,7 +15,7 @@ import ( ) func TestMCP_RegisterMCPService_Good(t *testing.T) { - result := registerMCPService(core.New(core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})))) + result := registerMCPService(core.New(core.WithOption("name", "core-agent"))) require.True(t, result.OK) _, ok := result.Value.(*mcp.Service) @@ -31,7 +31,7 @@ func TestMCP_RegisterMCPService_Bad(t *testing.T) { func TestMCP_RegisterMCPService_Ugly(t *testing.T) { c := core.New( - core.WithOptions(core.NewOptions(core.Option{Key: "name", Value: "core-agent"})), + core.WithOption("name", "core-agent"), core.WithService(agentic.ProcessRegister), core.WithService(agentic.Register), core.WithService(monitor.Register), diff --git a/cmd/core-agent/update_test.go b/cmd/core-agent/update_test.go index 36fe48f..8111dd9 100644 --- a/cmd/core-agent/update_test.go +++ b/cmd/core-agent/update_test.go @@ -47,15 +47,15 @@ func TestUpdate_UpdateChannelNumericSuffix_Ugly(t *testing.T) { assert.Equal(t, "stable", updateChannel()) } -func TestUpdate_AppVersion_Good(t *testing.T) { +func TestUpdate_ApplicationVersion_Good(t *testing.T) { agentpkg.Version = "1.2.3" t.Cleanup(func() { agentpkg.Version = "" }) - assert.Equal(t, "1.2.3", appVersion()) + assert.Equal(t, "1.2.3", applicationVersion()) } -func TestUpdate_AppVersion_Bad(t *testing.T) { +func TestUpdate_ApplicationVersion_Bad(t *testing.T) { agentpkg.Version = "" - assert.Equal(t, "dev", appVersion()) + assert.Equal(t, "dev", applicationVersion()) } diff --git a/pkg/agentic/commands_workspace.go b/pkg/agentic/commands_workspace.go index e2a1455..bed4977 100644 --- a/pkg/agentic/commands_workspace.go +++ b/pkg/agentic/commands_workspace.go @@ -23,13 +23,13 @@ func (s *PrepSubsystem) cmdWorkspaceList(_ core.Options) core.Result { count := 0 for _, sf := range statusFiles { workspaceDir := core.PathDir(sf) - wsName := WorkspaceName(workspaceDir) + workspaceName := WorkspaceName(workspaceDir) result := ReadStatusResult(workspaceDir) workspaceStatus, ok := workspaceStatusValue(result) if !ok { continue } - core.Print(nil, " %-8s %-8s %-10s %s", workspaceStatus.Status, workspaceStatus.Agent, workspaceStatus.Repo, wsName) + core.Print(nil, " %-8s %-8s %-10s %s", workspaceStatus.Status, workspaceStatus.Agent, workspaceStatus.Repo, workspaceName) count++ } if count == 0 { @@ -51,7 +51,7 @@ func (s *PrepSubsystem) cmdWorkspaceClean(options core.Options) core.Result { for _, sf := range statusFiles { workspaceDir := core.PathDir(sf) - wsName := WorkspaceName(workspaceDir) + workspaceName := WorkspaceName(workspaceDir) result := ReadStatusResult(workspaceDir) workspaceStatus, ok := workspaceStatusValue(result) if !ok { @@ -62,19 +62,19 @@ func (s *PrepSubsystem) cmdWorkspaceClean(options core.Options) core.Result { switch filter { case "all": if status == "completed" || status == "failed" || status == "blocked" || status == "merged" || status == "ready-for-review" { - toRemove = append(toRemove, wsName) + toRemove = append(toRemove, workspaceName) } case "completed": if status == "completed" || status == "merged" || status == "ready-for-review" { - toRemove = append(toRemove, wsName) + toRemove = append(toRemove, workspaceName) } case "failed": if status == "failed" { - toRemove = append(toRemove, wsName) + toRemove = append(toRemove, workspaceName) } case "blocked": if status == "blocked" { - toRemove = append(toRemove, wsName) + toRemove = append(toRemove, workspaceName) } } } diff --git a/pkg/agentic/dispatch.go b/pkg/agentic/dispatch.go index c8a54ba..2255668 100644 --- a/pkg/agentic/dispatch.go +++ b/pkg/agentic/dispatch.go @@ -313,7 +313,7 @@ func (s *PrepSubsystem) stopIssueTracking(workspaceDir string) { // broadcastStart emits IPC + audit events for agent start. func (s *PrepSubsystem) broadcastStart(agent, workspaceDir string) { - wsName := WorkspaceName(workspaceDir) + workspaceName := WorkspaceName(workspaceDir) result := ReadStatusResult(workspaceDir) workspaceStatus, ok := workspaceStatusValue(result) repo := "" @@ -322,16 +322,16 @@ func (s *PrepSubsystem) broadcastStart(agent, workspaceDir string) { } if s.ServiceRuntime != nil { s.Core().ACTION(messages.AgentStarted{ - Agent: agent, Repo: repo, Workspace: wsName, + Agent: agent, Repo: repo, Workspace: workspaceName, }) } - emitStartEvent(agent, wsName) + emitStartEvent(agent, workspaceName) } // broadcastComplete emits IPC + audit events for agent completion. func (s *PrepSubsystem) broadcastComplete(agent, workspaceDir, finalStatus string) { - wsName := WorkspaceName(workspaceDir) - emitCompletionEvent(agent, wsName, finalStatus) + workspaceName := WorkspaceName(workspaceDir) + emitCompletionEvent(agent, workspaceName, finalStatus) if s.ServiceRuntime != nil { result := ReadStatusResult(workspaceDir) workspaceStatus, ok := workspaceStatusValue(result) @@ -341,7 +341,7 @@ func (s *PrepSubsystem) broadcastComplete(agent, workspaceDir, finalStatus strin } s.Core().ACTION(messages.AgentCompleted{ Agent: agent, Repo: repo, - Workspace: wsName, Status: finalStatus, + Workspace: workspaceName, Status: finalStatus, }) } } diff --git a/pkg/agentic/handlers_test.go b/pkg/agentic/handlers_test.go index be11008..e671e46 100644 --- a/pkg/agentic/handlers_test.go +++ b/pkg/agentic/handlers_test.go @@ -71,9 +71,9 @@ func TestHandlers_IngestOnCompletion_Good(t *testing.T) { c, _ := newCoreForHandlerTests(t) root := WorkspaceRoot() - wsName := "core/test/task-2" - wsDir := core.JoinPath(root, wsName) - repoDir := core.JoinPath(wsDir, "repo") + workspaceName := "core/test/task-2" + workspaceDir := core.JoinPath(root, workspaceName) + repoDir := core.JoinPath(workspaceDir, "repo") fs.EnsureDir(repoDir) st := &WorkspaceStatus{ @@ -82,11 +82,11 @@ func TestHandlers_IngestOnCompletion_Good(t *testing.T) { Agent: "codex", Task: "Review code", } - writeStatus(wsDir, st) + writeStatus(workspaceDir, st) // Should not panic — ingest handler runs but no findings file c.ACTION(messages.AgentCompleted{ - Workspace: wsName, + Workspace: workspaceName, Repo: "test", Status: "completed", }) diff --git a/pkg/agentic/logic_test.go b/pkg/agentic/logic_test.go index 9fa3102..d1c5036 100644 --- a/pkg/agentic/logic_test.go +++ b/pkg/agentic/logic_test.go @@ -590,24 +590,24 @@ func TestHandlers_ResolveWorkspace_Good_ExistingDir(t *testing.T) { t.Setenv("CORE_WORKSPACE", root) // Create the workspace directory structure - wsName := "core/go-io/task-5" - wsDir := core.JoinPath(root, "workspace", wsName) - require.True(t, fs.EnsureDir(wsDir).OK) + workspaceName := "core/go-io/task-5" + workspaceDir := core.JoinPath(root, "workspace", workspaceName) + require.True(t, fs.EnsureDir(workspaceDir).OK) - result := resolveWorkspace(wsName) - assert.Equal(t, wsDir, result) + result := resolveWorkspace(workspaceName) + assert.Equal(t, workspaceDir, result) } func TestHandlers_ResolveWorkspace_Good_NestedPath(t *testing.T) { root := t.TempDir() t.Setenv("CORE_WORKSPACE", root) - wsName := "core/agent/pr-42" - wsDir := core.JoinPath(root, "workspace", wsName) - require.True(t, fs.EnsureDir(wsDir).OK) + workspaceName := "core/agent/pr-42" + workspaceDir := core.JoinPath(root, "workspace", workspaceName) + require.True(t, fs.EnsureDir(workspaceDir).OK) - result := resolveWorkspace(wsName) - assert.Equal(t, wsDir, result) + result := resolveWorkspace(workspaceName) + assert.Equal(t, workspaceDir, result) } func TestHandlers_ResolveWorkspace_Bad_NonExistentDir(t *testing.T) { diff --git a/pkg/agentic/prep.go b/pkg/agentic/prep.go index 066e8f5..2471486 100644 --- a/pkg/agentic/prep.go +++ b/pkg/agentic/prep.go @@ -413,15 +413,15 @@ func (s *PrepSubsystem) prepWorkspace(ctx context.Context, _ *mcp.CallToolReques } // Resolve workspace directory from identifier - wsDirResult := workspaceDirResult(input.Org, input.Repo, input) - if !wsDirResult.OK { - err, _ := wsDirResult.Value.(error) + workspaceResult := workspaceDirResult(input.Org, input.Repo, input) + if !workspaceResult.OK { + err, _ := workspaceResult.Value.(error) if err == nil { err = core.E("prepWorkspace", "workspace path not resolved", nil) } return nil, PrepOutput{}, err } - workspaceDir, ok := wsDirResult.Value.(string) + workspaceDir, ok := workspaceResult.Value.(string) if !ok || workspaceDir == "" { return nil, PrepOutput{}, core.E("prepWorkspace", "invalid workspace path", nil) } diff --git a/pkg/monitor/monitor.go b/pkg/monitor/monitor.go index a2e26d3..33f9b4a 100644 --- a/pkg/monitor/monitor.go +++ b/pkg/monitor/monitor.go @@ -333,27 +333,27 @@ func (m *Subsystem) checkCompletions() string { continue } - wsName := agentic.WorkspaceName(core.PathDir(entry)) + workspaceName := agentic.WorkspaceName(core.PathDir(entry)) switch workspaceStatus.Status { case "completed": completed++ - if !m.seenCompleted[wsName] { - m.seenCompleted[wsName] = true + if !m.seenCompleted[workspaceName] { + m.seenCompleted[workspaceName] = true if seeded { newlyCompleted = append(newlyCompleted, core.Sprintf("%s (%s)", workspaceStatus.Repo, workspaceStatus.Agent)) } } case "running": running++ - if !m.seenRunning[wsName] && seeded { - m.seenRunning[wsName] = true + if !m.seenRunning[workspaceName] && seeded { + m.seenRunning[workspaceName] = true } case "queued": queued++ case "blocked", "failed": - if !m.seenCompleted[wsName] { - m.seenCompleted[wsName] = true + if !m.seenCompleted[workspaceName] { + m.seenCompleted[workspaceName] = true if seeded { newlyCompleted = append(newlyCompleted, core.Sprintf("%s (%s) [%s]", workspaceStatus.Repo, workspaceStatus.Agent, workspaceStatus.Status)) } diff --git a/pkg/runner/queue.go b/pkg/runner/queue.go index c1106be..c958d3a 100644 --- a/pkg/runner/queue.go +++ b/pkg/runner/queue.go @@ -251,8 +251,8 @@ func (s *Service) drainOne() bool { // Ask agentic to spawn — runner owns the gate, // agentic owns the actual process launch. // Workspace name is relative path from workspace root (e.g. "core/go-ai/dev") - wsName := agentic.WorkspaceName(workspaceDir) - core.Info("drainOne: found queued workspace", "workspace", wsName, "agent", workspaceStatus.Agent) + workspaceName := agentic.WorkspaceName(workspaceDir) + core.Info("drainOne: found queued workspace", "workspace", workspaceName, "agent", workspaceStatus.Agent) // Spawn directly — agentic is a Core service, use ServiceFor to get it if s.ServiceRuntime == nil { @@ -269,12 +269,12 @@ func (s *Service) drainOne() bool { prompt := core.Concat("TASK: ", workspaceStatus.Task, "\n\nResume from where you left off. Read CODEX.md for conventions. Commit when done.") spawnResult := agenticService.SpawnFromQueue(workspaceStatus.Agent, prompt, workspaceDir) if !spawnResult.OK { - core.Error("drainOne: spawn failed", "workspace", wsName, "reason", core.Sprint(spawnResult.Value)) + core.Error("drainOne: spawn failed", "workspace", workspaceName, "reason", core.Sprint(spawnResult.Value)) continue } pid, ok := spawnResult.Value.(int) if !ok { - core.Error("drainOne: spawn returned non-int pid", "workspace", wsName) + core.Error("drainOne: spawn returned non-int pid", "workspace", workspaceName) continue } @@ -283,11 +283,11 @@ func (s *Service) drainOne() bool { workspaceStatus.PID = pid workspaceStatus.Runs++ if writeResult := WriteStatus(workspaceDir, workspaceStatus); !writeResult.OK { - core.Error("drainOne: failed to write workspace status", "workspace", wsName, "reason", core.Sprint(writeResult.Value)) + core.Error("drainOne: failed to write workspace status", "workspace", workspaceName, "reason", core.Sprint(writeResult.Value)) continue } - s.TrackWorkspace(wsName, workspaceStatus) - core.Info("drainOne: spawned", "pid", pid, "workspace", wsName) + s.TrackWorkspace(workspaceName, workspaceStatus) + core.Info("drainOne: spawned", "pid", pid, "workspace", workspaceName) return true }