@cratis/pi 7.172.1 → 7.172.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,10 +38,9 @@ dumps, and similar coordination files. These are **work records, not documentati
38
38
  replace the prompt.
39
39
  - **A worktree is a work record too.** Create it outside the repository tree, for
40
40
  example in a sibling `../.worktrees/` directory. A nested worktree inherits the
41
- parent's `.globalconfig`, causing .NET `MultipleGlobalAnalyzerKeys` errors or silently
42
- changing analyzer severities. In a container worker whose checkout is the workspace root
43
- with a read-only parent (such as `/workspace`), use `$HOME/.worktrees/<name>`,
44
- never `..` outside the workspace or inside the checkout. **Delivered work is cleaned up by
41
+ parent's `.globalconfig` (.NET `MultipleGlobalAnalyzerKeys` errors or changed analyzer
42
+ severities). In a container whose checkout is the workspace root with a read-only
43
+ parent, use `$HOME/.worktrees/<name>`. **Delivered work is cleaned up by
45
44
  `.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`, not by memory:** run it from the
46
45
  main checkout when a PR merges or you finish a task (hooks and **ship-changes** also run it). It
47
46
  removes a worktree and its branch only on evidence the work reached the default branch —
@@ -53,7 +52,8 @@ dumps, and similar coordination files. These are **work records, not documentati
53
52
  or `git branch -D` a delivered branch when the script can; `gh pr merge --delete-branch`
54
53
  inside a worktree leaves the worktree and branch behind. If the branch must outlive the task
55
54
  unmerged, leave the worktree and say so in the handoff. Never `--force` a removal; a
56
- refusal means look, not push harder.
55
+ refusal means look. Cleanup keeps local-only work (unpushed commits, stashes, dirty
56
+ worktrees) and records branch refs and SHAs before and after.
57
57
  - **Scan for secrets before archiving or sharing.** Before anything from `.ai-work/` is archived,
