@bli-cockpit/cli 0.2.27 → 0.2.29
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/dist/adapters/local-sources.js +1 -0
- package/dist/adapters/raw-evidence-completeness.js +226 -0
- package/dist/adapters/raw-evidence-git-diff.js +90 -0
- package/dist/adapters/raw-evidence-keys.js +92 -0
- package/dist/adapters/raw-evidence-manifest.js +132 -0
- package/dist/adapters/raw-evidence-pack-store.js +136 -0
- package/dist/adapters/raw-evidence-sanitize.js +190 -0
- package/dist/adapters/raw-evidence.js +740 -1044
- package/dist/commands/backfill.js +7 -0
- package/dist/commands/cli-io.js +92 -0
- package/dist/commands/collection-report.js +135 -0
- package/dist/commands/collection-roots.js +153 -0
- package/dist/commands/install-receipts.js +193 -0
- package/dist/commands/install-update.js +305 -0
- package/dist/commands/local-auth.js +268 -0
- package/dist/commands/local-discovery.js +100 -0
- package/dist/commands/local-help.js +281 -0
- package/dist/commands/local.js +183 -1842
- package/dist/commands/public-root.js +1 -1
- package/dist/commands/sessions.js +162 -0
- package/dist/commands/status.js +191 -0
- package/dist/evidence-upload-client.js +43 -2
- package/dist/local-state.js +12 -1
- package/dist/raw-evidence-gc.js +178 -0
- package/dist/raw-evidence-staging.js +322 -0
- package/dist/upload-agent-artifacts.js +153 -0
- package/dist/upload-envelope.js +407 -0
- package/dist/upload-evidence-delivery.js +505 -0
- package/dist/upload-http.js +46 -0
- package/dist/upload-session-reports.js +404 -0
- package/dist/upload.js +153 -1159
- package/package.json +2 -2
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `cockpit --help` and `cockpit <command> --help` print, plus the set of
|
|
3
|
+
* command names the top-level router recognises.
|
|
4
|
+
*
|
|
5
|
+
* Pure text and one lookup table — no filesystem, no network, no process. Split
|
|
6
|
+
* out of commands/local.ts (BLI-3104) with every string moved verbatim: help
|
|
7
|
+
* output is what an intern pastes back when something breaks, so it is a
|
|
8
|
+
* user-visible contract like any other.
|
|
9
|
+
*/
|
|
10
|
+
import { DEFAULT_DASHBOARD_URL } from "../local-state.js";
|
|
11
|
+
export const rootCommandNames = new Set([
|
|
12
|
+
"onboard",
|
|
13
|
+
"update",
|
|
14
|
+
"upgrade",
|
|
15
|
+
"do-everything",
|
|
16
|
+
"fix",
|
|
17
|
+
"install",
|
|
18
|
+
"login",
|
|
19
|
+
"pair",
|
|
20
|
+
"logout",
|
|
21
|
+
"start",
|
|
22
|
+
"sync",
|
|
23
|
+
"analyze",
|
|
24
|
+
"backfill",
|
|
25
|
+
"status",
|
|
26
|
+
"sessions",
|
|
27
|
+
"serve",
|
|
28
|
+
"autostart",
|
|
29
|
+
"agent-rules",
|
|
30
|
+
"release",
|
|
31
|
+
]);
|
|
32
|
+
export function localCommandHelp(command) {
|
|
33
|
+
if (command)
|
|
34
|
+
return localSubcommandHelp(command);
|
|
35
|
+
return [
|
|
36
|
+
" cockpit onboard [--ticket <id>] [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--branch <name>] [--no-auth] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
37
|
+
" cockpit update [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--no-auth] [--json]",
|
|
38
|
+
" cockpit upgrade [same flags as update]",
|
|
39
|
+
" cockpit do-everything [--workspace <path>] [--dashboard-url <url>] [--update-tag <tag>] [--dry-run] [--json]",
|
|
40
|
+
" cockpit fix [same flags as do-everything]",
|
|
41
|
+
" cockpit install [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--json]",
|
|
42
|
+
" cockpit login [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--no-auth] [--json]",
|
|
43
|
+
" cockpit pair [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--no-auth] [--json]",
|
|
44
|
+
" cockpit logout",
|
|
45
|
+
" cockpit start [--ticket <id>|--clear-ticket] [--topic <label>] [--intent <intent>] [--phase <phase>] [--workspace <path>] [--branch <name>] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
46
|
+
" cockpit sync [--workspace <path>] [--dashboard-url <url>] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
47
|
+
" cockpit analyze [--workspace <path>] [--dashboard-url <url>] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
48
|
+
" cockpit backfill (--since-days <n>|--all) [--source codex|claude] [--dry-run] [--max-files <n>] [--max-depth <n>] [--max-repos <n>] [--yes] [--workspace <path>] [--json]",
|
|
49
|
+
" cockpit status [--workspace <path>] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
50
|
+
" cockpit sessions [--source codex|claude] [--since-days <n>|--all] [--workspace <path>] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
51
|
+
" cockpit serve [--port <port>] [--workspace <path>]",
|
|
52
|
+
" cockpit autostart [install|uninstall|status] [--workspace <path>] [--dashboard-url <url>] [--interval-seconds <n>] [--json]",
|
|
53
|
+
" cockpit agent-rules [install|uninstall|status] [--host codex|claude|all] [--workspace <path>] [--json]",
|
|
54
|
+
" cockpit release [--dry-run] [--skip-checks] [--tag <tag>] [--access <public|restricted>] [--otp <code>]",
|
|
55
|
+
"",
|
|
56
|
+
`Default dashboard: ${DEFAULT_DASHBOARD_URL}. Omit --dashboard-url for normal production use; pass it only for staging/custom dashboards or to force a different pairing.`,
|
|
57
|
+
].join("\n");
|
|
58
|
+
}
|
|
59
|
+
function localSubcommandHelp(command) {
|
|
60
|
+
const helpByCommand = new Map([
|
|
61
|
+
[
|
|
62
|
+
"onboard",
|
|
63
|
+
[
|
|
64
|
+
"Usage: cockpit onboard [--ticket <id>] [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--branch <name>] [--no-auth] [--max-depth <n>] [--max-repos <n>] [--json]",
|
|
65
|
+
"",
|
|
66
|
+
"Installs, pairs, starts work context(s), syncs once, completes all-history",
|
|
67
|
+
"Codex and Claude backfill for the saved roots, and then prints readiness proof.",
|
|
68
|
+
"If --workspace is a parent folder, scans child git repos/worktrees and rolls them up by repo.",
|
|
69
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
70
|
+
`Omit --dashboard-url for normal production setup (${DEFAULT_DASHBOARD_URL}).`,
|
|
71
|
+
"Pass --dashboard-url only for staging/custom dashboards or to force a different pairing.",
|
|
72
|
+
"Run with no flags in a terminal and it prompts for the dashboard email and OTP code; pass --email to skip the email prompt. Use --no-auth to force the manual approval fallback.",
|
|
73
|
+
"Interactive runs also offer to add Cockpit ticket-binding rules to AGENTS.md and CLAUDE.md after readiness proof.",
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"install",
|
|
78
|
+
[
|
|
79
|
+
"Usage: cockpit install [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--json]",
|
|
80
|
+
"",
|
|
81
|
+
"Writes local collector config. Pair with `cockpit login`, then run `cockpit start` when work begins.",
|
|
82
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
83
|
+
"Omit --dashboard-url for the production dashboard; pass it only for staging/custom dashboards.",
|
|
84
|
+
],
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
"update",
|
|
88
|
+
[
|
|
89
|
+
"Usage: cockpit update [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--workspace <path>] [--allow-home-root] [--no-auth] [--json]",
|
|
90
|
+
"",
|
|
91
|
+
"Updates the global public CLI from npm, then reruns `cockpit onboard`",
|
|
92
|
+
"with the same setup flags so pairing, saved roots, all-history backfill,",
|
|
93
|
+
"agent rules, autostart, and the initial sync are refreshed in one command.",
|
|
94
|
+
"`cockpit upgrade` is an alias.",
|
|
95
|
+
],
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
"upgrade",
|
|
99
|
+
[
|
|
100
|
+
"Usage: cockpit upgrade [same flags as cockpit update]",
|
|
101
|
+
"",
|
|
102
|
+
"Alias for `cockpit update`.",
|
|
103
|
+
],
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
"do-everything",
|
|
107
|
+
[
|
|
108
|
+
"Usage: cockpit do-everything [--workspace <path>] [--dashboard-url <url>] [--update-tag <tag>] [--dry-run] [--json]",
|
|
109
|
+
"",
|
|
110
|
+
"Converges a blank, existing, or reused intern machine: latest CLI, interactive auth and collection-root recovery when needed, saved roots, autostart, all-history backfill, raw-evidence GC, and sync freshness.",
|
|
111
|
+
"`cockpit fix` is an alias.",
|
|
112
|
+
"Maintainer canary: use `--update-tag next` so self-update and re-exec stay on the prerelease candidate.",
|
|
113
|
+
"--dry-run prints the checks and would-fix steps without writing config, plists, cursors, or install telemetry.",
|
|
114
|
+
],
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"fix",
|
|
118
|
+
[
|
|
119
|
+
"Usage: cockpit fix [same flags as cockpit do-everything]",
|
|
120
|
+
"",
|
|
121
|
+
"Alias for `cockpit do-everything`.",
|
|
122
|
+
],
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
"login",
|
|
126
|
+
[
|
|
127
|
+
"Usage: cockpit login [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--no-auth] [--json]",
|
|
128
|
+
"",
|
|
129
|
+
"Signs in with an email OTP when interactive, starts dashboard device pairing, and stores the approved local session.",
|
|
130
|
+
"Omit --dashboard-url for the production dashboard; pass it only for staging/custom dashboards.",
|
|
131
|
+
],
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
"pair",
|
|
135
|
+
[
|
|
136
|
+
"Usage: cockpit pair [--email <owner@email>] [--device-name <name>] [--dashboard-url <url>] [--no-auth] [--json]",
|
|
137
|
+
"",
|
|
138
|
+
"Alias for `cockpit login`.",
|
|
139
|
+
],
|
|
140
|
+
],
|
|
141
|
+
["logout", ["Usage: cockpit logout [--json]", "", "Removes the local device session."]],
|
|
142
|
+
[
|
|
143
|
+
"start",
|
|
144
|
+
[
|
|
145
|
+
"Usage: cockpit start [--ticket <id>|--clear-ticket] [--topic <label>] [--topic-summary <summary>] [--intent <intent>] [--phase <phase>] [--intent-confidence <0..1>] [--workspace <path>] [--branch <name>] [--json]",
|
|
146
|
+
"",
|
|
147
|
+
"Starts local ambient capture. Parent folders start each child git worktree.",
|
|
148
|
+
"Add --ticket only when the work already has a visible ticket; omit it to preserve an existing binding.",
|
|
149
|
+
"Use --clear-ticket to intentionally return the context to general ambient capture.",
|
|
150
|
+
"Use --topic/--intent/--phase for planning, discovery, and learning work that has no ticket yet.",
|
|
151
|
+
"Supported intents: implementation, bug_fix, root_cause_analysis, planning, discovery, review, testing, documentation, release, learning, coordination, maintenance, analysis, unknown, other.",
|
|
152
|
+
"Supported phases: planning, discovery, implementation, debugging, review, testing, documentation, release, handoff, analysis, unknown, other.",
|
|
153
|
+
"`--repo <path>` remains supported as a backward-compatible alias; use --workspace in agent guidance.",
|
|
154
|
+
],
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"sync",
|
|
158
|
+
[
|
|
159
|
+
"Usage: cockpit sync [--workspace <path>] [--dashboard-url <url>] [--json]",
|
|
160
|
+
"",
|
|
161
|
+
"Uploads latest local ambient envelope(s), or spools safe retries if blocked.",
|
|
162
|
+
"Omit --dashboard-url for normal production sync; pass it only for staging/custom dashboards or forced re-pairing.",
|
|
163
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
164
|
+
"Parent folders sync each child git worktree; Codex AND Claude Code JSONL",
|
|
165
|
+
"transcripts (and Claude subagent sidecars) are attributed to repos",
|
|
166
|
+
"deterministically and ambiguous transcripts are retained as unattributed",
|
|
167
|
+
"instead of being duplicated across repos. Use `cockpit sessions` to see why",
|
|
168
|
+
"a session is or is not collected.",
|
|
169
|
+
"Newly discovered repos get a general ambient work context automatically.",
|
|
170
|
+
"Discovery scans 3 folder levels and up to 50 repos by default; tune with",
|
|
171
|
+
"--max-depth and --max-repos.",
|
|
172
|
+
"Also self-updates the CLI from npm latest once per day, strictly after",
|
|
173
|
+
"collection finishes; set COCKPIT_DISABLE_AUTO_UPDATE=1 to freeze the",
|
|
174
|
+
"installed version during incident triage.",
|
|
175
|
+
],
|
|
176
|
+
],
|
|
177
|
+
[
|
|
178
|
+
"analyze",
|
|
179
|
+
[
|
|
180
|
+
"Usage: cockpit analyze [--workspace <path>] [--dashboard-url <url>] [--json]",
|
|
181
|
+
"",
|
|
182
|
+
"Uploads the latest local ambient evidence, then queues one analysis job.",
|
|
183
|
+
"The command returns after the batch is queued; view status and results in My Work.",
|
|
184
|
+
"Omit --dashboard-url for production; pass it only for staging/custom dashboards.",
|
|
185
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
186
|
+
],
|
|
187
|
+
],
|
|
188
|
+
[
|
|
189
|
+
"backfill",
|
|
190
|
+
[
|
|
191
|
+
"Usage: cockpit backfill (--since-days <n>|--all) [--source codex|claude] [--dry-run] [--max-files <n>] [--max-depth <n>] [--max-repos <n>] [--yes] [--workspace <path>] [--json]",
|
|
192
|
+
"",
|
|
193
|
+
"Backfills historical Codex and Claude Code session evidence using the saved collection roots from local config when --workspace is omitted.",
|
|
194
|
+
"Omit --source to scan both sources; there is no --source all literal.",
|
|
195
|
+
"The non-all window is capped at the collector session paired_at timestamp.",
|
|
196
|
+
"--all requires a dry-run review and TTY confirmation; pass --yes for headless agent runs.",
|
|
197
|
+
"Repo discovery scans 3 folder levels and up to 50 repos by default.",
|
|
198
|
+
"Raise --max-depth or --max-repos when a partial result reports a discovery cap.",
|
|
199
|
+
"--dry-run validates the paired collector and dashboard reachability, prints the same summary tables, and writes nothing.",
|
|
200
|
+
],
|
|
201
|
+
],
|
|
202
|
+
[
|
|
203
|
+
"status",
|
|
204
|
+
[
|
|
205
|
+
"Usage: cockpit status [--workspace <path>] [--json]",
|
|
206
|
+
"",
|
|
207
|
+
"Prints install, pairing, active work, upload, and retry state.",
|
|
208
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
209
|
+
],
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
"sessions",
|
|
213
|
+
[
|
|
214
|
+
"Usage: cockpit sessions [--source codex|claude] [--since-days <n>|--all] [--workspace <path>] [--json]",
|
|
215
|
+
"",
|
|
216
|
+
"Read-only: re-runs Codex + Claude session attribution and prints each",
|
|
217
|
+
"session's id, source, state, reason, scores, signals, and per-sidecar",
|
|
218
|
+
"skip reasons. No upload, no cursor writes. Answers \"why is session X",
|
|
219
|
+
"missing?\" locally — counts and labels only, never paths or content.",
|
|
220
|
+
"--since-days uses the same paired_at cap as `cockpit backfill`; --all scans the full local history.",
|
|
221
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
222
|
+
],
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
"serve",
|
|
226
|
+
[
|
|
227
|
+
"Usage: cockpit serve [--port <port>] [--workspace <path>]",
|
|
228
|
+
"",
|
|
229
|
+
"Starts the local collector HTTP status server.",
|
|
230
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
231
|
+
],
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
"autostart",
|
|
235
|
+
[
|
|
236
|
+
"Usage: cockpit autostart [install|uninstall|status] [--workspace <path>] [--dashboard-url <url>] [--interval-seconds <n>] [--json]",
|
|
237
|
+
"",
|
|
238
|
+
"Installs background sync through launchd on Apple Silicon macOS or a",
|
|
239
|
+
"per-user Task Scheduler task on native Windows.",
|
|
240
|
+
"Runs `cockpit sync` every 15 min by default and survives reboots;",
|
|
241
|
+
"the Windows task runs while the user is signed in.",
|
|
242
|
+
"Action defaults to `install`. `--workspace` is the parent work folder to sync.",
|
|
243
|
+
"`--repo <path>` remains supported as a backward-compatible alias.",
|
|
244
|
+
"Omit --dashboard-url for production; pass it only for staging/custom dashboards.",
|
|
245
|
+
"See docs/runbooks/cockpit-launchd-sync.md and",
|
|
246
|
+
"docs/runbooks/cockpit-windows-task-scheduler-sync.md.",
|
|
247
|
+
],
|
|
248
|
+
],
|
|
249
|
+
[
|
|
250
|
+
"agent-rules",
|
|
251
|
+
[
|
|
252
|
+
"Usage: cockpit agent-rules [install|uninstall|status] [--host codex|claude|all] [--workspace <path>] [--json]",
|
|
253
|
+
"",
|
|
254
|
+
"Installs a managed Cockpit Ticket Binding block into ~/.codex/AGENTS.md",
|
|
255
|
+
"and ~/.claude/CLAUDE.md by default. Pass --host to manage only one.",
|
|
256
|
+
"The block is scoped to --workspace, or the current directory when omitted,",
|
|
257
|
+
"so Codex and Claude only run Cockpit ticket binding inside that onboarded folder.",
|
|
258
|
+
"Action defaults to `install`.",
|
|
259
|
+
],
|
|
260
|
+
],
|
|
261
|
+
[
|
|
262
|
+
"release",
|
|
263
|
+
[
|
|
264
|
+
"Usage: cockpit release [--dry-run] [--skip-checks] [--tag <tag>] [--access <public|restricted>] [--otp <code>]",
|
|
265
|
+
"",
|
|
266
|
+
"Maintainer-only helper. Run from inside the bli-cockpit repo checkout.",
|
|
267
|
+
"Requires a clean `main` branch and runs `git pull --ff-only` before publishing.",
|
|
268
|
+
"Delegates to `npm run publish:public -- ...` so public packages are",
|
|
269
|
+
"built, checked, and published in the safe telemetry-core then CLI order.",
|
|
270
|
+
],
|
|
271
|
+
],
|
|
272
|
+
]);
|
|
273
|
+
return (helpByCommand.get(command) ?? [localCommandHelp()]).join("\n");
|
|
274
|
+
}
|
|
275
|
+
/** `cockpit <command> --help` — the command name alone, with only the help flag. */
|
|
276
|
+
export function isLocalHelpRequest(argv) {
|
|
277
|
+
const command = argv[0];
|
|
278
|
+
if (!command || !rootCommandNames.has(command))
|
|
279
|
+
return false;
|
|
280
|
+
return argv.length === 2 && (argv[1] === "--help" || argv[1] === "-h");
|
|
281
|
+
}
|