Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/hooks/architect-drift-detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
37 changes: 32 additions & 5 deletions bin/hooks/session-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions template/.claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"PreToolUse": [
{
"tools": ["Write", "Edit"],
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -36,7 +36,7 @@
]
},
{
"tools": ["Write", "Edit"],
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -47,7 +47,7 @@
]
},
{
"tools": ["Write"],
"matcher": "Write",
"hooks": [
{
"type": "command",
Expand All @@ -60,7 +60,7 @@
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -71,7 +71,7 @@
]
},
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -82,7 +82,7 @@
]
},
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -93,7 +93,7 @@
]
},
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -104,7 +104,7 @@
]
},
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand All @@ -113,7 +113,7 @@
]
},
{
"matcher": "Write|Edit",
"matcher": "Write|Edit|NotebookEdit",
"hooks": [
{
"type": "command",
Expand Down
Loading