58
58
  attached or shared, run `gitleaks detect --no-git --source <dir>` (or the repository's equivalent)
59
59
  and redact every finding. See [`secrets.md`](./secrets.instructions.md).
@@ -43,6 +43,9 @@ not measured: code-shape inspection is not a benchmark, a build is not behaviora
43
43
  proof, and an unexamined surface is not verified. State `None` only when the entire
44
44
  declared scope was examined; otherwise give concrete limits and remaining checks.
45
45
 
46
+ - **[contract]** A security reviewer's NOT PASS is blocking, never advisory. Resolve it with a fix plus re-review, or an explicit, recorded decision by the person who owns the risk; never downgrade it to advisory.
47
+ - **[contract]** A review report, and any reviewer notes posted on a PR, lists only the commit ranges actually reviewed. Name unreviewed deltas as unreviewed; never imply they are covered.
48
+
46
49
  ## Verdict vocabulary
47
50
 
48
51
  | Verdict | Meaning |
@@ -399,15 +399,15 @@ arguments are operands. A lone `-` is a stdin operand. Value-free short flags ma
399
399
  | `wc` | `-l -w -c -m` |
400
400
  | `ls` | `-l -a -A -1 -h -d -R -t -r -F` |
401
401
  | `df` | `-h` |
402
- | `rg` | `-n -l -i`, `--files`; literal `--glob`/`-g` filters |
402
+ | `rg` | `-n -l -i`, `--files`; literal `--glob`/`-g` filters; with an explicit `--no-config` option only: `-A N -B N -C N -m N` (digits), `-t NAME -T NAME` (alphanumeric), `-S -o -s -I -N` (also in short-flag groups). No `--hidden`, `--no-ignore` or `--iglob` |
403
403
  | `grep`, `egrep`, `fgrep` | `-n -i -r -R -l -L -c -v -w -x -F -E -H -h -o -q -s`; `-e PATTERN`, `-A N`, `-B N`, `-C N`; `--include=PATTERN`, `--exclude=PATTERN` or a separate literal pattern value; a search pattern is still required |
404
404
  | `echo` | `-n -e -E` |
405
405
  | `printf`, `test`, `[`, `true`, `false`, `pwd` | None (in particular, no `printf -v`) |
406
406
  | `git status` | `-s -b --short --porcelain` |
407
- | `git diff` | `--stat --numstat --name-only --name-status --cached --staged --check -p -U<N> --no-color` |
407
+ | `git diff` | `--stat --numstat --name-only --name-status --cached --staged --check -p -U<N> --no-color`; extra presentation flags remain refused (see #1255 below) |
408
408
  | `git log` | `--oneline --stat --name-only -n N -nN -<N> -p --no-color --format=<fmt> --pretty=<fmt> --follow` |
409
409
  | `git show` | `--stat --name-only -p --no-color --format=<fmt>` |
410
- | `git add` | `-A -u -p -v --all`, including path globs for installed prompts |
410
+ | `git add` | `-A -u -p -v --all`; literal named paths, including corpus files, and path globs for installed prompts. No `-f` or `-N`/`--intent-to-add` |
411
411
  | `git commit` | `-m MSG`, `--message MSG`, `-mMSG`, `-a`, `-q`; `-F FILE` only for a literal non-protected file; no `--no-verify` |
412
412
  | `git blame`, `ls-files`, `rev-parse`, `check-ignore`, `grep` | None |
413
413
  | `git branch` | Exactly `--show-current`, or `--list` followed only by literal patterns |
@@ -416,6 +416,38 @@ arguments are operands. A lone `-` is a stdin operand. Value-free short flags ma
416
416
  | `rsync` | `-a -r -v -n -u -z -t -p`; `--archive --recursive --verbose --dry-run --update --compress --times --perms` |
417
417
  | `install` | `-c -v -C -p`; `-d` directory operands; `-m MODE`/`-mMODE` (three or four octal digits); the same target-directory forms as `cp` |
418
418
 
419
+ ### Read-only admissions and deliberate refusals (#1255)
420
+
421
+ | Case | Decision | Reason | Workaround |
422
+ | --- | --- | --- | --- |
423
+ | 1: extra `git diff` flags | Refused, unchanged | Any `git diff`, including the forms already accepted, can run `diff.external`, `.gitattributes` textconv or the pager, and these flags do not prevent that (reproduced with `-w` and `--shortstat -p`). Keeping them refused limits what is newly accepted; it does not remove that risk. Re-admission needs guard-enforced sanitized configuration, tracked separately. | Use the existing exact option list above. |
424
+ | 1: extra `rg` flags | Narrow admission | Only the numeric context/count, alphanumeric type and short display flags listed above qualify, and only with an actual `--no-config` option disabling environment-selected configuration. A value or operand spelling `--no-config` does not qualify. Hidden/ignored-file expansion and all other new options stay refused. | Add `--no-config`, for example `rg --no-config -n -C 2 'a]*b' .cratis`. |
425
+ | 2: corpus script execution | Named allowlist, unchanged | The two exact entries below are already accepted; other scripts and `cd X && node …` remain refused because a script or another checkout's copy can write protected paths. | Run the exact named invocation from the current checkout without a `cd` prefix. |
426
+ | 3: scratch heredoc mentioning a protected path | Refused, unchanged | The whole command includes its body even when the destination is unprotected; that file could later be executed or sourced. Quoted/unquoted delimiters and append redirects are not exemptions. Stdout-only `cat <<'EOF'` remains accepted. | Use the Write tool for scratch files containing protected text. |
427
+ | 4: glob-like searches and file/test filters | Quoted search patterns and `ls -d Arc*` already accepted; wildcard test filter refused | `rg 'a]*b' .cratis` and `rg -n '^[a-z-]*' Source` (also with `\| sort`) treat the quoted pattern as data; path operands stay checked. `Foo*` can intersect `*.env`, and `dotnet test` compiles, executes code and writes bin/obj: it is not a read-only verb when a protected reference exists. | Use `dotnet test --filter 'FullyQualifiedName~Foo'` or `--filter 'ClassName=…'`; `~` is already a contains-match. With no protected reference the ordinary policy allows it, not a dotnet exemption. |
428
+ | 5: `git add` a named corpus file | Accepted, unchanged | Staging changes the index, not the working-tree content. The Write/Edit guard still protects that content. Chained content writes, `-f`, `-N`, status-variable and push chains remain refused. | Use `git add -- .cratis/ai/skills/s/SKILL.md` with the exact allowed options. |
429
+
430
+ These options were refused before #1255. This is a closed allowlist, not an admission
431
+ of arbitrary presentation options: `--pre`, `-f`, `--hostname-bin`, `--type-add`, `-z`,
432
+ unknown options and invalid values remain refused. Output redirects to protected paths
433
+ and pipelines to writers remain refused too. The existing protected-reference scan and
434
+ lexer are unchanged; the guard remains best-effort, not a sandbox.
435
+
436
+ #### Named scripts
437
+
438
+ Only these exact interpreter/path pairs qualify, with no `./`, variable, glob or
439
+ alternate spelling and no preceding directory change:
440
+
441
+ - `node .cratis/ai/hooks/scripts/cratis-check-pr.mjs`: `--strict`, and value options
442
+ `--body-file`, `--label`, `--add-label`, `--remove-label`, `--pr`, `--base`, `--repo`.
443
+ Values must be nonempty literal words, not start with `-`, and not be globbed.
444
+ - `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`: `--dry-run`, `--quiet`,
445
+ `--no-fetch` only.
446
+
447
+ This is not permission to run arbitrary corpus scripts: `cratis-check-handoff.mjs`
448
+ and all other scripts remain refused. Redirect destinations and chained commands
449
+ are still checked separately.
450
+
419
451
  The only global Git option exemption is a single separate `-C <dir>` with a literal,
420
452
  non-empty directory word not starting with `-`, followed by exactly one of these tails:
421
453
  `status --short`, `rev-parse HEAD`, `branch --show-current`, or `tag --list <pattern>`.
@@ -426,6 +458,19 @@ all other global options (`-c`, `--git-dir`, `--work-tree`, `--no-pager`, `--exe
426
458
  remain denied. `-C` gives **no protection** from a hostile repository's configuration:
427
459
  fsmonitor, hooks, pager and diff/textconv helpers can still run. This is a syntax filter,
428
460
  not a repository sandbox.
461
+
462
+ Known limitations of the same kind (both need control of the local environment or Git
463
+ configuration, which the guard cannot see):
464
+
465
+ - Plain `rg` forms that were already accepted (`-n`, `-l`, `-i`, `--files`) do not require
466
+ `--no-config`, so a `RIPGREP_CONFIG_PATH` set in the environment can add options such as
467
+ `--pre`. Only the flags admitted for #1255 require a literal `--no-config`; requiring it for
468
+ every `rg` would refuse the most common read-only searches.
469
+ - Already accepted `git diff` forms (for example `-p` or `-U2`) run an inherited
470
+ `GIT_EXTERNAL_DIFF` program. Controlling the environment already implies code execution,
471
+ so the guard does not try to detect it.
472
+ - `git add <file>` runs any `filter.<name>.clean` driver defined in Git configuration for a
473
+ path that `.gitattributes` assigns to that filter.
429
474
  Git format values containing `%(` are not accepted. Index/commit operations are deliberate
430
475
  allowances, not general shell execution permission. Output-to-file options such as
431
476
  `git diff --output=...` are never exempt, even with a non-protected destination on a line
@@ -275,10 +275,10 @@ function short_flags(w, flags, k) {
275
275
  return 1
276
276
  }
277
277
  function number(s) { return s ~ /^[+-]?[0-9]+$/ }
278
- function options_allowed(verb, first, i, w, filters, patterns, ended) {
278
+ function options_allowed(verb, first, i, w, filters, patterns, ended, rg_new, no_config) {
279
279
  for (i = first; i <= argc; i++) {
280
280
  w = W[i]
281
- if (!ended && w == "--") { if (verb !~ /^(sort|uniq)$/) return 1; ended = 1; continue }
281
+ if (!ended && w == "--") { if (verb !~ /^(sort|uniq)$/) return !rg_new || no_config; ended = 1; continue }
282
282
  if (ended || w !~ /^-/ || w == "-") {
283
283
  # Admit sort/uniq only as stdin filters. File operands, including after
284
284
  # --, retain whole-command classification and every existing refusal.
@@ -306,6 +306,20 @@ function options_allowed(verb, first, i, w, filters, patterns, ended) {
306
306
  }
307
307
  }
308
308
  if (verb == "git diff" && w ~ /^-U[0-9]+$/) continue
309
+ # New rg display/filter flags require an actual option, never a pattern or option value,
310
+ # disabling config-supplied helpers. Hidden/ignored-file expansion stays refused.
311
+ if (verb == "rg") {
312
+ if (w == "--no-config") { no_config = 1; continue }
313
+ if (w == "-A" || w == "-B" || w == "-C" || w == "-m") {
314
+ if (++i > argc || W[i] !~ /^[0-9]+$/) return 0
315
+ rg_new = 1; continue
316
+ }
317
+ if (w == "-t" || w == "-T") {
318
+ if (++i > argc || globbed[i] || W[i] !~ /^[A-Za-z0-9]+$/) return 0
319
+ rg_new = 1; continue
320
+ }
321
+ if (short_flags(w, "nliSosIN") && !short_flags(w, short_options[verb])) { rg_new = 1; continue }
322
+ }
309
323
  if (verb == "shellcheck" && w ~ /^--severity=(error|warning|info|style)$/) continue
310
324
  if ((verb == "git log" && w ~ /^--(format|pretty)=/) || (verb == "git show" && w ~ /^--format=/)) {
311
325
  if (index(w, "%(")) return 0
@@ -327,7 +341,7 @@ function options_allowed(verb, first, i, w, filters, patterns, ended) {
327
341
  }
328
342
  if (!short_flags(w, short_options[verb])) return 0
329
343
  }
330
- return !filters || patterns > 0
344
+ return (!filters || patterns > 0) && (!rg_new || no_config)
331
345
  }
332
346
  # awk is read-only only for the shape awk [-F sep] 'program' operands. Every other option (-f, -v, -e, -i,
333
347
  # --include, --, ...) is refused. awk output, execution and file reads need one of > | system getline close
@@ -37,10 +37,9 @@ dumps, and similar coordination files. These are **work records, not documentati
37
37
  replace the prompt.
38
38
  - **A worktree is a work record too.** Create it outside the repository tree, for
39
39
  example in a sibling `../.worktrees/` directory. A nested worktree inherits the
40
- parent's `.globalconfig`, causing .NET `MultipleGlobalAnalyzerKeys` errors or silently
41
- changing analyzer severities. In a container worker whose checkout is the workspace root
42
- with a read-only parent (such as `/workspace`), use `$HOME/.worktrees/<name>`,
43
- never `..` outside the workspace or inside the checkout. **Delivered work is cleaned up by
40
+ parent's `.globalconfig` (.NET `MultipleGlobalAnalyzerKeys` errors or changed analyzer
41
+ severities). In a container whose checkout is the workspace root with a read-only
42
+ parent, use `$HOME/.worktrees/<name>`. **Delivered work is cleaned up by
44
43
  `.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`, not by memory:** run it from the
45
44
  main checkout when a PR merges or you finish a task (hooks and **ship-changes** also run it). It
46
45
  removes a worktree and its branch only on evidence the work reached the default branch —
@@ -52,7 +51,8 @@ dumps, and similar coordination files. These are **work records, not documentati
52
51
  or `git branch -D` a delivered branch when the script can; `gh pr merge --delete-branch`
53
52
  inside a worktree leaves the worktree and branch behind. If the branch must outlive the task
54
53
  unmerged, leave the worktree and say so in the handoff. Never `--force` a removal; a
55
- refusal means look, not push harder.
54
+ refusal means look. Cleanup keeps local-only work (unpushed commits, stashes, dirty
55
+ worktrees) and records branch refs and SHAs before and after.
56
56
  - **Scan for secrets before archiving or sharing.** Before anything from `.ai-work/` is archived,
57
57
  attached or shared, run `gitleaks detect --no-git --source <dir>` (or the repository's equivalent)
58
58
  and redact every finding. See [`secrets.md`](./secrets.md).
@@ -42,6 +42,9 @@ not measured: code-shape inspection is not a benchmark, a build is not behaviora
42
42
  proof, and an unexamined surface is not verified. State `None` only when the entire
43
43
  declared scope was examined; otherwise give concrete limits and remaining checks.
44
44
 
45
+ - **[contract]** A security reviewer's NOT PASS is blocking, never advisory. Resolve it with a fix plus re-review, or an explicit, recorded decision by the person who owns the risk; never downgrade it to advisory.
46
+ - **[contract]** A review report, and any reviewer notes posted on a PR, lists only the commit ranges actually reviewed. Name unreviewed deltas as unreviewed; never imply they are covered.
47
+
45
48
  ## Verdict vocabulary
46
49
 
47
50
  | Verdict | Meaning |
@@ -118,6 +118,9 @@ on a design decision, consumer proof, or another repository out.
118
118
  After the cut, nothing joins. Late deliveries go into the next candidate.
119
119
  Corrections needed to make the frozen candidate pass are not new deliveries;
120
120
  rerun the affected required gates for that changed code state.
121
+ A security-fix train is sealed the same way, with no exception for urgency:
122
+ every correction gets its own review of the new head, including the security
123
+ lens, plus gate evidence for that head before the train merges.
121
124
 
122
125
  Record the cut in one line in the reviewer comment, not the release note:
123
126
  `Cut with A and B; C waits for consumer proof.` Keep local
@@ -63,6 +63,11 @@ reading a message: it defines the types, the file naming, the required fields
63
63
  and the token-exact matching rule that keeps one lane from reading another's
64
64
  mail. Act on a message only after checking it against git and `gh` state.
65
65
 
66
+ Re-arm the inbox watch on every wake, before anything else, so no message is
67
+ missed. A hold or stop order from the user, a coordinator or a release owner is
68
+ binding until its issuer explicitly lifts it; silence, elapsed time, a green
69
+ check or finishing the current step do not lift it.
70
+
66
71
  ## Lane brief
67
72
 
68
73
  Every lane starts from a written brief with a goal, worktree, owned files, the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.172.1",
3
+ "version": "7.172.3",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [