From 7468c389064a73e6fa341c997cd64c373ba1f7df Mon Sep 17 00:00:00 2001 From: Snider Date: Fri, 6 Mar 2026 12:35:41 +0000 Subject: [PATCH] refactor: swap pkg/{io,log,i18n} imports to go-io/go-log/go-i18n Co-Authored-By: Virgil --- auth/auth.go | 4 ++-- auth/auth_test.go | 2 +- auth/session_store_test.go | 2 +- cmd/testcmd/cmd_main.go | 2 +- cmd/testcmd/cmd_output.go | 2 +- cmd/testcmd/cmd_runner.go | 2 +- crypt/checksum.go | 2 +- crypt/crypt.go | 2 +- crypt/hash.go | 2 +- crypt/kdf.go | 2 +- crypt/openpgp/service.go | 16 +++++++++------- crypt/openpgp/service_test.go | 6 +++--- crypt/symmetric.go | 2 +- go.mod | 5 ++++- go.sum | 9 ++++++++- 15 files changed, 36 insertions(+), 24 deletions(-) diff --git a/auth/auth.go b/auth/auth.go index 81b14c2..85fd915 100644 --- a/auth/auth.go +++ b/auth/auth.go @@ -36,12 +36,12 @@ import ( "sync" "time" - coreerr "forge.lthn.ai/core/go/pkg/framework/core" + coreerr "forge.lthn.ai/core/go-log" "forge.lthn.ai/core/go-crypt/crypt" "forge.lthn.ai/core/go-crypt/crypt/lthn" "forge.lthn.ai/core/go-crypt/crypt/pgp" - "forge.lthn.ai/core/go/pkg/io" + "forge.lthn.ai/core/go-io" ) // Default durations for challenge and session lifetimes. diff --git a/auth/auth_test.go b/auth/auth_test.go index a1f4235..f4587f2 100644 --- a/auth/auth_test.go +++ b/auth/auth_test.go @@ -13,7 +13,7 @@ import ( "forge.lthn.ai/core/go-crypt/crypt/lthn" "forge.lthn.ai/core/go-crypt/crypt/pgp" - "forge.lthn.ai/core/go/pkg/io" + "forge.lthn.ai/core/go-io" ) // helper creates a fresh Authenticator backed by MockMedium. diff --git a/auth/session_store_test.go b/auth/session_store_test.go index bfdedc5..3a753f0 100644 --- a/auth/session_store_test.go +++ b/auth/session_store_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "forge.lthn.ai/core/go-crypt/crypt/lthn" - "forge.lthn.ai/core/go/pkg/io" + "forge.lthn.ai/core/go-io" ) // --- MemorySessionStore --- diff --git a/cmd/testcmd/cmd_main.go b/cmd/testcmd/cmd_main.go index 17c930c..5eb3f8b 100644 --- a/cmd/testcmd/cmd_main.go +++ b/cmd/testcmd/cmd_main.go @@ -5,7 +5,7 @@ package testcmd import ( "forge.lthn.ai/core/cli/pkg/cli" - "forge.lthn.ai/core/go/pkg/i18n" + "forge.lthn.ai/core/go-i18n" "github.com/spf13/cobra" ) diff --git a/cmd/testcmd/cmd_output.go b/cmd/testcmd/cmd_output.go index ab137a1..c3ef272 100644 --- a/cmd/testcmd/cmd_output.go +++ b/cmd/testcmd/cmd_output.go @@ -10,7 +10,7 @@ import ( "strconv" "strings" - "forge.lthn.ai/core/go/pkg/i18n" + "forge.lthn.ai/core/go-i18n" ) type packageCoverage struct { diff --git a/cmd/testcmd/cmd_runner.go b/cmd/testcmd/cmd_runner.go index ac080a6..3365491 100644 --- a/cmd/testcmd/cmd_runner.go +++ b/cmd/testcmd/cmd_runner.go @@ -10,7 +10,7 @@ import ( "runtime" "strings" - "forge.lthn.ai/core/go/pkg/i18n" + "forge.lthn.ai/core/go-i18n" ) func runTest(verbose, coverage, short bool, pkg, run string, race, jsonOutput bool) error { diff --git a/crypt/checksum.go b/crypt/checksum.go index ddf501f..b0a82ff 100644 --- a/crypt/checksum.go +++ b/crypt/checksum.go @@ -7,7 +7,7 @@ import ( "io" "os" - core "forge.lthn.ai/core/go/pkg/framework/core" + core "forge.lthn.ai/core/go-log" ) // SHA256File computes the SHA-256 checksum of a file and returns it as a hex string. diff --git a/crypt/crypt.go b/crypt/crypt.go index a73f0ad..ed91676 100644 --- a/crypt/crypt.go +++ b/crypt/crypt.go @@ -1,7 +1,7 @@ package crypt import ( - core "forge.lthn.ai/core/go/pkg/framework/core" + core "forge.lthn.ai/core/go-log" ) // Encrypt encrypts data with a passphrase using ChaCha20-Poly1305. diff --git a/crypt/hash.go b/crypt/hash.go index 9b1273d..5b77cfb 100644 --- a/crypt/hash.go +++ b/crypt/hash.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - core "forge.lthn.ai/core/go/pkg/framework/core" + core "forge.lthn.ai/core/go-log" "golang.org/x/crypto/argon2" "golang.org/x/crypto/bcrypt" ) diff --git a/crypt/kdf.go b/crypt/kdf.go index 71fdff4..abcd5b3 100644 --- a/crypt/kdf.go +++ b/crypt/kdf.go @@ -7,7 +7,7 @@ import ( "crypto/sha256" "io" - core "forge.lthn.ai/core/go/pkg/framework/core" + core "forge.lthn.ai/core/go-log" "golang.org/x/crypto/argon2" "golang.org/x/crypto/hkdf" "golang.org/x/crypto/scrypt" diff --git a/crypt/openpgp/service.go b/crypt/openpgp/service.go index 5064ea9..ae411af 100644 --- a/crypt/openpgp/service.go +++ b/crypt/openpgp/service.go @@ -9,16 +9,18 @@ import ( "github.com/ProtonMail/go-crypto/openpgp" "github.com/ProtonMail/go-crypto/openpgp/armor" "github.com/ProtonMail/go-crypto/openpgp/packet" - core "forge.lthn.ai/core/go/pkg/framework/core" + + core "forge.lthn.ai/core/go-log" + framework "forge.lthn.ai/core/go/pkg/framework/core" ) -// Service implements the core.Crypt interface using OpenPGP. +// Service implements the framework.Crypt interface using OpenPGP. type Service struct { - core *core.Core + core *framework.Core } // New creates a new OpenPGP service instance. -func New(c *core.Core) (any, error) { +func New(c *framework.Core) (any, error) { return &Service{core: c}, nil } @@ -172,7 +174,7 @@ func (s *Service) DecryptPGP(privateKey, message, passphrase string, opts ...any } // HandleIPCEvents handles PGP-related IPC messages. -func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) error { +func (s *Service) HandleIPCEvents(c *framework.Core, msg framework.Message) error { switch m := msg.(type) { case map[string]any: action, _ := m["action"].(string) @@ -187,5 +189,5 @@ func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) error { return nil } -// Ensure Service implements core.Crypt. -var _ core.Crypt = (*Service)(nil) +// Ensure Service implements framework.Crypt. +var _ framework.Crypt = (*Service)(nil) diff --git a/crypt/openpgp/service_test.go b/crypt/openpgp/service_test.go index b74c334..67bf484 100644 --- a/crypt/openpgp/service_test.go +++ b/crypt/openpgp/service_test.go @@ -4,12 +4,12 @@ import ( "bytes" "testing" - core "forge.lthn.ai/core/go/pkg/framework/core" + framework "forge.lthn.ai/core/go/pkg/framework/core" "github.com/stretchr/testify/assert" ) func TestCreateKeyPair(t *testing.T) { - c, _ := core.New() + c, _ := framework.New() s := &Service{core: c} privKey, err := s.CreateKeyPair("test user", "password123") @@ -19,7 +19,7 @@ func TestCreateKeyPair(t *testing.T) { } func TestEncryptDecrypt(t *testing.T) { - c, _ := core.New() + c, _ := framework.New() s := &Service{core: c} passphrase := "secret" diff --git a/crypt/symmetric.go b/crypt/symmetric.go index 844e4a5..f7d874f 100644 --- a/crypt/symmetric.go +++ b/crypt/symmetric.go @@ -5,7 +5,7 @@ import ( "crypto/cipher" "crypto/rand" - core "forge.lthn.ai/core/go/pkg/framework/core" + core "forge.lthn.ai/core/go-log" "golang.org/x/crypto/chacha20poly1305" ) diff --git a/go.mod b/go.mod index e3c7b13..744e373 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,9 @@ go 1.26.0 require ( forge.lthn.ai/core/cli v0.1.0 forge.lthn.ai/core/go v0.1.0 + forge.lthn.ai/core/go-i18n v0.0.1 + 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/ProtonMail/go-crypto v1.3.0 github.com/spf13/cobra v1.10.2 @@ -13,6 +16,7 @@ require ( ) require ( + forge.lthn.ai/core/go-inference v0.0.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/charmbracelet/bubbletea v1.3.10 // indirect github.com/charmbracelet/colorprofile v0.4.2 // indirect @@ -28,7 +32,6 @@ require ( github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/text v0.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-localereader v0.0.1 // indirect diff --git a/go.sum b/go.sum index c4836dd..8f384b0 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,14 @@ forge.lthn.ai/core/cli v0.1.0 h1:2XRiEMVzUElnQlZnHYDyfKIKQVPcCzGuYHlnz55GjsM= forge.lthn.ai/core/cli v0.1.0/go.mod h1:mZ7dzccfzo0BP2dE7Mwuw9dXuIowiEd1G5ZGMoLuxVc= forge.lthn.ai/core/go v0.1.0 h1:Ow/1NTajrrNPO0zgkskEyEGdx4SKpiNqTaqM0txNOYI= forge.lthn.ai/core/go v0.1.0/go.mod h1:lwi0tccAlg5j3k6CfoNJEueBc5l9mUeSBX/x6uY8ZbQ= +forge.lthn.ai/core/go-i18n v0.0.1 h1:7I2cOv3GCc7MssLny/CAnwz3L7/Y4iqwzrCRQMQ+teA= +forge.lthn.ai/core/go-i18n v0.0.1/go.mod h1:nyiGwZ3jV4h9Yge6mSrKVTo7CI1LI/p3ydI+9jUnMtk= +forge.lthn.ai/core/go-inference v0.0.1 h1:hf5eOzm5sNDifhb0BscMTyKEkB44r2Tv58wakHGvtz4= +forge.lthn.ai/core/go-inference v0.0.1/go.mod h1:pq2JCmbWLHgik0QdAflGb3raJcCGC44xt8rCUtDjFys= +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-store v0.1.3 h1:CSVTRdsOXm2pl+FCs12fHOc9eM88DcZRY6HghN98w/I= forge.lthn.ai/core/go-store v0.1.3/go.mod h1:op+ftjAqYskPv4OGvHZQf7/DLiRnFIdT0XCQTKR/GjE= github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= @@ -27,7 +35,6 @@ github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJ github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8= github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=