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"
|
2026-03-30 20:12:39 +00:00
|
|
|
iofs "io/fs"
|
|
|
|
|
"sort"
|
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-30 22:54:19 +00:00
|
|
|
// r := fs.Read("/etc/hostname")
|
|
|
|
|
// 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
|
|
|
|
2026-04-02 04:28:37 +00:00
|
|
|
var workspaceRootOverride string
|
|
|
|
|
|
|
|
|
|
func setWorkspaceRootOverride(root string) {
|
|
|
|
|
workspaceRootOverride = core.Trim(root)
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +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-30 22:54:19 +00:00
|
|
|
// workspaceDir := core.JoinPath(agentic.WorkspaceRoot(), "core", "go-io", "task-42")
|
2026-03-17 18:13:44 +00:00
|
|
|
func WorkspaceRoot() string {
|
2026-04-02 04:28:37 +00:00
|
|
|
if root := core.Trim(workspaceRootOverride); root != "" {
|
|
|
|
|
return root
|
|
|
|
|
}
|
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-30 22:54:19 +00:00
|
|
|
// paths := agentic.WorkspaceStatusPaths()
|
2026-03-29 20:15:58 +00:00
|
|
|
func WorkspaceStatusPaths() []string {
|
|
|
|
|
return workspaceStatusPaths(WorkspaceRoot())
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// path := agentic.WorkspaceStatusPath("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceStatusPath(workspaceDir string) string {
|
|
|
|
|
return core.JoinPath(workspaceDir, "status.json")
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// name := agentic.WorkspaceName("/Users/snider/Code/.core/workspace/core/go-io/dev")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceName(workspaceDir string) string {
|
2026-03-29 20:40:20 +01:00
|
|
|
root := WorkspaceRoot()
|
2026-03-30 21:22:54 +00:00
|
|
|
name := core.TrimPrefix(workspaceDir, root)
|
2026-03-29 20:40:20 +01:00
|
|
|
name = core.TrimPrefix(name, "/")
|
|
|
|
|
if name == "" {
|
2026-03-30 21:22:54 +00:00
|
|
|
return core.PathBase(workspaceDir)
|
2026-03-29 20:40:20 +01:00
|
|
|
}
|
|
|
|
|
return name
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +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
|
|
|
|
|
}
|
2026-03-30 18:52:15 +00:00
|
|
|
return core.JoinPath(HomeDir(), "Code", ".core")
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// home := agentic.HomeDir()
|
2026-03-30 18:52:15 +00:00
|
|
|
func HomeDir() string {
|
|
|
|
|
if home := core.Env("CORE_HOME"); home != "" {
|
|
|
|
|
return home
|
|
|
|
|
}
|
|
|
|
|
if home := core.Env("HOME"); home != "" {
|
|
|
|
|
return home
|
|
|
|
|
}
|
|
|
|
|
return core.Env("DIR_HOME")
|
2026-03-17 18:13:44 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceStatusPaths(workspaceRoot string) []string {
|
|
|
|
|
if workspaceRoot == "" {
|
2026-03-30 20:12:39 +00:00
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var paths []string
|
|
|
|
|
seen := make(map[string]bool)
|
|
|
|
|
|
|
|
|
|
var walk func(dir string, depth int)
|
|
|
|
|
walk = func(dir string, depth int) {
|
|
|
|
|
r := fs.List(dir)
|
|
|
|
|
if !r.OK {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entries, ok := r.Value.([]iofs.DirEntry)
|
|
|
|
|
if !ok {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
statusPath := core.JoinPath(dir, "status.json")
|
|
|
|
|
if fs.IsFile(statusPath) {
|
|
|
|
|
if depth == 1 || depth == 3 || (fs.IsDir(core.JoinPath(dir, "repo")) && fs.IsDir(core.JoinPath(dir, ".meta"))) {
|
|
|
|
|
if !seen[statusPath] {
|
|
|
|
|
seen[statusPath] = true
|
|
|
|
|
paths = append(paths, statusPath)
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for _, entry := range entries {
|
|
|
|
|
if !entry.IsDir() {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
walk(core.JoinPath(dir, entry.Name()), depth+1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
walk(workspaceRoot, 0)
|
2026-03-30 20:12:39 +00:00
|
|
|
sort.Strings(paths)
|
|
|
|
|
return paths
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// repoDir := agentic.WorkspaceRepoDir("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceRepoDir(workspaceDir string) string {
|
|
|
|
|
return core.JoinPath(workspaceDir, "repo")
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceRepoDir(workspaceDir string) string {
|
|
|
|
|
return WorkspaceRepoDir(workspaceDir)
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// metaDir := agentic.WorkspaceMetaDir("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceMetaDir(workspaceDir string) string {
|
|
|
|
|
return core.JoinPath(workspaceDir, ".meta")
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceMetaDir(workspaceDir string) string {
|
|
|
|
|
return WorkspaceMetaDir(workspaceDir)
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// blocked := agentic.WorkspaceBlockedPath("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceBlockedPath(workspaceDir string) string {
|
|
|
|
|
return core.JoinPath(WorkspaceRepoDir(workspaceDir), "BLOCKED.md")
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceBlockedPath(workspaceDir string) string {
|
|
|
|
|
return WorkspaceBlockedPath(workspaceDir)
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// answer := agentic.WorkspaceAnswerPath("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceAnswerPath(workspaceDir string) string {
|
|
|
|
|
return core.JoinPath(WorkspaceRepoDir(workspaceDir), "ANSWER.md")
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceAnswerPath(workspaceDir string) string {
|
|
|
|
|
return WorkspaceAnswerPath(workspaceDir)
|
2026-03-29 21:11:46 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +00:00
|
|
|
// logs := agentic.WorkspaceLogFiles("/srv/.core/workspace/core/go-io/task-5")
|
2026-03-30 21:22:54 +00:00
|
|
|
func WorkspaceLogFiles(workspaceDir string) []string {
|
|
|
|
|
return core.PathGlob(core.JoinPath(WorkspaceMetaDir(workspaceDir), "agent-*.log"))
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 21:22:54 +00:00
|
|
|
func workspaceLogFiles(workspaceDir string) []string {
|
|
|
|
|
return WorkspaceLogFiles(workspaceDir)
|
2026-03-29 20:15:58 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-30 22:54:19 +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
|
|
|
|
2026-03-30 22:54:19 +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-30 22:54:19 +00:00
|
|
|
// base := s.DefaultBranch("/srv/Code/core/go-io/repo")
|
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
|
|
|
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-30 22:54:19 +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
|
|
|
|
|
}
|