From 1bf130b25a6372a7d0cf297888b4704840e07cbf Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 17 Feb 2026 19:19:40 +0000 Subject: [PATCH] chore: update module paths and daemon refactor 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 --- cmd/ai/cmd_agent.go | 2 +- cmd/ai/cmd_git.go | 2 +- cmd/ai/cmd_metrics.go | 2 +- cmd/ai/cmd_tasks.go | 4 +- cmd/ai/cmd_updates.go | 4 +- cmd/collect/cmd.go | 2 +- cmd/collect/cmd_bitcointalk.go | 2 +- cmd/collect/cmd_dispatch.go | 2 +- cmd/collect/cmd_excavate.go | 2 +- cmd/collect/cmd_github.go | 2 +- cmd/collect/cmd_market.go | 2 +- cmd/collect/cmd_papers.go | 2 +- cmd/collect/cmd_process.go | 2 +- cmd/crypt/cmd_checksum.go | 2 +- cmd/crypt/cmd_encrypt.go | 2 +- cmd/crypt/cmd_hash.go | 2 +- cmd/daemon/cmd.go | 329 +++++++++++++++++++++++++++++---- cmd/deploy/cmd_ansible.go | 2 +- cmd/deploy/cmd_deploy.go | 2 +- cmd/dev/cmd_apply.go | 2 +- cmd/dev/cmd_bundles.go | 4 +- cmd/dev/cmd_commit.go | 2 +- cmd/dev/cmd_file_sync.go | 2 +- cmd/dev/cmd_health.go | 2 +- cmd/dev/cmd_pull.go | 2 +- cmd/dev/cmd_push.go | 2 +- cmd/dev/cmd_vm.go | 2 +- cmd/dev/cmd_work.go | 4 +- cmd/dev/service.go | 4 +- cmd/forge/cmd_auth.go | 2 +- cmd/forge/cmd_config.go | 2 +- cmd/forge/cmd_issues.go | 2 +- cmd/forge/cmd_labels.go | 2 +- cmd/forge/cmd_migrate.go | 2 +- cmd/forge/cmd_orgs.go | 2 +- cmd/forge/cmd_prs.go | 2 +- cmd/forge/cmd_repos.go | 2 +- cmd/forge/cmd_status.go | 2 +- cmd/forge/cmd_sync.go | 2 +- cmd/gitea/cmd_config.go | 2 +- cmd/gitea/cmd_issues.go | 2 +- cmd/gitea/cmd_mirror.go | 2 +- cmd/gitea/cmd_prs.go | 2 +- cmd/gitea/cmd_repos.go | 2 +- cmd/gitea/cmd_sync.go | 2 +- cmd/mcpcmd/cmd_mcp.go | 2 +- cmd/ml/cmd_agent.go | 2 +- cmd/ml/cmd_approve.go | 2 +- cmd/ml/cmd_consolidate.go | 2 +- cmd/ml/cmd_convert.go | 2 +- cmd/ml/cmd_coverage.go | 2 +- cmd/ml/cmd_expand.go | 2 +- cmd/ml/cmd_export.go | 2 +- cmd/ml/cmd_gguf.go | 2 +- cmd/ml/cmd_import.go | 2 +- cmd/ml/cmd_ingest.go | 2 +- cmd/ml/cmd_inventory.go | 2 +- cmd/ml/cmd_metrics.go | 2 +- cmd/ml/cmd_normalize.go | 2 +- cmd/ml/cmd_probe.go | 2 +- cmd/ml/cmd_publish.go | 2 +- cmd/ml/cmd_query.go | 2 +- cmd/ml/cmd_score.go | 2 +- cmd/ml/cmd_seed_influx.go | 2 +- cmd/ml/cmd_status.go | 2 +- cmd/ml/cmd_worker.go | 2 +- cmd/prod/cmd_dns.go | 2 +- cmd/prod/cmd_lb.go | 2 +- cmd/prod/cmd_setup.go | 2 +- cmd/prod/cmd_status.go | 4 +- cmd/rag/cmd_collections.go | 2 +- cmd/rag/cmd_ingest.go | 2 +- cmd/rag/cmd_query.go | 2 +- cmd/security/cmd_jobs.go | 2 +- cmd/security/cmd_scan.go | 2 +- cmd/test/cmd_output.go | 4 +- cmd/unifi/cmd_clients.go | 2 +- cmd/unifi/cmd_config.go | 2 +- cmd/unifi/cmd_devices.go | 2 +- cmd/unifi/cmd_networks.go | 2 +- cmd/unifi/cmd_routes.go | 2 +- cmd/unifi/cmd_sites.go | 2 +- cmd/vm/cmd_container.go | 2 +- cmd/vm/cmd_templates.go | 2 +- go.mod | 18 +- go.work | 7 +- main.go | 2 +- 87 files changed, 402 insertions(+), 134 deletions(-) diff --git a/cmd/ai/cmd_agent.go b/cmd/ai/cmd_agent.go index 9e56815f..9091ddc3 100644 --- a/cmd/ai/cmd_agent.go +++ b/cmd/ai/cmd_agent.go @@ -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" ) diff --git a/cmd/ai/cmd_git.go b/cmd/ai/cmd_git.go index b9b17af6..ec11db23 100644 --- a/cmd/ai/cmd_git.go +++ b/cmd/ai/cmd_git.go @@ -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" ) diff --git a/cmd/ai/cmd_metrics.go b/cmd/ai/cmd_metrics.go index 55e8b19e..cb859b87 100644 --- a/cmd/ai/cmd_metrics.go +++ b/cmd/ai/cmd_metrics.go @@ -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" ) diff --git a/cmd/ai/cmd_tasks.go b/cmd/ai/cmd_tasks.go index c03f44ba..e4f9c53e 100644 --- a/cmd/ai/cmd_tasks.go +++ b/cmd/ai/cmd_tasks.go @@ -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" ) diff --git a/cmd/ai/cmd_updates.go b/cmd/ai/cmd_updates.go index f10903c7..a1eccfc4 100644 --- a/cmd/ai/cmd_updates.go +++ b/cmd/ai/cmd_updates.go @@ -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" ) diff --git a/cmd/collect/cmd.go b/cmd/collect/cmd.go index a4a45765..e1a81935 100644 --- a/cmd/collect/cmd.go +++ b/cmd/collect/cmd.go @@ -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" ) diff --git a/cmd/collect/cmd_bitcointalk.go b/cmd/collect/cmd_bitcointalk.go index b5efc2ed..92d9d4c2 100644 --- a/cmd/collect/cmd_bitcointalk.go +++ b/cmd/collect/cmd_bitcointalk.go @@ -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" ) diff --git a/cmd/collect/cmd_dispatch.go b/cmd/collect/cmd_dispatch.go index ee7ddbdf..09fafe61 100644 --- a/cmd/collect/cmd_dispatch.go +++ b/cmd/collect/cmd_dispatch.go @@ -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" ) diff --git a/cmd/collect/cmd_excavate.go b/cmd/collect/cmd_excavate.go index fdf22111..5aa4fbdd 100644 --- a/cmd/collect/cmd_excavate.go +++ b/cmd/collect/cmd_excavate.go @@ -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" ) diff --git a/cmd/collect/cmd_github.go b/cmd/collect/cmd_github.go index 20a4a36d..c71980f4 100644 --- a/cmd/collect/cmd_github.go +++ b/cmd/collect/cmd_github.go @@ -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" ) diff --git a/cmd/collect/cmd_market.go b/cmd/collect/cmd_market.go index eb3076dc..57b874ae 100644 --- a/cmd/collect/cmd_market.go +++ b/cmd/collect/cmd_market.go @@ -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" ) diff --git a/cmd/collect/cmd_papers.go b/cmd/collect/cmd_papers.go index 669e6368..547181cd 100644 --- a/cmd/collect/cmd_papers.go +++ b/cmd/collect/cmd_papers.go @@ -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" ) diff --git a/cmd/collect/cmd_process.go b/cmd/collect/cmd_process.go index 7143025e..c3eb6b4c 100644 --- a/cmd/collect/cmd_process.go +++ b/cmd/collect/cmd_process.go @@ -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" ) diff --git a/cmd/crypt/cmd_checksum.go b/cmd/crypt/cmd_checksum.go index 954886ab..0d726ade 100644 --- a/cmd/crypt/cmd_checksum.go +++ b/cmd/crypt/cmd_checksum.go @@ -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 diff --git a/cmd/crypt/cmd_encrypt.go b/cmd/crypt/cmd_encrypt.go index 3fad8f1a..7205a31c 100644 --- a/cmd/crypt/cmd_encrypt.go +++ b/cmd/crypt/cmd_encrypt.go @@ -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 diff --git a/cmd/crypt/cmd_hash.go b/cmd/crypt/cmd_hash.go index 1901422c..fd6ef3ca 100644 --- a/cmd/crypt/cmd_hash.go +++ b/cmd/crypt/cmd_hash.go @@ -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" ) diff --git a/cmd/daemon/cmd.go b/cmd/daemon/cmd.go index 6779dd73..c6bb7bbb 100644 --- a/cmd/daemon/cmd.go +++ b/cmd/daemon/cmd.go @@ -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 +} diff --git a/cmd/deploy/cmd_ansible.go b/cmd/deploy/cmd_ansible.go index 387bdbc2..27ad9af0 100644 --- a/cmd/deploy/cmd_ansible.go +++ b/cmd/deploy/cmd_ansible.go @@ -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" ) diff --git a/cmd/deploy/cmd_deploy.go b/cmd/deploy/cmd_deploy.go index 64f538c8..8ec43d9b 100644 --- a/cmd/deploy/cmd_deploy.go +++ b/cmd/deploy/cmd_deploy.go @@ -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" ) diff --git a/cmd/dev/cmd_apply.go b/cmd/dev/cmd_apply.go index bfc031f4..75c392d6 100644 --- a/cmd/dev/cmd_apply.go +++ b/cmd/dev/cmd_apply.go @@ -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" diff --git a/cmd/dev/cmd_bundles.go b/cmd/dev/cmd_bundles.go index 347262bc..1be61307 100644 --- a/cmd/dev/cmd_bundles.go +++ b/cmd/dev/cmd_bundles.go @@ -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. diff --git a/cmd/dev/cmd_commit.go b/cmd/dev/cmd_commit.go index 595d1f41..644e64eb 100644 --- a/cmd/dev/cmd_commit.go +++ b/cmd/dev/cmd_commit.go @@ -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" ) diff --git a/cmd/dev/cmd_file_sync.go b/cmd/dev/cmd_file_sync.go index 9e340bcc..436bf797 100644 --- a/cmd/dev/cmd_file_sync.go +++ b/cmd/dev/cmd_file_sync.go @@ -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" diff --git a/cmd/dev/cmd_health.go b/cmd/dev/cmd_health.go index 0bcbc28e..b898e3a7 100644 --- a/cmd/dev/cmd_health.go +++ b/cmd/dev/cmd_health.go @@ -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" ) diff --git a/cmd/dev/cmd_pull.go b/cmd/dev/cmd_pull.go index 3fcfec9a..ab8d2c7d 100644 --- a/cmd/dev/cmd_pull.go +++ b/cmd/dev/cmd_pull.go @@ -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" ) diff --git a/cmd/dev/cmd_push.go b/cmd/dev/cmd_push.go index 8313a2d6..48ca78e4 100644 --- a/cmd/dev/cmd_push.go +++ b/cmd/dev/cmd_push.go @@ -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" ) diff --git a/cmd/dev/cmd_vm.go b/cmd/dev/cmd_vm.go index 73dee5e3..fdfa16b3 100644 --- a/cmd/dev/cmd_vm.go +++ b/cmd/dev/cmd_vm.go @@ -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" ) diff --git a/cmd/dev/cmd_work.go b/cmd/dev/cmd_work.go index 4ab554a2..aa108817 100644 --- a/cmd/dev/cmd_work.go +++ b/cmd/dev/cmd_work.go @@ -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" ) diff --git a/cmd/dev/service.go b/cmd/dev/service.go index 7e6a6f09..83f0ab1a 100644 --- a/cmd/dev/service.go +++ b/cmd/dev/service.go @@ -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 diff --git a/cmd/forge/cmd_auth.go b/cmd/forge/cmd_auth.go index d410ff1a..c488a3fa 100644 --- a/cmd/forge/cmd_auth.go +++ b/cmd/forge/cmd_auth.go @@ -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. diff --git a/cmd/forge/cmd_config.go b/cmd/forge/cmd_config.go index d5ed8609..85749d2f 100644 --- a/cmd/forge/cmd_config.go +++ b/cmd/forge/cmd_config.go @@ -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. diff --git a/cmd/forge/cmd_issues.go b/cmd/forge/cmd_issues.go index 2506f527..6b40644d 100644 --- a/cmd/forge/cmd_issues.go +++ b/cmd/forge/cmd_issues.go @@ -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. diff --git a/cmd/forge/cmd_labels.go b/cmd/forge/cmd_labels.go index 5b25fb3d..5ad421a6 100644 --- a/cmd/forge/cmd_labels.go +++ b/cmd/forge/cmd_labels.go @@ -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. diff --git a/cmd/forge/cmd_migrate.go b/cmd/forge/cmd_migrate.go index 0c88c342..8f22c7bd 100644 --- a/cmd/forge/cmd_migrate.go +++ b/cmd/forge/cmd_migrate.go @@ -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. diff --git a/cmd/forge/cmd_orgs.go b/cmd/forge/cmd_orgs.go index b63c67ab..accb21dc 100644 --- a/cmd/forge/cmd_orgs.go +++ b/cmd/forge/cmd_orgs.go @@ -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. diff --git a/cmd/forge/cmd_prs.go b/cmd/forge/cmd_prs.go index 564c8566..0e26e702 100644 --- a/cmd/forge/cmd_prs.go +++ b/cmd/forge/cmd_prs.go @@ -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. diff --git a/cmd/forge/cmd_repos.go b/cmd/forge/cmd_repos.go index 0552b7c1..0784f2ba 100644 --- a/cmd/forge/cmd_repos.go +++ b/cmd/forge/cmd_repos.go @@ -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. diff --git a/cmd/forge/cmd_status.go b/cmd/forge/cmd_status.go index 4a169e9f..2de8b59c 100644 --- a/cmd/forge/cmd_status.go +++ b/cmd/forge/cmd_status.go @@ -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. diff --git a/cmd/forge/cmd_sync.go b/cmd/forge/cmd_sync.go index 8a34e7d8..d5a3fc1f 100644 --- a/cmd/forge/cmd_sync.go +++ b/cmd/forge/cmd_sync.go @@ -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. diff --git a/cmd/gitea/cmd_config.go b/cmd/gitea/cmd_config.go index 59b86411..6fdd49d1 100644 --- a/cmd/gitea/cmd_config.go +++ b/cmd/gitea/cmd_config.go @@ -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. diff --git a/cmd/gitea/cmd_issues.go b/cmd/gitea/cmd_issues.go index e882075c..cb627988 100644 --- a/cmd/gitea/cmd_issues.go +++ b/cmd/gitea/cmd_issues.go @@ -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. diff --git a/cmd/gitea/cmd_mirror.go b/cmd/gitea/cmd_mirror.go index 13ef28a5..7b466caf 100644 --- a/cmd/gitea/cmd_mirror.go +++ b/cmd/gitea/cmd_mirror.go @@ -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. diff --git a/cmd/gitea/cmd_prs.go b/cmd/gitea/cmd_prs.go index 4fa0dc58..ad9e629c 100644 --- a/cmd/gitea/cmd_prs.go +++ b/cmd/gitea/cmd_prs.go @@ -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. diff --git a/cmd/gitea/cmd_repos.go b/cmd/gitea/cmd_repos.go index 6a22e2ed..69af886d 100644 --- a/cmd/gitea/cmd_repos.go +++ b/cmd/gitea/cmd_repos.go @@ -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. diff --git a/cmd/gitea/cmd_sync.go b/cmd/gitea/cmd_sync.go index 7aa638f7..0e525fd7 100644 --- a/cmd/gitea/cmd_sync.go +++ b/cmd/gitea/cmd_sync.go @@ -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. diff --git a/cmd/mcpcmd/cmd_mcp.go b/cmd/mcpcmd/cmd_mcp.go index a85ec691..7c7c1ace 100644 --- a/cmd/mcpcmd/cmd_mcp.go +++ b/cmd/mcpcmd/cmd_mcp.go @@ -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() { diff --git a/cmd/ml/cmd_agent.go b/cmd/ml/cmd_agent.go index fbfe91df..b617a0fe 100644 --- a/cmd/ml/cmd_agent.go +++ b/cmd/ml/cmd_agent.go @@ -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 ( diff --git a/cmd/ml/cmd_approve.go b/cmd/ml/cmd_approve.go index 32311e81..a40f41e4 100644 --- a/cmd/ml/cmd_approve.go +++ b/cmd/ml/cmd_approve.go @@ -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 ( diff --git a/cmd/ml/cmd_consolidate.go b/cmd/ml/cmd_consolidate.go index 803996a5..1b3eec5e 100644 --- a/cmd/ml/cmd_consolidate.go +++ b/cmd/ml/cmd_consolidate.go @@ -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 ( diff --git a/cmd/ml/cmd_convert.go b/cmd/ml/cmd_convert.go index c0958adb..4e00620c 100644 --- a/cmd/ml/cmd_convert.go +++ b/cmd/ml/cmd_convert.go @@ -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 ( diff --git a/cmd/ml/cmd_coverage.go b/cmd/ml/cmd_coverage.go index 087746af..a4ae7765 100644 --- a/cmd/ml/cmd_coverage.go +++ b/cmd/ml/cmd_coverage.go @@ -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{ diff --git a/cmd/ml/cmd_expand.go b/cmd/ml/cmd_expand.go index e13bb661..6ef1fe32 100644 --- a/cmd/ml/cmd_expand.go +++ b/cmd/ml/cmd_expand.go @@ -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 ( diff --git a/cmd/ml/cmd_export.go b/cmd/ml/cmd_export.go index e16a9031..ebf08e06 100644 --- a/cmd/ml/cmd_export.go +++ b/cmd/ml/cmd_export.go @@ -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 ( diff --git a/cmd/ml/cmd_gguf.go b/cmd/ml/cmd_gguf.go index 0a0f1935..b48d9c23 100644 --- a/cmd/ml/cmd_gguf.go +++ b/cmd/ml/cmd_gguf.go @@ -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 ( diff --git a/cmd/ml/cmd_import.go b/cmd/ml/cmd_import.go index 54e540cf..11d3ce74 100644 --- a/cmd/ml/cmd_import.go +++ b/cmd/ml/cmd_import.go @@ -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{ diff --git a/cmd/ml/cmd_ingest.go b/cmd/ml/cmd_ingest.go index 45752e6b..efac7e99 100644 --- a/cmd/ml/cmd_ingest.go +++ b/cmd/ml/cmd_ingest.go @@ -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{ diff --git a/cmd/ml/cmd_inventory.go b/cmd/ml/cmd_inventory.go index edabb2a2..d3b8970c 100644 --- a/cmd/ml/cmd_inventory.go +++ b/cmd/ml/cmd_inventory.go @@ -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{ diff --git a/cmd/ml/cmd_metrics.go b/cmd/ml/cmd_metrics.go index a94bc26b..0438bb01 100644 --- a/cmd/ml/cmd_metrics.go +++ b/cmd/ml/cmd_metrics.go @@ -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{ diff --git a/cmd/ml/cmd_normalize.go b/cmd/ml/cmd_normalize.go index a1beb18e..152e1415 100644 --- a/cmd/ml/cmd_normalize.go +++ b/cmd/ml/cmd_normalize.go @@ -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 diff --git a/cmd/ml/cmd_probe.go b/cmd/ml/cmd_probe.go index d25652cb..779b3712 100644 --- a/cmd/ml/cmd_probe.go +++ b/cmd/ml/cmd_probe.go @@ -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 ( diff --git a/cmd/ml/cmd_publish.go b/cmd/ml/cmd_publish.go index 58de63c8..54b89b4a 100644 --- a/cmd/ml/cmd_publish.go +++ b/cmd/ml/cmd_publish.go @@ -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 ( diff --git a/cmd/ml/cmd_query.go b/cmd/ml/cmd_query.go index f7bfbc9d..185d3fcc 100644 --- a/cmd/ml/cmd_query.go +++ b/cmd/ml/cmd_query.go @@ -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{ diff --git a/cmd/ml/cmd_score.go b/cmd/ml/cmd_score.go index 901b9719..cf603c44 100644 --- a/cmd/ml/cmd_score.go +++ b/cmd/ml/cmd_score.go @@ -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 ( diff --git a/cmd/ml/cmd_seed_influx.go b/cmd/ml/cmd_seed_influx.go index 64eebe86..779b6d52 100644 --- a/cmd/ml/cmd_seed_influx.go +++ b/cmd/ml/cmd_seed_influx.go @@ -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{ diff --git a/cmd/ml/cmd_status.go b/cmd/ml/cmd_status.go index 0f41ac4b..987044a2 100644 --- a/cmd/ml/cmd_status.go +++ b/cmd/ml/cmd_status.go @@ -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{ diff --git a/cmd/ml/cmd_worker.go b/cmd/ml/cmd_worker.go index ec5d3eb8..61a9125e 100644 --- a/cmd/ml/cmd_worker.go +++ b/cmd/ml/cmd_worker.go @@ -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 ( diff --git a/cmd/prod/cmd_dns.go b/cmd/prod/cmd_dns.go index 093a9d5d..bea8097d 100644 --- a/cmd/prod/cmd_dns.go +++ b/cmd/prod/cmd_dns.go @@ -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" ) diff --git a/cmd/prod/cmd_lb.go b/cmd/prod/cmd_lb.go index 8c7f487c..b707d24c 100644 --- a/cmd/prod/cmd_lb.go +++ b/cmd/prod/cmd_lb.go @@ -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" ) diff --git a/cmd/prod/cmd_setup.go b/cmd/prod/cmd_setup.go index 2d0f7f32..776cbd91 100644 --- a/cmd/prod/cmd_setup.go +++ b/cmd/prod/cmd_setup.go @@ -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" ) diff --git a/cmd/prod/cmd_status.go b/cmd/prod/cmd_status.go index 700306ca..b816c84d 100644 --- a/cmd/prod/cmd_status.go +++ b/cmd/prod/cmd_status.go @@ -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" ) diff --git a/cmd/rag/cmd_collections.go b/cmd/rag/cmd_collections.go index d9c06161..bfcb508a 100644 --- a/cmd/rag/cmd_collections.go +++ b/cmd/rag/cmd_collections.go @@ -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" ) diff --git a/cmd/rag/cmd_ingest.go b/cmd/rag/cmd_ingest.go index 357cd16d..67e20aa3 100644 --- a/cmd/rag/cmd_ingest.go +++ b/cmd/rag/cmd_ingest.go @@ -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" ) diff --git a/cmd/rag/cmd_query.go b/cmd/rag/cmd_query.go index 327f2fa4..b058085f 100644 --- a/cmd/rag/cmd_query.go +++ b/cmd/rag/cmd_query.go @@ -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" ) diff --git a/cmd/security/cmd_jobs.go b/cmd/security/cmd_jobs.go index ae8498bf..e3f7b242 100644 --- a/cmd/security/cmd_jobs.go +++ b/cmd/security/cmd_jobs.go @@ -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" ) diff --git a/cmd/security/cmd_scan.go b/cmd/security/cmd_scan.go index 54c099ca..5d7ccb03 100644 --- a/cmd/security/cmd_scan.go +++ b/cmd/security/cmd_scan.go @@ -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" ) diff --git a/cmd/test/cmd_output.go b/cmd/test/cmd_output.go index 17d50f5b..450cf2b2 100644 --- a/cmd/test/cmd_output.go +++ b/cmd/test/cmd_output.go @@ -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\]`) diff --git a/cmd/unifi/cmd_clients.go b/cmd/unifi/cmd_clients.go index f88329e3..6cdbb97e 100644 --- a/cmd/unifi/cmd_clients.go +++ b/cmd/unifi/cmd_clients.go @@ -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. diff --git a/cmd/unifi/cmd_config.go b/cmd/unifi/cmd_config.go index b2aaf49b..c7f8e6f0 100644 --- a/cmd/unifi/cmd_config.go +++ b/cmd/unifi/cmd_config.go @@ -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. diff --git a/cmd/unifi/cmd_devices.go b/cmd/unifi/cmd_devices.go index f8ca0409..289d927f 100644 --- a/cmd/unifi/cmd_devices.go +++ b/cmd/unifi/cmd_devices.go @@ -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. diff --git a/cmd/unifi/cmd_networks.go b/cmd/unifi/cmd_networks.go index 74b847b5..d23042bc 100644 --- a/cmd/unifi/cmd_networks.go +++ b/cmd/unifi/cmd_networks.go @@ -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. diff --git a/cmd/unifi/cmd_routes.go b/cmd/unifi/cmd_routes.go index 64862b0a..d8e924ea 100644 --- a/cmd/unifi/cmd_routes.go +++ b/cmd/unifi/cmd_routes.go @@ -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. diff --git a/cmd/unifi/cmd_sites.go b/cmd/unifi/cmd_sites.go index 18508e8f..45586ca9 100644 --- a/cmd/unifi/cmd_sites.go +++ b/cmd/unifi/cmd_sites.go @@ -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. diff --git a/cmd/vm/cmd_container.go b/cmd/vm/cmd_container.go index cc8c4c30..805990ea 100644 --- a/cmd/vm/cmd_container.go +++ b/cmd/vm/cmd_container.go @@ -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" diff --git a/cmd/vm/cmd_templates.go b/cmd/vm/cmd_templates.go index 1092db0b..d8a4e878 100644 --- a/cmd/vm/cmd_templates.go +++ b/cmd/vm/cmd_templates.go @@ -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" diff --git a/go.mod b/go.mod index 773dd842..1cdcbc28 100644 --- a/go.mod +++ b/go.mod @@ -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 +) diff --git a/go.work b/go.work index 3778bf5f..d7bccbfa 100644 --- a/go.work +++ b/go.work @@ -2,5 +2,10 @@ go 1.25.5 use ( . - ../go + ../core + ../go-ai + ../go-crypt + ../go-devops + ../go-netops + ../go-scm ) diff --git a/main.go b/main.go index 8405a202..9945cf8f 100644 --- a/main.go +++ b/main.go @@ -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"