diff --git a/create-dev-loop.md b/create-dev-loop.md index 40dec74..a10bf7b 100644 --- a/create-dev-loop.md +++ b/create-dev-loop.md @@ -27,7 +27,7 @@ ls ~/.claude/commands/-dev-loop.md 2>/dev/null **If a skill already exists**, ask the user to choose: -- **update** *(default)* — re-derive the skill from the current template and current repo state, producing a fresh skill file. Set `MODE=update`. Steps 2–5 run; Steps 6 (create GitHub repo) and 7 (record in `my-claude-skills`) are skipped because those artifacts already exist. +- **update** *(default)* — re-derive the skill from the current template and current repo state, producing a fresh skill file. Set `MODE=update`. Steps 2–5 run; Steps 6 (create GitHub repo) and 7 (record in the personal catalog) are skipped because those artifacts already exist. - **overwrite** — re-derive and replace as in fresh generation. Set `MODE=overwrite`. Steps 6–7 still run, idempotently re-asserting the repo and registry entry. - **cancel** — exit without changes. @@ -37,11 +37,13 @@ cd ~/local-skills/-dev-loop && git status --porcelain ``` If the output is non-empty, stop and ask the user to commit or stash their edits — the update would otherwise overwrite in-progress work. -In **update mode**, after Step 4 completes, show the user a diff between the existing skill file and the freshly generated content *before* overwriting: +In **update mode**, after Step 4 completes, write the freshly generated content to a scratch file using the `Write` tool — not `>` shell redirection, which some harness sandboxes statically block even for files the same session just created (the same constraint the generated template's Phase 3 teaches its own children) — at `~/local-skills/-dev-loop/-dev-loop.md.new`. Use that path, inside the directory the generator already owns, rather than `/tmp`: out-of-repo scratch writes can be blocked even when in-repo `Write` calls succeed. **If the scratch write fails, abort the update and report the failure** — do not fall back to overwriting without having shown the diff; the diff is the only confirmation gate protecting the user's existing skill file. + +Show the user a diff between the existing skill file and the scratch file *before* overwriting: ```bash -diff -u ~/local-skills/-dev-loop/-dev-loop.md /tmp/-dev-loop.new.md +diff -u ~/local-skills/-dev-loop/-dev-loop.md ~/local-skills/-dev-loop/-dev-loop.md.new ``` -Get explicit confirmation before replacing the file. +Get explicit confirmation before replacing the file. After the file is replaced (or the update is declined), remove the scratch file: `python3 -c "import os; os.remove(path)"` (not `rm`, for the same sandbox reason). ---