Skip to content

feat: origin-qualified anchors for cross-repo specs#11

Open
laulauland wants to merge 1 commit intolau/content-sigfrom
lau/origin-qualified-anchors
Open

feat: origin-qualified anchors for cross-repo specs#11
laulauland wants to merge 1 commit intolau/content-sigfrom
lau/origin-qualified-anchors

Conversation

@laulauland
Copy link
Copy Markdown
Member

@laulauland laulauland commented Mar 27, 2026

Summary

When a spec from repo A is installed into repo B (e.g. via skill installation), its drift anchors reference repo A's files. Running drift check in repo B reports false "STALE (file not found)" errors.

This adds an origin field to drift frontmatter:

drift:
  origin: github:fiberplane/drift
  files:
    - src/main.zig@sig:a1b2c3d4e5f67890

When origin is present and doesn't match the current repo's git remote, drift check skips those anchors with SKIP (foreign origin: ...) instead of reporting them as stale. Foreign-origin specs don't cause exit 1.

Stacked on #12.

Changes

  • frontmatter.zig — parse origin: from YAML frontmatter and HTML comment blocks. New DriftSpec return type with anchors + origin
  • scanner.zig — add origin field to Spec struct
  • vcs.zig — add getRepoIdentity() + normalizeGitHubUrl() for matching git remotes to github:owner/repo format
  • main.zig — skip foreign-origin specs in lint, show origin in status text/JSON output
  • SKILL.md — add origin: github:fiberplane/drift
  • docs/ — updated DESIGN.md, CLI.md, DECISIONS.md

Design decisions

  • Phase 1 only: no network calls, no fetching from origin repos
  • github:owner/repo qualifier scopes identity matching to github.com remotes
  • JSON output omits origin when null (backwards-compatible)
  • Extensible to other qualifiers and future phases

Full spec: docs/ORIGIN.md

Closes #8

Test plan

  • Unit tests for origin parsing (frontmatter + comment blocks)
  • Unit tests for GitHub URL normalization
  • drift check with foreign-origin specs shows SKIP, exits 0
  • drift check in the origin repo checks anchors normally
  • drift status displays origin field
  • JSON output includes origin only when present

@laulauland laulauland force-pushed the lau/origin-qualified-anchors branch from 87eeb84 to 726814c Compare March 27, 2026 11:26
@laulauland laulauland force-pushed the lau/origin-qualified-anchors branch from 726814c to fc4ae35 Compare March 27, 2026 16:14
@laulauland laulauland changed the base branch from main to lau/content-sig March 27, 2026 16:15
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.

Installed skilled drifts

1 participant