Skip to content

Reform publish: reference-chain only inclusion (replaces flat-mirror)#16

Open
electricessence wants to merge 1 commit into
mainfrom
refactor/publish-reference-chain
Open

Reform publish: reference-chain only inclusion (replaces flat-mirror)#16
electricessence wants to merge 1 commit into
mainfrom
refactor/publish-reference-chain

Conversation

@electricessence
Copy link
Copy Markdown
Contributor

Summary

Restore reference-chain-only semantics in tools/publish.ps1. Files ship if and only if they are reachable from a skill's SKILL.md via the reference chain. Eliminates the 0.4.0 dist leaks (research.md, redundancy-audit.md, draft task files, etc.).

Operator framing: "reachable from SKILL.md via reference chain, period."

What changed

  • tools/publish.ps1 — flat-mirror replaced with BFS walker (Build-InclusionSet) that follows two ref patterns: backtick-quoted spans and shell-command bare names. Change-detection and build-dist both use the walker.
  • build/deny-list.ps1 — fixed wildcard bug where *.uncompressed.md was added to HashSet[string] (literal match only). Moved to $DenyPatterns (-like match works).
  • tools/publish-rule.spec.md — new formal spec for inclusion semantics.

Companion change (skills repo)

Three SKILL.md files had tool refs that weren't reachable under strict walk; explicit backtick refs need to be added in skills repo:

  • messaging/SKILL.md (8 scripts)
  • markdown-hygiene/markdown-hygiene-lint/SKILL.md (verify scripts)
  • hash-record/hash-record-prune/SKILL.md (prune scripts)

These edits are staged locally in skills repo on a follow-up; will PR separately or fold into next dev→master loop.

Out of scope (deferred)

  • -BuildOnly flag to let operator audit dist diff before commit (separate PR; planned for next pass).

Test plan

  • Reform agent dry-run reports change count > 0 with the expected exclusions identified.
  • Real publish run produces a clean dist (no session notes); verified on next release.
  • Companion SKILL.md tool-ref edits land in skills repo before next publish.

🤖 Generated with Claude Code

Background: 0.1.4 changed inclusion semantics from reference-walk-only to
flat-mirror-all-non-denied to fix tool-bundling gaps. That fix was an
overcorrection — session notes (research.md, redundancy-audit.md, draft
tasks) rode along into every release dist because they sat in skill folders.
Operator: "reachable from SKILL.md via reference chain, period."

Restore reference-chain-only semantics with a hardened walker:

- New helpers: Get-RefsFromContent (backtick-quoted spans + shell-command
  bare-name patterns), Build-InclusionSet (BFS walk from SKILL.md as root).
- Walk admits a file if: ref pattern matches AND file exists AND not denied
  AND within sourceRoot AND not under a dot-ancestor. `.md`/`.txt` files are
  recursively scanned for more refs.
- Change-detection loop (lines 184–191) now uses Build-InclusionSet so the
  manifest delta reflects what the new build would actually ship.
- Build-dist loop now copies only files in the inclusion set; tracks
  $totalExcluded separately from $totalDenied.

deny-list.ps1: fixed dead-code bug where `*.uncompressed.md` was added to
a HashSet[string] (literal match only, never wildcard). Moved to
$DenyPatterns where `-like` matches. Now correctly catches `eval.uncompressed.md`
and similar variants.

New file: tools/publish-rule.spec.md — formal spec for inclusion semantics.

Companion changes in skills repo (separate commit/branch): three SKILL.md
files (messaging, markdown-hygiene-lint, hash-record-prune) had tool refs
that weren't reachable under strict ref-walk; added explicit backtick refs
so co-located scripts stay in the inclusion set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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