@dreb/coding-agent 2.50.0 → 2.51.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.
package/docs/dashboard.md CHANGED
@@ -474,3 +474,145 @@ TUI theme system** — dashboard themes intentionally do not map to TUI themes.
474
474
  loop; the tree design and RPC are ready).
475
475
  - No shell passthrough from the browser.
476
476
  - No subagent steering (the drill-in view is read-only).
477
+
478
+ ## Background service / auto-restart
479
+
480
+ The dashboard runs as a foreground process by default. For it to start on boot
481
+ and restart after crashes, run it as a system service.
482
+
483
+ ### Linux (systemd)
484
+
485
+ Save a user unit to `~/.config/systemd/user/dreb-dashboard.service`:
486
+
487
+ ```ini
488
+ [Unit]
489
+ Description=dreb web dashboard
490
+
491
+ [Service]
492
+ ExecStart=%h/.npm-global/bin/dreb-dashboard
493
+ Restart=on-failure
494
+
495
+ [Install]
496
+ WantedBy=default.target
497
+ ```
498
+
499
+ Use the absolute path from `which dreb-dashboard` for `ExecStart` (the example
500
+ matches an npm global prefix under `~/.npm-global`). Then:
501
+
502
+ ```bash
503
+ systemctl --user daemon-reload
504
+ systemctl --user enable --now dreb-dashboard
505
+ ```
506
+
507
+ ### macOS (launchd)
508
+
509
+ Create a **LaunchAgent** (not a LaunchDaemon) — the dashboard must run as the
510
+ logged-in user to read `~/.dreb/agent/sessions` and `auth.json`, and to spawn
511
+ `dreb --mode rpc` children under that user. A root LaunchDaemon would have the
512
+ wrong `HOME` and credentials.
513
+
514
+ Save a plist to `~/Library/LaunchAgents/com.dreb.dashboard.plist`:
515
+
516
+ ```xml
517
+ <?xml version="1.0" encoding="UTF-8"?>
518
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
519
+ <plist version="1.0">
520
+ <dict>
521
+ <key>Label</key>
522
+ <string>com.dreb.dashboard</string>
523
+ <!--
524
+ Invoke node directly on the resolved entry point. The `dreb-dashboard`
525
+ bin is a #!/usr/bin/env node script; launchd's minimal environment
526
+ cannot resolve `node` via PATH, so we point ProgramArguments at the
527
+ absolute node binary and the resolved dist/index.js.
528
+ -->
529
+ <key>ProgramArguments</key>
530
+ <array>
531
+ <string>/ABSOLUTE/PATH/TO/node</string>
532
+ <string>/ABSOLUTE/PATH/TO/@dreb/dashboard/dist/index.js</string>
533
+ <string>--port</string>
534
+ <string>5343</string>
535
+ </array>
536
+ <key>RunAtLoad</key>
537
+ <true/>
538
+ <key>KeepAlive</key>
539
+ <true/>
540
+ <!-- KeepAlive + ThrottleInterval gives crash auto-restart without a tight
541
+ fail-loop. kill -9 the process and launchd respawns it in seconds. -->
542
+ <key>ThrottleInterval</key>
543
+ <integer>10</integer>
544
+ <!--
545
+ HOME is set automatically for user agents, so ~/.dreb/agent/auth.json
546
+ (OAuth creds) is found. PATH lets RPC children spawn bash/git/node.
547
+ If you use API keys via shell environment variables rather than OAuth
548
+ creds, add the keys here — LaunchAgents do not source shell profiles.
549
+ -->
550
+ <key>EnvironmentVariables</key>
551
+ <dict>
552
+ <key>PATH</key>
553
+ <string>/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
554
+ </dict>
555
+ <key>StandardOutPath</key>
556
+ <string>/Users/YOU/Library/Logs/dreb-dashboard.out.log</string>
557
+ <key>StandardErrorPath</key>
558
+ <string>/Users/YOU/Library/Logs/dreb-dashboard.err.log</string>
559
+ </dict>
560
+ </plist>
561
+ ```
562
+
563
+ #### Finding the absolute paths
564
+
565
+ The two `ProgramArguments` paths vary by install method (Homebrew, nvm, bun
566
+ global, npm global prefix). Discover them:
567
+
568
+ ```bash
569
+ command -v node # → /opt/homebrew/bin/node
570
+ realpath "$(command -v dreb-dashboard)" # → /opt/homebrew/lib/node_modules/@dreb/dashboard/dist/index.js
571
+ # If `realpath` is not found, install coreutils: brew install coreutils
572
+ ```
573
+
574
+ Replace `/ABSOLUTE/PATH/TO/node` and `/ABSOLUTE/PATH/TO/@dreb/dashboard/dist/index.js`
575
+ with the actual output. Also replace `/Users/YOU/` in the log paths with your
576
+ home directory.
577
+
578
+ #### load / unload / status
579
+
580
+ Use the modern `launchctl bootstrap`/`bootout` API (not the deprecated
581
+ `load`/`unload`):
582
+
583
+ ```bash
584
+ # load / start
585
+ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.dreb.dashboard.plist
586
+ # stop / unload
587
+ launchctl bootout gui/$(id -u)/com.dreb.dashboard
588
+ # check state
589
+ launchctl print gui/$(id -u)/com.dreb.dashboard | grep -E 'state|pid'
590
+ ```
591
+
592
+ #### API-key providers
593
+
594
+ OAuth subscription credentials live in `~/.dreb/agent/auth.json` and are
595
+ found via the auto-set `HOME` — no secrets in the plist. If you use API keys
596
+ via shell environment variables (e.g. `ANTHROPIC_API_KEY`), add them to the
597
+ `EnvironmentVariables` dictionary:
598
+
599
+ ```xml
600
+ <key>EnvironmentVariables</key>
601
+ <dict>
602
+ <key>PATH</key>
603
+ <string>…</string>
604
+ <key>ANTHROPIC_API_KEY</key>
605
+ <string>sk-ant-…</string>
606
+ </dict>
607
+ ```
608
+
609
+ LaunchAgents do not source `.zshrc`/`.bashrc`/`.profile`, so env vars must be
610
+ set explicitly in the plist.
611
+
612
+ #### Local vs remote
613
+
614
+ The plist above runs in local-only mode (binds `127.0.0.1:5343`). For remote
615
+ access from a phone, add `--remote --allow you@example.com` to
616
+ `ProgramArguments` and see the [remote access walkthrough](#local-vs-remote--exactly-two-modes)
617
+ and [TLS setup](#native-tls-remote-https) for the Tailscale + HTTPS path.
618
+ Do not expose the port on your LAN — there is no LAN mode.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreb/coding-agent",
3
- "version": "2.50.0",
3
+ "version": "2.51.0",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "drebConfig": {
@@ -18,7 +18,7 @@ This skill has two modes:
18
18
  2. **No `#N` in comment bodies** — Use "finding 3", "item 3" etc. instead.
19
19
  3. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
20
20
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
21
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
21
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
22
22
 
23
23
  ## Parent ownership and the formal-review checkpoint
24
24
 
@@ -16,7 +16,7 @@ argument-hint: "[issue-number | description]"
16
16
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets (.env, credentials, tokens, keys).
17
17
  5. **Task tracking** — Use the `tasks_update` tool to show progress through multi-step commands.
18
18
  6. **Project conventions** — Check for CLAUDE.md, AGENTS.md, .dreb/CONTEXT.md, and CONTRIBUTING.md before planning or implementing.
19
- 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
19
+ 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
20
20
 
21
21
  ## Determine Mode
22
22
 
@@ -76,7 +76,7 @@ Present to the user:
76
76
  Post as an issue comment:
77
77
 
78
78
  ```bash
79
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
79
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
80
80
  cat > "$GH_BODY" << 'MACH6_EOF'
81
81
  <!-- mach6-assessment -->
82
82
  ## Issue Assessment
@@ -128,7 +128,7 @@ Present the draft to the user for approval.
128
128
  ### Step 3: Create the issue
129
129
 
130
130
  ```bash
131
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
131
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
132
132
  cat > "$GH_BODY" << 'MACH6_EOF'
133
133
  <body>
134
134
  MACH6_EOF
@@ -18,7 +18,7 @@ This command is strictly for **planning**. Do NOT implement any code changes —
18
18
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
19
19
  5. **Task tracking** — Use the `tasks_update` tool to show progress through multi-step commands.
20
20
  6. **Project conventions** — Check for CLAUDE.md, AGENTS.md, .dreb/CONTEXT.md, and CONTRIBUTING.md before planning.
21
- 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
21
+ 7. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
22
22
 
23
23
  ## Step 1: Set up task tracking
24
24
 
@@ -98,7 +98,7 @@ git commit --allow-empty -m "chore: open PR for issue <N>"
98
98
  git push -u origin feature/issue-<N>-<slug>
99
99
 
100
100
  # Open draft PR
101
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
101
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
102
102
  cat > "$GH_BODY" << 'MACH6_EOF'
103
103
  Closes #<N>
104
104
 
@@ -114,7 +114,7 @@ Update task: branch → completed, post → in_progress.
114
114
  ## Step 7: Post plan to PR
115
115
 
116
116
  ```bash
117
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
117
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
118
118
  cat > "$GH_BODY" << 'MACH6_EOF'
119
119
  <!-- mach6-plan -->
120
120
  ## Implementation Plan
@@ -14,7 +14,7 @@ argument-hint: "<pr-number>"
14
14
  2. **No `#N` in comment bodies** — Use "finding 3", "item 3" etc. instead.
15
15
  3. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets.
16
16
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
17
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
17
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
18
 
19
19
  ## Step 1: Set up task tracking
20
20
 
@@ -180,7 +180,7 @@ git push --tags
180
180
 
181
181
  3. Present draft to user for approval, then create:
182
182
  ```bash
183
- GH_NOTES="$(mktemp /tmp/gh-release-notes.XXXXXX.md)"
183
+ GH_NOTES="$(mktemp /tmp/gh-release-notes.$$.XXXXXXXX)"
184
184
  cat > "$GH_NOTES" << 'MACH6_EOF'
185
185
  <release-notes>
186
186
  MACH6_EOF
@@ -15,7 +15,7 @@ argument-hint: "[commit message]"
15
15
  3. **No `#N` in comment bodies** — Use "finding 3", "item 3", "stage 2" etc. instead.
16
16
  4. **Safe git** — Never use `git add -A` or `git add .`. Stage files by name. Never stage secrets (.env, credentials, tokens, keys).
17
17
  5. **Task tracking** — Use the `tasks_update` tool to show progress.
18
- 6. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
+ 6. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
19
19
  7. **Stop after durable progress** — The commit, push, and GitHub progress comment are the accountability and recovery boundary. Do not invoke `mach6-review` or continue into a formal review cycle. Only the user may start formal review; offer it with `suggest_next` and stop.
20
20
 
21
21
  ## Step 1: Set up task tracking
@@ -82,7 +82,7 @@ If session context points to an issue but a PR also exists on the current branch
82
82
 
83
83
  Post a progress comment:
84
84
  ```bash
85
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
85
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
86
86
  cat > "$GH_BODY" << 'MACH6_EOF'
87
87
  <!-- mach6-progress -->
88
88
  ## Progress Update
@@ -14,7 +14,7 @@ argument-hint: "<pr-number> [code|errors|tests|completeness|simplify]"
14
14
  2. **HTML markers** — Use `<!-- mach6-review -->` and `<!-- mach6-assessment -->` as the first line of comment bodies.
15
15
  3. **No `#N` in comment bodies** — Use "finding 3", "item 3", "stage 2" etc. instead.
16
16
  4. **Task tracking** — Use the `tasks_update` tool to show progress.
17
- 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
17
+ 5. **Non-interactive `gh`** — Set `GH_PAGER=cat` and `GH_EDITOR=cat` before all `gh` commands to prevent interactive prompts from hanging the agent. Use `--body-file` instead of inline `--body` for all `gh pr comment`, `gh pr create`, and `gh issue create` calls to avoid shell interpretation of backticks. Write each body to a **unique per-invocation temp file** via `mktemp` (e.g. `GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"`) — never a fixed path like `/tmp/gh-comment.md`, which concurrent mach6 sessions on the same machine would clobber, cross-posting one session's body to another's PR/issue.
18
18
  6. **User-controlled checkpoint** — This formal multi-agent review runs only from an explicit user request, either through its slash command or a direct instruction to an agent to invoke it. An agent may invoke it in response to that request; otherwise agents must only offer it with `suggest_next`, never invoke it autonomously or start a review-fix-review loop.
19
19
  7. **Review durable work only** — Do not launch formal review agents against uncommitted or unpushed work. The commit, push, and GitHub progress comment are the accountability and recovery boundary.
20
20
 
@@ -126,7 +126,7 @@ Update task: review → completed, post-review → in_progress.
126
126
  Compile all findings from all agents into a single structured comment:
127
127
 
128
128
  ```bash
129
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
129
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
130
130
  cat > "$GH_BODY" << 'MACH6_EOF'
131
131
  <!-- mach6-review -->
132
132
  ## Code Review
@@ -195,7 +195,7 @@ Update task: assess → completed, post-assess → in_progress.
195
195
  ## Step 7: Post assessment
196
196
 
197
197
  ```bash
198
- GH_BODY="$(mktemp /tmp/gh-comment.XXXXXX.md)"
198
+ GH_BODY="$(mktemp /tmp/gh-comment.$$.XXXXXXXX)"
199
199
  cat > "$GH_BODY" << 'MACH6_EOF'
200
200
  <!-- mach6-assessment -->
201
201
  ## Review Assessment
@@ -229,7 +229,7 @@ Present to the user:
229
229
 
230
230
  If any findings were classified as **deferred**, ask the user if they want to create issues for them:
231
231
  ```bash
232
- GH_BODY="$(mktemp /tmp/gh-body.XXXXXX.md)"
232
+ GH_BODY="$(mktemp /tmp/gh-body.$$.XXXXXXXX)"
233
233
  cat > "$GH_BODY" << 'MACH6_EOF'
234
234
  <body referencing PR and finding>
235
235
  MACH6_EOF