ai-lens 0.8.22 → 0.8.23
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/.commithash +1 -1
- package/cli/hooks.js +28 -22
- package/package.json +1 -1
package/.commithash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
9446d54
|
package/cli/hooks.js
CHANGED
|
@@ -106,15 +106,17 @@ export function captureCommand() {
|
|
|
106
106
|
const capturePath = CAPTURE_PATH.replace(/\\/g, '/');
|
|
107
107
|
const escaped = shellEscape(capturePath);
|
|
108
108
|
// /usr/bin/env doesn't need shell-escaping, but named paths do
|
|
109
|
-
|
|
109
|
+
return nodePath === '/usr/bin/env node'
|
|
110
110
|
? `/usr/bin/env node ${escaped}`
|
|
111
111
|
: `${shellEscape(nodePath.replace(/\\/g, '/'))} ${escaped}`;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Cursor on Windows executes hooks via PowerShell, which treats a quoted path like
|
|
115
|
+
// "node.exe" as a string expression, not a command invocation. The & (call) operator
|
|
116
|
+
// is required. Claude Code uses bash or cmd.exe where & is not needed (and breaks bash).
|
|
117
|
+
export function cursorCaptureCommand() {
|
|
118
|
+
const cmd = captureCommand();
|
|
119
|
+
return process.platform === 'win32' ? `& ${cmd}` : cmd;
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
// ---------------------------------------------------------------------------
|
|
@@ -169,20 +171,20 @@ const CLAUDE_CODE_HOOKS = {
|
|
|
169
171
|
};
|
|
170
172
|
|
|
171
173
|
const CURSOR_HOOKS = {
|
|
172
|
-
sessionStart: () => ({ command:
|
|
173
|
-
beforeSubmitPrompt: () => ({ command:
|
|
174
|
-
postToolUse: () => ({ command:
|
|
175
|
-
postToolUseFailure: () => ({ command:
|
|
176
|
-
afterFileEdit: () => ({ command:
|
|
177
|
-
afterShellExecution: () => ({ command:
|
|
178
|
-
afterMCPExecution: () => ({ command:
|
|
179
|
-
subagentStart: () => ({ command:
|
|
180
|
-
subagentStop: () => ({ command:
|
|
181
|
-
preCompact: () => ({ command:
|
|
182
|
-
afterAgentResponse: () => ({ command:
|
|
183
|
-
afterAgentThought: () => ({ command:
|
|
184
|
-
stop: () => ({ command:
|
|
185
|
-
sessionEnd: () => ({ command:
|
|
174
|
+
sessionStart: () => ({ command: cursorCaptureCommand() }),
|
|
175
|
+
beforeSubmitPrompt: () => ({ command: cursorCaptureCommand() }),
|
|
176
|
+
postToolUse: () => ({ command: cursorCaptureCommand() }),
|
|
177
|
+
postToolUseFailure: () => ({ command: cursorCaptureCommand() }),
|
|
178
|
+
afterFileEdit: () => ({ command: cursorCaptureCommand() }),
|
|
179
|
+
afterShellExecution: () => ({ command: cursorCaptureCommand() }),
|
|
180
|
+
afterMCPExecution: () => ({ command: cursorCaptureCommand() }),
|
|
181
|
+
subagentStart: () => ({ command: cursorCaptureCommand() }),
|
|
182
|
+
subagentStop: () => ({ command: cursorCaptureCommand() }),
|
|
183
|
+
preCompact: () => ({ command: cursorCaptureCommand() }),
|
|
184
|
+
afterAgentResponse: () => ({ command: cursorCaptureCommand() }),
|
|
185
|
+
afterAgentThought: () => ({ command: cursorCaptureCommand() }),
|
|
186
|
+
stop: () => ({ command: cursorCaptureCommand() }),
|
|
187
|
+
sessionEnd: () => ({ command: cursorCaptureCommand() }),
|
|
186
188
|
};
|
|
187
189
|
|
|
188
190
|
export const TOOL_CONFIGS = [
|
|
@@ -224,7 +226,11 @@ export function isAiLensHook(entry) {
|
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
function isCurrentAiLensHook(entry, expected) {
|
|
227
|
-
|
|
229
|
+
// Extract expected command from the hook definition (supports per-tool commands,
|
|
230
|
+
// e.g. Cursor uses & prefix on Windows for PowerShell, Claude Code does not).
|
|
231
|
+
const expected_cmd = expected?.command
|
|
232
|
+
|| expected?.hooks?.[0]?.command
|
|
233
|
+
|| captureCommand(); // fallback
|
|
228
234
|
// Normalize separators so hooks installed before path-normalization fix still match
|
|
229
235
|
const norm = s => (s || '').replace(/\\/g, '/');
|
|
230
236
|
// Flat format (Cursor)
|