fix(ax): continue AX naming cleanup

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-03-30 21:30:49 +00:00
parent 1cc8fb50e1
commit e825550a90
15 changed files with 75 additions and 75 deletions

View file

@ -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))

View file

@ -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

View file

@ -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")

View file

@ -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
}

View file

@ -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
}

View file

@ -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

View file

@ -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),

View file

@ -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())
}

View file

@ -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)
}
}
}

View file

@ -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,
})
}
}

View file

@ -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",
})

View file

@ -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) {

View file

@ -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)
}

View file

@ -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))
}

View file

@ -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
}