@dashclaw/cli 0.1.2 → 0.3.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.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @dashclaw/cli
2
+
3
+ Terminal client for [DashClaw](https://dashclaw.io) — approve agent actions and diagnose your instance without leaving the shell.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @dashclaw/cli
9
+ ```
10
+
11
+ ## Configure
12
+
13
+ The CLI resolves config in this order:
14
+
15
+ 1. Environment variables (`DASHCLAW_BASE_URL`, `DASHCLAW_API_KEY`, optional `DASHCLAW_AGENT_ID`)
16
+ 2. Saved config at `~/.dashclaw/config.json` (mode `600`)
17
+ 3. Interactive prompt (first run)
18
+
19
+ On first run, if neither env vars nor a saved config are present, the CLI walks you through setup and offers to save the values to `~/.dashclaw/config.json`. Env vars always override saved values.
20
+
21
+ ```bash
22
+ # Option A: env vars (one-shot or CI)
23
+ export DASHCLAW_BASE_URL="https://your-dashclaw.example.com"
24
+ export DASHCLAW_API_KEY="oc_live_..."
25
+
26
+ # Option B: interactive first run (persists)
27
+ dashclaw doctor
28
+ # → DashClaw instance URL: ...
29
+ # → API key: ********
30
+ # → Save to ~/.dashclaw/config.json? [Y/n]
31
+
32
+ # Later: remove the saved config
33
+ dashclaw logout
34
+ ```
35
+
36
+ Optionally set `DASHCLAW_AGENT_ID` (defaults to `cli-operator`) for audit attribution.
37
+
38
+ ## Commands
39
+
40
+ ### `dashclaw approvals`
41
+
42
+ Interactive inbox for all pending approval requests. Use arrow keys to navigate, `A` to approve, `D` to deny, `O` to open the replay link, `Q` to quit.
43
+
44
+ ### `dashclaw approve <actionId>`
45
+
46
+ Approve a single action by ID.
47
+
48
+ ```bash
49
+ dashclaw approve act_01h... --reason "Verified change window"
50
+ ```
51
+
52
+ ### `dashclaw deny <actionId>`
53
+
54
+ Deny a single action by ID.
55
+
56
+ ```bash
57
+ dashclaw deny act_01h... --reason "Outside change window"
58
+ ```
59
+
60
+ ### `dashclaw doctor`
61
+
62
+ Diagnose your DashClaw instance and auto-fix safe issues. Checks database, configuration, auth, deployment, SDK reachability, and governance.
63
+
64
+ ```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
69
+ ```
70
+
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.
72
+
73
+ ### `dashclaw code`
74
+
75
+ Subcommand group for Code Sessions (Claude Code analytics, ported from AgentLens). Three actions:
76
+
77
+ ```bash
78
+ dashclaw code ingest # walk ~/.claude/projects and POST every .jsonl
79
+ dashclaw code ingest --dry-run # preview the file list and payload shape without POSTing
80
+ dashclaw code ingest --projects-dir <p> # override the default projects directory (also reads $CLAUDE_PROJECTS_DIR)
81
+
82
+ dashclaw code memo --project <slug> # show the most recent weekly memo for a project
83
+ dashclaw code memo --project <slug> --save # write the memo to ./memos/<iso-week>.md
84
+
85
+ dashclaw code apply <manifest-id> --dest=<project-cwd> # apply an Optimal Files manifest locally
86
+ dashclaw code apply <manifest-id> --dest=<project-cwd> --dry-run
87
+ ```
88
+
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.
90
+
91
+ `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
+
93
+ ### `dashclaw help`
94
+
95
+ Show all commands and flags.
96
+
97
+ ## Exit codes
98
+
99
+ - `0` — healthy
100
+ - `1` — warnings present, failures, or the instance was unreachable
101
+
102
+ ## License
103
+
104
+ MIT.