docs: doctor residue check covers skillOverrides, MIGRATION step 1 restores both keys (H7)

This commit is contained in:
bchanot committed 2026-11-14 10:40:51 +01:00
1 parent 313b1573bb
commit 8dcee03e47
2 files changed
+17 -11

No files matched your search

+1
View File
@@ -28,6 +28,7 @@ Format follows [Keep a Changelog](https://keepachangelog.com/) and this project
- `settings.json` denies more read and exec forms (28 entries): `awk`/`gawk`/`mawk` with `system (` (space before the paren), `-f` program files, `getline` and `| "` pipe-to-command; `cat` and `rtk read` (plus `*/rtk read` twins) on `.key`, `.pem`, `id_rsa` and `id_ed25519` without a directory prefix. Test: `lib/tests/push-guard.test.sh` T63 locks every row, T62 twins hold. `doctor.sh`: the missing-jq message names every jq hook (`statusline, rtk-rewrite, code-limits and push-guard`). - `settings.json` denies more read and exec forms (28 entries): `awk`/`gawk`/`mawk` with `system (` (space before the paren), `-f` program files, `getline` and `| "` pipe-to-command; `cat` and `rtk read` (plus `*/rtk read` twins) on `.key`, `.pem`, `id_rsa` and `id_ed25519` without a directory prefix. Test: `lib/tests/push-guard.test.sh` T63 locks every row, T62 twins hold. `doctor.sh`: the missing-jq message names every jq hook (`statusline, rtk-rewrite, code-limits and push-guard`).
- Hooks: `hooks/code-limits.sh` keeps its per-session state in a private dir (`mkdir -m 700` without `-p`, else an existing dir is accepted only if it is ours, a directory and mode 700); `hooks/session-start.sh` bounds `memory.sh` and the feedback reminder with `timeout`, else `gtimeout`, else a perl alarm (stock macOS), never unbounded; the gitflow pre-commit hook (generator `lib/gitflow.sh` and both copies) blocks when `git diff --cached` or its filter fails instead of letting the commit through. Tests: `lib/tests/code-limits.test.sh` T16, `lib/tests/session-digest.test.sh` SD19, new `lib/tests/precommit-failclosed.test.sh` PC1-PC4. - Hooks: `hooks/code-limits.sh` keeps its per-session state in a private dir (`mkdir -m 700` without `-p`, else an existing dir is accepted only if it is ours, a directory and mode 700); `hooks/session-start.sh` bounds `memory.sh` and the feedback reminder with `timeout`, else `gtimeout`, else a perl alarm (stock macOS), never unbounded; the gitflow pre-commit hook (generator `lib/gitflow.sh` and both copies) blocks when `git diff --cached` or its filter fails instead of letting the commit through. Tests: `lib/tests/code-limits.test.sh` T16, `lib/tests/session-digest.test.sh` SD19, new `lib/tests/precommit-failclosed.test.sh` PC1-PC4.
- `hooks/session-start.sh`: the memory digest prints `- open: none` when no blocker is open and `- open: unknown (memory.sh index failed)` when `memory.sh index blocker` fails or times out. Both cases used to print no blocker line, so a failed read looked like a clean slate. `lib/profile-state.jq` (`profile.sh current --plain`): a newline or CR in a printed value becomes a space, and a plugin id that does not match `\A[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\z` is dropped, so a settings value can no longer forge a `plugin:` line. Tests: `lib/tests/session-digest.test.sh` SD9a-SD9d, SD12; `lib/tests/profile.test.sh` T28. - `hooks/session-start.sh`: the memory digest prints `- open: none` when no blocker is open and `- open: unknown (memory.sh index failed)` when `memory.sh index blocker` fails or times out. Both cases used to print no blocker line, so a failed read looked like a clean slate. `lib/profile-state.jq` (`profile.sh current --plain`): a newline or CR in a printed value becomes a space, and a plugin id that does not match `\A[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\z` is dropped, so a settings value can no longer forge a `plugin:` line. Tests: `lib/tests/session-digest.test.sh` SD9a-SD9d, SD12; `lib/tests/profile.test.sh` T28.
- doctor.sh: the user-scope residue check compares `enabledPlugins` and `skillOverrides` between HEAD and the working `settings.json` (it compared `enabledPlugins` only), so a UI write into user-scope `skillOverrides` that dirties the tracked file is now reported; the pass and skip lines name both keys. MIGRATION "Profiles and packs" step 1 restores both keys.
## [3.0.0] — 2026-11-12 ## [3.0.0] — 2026-11-12
+16 -11
View File
@@ -211,9 +211,9 @@ is the only one that removes a real directory (`make plugin` replaces
the clone, not the clone itself, so resolve the root first. `git pull the clone, not the clone itself, so resolve the root first. `git pull
--autostash` (a plain `git pull` aborts when `settings.json` is modified --autostash` (a plain `git pull` aborts when `settings.json` is modified
locally and the incoming commits touch it; autostash keeps your UI locally and the incoming commits touch it; autostash keeps your UI
writes), then restore the user-scope plugins the old `profile.sh` had writes), then restore from HEAD the user-scope plugins the old
toggled. Never `git checkout -- settings.json`: it would drop your UI `profile.sh` had toggled (`enabledPlugins`) and `skillOverrides`. Never
writes. `git checkout -- settings.json`: it would drop your UI writes.
```bash ```bash
ep= next= ep= next=
@@ -222,11 +222,14 @@ is the only one that removes a real directory (`make plugin` replaces
|| { echo "no clone root"; false; } \ || { echo "no clone root"; false; } \
&& git pull --autostash \ && git pull --autostash \
&& ep="$(mktemp)" \ && ep="$(mktemp)" \
&& git show HEAD:settings.json | jq -e '.enabledPlugins | objects' \ && git show HEAD:settings.json \
> "$ep" \ | jq -e '{enabledPlugins, skillOverrides}
| select((.enabledPlugins | type) == "object")' > "$ep" \
&& next="$(mktemp)" \ && next="$(mktemp)" \
&& jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0]' settings.json \ && jq --slurpfile ep "$ep" '.enabledPlugins = $ep[0].enabledPlugins
> "$next" \ | if $ep[0].skillOverrides == null then del(.skillOverrides)
else .skillOverrides = $ep[0].skillOverrides end' \
settings.json > "$next" \
&& jq -e . "$next" >/dev/null && [ -s "$next" ] \ && jq -e . "$next" >/dev/null && [ -s "$next" ] \
&& cp "$next" settings.json && cp "$next" settings.json
rm -f "$ep" "$next" rm -f "$ep" "$next"
@@ -236,10 +239,12 @@ is the only one that removes a real directory (`make plugin` replaces
`cp`, which writes through the symlink into the live tracked `cp`, which writes through the symlink into the live tracked
`settings.json`; a failure prints `no clone root` or stops the chain `settings.json`; a failure prints `no clone root` or stops the chain
without closing your shell. `ep= next=` comes first so the final `rm -f` without closing your shell. `ep= next=` comes first so the final `rm -f`
never removes a file an earlier run named. `jq -e '.enabledPlugins | never removes a file an earlier run named. The first `jq -e` produces
objects'` fails when HEAD holds no object (a null would wipe every nothing, and fails, when HEAD's `enabledPlugins` is not an object (a
plugin). `jq -e .` and `[ -s ]` refuse an invalid or empty result (an null would wipe every plugin); a HEAD without `skillOverrides` removes
empty file would drop the plugins, the deny rules and the hooks). the key instead of writing a null. `jq -e .` and `[ -s ]` refuse an
invalid or empty result (an empty file would drop the plugins, the deny
rules and the hooks).
If the autostash pop conflicts, `settings.json` holds conflict markers: If the autostash pop conflicts, `settings.json` holds conflict markers:
the second `jq` then fails closed and nothing is copied. Resolve the the second `jq` then fails closed and nothing is copied. Resolve the