fix(project-rules): physical parent check, emit write guard, extract keeps both copies

_rules_out_path_ok resolves the first existing ancestor with cd -P and
refuses an out that escapes the project; emit goes through it and checks
mkdir and the write; an extract rewrite failure keeps tmp and out and
names both. Callers (onboarder, scaffolder) stop on any rc 2 but exists.
This commit is contained in:
bchanot committed 2026-11-13 13:14:24 +01:00
1 parent 4e71b1af64
commit 9d5530af89
4 files changed
+83 -24

No files matched your search

+3 -1
View File
@@ -87,7 +87,9 @@ bash ~/.claude/lib/project-rules.sh -C <PROJECT_ROOT> emit ~/.claude/templates/p
rc 0 → fill its stubs from the DESIGN (image, compose services, test
layout, pipeline jobs), no placeholders left; rc 1 → nothing matched,
skipped (a plain scaffold yields `docker.md` when Docker is relevant, and
`testing.md` only when the stack scaffolds a test file). Then
`testing.md` only when the stack scaffolds a test file); rc 2 whose stderr
line ends with ` exists` → keep the file, any other rc 2 → STOP, relay the
lib's line. Then
`bash ~/.claude/lib/project-rules.sh -C <PROJECT_ROOT> check` prints
`N rule(s) ok`. The `.gitignore` negation `!.claude/rules/` comes from the
gitflow socle at STEP 5f (`gitflow init` reconciles it before the root