@cratis/pi 7.81.0 → 7.82.0

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.
@@ -36,8 +36,8 @@ rather than overwriting — the rest of that file is yours — and re-copy after
36
36
  The markdown files in this folder (`agent-stop.md`, `pre-commit.md`) remain *lifecycle guidance* —
37
37
  they describe what a hook should do for tools that have no wiring yet.
38
38
 
39
- > Hooks are the one surface with no folder adapter: Claude Code reads `.claude/settings.json`;
40
- > the Pi harness bridges the same scripts to its own events through the `cratis-hooks`
39
+ > Hooks use native wiring rather than a shared folder adapter: Claude Code reads `.claude/settings.json`;
40
+ > Codex has a shell-only adapter described below. The Pi harness bridges the same scripts to its own events through the `cratis-hooks`
41
41
  > extension under `../harnesses/pi/extensions/` (its `bash` tool feeds the store-mutation and PR-body guards, its
42
42
  > `write` and `edit` tools the write guard); Copilot would read `.github/hooks/*.json`, and no
43
43
  > Copilot wiring ships yet.
@@ -61,6 +61,49 @@ conversion and Git's assume-unchanged or skip-worktree settings can hide raw dis
61
61
  use those settings, independently verify raw file contents or remove the hiding settings before
62
62
  relying on this check.
63
63
 
64
+ ## Codex shell-command adapter (partial)
65
+
66
+ [`../harnesses/codex/hooks.json`](../harnesses/codex/hooks.json) registers one native
67
+ `PreToolUse` command running `hooks.mjs` for `^Bash$`. Per the
68
+ [Codex hook contract](https://developers.openai.com/codex/hooks/), shell calls and unified
69
+ `exec_command` calls are normalized to `tool_name: "Bash"`, with shell text in
70
+ `tool_input.command`. The adapter requires that canonical payload, an absolute existing
71
+ `cwd`, a nonempty `session_id`, and `hook_event_name: "PreToolUse"`. It does not match
72
+ raw `exec_command` or invent tool aliases. `write_stdin` input to an already-running
73
+ session does not trigger another `PreToolUse` check.
74
+
75
+ The authoring setup (`yarn workspace @cratis/harness-setup run setup`) links
76
+ `.codex/hooks.json` to the corpus asset, repairs owned stale links, and refuses occupied
77
+ parents or user-owned hook files, even with `--force`. It leaves other Codex configuration
78
+ alone. **Consumer activation through `cratis ai install/update` is not delivered by this
79
+ adapter**: the CLI's Codex installation plan needs a separate change. Authoring setup
80
+ and isolated fixtures are not evidence of installed or end-to-end Codex runtime coverage.
81
+
82
+ The bridge runs the existing store-mutation guard and then the PR-body guard through
83
+ Bash, using the payload's working directory and inherited environment. It never executes
84
+ the pending command. A denial is final; the later guard cannot override it. Malformed
85
+ input, a missing managed guard, spawn failure, signal, unexpected nonzero exit, malformed
86
+ JSON output, excessive output, or an internal deadline produces explicit denial JSON and
87
+ exit **2**, not synthetic success. Child warnings are retained as model-visible context;
88
+ child allow/rewrite decisions are not forwarded. Input is limited to 1 MiB and two seconds;
89
+ each child has ten seconds plus bounded process-group termination/reaping, shorter than
90
+ the native thirty-second hook deadline. Cleanup targets only the detached child process
91
+ group on macOS/Linux; processes deliberately escaping that group are not contained.
92
+
93
+ This is a guardrail, **not absolute enforcement**. Node, Bash and Git are required to
94
+ launch the adapter; native callback failure, crash, timeout, or malformed-response behavior
95
+ can fail open before a supported denial is received. Other local hook configurations and
96
+ specialized tool paths are outside this adapter's control. The existing scripts retain
97
+ their own deliberate allowances and limits: missing `jq` skips the store guard; PR checks
98
+ can allow with an unchecked/offline warning; command-text parsing cannot see all indirect
99
+ execution. Inherited `CRATIS_HOOKS_ALLOW_STORE_MUTATIONS=1` and existing script configuration
100
+ are preserved. An adapter exit **0** is not proof that every underlying check ran.
101
+
102
+ **Not wired:** `apply_patch`/file-write protection (a patch is not a single-file write),
103
+ pattern scans, an explicit quality-gate tool, Stop gates, SessionStart, SessionEnd,
104
+ and automatic worktree cleanup. Use the repository's explicit verification and cleanup
105
+ workflows; this slice neither provides full hook parity nor completes Codex integration.
106
+
64
107
  ## Cleanup of delivered work
65
108
 
66
109
  `scripts/cratis-cleanup-worktrees.sh` is the one place that removes linked worktrees and local
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.81.0",
3
+ "version": "7.82.0",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [