@xerg/cli 0.2.0 → 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
@@ -1,28 +1,43 @@
1
1
  # xerg
2
2
 
3
- Audit OpenClaw workflows in dollars, compare fixes, and export daily spend and waste trends.
3
+ Audit OpenClaw and Hermes workflows in dollars, compare fixes, and optionally connect hosted follow-up after the first local result.
4
4
 
5
- Xerg audits OpenClaw workflows in dollars, not tokens. It reads your gateway logs and session transcripts, surfaces daily spend and waste rollups plus the highest-leverage findings, and lets you re-run the same audit with `--compare` so you can see exactly what changed after a fix.
5
+ Xerg runs locally by default. Local audits and `--compare` are free. No account is required for local value, and no data leaves your machine unless you explicitly push results to Xerg Cloud.
6
6
 
7
- Everything runs locally by default. No account is required for local audits. No data leaves your machine unless you explicitly `--push` results to the Xerg API for a team dashboard.
8
-
9
- ## 30-second quick start
7
+ ## Fastest first run
10
8
 
11
9
  ```bash
12
- npx @xerg/cli doctor
13
- npx @xerg/cli doctor --verbose
14
- npx @xerg/cli audit
15
- npx @xerg/cli audit --compare
10
+ npx @xerg/cli@latest init
16
11
  ```
17
12
 
13
+ `init` is the default first-run path. It:
14
+
15
+ - detects local OpenClaw or Hermes data
16
+ - runs a first audit and stores the local snapshot
17
+ - prints the standard terminal summary
18
+ - offers optional hosted follow-up with `connect` and `mcp-setup`
19
+
18
20
  Prefer a global install?
19
21
 
20
22
  ```bash
21
23
  npm install -g @xerg/cli
22
- xerg doctor
23
- xerg audit
24
+ xerg init
24
25
  ```
25
26
 
27
+ ## Direct commands for explicit control
28
+
29
+ If you already know what you want, skip `init` and use the direct flows:
30
+
31
+ ```bash
32
+ npx @xerg/cli doctor
33
+ npx @xerg/cli audit
34
+ npx @xerg/cli audit --compare
35
+ npx @xerg/cli audit --json
36
+ npx @xerg/cli audit --markdown
37
+ ```
38
+
39
+ Use these when you need non-interactive behavior, CI gates, JSON/Markdown output, or explicit runtime and path flags.
40
+
26
41
  ## Bundled skill
27
42
 
28
43
  The published `@xerg/cli` package includes the portable Xerg skill bundle inside the installed package at:
@@ -63,36 +78,29 @@ First savings test
63
78
  - Move heartbeat_monitor from Claude Opus to Sonnet
64
79
  ```
65
80
 
66
- ## Commands
67
-
68
- - Inspect local audit readiness:
69
-
70
- ```bash
71
- xerg doctor
72
- ```
73
-
74
- - Run the first audit:
75
-
76
- ```bash
77
- xerg audit
78
- ```
79
-
80
- - Compare the latest run against the newest compatible prior local snapshot:
81
+ ## Common commands
81
82
 
82
83
  ```bash
84
+ xerg init
83
85
  xerg audit --compare
86
+ xerg connect
87
+ xerg mcp-setup
84
88
  ```
85
89
 
86
- - Audit a specific window:
90
+ More explicit examples:
87
91
 
88
92
  ```bash
93
+ xerg doctor --runtime openclaw
94
+ xerg audit --runtime hermes
89
95
  xerg audit --since 24h --compare
