@dashclaw/cli 0.3.1 → 0.4.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/README.md CHANGED
@@ -57,18 +57,46 @@ Deny a single action by ID.
57
57
  dashclaw deny act_01h... --reason "Outside change window"
58
58
  ```
59
59
 
60
+ ### `dashclaw install claude`
61
+
62
+ Provision DashClaw governance into Claude Code without cloning the repo.
63
+
64
+ ```bash
65
+ dashclaw install claude # prompts for endpoint + API key
66
+ dashclaw install claude --endpoint <url> --key <oc_live_...>
67
+ dashclaw install claude --trial # browser signup on a hosted instance, paste the key
68
+ ```
69
+
70
+ Flow: preflight (`/api/health` + an authenticated read — nothing is written until it passes), hooks downloaded from your instance's `/downloads/dashclaw-claude-code-hooks.zip` (or copied from a repo checkout), `python3`/`python` resolved automatically, managed hook entries merged into `~/.claude/settings.json` (`.dashclaw-bak` backup, replace-on-reinstall), credentials written to `~/.dashclaw/claude-hooks/.env` (mode 600 — no secret lands in settings.json). Installs in **observe mode**; flip to enforce by setting `DASHCLAW_HOOK_MODE=enforce` in that `.env`. For `--trial`, set `DASHCLAW_HOSTED_URL` (or `--endpoint`) to the hosted instance if it isn't prompted.
71
+
72
+ ### `dashclaw cost`
73
+
74
+ Spend readback from `GET /api/finops/spend` — your own Claude Code cost or the fleet rollup, straight from the terminal.
75
+
76
+ ```bash
77
+ dashclaw cost # Claude Code spend, last 7 days (defaults)
78
+ dashclaw cost --lens claude-code --period 30d
79
+ dashclaw cost --lens fleet --period 90d # agent LLM cost + x402 purchases
80
+ ```
81
+
82
+ Outputs an aligned table (total, sessions, cache savings, by-project breakdown for the Claude-Code lens; Agent LLM / x402 / Total for the Fleet lens) plus a one-line summary. Unconfigured exits non-zero with a `dashclaw install claude` hint; bad `--lens`/`--period` values are rejected with usage text.
83
+
60
84
  ### `dashclaw doctor`
61
85
 
62
- Diagnose your DashClaw instance and auto-fix safe issues. Checks database, configuration, auth, deployment, SDK reachability, and governance.
86
+ Diagnose your DashClaw instance **and this machine**. Remote checks cover database, configuration, auth, deployment, SDK reachability, governance, and data hygiene; local checks cover what the server can't see — a stale compiled `mcp-server/lib`, `.gitattributes` drift, a local DB schema behind code, a disabled OpenClaw runtime plugin, a stale global CLI shim, broken Claude hook installs, and leaked machine-scope `DASHCLAW_*` env vars.
63
87
 
64
88
  ```bash
65
- dashclaw doctor # rich terminal output, auto-fix what it can
66
- dashclaw doctor --json # JSON output for CI/scripts
67
- dashclaw doctor --no-fix # diagnose only
68
- dashclaw doctor --category database,config
89
+ dashclaw doctor # report-only (DEFAULT applies nothing)
90
+ dashclaw doctor --fix # apply safe auto-fixes, re-check, report what changed
91
+ dashclaw doctor --json # JSON output for CI/scripts (includes local checks)
92
+ dashclaw doctor --category database,config # filter remote checks
93
+ dashclaw doctor --repo /path/to/dashclaw # point repo checks at a checkout
94
+ dashclaw doctor --no-fix # accepted no-op alias (report-only is the default)
69
95
  ```
70
96
 
71
- The CLI invokes your instance's `/api/doctor` endpoints, so fixes that need filesystem access (env writes) are handled separately by self-hosters running `npm run doctor` locally.
97
+ > **Changed in 0.4.0:** `dashclaw doctor` no longer applies remote auto-fixes by default it reports and prints would-fix entries. Pass `--fix` to apply. Exit codes are unchanged (0 healthy, 1 otherwise).
98
+
99
+ Detect-only classes are never auto-fixed: leaked machine env vars (removal instructions printed) and OpenClaw gateway configs (remediation text printed). The `.gitattributes` restore runs only when the diff is provably line-ending/whitespace-only. Remote fixes go through `POST /api/doctor/fix`; fixes that need server filesystem access remain self-hoster territory via `npm run doctor` (also report-only by default now, same `--fix` opt-in).
72
100
 
73
101
  ### `dashclaw code`
74
102
 
@@ -86,10 +114,61 @@ dashclaw code apply <manifest-id> --dest=<project-cwd> # apply an Optimal File
86
114
  dashclaw code apply <manifest-id> --dest=<project-cwd> --dry-run
87
115
  ```
