@tritard/waterbrother 0.10.0 → 0.10.1

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.
Files changed (3) hide show
  1. package/README.md +62 -63
  2. package/package.json +1 -1
  3. package/src/cli.js +19 -9
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
- #waterbrother
1
+ # waterbrother
2
2
 
3
3
  A local coding CLI that connects to Grok (`api.x.ai`) with codex/claude-style interactive workflows, local tool calls, session persistence, and approval controls.
4
4
 
5
- ##Web docs interface
5
+ ## Web docs interface
6
6
 
7
7
  This repo includes a static docs web interface:
8
8
 
@@ -17,18 +17,18 @@ This repo includes a static docs web interface:
17
17
 
18
18
  It is Vercel-ready via `vercel.json` (clean URLs, no build step required).
19
19
 
20
- ##Implemented features
20
+ ## Implemented features
21
21
 
22
22
  - Interactive and one-shot chat modes
23
23
  - Codex-style non-interactive commands:
24
- - `waterbrother exec <prompt>`
25
- - `waterbrother review <prompt>`
26
- - `waterbrother resume [session-id] [prompt]`
27
- - `waterbrother resume --last`
24
+ - `waterbrother exec <prompt>`
25
+ - `waterbrother review <prompt>`
26
+ - `waterbrother resume [session-id] [prompt]`
27
+ - `waterbrother resume --last`
28
28
  - First-run onboarding wizard in terminal
29
- - asks for API key
30
- - offers opening `https://console.x.ai/`
31
- - prompts for default model and agent profile
29
+ - asks for API key
30
+ - offers opening `https://console.x.ai/`
31
+ - prompts for default model and agent profile
32
32
  - Grok API integration (`/chat/completions`)
33
33
  - Vision command for local images: `waterbrother vision <image-path> <prompt>`
34
34
  - Authenticated GitHub repo reading for GitHub URLs, including private repos when `gh` is logged in
@@ -41,33 +41,33 @@ It is Vercel-ready via `vercel.json` (clean URLs, no build step required).
41
41
  - Local model catalog (`waterbrother models catalog`)
42
42
  - Onboarding guide command (`waterbrother onboarding`)
43
43
  - Local self-update command (`waterbrother update`)
44
- - git-clone installs pull latest source, install deps, and run checks
45
- - npm installs upgrade with `npm install -g @tritard/waterbrother@latest`
44
+ - git-clone installs pull latest source, install deps, and run checks
45
+ - npm installs upgrade with `npm install -g @tritard/waterbrother@latest`
46
46
  - Environment diagnostics (`waterbrother doctor`)
47
47
  - Tool calling for file, shell, search, and git tasks
48
48
  - Diff preview in approval prompts: see exactly what will change before approving file writes and replacements
49
49
  - Fuzzy whitespace-tolerant matching in `replace_in_file` to reduce failed edits
50
50
  - Shell working directory tracking (`cd` commands update the shell cwd for subsequent calls)
51
51
  - Approval policy for mutating/shell tools: `auto`, `on-request`, `never`
52
- - supports path-aware allow/ask/deny rules via config
53
- - supports command-aware shell allow/ask/deny rules via config
54
- - includes `apply_patch`, `make_directory`, and `restore_checkpoint` in approval-protected actions
55
- - `restore_checkpoint` is treated as high-risk and always requires explicit approval
56
- - On-request prompt supports keyboard-first actions:
57
- - `↑/↓` changes the highlighted approval row
58
- - `Enter` or `y` approve once
59
- - `p` saves a session approval rule for the current shell-command prefix or tool
60
- - `Esc` denies and optionally provides alternate guidance
61
- - the chooser renders in a bordered block with the default action highlighted
62
- - the footer shows a short rules indicator when session approval rules are active
52
+ - supports path-aware allow/ask/deny rules via config
53
+ - supports command-aware shell allow/ask/deny rules via config
54
+ - includes `apply_patch`, `make_directory`, and `restore_checkpoint` in approval-protected actions
55
+ - `restore_checkpoint` is treated as high-risk and always requires explicit approval
56
+ - On-request prompt supports keyboard-first actions:
57
+ - `↑/↓` changes the highlighted approval row
58
+ - `Enter` or `y` approve once
59
+ - `p` saves a session approval rule for the current shell-command prefix or tool
60
+ - `Esc` denies and optionally provides alternate guidance
61
+ - the chooser renders in a bordered block with the default action highlighted
62
+ - the footer shows a short rules indicator when session approval rules are active
63
63
  - AI-powered commit command: `waterbrother commit [--push]`
