fix(agents-md): list a scoped rule at the file a target writes, or embed it (0.8.3) - #23
Merged
Merged
Conversation
Add ruleFile() to shared.ts and use it in claude-code.ts and kiro.ts. The path AGENTS.md will list is now computed by the same function for all three emitters, preventing drift.
…bed them Spec 14: a scoped rule names .claude/rules/ when claude-code writes it, .kiro/steering/ when only kiro does, and is embedded with its scope when no target writes it. Workspaces in state A keep their bytes.
…hat 0.8.3 changes Update the Targets description for agents-md to specify where each scoped rule is listed or when it is embedded. Add the 0.8.3 upgrade notes.
Bump version to 0.8.3 for the agents-md scoped-rules fix.
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.3. Merging it publishes
craftar@0.8.3to npm once thereleaserun is approved in thenpmenvironment.What changes. In 0.8.2,
AGENTS.mdlisted every scoped rule (fileMatch,manual,auto) at.claude/rules/<name>.md, whatever the workspace's targets were. When no target wrote that file, the rule's text reached no agent and nothing warned. Now each scoped rule:.claude/rules/<name>.mdwhenclaude-codewrites it;.kiro/steering/<name>.mdwhenkirowrites it;> Scoped rule — <scope>.The order of the workspace's targets does not matter. This follows the approved spec, scoped rules in
AGENTS.md.src/emitters/shared.tsgainsruleFile(target, meta), now used by theclaude-code,kiroandagents-mdemitters. As a result, the listed path cannot drift from what the writers write. The refactor is byte-neutral: everyclaude-codeandkirooutput is unchanged.plan(),status(), the lock or the CLI.Which workspaces see
updateOnly
AGENTS.mdchanges, and only in the cases below. The user approved this byte change at a checkpoint before the commit, using the before/after measured on 0.8.2 with the spec's six-rule Forge.syncon 0.8.3claude-code, scoped rules with the defaulttargets(every workspacecraftar importproduced)agents-mdkiro+agents-md, noclaude-code.claude/rules/to.kiro/steering/agents-mdonlytargetsexcludeclaude-code.kiro/steering/or is embeddedAn affected workspace shows
AGENTS.mdasupdate, andcraftar sync --checkexits 1 until it syncs. The README has an Upgrading → to 0.8.3 note.Tests
test/emitters/agents-md.test.tsare re-targeted. As the spec requires, they now use["claude-code", "agents-md"], and their expectedAGENTS.mdbytes are unchanged. That is the proof that state A does not move. One path-list assertion gains the.claude/rules/files. No other existing test changed.agents-mdonly;kiro+agents-md;claude-code+agents-md;Out of scope
.claude/rules/…reference inside a rule body is emitted as the Forge holds it. That reference is the next patch's subject..kiro/steering/<name>.mdcollide as before. That case is warned (last wins), and it is not new.Test plan
npm run typecheck: exit 0 onad10cc2.npm run build: exit 0.node bin/craftar.js --versionprints0.8.3.test/ci.test.ts(Linux): 798 passed / 5 skipped.test/golden/**is unchanged;claude-codeandkirooutputs byte-identical tod65afffacross 16 scenarios, andAGENTS.mdidentical in 13 state-A scenarios.node-cli-revieweranddocs-authorround 1 were clean, with nits only.37232063445,37232084434).