88
116
 
89
- `ingest` stream-reads each session JSONL line-by-line and ships raw lines; large request bodies are gzip-compressed on the wire (raw gzip via the `x-dashclaw-encoding: gzip` header — no base64 inflation) to fit Vercel's 4.5 MB per-request limit. It retries 429s and 5xxs with exponential backoff and throttles 150 ms between POSTs. Files over 40 MB raw are skipped with a `too_large` log entry. Never logs raw transcript content.
117
+ `ingest` stream-reads each session JSONL line-by-line and ships raw lines; large request bodies are brotli-compressed on the wire (via the `x-dashclaw-encoding: br` header — no base64 inflation) to fit Vercel's 4.5 MB per-request limit. It retries 429s and 5xxs with exponential backoff and throttles 150 ms between POSTs. Files over 40 MB raw are skipped with a `too_large` log entry. Never logs raw transcript content.
118
+
119
+ There is also `dashclaw code ingest-codex [--dry-run]`, which backfills Codex CLI transcripts from `~/.codex/sessions` (`--sessions-dir <path>` to override; `--out <dir>` for the local output directory).
90
120
 
91
121
  `apply` fetches a manifest from `/api/code-sessions/manifests/<id>`, re-runs the secret scan, and writes the bundled files to `--dest`. Existing files get a three-way merge via the section-aware markdown merger; new files are written directly. Refuses any path outside `--dest` (path-traversal guard).
92
122
 
123
+ ### `dashclaw install codex`
124
+
125
+ Provision DashClaw governance into the Codex CLI: writes an AGENTS.md governance block into the target project and (optionally) wires Codex's notify config.
126
+
127
+ ```bash
128
+ dashclaw install codex --project <path> # default: current directory
129
+ dashclaw install codex --approval-policy on-request
130
+ dashclaw install codex --include-notify # also wire notify → dashclaw codex notify
131
+ ```
132
+
133
+ ### `dashclaw codex notify '<json>'`
134
+
135
+ Records a Codex turn-complete event as a DashClaw action record. Called by Codex's notify config (wired by `install codex --include-notify`); always exits 0 so Codex never sees an error from the spawn.
136
+
137
+ ### `dashclaw prompts`
138
+
139
+ Prompt-library client: `list [--category C]`, `get <id>`, `versions <id>`, `render <templateId> [--version-id <vid>] [--var key=value] [--record]`, `create --name N --description D --category C` (admin), `add-version <id> --content C` (admin), `activate <id> <vid>` (admin), `stats [--template-id X]`.
140
+
141
+ ### `dashclaw inbox`
142
+
143
+ Agent message inbox: `inbox list [--unread] [--limit N]`, `inbox read <id> [...]`, `inbox archive <id> [...]`.
144
+
145
+ ### `dashclaw behavior`
146
+
147
+ Behavior Learning readback: `behavior status` (local recorder sample counts) and `behavior suggestions [--agent-id <id>]` (evidence-backed policy suggestions).
148
+
149
+ ### `dashclaw posture` / `dashclaw next`
150
+
151
+ `posture` prints the governance posture score and the remediation queue; `posture resolve <key> [--snooze | --accept-risk] [--note "..."]` dispositions a finding. `next` prints the single top open governance gap and its fix.
152
+
153
+ ### `dashclaw env`
154
+
155
+ Run a command with managed secrets injected in-memory (values never touch disk or the terminal):
156
+
157
+ ```bash
158
+ dashclaw env [--agent <id>] -- node my-agent.js # inject managed secrets into the child env
159
+ dashclaw env # list secret NAMES + count (never values)
160
+ ```
161
+
162
+ Fail-closed: if the secrets fetch fails, the child is not spawned.
163
+
164
+ ### `dashclaw logout`
165
+
166
+ Remove the saved config at `~/.dashclaw/config.json`.
167
+
168
+ ### `dashclaw version`
169
+
170
+ Print the CLI version (`--version` / `-v` also work).
171
+
93
172
  ### `dashclaw help`
94
173
 
95
174
  Show all commands and flags.