64
64
  - Split config layers:
65
- - user config (`~/.waterbrother/config.json`)
66
- - project overrides (`.waterbrother/config.json`)
65
+ - user config (`~/.waterbrother/config.json`)
66
+ - project overrides (`.waterbrother/config.json`)
67
67
  - Session persistence (`~/.waterbrother/sessions/*.json`)
68
68
  - Two-tier project memory:
69
- - global instructions (`~/.waterbrother/WATERBROTHER.md`)
70
- - project instructions (`WATERBROTHER.md`) — both merged into system prompt
69
+ - global instructions (`~/.waterbrother/WATERBROTHER.md`)
70
+ - project instructions (`WATERBROTHER.md`) — both merged into system prompt
71
71
  - Accurate token tracking using API usage data when available (falls back to estimation)
72
72
  - Manual compaction command (`/compact`) for long-running sessions
73
73
  - Session forking with `/fork`
@@ -76,39 +76,39 @@ It is Vercel-ready via `vercel.json` (clean URLs, no build step required).
76
76
  - Git-backed local checkpoints with restore support (`/checkpoints`, `/rewind [id]`)
77
77
  - Deterministic patch application tool (`apply_patch`) with preflight validation
78
78
  - Turn contracts (new)
79
- - agent must declare intended scope before edits or risky shell calls
80
- - contract includes summary, allowed paths, expected commands, and verification commands
81
- - runtime blocks out-of-scope mutations automatically
79
+ - agent must declare intended scope before edits or risky shell calls
80
+ - contract includes summary, allowed paths, expected commands, and verification commands
81
+ - runtime blocks out-of-scope mutations automatically
82
82
  - Turn receipts (new)
83
- - every tool-heavy or mutating turn writes a local receipt under `.waterbrother/receipts/`
84
- - receipt captures contract, files touched, checkpoint, verification results, and command/tool provenance
85
- - inspect with `/receipts`, `/receipt last`, `/receipt <id>`
86
- - summary printing is configurable with `receiptMode` / `--receipts auto|off|verbose`
87
- - default `auto` suppresses noisy receipt lines for minimal read-only turns
83
+ - every tool-heavy or mutating turn writes a local receipt under `.waterbrother/receipts/`
84
+ - receipt captures contract, files touched, checkpoint, verification results, and command/tool provenance
85
+ - inspect with `/receipts`, `/receipt last`, `/receipt <id>`
86
+ - summary printing is configurable with `receiptMode` / `--receipts auto|off|verbose`
87
+ - default `auto` suppresses noisy receipt lines for minimal read-only turns
88
88
  - Automatic post-edit verification
89
- - verification commands from the turn contract run automatically after edits
90
- - optional default verification commands available through config
89
+ - verification commands from the turn contract run automatically after edits
90
+ - optional default verification commands available through config
91
91
  - Auto-compaction near context limits (`autoCompactThreshold`, default `0.9`)
92
92
  - Interactive slash controls with command palette
93
- - `/` opens command menu
94
- - `↑/↓` changes selection
95
- - `Enter` accepts selected command
93
+ - `/` opens command menu
94
+ - `↑/↓` changes selection
95
+ - `Enter` accepts selected command
96
96
  - Read-only file tools can inspect common home folders such as ~/Desktop, ~/Downloads, and ~/Documents without falling back to shell; /desktop, /downloads, and /documents are treated as aliases for those locations on macOS
