refactor: swap pkg/{io,log,i18n} imports to go-io/go-log/go-i18n
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
ecd8d17a87
commit
8d2c3708b0
22 changed files with 48 additions and 36 deletions
|
|
@ -5,7 +5,7 @@ import (
|
|||
"slices"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// AllowanceService enforces agent quota limits. It provides pre-dispatch checks,
|
||||
|
|
|
|||
2
brain.go
2
brain.go
|
|
@ -8,7 +8,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// MemoryType represents the classification of a brain memory.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// Client is the API client for the core-agentic service.
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go-agentic"
|
||||
"forge.lthn.ai/core/go-ai/ai"
|
||||
"forge.lthn.ai/core/go/pkg/i18n"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
// Style aliases from shared package
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"forge.lthn.ai/core/go-agentic"
|
||||
"forge.lthn.ai/core/go-ai/ai"
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go/pkg/i18n"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
// task:update command flags
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import (
|
|||
"time"
|
||||
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
coreio "forge.lthn.ai/core/go/pkg/io"
|
||||
coreio "forge.lthn.ai/core/go-io"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
coreio "forge.lthn.ai/core/go/pkg/io"
|
||||
coreio "forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go/pkg/repos"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
coreio "forge.lthn.ai/core/go/pkg/io"
|
||||
coreio "forge.lthn.ai/core/go-io"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// PROptions contains options for creating a pull request.
|
||||
|
|
|
|||
24
config.go
24
config.go
|
|
@ -5,8 +5,8 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
errors "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
"forge.lthn.ai/core/go/pkg/io"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
|
|
@ -77,12 +77,12 @@ func LoadConfig(dir string) (*Config, error) {
|
|||
// Try loading from ~/.core/agentic.yaml
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return nil, errors.E("agentic.LoadConfig", "failed to get home directory", err)
|
||||
return nil, log.E("agentic.LoadConfig", "failed to get home directory", err)
|
||||
}
|
||||
|
||||
configPath := filepath.Join(homeDir, ".core", configFileName)
|
||||
if err := loadYAMLConfig(configPath, cfg); err != nil && !os.IsNotExist(err) {
|
||||
return nil, errors.E("agentic.LoadConfig", "failed to load config", err)
|
||||
return nil, log.E("agentic.LoadConfig", "failed to load config", err)
|
||||
}
|
||||
|
||||
// Apply environment variable overrides
|
||||
|
|
@ -90,7 +90,7 @@ func LoadConfig(dir string) (*Config, error) {
|
|||
|
||||
// Validate configuration
|
||||
if cfg.Token == "" {
|
||||
return nil, errors.E("agentic.LoadConfig", "no authentication token configured", nil)
|
||||
return nil, log.E("agentic.LoadConfig", "no authentication token configured", nil)
|
||||
}
|
||||
|
||||
return cfg, nil
|
||||
|
|
@ -168,23 +168,23 @@ func applyEnvOverrides(cfg *Config) {
|
|||
func SaveConfig(cfg *Config) error {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return errors.E("agentic.SaveConfig", "failed to get home directory", err)
|
||||
return log.E("agentic.SaveConfig", "failed to get home directory", err)
|
||||
}
|
||||
|
||||
configDir := filepath.Join(homeDir, ".core")
|
||||
if err := io.Local.EnsureDir(configDir); err != nil {
|
||||
return errors.E("agentic.SaveConfig", "failed to create config directory", err)
|
||||
return log.E("agentic.SaveConfig", "failed to create config directory", err)
|
||||
}
|
||||
|
||||
configPath := filepath.Join(configDir, configFileName)
|
||||
|
||||
data, err := yaml.Marshal(cfg)
|
||||
if err != nil {
|
||||
return errors.E("agentic.SaveConfig", "failed to marshal config", err)
|
||||
return log.E("agentic.SaveConfig", "failed to marshal config", err)
|
||||
}
|
||||
|
||||
if err := io.Local.Write(configPath, string(data)); err != nil {
|
||||
return errors.E("agentic.SaveConfig", "failed to write config file", err)
|
||||
return log.E("agentic.SaveConfig", "failed to write config file", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -194,7 +194,7 @@ func SaveConfig(cfg *Config) error {
|
|||
func ConfigPath() (string, error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", errors.E("agentic.ConfigPath", "failed to get home directory", err)
|
||||
return "", log.E("agentic.ConfigPath", "failed to get home directory", err)
|
||||
}
|
||||
return filepath.Join(homeDir, ".core", configFileName), nil
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ type AllowanceConfig struct {
|
|||
func DefaultAllowanceStorePath() (string, error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", errors.E("agentic.DefaultAllowanceStorePath", "failed to get home directory", err)
|
||||
return "", log.E("agentic.DefaultAllowanceStorePath", "failed to get home directory", err)
|
||||
}
|
||||
return filepath.Join(homeDir, ".config", "agentic", "allowance.db"), nil
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ type RegistryConfig struct {
|
|||
func DefaultRegistryPath() (string, error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", errors.E("agentic.DefaultRegistryPath", "failed to get home directory", err)
|
||||
return "", log.E("agentic.DefaultRegistryPath", "failed to get home directory", err)
|
||||
}
|
||||
return filepath.Join(homeDir, ".config", "agentic", "registry.db"), nil
|
||||
}
|
||||
|
|
|
|||
12
context.go
12
context.go
|
|
@ -9,8 +9,8 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
errors "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
"forge.lthn.ai/core/go/pkg/io"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// FileContent represents the content of a file for AI context.
|
||||
|
|
@ -42,13 +42,13 @@ func BuildTaskContext(task *Task, dir string) (*TaskContext, error) {
|
|||
const op = "agentic.BuildTaskContext"
|
||||
|
||||
if task == nil {
|
||||
return nil, errors.E(op, "task is required", nil)
|
||||
return nil, log.E(op, "task is required", nil)
|
||||
}
|
||||
|
||||
if dir == "" {
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return nil, errors.E(op, "failed to get working directory", err)
|
||||
return nil, log.E(op, "failed to get working directory", err)
|
||||
}
|
||||
dir = cwd
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ func GatherRelatedFiles(task *Task, dir string) ([]FileContent, error) {
|
|||
const op = "agentic.GatherRelatedFiles"
|
||||
|
||||
if task == nil {
|
||||
return nil, errors.E(op, "task is required", nil)
|
||||
return nil, log.E(op, "task is required", nil)
|
||||
}
|
||||
|
||||
var files []FileContent
|
||||
|
|
@ -118,7 +118,7 @@ func findRelatedCode(task *Task, dir string) ([]FileContent, error) {
|
|||
const op = "agentic.findRelatedCode"
|
||||
|
||||
if task == nil {
|
||||
return nil, errors.E(op, "task is required", nil)
|
||||
return nil, log.E(op, "task is required", nil)
|
||||
}
|
||||
|
||||
// Extract keywords from title and description
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"slices"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
4
go.mod
4
go.mod
|
|
@ -6,6 +6,9 @@ require (
|
|||
forge.lthn.ai/core/cli v0.1.0
|
||||
forge.lthn.ai/core/go v0.1.0
|
||||
forge.lthn.ai/core/go-ai v0.1.0
|
||||
forge.lthn.ai/core/go-i18n v0.1.0
|
||||
forge.lthn.ai/core/go-io v0.0.1
|
||||
forge.lthn.ai/core/go-log v0.0.1
|
||||
forge.lthn.ai/core/go-store v0.1.3
|
||||
github.com/redis/go-redis/v9 v9.18.0
|
||||
github.com/spf13/cobra v1.10.2
|
||||
|
|
@ -16,6 +19,7 @@ require (
|
|||
|
||||
require (
|
||||
forge.lthn.ai/core/go-crypt v0.1.0 // indirect
|
||||
forge.lthn.ai/core/go-inference v0.0.2 // indirect
|
||||
forge.lthn.ai/core/go-rag v0.1.0 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
|
|
|
|||
8
go.sum
8
go.sum
|
|
@ -6,6 +6,14 @@ forge.lthn.ai/core/go-ai v0.1.0 h1:Z7Gbxsq4d8vnO35zZxJXvk8wEUGSazpxncN1voJkNT0=
|
|||
forge.lthn.ai/core/go-ai v0.1.0/go.mod h1:YUsCZmWereE2wZPDEmk46Xu+xxmfsNZktpY7H9jgNJI=
|
||||
forge.lthn.ai/core/go-crypt v0.1.0 h1:92gwdQi7iAwktpvZhL/8Cu+QS6xKCtGP4FJfyInPGnw=
|
||||
forge.lthn.ai/core/go-crypt v0.1.0/go.mod h1:zVAgx6ZiGtC+dbX4R/VKvEPqsEqjyuLl4gQZH9SXBUw=
|
||||
forge.lthn.ai/core/go-i18n v0.1.0 h1:F7JVSoVkZtzx9JfhpntM9z3iQm1vnuMUi/Zklhz8PCI=
|
||||
forge.lthn.ai/core/go-i18n v0.1.0/go.mod h1:Q4xsrxuNCl/6NfMv1daria7t1RSiyy8ml+6jiPtUcBs=
|
||||
forge.lthn.ai/core/go-inference v0.0.2 h1:aHjBkYyLKxLr9tbO4AvzzV/lsZueGq/jeo33SLh113k=
|
||||
forge.lthn.ai/core/go-inference v0.0.2/go.mod h1:jfWz+IJX55wAH98+ic6FEqqGB6/P31CHlg7VY7pxREw=
|
||||
forge.lthn.ai/core/go-io v0.0.1 h1:N/GCl6Asusfr4gs53JZixJVtqcnerQ6GcxSN8F8iJXY=
|
||||
forge.lthn.ai/core/go-io v0.0.1/go.mod h1:l+gG/G5TMIOTG8G7y0dg4fh1a7Suy8wCYVwsz4duV7M=
|
||||
forge.lthn.ai/core/go-log v0.0.1 h1:x/E6EfF9vixzqiLHQOl2KT25HyBcMc9qiBkomqVlpPg=
|
||||
forge.lthn.ai/core/go-log v0.0.1/go.mod h1:r14MXKOD3LF/sI8XUJQhRk/SZHBE7jAFVuCfgkXoZPw=
|
||||
forge.lthn.ai/core/go-rag v0.1.0 h1:H5umiRryuq6J6l889s0OsxWpmq5P5c3A9Bkj0cQyO7k=
|
||||
forge.lthn.ai/core/go-rag v0.1.0/go.mod h1:bB8Fy98G2zxVoe7k2B85gXvim6frJdbAMnDyW4peUVU=
|
||||
forge.lthn.ai/core/go-store v0.1.3 h1:CSVTRdsOXm2pl+FCs12fHOc9eM88DcZRY6HghN98w/I=
|
||||
|
|
|
|||
2
logs.go
2
logs.go
|
|
@ -6,7 +6,7 @@ import (
|
|||
"io"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// StreamLogs polls a task's status and writes updates to writer. It polls at
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// PlanDispatcher orchestrates plan-based work by polling active plans,
|
||||
|
|
|
|||
2
plans.go
2
plans.go
|
|
@ -8,7 +8,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// PlanStatus represents the state of a plan.
|
||||
|
|
|
|||
2
score.go
2
score.go
|
|
@ -6,7 +6,7 @@ import (
|
|||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// ScoreContentRequest is the payload for content scoring.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/framework"
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// Tasks for AI service
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// SessionStatus represents the state of a session.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"slices"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// StatusSummary aggregates status from the agent registry, task client, and
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/log"
|
||||
"forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// SubmitTask creates a new task with the given parameters via the API client.
|
||||
|
|
|
|||
Reference in a new issue