Commit graph

56 commits

Author SHA1 Message Date
Snider
7c8cd0fe70 fix: update stale import paths and dependency versions from extraction
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Failing after 2m56s
Resolve stale forge.lthn.ai/core/cli v0.1.0 references (tag never existed,
earliest is v0.0.1) and regenerate go.sum via workspace-aware go mod tidy.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 13:38:59 +00:00
Snider
dc1790f12b feat(marketplace): add provider discovery and registry
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 1m19s
Extend Manifest with provider fields (namespace, port, binary, args, element,
spec) and add IsProvider() helper. New DiscoverProviders() scans directories
for runtime provider manifests. ProviderRegistryFile handles registry.yaml
read/write for tracking installed providers. Includes 20 tests.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 12:22:37 +00:00
Snider
81deee8598 feat(api): add SCM service provider with Lit custom elements
Some checks failed
Security Scan / security (push) Failing after 7s
Test / test (push) Failing after 1m16s
ScmProvider implements Provider + Streamable + Describable + Renderable,
wrapping marketplace, manifest, installed, and registry endpoints as REST
API with WS event streaming. Includes Lit custom element bundle with
panel, marketplace browser, manifest viewer, installed manager, and
registry status display. All 14 tests pass.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:42:37 +00:00
Snider
e7db4b163f refactor: update import path from go-config to core/config
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 1m19s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-14 10:26:01 +00:00
Snider
e5f4bbbe80 docs: add CLAUDE.md project instructions
Some checks failed
Security Scan / security (push) Failing after 10s
Test / test (push) Failing after 1m12s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-13 13:38:02 +00:00
Snider
b263a9ea7d docs: add human-friendly documentation
Some checks failed
Security Scan / security (push) Failing after 7s
Test / test (push) Failing after 1m14s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:02:40 +00:00
Snider
2ddb33084a fix: reject ambiguous multiple default daemons, add missing tests
Some checks failed
Security Scan / security (push) Failing after 7s
Test / test (push) Failing after 1m12s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 15:10:46 +00:00
Snider
dbb0933b27 fix: update loader tests for .core/manifest.yaml path rename
Some checks failed
Security Scan / security (push) Failing after 7s
Test / test (push) Failing after 1m13s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 15:03:02 +00:00
Snider
849221eb80 feat: add DaemonSpec to manifest, rename path to .core/manifest.yaml
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:42:32 +00:00
Snider
68379b6b58 chore: add .core/ build and release configs
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Failing after 1m6s
Add go-devops build system configuration for standardised
build, test, and release workflows across the Go ecosystem.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 18:52:37 +00:00
Snider
e4342454b8 feat(repos): add kb.yaml knowledge base config
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 1m14s
KBConfig (.core/kb.yaml, checked in):
- Wiki mirror: enabled flag, local dir, remote SSH base URL
- Search: Qdrant host/port, collection (openbrain), Ollama URL,
  embed model (embeddinggemma), default top_k
- Helpers: WikiRepoURL(name), WikiLocalPath(root, name)

Data already lives in Qdrant (homelab-embedded) — this just
configures the search client and local wiki clone paths.

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 15:55:48 +00:00
Snider
f751b29170 feat(repos): add git.yaml state tracking and work.yaml sync config
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 1m10s
GitState (.core/git.yaml, .gitignored):
- Per-repo sync timestamps (last pull/push), branch, ahead/behind
- Agent heartbeats with active package lists
- Stale agent detection, overlap queries, NeedsPull check

WorkConfig (.core/work.yaml, checked in):
- Sync policy: interval, auto_pull, auto_push, clone_missing
- Agent policy: heartbeat interval, stale timeout, overlap warnings
- Trigger list: on_activate, on_commit, scheduled

Both use io.Medium for testability (MockMedium in all tests).