97
97
  - Turn presentation improvements
98
- - streaming assistant output for faster perceived response
99
- - explicit run-state tracking (`planning`, `reading`, `editing`, `running`, `reviewing`, `done`, `error`) persisted in session metadata
100
- - heartbeat/stuck detection with interrupt hint during long-running steps
101
- - spinner/progress animation while model or tools are running
102
- - live visible trace lines during turns for phases like thinking and tool use, with verbose-only run-state heartbeat details
103
- - per-turn summary with duration, tool outcomes, and token usage when available
104
- - compact trace grouping so tool retries do not spam the status line
105
- - formatted code-fence rendering with line numbers
98
+ - streaming assistant output for faster perceived response
99
+ - explicit run-state tracking (`planning`, `reading`, `editing`, `running`, `reviewing`, `done`, `error`) persisted in session metadata
100
+ - heartbeat/stuck detection with interrupt hint during long-running steps
101
+ - spinner/progress animation while model or tools are running
102
+ - live visible trace lines during turns for phases like thinking and tool use, with verbose-only run-state heartbeat details
103
+ - per-turn summary with duration, tool outcomes, and token usage when available
104
+ - compact trace grouping so tool retries do not spam the status line
105
+ - formatted code-fence rendering with line numbers
106
106
  - Headless pipe mode for one-shot automation:
107
- - `-p` reads prompt from stdin or `--prompt`
108
- - `--output-format text|json|stream-json`
107
+ - `-p` reads prompt from stdin or `--prompt`
108
+ - `--output-format text|json|stream-json`
109
109
  - Production-readiness tracking page for the active P0/P1/P2 release matrix
110
110
 
111
- ##Quick start
111
+ ## Quick start
112
112
 
113
113
  User install:
114
114
 
@@ -157,10 +157,10 @@ waterbrother vision ./mockup.png "Suggest concrete CSS and layout improvements"
157
157
  Git workflow:
158
158
 
159
159
  ```bash
160
- waterbrother commit # stage, diff, generate commit message, confirm
161
- waterbrother commit --push # same as above, then push
162
- waterbrother pr # commit, push, generate PR title+body, create via gh
163
- waterbrother pr --branch=my-feat # create branch first if on main, then PR
160
+ waterbrother commit # stage, diff, generate commit message, confirm
161
+ waterbrother commit --push # same as above, then push
162
+ waterbrother pr # commit, push, generate PR title+body, create via gh
163
+ waterbrother pr --branch=my-feat # create branch first if on main, then PR
164
164
  ```
165
165
 
166
166
  Utility commands:
@@ -180,13 +180,13 @@ Web research examples:
180
180
  waterbrother "Read https://console.x.ai and summarize how to create an API key"
181
181
  waterbrother "Search the web for the latest xAI API docs about vision support and cite the sources"
182
182
 
183
- #interactive
183
+ # interactive
184
184
  /read https://console.x.ai/
185
185
  /search latest xAI vision docs
186
186
  /open 1
187
187
  ```
188
188
 
189
- ##Release flow
189
+ ## Release flow
190
190
 
191
191
  Partners should ship updates by pushing a version tag, not by running `npm publish` locally.
192
192
 
@@ -218,7 +218,7 @@ This lets partners such as Umair and Austin ship releases without using the publ
218
218
  Long-running session controls:
219
219
 
220
220
  ```bash
221
- #inside interactive mode
221
+ # inside interactive mode
222
222
  /compact
223
223
  /compact 32
224
224
  /cost
@@ -236,7 +236,7 @@ Long-running session controls:
236
236
  /memory add Always run tests before final answer.
237
237
  /memory reload
238
238
 
239
- #config tuning
239
+ # config tuning
240
240
  waterbrother config set autoCompactThreshold 0.9
