reasonix 0.4.22 → 0.4.23
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.
- package/README.md +54 -0
- package/dist/cli/index.js +444 -48
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +207 -1
- package/dist/index.js +319 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -271,6 +271,60 @@ prose, so skills authored for other tools usually port over unchanged
|
|
|
271
271
|
(Reasonix's tool names differ — `filesystem` / `shell` / `web` — but
|
|
272
272
|
the model reads the instructions and picks our equivalents).
|
|
273
273
|
|
|
274
|
+
### Hooks — automate around tool calls and turns
|
|
275
|
+
|
|
276
|
+
Drop a `settings.json` under `.reasonix/` (project or `~/`) and
|
|
277
|
+
Reasonix will fire shell commands at four well-known points in
|
|
278
|
+
the loop: before a tool runs, after a tool returns, before your
|
|
279
|
+
prompt reaches the model, and after the turn ends.
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
// <project>/.reasonix/settings.json ← committable
|
|
283
|
+
// ~/.reasonix/settings.json ← per-user
|
|
284
|
+
{
|
|
285
|
+
"hooks": {
|
|
286
|
+
"PreToolUse": [{ "match": "edit_file|write_file", "command": "bun scripts/guard.ts" }],
|
|
287
|
+
"PostToolUse": [{ "match": "edit_file", "command": "biome format --write" }],
|
|
288
|
+
"UserPromptSubmit": [{ "command": "echo $(date +%s) >> ~/.reasonix/prompts.log" }],
|
|
289
|
+
"Stop": [{ "command": "bun test --run", "timeout": 60000 }]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Each hook is a shell command. Reasonix invokes it with stdin = a
|
|
295
|
+
JSON envelope describing the event:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{ "event": "PreToolUse", "cwd": "/path/to/project",
|
|
299
|
+
"toolName": "edit_file", "toolArgs": { "path": "src/x.ts", "..." } }
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Exit code drives the decision:
|
|
303
|
+
|
|
304
|
+
- **0** — pass; loop continues normally
|
|
305
|
+
- **2** — block (only on `PreToolUse` / `UserPromptSubmit`); the
|
|
306
|
+
hook's stderr becomes the synthetic tool result the model sees,
|
|
307
|
+
or the prompt is dropped entirely
|
|
308
|
+
- **anything else** — warn; loop continues, stderr renders as a
|
|
309
|
+
yellow row inline
|
|
310
|
+
|
|
311
|
+
`match` is anchored regex on the tool name; `*` or omitted matches
|
|
312
|
+
every tool. Project hooks fire before global hooks. Default
|
|
313
|
+
timeouts: 5s for blocking events, 30s for logging events; per-hook
|
|
314
|
+
`timeout` overrides.
|
|
315
|
+
|
|
316
|
+
**Slash**: `/hooks` (list active hooks) · `/hooks reload` (re-read
|
|
317
|
+
`settings.json` from disk without losing your session).
|
|
318
|
+
|
|
319
|
+
### Staying current from inside the TUI
|
|
320
|
+
|
|
321
|
+
`/update` inside a running session shows your current version, the
|
|
322
|
+
last-resolved latest version (from the quiet 24h background check),
|
|
323
|
+
and the shell command to run. The slash does *not* spawn
|
|
324
|
+
`npm install` — stdio:inherit into a running Ink renderer corrupts
|
|
325
|
+
the display. Exit the session and run `reasonix update` in a
|
|
326
|
+
fresh shell when you actually want to install.
|
|
327
|
+
|
|
274
328
|
---
|
|
275
329
|
|
|
276
330
|
## `reasonix` — also works as general chat
|