litmus-cli 1.5.0-beta.1 → 1.5.0-beta.11
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 +26 -4
- package/dist/commands/connect.d.ts +23 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +267 -50
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +16 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +25 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/pause.d.ts.map +1 -1
- package/dist/commands/pause.js +12 -2
- package/dist/commands/pause.js.map +1 -1
- package/dist/cursor-session/extension.cjs +12 -3
- package/dist/cursor-session/package.json +3 -3
- package/dist/cursor-session/session.cjs +29 -6
- package/dist/index.js +10 -232
- package/dist/index.js.map +1 -1
- package/dist/lib/ai-tracking.d.ts +4 -0
- package/dist/lib/ai-tracking.d.ts.map +1 -1
- package/dist/lib/ai-tracking.js +68 -0
- package/dist/lib/ai-tracking.js.map +1 -1
- package/dist/lib/api.d.ts +2 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +33 -8
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/capture-notice-ping.d.ts +7 -27
- package/dist/lib/capture-notice-ping.d.ts.map +1 -1
- package/dist/lib/capture-notice-ping.js +10 -42
- package/dist/lib/capture-notice-ping.js.map +1 -1
- package/dist/lib/capture-nudge.d.ts +5 -7
- package/dist/lib/capture-nudge.d.ts.map +1 -1
- package/dist/lib/capture-nudge.js +19 -35
- package/dist/lib/capture-nudge.js.map +1 -1
- package/dist/lib/capture-selftest.d.ts +11 -0
- package/dist/lib/capture-selftest.d.ts.map +1 -1
- package/dist/lib/capture-selftest.js +44 -5
- package/dist/lib/capture-selftest.js.map +1 -1
- package/dist/lib/capture-startup-diagnostics.d.ts +15 -0
- package/dist/lib/capture-startup-diagnostics.d.ts.map +1 -0
- package/dist/lib/capture-startup-diagnostics.js +134 -0
- package/dist/lib/capture-startup-diagnostics.js.map +1 -0
- package/dist/lib/capture-storage-error.d.ts +10 -0
- package/dist/lib/capture-storage-error.d.ts.map +1 -0
- package/dist/lib/capture-storage-error.js +18 -0
- package/dist/lib/capture-storage-error.js.map +1 -0
- package/dist/lib/codex-capture-health.d.ts +21 -0
- package/dist/lib/codex-capture-health.d.ts.map +1 -0
- package/dist/lib/codex-capture-health.js +82 -0
- package/dist/lib/codex-capture-health.js.map +1 -0
- package/dist/lib/cursor-session.d.ts +4 -0
- package/dist/lib/cursor-session.d.ts.map +1 -1
- package/dist/lib/cursor-session.js +26 -10
- package/dist/lib/cursor-session.js.map +1 -1
- package/dist/lib/editor-foreground.d.ts +9 -1
- package/dist/lib/editor-foreground.d.ts.map +1 -1
- package/dist/lib/editor-foreground.js +15 -0
- package/dist/lib/editor-foreground.js.map +1 -1
- package/dist/lib/environment-checks.d.ts +1 -3
- package/dist/lib/environment-checks.d.ts.map +1 -1
- package/dist/lib/environment-checks.js +2 -16
- package/dist/lib/environment-checks.js.map +1 -1
- package/dist/lib/errors.d.ts +2 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +7 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/lib/file-monitor.d.ts +18 -0
- package/dist/lib/file-monitor.d.ts.map +1 -0
- package/dist/lib/file-monitor.js +87 -0
- package/dist/lib/file-monitor.js.map +1 -0
- package/dist/lib/hook-logger.cjs +76 -11
- package/dist/lib/hosted-capture.d.ts +4 -2
- package/dist/lib/hosted-capture.d.ts.map +1 -1
- package/dist/lib/hosted-capture.js +121 -26
- package/dist/lib/hosted-capture.js.map +1 -1
- package/dist/lib/hosted-watcher.js +9 -1
- package/dist/lib/hosted-watcher.js.map +1 -1
- package/dist/lib/init-location.d.ts +4 -0
- package/dist/lib/init-location.d.ts.map +1 -0
- package/dist/lib/init-location.js +36 -0
- package/dist/lib/init-location.js.map +1 -0
- package/dist/lib/installed-tools.d.ts +3 -0
- package/dist/lib/installed-tools.d.ts.map +1 -1
- package/dist/lib/installed-tools.js +31 -18
- package/dist/lib/installed-tools.js.map +1 -1
- package/dist/lib/launcher-cleanup-journal.d.ts +44 -0
- package/dist/lib/launcher-cleanup-journal.d.ts.map +1 -0
- package/dist/lib/launcher-cleanup-journal.js +196 -0
- package/dist/lib/launcher-cleanup-journal.js.map +1 -0
- package/dist/lib/launcher-inventory-cache.d.ts +44 -0
- package/dist/lib/launcher-inventory-cache.d.ts.map +1 -0
- package/dist/lib/launcher-inventory-cache.js +126 -0
- package/dist/lib/launcher-inventory-cache.js.map +1 -0
- package/dist/lib/launcher-preparation-cache.d.ts +46 -0
- package/dist/lib/launcher-preparation-cache.d.ts.map +1 -0
- package/dist/lib/launcher-preparation-cache.js +131 -0
- package/dist/lib/launcher-preparation-cache.js.map +1 -0
- package/dist/lib/mac-notifier.d.ts +4 -0
- package/dist/lib/mac-notifier.d.ts.map +1 -0
- package/dist/lib/mac-notifier.js +72 -0
- package/dist/lib/mac-notifier.js.map +1 -0
- package/dist/lib/node-version.d.ts +8 -0
- package/dist/lib/node-version.d.ts.map +1 -0
- package/dist/lib/node-version.js +23 -0
- package/dist/lib/node-version.js.map +1 -0
- package/dist/lib/notify.d.ts +4 -5
- package/dist/lib/notify.d.ts.map +1 -1
- package/dist/lib/notify.js +24 -25
- package/dist/lib/notify.js.map +1 -1
- package/dist/lib/portal-launcher-background.d.ts +2 -0
- package/dist/lib/portal-launcher-background.d.ts.map +1 -1
- package/dist/lib/portal-launcher-background.js.map +1 -1
- package/dist/lib/portal-launcher.d.ts +44 -5
- package/dist/lib/portal-launcher.d.ts.map +1 -1
- package/dist/lib/portal-launcher.js +425 -77
- package/dist/lib/portal-launcher.js.map +1 -1
- package/dist/lib/prepared-editor.d.ts.map +1 -1
- package/dist/lib/prepared-editor.js +20 -5
- package/dist/lib/prepared-editor.js.map +1 -1
- package/dist/lib/session-over.d.ts +2 -0
- package/dist/lib/session-over.d.ts.map +1 -1
- package/dist/lib/session-over.js +71 -12
- package/dist/lib/session-over.js.map +1 -1
- package/dist/lib/ssh-config-file.d.ts +13 -2
- package/dist/lib/ssh-config-file.d.ts.map +1 -1
- package/dist/lib/ssh-config-file.js +32 -27
- package/dist/lib/ssh-config-file.js.map +1 -1
- package/dist/lib/tool-installation-watcher.d.ts +20 -0
- package/dist/lib/tool-installation-watcher.d.ts.map +1 -0
- package/dist/lib/tool-installation-watcher.js +112 -0
- package/dist/lib/tool-installation-watcher.js.map +1 -0
- package/dist/lib/tracker.d.ts +1 -0
- package/dist/lib/tracker.d.ts.map +1 -1
- package/dist/lib/tracker.js +29 -4
- package/dist/lib/tracker.js.map +1 -1
- package/dist/lib/watcher.js +152 -101
- package/dist/lib/watcher.js.map +1 -1
- package/dist/lib/workspace-start-wait.d.ts +3 -1
- package/dist/lib/workspace-start-wait.d.ts.map +1 -1
- package/dist/lib/workspace-start-wait.js +36 -1
- package/dist/lib/workspace-start-wait.js.map +1 -1
- package/dist/notification-assets/litmus.icns +0 -0
- package/dist/notification-assets/litmus.png +0 -0
- package/dist/notification-assets/notifier.js +12 -0
- package/dist/program.d.ts +2 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +244 -0
- package/dist/program.js.map +1 -0
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const WORKSPACE = "/home/candidate/workspace";
|
|
3
3
|
const HANDOFF = "cursor.openOrFocusGlassWindow";
|
|
4
|
-
const
|
|
4
|
+
const CLOSE_WINDOW = "workbench.action.closeWindow";
|
|
5
5
|
const REMOVE = "vscode.removeFromRecentlyOpened";
|
|
6
6
|
|
|
7
7
|
function targetFolder(vscode) {
|
|
@@ -38,19 +38,42 @@ async function handoff(vscode, expectedUri) {
|
|
|
38
38
|
function hasUnsavedWork(vscode) {
|
|
39
39
|
return vscode.workspace.textDocuments.some(d => d.isDirty) ||
|
|
40
40
|
(vscode.workspace.notebookDocuments ?? []).some(d => d.isDirty) ||
|
|
41
|
-
(vscode.window?.tabGroups?.all ?? []).some(group => group.tabs.some(tab => tab.isDirty));
|
|
41
|
+
(vscode.window?.tabGroups?.all ?? []).some(group => group.tabs.some(tab => tab.isDirty && !isEmptyCursorAgent(tab)));
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
function isEmptyCursorAgent(tab) {
|
|
44
|
+
if (tab.label !== "New Agent") return false;
|
|
45
|
+
const input = tab.input;
|
|
46
|
+
// Cursor exposes its empty composer as a resource-less dirty tab. It is UI
|
|
47
|
+
// state, not candidate work. A text, notebook, diff, or custom editor has a
|
|
48
|
+
// resource on its input and must continue to block automatic disconnection.
|
|
49
|
+
return !input || (typeof input === "object" && !("uri" in input) && !("original" in input) && !("modified" in input));
|
|
50
|
+
}
|
|
51
|
+
async function detach(vscode, expectedUri, stillOwned = async () => true, wait = ms => new Promise(resolve => setTimeout(resolve, ms))) {
|
|
44
52
|
const matches = () => targetFolder(vscode)?.toString() === expectedUri.toString();
|
|
45
53
|
if (!matches()) return false;
|
|
46
54
|
const commands = await vscode.commands.getCommands(true);
|
|
47
|
-
//
|
|
48
|
-
|
|
55
|
+
// This extension is executing inside the exact remote window selected above.
|
|
56
|
+
// Closing the current workbench cannot target Cursor's global Agents Window:
|
|
57
|
+
// that surface has no matching Remote-SSH workspace root. Capability-check
|
|
58
|
+
// the public workbench command and fail closed on unsupported editor builds.
|
|
59
|
+
if (!commands.includes(CLOSE_WINDOW) || !commands.includes(REMOVE)) return false;
|
|
49
60
|
if (hasUnsavedWork(vscode)) return false;
|
|
50
61
|
if (!matches()) return false;
|
|
51
62
|
await vscode.commands.executeCommand(REMOVE, expectedUri);
|
|
52
63
|
if (!matches() || hasUnsavedWork(vscode)) return false;
|
|
53
|
-
await
|
|
64
|
+
if (!await stillOwned()) return false;
|
|
65
|
+
if (!matches() || hasUnsavedWork(vscode)) return false;
|
|
66
|
+
// VS Code closes on the first command. Cursor can first detach its remote
|
|
67
|
+
// workbench while leaving the exact native window alive, so give it one
|
|
68
|
+
// bounded retry while the same clean, ended registration still owns it.
|
|
69
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
70
|
+
await vscode.commands.executeCommand(CLOSE_WINDOW);
|
|
71
|
+
if (attempt === 1) break;
|
|
72
|
+
await wait(250);
|
|
73
|
+
if (!matches()) return true;
|
|
74
|
+
if (hasUnsavedWork(vscode) || !await stillOwned()) return false;
|
|
75
|
+
if (!matches() || hasUnsavedWork(vscode)) return false;
|
|
76
|
+
}
|
|
54
77
|
return true;
|
|
55
78
|
}
|
|
56
79
|
|
package/dist/index.js
CHANGED
|
@@ -1,236 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { runSubmit } from "./commands/submit.js";
|
|
11
|
-
import { runPause } from "./commands/pause.js";
|
|
12
|
-
import { runStatus } from "./commands/status.js";
|
|
13
|
-
import { runDoctor } from "./commands/doctor.js";
|
|
14
|
-
import { runSetupCheck } from "./commands/setup-check.js";
|
|
15
|
-
import { runEnv } from "./commands/env.js";
|
|
16
|
-
import { FatalError } from "./lib/errors.js";
|
|
17
|
-
import { CLI_VERSION } from "./lib/version.js";
|
|
18
|
-
import { checkNodeVersion } from "./lib/environment-checks.js";
|
|
19
|
-
import { MISSING_TOKEN_HELP, readTokenArgument } from "./lib/workspace-token.js";
|
|
20
|
-
/**
|
|
21
|
-
* The token for a command that takes one (ENG-3035): the argument, `-` for
|
|
22
|
-
* stdin, or LITMUS_ASSESSMENT_TOKEN. Exits with the help line when none is given.
|
|
23
|
-
*/
|
|
24
|
-
async function tokenOrExit(arg) {
|
|
25
|
-
const token = await readTokenArgument(arg);
|
|
26
|
-
if (!token) {
|
|
27
|
-
console.error(MISSING_TOKEN_HELP);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
return token;
|
|
2
|
+
import { checkNodeVersion } from "./lib/node-version.js";
|
|
3
|
+
// Keep the runtime check ahead of Commander and every command import. Commander 15
|
|
4
|
+
// requires Node 22.12+, and this package promises Node 24+, so an older candidate
|
|
5
|
+
// gets an actionable message instead of an ESM loader failure.
|
|
6
|
+
const node = checkNodeVersion();
|
|
7
|
+
if (node.status === "fail") {
|
|
8
|
+
console.error(node.detail);
|
|
9
|
+
process.exitCode = 1;
|
|
31
10
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const check = checkNodeVersion();
|
|
35
|
-
if (check.status === "fail")
|
|
36
|
-
throw new Error(check.detail);
|
|
11
|
+
else {
|
|
12
|
+
await import("./program.js");
|
|
37
13
|
}
|
|
38
|
-
program
|
|
39
|
-
.name("litmus")
|
|
40
|
-
.description("Litmus engineering assessment CLI")
|
|
41
|
-
.version(CLI_VERSION);
|
|
42
|
-
program
|
|
43
|
-
.command("init [token]")
|
|
44
|
-
.description("Download and set up a Litmus assessment")
|
|
45
|
-
.action(async (token) => {
|
|
46
|
-
try {
|
|
47
|
-
requireSupportedNode();
|
|
48
|
-
await runInit(await tokenOrExit(token));
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
if (err instanceof FatalError)
|
|
52
|
-
return;
|
|
53
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
cursorSessionFlags(program.command("connect [token]"))
|
|
58
|
-
.description("Open your assessment workspace in your editor of choice (codespace)")
|
|
59
|
-
.option("--ide <editor>", "Where to open: vscode (native VS Code), cursor (native Cursor), browser, or ssh")
|
|
60
|
-
.option("--verbose", "Print what your editor wrote while opening, for support")
|
|
61
|
-
.option("--skills", "Import your AI skills (~/.claude/skills, ~/.agents/skills, ...) into the workspace without asking")
|
|
62
|
-
.option("--no-skills", "Don't offer to import your AI skills")
|
|
63
|
-
.action(async (token, opts) => {
|
|
64
|
-
try {
|
|
65
|
-
requireSupportedNode();
|
|
66
|
-
await runConnect(token, opts.ide, { verbose: opts.verbose, skills: opts.skills, cursorAgentWindow: opts.cursorAgentWindow, cursorSessionCleanup: opts.cursorSessionCleanup });
|
|
67
|
-
}
|
|
68
|
-
catch (err) {
|
|
69
|
-
if (err instanceof FatalError)
|
|
70
|
-
return;
|
|
71
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
program
|
|
76
|
-
.command("ssh <alias>")
|
|
77
|
-
.description("Open a configured workspace SSH shell with automatic localhost forwarding")
|
|
78
|
-
.action(async (alias) => {
|
|
79
|
-
try {
|
|
80
|
-
await runSsh(alias);
|
|
81
|
-
}
|
|
82
|
-
catch (err) {
|
|
83
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
84
|
-
process.exitCode = 1;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
program
|
|
88
|
-
.command("diagnose-connection [token]")
|
|
89
|
-
.description("Collect connection diagnostics without changing your editor or workspace")
|
|
90
|
-
.option("--ide <editor>", "Editor to inspect: cursor or vscode", "cursor")
|
|
91
|
-
.option("--log <file>", "Classify the last 64 KiB of a Remote-SSH log locally; raw contents are not uploaded")
|
|
92
|
-
.action(async (token, opts) => {
|
|
93
|
-
try {
|
|
94
|
-
await runDiagnoseConnection(await tokenOrExit(token), opts);
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
98
|
-
process.exitCode = 1;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
program
|
|
102
|
-
.command("forward [token] [ports...]")
|
|
103
|
-
.description("Automatically forward workspace apps to localhost; optionally choose ports (5173, or 5174:5173)")
|
|
104
|
-
.option("--verbose", "Print more detail, for support")
|
|
105
|
-
.action(async (token, ports, opts) => {
|
|
106
|
-
try {
|
|
107
|
-
await runForward(await tokenOrExit(token), ports, { verbose: opts.verbose });
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
if (err instanceof FatalError)
|
|
111
|
-
return;
|
|
112
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
113
|
-
process.exit(1);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
program
|
|
117
|
-
.command("push")
|
|
118
|
-
.description("Submit your VM workspace (codespace) for grading")
|
|
119
|
-
// OPTIONAL, unlike `init`/`connect` (ENG-2064). Inside the workspace the token
|
|
120
|
-
// comes from the environment the host injected at container start, so a candidate
|
|
121
|
-
// in their own terminal types `litmus push` and nothing else. On a laptop it is
|
|
122
|
-
// still required in practice: with no argument and no injected token the command
|
|
123
|
-
// says so and points at the assessment page.
|
|
124
|
-
.argument("[token]", "Assessment token — only needed outside the workspace (it is pre-set inside one)")
|
|
125
|
-
.option("-y, --yes", "Skip confirmation prompt")
|
|
126
|
-
.action(async (token, opts) => {
|
|
127
|
-
try {
|
|
128
|
-
await runPush(token, opts);
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
if (err instanceof FatalError)
|
|
132
|
-
return;
|
|
133
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
program
|
|
138
|
-
.command("pause [token]")
|
|
139
|
-
.description("Pause your workspace (codespace) and come back later - your work is kept")
|
|
140
|
-
.action(async (token) => {
|
|
141
|
-
try {
|
|
142
|
-
await runPause(await tokenOrExit(token));
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
if (err instanceof FatalError)
|
|
146
|
-
return;
|
|
147
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
program
|
|
152
|
-
.command("submit")
|
|
153
|
-
.description("Submit your assessment code (walkthrough recording happens in the browser)")
|
|
154
|
-
.option("-y, --yes", "Skip confirmation prompt")
|
|
155
|
-
.action(async (opts) => {
|
|
156
|
-
try {
|
|
157
|
-
await runSubmit(opts);
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
if (err instanceof FatalError)
|
|
161
|
-
return;
|
|
162
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
163
|
-
process.exit(1);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
program
|
|
167
|
-
.command("doctor")
|
|
168
|
-
.description("Check your assessment setup and repair activity tracking")
|
|
169
|
-
// Positional like `litmus init <token>`, but optional: with a healthy
|
|
170
|
-
// config the token comes from the settings file and nobody types it.
|
|
171
|
-
// Doctor only needs it to restore a missing/corrupted settings file, and
|
|
172
|
-
// prompts for it interactively when it does.
|
|
173
|
-
.argument("[token]", "Assessment token, only needed to restore a missing settings file (doctor asks for it otherwise)")
|
|
174
|
-
.option("--verbose", "Show diagnostic details for support")
|
|
175
|
-
.option("--backfill-prompts", "Recover missed AI prompts from the whole assessment window (recovery also runs automatically when doctor repairs broken tracking)")
|
|
176
|
-
.option("--since <timestamp>", "Only recover prompts after this time (ISO format, e.g. 2026-08-07T19:00:00Z)")
|
|
177
|
-
.option("--all-sessions", "Recover from every AI session on this machine (Claude, Gemini, Copilot, Cursor), not just this folder's")
|
|
178
|
-
.option("--no-backfill", "Skip automatic prompt recovery")
|
|
179
|
-
.option("--here", "Restore a missing settings file in this folder, without looking for your assessment folder below it")
|
|
180
|
-
.action(async (token, opts) => {
|
|
181
|
-
try {
|
|
182
|
-
await runDoctor({ ...opts, token });
|
|
183
|
-
}
|
|
184
|
-
catch (err) {
|
|
185
|
-
if (err instanceof FatalError)
|
|
186
|
-
return;
|
|
187
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
188
|
-
process.exit(1);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
program
|
|
192
|
-
.command("setup-check")
|
|
193
|
-
.description("Check this machine can run the Litmus CLI, before you start an assessment")
|
|
194
|
-
.option("--verbose", "Show diagnostic details for support")
|
|
195
|
-
.action(async (opts) => {
|
|
196
|
-
try {
|
|
197
|
-
await runSetupCheck(opts);
|
|
198
|
-
}
|
|
199
|
-
catch (err) {
|
|
200
|
-
if (err instanceof FatalError)
|
|
201
|
-
return;
|
|
202
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
203
|
-
process.exit(1);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
program
|
|
207
|
-
.command("status")
|
|
208
|
-
.description("Show assessment status and stats")
|
|
209
|
-
.action(async () => {
|
|
210
|
-
try {
|
|
211
|
-
await runStatus();
|
|
212
|
-
}
|
|
213
|
-
catch (err) {
|
|
214
|
-
if (err instanceof FatalError)
|
|
215
|
-
return;
|
|
216
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
217
|
-
process.exit(1);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
program
|
|
221
|
-
.command("env")
|
|
222
|
-
.description("Set the assessment's environment variables in this shell: eval \"$(litmus env)\"")
|
|
223
|
-
.option("--powershell", "Print PowerShell assignments, for: litmus env --powershell | Invoke-Expression")
|
|
224
|
-
.action(async (opts) => {
|
|
225
|
-
try {
|
|
226
|
-
await runEnv(opts);
|
|
227
|
-
}
|
|
228
|
-
catch (err) {
|
|
229
|
-
if (err instanceof FatalError)
|
|
230
|
-
return;
|
|
231
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
232
|
-
process.exit(1);
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
program.parse();
|
|
236
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAC/D,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAA;AAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC1B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC;KAAM,CAAC;IACN,MAAM,MAAM,CAAC,cAAc,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -275,6 +275,10 @@ export declare function pruneOrphanedCaptureRegistrations(): void;
|
|
|
275
275
|
* before deciding to reinstall via `setupAiTracking`.
|
|
276
276
|
*/
|
|
277
277
|
export declare function detectInstalledHooks(assessmentDir: string): InstalledHooks;
|
|
278
|
+
/** A missing conversation is not evidence of a permission problem. Read the
|
|
279
|
+
* actual setup files before asking the candidate to do anything. Unknown
|
|
280
|
+
* configuration formats are left to the explicit doctor command. */
|
|
281
|
+
export declare function notificationSetupAction(assessmentDir: string, tool: "codex" | "copilot" | "claude_code"): "approve_codex" | "trust_copilot" | "repair" | null;
|
|
278
282
|
export type HookCapturableTool = "claude" | "codex" | "cursor" | "gemini" | "copilot";
|
|
279
283
|
export declare const HOOK_CAPTURABLE_TOOLS: readonly HookCapturableTool[];
|
|
280
284
|
export interface InstalledHookCommands {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tracking.d.ts","sourceRoot":"","sources":["../../src/lib/ai-tracking.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,iBAAiB,QAA2C,CAAA;AAczE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG/C;AAiBD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWlD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA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,CAEvH;AAmCD,0FAA0F;AAC1F,wBAAgB,iCAAiC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAK7E;AAsFD;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,iBAAiB,CAEtH;AAqCD,iFAAiF;AACjF,wBAAgB,gCAAgC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAK5E;AA2DD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,iBAAiB,CAErH;AAgCD,sFAAsF;AACtF,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAK3E;AAyCD,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAwCxE"}
|
package/dist/lib/ai-tracking.js
CHANGED
|
@@ -1429,6 +1429,74 @@ export function detectInstalledHooks(assessmentDir) {
|
|
|
1429
1429
|
loggerPresent: existsSync(USER_SCOPE_LOGGER),
|
|
1430
1430
|
};
|
|
1431
1431
|
}
|
|
1432
|
+
/** A missing conversation is not evidence of a permission problem. Read the
|
|
1433
|
+
* actual setup files before asking the candidate to do anything. Unknown
|
|
1434
|
+
* configuration formats are left to the explicit doctor command. */
|
|
1435
|
+
export function notificationSetupAction(assessmentDir, tool) {
|
|
1436
|
+
const hooks = detectInstalledHooks(assessmentDir);
|
|
1437
|
+
const installed = tool === "codex" ? hooks.codex : tool === "copilot" ? hooks.copilot : hooks.claude !== null;
|
|
1438
|
+
if (!installed)
|
|
1439
|
+
return "repair";
|
|
1440
|
+
// Project-scoped Claude is a supported fallback and intentionally does not
|
|
1441
|
+
// use the HOME logger or active-assessment registry.
|
|
1442
|
+
const projectClaude = tool === "claude_code" && hooks.claude === "project";
|
|
1443
|
+
if (projectClaude) {
|
|
1444
|
+
return existsSync(path.join(assessmentDir, ".litmus", "hook-logger.cjs")) ? null : "repair";
|
|
1445
|
+
}
|
|
1446
|
+
if (tool === "copilot") {
|
|
1447
|
+
// Copilot receives the assessment path explicitly, so neither logger
|
|
1448
|
+
// location needs an active-assessment registry entry.
|
|
1449
|
+
const commands = readOurHookCommands(copilotHooksFile(assessmentDir), COPILOT_PROMPT_EVENT).commands;
|
|
1450
|
+
const projectLogger = path.join(assessmentDir, ".litmus", "hook-logger.cjs");
|
|
1451
|
+
const loggers = [projectLogger, USER_SCOPE_LOGGER].filter(candidate => commands.includes(buildCopilotHookEntry(candidate, assessmentDir).command));
|
|
1452
|
+
if (!loggers.length)
|
|
1453
|
+
return null; // a command shape we cannot diagnose safely
|
|
1454
|
+
if (!loggers.some(logger => existsSync(logger)))
|
|
1455
|
+
return "repair";
|
|
1456
|
+
}
|
|
1457
|
+
else if (!hooks.loggerPresent || !hooks.registered)
|
|
1458
|
+
return "repair";
|
|
1459
|
+
if (tool === "codex") {
|
|
1460
|
+
const config = readJsonObjectOrNull(CODEX_HOOKS);
|
|
1461
|
+
const groups = config?.hooks?.UserPromptSubmit;
|
|
1462
|
+
if (!Array.isArray(groups))
|
|
1463
|
+
return null;
|
|
1464
|
+
let toml;
|
|
1465
|
+
try {
|
|
1466
|
+
toml = readFileSync(CODEX_CONFIG, "utf8");
|
|
1467
|
+
}
|
|
1468
|
+
catch {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
for (let index = 0; index < groups.length; index++) {
|
|
1472
|
+
if (!isOurEntry(groups[index]))
|
|
1473
|
+
continue;
|
|
1474
|
+
const commandHook = groups[index]?.hooks?.[0];
|
|
1475
|
+
if (typeof commandHook?.command !== "string" || typeof commandHook?.timeout !== "number")
|
|
1476
|
+
return null;
|
|
1477
|
+
const key = codexHookStateKey("UserPromptSubmit", index);
|
|
1478
|
+
if (codexKeyAppearsElsewhere(toml, key))
|
|
1479
|
+
return null;
|
|
1480
|
+
const table = codexStateTableForKey(key).exec(toml)?.[0] ?? "";
|
|
1481
|
+
const hash = codexHookTrustHash("UserPromptSubmit", commandHook.command, commandHook.timeout);
|
|
1482
|
+
const trusted = /^[ \t]*trusted_hash[ \t]*=[ \t]*["'](sha256:[a-f0-9]+)["']/m.exec(table)?.[1];
|
|
1483
|
+
return trusted === hash ? null : "approve_codex";
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
if (tool === "copilot") {
|
|
1487
|
+
try {
|
|
1488
|
+
const config = JSON.parse(splitCopilotConfig(readFileSync(COPILOT_CONFIG, "utf8")).body);
|
|
1489
|
+
if (!Array.isArray(config.trustedFolders))
|
|
1490
|
+
return null;
|
|
1491
|
+
return config.trustedFolders.some((folder) => typeof folder === "string" && samePath(folder, assessmentDir))
|
|
1492
|
+
? null : "trust_copilot";
|
|
1493
|
+
}
|
|
1494
|
+
catch {
|
|
1495
|
+
return null;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
return null;
|
|
1499
|
+
}
|
|
1432
1500
|
export const HOOK_CAPTURABLE_TOOLS = ["claude", "codex", "cursor", "gemini", "copilot"];
|
|
1433
1501
|
function readOurHookCommands(file, event) {
|
|
1434
1502
|
if (!existsSync(file))
|