chore: update module paths and daemon refactor
Some checks are pending
Security Scan / Go Vulnerability Check (push) Waiting to run
Security Scan / Secret Detection (push) Waiting to run
Security Scan / Dependency & Config Scan (push) Waiting to run

Sync CLI module imports across all command packages.
Refactor daemon command with expanded functionality.
Update go.mod and go.work dependencies.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-02-17 19:19:40 +00:00
parent e64fa7b4ff
commit 1bf130b25a
87 changed files with 402 additions and 134 deletions

View file

@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
"forge.lthn.ai/core/go/pkg/agentci"
"forge.lthn.ai/core/go-scm/agentci"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/config"
)

View file

@ -10,7 +10,7 @@ import (
"strings"
"time"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -7,7 +7,7 @@ import (
"fmt"
"time"
"forge.lthn.ai/core/go/pkg/ai"
"forge.lthn.ai/core/go-ai/ai"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -9,8 +9,8 @@ import (
"strings"
"time"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go/pkg/ai"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go-ai/ai"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -6,8 +6,8 @@ import (
"context"
"time"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go/pkg/ai"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go-ai/ai"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/io"
)

View file

@ -5,7 +5,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
collectpkg "forge.lthn.ai/core/go/pkg/collect"
collectpkg "forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -4,7 +4,7 @@ import (
"context"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -4,7 +4,7 @@ import (
"context"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -4,7 +4,7 @@ import (
"context"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/collect"
"forge.lthn.ai/core/go-scm/collect"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"path/filepath"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/crypt"
"forge.lthn.ai/core/go-crypt/crypt"
)
// Checksum command flags

View file

@ -6,7 +6,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/crypt"
"forge.lthn.ai/core/go-crypt/crypt"
)
// Encrypt command flags

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/crypt"
"forge.lthn.ai/core/go-crypt/crypt"
"golang.org/x/crypto/bcrypt"
)

View file

@ -3,13 +3,21 @@ package daemon
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
"forge.lthn.ai/core/go/pkg/mcp"
"forge.lthn.ai/core/go/pkg/process"
"forge.lthn.ai/core/go-ai/mcp"
)
func init() {
@ -47,7 +55,6 @@ func DefaultConfig() Config {
}
// ConfigFromEnv loads configuration from environment variables.
// Environment variables override default values.
func ConfigFromEnv() Config {
cfg := DefaultConfig()
@ -67,40 +74,207 @@ func ConfigFromEnv() Config {
return cfg
}
// AddDaemonCommand adds the 'daemon' command to the root.
// AddDaemonCommand adds the 'daemon' command group to the root.
func AddDaemonCommand(root *cli.Command) {
cfg := ConfigFromEnv()
daemonCmd := cli.NewCommand(
daemonCmd := cli.NewGroup(
"daemon",
"Start the core daemon",
"Starts the core daemon which provides long-running services like MCP.\n\n"+
"The daemon can be configured via environment variables or flags:\n"+
" CORE_MCP_TRANSPORT - MCP transport type (stdio, tcp, socket)\n"+
" CORE_MCP_ADDR - MCP address/path (e.g., :9100, /tmp/mcp.sock)\n"+
" CORE_HEALTH_ADDR - Health check endpoint address\n"+
" CORE_PID_FILE - PID file path for single-instance enforcement",
"Manage the core daemon",
"Manage the core background daemon which provides long-running services.\n\n"+
"Subcommands:\n"+
" start - Start the daemon in the background\n"+
" stop - Stop the running daemon\n"+
" status - Show daemon status\n"+
" run - Run in foreground (for development/debugging)",
)
// Persistent flags inherited by all subcommands
cli.PersistentStringFlag(daemonCmd, &cfg.MCPTransport, "mcp-transport", "t", cfg.MCPTransport,
"MCP transport type (stdio, tcp, socket)")
cli.PersistentStringFlag(daemonCmd, &cfg.MCPAddr, "mcp-addr", "a", cfg.MCPAddr,
"MCP listen address (e.g., :9100 or /tmp/mcp.sock)")
cli.PersistentStringFlag(daemonCmd, &cfg.HealthAddr, "health-addr", "", cfg.HealthAddr,
"Health check endpoint address (empty to disable)")
cli.PersistentStringFlag(daemonCmd, &cfg.PIDFile, "pid-file", "", cfg.PIDFile,
"PID file path (empty to disable)")
// --- Subcommands ---
startCmd := cli.NewCommand("start", "Start the daemon in the background",
"Re-executes the core binary as a background daemon process.\n"+
"The daemon PID is written to the PID file for later management.",
func(cmd *cli.Command, args []string) error {
return runDaemon(cfg)
return runStart(cfg)
},
)
// Flags override environment variables
cli.StringFlag(daemonCmd, &cfg.MCPTransport, "mcp-transport", "t", cfg.MCPTransport,
"MCP transport type (stdio, tcp, socket)")
cli.StringFlag(daemonCmd, &cfg.MCPAddr, "mcp-addr", "a", cfg.MCPAddr,
"MCP listen address (e.g., :9100 or /tmp/mcp.sock)")
cli.StringFlag(daemonCmd, &cfg.HealthAddr, "health-addr", "", cfg.HealthAddr,
"Health check endpoint address (empty to disable)")
cli.StringFlag(daemonCmd, &cfg.PIDFile, "pid-file", "", cfg.PIDFile,
"PID file path (empty to disable)")
stopCmd := cli.NewCommand("stop", "Stop the running daemon",
"Sends SIGTERM to the daemon process identified by the PID file.\n"+
"Waits for graceful shutdown before returning.",
func(cmd *cli.Command, args []string) error {
return runStop(cfg)
},
)
statusCmd := cli.NewCommand("status", "Show daemon status",
"Checks if the daemon is running and queries its health endpoint.",
func(cmd *cli.Command, args []string) error {
return runStatus(cfg)
},
)
runCmd := cli.NewCommand("run", "Run the daemon in the foreground",
"Runs the daemon in the current terminal (blocks until SIGINT/SIGTERM).\n"+
"Useful for development, debugging, or running under a process manager.",
func(cmd *cli.Command, args []string) error {
return runForeground(cfg)
},
)
daemonCmd.AddCommand(startCmd, stopCmd, statusCmd, runCmd)
root.AddCommand(daemonCmd)
}
// runDaemon starts the daemon with the given configuration.
func runDaemon(cfg Config) error {
// Set daemon mode environment for child processes
// runStart re-execs the current binary as a detached daemon process.
func runStart(cfg Config) error {
// Check if already running
if pid, running := readPID(cfg.PIDFile); running {
return fmt.Errorf("daemon already running (PID %d)", pid)
}
// Find the current binary
exe, err := os.Executable()
if err != nil {
return fmt.Errorf("failed to find executable: %w", err)
}
// Build args for the foreground run command
args := []string{"daemon", "run",
"--mcp-transport", cfg.MCPTransport,
"--mcp-addr", cfg.MCPAddr,
"--health-addr", cfg.HealthAddr,
"--pid-file", cfg.PIDFile,
}
// Launch detached child with CORE_DAEMON=1
cmd := exec.Command(exe, args...)
cmd.Env = append(os.Environ(), "CORE_DAEMON=1")
cmd.Stdout = nil
cmd.Stderr = nil
cmd.Stdin = nil
// Detach from parent process group
cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}
if err := cmd.Start(); err != nil {
return fmt.Errorf("failed to start daemon: %w", err)
}
pid := cmd.Process.Pid
// Release the child process so it runs independently
_ = cmd.Process.Release()
// Wait briefly for the health endpoint to come up
if cfg.HealthAddr != "" {
ready := waitForHealth(cfg.HealthAddr, 5*time.Second)
if ready {
log.Info("Daemon started", "pid", pid, "health", cfg.HealthAddr)
} else {
log.Info("Daemon started (health check not yet ready)", "pid", pid)
}
} else {
log.Info("Daemon started", "pid", pid)
}
return nil
}
// runStop sends SIGTERM to the daemon process.
func runStop(cfg Config) error {
pid, running := readPID(cfg.PIDFile)
if !running {
log.Info("Daemon is not running")
return nil
}
proc, err := os.FindProcess(pid)
if err != nil {
return fmt.Errorf("failed to find process %d: %w", pid, err)
}
log.Info("Stopping daemon", "pid", pid)
if err := proc.Signal(syscall.SIGTERM); err != nil {
return fmt.Errorf("failed to send SIGTERM to PID %d: %w", pid, err)
}
// Wait for the process to exit (poll PID file removal)
deadline := time.Now().Add(30 * time.Second)
for time.Now().Before(deadline) {
if _, still := readPID(cfg.PIDFile); !still {
log.Info("Daemon stopped")
return nil
}
time.Sleep(250 * time.Millisecond)
}
log.Warn("Daemon did not stop within 30s, sending SIGKILL")
_ = proc.Signal(syscall.SIGKILL)
// Clean up stale PID file
_ = os.Remove(cfg.PIDFile)
log.Info("Daemon killed")
return nil
}
// runStatus checks daemon status via PID and health endpoint.
func runStatus(cfg Config) error {
pid, running := readPID(cfg.PIDFile)
if !running {
fmt.Println("Daemon is not running")
return nil
}
fmt.Printf("Daemon is running (PID %d)\n", pid)
// Query health endpoint if configured
if cfg.HealthAddr != "" {
healthURL := fmt.Sprintf("http://%s/health", cfg.HealthAddr)
resp, err := http.Get(healthURL)
if err != nil {
fmt.Printf("Health: unreachable (%v)\n", err)
return nil
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
fmt.Println("Health: ok")
} else {
fmt.Printf("Health: unhealthy (HTTP %d)\n", resp.StatusCode)
}
// Check readiness
readyURL := fmt.Sprintf("http://%s/ready", cfg.HealthAddr)
resp2, err := http.Get(readyURL)
if err == nil {
defer resp2.Body.Close()
if resp2.StatusCode == http.StatusOK {
fmt.Println("Ready: yes")
} else {
fmt.Println("Ready: no")
}
}
}
return nil
}
// runForeground runs the daemon in the current process (blocking).
// This is what `core daemon run` and the detached child process execute.
func runForeground(cfg Config) error {
os.Setenv("CORE_DAEMON", "1")
log.Info("Starting daemon",
@ -127,33 +301,61 @@ func runDaemon(cfg Config) error {
return fmt.Errorf("failed to start daemon: %w", err)
}
// Get context that cancels on SIGINT/SIGTERM
ctx := cli.Context()
// Create supervisor for managed services
sup := process.NewSupervisor(nil) // nil service — we only supervise Go functions
// Start MCP server in background
mcpErrCh := make(chan error, 1)
go func() {
mcpErrCh <- startMCP(ctx, mcpSvc, cfg)
}()
// Register MCP server as a supervised service
sup.RegisterFunc(process.GoSpec{
Name: "mcp",
Func: func(ctx context.Context) error {
return startMCP(ctx, mcpSvc, cfg)
},
Restart: process.RestartPolicy{
Delay: 3 * time.Second,
MaxRestarts: -1, // Unlimited restarts
},
})
// Start supervised services
sup.Start()
// Mark as ready
daemon.SetReady(true)
// Add supervisor status to health checks
daemon.AddHealthCheck(func() error {
statuses := sup.Statuses()
for name, status := range statuses {
if !status.Running {
return fmt.Errorf("service %s is not running (restarts: %d)", name, status.RestartCount)
}
}
return nil
})
log.Info("Daemon ready",
"pid", os.Getpid(),
"health", daemon.HealthAddr(),
"services", strings.Join(sup.UnitNames(), ", "),
)
// Wait for shutdown signal or MCP error
select {
case err := <-mcpErrCh:
if err != nil && ctx.Err() == nil {
log.Error("MCP server error", "err", err)
return err
}
case <-ctx.Done():
log.Info("Shutting down daemon")
// Print supervised service status as JSON for machine consumption
statuses := sup.Statuses()
if data, err := json.Marshal(statuses); err == nil {
log.Debug("Supervised services", "statuses", string(data))
}
// Get context that cancels on SIGINT/SIGTERM
ctx := cli.Context()
// Wait for shutdown signal
<-ctx.Done()
log.Info("Shutting down daemon")
// Stop supervised services first
sup.Stop()
// Then stop the daemon (releases PID, stops health server)
return daemon.Stop()
}
@ -176,3 +378,50 @@ func startMCP(ctx context.Context, svc *mcp.Service, cfg Config) error {
return fmt.Errorf("unknown MCP transport: %s (valid: stdio, tcp, socket)", cfg.MCPTransport)
}
}
// --- Helpers ---
// readPID reads the PID file and checks if the process is still running.
func readPID(path string) (int, bool) {
data, err := os.ReadFile(path)
if err != nil {
return 0, false
}
pid, err := strconv.Atoi(strings.TrimSpace(string(data)))
if err != nil || pid <= 0 {
return 0, false
}
// Check if process is actually running
proc, err := os.FindProcess(pid)
if err != nil {
return pid, false
}
// Signal 0 tests if the process exists without actually sending a signal
if err := proc.Signal(syscall.Signal(0)); err != nil {
return pid, false
}
return pid, true
}
// waitForHealth polls the health endpoint until it responds or timeout.
func waitForHealth(addr string, timeout time.Duration) bool {
deadline := time.Now().Add(timeout)
url := fmt.Sprintf("http://%s/health", addr)
for time.Now().Before(deadline) {
resp, err := http.Get(url)
if err == nil {
resp.Body.Close()
if resp.StatusCode == http.StatusOK {
return true
}
}
time.Sleep(200 * time.Millisecond)
}
return false
}

View file

@ -8,7 +8,7 @@ import (
"strings"
"time"
"forge.lthn.ai/core/go/pkg/ansible"
"forge.lthn.ai/core/go-devops/ansible"
"forge.lthn.ai/core/go/pkg/cli"
"github.com/spf13/cobra"
)

View file

@ -7,7 +7,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/deploy/coolify"
"forge.lthn.ai/core/go-devops/deploy/coolify"
"forge.lthn.ai/core/go/pkg/i18n"
"github.com/spf13/cobra"
)

View file

@ -16,7 +16,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
core "forge.lthn.ai/core/go/pkg/framework/core"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/io"
"forge.lthn.ai/core/go/pkg/repos"

View file

@ -3,9 +3,9 @@ package dev
import (
"context"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go/pkg/framework"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
)
// WorkBundle contains the Core instance for dev work operations.

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
coreio "forge.lthn.ai/core/go/pkg/io"
)

View file

@ -15,7 +15,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
coreio "forge.lthn.ai/core/go/pkg/io"
"forge.lthn.ai/core/go/pkg/log"

View file

@ -7,7 +7,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"os/exec"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -7,7 +7,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/devops"
"forge.lthn.ai/core/go-devops/devops"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/io"
)

View file

@ -7,9 +7,9 @@ import (
"sort"
"strings"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,10 +5,10 @@ import (
"sort"
"strings"
"forge.lthn.ai/core/go/pkg/agentic"
"forge.lthn.ai/core/go-ai/agentic"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/framework"
"forge.lthn.ai/core/go/pkg/git"
"forge.lthn.ai/core/go-scm/git"
)
// Tasks for dev service

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Auth command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Config command flags.

View file

@ -7,7 +7,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Issues command flags.

View file

@ -6,7 +6,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Labels command flags.

View file

@ -6,7 +6,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Migrate command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// addOrgsCommand adds the 'orgs' subcommand for listing organisations.

View file

@ -7,7 +7,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// PRs command flags.

View file

@ -6,7 +6,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Repos command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// addStatusCommand adds the 'status' subcommand for instance info.

View file

@ -10,7 +10,7 @@ import (
forgejo "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
"forge.lthn.ai/core/go/pkg/cli"
fg "forge.lthn.ai/core/go/pkg/forge"
fg "forge.lthn.ai/core/go-scm/forge"
)
// Sync command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// Config command flags.

View file

@ -7,7 +7,7 @@ import (
"code.gitea.io/sdk/gitea"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// Issues command flags.

View file

@ -6,7 +6,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// Mirror command flags.

View file

@ -7,7 +7,7 @@ import (
sdk "code.gitea.io/sdk/gitea"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// PRs command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// Repos command flags.

View file

@ -10,7 +10,7 @@ import (
"code.gitea.io/sdk/gitea"
"forge.lthn.ai/core/go/pkg/cli"
gt "forge.lthn.ai/core/go/pkg/gitea"
gt "forge.lthn.ai/core/go-scm/gitea"
)
// Sync command flags.

View file

@ -11,7 +11,7 @@ import (
"syscall"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/mcp"
"forge.lthn.ai/core/go-ai/mcp"
)
func init() {

View file

@ -2,7 +2,7 @@ package ml
import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -2,7 +2,7 @@ package ml
import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var coverageCmd = &cli.Command{

View file

@ -6,7 +6,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -6,7 +6,7 @@ import (
"path/filepath"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var importCmd = &cli.Command{

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var ingestCmd = &cli.Command{

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var inventoryCmd = &cli.Command{

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var metricsCmd = &cli.Command{

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var normalizeMinLen int

View file

@ -7,7 +7,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -2,7 +2,7 @@ package ml
import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -7,7 +7,7 @@ import (
"strings"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var queryCmd = &cli.Command{

View file

@ -6,7 +6,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var seedInfluxCmd = &cli.Command{

View file

@ -5,7 +5,7 @@ import (
"os"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var statusCmd = &cli.Command{

View file

@ -4,7 +4,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/ml"
"forge.lthn.ai/core/go-ai/ml"
)
var (

View file

@ -7,7 +7,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/infra"
"forge.lthn.ai/core/go-devops/infra"
"github.com/spf13/cobra"
)

View file

@ -7,7 +7,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/infra"
"forge.lthn.ai/core/go-devops/infra"
"github.com/spf13/cobra"
)

View file

@ -7,7 +7,7 @@ import (
"time"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/infra"
"forge.lthn.ai/core/go-devops/infra"
"github.com/spf13/cobra"
)

View file

@ -8,9 +8,9 @@ import (
"sync"
"time"
"forge.lthn.ai/core/go/pkg/ansible"
"forge.lthn.ai/core/go-devops/ansible"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/infra"
"forge.lthn.ai/core/go-devops/infra"
"github.com/spf13/cobra"
)

View file

@ -6,7 +6,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/rag"
"forge.lthn.ai/core/go-ai/rag"
"github.com/spf13/cobra"
)

View file

@ -6,7 +6,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/rag"
"forge.lthn.ai/core/go-ai/rag"
"github.com/spf13/cobra"
)

View file

@ -5,7 +5,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/rag"
"forge.lthn.ai/core/go-ai/rag"
"github.com/spf13/cobra"
)

View file

@ -6,7 +6,7 @@ import (
"strings"
"time"
"forge.lthn.ai/core/go/pkg/ai"
"forge.lthn.ai/core/go-ai/ai"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -5,7 +5,7 @@ import (
"fmt"
"time"
"forge.lthn.ai/core/go/pkg/ai"
"forge.lthn.ai/core/go-ai/ai"
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/i18n"
)

View file

@ -32,8 +32,8 @@ func parseTestOutput(output string) testResults {
results := testResults{}
// Regex patterns - handle both timed and cached test results
// Example: ok forge.lthn.ai/core/go/pkg/crypt 0.015s coverage: 91.2% of statements
// Example: ok forge.lthn.ai/core/go/pkg/crypt (cached) coverage: 91.2% of statements
// Example: ok forge.lthn.ai/core/go-crypt/crypt 0.015s coverage: 91.2% of statements
// Example: ok forge.lthn.ai/core/go-crypt/crypt (cached) coverage: 91.2% of statements
okPattern := regexp.MustCompile(`^ok\s+(\S+)\s+(?:[\d.]+s|\(cached\))(?:\s+coverage:\s+([\d.]+)%)?`)
failPattern := regexp.MustCompile(`^FAIL\s+(\S+)`)
skipPattern := regexp.MustCompile(`^\?\s+(\S+)\s+\[no test files\]`)

View file

@ -6,7 +6,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// Clients command flags.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"forge.lthn.ai/core/go/pkg/cli"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// Config command flags.

View file

@ -5,7 +5,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// Devices command flags.

View file

@ -5,7 +5,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// Networks command flags.

View file

@ -5,7 +5,7 @@ import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// Routes command flags.

View file

@ -3,7 +3,7 @@ package unifi
import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go/pkg/log"
uf "forge.lthn.ai/core/go/pkg/unifi"
uf "forge.lthn.ai/core/go-netops/unifi"
)
// addSitesCommand adds the 'sites' subcommand for listing UniFi sites.

View file

@ -10,7 +10,7 @@ import (
"text/tabwriter"
"time"
"forge.lthn.ai/core/go/pkg/container"
"forge.lthn.ai/core/go-devops/container"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/io"
"github.com/spf13/cobra"

View file

@ -10,7 +10,7 @@ import (
"strings"
"text/tabwriter"
"forge.lthn.ai/core/go/pkg/container"
"forge.lthn.ai/core/go-devops/container"
"forge.lthn.ai/core/go/pkg/i18n"
"forge.lthn.ai/core/go/pkg/io"
"github.com/spf13/cobra"

18
go.mod
View file

@ -2,7 +2,14 @@ module forge.lthn.ai/core/cli
go 1.25.5
require forge.lthn.ai/core/go v0.0.0
require (
forge.lthn.ai/core/go v0.0.0
forge.lthn.ai/core/go-ai v0.0.0
forge.lthn.ai/core/go-crypt v0.0.0
forge.lthn.ai/core/go-devops v0.0.0
forge.lthn.ai/core/go-netops v0.0.0
forge.lthn.ai/core/go-scm v0.0.0
)
require (
code.gitea.io/sdk/gitea v0.23.2
@ -117,4 +124,11 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
)
replace forge.lthn.ai/core/go => ../go
replace (
forge.lthn.ai/core/go => ../core
forge.lthn.ai/core/go-ai => ../go-ai
forge.lthn.ai/core/go-crypt => ../go-crypt
forge.lthn.ai/core/go-devops => ../go-devops
forge.lthn.ai/core/go-netops => ../go-netops
forge.lthn.ai/core/go-scm => ../go-scm
)

View file

@ -2,5 +2,10 @@ go 1.25.5
use (
.
../go
../core
../go-ai
../go-crypt
../go-devops
../go-netops
../go-scm
)

View file

@ -34,7 +34,7 @@ import (
_ "forge.lthn.ai/core/cli/cmd/updater"
_ "forge.lthn.ai/core/cli/cmd/vm"
_ "forge.lthn.ai/core/cli/cmd/workspace"
_ "forge.lthn.ai/core/go/pkg/build/buildcmd"
_ "forge.lthn.ai/core/go-devops/build/buildcmd"
// Variant repos (optional — comment out to exclude)
// _ "forge.lthn.ai/core/php"