96
+ xerg audit --push
97
+ xerg push
90
98
  ```
91
99
 
92
- ## Works where your OpenClaw logs live
100
+ ## Works where your agent data lives
93
101
 
94
102
  - Local machine: yes
95
- - VPS or remote server: yes
103
+ - VPS or remote server: OpenClaw only in this phase
96
104
  - If OpenClaw runs remotely, you can audit it from your local machine with `xerg audit --remote user@host`
97
105
  - Or point Xerg at exported files directly with flags
98
106
 
@@ -105,30 +113,50 @@ Remote prerequisites:
105
113
 
106
114
  By default, Xerg checks:
107
115
 
108
- - `/tmp/openclaw/openclaw-*.log`
109
- - `~/.openclaw/agents/*/sessions/*.jsonl`
116
+ - OpenClaw: `/tmp/openclaw/openclaw-*.log`
117
+ - OpenClaw: `~/.openclaw/agents/*/sessions/*.jsonl`
118
+ - Hermes: `~/.hermes/logs/agent.log*` with `gateway.log*` fallback
119
+ - Hermes: `~/.hermes/sessions/`
110
120
 
111
121
  Use explicit paths when needed:
112
122
 
113
123
  ```bash
114
- xerg audit --log-file /path/to/openclaw.log
115
- xerg audit --sessions-dir /path/to/sessions
124
+ xerg audit --runtime openclaw --log-file /path/to/openclaw.log
125
+ xerg audit --runtime openclaw --sessions-dir /path/to/sessions
126
+ xerg audit --runtime hermes --log-file ~/.hermes/logs/agent.log
127
+ xerg audit --runtime hermes --sessions-dir ~/.hermes/sessions
128
+ ```
129
+
130
+ If only one supported local runtime is present, Xerg auto-selects it. If both OpenClaw and Hermes are present locally, rerun with `--runtime openclaw` or `--runtime hermes`.
131
+
132
+ If local defaults are empty, `xerg init` prints next-step commands for explicit local paths plus remote OpenClaw-only flows:
133
+
134
+ ```bash
135
+ xerg audit --remote user@host
136
+ xerg audit --railway
116
137
  ```
117
138
 
118
- If your local machine has no OpenClaw files, inspect remote targets directly instead:
139
+ ## Hosted follow-up
140
+
141
+ Hosted sync and hosted MCP are optional paid workspace features. The simplest hosted path is:
119
142
 
120
143
  ```bash
121
- xerg doctor --remote user@host
122
- xerg doctor --railway
144
+ xerg connect
145
+ xerg mcp-setup
123
146
  ```
124
147
 
148
+ - `connect` resolves auth from `XERG_API_KEY`, `~/.xerg/config.json`, or stored browser credentials, then offers to push the latest audit
149
+ - `mcp-setup` prints or writes hosted MCP config for Cursor, Claude Code, or another client
150
+
151
+ You can skip both and keep using local audits and compare.
152
+
125
153
  ## Authentication and config
126
154
 
127
155
  Push commands resolve credentials in this order:
128
156
 
129
157
  1. `XERG_API_KEY`
130
158
  2. `~/.xerg/config.json`
131
- 3. `xerg login` browser credentials stored at `~/.config/xerg/credentials.json`
159
+ 3. stored browser credentials from `xerg login` at `~/.config/xerg/credentials.json`
132
160
 
133
161
  Optional API URL overrides:
134
162
 
@@ -144,7 +172,9 @@ Example `~/.xerg/config.json`:
144
172
  }
145
173
  ```
146
174
 
147
- `xerg login` stores a browser-issued token in `~/.config/xerg/credentials.json`. That token store is separate from `~/.xerg/config.json`.
175
+ `xerg connect` is the guided hosted path. `xerg login` remains available when you want browser auth without the push prompt.
176
+
177
+ `xerg login` stores a browser-issued token in `~/.config/xerg/credentials.json`. That token store is separate from `~/.xerg/config.json`. Hosted MCP works best with a workspace API key.
148
178
 
149
179
  ## What the audit shows
150
180
 
@@ -164,12 +194,13 @@ Xerg v0 stores economic metadata and audit summaries locally. It does not store
164
194
 
165
195
  - `0`: success
166
196
  - `1`: general failure
167
- - `2`: no OpenClaw data was found
197
+ - `2`: no supported local runtime data was found
168
198
  - `3`: a `--fail-above-waste-rate` or `--fail-above-waste-usd` threshold was exceeded
169
199
 
170
200
  ## Troubleshooting
171
201
 
172
202
  - `better-sqlite3` is a native dependency. If install fails, retry on a supported Node version and make sure standard native build tooling is available for your platform.
203
+ - `xerg init` is interactive in v1. Use direct `doctor` / `audit` commands when you need non-interactive control.
173
204
  - `--verbose` prints progress updates to stderr for `xerg doctor` and `xerg audit`, which helps distinguish package install time from CLI runtime.
174
205
  - If `xerg audit --remote ...` fails before pulling files, verify that both `ssh` and `rsync` are installed and reachable on your `PATH`.
175
206
  - If `xerg audit --railway` fails immediately, verify that the `railway` CLI is installed, authenticated, and can access the target project.