Skip to content

feat(source): linked (editable) sources — SPEC-007 (closes #69) - #71

Merged
nmccready merged 1 commit into
mainfrom
feat/issue-69-linked-sources
Jul 7, 2026
Merged

feat(source): linked (editable) sources — SPEC-007 (closes #69)#71
nmccready merged 1 commit into
mainfrom
feat/issue-69-linked-sources

Conversation

@nmccready

Copy link
Copy Markdown
Contributor

Implements SPEC-007 (spec) — the npm link / go mod replace analogue for .agents/ artifacts. A linked source symlinks a managed artifact at a live local git checkout instead of a SHA-pinned tarball snapshot, so edits flow both ways and git pull in the checkout reaps updates with no re-fetch. Replaces the undocumented, non-portable manual ln -s.

What's new

sync-agents source add --link=../foo-skill skill:me/foo-skill  # link a checkout you own
sync-agents source add --link=../foo-skill                     # derive entry from git remote
sync-agents source add --link skill:me/foo-skill               # managed clone (.agents/.sources/), scanned once

Acceptance criteria (issue #69)

  • Override.Link + LockEntry.Link/ManagedClone schema; link⊕pin_sha validated at load
  • file: parse (relative ok, absolute rejected)
  • add --link=<path> <entry> writes relative manifest/lock + relative symlink; re-pull no-op, no clobber
  • add --link <entry> managed clone + SPEC-005 scan gate
  • --link=<path> derives owner/repo from git remote
  • update: managed clone git pull --ff-only; user checkout no-op
  • index enumerates linked skill in AGENTS.md (follows symlinks)
  • detach link → vendored copy (freeze; keeps upstream identity)
  • portability test: no absolute paths in lock/symlink
  • docs synced (README + SPEC status → Implemented)

Design notes

  • All persisted paths use the file: scheme relative to .agents/; the on-disk symlink is created relative too — absolute file: paths are rejected at parse time (git-tracked sources.lock must stay portable).
  • Reuses the existing Override mechanism (adds link, mutually exclusive with pin_sha).
  • A linked source is a working tree the operator owns → trusted by default; only a managed clone's first fetch is scanned (matches the ClawHub supply-chain posture).
  • pull never re-fetches a snapshot over a link; a moved/deleted checkout surfaces as a warning, not a silent revert.
  • scan/copyTree now skip nested .git (VCS metadata is never artifact content).

Tests

  • Go: file: parse table, link⊕pin_sha + absolute rejection, all three add --link forms (managed clone uses a hermetic local repo via injectable CloneURL), dangling-target warn, detach freeze, index-follows-symlink.
  • bats: 7 end-to-end cases. Full suite 139/139 green; go test ./..., go vet, gofmt clean.

🤖 Generated with Claude Code

Add an npm-link / go-replace mode to the SPEC-003 source system: a linked
source symlinks a managed .agents/ artifact at a live local git checkout
instead of a SHA-pinned tarball snapshot, so edits flow both ways and
`git pull` in the checkout reaps updates with no re-fetch.

- schema: Override.Link + LockEntry.Link/ManagedClone; link⊕pin_sha and
  absolute-path rejection validated at manifest load
- file: scheme parser (relative ok, absolute rejected) resolved against .agents/
- `source add --link=<path> <entry>` (link a checkout), `--link <entry>`
  (managed clone under .agents/.sources/, scanned once via SPEC-005), and
  `--link=<path>` (derive owner/repo from the checkout's git remote)
- pull skips the fetcher and verifies/self-heals the symlink; dangling target
  warns instead of silently re-fetching; update git-pulls managed clones
- index follows symlinks so linked skills enumerate in AGENTS.md
- `source list` marks linked entries; `detach` freezes a link into a vendored
  snapshot (keeps upstream identity, drops the link override)
- all persisted paths + on-disk symlinks are relative (portability invariant)
- scan/copyTree skip nested .git; docs + SPEC-007 status → Implemented
- tests: Go (parse, three add forms, dangling, detach, index) + 7 bats e2e

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🤖 AI Code Review Complete

Review performed on changed files. Check inline comments for specific findings.

Severity Levels:

  • 🔴 Critical: Must fix (bugs, security, data loss)
  • 🟡 Warning: Should fix (performance, maintainability)
  • 🔵 Suggestion: Nice to have (style, alternatives)
  • Nit: Optional (cosmetic)

@nmccready
nmccready merged commit eca6d90 into main Jul 7, 2026
6 checks passed
@nmccready
nmccready deleted the feat/issue-69-linked-sources branch July 7, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant