ai-lens 0.8.41 → 0.8.43

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 CHANGED
@@ -1 +1 @@
1
- 499af2e
1
+ eea31dd
package/cli/status.js CHANGED
@@ -847,7 +847,7 @@ function buildWarnings(results, { hasEverCaptured, lastCaptureMs, serverSessionC
847
847
  // Report file generation
848
848
  // ---------------------------------------------------------------------------
849
849
 
850
- function buildReport(results, timestamp, warnings = []) {
850
+ function buildReport(results, timestamp, warnings = [], allTools = TOOL_CONFIGS) {
851
851
  const lines = [
852
852
  `AI Lens Status Report`,
853
853
  `Generated: ${timestamp}`,
@@ -890,8 +890,8 @@ function buildReport(results, timestamp, warnings = []) {
890
890
  }
891
891
  lines.push('');
892
892
 
893
- // Full hook configs
894
- for (const tool of TOOL_CONFIGS) {
893
+ // Full hook configs (global + project)
894
+ for (const tool of allTools) {
895
895
  lines.push(`${'='.repeat(60)}`);
896
896
  lines.push(`${tool.name} hook config (${tool.configPath}):`);
897
897
  try {
@@ -1028,15 +1028,24 @@ export default async function status() {
1028
1028
  // 6. Hooks: global + project (Cursor then Claude Code; within each: global then project)
1029
1029
  const installedTools = detectInstalledTools();
1030
1030
  const toolsWithProject = getToolsForCaptureTest();
1031
- const toolLabel = (tool) => (TOOL_CONFIGS.includes(tool) ? `${tool.name} (global)` : tool.name);
1031
+ const isGlobalTool = (tool) => TOOL_CONFIGS.includes(tool);
1032
+ const toolLabel = (tool) => (isGlobalTool(tool) ? `${tool.name} (global)` : tool.name);
1032
1033
  const hooksOrder = (a, b) => {
1033
1034
  const nameA = toolLabel(a), nameB = toolLabel(b);
1034
1035
  const cursorFirst = (n) => (n.startsWith('Cursor') ? 0 : 1);
1035
1036
  const globalFirst = (n) => (n.includes('(global)') ? 0 : 1);
1036
1037
  return cursorFirst(nameA) - cursorFirst(nameB) || globalFirst(nameA) - globalFirst(nameB);
1037
1038
  };
1039
+ // Track which scopes have current hooks for mode detection
1040
+ let hasGlobalHooks = false;
1041
+ let hasProjectHooks = false;
1038
1042
  for (const tool of toolsWithProject.slice().sort(hooksOrder)) {
1039
- printLine(toolLabel(tool), checkHooks(tool));
1043
+ const hookResult = checkHooks(tool);
1044
+ printLine(toolLabel(tool), hookResult);
1045
+ if (hookResult.ok === true) {
1046
+ if (isGlobalTool(tool)) hasGlobalHooks = true;
1047
+ else hasProjectHooks = true;
1048
+ }
1040
1049
  }
1041
1050
  // Global tools not installed (no ~/.cursor or ~/.claude) — same order: Cursor then Claude Code
1042
1051
  const notInstalled = TOOL_CONFIGS.filter(t => !installedTools.includes(t));
@@ -1045,6 +1054,20 @@ export default async function status() {
1045
1054
  printLine(toolLabel(tool), r);
1046
1055
  }
1047
1056
 
1057
+ // 6b. Hook mode: global, project, both, or none
1058
+ const hookMode = hasGlobalHooks && hasProjectHooks ? 'global + project (may double-fire!)'
1059
+ : hasProjectHooks ? 'project'
1060
+ : hasGlobalHooks ? 'global'
1061
+ : 'none';
1062
+ const hookModeOk = hasGlobalHooks && hasProjectHooks ? null
1063
+ : (hasGlobalHooks || hasProjectHooks) ? true
1064
+ : false;
1065
+ printLine('Hook mode', {
1066
+ ok: hookModeOk,
1067
+ summary: hookMode,
1068
+ detail: `Global hooks active: ${hasGlobalHooks}\nProject hooks active: ${hasProjectHooks}${hasGlobalHooks && hasProjectHooks ? '\nWarning: both global and project hooks are active — events may be captured twice. Run init with --project-hooks to consolidate.' : ''}`,
1069
+ });
1070
+
1048
1071
  // 7. Queue (before capture test so test event doesn't show as pending)
1049
1072
  const queueResult = checkQueue();
1050
1073
  printLine('Queue', queueResult);
@@ -1103,7 +1126,9 @@ export default async function status() {
1103
1126
 
1104
1127
  // Write report file
1105
1128
  const timestamp = new Date().toISOString();
1106
- const report = buildReport(results, timestamp, warnings);
1129
+ // Merge global TOOL_CONFIGS (always listed, even if not installed) with project tools
1130
+ const allToolsForReport = [...TOOL_CONFIGS, ...toolsWithProject.filter(t => !TOOL_CONFIGS.includes(t))];
1131
+ const report = buildReport(results, timestamp, warnings, allToolsForReport);
1107
1132
  try {
1108
1133
  writeFileSync(REPORT_PATH, report);
1109
1134
  blank();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-lens",
3
- "version": "0.8.41",
3
+ "version": "0.8.43",
4
4
  "type": "module",
5
5
  "description": "Centralized session analytics for AI coding tools",
6
6
  "bin": {