diff --git a/bin/hooks/architect-drift-detector.js b/bin/hooks/architect-drift-detector.js index f10219b..b6a7513 100755 --- a/bin/hooks/architect-drift-detector.js +++ b/bin/hooks/architect-drift-detector.js @@ -239,4 +239,6 @@ function markForReanalysis(arch, reasons) { // Run detection const driftDetected = detectArchitectDrift(); -process.exit(driftDetected ? 1 : 0); +// Always exit 0 - drift is informational, not an error +// Non-zero exit codes are interpreted as hook errors by Claude Code +process.exit(0); diff --git a/bin/hooks/session-start.js b/bin/hooks/session-start.js index 400c0c3..de10834 100755 --- a/bin/hooks/session-start.js +++ b/bin/hooks/session-start.js @@ -29,15 +29,42 @@ try { /** * Detect if TeammateTool (parallel execution) is enabled + * Supports Windows, macOS, and Linux */ function detectParallelExecution() { + // Check environment variable first (user can set AGENTFUL_PARALLEL=true) + if (process.env.AGENTFUL_PARALLEL === 'true') { + return { enabled: true, method: 'env_var' }; + } + try { - // Find Claude Code binary - const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim(); - const cliPath = path.join(npmRoot, '@anthropic-ai', 'claude-code', 'cli.js'); + // Find Claude Code binary - try multiple paths for Windows/Unix + let cliPath = null; + const possiblePaths = [ + // Unix npm global + '/usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js', + // Homebrew on macOS + '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js', + ]; + + // npm root -g can throw on Windows if npm isn't in PATH + try { + const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim(); + possiblePaths.unshift(path.join(npmRoot, '@anthropic-ai', 'claude-code', 'cli.js')); + } catch { + // npm not available - continue with static paths + } + + for (const p of possiblePaths) { + if (fs.existsSync(p)) { + cliPath = p; + break; + } + } - if (!fs.existsSync(cliPath)) { - return { enabled: false, reason: 'Claude Code binary not found' }; + if (!cliPath) { + // Assume enabled if we can't find CLI (newer versions have it by default) + return { enabled: true, method: 'assumed' }; } // Check for TeammateTool pattern diff --git a/template/.claude/settings.json b/template/.claude/settings.json index 9c40b45..048fbe6 100644 --- a/template/.claude/settings.json +++ b/template/.claude/settings.json @@ -25,7 +25,7 @@ ], "PreToolUse": [ { - "tools": ["Write", "Edit"], + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -36,7 +36,7 @@ ] }, { - "tools": ["Write", "Edit"], + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -47,7 +47,7 @@ ] }, { - "tools": ["Write"], + "matcher": "Write", "hooks": [ { "type": "command", @@ -60,7 +60,7 @@ ], "PostToolUse": [ { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -71,7 +71,7 @@ ] }, { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -82,7 +82,7 @@ ] }, { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -93,7 +93,7 @@ ] }, { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -104,7 +104,7 @@ ] }, { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command", @@ -113,7 +113,7 @@ ] }, { - "matcher": "Write|Edit", + "matcher": "Write|Edit|NotebookEdit", "hooks": [ { "type": "command",