@ariso-ai/ari-hooks 0.1.6 → 0.1.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/init.js +24 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariso-ai/ari-hooks",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Set up Claude Code hooks that share your requests and their outcomes with Ari",
5
5
  "type": "module",
6
6
  "bin": {
package/src/init.js CHANGED
@@ -20,12 +20,33 @@ const CURSOR_HOOK_EVENTS = {
20
20
  stop: 'ari-hooks hook stop',
21
21
  };
22
22
 
23
+ // Cursor's app install shows up in the env vars its integrated terminal
24
+ // inherits: the git-askpass helpers point into Cursor.app (macOS),
25
+ // AppData\Local\Programs\cursor (Windows), or a cursor install dir (Linux).
26
+ const CURSOR_PATH_VARS = [
27
+ 'GIT_ASKPASS',
28
+ 'VSCODE_GIT_ASKPASS_NODE',
29
+ 'VSCODE_GIT_ASKPASS_MAIN',
30
+ ];
31
+
32
+ // Cursor ships via ToDesktop, so its macOS bundle id is this opaque token
33
+ // rather than anything containing "cursor".
34
+ const CURSOR_BUNDLE_ID = 'com.todesktop.230313mzl4w4u92';
35
+
23
36
  /**
24
- * Cursor's integrated terminal exports CURSOR_TRACE_ID and its CLI agent
25
- * exports CURSOR_AGENT; neither is set by plain VS Code or a bare shell.
37
+ * Cursor's agent terminals export CURSOR_TRACE_ID and its CLI agent exports
38
+ * CURSOR_AGENT, but a regular integrated terminal in Cursor sets neither
39
+ * it looks like VS Code (TERM_PROGRAM=vscode). There, the tells are the
40
+ * app's bundle id and the helper paths pointing into the Cursor install;
41
+ * plain VS Code and a bare shell match none of these.
26
42
  */
27
43
  export const isCursor = (env = process.env) =>
28
- Boolean(env.CURSOR_TRACE_ID || env.CURSOR_AGENT);
44
+ Boolean(
45
+ env.CURSOR_TRACE_ID ||
46
+ env.CURSOR_AGENT ||
47
+ env.__CFBundleIdentifier === CURSOR_BUNDLE_ID ||
48
+ CURSOR_PATH_VARS.some((key) => /cursor/i.test(env[key] ?? ''))
49
+ );
29
50
 
30
51
  function readJson(path) {
31
52
  try {