🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
Checkpoint: File edits
rUvcf0d9ca5e69f
diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.tsindex b5aeccd552..5b37e57cbc 100644--- a/v3/@claude-flow/cli/src/init/settings-generator.ts+++ b/v3/@claude-flow/cli/src/init/settings-generator.ts@@ -177,9 +177,34 @@ function generateStatusLineConfig(options: InitOptions): object {/*** Generate hooks configuration+ * Detects platform and generates appropriate commands for Mac, Linux, and Windows*/function generateHooksConfig(config: HooksConfig): object {const hooks: Record<string, unknown[]> = {};+ const platform = detectPlatform();+ const isWindows = platform.os === 'windows';++ // Platform-specific command helpers+ // Windows: PowerShell syntax with 2>$null and ; exit 0+ // Mac/Linux: Bash syntax with 2>/dev/null || true+ const cmd = {+ // Check if variable is set and run command+ ifVar: (varName: string, command: string) => isWindows+ ? `if ($env:${varName}) { ${command} 2>$null }; exit 0`+ : `[ -n "$${varName}" ] && ${command} 2>/dev/null || true`,+ // Simple command with error suppression+ simple: (command: string) => isWindows+ ? `${command} 2>$null; exit 0`+ : `${command} 2>/dev/null || true`,+ // Echo JSON (different quote escaping)+ echoJson: (json: string) => isWindows+ ? `Write-Output '${json}'`+ : `echo '${json}'`,+ // Generate timestamp (for unique keys)+ timestamp: () => isWindows+ ? '$(Get-Date -UFormat %s)'+ : '$(date +%s)',+ };// PreToolUse hooks - cross-platform via npx with defensive guardsif (config.preToolUse) {@@ -190,7 +215,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_INPUT_file_path" ] && npx @claude-flow/cli@latest hooks pre-edit --file "$TOOL_INPUT_file_path" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_INPUT_file_path',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks pre-edit --file $env:TOOL_INPUT_file_path'+ : 'npx @claude-flow/cli@latest hooks pre-edit --file "$TOOL_INPUT_file_path"'),timeout: config.timeout,continueOnError: true,},@@ -202,7 +230,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_INPUT_command" ] && npx @claude-flow/cli@latest hooks pre-command --command "$TOOL_INPUT_command" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_INPUT_command',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks pre-command --command $env:TOOL_INPUT_command'+ : 'npx @claude-flow/cli@latest hooks pre-command --command "$TOOL_INPUT_command"'),timeout: config.timeout,continueOnError: true,},@@ -214,7 +245,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_INPUT_prompt" ] && npx @claude-flow/cli@latest hooks pre-task --task-id "task-$(date +%s)" --description "$TOOL_INPUT_prompt" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_INPUT_prompt',+ isWindows+ ? `npx @claude-flow/cli@latest hooks pre-task --task-id "task-${cmd.timestamp()}" --description $env:TOOL_INPUT_prompt`+ : `npx @claude-flow/cli@latest hooks pre-task --task-id "task-${cmd.timestamp()}" --description "$TOOL_INPUT_prompt"`),timeout: config.timeout,continueOnError: true,},@@ -232,7 +266,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_INPUT_file_path" ] && npx @claude-flow/cli@latest hooks post-edit --file "$TOOL_INPUT_file_path" --success "${TOOL_SUCCESS:-true}" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_INPUT_file_path',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks post-edit --file $env:TOOL_INPUT_file_path --success $($env:TOOL_SUCCESS ?? "true")'+ : 'npx @claude-flow/cli@latest hooks post-edit --file "$TOOL_INPUT_file_path" --success "${TOOL_SUCCESS:-true}"'),timeout: config.timeout,continueOnError: true,},@@ -244,7 +281,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_INPUT_command" ] && npx @claude-flow/cli@latest hooks post-command --command "$TOOL_INPUT_command" --success "${TOOL_SUCCESS:-true}" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_INPUT_command',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks post-command --command $env:TOOL_INPUT_command --success $($env:TOOL_SUCCESS ?? "true")'+ : 'npx @claude-flow/cli@latest hooks post-command --command "$TOOL_INPUT_command" --success "${TOOL_SUCCESS:-true}"'),timeout: config.timeout,continueOnError: true,},@@ -256,7 +296,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TOOL_RESULT_agent_id" ] && npx @claude-flow/cli@latest hooks post-task --task-id "$TOOL_RESULT_agent_id" --success "${TOOL_SUCCESS:-true}" 2>/dev/null || true',+ command: cmd.ifVar('TOOL_RESULT_agent_id',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks post-task --task-id $env:TOOL_RESULT_agent_id --success $($env:TOOL_SUCCESS ?? "true")'+ : 'npx @claude-flow/cli@latest hooks post-task --task-id "$TOOL_RESULT_agent_id" --success "${TOOL_SUCCESS:-true}"'),timeout: config.timeout,continueOnError: true,},@@ -272,7 +315,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$PROMPT" ] && npx @claude-flow/cli@latest hooks route --task "$PROMPT" || true',+ command: cmd.ifVar('PROMPT',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks route --task $env:PROMPT'+ : 'npx @claude-flow/cli@latest hooks route --task "$PROMPT"'),timeout: config.timeout,continueOnError: true,},@@ -288,13 +334,16 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: 'npx @claude-flow/cli@latest daemon start --quiet 2>/dev/null || true',+ command: cmd.simple('npx @claude-flow/cli@latest daemon start --quiet'),timeout: 5000,continueOnError: true,},{type: 'command',- command: '[ -n "$SESSION_ID" ] && npx @claude-flow/cli@latest hooks session-restore --session-id "$SESSION_ID" 2>/dev/null || true',+ command: cmd.ifVar('SESSION_ID',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks session-restore --session-id $env:SESSION_ID'+ : 'npx @claude-flow/cli@latest hooks session-restore --session-id "$SESSION_ID"'),timeout: 10000,continueOnError: true,},@@ -311,7 +360,7 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: 'echo \'{"ok": true}\'',+ command: cmd.echoJson('{"ok": true}'),timeout: 1000,},],@@ -326,7 +375,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$NOTIFICATION_MESSAGE" ] && npx @claude-flow/cli@latest memory store --namespace notifications --key "notify-$(date +%s)" --value "$NOTIFICATION_MESSAGE" 2>/dev/null || true',+ command: cmd.ifVar('NOTIFICATION_MESSAGE',+ isWindows+ ? `npx @claude-flow/cli@latest memory store --namespace notifications --key "notify-${cmd.timestamp()}" --value $env:NOTIFICATION_MESSAGE`+ : `npx @claude-flow/cli@latest memory store --namespace notifications --key "notify-${cmd.timestamp()}" --value "$NOTIFICATION_MESSAGE"`),timeout: 3000,continueOnError: true,},@@ -344,7 +396,7 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: 'npx @claude-flow/cli@latest hooks teammate-idle --auto-assign true 2>/dev/null || true',+ command: cmd.simple('npx @claude-flow/cli@latest hooks teammate-idle --auto-assign true'),timeout: 5000,continueOnError: true,},@@ -357,7 +409,10 @@ function generateHooksConfig(config: HooksConfig): object {hooks: [{type: 'command',- command: '[ -n "$TASK_ID" ] && npx @claude-flow/cli@latest hooks task-completed --task-id "$TASK_ID" --train-patterns true 2>/dev/null || true',+ command: cmd.ifVar('TASK_ID',+ isWindows+ ? 'npx @claude-flow/cli@latest hooks task-completed --task-id $env:TASK_ID --train-patterns true'+ : 'npx @claude-flow/cli@latest hooks task-completed --task-id "$TASK_ID" --train-patterns true'),timeout: 5000,continueOnError: true,},