feat: infrastructure packages and lint cleanup (#281)
* ci: consolidate duplicate workflows and merge CodeQL configs
Remove 17 duplicate workflow files that were split copies of the
combined originals. Each family (CI, CodeQL, Coverage, PR Build,
Alpha Release) had the same job duplicated across separate
push/pull_request/schedule/manual trigger files.
Merge codeql.yml and codescan.yml into a single codeql.yml with
a language matrix covering go, javascript-typescript, python,
and actions — matching the previous default setup coverage.
Remaining workflows (one per family):
- ci.yml (push + PR + manual)
- codeql.yml (push + PR + schedule, all languages)
- coverage.yml (push + PR + manual)
- alpha-release.yml (push + manual)
- pr-build.yml (PR + manual)
- release.yml (tag push)
- agent-verify.yml, auto-label.yml, auto-project.yml
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add collect, config, crypt, plugin packages and fix all lint issues
Add four new infrastructure packages with CLI commands:
- pkg/config: layered configuration (defaults → file → env → flags)
- pkg/crypt: crypto primitives (Argon2id, AES-GCM, ChaCha20, HMAC, checksums)
- pkg/plugin: plugin system with GitHub-based install/update/remove
- pkg/collect: collection subsystem (GitHub, BitcoinTalk, market, papers, excavate)
Fix all golangci-lint issues across the entire codebase (~100 errcheck,
staticcheck SA1012/SA1019/ST1005, unused, ineffassign fixes) so that
`core go qa` passes with 0 issues.
Closes #167, #168, #170, #250, #251, #252, #253, #254, #255, #256
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 11:34:43 +00:00
|
|
|
package collect
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
refactor: strip to pure package library (#3)
- Fix remaining 187 pkg/ files referencing core/cli → core/go
- Move SDK library code from internal/cmd/sdk/ → pkg/sdk/ (new package)
- Create pkg/rag/helpers.go with convenience functions from internal/cmd/rag/
- Fix pkg/mcp/tools_rag.go to use pkg/rag instead of internal/cmd/rag
- Fix pkg/build/buildcmd/cmd_sdk.go and pkg/release/sdk.go to use pkg/sdk
- Remove all non-library content: main.go, internal/, cmd/, docker/,
scripts/, tasks/, tools/, .core/, .forgejo/, .woodpecker/, Taskfile.yml
- Run go mod tidy to trim unused dependencies
core/go is now a pure Go package suite (library only).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude <developers@lethean.io>
Reviewed-on: https://forge.lthn.ai/core/go/pulls/3
2026-02-16 14:23:45 +00:00
|
|
|
"forge.lthn.ai/core/go/pkg/io"
|
feat: infrastructure packages and lint cleanup (#281)
* ci: consolidate duplicate workflows and merge CodeQL configs
Remove 17 duplicate workflow files that were split copies of the
combined originals. Each family (CI, CodeQL, Coverage, PR Build,
Alpha Release) had the same job duplicated across separate
push/pull_request/schedule/manual trigger files.
Merge codeql.yml and codescan.yml into a single codeql.yml with
a language matrix covering go, javascript-typescript, python,
and actions — matching the previous default setup coverage.
Remaining workflows (one per family):
- ci.yml (push + PR + manual)
- codeql.yml (push + PR + schedule, all languages)
- coverage.yml (push + PR + manual)
- alpha-release.yml (push + manual)
- pr-build.yml (PR + manual)
- release.yml (tag push)
- agent-verify.yml, auto-label.yml, auto-project.yml
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add collect, config, crypt, plugin packages and fix all lint issues
Add four new infrastructure packages with CLI commands:
- pkg/config: layered configuration (defaults → file → env → flags)
- pkg/crypt: crypto primitives (Argon2id, AES-GCM, ChaCha20, HMAC, checksums)
- pkg/plugin: plugin system with GitHub-based install/update/remove
- pkg/collect: collection subsystem (GitHub, BitcoinTalk, market, papers, excavate)
Fix all golangci-lint issues across the entire codebase (~100 errcheck,
staticcheck SA1012/SA1019/ST1005, unused, ineffassign fixes) so that
`core go qa` passes with 0 issues.
Closes #167, #168, #170, #250, #251, #252, #253, #254, #255, #256
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 11:34:43 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestNewConfig_Good(t *testing.T) {
|
|
|
|
|
cfg := NewConfig("/tmp/output")
|
|
|
|
|
|
|
|
|
|
assert.NotNil(t, cfg)
|
|
|
|
|
assert.Equal(t, "/tmp/output", cfg.OutputDir)
|
|
|
|
|
assert.NotNil(t, cfg.Output)
|
|
|
|
|
assert.NotNil(t, cfg.Limiter)
|
|
|
|
|
assert.NotNil(t, cfg.State)
|
|
|
|
|
assert.NotNil(t, cfg.Dispatcher)
|
|
|
|
|
assert.False(t, cfg.Verbose)
|
|
|
|
|
assert.False(t, cfg.DryRun)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestNewConfigWithMedium_Good(t *testing.T) {
|
|
|
|
|
m := io.NewMockMedium()
|
|
|
|
|
cfg := NewConfigWithMedium(m, "/data")
|
|
|
|
|
|
|
|
|
|
assert.NotNil(t, cfg)
|
|
|
|
|
assert.Equal(t, m, cfg.Output)
|
|
|
|
|
assert.Equal(t, "/data", cfg.OutputDir)
|
|
|
|
|
assert.NotNil(t, cfg.Limiter)
|
|
|
|
|
assert.NotNil(t, cfg.State)
|
|
|
|
|
assert.NotNil(t, cfg.Dispatcher)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestMergeResults_Good(t *testing.T) {
|
|
|
|
|
r1 := &Result{
|
|
|
|
|
Source: "a",
|
|
|
|
|
Items: 5,
|
|
|
|
|
Errors: 1,
|
|
|
|
|
Files: []string{"a.md", "b.md"},
|
|
|
|
|
}
|
|
|
|
|
r2 := &Result{
|
|
|
|
|
Source: "b",
|
|
|
|
|
Items: 3,
|
|
|
|
|
Skipped: 2,
|
|
|
|
|
Files: []string{"c.md"},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
merged := MergeResults("combined", r1, r2)
|
|
|
|
|
assert.Equal(t, "combined", merged.Source)
|
|
|
|
|
assert.Equal(t, 8, merged.Items)
|
|
|
|
|
assert.Equal(t, 1, merged.Errors)
|
|
|
|
|
assert.Equal(t, 2, merged.Skipped)
|
|
|
|
|
assert.Len(t, merged.Files, 3)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestMergeResults_Good_NilResults(t *testing.T) {
|
|
|
|
|
r1 := &Result{Items: 3}
|
|
|
|
|
merged := MergeResults("test", r1, nil, nil)
|
|
|
|
|
assert.Equal(t, 3, merged.Items)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestMergeResults_Good_Empty(t *testing.T) {
|
|
|
|
|
merged := MergeResults("empty")
|
|
|
|
|
assert.Equal(t, 0, merged.Items)
|
|
|
|
|
assert.Equal(t, 0, merged.Errors)
|
|
|
|
|
assert.Nil(t, merged.Files)
|
|
|
|
|
}
|