Repository navigation
fix(emitters): resolve rule references inside link text, and collapse a dead self-link (0.8.6) - #26
Merged
Merged
Conversation
… a dead self-link Spec 20: a reference in a link's text is resolved like a token in agents-md and kiro; a link whose own state reads "rule not in this workspace" and whose text is exactly its path becomes the token form. A K2 link keeps its non-references.
….8.6 changes Document that references inside link text are resolved like bare tokens in both agents-md and kiro, and that a dead self-link collapses to the token form.
Bump version to 0.8.6 for the link-text-references fix.
…ning entry Both tests validate spec 20's warning order and the imported-shape no-change guarantee, pinning behaviour that must not regress.
…lveRuleRefs Deduplicate the token regex pattern and the collapse logic to reduce code duplication and make future maintenance easier. Remove the unused warningOffset field from the Match interface.
Clarify the exact conditions for collapsed links and specify which workspaces see no byte change in 0.8.6.
Spec 20 §4.1 says a reference inside the text of a K2 link (kept for claude-code) is resolved. An unknown name inside that text rewrites to .kiro/steering/ and is reported, covering the only Kiro-specific byte change 0.8.6 can make in an imported-shape workspace.
An unknown name in a K2 link's text now moves to .kiro/steering/ and is reported—the only Kiro-specific byte change 0.8.6 makes in an imported- shape workspace.
…le or not Clarify that the No byte change condition for AGENTS.md with claude-code applies when links cite rules claude-code writes OR names that are no rule, and that without claude-code, updates occur wherever a link text holds a .claude/rules/<x>.md reference, known rule or not.
…NTS.md The "No byte change" clause now correctly states that AGENTS.md preserves bytes unless a link's text names a steering file kiro writes (state B), not just when it names "no rule" (state C or unknown).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR bumps the version to 0.8.6. Merging publishes
craftar@0.8.6to npm once the release is approved in thenpmenvironment.What changes. 0.8.4 (
AGENTS.md) and 0.8.5 (kiro) treated the text of a link they rewrote as opaque. A link whose text repeats its own target,[`.claude/rules/x.md`](.claude/rules/x.md), therefore kept a path the workspace may not have. This PR implements the approved spec rule references inside link text, the contract the user chose ("Token + colapsar"):agents-mdandkiro, every rule reference inside a matched link's text is resolved like a token, with the same states and wording as the same mode.[`.claude/rules/cc.md`](.claude/rules/cc.md)→`cc (rule not in this workspace)`claude-code(K2). Only the references in its text move. Non-references stay as written (spec Ruling 4).resolveRuleRefs(src/emitters/shared.ts): one token pattern and one collapse helper.agents-md.tsandkiro.tsdo not change.Which workspaces see
updateThe user approved the byte change at the spec's checkpoint, before the commit. They saw the before/after on a scratch Forge holding every example line of the spec, across six target sets.
syncon 0.8.6craftar importproduced (rulestargets: "*",claude-codea target).kiro/, nor inAGENTS.mdunless a link's text names one of its hand-written steering files (state B: it becomes.kiro/steering/<x>.md); a kiro link text citing an unknown name adds akiro:warning entryAGENTS.mdwritten withoutclaude-code, a link's text holds a.claude/rules/<x>.mdreferenceclaude-codewhose text cites another nameAn affected workspace shows
AGENTS.mdor the.kiro/files asupdate, andcraftar sync --checkexits 1 until it syncs.Accepted odd forms
The user accepted these two forms as part of the contract:
see cc (rule not in this workspace) (cc, rule not in this workspace).cc (rule not in this workspace)#part (cc, rule not in this workspace).Tests
importproduces keeps itsAGENTS.mdand kiro bytes;Known limits (unchanged)
[see [.claude/rules/cc.md](.claude/rules/cc.md)) match the outer[(spec 15 §4.1). Recorded for the docs.Test plan
npm run typecheck: exit 0 on77e395a.npm run build: exit 0.test/ci.test.ts(Linux): 853 passed / 5 skipped.npx tsx test/helpers/regen-golden.ts: no diff undertest/golden/.node-cli-reviewer2 rounds, the second clean;docs-author5 rounds on the README; the last finding (asteeringname is state B inAGENTS.md) is fixed in77e395a.37307562016,37307567200).