SIGN IN SIGN UP

fix(install): upgrade a stale instruction block instead of skipping the file

_inject_instructions only checked whether the opening marker was present.
Anyone who installed at an earlier version kept that release's text forever
and reinstalling was a no-op, so the guardrails added in the previous commit
would only ever reach brand-new installs. Same upgrade-path failure as #558.

Generated sections now end with <!-- /code-review-graph MCP tools --> so the
managed block has real boundaries. Blocks written before that marker existed
have no closing boundary, so they are found by matching their full recorded
text rather than by guessing where they stop, and only text that exactly
equals a block this project generated is ever rewritten. Anything the user
wrote around the block survives byte for byte, and duplicate stale blocks
from repeat installs collapse to one.

_legacy_instructions.py records the 10 past block texts, recovered by walking
git history twice: an AST evaluation of every past revision of skills.py, and
a scan of the instruction files this repo ships, which caught blocks a
markdown formatter rewrote after generation. The list is append-only.

_inject_instructions now returns created, updated, unchanged or conflict.
Identical content stays a no-op and does not rewrite the file. A block that
matches nothing known was hand-edited: it is left untouched and reported, so
install names the file instead of silently doing nothing. inject_platform_
instructions keeps its list-of-filenames contract; the new
inject_instruction_files carries the outcomes, and the install command and
its dry-run preview both use them.

Refs #314, #558

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012fHfGDiZedoxjpKzanHri3
T
Tirth Kanani committed
060fc1ae785954106fee90e6782fae671db65ac9
Parent: 5b914a4