Co-Authored-By: Virgil <virgil@lethean.io>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 15:44:31 +00:00
Snider
58b20e7aec chore: sync go.mod dependencies
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Failing after 1m24s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 15:22:36 +00:00
Snider
70fb874240 chore: remove boilerplate Taskfile
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Failing after 25s
All tasks (test, build, lint, fmt, vet, cov) are handled natively
by `core go` commands. Taskfile was redundant wrapper.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 14:45:49 +00:00
Snider
c662b7bf05 refactor: swap pkg/framework imports to pkg/core
Some checks failed
Security Scan / security (push) Failing after 6s
Test / test (push) Failing after 26s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 14:10:59 +00:00
Snider
fa0beae5c8 feat: add manifest, marketplace, plugin, repos subpackages
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 27s
Extracted from core/go pkg/{manifest,marketplace,plugin,repos}.
Also swapped agentci/forge/gitea config imports to go-config.

These packages handle package manifests, marketplace installation,
plugin lifecycle, and multi-repo registry management.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 13:20:12 +00:00
Snider
89cedeac62 refactor: swap pkg/{io,log,i18n} imports to go-io/go-log/go-i18n
Some checks failed
Security Scan / security (push) Failing after 6s
Test / test (push) Successful in 2m4s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-06 12:35:42 +00:00
Snider
3b70a32a92 chore: bump forge.lthn.ai dep versions to latest tags
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Successful in 3m37s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-26 05:34:23 +00:00
134415404d Merge pull request 'chore: Go 1.26 modernization' (#2) from chore/go-1.26-modernization into main
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Successful in 1m12s
2026-02-24 18:01:45 +00:00
Claude
7ef7c3b107
chore: use %w for error wrapping
Some checks failed
Security Scan / security (pull_request) Failing after 13s
Test / test (pull_request) Successful in 1m9s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:24:05 +00:00
Claude
da9c133f1f
chore: fmt.Errorf(static) → errors.New
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 16:22:37 +00:00
Snider
cacc1ab3c8 chore: bump forge.lthn.ai dep versions to latest tags
Some checks failed
Security Scan / security (push) Failing after 9s
Test / test (push) Successful in 4m1s
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:49:45 +00:00
Snider
e7a238c4b5 chore: add Go repo norms (badges, contributing, lint, taskfile, editorconfig)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:45:47 +00:00
Snider
9a9ae0d4c4 chore: refresh go.sum after upstream tag updates
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:35:19 +00:00
Snider
a315c3894e refactor: modernise to Go 1.26 — iterators, slices, maps
Some checks failed
Security Scan / security (push) Failing after 8s
Test / test (push) Failing after 23s
- Add StatusIter, DirtyReposIter, AheadReposIter on git.Service
- Add StatusIter, PushMultipleIter on git package functions
- Add ListOrgReposIter, ListUserReposIter on forge/gitea clients
- Add ListPullRequestsIter on forge/gitea clients
- Add extractIACRPapersIter, extractPostsIter iterators
- Replace manual map-key-sort with slices.Sorted(maps.Keys(...))
- Modernise range-over-int in excavate_test.go

Co-Authored-By: Gemini <noreply@google.com>
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-23 06:23:45 +00:00
Claude
3e56a022de
ci: add Forgejo Actions test and security scan workflows
Some checks failed
Security Scan / security (push) Failing after 11s
Test / test (push) Failing after 23s
Uses reusable workflows from core/go-devops for Go testing
(with race detector and coverage) and security scanning
(govulncheck, gitleaks, trivy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 03:28:08 +00:00
Claude
3009c7354f
chore: refresh go.sum after upstream tag updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 23:36:25 +00:00
Snider
d025f9c49b refactor: migrate CLI imports from core/go to core/cli
Update imports from forge.lthn.ai/core/go/pkg/cli to
forge.lthn.ai/core/cli/pkg/cli following CLI package split.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 23:29:41 +00:00
Claude
4bbff49c40
chore: sync workspace dependency versions
Run go work sync to align dependency versions across workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:42:01 +00:00
Snider
f994473196 refactor: apply go fix modernizers for Go 1.26
Automated fixes: interface{} → any, range-over-int, t.Context(),
wg.Go(), strings.SplitSeq, strings.Builder, slices.Contains,
maps helpers, min/max builtins.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 21:00:17 +00:00
Snider
39efacbe24 chore: go mod tidy for 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:35:59 +00:00
Snider
8499fec260 chore: bump go directive to 1.26.0
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:33:48 +00:00
Snider
eeec313037 chore: pin forge deps to v0.0.1 tags for Go 1.26 compat
Go 1.26 rejects non-semver version strings (like 'main') in go.mod.
Tags v0.0.1 now exist on all forge repos — workspace still overrides
for local development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 20:15:06 +00:00
Snider
5ddc952481 chore: use workspace-resolved versions, drop replace directives
Forge module versions now use main branch resolution via ~/Code/go.work
workspace. Removes local replace directives — the central go.work handles
all cross-repo resolution during development.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-22 19:49:36 +00:00
Snider
7eb28df79d feat: migrate collect, forge, gitea commands from CLI
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:38:36 +00:00
Snider
5bfafcd6fc feat: restore agentci, git, and jobrunner packages
These packages are still imported by the CLI. Reverting the premature
extraction so forge consumers can resolve them.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:27:35 +00:00
Snider
8527302df1 chore: resolve forge deps from registry, remove local replaces
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 19:20:07 +00:00
Snider
dc93f7dcf9 refactor: remove git/ package (extracted to core/go-git)
The git/ package was extracted to the standalone core/go-git repo.
No remaining packages import it. Three packages remain: forge/,
gitea/, collect/.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 17:26:35 +00:00
Snider
c95aefed94 refactor: extract agentci + jobrunner to core/go-agent
Both packages now live in forge.lthn.ai/core/go-agent as a unified
agent orchestration repo. go-scm retains collect/, forge/, git/, gitea/.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-21 17:13:26 +00:00
Claude
148003e005
fix(dispatch): resolve target branch from repo default
Replace hardcoded "new" target branch with a lookup against the
Forgejo API for the repository's default branch, falling back to
"main" if the API call fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:58:35 +00:00
Snider
fb02ccad99 docs: add README with quick start and docs links
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:11:19 +00:00
Snider
4558504499 docs: graduate TODO/FINDINGS into production documentation
Replace internal task tracking (TODO.md, FINDINGS.md) with structured
documentation in docs/. Trim CLAUDE.md to agent instructions only.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 15:02:22 +00:00
Claude
4a2e1298a4
test(forgejo): add supplementary signal source coverage
Extends Phase 3 forgejo source tests with 9 additional scenarios:
multi-epic with multiple children, combined status fetch error
fallback to PENDING, mixed repos with partial failure, Report
comment body format (table-driven), Report posting to correct
epic issue, signal field completeness, all-children-checked
producing zero signals, and NeedsCoding signal field population.

Co-Authored-By: Charon <developers@lethean.io>
2026-02-20 11:52:11 +00:00
Snider
70e06d2226 docs: mark Phase 3 tasks complete in TODO.md
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:52:12 +00:00
Snider
0fe2978b9d test: Phase 3 — Forgejo signal source, journal replay, handler integration
Forgejo signal source tests:
- Signal parsing for empty body, mixed content, large issue numbers
- findLinkedPR edge cases (multiple refs, empty body, first match wins)
- Poll with combined status failure/error fallback to PENDING
- Poll with unassigned child (no signal), child fetch failure (skipped)
- Poll with multiple epics, mixed labels (only epics generate signals)
- Report format verification (success/failure, error in code block)

Journal replay tests:
- Write + read-back round-trip with full field preservation
- Filter by action (tick_parent from mixed actions)
- Filter by repo (date-partitioned files in owner/repo directories)
- Filter by time range (entries across multiple days)
- Combined filter (action + repo + time)
- Concurrent write safety (20 goroutines, valid JSONL output)
- Empty journal returns no entries

Handler integration tests:
- TickParent full flow: signal -> execute -> verify epic body updated,
  child closed, progress tracked (checked/unchecked counts)
- EnableAutoMerge: verify squash merge method via mock
- PublishDraft: verify draft=false PATCH sent
- SendFixCommand: conflict vs review message paths
- Completion: success flow (label swap, comment) and failure flow
- Full pipeline: signal -> handler -> journal write -> read-back
- Handler priority: verify correct handler matches each signal state
  (merged, draft, conflicting, open+passing)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:51:48 +00:00
Snider
15566df2b0 docs: mark Phase 2 tasks complete in TODO.md
Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:42:28 +00:00
Snider
3ba8fbb8fb fix: Phase 2 — error wrapping, context audit, rate limiting review
- Standardise all fmt.Errorf calls to "package.Func: context" pattern
  across jobrunner/journal.go, agentci/config.go, agentci/security.go,
  handlers/dispatch.go, and forge/labels.go (15 bare errors fixed)
- Add SecureSSHCommandContext with context propagation for cancellable
  SSH operations; update dispatch handler to use it
- Add CheckGitHubRateLimitCtx for context-aware rate limit checking
- Document Forgejo/Gitea SDK v2 context limitation in FINDINGS.md
  (SDKs do not accept context.Context — adding ctx to 66 wrappers
  would be ceremony without real propagation)
- Review and document rate limiter: handles all edge cases, adaptive
  throttling at 75% GitHub usage, SDK header parsing not feasible

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-20 05:42:02 +00:00
Claude
8d1d7fce01
test: push coverage across collect/jobrunner/gitea
collect: 83.0% -> 90.0% via error medium injection (write/list/read/ensureDir
failures), rate limiter blocking tests, HTTP mock servers for papers/market/
bitcointalk write errors, processor context cancellation, state round-trip,
and GitHub collector gh-auth-failure paths.

gitea: 89.2% -> 94.0% via paginated org/user repo servers, PR meta with
comment counting and nil dates, GetCommentBodies with nil poster, ListPullRequests
state mapping, and NewFromConfig flag override tests.

jobrunner: 86.4% -> 94.4% via journal error paths (empty baseDir, readonly dir,
path sanitisation), poller with error-returning source/handler/report, journal
integration (JSONL file verification), multiple sources, immediate cancellation,
and cycle counter tests.

handlers: 83.8% -> 89.2% via dispatch mock servers (invalid repo, EnsureLabel
failure, GetIssue not found, AssignIssue failure, AddIssueLabels error, issue
with no special labels), completion label errors, EnableAutoMerge pending checks,
PublishDraft merged state, SendFixCommand merge conflict, DismissReviews stale
review, TickParent checkbox ticking, and dual-run mode. Remaining 10.8% is in
SSH-dependent dispatch code (secureTransfer/runRemote/ticketExists) that cannot
be tested without modifying production code.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 03:06:43 +00:00
Claude
b3e3ef2efb
test(git): push coverage from 79.5% to 96.7%
Add tests for Service lifecycle: NewService factory, OnStartup, and all
handleQuery/handleTask paths (QueryStatus, QueryDirtyRepos,
QueryAheadRepos, TaskPush, TaskPull, TaskPushMultiple, unknown types).

Add integration tests for Push with a real bare remote (push succeeds,
ahead count drops to zero), PushMultiple with multiple paths, empty
paths, and ahead/behind with no upstream tracking branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:01:12 +00:00
Claude
f50fc405f5
test(forgejo): push coverage from 73.3% to 95.0%
Add unit tests for all signal mapping functions (mapPRState, mapMergeable,
mapCombinedStatus with all branches including nil, zero count, error
state). Add tests for parseEpicChildren (all checked, all unchecked,
no checkboxes), findLinkedPR (found, not found, nil), buildSignal
(with and without head SHA), splitRepo table-driven tests.

Add Poll integration tests: multiple repos, NeedsCoding with assignee,
merged PR, no head SHA (PENDING status), API errors (graceful skip),
empty repos list, non-epic issues filtered. Add Report tests: nil
result, failed result with error message.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 01:59:36 +00:00