241
241
  waterbrother config set traceMode verbose
242
242
  waterbrother config set receiptMode verbose
@@ -267,11 +267,11 @@ waterbrother config set-json mcpServers '{"filesystem":{"command":"npx","args":[
267
267
  waterbrother mcp list
268
268
  ```
269
269
 
270
- ##Task console
270
+ ## Task console
271
271
 
272
272
  Waterbrother treats serious work as **tasks**, not chat turns.
273
273
 
274
- ###Commands
274
+ ### Commands
275
275
 
276
276
  | Command | Description |
277
277
  |---------|-------------|
@@ -290,7 +290,7 @@ Waterbrother treats serious work as **tasks**, not chat turns.
290
290
  | `/close` | Close the active task |
291
291
  | `/panel` | Show/toggle operator panel |
292
292
 
293
- ###Typical flow
293
+ ### Typical flow
294
294
 
295
295
  ```
296
296
  /feature auth-rework
@@ -308,4 +308,3 @@ Supported in this release:
308
308
  - automatic tool discovery at startup
309
309
  - tool routing through normal approval + trace flow
310
310
  - interactive inspection with `/mcp`
311
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tritard/waterbrother",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Waterbrother: Grok-powered coding CLI with local tools, sessions, operator modes, and approval controls",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -6242,15 +6242,25 @@ async function promptLoop(agent, session, context) {
6242
6242
  continue;
6243
6243
  }
6244
6244
 
6245
- // Extract flags
6246
- const metricMatch = rawArgs.match(/--metric\s+"([^"]+)"|--metric\s+(\S+)/);
6245
+ // Extract flags — parse --metric value (everything until next -- flag or end)
6247
6246
  const attemptsMatch = rawArgs.match(/--attempts\s+(\d+)/);
6248
6247
  const timeMatch = rawArgs.match(/--time\s+(\d+)/);
6249
- const goalArg = rawArgs
6250
- .replace(/--metric\s+"[^"]+"|--metric\s+\S+/g, "")
6251
- .replace(/--attempts\s+\d+/g, "")
6252
- .replace(/--time\s+\d+/g, "")
6253
- .trim();
6248
+ // Remove --attempts and --time first so --metric can grab the rest
6249
+ let cleaned = rawArgs.replace(/--attempts\s+\d+/g, "").replace(/--time\s+\d+/g, "");
6250
+ let metricCmd = "";
6251
+ const metricIdx = cleaned.indexOf("--metric");
6252
+ if (metricIdx !== -1) {
6253
+ const afterMetric = cleaned.slice(metricIdx + 8).trim();
6254
+ // If quoted, take the quoted content; otherwise take everything until end
6255
+ if (afterMetric.startsWith('"')) {
6256
+ const endQuote = afterMetric.indexOf('"', 1);
6257
+ metricCmd = endQuote > 0 ? afterMetric.slice(1, endQuote) : afterMetric.slice(1);
6258
+ } else {
6259
+ metricCmd = afterMetric;
6260
+ }
6261
+ cleaned = cleaned.slice(0, metricIdx).trim();
6262
+ }
6263
+ const goalArg = cleaned.trim();
6254
6264
 
6255
6265
  if (!goalArg) {
6256
6266
  console.log("experiment needs a goal");
@@ -6259,8 +6269,8 @@ async function promptLoop(agent, session, context) {
6259
6269
 
6260
6270
  const charter = parseCharterFromGoal(goalArg);
6261
6271
 
6262
- if (metricMatch) {
6263
- charter.metric.command = (metricMatch[1] || metricMatch[2]).trim();
6272
+ if (metricCmd) {
6273
+ charter.metric.command = metricCmd.trim();
6264
6274
  }
6265
6275
  if (attemptsMatch) {
6266
6276
  charter.budget.maxAttempts = parseInt(attemptsMatch[1], 10);