Skip to content

feat(cli): always write RTK's usage block on init and update - #58

Open
protonspy wants to merge 1 commit into
mainfrom
feat/rtk-block-always
Open

protonspy wants to merge 1 commit into
mainfrom
feat/rtk-block-always

Conversation

@protonspy

Copy link
Copy Markdown
Owner

What changed

  • scc init writes RTK's usage block into the entry file (CLAUDE.md/AGENTS.md) whether or not rtk is on PATH. Only --no-rtk skips it. The cargo build is still asked about; --rtk still exits 1 when the build fails, with the block written anyway.
  • scc update plans a missing block alongside the template changes, adds it on apply, keeps a block already there (whatever version), and takes --no-rtk to skip. --json gains an omitempty rtk key: the planned entry files under --dry-run, the spliced files on apply.
  • Update planner (internal/scaffold/update.go): an owned entry file that differs from its template only by the RTK and CodeGraph marker blocks is now current, so a wired workspace reports "nothing to do" instead of listing CLAUDE.md as "yours".
  • README's RTK section updated to match.

Plan: plans/rtk-block-always.md.

How it was verified

  • scc validate --checks --pr: build, format, lint, and test (1033 tests, 86.3% coverage) all pass, 0 findings.
  • New tests: TestInitWritesTheBlockWithoutTheBinary, the --rtk build failure still writes the block, TestUpdateAddsAMissingRTKBlock (dry-run text and JSON, applied JSON, second run is a no-op with a CodeGraph block present), TestUpdateKeepsAnExistingRTKBlock, TestUpdateNoRTKLeavesTheEntryFileAlone, TestPlanTreatsAnEntryFileWithOnlyUsageBlocksAsCurrent (LF and CRLF, plus a real edit staying owned).

Reviews

  • scc-code-review: changes-requested. One major: no direct scaffold test for the block-stripping comparison. One minor: no unmarshalled test of the dry-run rtk key. Both are fixed in this PR. Tests and lint pass.
  • scc-security-review: clean, no findings. Not acted on: a low hypothesis about following symlinks. When the entry file is a symlink, the splice reads through it and AtomicWrite replaces the link with a regular file. scc rtk and scc launch already behave this way, so it is out of scope here. Hardening it belongs in spliceEntryBlock as a separate change.

`scc init` now writes RTK's usage block into CLAUDE.md/AGENTS.md whether
or not the rtk binary is on PATH; the cargo build stays a question, and
`--rtk` still exits 1 when the build fails (the block is written anyway).
`scc update` plans and adds the block to an entry file that lacks one,
keeps one already there, and takes `--no-rtk` to skip it; its JSON gains
an omitempty "rtk" key in both the dry-run plan and the applied result.

The update planner now treats an owned entry file that differs from its
template only by the RTK and CodeGraph blocks as current, so a wired
workspace reports "nothing to do" instead of listing CLAUDE.md as yours.

Plan: plans/rtk-block-always.md
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