@mainwave/cli 0.8.0 → 0.10.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 +169 -42
- package/dist/adapters/claude-code.js +23 -4
- package/dist/adapters/codex-cli.js +1 -1
- package/dist/adapters/cursor.js +4 -2
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/kiro.js +361 -0
- package/dist/core/apply.js +161 -46
- package/dist/core/behaviour-hooks.js +7 -7
- package/dist/core/codecs/kiro-hooks-json.js +76 -0
- package/dist/core/doctor.js +27 -9
- package/dist/core/effective-settings.js +10 -0
- package/dist/core/entry-script.js +90 -0
- package/dist/core/git-bash.js +40 -0
- package/dist/core/install-hooks.js +126 -43
- package/dist/core/interview.js +114 -16
- package/dist/core/markers.js +678 -140
- package/dist/core/remove.js +67 -0
- package/dist/core/settings.js +32 -6
- package/dist/core/skills.js +47 -1
- package/dist/core/status.js +2 -1
- package/dist/core/wizard.js +64 -3
- package/dist/main.js +28 -9
- package/hooks/cursor-otlp.mjs +4 -27
- package/hooks/github-pr-marker.mjs +35 -22
- package/hooks/glab-mr-marker.mjs +795 -0
- package/hooks/jira-ticket-marker.mjs +27 -15
- package/hooks/kiro-otlp.mjs +570 -0
- package/hooks/linear-ticket-marker.mjs +27 -15
- package/hooks/mainwave-hook-node.mjs +42 -0
- package/hooks/mainwave-hook.mjs +301 -0
- package/hooks/marker-core.mjs +368 -41
- package/hooks/matchers.json +82 -6
- package/hooks/plan-snapshot.mjs +529 -0
- package/hooks/stop-failure.mjs +43 -0
- package/hooks/vocabulary.d.mts +49 -0
- package/hooks/vocabulary.mjs +188 -0
- package/package.json +5 -5
- package/skills/mainwave-instrument/SKILL.md +21 -7
- package/skills/mainwave-instrument/reference/api.md +29 -10
- package/skills/mainwave-instrument/reference/frameworks.md +3 -3
- package/skills/mainwave-instrument/reference/troubleshooting.md +12 -5
- package/skills/mainwave-setup/SKILL.md +47 -12
package/README.md
CHANGED
|
@@ -16,6 +16,8 @@ Installs as the `mainwave-cli` command. Requires Node 22.13 or newer.
|
|
|
16
16
|
| `copilot-chat` | GitHub Copilot Chat in VS Code |
|
|
17
17
|
| `cursor` | Cursor |
|
|
18
18
|
| `cursor-enterprise` | Cursor (Enterprise OTel export) |
|
|
19
|
+
| `kiro-ide` | Kiro IDE (1.0 or newer) |
|
|
20
|
+
| `kiro-cli` | Kiro CLI (2.13 or newer, V3) |
|
|
19
21
|
|
|
20
22
|
## Setup
|
|
21
23
|
|
|
@@ -58,6 +60,35 @@ re-run, and never shared with your other tools. If the id it already has is also
|
|
|
58
60
|
tools' config, or is your own stored use case — which is what earlier versions of the CLI wrote —
|
|
59
61
|
setup mints a separate team id and says so.
|
|
60
62
|
|
|
63
|
+
Kiro has no exporter of its own to point at Mainwave, so setup installs a Kiro hook instead: one
|
|
64
|
+
file, `~/.kiro/hooks/mainwave.json` (other files in that directory are left alone), that runs a small
|
|
65
|
+
script on session start, prompt submit, each tool call, agent file changes, the end of each turn and,
|
|
66
|
+
in Kiro CLI, session end. Each event becomes one span carrying the Kiro session id, the event, the
|
|
67
|
+
tool name and the kind of file change — never file paths, tool input or output. Prompt text is off
|
|
68
|
+
for Kiro unless you pass `--opt-in prompts`. The script prints nothing, always exits successfully and
|
|
69
|
+
hands the upload to a background process, so it never blocks, slows or steers a Kiro session. Your
|
|
70
|
+
email is the account `kiro-cli whoami` reports — it is how Kiro activity is matched to Kiro's own
|
|
71
|
+
usage export — unless you pass `--email`; without a Kiro sign-in it falls back to your Mainwave
|
|
72
|
+
sign-in, then your git email. Kiro CLI records sessions only in V3 mode (`kiro-cli --v3`); its 2.x
|
|
73
|
+
default mode doesn't read global hooks. Kiro hooks carry no tokens or cost, and `--ucid` doesn't
|
|
74
|
+
apply to them: Kiro activity is always attributed from your email. To take it off again:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
mainwave-cli setup kiro-ide --remove # or kiro-cli; both together to remove everything
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Kiro IDE and Kiro CLI run the same hooks file, and the hook can't always tell which one ran it. With
|
|
81
|
+
only one of them set up, sessions from the other are reported under the one you set up. With both
|
|
82
|
+
set up, Kiro CLI run in an editor's terminal (VS Code, Cursor, Kiro) is reported as the IDE, apart
|
|
83
|
+
from its session-end event. After you remove kiro-ide, that terminal session is taken for the IDE and
|
|
84
|
+
dropped, apart from its session-end event; after you remove kiro-cli, it is still reported as the
|
|
85
|
+
IDE, and Kiro CLI in a plain terminal is dropped.
|
|
86
|
+
|
|
87
|
+
Removing one of the two keeps the hooks for the other, and the hook stops sending the removed one's
|
|
88
|
+
sessions; removing the last one removes Mainwave's entries from `~/.kiro/hooks/mainwave.json` (the
|
|
89
|
+
file too, if nothing else is in it), Mainwave's instructions from `~/.kiro/steering/mainwave.md`
|
|
90
|
+
(likewise) and `~/.mainwave/kiro.env` with its backups (they hold your key; setup writes it again).
|
|
91
|
+
|
|
61
92
|
Validation names the organization the key belongs to, so a key from the wrong workspace is caught
|
|
62
93
|
before anything is written. To pin every tool to one specific use case instead — a shared or team
|
|
63
94
|
one — pass `--ucid <id|url>` or `--use-case <name>`. A pin you set that way stays: re-running setup
|
|
@@ -75,10 +106,12 @@ rather than leaving it stale.
|
|
|
75
106
|
|
|
76
107
|
## What gets captured
|
|
77
108
|
|
|
78
|
-
Setup enables content capture by default: **prompt text**, **shell commands and file paths**,
|
|
79
|
-
**tool result bodies**
|
|
80
|
-
|
|
81
|
-
|
|
109
|
+
Setup enables content capture by default: **prompt text**, **shell commands and file paths**,
|
|
110
|
+
**tool result bodies** and, for Claude Code, **repository names** (`OTEL_METRICS_INCLUDE_REPOSITORY`,
|
|
111
|
+
which stamps the session's repository on Claude Code's own events, metrics and trace spans) are
|
|
112
|
+
sent to your collector alongside the metadata (tool names, tokens, cost, who ran what). The wizard
|
|
113
|
+
says so before it finishes — it is not a question, because what an organization collects is a
|
|
114
|
+
policy decision rather than a per-developer one.
|
|
82
115
|
|
|
83
116
|
To send metadata only:
|
|
84
117
|
|
|
@@ -91,7 +124,8 @@ and per-person activity are all metadata. **Codex is different:** it reports too
|
|
|
91
124
|
approvals only when tool logging is on, so `--opt-in none` leaves Codex's tool views empty. Keep
|
|
92
125
|
`--opt-in tool-details` for Codex if you want those without sending prompt text or tool output.
|
|
93
126
|
|
|
94
|
-
Or pick exactly what you want: `--opt-in tool-details`, `--opt-in prompts,tool-details`,
|
|
127
|
+
Or pick exactly what you want: `--opt-in tool-details`, `--opt-in prompts,tool-details`,
|
|
128
|
+
`--opt-in tool-details,repository`, and so on.
|
|
95
129
|
Re-running with a different `--opt-in` removes the flags it no longer wants rather than leaving them
|
|
96
130
|
stale.
|
|
97
131
|
|
|
@@ -129,18 +163,18 @@ mainwave-cli setup claude-code codex \
|
|
|
129
163
|
--opt-in none --no-markers --yes --json
|
|
130
164
|
```
|
|
131
165
|
|
|
132
|
-
| Flag
|
|
133
|
-
|
|
|
134
|
-
| `--api-key <k>`
|
|
135
|
-
| `--collector-url <u>` / `--api-url <u>`
|
|
136
|
-
| `--ucid <id\|url>` / `--use-case <name>` / `--no-use-case`
|
|
137
|
-
| `--email <e>`
|
|
138
|
-
| `--opt-in prompts,tool-details,tool-content` (or `all` / `none`) | content capture (default: all on; `none` sends metadata only) |
|
|
139
|
-
| `--no-markers`
|
|
140
|
-
| `--new-key`
|
|
141
|
-
| `--yes`
|
|
142
|
-
| `--no-verify` / `--verify-timeout <s>`
|
|
143
|
-
| `--skills` / `--no-skills`
|
|
166
|
+
| Flag | Answers |
|
|
167
|
+
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
168
|
+
| `--api-key <k>` | the collector key (otherwise minted for you when signed in) |
|
|
169
|
+
| `--collector-url <u>` / `--api-url <u>` | which deployment |
|
|
170
|
+
| `--ucid <id\|url>` / `--use-case <name>` / `--no-use-case` | pin one use case, or `--no-use-case` to unpin (default: none) |
|
|
171
|
+
| `--email <e>` | attribution identity for tools that need it injected |
|
|
172
|
+
| `--opt-in prompts,tool-details,tool-content,repository` (or `all` / `none`) | content capture (default: all on; `none` sends metadata only; `repository` is Claude Code's repository names) |
|
|
173
|
+
| `--no-markers` | skip the Mainwave hooks (installed by default): the ticket & PR markers and the Claude plan snapshot |
|
|
174
|
+
| `--new-key` | mint a fresh machine key instead of reusing this machine's |
|
|
175
|
+
| `--yes` | write without the confirmation prompt |
|
|
176
|
+
| `--no-verify` / `--verify-timeout <s>` | the closing first-span check |
|
|
177
|
+
| `--skills` / `--no-skills` | the agent skills payload |
|
|
144
178
|
|
|
145
179
|
Without a terminal the CLI never prompts: it answers from flags and environment, or fails naming the
|
|
146
180
|
flag it needed. `status` and `doctor` also take `--json`.
|
|
@@ -159,12 +193,12 @@ Setup installs three skills alongside the telemetry config — one detection, on
|
|
|
159
193
|
|
|
160
194
|
The bundles are copied to `~/.mainwave/skills/`, then registered on each tool's own instruction
|
|
161
195
|
surface: a native skill directory for Claude Code, `AGENTS.md` for Codex, `copilot-instructions.md`
|
|
162
|
-
for Copilot, a rules file for Cursor. Claude Desktop has no such surface and is reported as a no-op
|
|
196
|
+
for Copilot, a rules file for Cursor, a steering file for Kiro. Claude Desktop has no such surface and is reported as a no-op
|
|
163
197
|
rather than counted as installed.
|
|
164
198
|
|
|
165
199
|
The payload is installed at user scope, like the telemetry config — the skills teach an agent how to
|
|
166
200
|
use Mainwave anywhere, so a copy per repo would be pure duplication. Re-running setup refreshes them,
|
|
167
|
-
the same way it refreshes the
|
|
201
|
+
the same way it refreshes the hook scripts.
|
|
168
202
|
|
|
169
203
|
```bash
|
|
170
204
|
mainwave-cli setup claude-code --skills-only # instructions, no telemetry config
|
|
@@ -182,38 +216,113 @@ mainwave-cli login --device
|
|
|
182
216
|
|
|
183
217
|
For Claude Code, setup also installs **ticket & PR markers**: small post-tool hooks that emit one
|
|
184
218
|
event when a Linear or Jira issue is filed and one when a pull request is opened with
|
|
185
|
-
`gh pr create
|
|
219
|
+
`gh pr create` or a GitLab merge request is opened with `glab mr create` (or a `glab api` POST to a
|
|
220
|
+
project's `merge_requests` endpoint). Claude Code starts the pull-request hooks only for a Bash
|
|
221
|
+
command that begins with `gh` or `glab` (a wrapper or a path, such as `env gh …` or
|
|
222
|
+
`/usr/local/bin/glab …`, isn't matched), and runs every Mainwave hook in the background, so none of
|
|
223
|
+
them adds time to a tool call. They are what populates "Tickets filed" and "PRs created" on the use case — without
|
|
186
224
|
them those counts read zero, which is why they are on by default rather than a question.
|
|
187
225
|
|
|
188
226
|
What leaves your machine: the issue key, whether it was a create or an update, and the PR's
|
|
189
|
-
url/number/title plus aggregate diff counts.
|
|
227
|
+
url/number/title plus aggregate diff counts. For a GitLab merge request that is the url, number,
|
|
228
|
+
title, project id and the changed-file count. Never ticket bodies, never diff content. The hooks fail
|
|
190
229
|
open — a telemetry problem can never block or slow a coding session — and count forward only from
|
|
191
230
|
when you enable them.
|
|
192
231
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
232
|
+
For Claude Code, the same install adds a **Claude plan snapshot**: a hook on Claude Code's
|
|
233
|
+
`UserPromptSubmit` event (each prompt you submit) that reads Claude Code's local account record (`.claude.json`) and sends one event every time
|
|
234
|
+
it runs. What leaves your machine: your Claude account id, organization id and email (the identity
|
|
235
|
+
Claude Code's own telemetry already carries); from your account profile, exactly as Claude Code
|
|
236
|
+
stores them, the plan's organization type, seat tier, rate-limit tier and billing type, your
|
|
237
|
+
organization and workspace roles, when the subscription started, the trial's end date and length,
|
|
238
|
+
the date of your first Claude Code use, and when Claude Code fetched that profile; from Claude
|
|
239
|
+
Code's usage cache, your 5-hour and 7-day usage and when they reset, each rate limit's percent used,
|
|
240
|
+
group, severity, whether it is the active one and when it resets (and, for a limit Claude Code
|
|
241
|
+
applies per model, which model it is, by the name Claude Code stores), whether extra usage is on, the
|
|
242
|
+
extra-usage amount spent and monthly limit, their currency, whether the spend limit is reached,
|
|
243
|
+
whether and why extra usage is disabled, and when Claude Code fetched those figures. Each event also
|
|
244
|
+
carries which event sent it, the prompt id, the
|
|
245
|
+
session id, the ids of the turn's trace and span, and the session's OpenTelemetry resource attributes, as the
|
|
246
|
+
other markers do. Never your prompt, and nothing else in that file. A figure Claude Code hasn't
|
|
247
|
+
recorded is left out, not sent as zero; Claude Code refreshes its usage figures only when you open
|
|
248
|
+
its usage view, so the same figures repeat until then, each with the time Claude Code fetched it. Figures
|
|
249
|
+
refreshed by a `/usage` just before you quit reach Mainwave at your next prompt, since Claude Code
|
|
250
|
+
keeps them on disk. Nothing is sent when a session ends.
|
|
251
|
+
It runs only in sessions signed in with a Claude account, keeps no state it reads back (a one-line
|
|
252
|
+
timestamp file, `~/.mainwave/logs/plan-snapshot.log.ok`, records the last successful send for `doctor`),
|
|
253
|
+
and never makes a
|
|
254
|
+
prompt wait: Claude Code runs it in the background without waiting for it, and it gives up on the
|
|
255
|
+
send after 4 seconds. Under `claude -p`, Claude Code stops a snapshot that is still sending when the
|
|
256
|
+
run ends, so that snapshot is lost. Setup says that it is on, and what it sends, on every run.
|
|
257
|
+
It has no switch of its own: it installs wherever setup installs the Mainwave hooks for Claude Code,
|
|
258
|
+
and `--no-markers`, which installs no Mainwave hooks at all, leaves it out too.
|
|
259
|
+
Where Claude Code runs only the hooks your organization's managed settings deliver
|
|
260
|
+
(`allowManagedHooksOnly`), or a settings file turns hooks off (`disableAllHooks`), and the managed
|
|
261
|
+
settings don't send the snapshot themselves, your own copy can't run; setup says so and names the
|
|
262
|
+
setting.
|
|
263
|
+
|
|
264
|
+
It comes with one smaller Claude account event. When a turn ends on an API error (a rate
|
|
265
|
+
limit, a billing error, an overloaded API, a sign-in that stopped working), one event carries the
|
|
266
|
+
error type only — never the error details or message. It also carries the session id, the prompt id,
|
|
267
|
+
the turn's trace ids and, when the session is signed in with a Claude account, your Claude account id
|
|
268
|
+
and email, so it lines up with the plan snapshot. Unlike the snapshot, it is sent from any Claude
|
|
269
|
+
Code session.
|
|
270
|
+
|
|
271
|
+
Mechanics: every Mainwave hook group in your settings runs one small shell entry,
|
|
272
|
+
`~/.mainwave/hooks/managed/mainwave-hook.sh`, with the event it is for (`claude-code PostToolUse gh`,
|
|
273
|
+
`claude-code UserPromptSubmit`, …). The entry prints nothing, never reads the hook input itself
|
|
274
|
+
(only Codex's one Bash hook does, to skip commands that can't open a PR or MR), and exits 0 whatever
|
|
275
|
+
happens; it runs the current release's scripts, kept in `~/.mainwave/hooks/managed/versions/`.
|
|
276
|
+
Setup also adds a session-start hook that runs
|
|
277
|
+
`{ cd "$HOME" && npx -y --registry=https://registry.npmjs.org @mainwave/cli@latest install-hooks --quiet; } >/dev/null 2>&1; exit 0`
|
|
278
|
+
in the background when a session starts, resumes or forks — its output discarded and exit 0
|
|
279
|
+
whatever happens, so an unreachable npm registry never shows up as a failed hook: it installs the latest release's scripts
|
|
280
|
+
and points the entry at them, and keeps the hooks setup installed in your user settings current —
|
|
281
|
+
on the events setup told you about only. A release that adds a new kind of hook waits for your next
|
|
282
|
+
setup run, which says what it sends. It is written only when at least one hook is on, so
|
|
283
|
+
`--no-markers` writes no hooks at all. Your `--no-markers` choice is also recorded as a file
|
|
284
|
+
under `~/.mainwave/hooks/off/`, which the entry reads, so a hook you turned off sends nothing even
|
|
285
|
+
from a copy setup didn't write (unless your organization's managed settings deliver it, which you
|
|
286
|
+
can't turn off). Re-running setup removes hooks written by an earlier CLI version, and the scripts
|
|
287
|
+
an earlier version copied into `~/.mainwave/hooks/` once nothing runs them. To disable the hooks,
|
|
288
|
+
the plan snapshot included, re-run setup with `--no-markers` — the entries are removed cleanly. `doctor` checks that the entry is installed, that it names an installed release with every
|
|
289
|
+
script, and that every Mainwave hook group is in the background and narrowed by its matcher.
|
|
290
|
+
|
|
291
|
+
On Windows, the Claude Code hooks need Git for Windows. Claude Code runs hook commands through Git
|
|
292
|
+
Bash, and through PowerShell when it finds none, where the entry's shell command can't run. Without
|
|
293
|
+
Git Bash, setup installs no Claude Code hooks and says why, and `doctor` reports it as an error;
|
|
294
|
+
hooks an earlier CLI version installed that run `node` directly are kept. Claude Code looks for Git
|
|
295
|
+
Bash at `CLAUDE_CODE_GIT_BASH_PATH`, then Git for Windows' default install paths, then beside the
|
|
296
|
+
`git` on your `PATH`, and setup looks in the same places: if yours is elsewhere, set
|
|
297
|
+
`CLAUDE_CODE_GIT_BASH_PATH` to its `bash.exe` and re-run setup.
|
|
198
298
|
|
|
199
299
|
Organizations that configure Claude Code centrally (managed settings from the Claude admin console,
|
|
200
|
-
or an MDM `managed-settings.json`) deliver the markers
|
|
201
|
-
starts or
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
300
|
+
or an MDM `managed-settings.json`) deliver the markers and the Claude plan snapshot without anyone
|
|
301
|
+
running setup: when a session starts, resumes or forks (not on `/clear` or a compaction), the
|
|
302
|
+
managed settings run the same `install-hooks` command — from your home directory, so a repository's
|
|
303
|
+
own `.npmrc` or `node_modules` can't choose what runs — which installs or refreshes the scripts in
|
|
304
|
+
`~/.mainwave/hooks/managed/` with no prompts, no sign-in and no network calls of its own. `@latest`
|
|
305
|
+
means each new release reaches your machine at its next session start, whatever copy of the CLI you
|
|
306
|
+
have installed: npx asks the registry for the current release each time, and while you're offline
|
|
307
|
+
the scripts already installed keep working. Each release's scripts sit in their own directory and
|
|
308
|
+
the entry is switched to a new one only once it is complete, so two installs racing never mix
|
|
309
|
+
releases. The org-wide payload writes exactly the hook commands setup writes, so on a machine with
|
|
310
|
+
both, Claude Code runs each hook once. Managed settings your admin pasted before the entry existed
|
|
311
|
+
run one script per hook, in the foreground, and have no plan snapshot; they keep working, and get
|
|
312
|
+
the current hooks only when your admin pastes the current version from Mainwave's Org-wide setup,
|
|
313
|
+
since `install-hooks` refreshes the scripts, not your organization's managed settings. An admin who
|
|
314
|
+
adds the current version without removing the earlier one gets every marker twice; `doctor` flags
|
|
315
|
+
both being present. When managed settings deliver the
|
|
316
|
+
hooks, `install-hooks` also removes your user settings' copy of each hook they deliver, so each ticket and PR is marked once and each prompt sends one plan snapshot, and `setup` itself leaves
|
|
317
|
+
out any hook your managed settings already run. Your own session-start hook stays: while the
|
|
318
|
+
managed settings run the same command Claude Code runs it once (a payload pasted before the
|
|
319
|
+
silent form runs beside it until your admin re-pastes — harmless), and if they stop delivering the
|
|
320
|
+
hooks it puts back the ones setup installed for you. It never edits project settings; `doctor` lists
|
|
212
321
|
every settings file that installs the hooks and warns when two of them would fire for the same
|
|
213
322
|
ticket or PR. The org-wide setup follows how Claude Code 2.1.282 and later apply managed settings;
|
|
214
323
|
`doctor` warns on an older install.
|
|
215
324
|
|
|
216
|
-
Two kinds of session don't get the admin console's markers:
|
|
325
|
+
Two kinds of session don't get the admin console's markers or plan snapshot:
|
|
217
326
|
|
|
218
327
|
- A session that skips server-managed settings: one started with a `CLAUDE_CODE_USE_*` provider
|
|
219
328
|
variable or a non-Anthropic `ANTHROPIC_BASE_URL` in your shell or user settings. Once the org's
|
|
@@ -231,9 +340,10 @@ Two kinds of session don't get the admin console's markers:
|
|
|
231
340
|
Under the org's settings, which carry no use case of their own, a marker is attributed through the
|
|
232
341
|
Claude account the session is signed in with. A session signed in another way (an API key, a
|
|
233
342
|
`CLAUDE_CODE_OAUTH_TOKEN`, a cloud provider through MDM delivery) sends markers no developer is
|
|
234
|
-
attached to.
|
|
343
|
+
attached to, and no plan snapshot.
|
|
235
344
|
|
|
236
|
-
Markers are available only for tools with a hooks mechanism (today: Claude Code
|
|
345
|
+
Markers are available only for tools with a hooks mechanism (today: Claude Code and Codex; the plan
|
|
346
|
+
snapshot is Claude Code only). For other tools
|
|
237
347
|
the wizard says so instead of appearing to succeed.
|
|
238
348
|
|
|
239
349
|
## Signing in
|
|
@@ -278,7 +388,7 @@ mainwave-cli doctor <adapter> # settings hierarchy + health checks
|
|
|
278
388
|
mainwave-cli doctor <adapter> --validate # also auth-check against the collector
|
|
279
389
|
mainwave-cli edit <adapter> # open the settings file in $EDITOR
|
|
280
390
|
mainwave-cli env <adapter> # print shell export lines
|
|
281
|
-
mainwave-cli install-hooks [--quiet] # install or refresh the
|
|
391
|
+
mainwave-cli install-hooks [--quiet] # install or refresh the Mainwave hook entry and the latest release's scripts
|
|
282
392
|
mainwave-cli --help
|
|
283
393
|
```
|
|
284
394
|
|
|
@@ -315,6 +425,23 @@ permissions in your home directory — never inside a repository. `status` shows
|
|
|
315
425
|
knows about, masked; `doctor <adapter>` walks the full hierarchy, including repo-local files an
|
|
316
426
|
older CLI or a colleague may have written.
|
|
317
427
|
|
|
428
|
+
## Removing Mainwave
|
|
429
|
+
|
|
430
|
+
Deleting `~/.mainwave` is safe. Every Mainwave hook checks that its script is there and exits
|
|
431
|
+
quietly when it isn't, so nothing reaches your coding sessions. Where your organization delivers
|
|
432
|
+
Mainwave through Claude Code's managed settings, the next session start reinstalls what the hooks
|
|
433
|
+
run and telemetry resumes on its own. A setup you ran yourself stays off until you run
|
|
434
|
+
`mainwave-cli setup` again — signed in, that creates a new key, since the record of the old one
|
|
435
|
+
lived there — and Cursor and VS Code Copilot Chat stop sending until then.
|
|
436
|
+
|
|
437
|
+
To stop entirely, also remove the Mainwave entries from your tools' settings — for Claude Code,
|
|
438
|
+
`mainwave-cli setup claude-code --no-markers` removes its hooks, or delete the hook groups that
|
|
439
|
+
name `mainwave-hook.sh`, `install-hooks` or `--managed-by @mainwave/cli` from
|
|
440
|
+
`~/.claude/settings.json`, along with the `OTEL_*` telemetry keys setup wrote. Hooks delivered
|
|
441
|
+
through your organization's managed settings stay until your Claude admin removes them. Hooks
|
|
442
|
+
now log under `~/.mainwave/logs/`; releases before that logged to `~/.mainwave-*.log` files in your
|
|
443
|
+
home directory, which are left for you to delete.
|
|
444
|
+
|
|
318
445
|
## License
|
|
319
446
|
|
|
320
447
|
Apache-2.0
|
|
@@ -19,6 +19,7 @@ const MANAGED_ENV_KEYS = [
|
|
|
19
19
|
'OTEL_LOG_USER_PROMPTS',
|
|
20
20
|
'OTEL_LOG_TOOL_DETAILS',
|
|
21
21
|
'OTEL_LOG_TOOL_CONTENT',
|
|
22
|
+
'OTEL_METRICS_INCLUDE_REPOSITORY',
|
|
22
23
|
];
|
|
23
24
|
const buildResourceAttrs = (ucid, userEmail) => {
|
|
24
25
|
const deploymentEnv = process.env.MAINWAVE_DEPLOYMENT_ENV ?? 'production';
|
|
@@ -79,6 +80,7 @@ const parseEnv = (env) => {
|
|
|
79
80
|
userPrompts: env.OTEL_LOG_USER_PROMPTS === '1',
|
|
80
81
|
toolDetails: env.OTEL_LOG_TOOL_DETAILS === '1',
|
|
81
82
|
toolContent: env.OTEL_LOG_TOOL_CONTENT === '1',
|
|
83
|
+
repository: env.OTEL_METRICS_INCLUDE_REPOSITORY === '1',
|
|
82
84
|
};
|
|
83
85
|
return out;
|
|
84
86
|
};
|
|
@@ -100,6 +102,8 @@ const buildEnv = ({ ucid, collectorUrl, apiKey, optIns, userEmail, }) => {
|
|
|
100
102
|
env.OTEL_LOG_TOOL_DETAILS = '1';
|
|
101
103
|
if (optIns.toolContent)
|
|
102
104
|
env.OTEL_LOG_TOOL_CONTENT = '1';
|
|
105
|
+
if (optIns.repository)
|
|
106
|
+
env.OTEL_METRICS_INCLUDE_REPOSITORY = '1';
|
|
103
107
|
return env;
|
|
104
108
|
};
|
|
105
109
|
const collectChecks = (env) => {
|
|
@@ -160,11 +164,11 @@ const managedSettingsDir = (() => {
|
|
|
160
164
|
return 'C:\\Program Files\\ClaudeCode';
|
|
161
165
|
return '/etc/claude-code';
|
|
162
166
|
})();
|
|
163
|
-
const
|
|
167
|
+
const hierarchyFor = (userDir) => [
|
|
164
168
|
{
|
|
165
169
|
id: 'managed-server',
|
|
166
170
|
label: 'Managed (server, cached)',
|
|
167
|
-
path: join(
|
|
171
|
+
path: join(userDir, 'remote-settings.json'),
|
|
168
172
|
kind: 'file',
|
|
169
173
|
managedSource: 'server',
|
|
170
174
|
},
|
|
@@ -197,10 +201,11 @@ const HIERARCHY = [
|
|
|
197
201
|
{
|
|
198
202
|
id: 'user',
|
|
199
203
|
label: 'User (global)',
|
|
200
|
-
path: join(
|
|
204
|
+
path: join(userDir, 'settings.json'),
|
|
201
205
|
kind: 'file',
|
|
202
206
|
},
|
|
203
207
|
];
|
|
208
|
+
const HIERARCHY = hierarchyFor(USER_DIR);
|
|
204
209
|
const EXPORTER_SELECTORS = ['OTEL_TRACES_EXPORTER', 'OTEL_METRICS_EXPORTER', 'OTEL_LOGS_EXPORTER'];
|
|
205
210
|
const OFF_SWITCH_CONTENT_KEYS = [
|
|
206
211
|
'OTEL_LOG_USER_PROMPTS',
|
|
@@ -446,6 +451,20 @@ export const claudeCode = {
|
|
|
446
451
|
label: 'skill directory',
|
|
447
452
|
},
|
|
448
453
|
markers: {
|
|
449
|
-
disclosure: 'Sends Linear/Jira issue ids and GitHub PR urls to the collector — never ticket bodies or diff content.',
|
|
454
|
+
disclosure: 'Sends Linear/Jira issue ids and GitHub PR / GitLab MR urls to the collector — never ticket bodies or diff content.',
|
|
455
|
+
planSnapshotDisclosure: 'On each prompt it sends, from your Claude account: its email, account id and organization id; ' +
|
|
456
|
+
"the plan's tier names and roles; the subscription start date, trial end date and length, first-use date and profile refresh time; " +
|
|
457
|
+
'your usage against its rate limits; whether extra usage is on, its amount, limit and currency, whether the limit is reached and why it is off; ' +
|
|
458
|
+
'when Claude Code fetched those figures; and the session id, prompt id and turn trace and span ids. ' +
|
|
459
|
+
"It never includes prompt text; prompt text reaches Mainwave only through Claude Code's own telemetry, when prompt capture is on (it is by default) or raw API body logging is enabled. " +
|
|
460
|
+
'When a turn ends on an API error, it sends only the error type ' +
|
|
461
|
+
'(never its message) with the same identity and ids.',
|
|
450
462
|
},
|
|
451
463
|
};
|
|
464
|
+
export const claudeCodeFor = (userDir) => ({
|
|
465
|
+
...claudeCode,
|
|
466
|
+
paths: { ...claudeCode.paths, global: join(userDir, 'settings.json') },
|
|
467
|
+
detect: () => hasPath(userDir) || hasBinary('claude'),
|
|
468
|
+
hierarchy: hierarchyFor(userDir),
|
|
469
|
+
instructionSurface: { ...claudeCode.instructionSurface, global: join(userDir, 'skills') },
|
|
470
|
+
});
|
|
@@ -189,7 +189,7 @@ export const codexCli = {
|
|
|
189
189
|
collectFileChecks,
|
|
190
190
|
normalizeForGenericChecks,
|
|
191
191
|
markers: {
|
|
192
|
-
disclosure: 'Sends Linear/Jira issue ids and GitHub PR urls to the collector — never ticket bodies or diff content.',
|
|
192
|
+
disclosure: 'Sends Linear/Jira issue ids and GitHub PR / GitLab MR urls to the collector — never ticket bodies or diff content.',
|
|
193
193
|
hooksFile: {
|
|
194
194
|
path: join(homedir(), '.codex', 'hooks.json'),
|
|
195
195
|
localPath: join('.codex', 'hooks.json'),
|
package/dist/adapters/cursor.js
CHANGED
|
@@ -5,7 +5,7 @@ import { cursorHooksJsonCodec } from '../core/codecs/cursor-hooks-json.js';
|
|
|
5
5
|
import { envFileCodec } from '../core/codecs/env-file.js';
|
|
6
6
|
import { hasBinary, hasPath } from '../core/detect.js';
|
|
7
7
|
import { buildHeaders, HEADER_NAME, headerBearerToken, kvPairsHeaders } from '../core/headers.js';
|
|
8
|
-
import {
|
|
8
|
+
import { buildScriptHookCommand, installedHooksDir } from '../core/markers.js';
|
|
9
9
|
import { isSamePath } from '../core/settings.js';
|
|
10
10
|
import { VERSION } from '../core/version.js';
|
|
11
11
|
const SOURCE_VALUE = 'coding_agent.cursor';
|
|
@@ -34,7 +34,7 @@ const ALWAYS_EVENTS = [
|
|
|
34
34
|
const PROMPT_EVENT = 'beforeSubmitPrompt';
|
|
35
35
|
const hookKey = (event) => `hooks.${event}`;
|
|
36
36
|
const HOOKS_MANAGED_KEYS = [...ALWAYS_EVENTS, PROMPT_EVENT].map(hookKey);
|
|
37
|
-
const hookCommand = () =>
|
|
37
|
+
const hookCommand = () => buildScriptHookCommand(join(installedHooksDir(), 'cursor-otlp.mjs'), VERSION);
|
|
38
38
|
const stripTrailingSlash = (url) => url.replace(/\/+$/, '');
|
|
39
39
|
const buildHeadersValue = (apiKey, ucid) => kvPairsHeaders.encode(buildHeaders({ apiKey, ucid, source: SOURCE_VALUE }));
|
|
40
40
|
const parseHeaders = (raw) => kvPairsHeaders.decode(raw) ?? {};
|
|
@@ -147,6 +147,8 @@ export const cursor = {
|
|
|
147
147
|
additionalWrites: [hooksWrite],
|
|
148
148
|
bundledHookScripts: ['marker-core.mjs', 'vocabulary.mjs', 'cursor-otlp.mjs'],
|
|
149
149
|
behaviourHooks: {
|
|
150
|
+
toolName: 'Cursor',
|
|
151
|
+
setupCommand: 'mainwave-cli setup cursor',
|
|
150
152
|
layers: HOOKS_LAYERS,
|
|
151
153
|
codec: cursorHooksJsonCodec,
|
|
152
154
|
script: 'cursor-otlp.mjs',
|
package/dist/adapters/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { copilotChat } from './copilot-chat.js';
|
|
|
5
5
|
import { copilotCli } from './copilot-cli.js';
|
|
6
6
|
import { cursor } from './cursor.js';
|
|
7
7
|
import { cursorEnterprise } from './cursor-enterprise.js';
|
|
8
|
+
import { kiroCli, kiroIde } from './kiro.js';
|
|
8
9
|
export const adapters = {
|
|
9
10
|
[claudeCode.name]: claudeCode,
|
|
10
11
|
[claudeDesktop.name]: claudeDesktop,
|
|
@@ -13,5 +14,7 @@ export const adapters = {
|
|
|
13
14
|
[copilotCli.name]: copilotCli,
|
|
14
15
|
[cursor.name]: cursor,
|
|
15
16
|
[cursorEnterprise.name]: cursorEnterprise,
|
|
17
|
+
[kiroIde.name]: kiroIde,
|
|
18
|
+
[kiroCli.name]: kiroCli,
|
|
16
19
|
};
|
|
17
20
|
export const adapterNames = () => Object.keys(adapters).sort();
|