2026-03-17 18:13:44 +00:00
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
|
|
|
|
|
package agentic
|
|
|
|
|
|
|
|
|
|
import (
|
2026-03-25 09:51:57 +00:00
|
|
|
"context"
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
"strconv"
|
2026-03-22 03:41:07 +00:00
|
|
|
|
|
|
|
|
core "dappco.re/go/core"
|
2026-03-17 18:13:44 +00:00
|
|
|
)
|
|
|
|
|
|
2026-03-22 03:41:07 +00:00
|
|
|
// fs provides unrestricted filesystem access (root "/" = no sandbox).
|
|
|
|
|
//
|
|
|
|
|
// r := fs.Read("/etc/hostname")
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
// if r.OK { core.Print(nil, "%s", r.Value.(string)) }
|
feat(v0.8.0): full AX migration — ServiceRuntime, Actions, quality gates, transport
go-process:
- Register factory, Result lifecycle, 5 named Action handlers
- Start/Run/StartWithOptions/RunWithOptions all return core.Result
- core.ID() replaces fmt.Sprintf, core.As replaces errors.As
core/agent:
- PrepSubsystem + monitor.Subsystem + setup.Service embed ServiceRuntime[T]
- 22 named Actions + agent.completion Task pipeline in OnStartup
- ChannelNotifier removed — all IPC via c.ACTION(messages.X{})
- proc.go: all methods via s.Core().Process(), returns core.Result
- status.go: WriteAtomic + JSONMarshalString
- paths.go: Fs.NewUnrestricted() replaces unsafe.Pointer
- transport.go: ONE net/http file — HTTPGet/HTTPPost/HTTPDo/MCP transport
- All disallowed imports eliminated from source files (13 quality gates)
- String concat eliminated — core.Concat() throughout
- 1:1 _test.go + _example_test.go for every source file
- Reference docs synced from core/go v0.8.0
- RFC-025 updated with net/http, net/url, io/fs quality gates
- lib.go: io/fs eliminated via Data.ListNames, Array[T].Deduplicate
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 01:27:46 +00:00
|
|
|
var fs = (&core.Fs{}).NewUnrestricted()
|
2026-03-22 03:41:07 +00:00
|
|
|
|
|
|
|
|
// LocalFs returns an unrestricted filesystem instance for use by other packages.
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
//
|
feat(v0.8.0): full AX migration — ServiceRuntime, Actions, quality gates, transport
go-process:
- Register factory, Result lifecycle, 5 named Action handlers
- Start/Run/StartWithOptions/RunWithOptions all return core.Result
- core.ID() replaces fmt.Sprintf, core.As replaces errors.As
core/agent:
- PrepSubsystem + monitor.Subsystem + setup.Service embed ServiceRuntime[T]
- 22 named Actions + agent.completion Task pipeline in OnStartup
- ChannelNotifier removed — all IPC via c.ACTION(messages.X{})
- proc.go: all methods via s.Core().Process(), returns core.Result
- status.go: WriteAtomic + JSONMarshalString
- paths.go: Fs.NewUnrestricted() replaces unsafe.Pointer
- transport.go: ONE net/http file — HTTPGet/HTTPPost/HTTPDo/MCP transport
- All disallowed imports eliminated from source files (13 quality gates)
- String concat eliminated — core.Concat() throughout
- 1:1 _test.go + _example_test.go for every source file
- Reference docs synced from core/go v0.8.0
- RFC-025 updated with net/http, net/url, io/fs quality gates
- lib.go: io/fs eliminated via Data.ListNames, Array[T].Deduplicate
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 01:27:46 +00:00
|
|
|
// f := agentic.LocalFs()
|
|
|
|
|
// r := f.Read("/tmp/agent-status.json")
|
2026-03-22 03:41:07 +00:00
|
|
|
func LocalFs() *core.Fs { return fs }
|
|
|
|
|
|
2026-03-17 18:13:44 +00:00
|
|
|
// WorkspaceRoot returns the root directory for agent workspaces.
|
|
|
|
|
// Checks CORE_WORKSPACE env var first, falls back to ~/Code/.core/workspace.
|
2026-03-22 03:41:07 +00:00
|
|
|
//
|
2026-03-29 21:56:45 +00:00
|
|
|
// wsDir := core.JoinPath(agentic.WorkspaceRoot(), "core", "go-io", "task-42")
|
2026-03-17 18:13:44 +00:00
|
|
|
func WorkspaceRoot() string {
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
return core.JoinPath(CoreRoot(), "workspace")
|
2026-03-17 18:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 20:15:58 +00:00
|
|
|
// WorkspaceStatusPaths returns all workspace status files across supported layouts.
|
|
|
|
|
//
|
|
|
|
|
// paths := agentic.WorkspaceStatusPaths()
|
|
|
|
|
func WorkspaceStatusPaths() []string {
|
|
|
|
|
return workspaceStatusPaths(WorkspaceRoot())
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:11:46 +00:00
|
|
|
// WorkspaceStatusPath returns the status file for a workspace directory.
|
|
|
|
|
//
|
|
|
|
|
// path := agentic.WorkspaceStatusPath("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceStatusPath(wsDir string) string {
|
|
|
|
|
return core.JoinPath(wsDir, "status.json")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 20:40:20 +01:00
|
|
|
// WorkspaceName extracts the unique workspace name from a full path.
|
|
|
|
|
// Given /Users/snider/Code/.core/workspace/core/go-io/dev → core/go-io/dev
|
|
|
|
|
//
|
|
|
|
|
// name := agentic.WorkspaceName("/Users/snider/Code/.core/workspace/core/go-io/dev")
|
|
|
|
|
func WorkspaceName(wsDir string) string {
|
|
|
|
|
root := WorkspaceRoot()
|
|
|
|
|
name := core.TrimPrefix(wsDir, root)
|
|
|
|
|
name = core.TrimPrefix(name, "/")
|
|
|
|
|
if name == "" {
|
|
|
|
|
return core.PathBase(wsDir)
|
|
|
|
|
}
|
|
|
|
|
return name
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 18:13:44 +00:00
|
|
|
// CoreRoot returns the root directory for core ecosystem files.
|
|
|
|
|
// Checks CORE_WORKSPACE env var first, falls back to ~/Code/.core.
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
//
|
|
|
|
|
// root := agentic.CoreRoot()
|
2026-03-17 18:13:44 +00:00
|
|
|
func CoreRoot() string {
|
refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.
10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.
Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.
Bumps dappco.re/go/core to v0.6.0.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
|
|
|
if root := core.Env("CORE_WORKSPACE"); root != "" {
|
2026-03-17 18:13:44 +00:00
|
|
|
return root
|
|
|
|
|
}
|
refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.
10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.
Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.
Bumps dappco.re/go/core to v0.6.0.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
|
|
|
return core.JoinPath(core.Env("DIR_HOME"), "Code", ".core")
|
2026-03-17 18:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 20:15:58 +00:00
|
|
|
func workspaceStatusPaths(wsRoot string) []string {
|
|
|
|
|
old := core.PathGlob(core.JoinPath(wsRoot, "*", "status.json"))
|
|
|
|
|
deep := core.PathGlob(core.JoinPath(wsRoot, "*", "*", "*", "status.json"))
|
|
|
|
|
return append(old, deep...)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:11:46 +00:00
|
|
|
// WorkspaceRepoDir returns the checked-out repo directory for a workspace.
|
|
|
|
|
//
|
|
|
|
|
// repoDir := agentic.WorkspaceRepoDir("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceRepoDir(wsDir string) string {
|
2026-03-29 20:15:58 +00:00
|
|
|
return core.JoinPath(wsDir, "repo")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:11:46 +00:00
|
|
|
func workspaceRepoDir(wsDir string) string {
|
|
|
|
|
return WorkspaceRepoDir(wsDir)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WorkspaceMetaDir returns the metadata directory for a workspace.
|
|
|
|
|
//
|
|
|
|
|
// metaDir := agentic.WorkspaceMetaDir("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceMetaDir(wsDir string) string {
|
2026-03-29 20:15:58 +00:00
|
|
|
return core.JoinPath(wsDir, ".meta")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 21:11:46 +00:00
|
|
|
func workspaceMetaDir(wsDir string) string {
|
|
|
|
|
return WorkspaceMetaDir(wsDir)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WorkspaceBlockedPath returns the BLOCKED.md path for a workspace.
|
|
|
|
|
//
|
|
|
|
|
// blocked := agentic.WorkspaceBlockedPath("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceBlockedPath(wsDir string) string {
|
|
|
|
|
return core.JoinPath(WorkspaceRepoDir(wsDir), "BLOCKED.md")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 20:15:58 +00:00
|
|
|
func workspaceBlockedPath(wsDir string) string {
|
2026-03-29 21:11:46 +00:00
|
|
|
return WorkspaceBlockedPath(wsDir)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WorkspaceAnswerPath returns the ANSWER.md path for a workspace.
|
|
|
|
|
//
|
|
|
|
|
// answer := agentic.WorkspaceAnswerPath("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceAnswerPath(wsDir string) string {
|
|
|
|
|
return core.JoinPath(WorkspaceRepoDir(wsDir), "ANSWER.md")
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func workspaceAnswerPath(wsDir string) string {
|
2026-03-29 21:11:46 +00:00
|
|
|
return WorkspaceAnswerPath(wsDir)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WorkspaceLogFiles returns captured agent log files for a workspace.
|
|
|
|
|
//
|
|
|
|
|
// logs := agentic.WorkspaceLogFiles("/srv/.core/workspace/core/go-io/task-5")
|
|
|
|
|
func WorkspaceLogFiles(wsDir string) []string {
|
|
|
|
|
return core.PathGlob(core.JoinPath(WorkspaceMetaDir(wsDir), "agent-*.log"))
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func workspaceLogFiles(wsDir string) []string {
|
2026-03-29 21:11:46 +00:00
|
|
|
return WorkspaceLogFiles(wsDir)
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-17 18:13:44 +00:00
|
|
|
// PlansRoot returns the root directory for agent plans.
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
//
|
|
|
|
|
// plansDir := agentic.PlansRoot()
|
2026-03-17 18:13:44 +00:00
|
|
|
func PlansRoot() string {
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
return core.JoinPath(CoreRoot(), "plans")
|
2026-03-17 18:13:44 +00:00
|
|
|
}
|
2026-03-17 19:19:04 +00:00
|
|
|
|
|
|
|
|
// AgentName returns the name of this agent based on hostname.
|
|
|
|
|
// Checks AGENT_NAME env var first.
|
2026-03-22 03:41:07 +00:00
|
|
|
//
|
|
|
|
|
// name := agentic.AgentName() // "cladius" on Snider's Mac, "charon" elsewhere
|
2026-03-17 19:19:04 +00:00
|
|
|
func AgentName() string {
|
refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.
10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.
Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.
Bumps dappco.re/go/core to v0.6.0.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
|
|
|
if name := core.Env("AGENT_NAME"); name != "" {
|
2026-03-17 19:19:04 +00:00
|
|
|
return name
|
|
|
|
|
}
|
refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.
10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.
Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.
Bumps dappco.re/go/core to v0.6.0.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
|
|
|
h := core.Lower(core.Env("HOSTNAME"))
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
if core.Contains(h, "snider") || core.Contains(h, "studio") || core.Contains(h, "mac") {
|
2026-03-17 19:19:04 +00:00
|
|
|
return "cladius"
|
|
|
|
|
}
|
|
|
|
|
return "charon"
|
|
|
|
|
}
|
2026-03-17 19:27:44 +00:00
|
|
|
|
2026-03-22 03:41:07 +00:00
|
|
|
// DefaultBranch detects the default branch of a repo (main, master, etc.).
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
//
|
feat(v0.8.0): full AX migration — ServiceRuntime, Actions, quality gates, transport
go-process:
- Register factory, Result lifecycle, 5 named Action handlers
- Start/Run/StartWithOptions/RunWithOptions all return core.Result
- core.ID() replaces fmt.Sprintf, core.As replaces errors.As
core/agent:
- PrepSubsystem + monitor.Subsystem + setup.Service embed ServiceRuntime[T]
- 22 named Actions + agent.completion Task pipeline in OnStartup
- ChannelNotifier removed — all IPC via c.ACTION(messages.X{})
- proc.go: all methods via s.Core().Process(), returns core.Result
- status.go: WriteAtomic + JSONMarshalString
- paths.go: Fs.NewUnrestricted() replaces unsafe.Pointer
- transport.go: ONE net/http file — HTTPGet/HTTPPost/HTTPDo/MCP transport
- All disallowed imports eliminated from source files (13 quality gates)
- String concat eliminated — core.Concat() throughout
- 1:1 _test.go + _example_test.go for every source file
- Reference docs synced from core/go v0.8.0
- RFC-025 updated with net/http, net/url, io/fs quality gates
- lib.go: io/fs eliminated via Data.ListNames, Array[T].Deduplicate
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 01:27:46 +00:00
|
|
|
// base := s.DefaultBranch("./src")
|
|
|
|
|
func (s *PrepSubsystem) DefaultBranch(repoDir string) string {
|
2026-03-25 09:51:57 +00:00
|
|
|
ctx := context.Background()
|
2026-03-30 15:48:21 +00:00
|
|
|
process := s.Core().Process()
|
|
|
|
|
if r := process.RunIn(ctx, repoDir, "git", "symbolic-ref", "refs/remotes/origin/HEAD", "--short"); r.OK {
|
|
|
|
|
ref := core.Trim(r.Value.(string))
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
if core.HasPrefix(ref, "origin/") {
|
|
|
|
|
return core.TrimPrefix(ref, "origin/")
|
2026-03-21 16:22:18 +00:00
|
|
|
}
|
|
|
|
|
return ref
|
|
|
|
|
}
|
|
|
|
|
for _, branch := range []string{"main", "master"} {
|
2026-03-30 15:48:21 +00:00
|
|
|
if process.RunIn(ctx, repoDir, "git", "rev-parse", "--verify", branch).OK {
|
2026-03-21 16:22:18 +00:00
|
|
|
return branch
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return "main"
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-17 19:27:44 +00:00
|
|
|
// GitHubOrg returns the GitHub org for mirror operations.
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
//
|
|
|
|
|
// org := agentic.GitHubOrg() // "dAppCore"
|
2026-03-17 19:27:44 +00:00
|
|
|
func GitHubOrg() string {
|
refactor(agentic): adopt core.Env() + core.Path() across package
Replace all os.UserHomeDir/os.Getenv/os.Hostname with core.Env().
Replace all filepath.Base/Dir/Glob/IsAbs with core.PathBase/PathDir/
PathGlob/PathIsAbs.
10 files migrated: paths, prep, review_queue, remote, dispatch,
ingest, mirror, plan, verify, watch.
Imports eliminated: 5x os, 7x filepath. All file I/O and path
construction now routes through Core primitives.
Bumps dappco.re/go/core to v0.6.0.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 10:15:15 +00:00
|
|
|
if org := core.Env("GITHUB_ORG"); org != "" {
|
2026-03-17 19:27:44 +00:00
|
|
|
return org
|
|
|
|
|
}
|
|
|
|
|
return "dAppCore"
|
|
|
|
|
}
|
refactor: migrate core/agent to Core primitives — reference implementation
Phase 1: go-io/go-log → core.Fs{}, core.E(), core.Error/Info/Warn
Phase 2: strings/fmt → core.Contains, core.Sprintf, core.Split etc
Phase 3: embed.FS → core.Mount/core.Embed, core.Extract
Phase 4: cmd/main.go → core.Command(), c.Cli().Run(), no cli package
All packages migrated:
- pkg/lib (Codex): core.Mount, core.Extract, Result returns, AX comments
- pkg/setup (Codex): core.Fs, core.E, fixed missing lib helpers
- pkg/brain (Codex): Core primitives, AX comments
- pkg/monitor (Codex): Core string/logging primitives
- pkg/agentic (Codex): 20 files, Core primitives throughout
- cmd/main.go: pure Core CLI, no fmt/log/filepath/strings/cli
Remaining stdlib: path/filepath (Core doesn't wrap OS paths),
fmt.Sscanf/strings.Map (no Core equivalent).
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-22 06:13:41 +00:00
|
|
|
|
|
|
|
|
func parseInt(value string) int {
|
|
|
|
|
n, err := strconv.Atoi(core.Trim(value))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
return n
|
|
|
|
|
}
|