agentic-flow 3.0.0 ā 3.1.0
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/.claude/skills/agentic-flow-quickstart/skill.md +6 -6
- package/.claude/skills/hooks-automation/skill.md +11 -11
- package/.claude/skills/memory-patterns/skill.md +7 -7
- package/.claude/skills/sparc-methodology/skill.md +13 -13
- package/.claude/skills/swarm-coordination/skill.md +5 -5
- package/.claude/skills/worker-benchmarks/skill.md +5 -5
- package/.claude/skills/worker-integration/skill.md +5 -5
- package/.claude/statusline.mjs +22 -5
- package/CHANGELOG.md +23 -0
- package/README.md +68 -71
- package/dist/.tsbuildinfo +1 -1
- package/dist/cli/commands/hooks.d.ts.map +1 -1
- package/dist/cli/commands/hooks.js +17 -17
- package/dist/cli/commands/hooks.js.map +1 -1
- package/dist/cli/commands/init.d.ts +2 -5
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -15
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/swarm.d.ts.map +1 -1
- package/dist/cli/commands/swarm.js +3 -2
- package/dist/cli/commands/swarm.js.map +1 -1
- package/dist/proxy/anthropic-to-gemini.d.ts.map +1 -1
- package/dist/proxy/anthropic-to-gemini.js +10 -14
- package/dist/proxy/anthropic-to-gemini.js.map +1 -1
- package/dist/proxy/anthropic-to-openrouter.d.ts.map +1 -1
- package/dist/proxy/anthropic-to-openrouter.js +6 -25
- package/dist/proxy/anthropic-to-openrouter.js.map +1 -1
- package/dist/proxy/anthropic-to-requesty.d.ts.map +1 -1
- package/dist/proxy/anthropic-to-requesty.js +8 -10
- package/dist/proxy/anthropic-to-requesty.js.map +1 -1
- package/dist/proxy/sse-lines.d.ts +9 -0
- package/dist/proxy/sse-lines.d.ts.map +1 -0
- package/dist/proxy/sse-lines.js +37 -0
- package/dist/proxy/sse-lines.js.map +1 -0
- package/dist/reasoningbank/index.d.ts +2 -1
- package/dist/reasoningbank/index.d.ts.map +1 -1
- package/dist/reasoningbank/index.js +1 -1
- package/dist/reasoningbank/index.js.map +1 -1
- package/dist/reasoningbank/utils/embeddings.d.ts +17 -0
- package/dist/reasoningbank/utils/embeddings.d.ts.map +1 -1
- package/dist/reasoningbank/utils/embeddings.js +48 -17
- package/dist/reasoningbank/utils/embeddings.js.map +1 -1
- package/dist/utils/package-version.d.ts +9 -0
- package/dist/utils/package-version.d.ts.map +1 -0
- package/dist/utils/package-version.js +39 -0
- package/dist/utils/package-version.js.map +1 -0
- package/docs/docker-tests/TEST-V1.7.8.Dockerfile +2 -2
- package/docs/docker-tests/TEST-V1.7.9-NODE20.Dockerfile +2 -2
- package/docs/docker-tests/TEST-V1.7.9.Dockerfile +2 -2
- package/docs/guides/CLAUDE-CODE-INTEGRATION.md +25 -8
- package/docs/guides/PROXY-ARCHITECTURE-AND-EXTENSION.md +22 -9
- package/docs/guides/STANDALONE_PROXY_GUIDE.md +16 -6
- package/docs/integrations/FASTMCP_CLI_INTEGRATION.md +1 -1
- package/docs/plans/requesty/02-architecture.md +5 -6
- package/docs/plans/requesty/03-implementation-phases.md +3 -4
- package/docs/plans/requesty/05-migration-guide.md +2 -2
- package/package.json +1 -1
- package/scripts/validate-providers.sh +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqCpC,wBAAgB,kBAAkB,IAAI,OAAO,CAkkC5C;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* 2. MCP Tools (via hooks-server.ts)
|
|
14
14
|
*/
|
|
15
15
|
import { Command } from 'commander';
|
|
16
|
+
import { packageSpec } from '../../utils/package-version.js';
|
|
16
17
|
import * as path from 'path';
|
|
17
18
|
// Import hook tools
|
|
18
19
|
import { hookPreEditTool } from '../../mcp/fastmcp/tools/hooks/pre-edit.js';
|
|
@@ -558,6 +559,8 @@ console.log(lines.join('\\n'));
|
|
|
558
559
|
fs.writeFileSync(statuslinePath, statuslineContent);
|
|
559
560
|
console.log(` š Created: ${statuslinePath}`);
|
|
560
561
|
}
|
|
562
|
+
// Hooks run exactly this release, never a dist-tag
|
|
563
|
+
const spec = packageSpec();
|
|
561
564
|
// Create settings with full capabilities
|
|
562
565
|
const settings = {
|
|
563
566
|
env: {
|
|
@@ -574,7 +577,7 @@ console.log(lines.join('\\n'));
|
|
|
574
577
|
hooks: [
|
|
575
578
|
{
|
|
576
579
|
type: 'command',
|
|
577
|
-
command:
|
|
580
|
+
command: `npx ${spec} hooks pre-edit "$TOOL_INPUT_file_path"`
|
|
578
581
|
}
|
|
579
582
|
]
|
|
580
583
|
},
|
|
@@ -583,7 +586,7 @@ console.log(lines.join('\\n'));
|
|
|
583
586
|
hooks: [
|
|
584
587
|
{
|
|
585
588
|
type: 'command',
|
|
586
|
-
command:
|
|
589
|
+
command: `npx ${spec} hooks pre-command "$TOOL_INPUT_command"`
|
|
587
590
|
}
|
|
588
591
|
]
|
|
589
592
|
}
|
|
@@ -594,7 +597,7 @@ console.log(lines.join('\\n'));
|
|
|
594
597
|
hooks: [
|
|
595
598
|
{
|
|
596
599
|
type: 'command',
|
|
597
|
-
command:
|
|
600
|
+
command: `npx ${spec} hooks post-edit "$TOOL_INPUT_file_path" --success`
|
|
598
601
|
}
|
|
599
602
|
]
|
|
600
603
|
}
|
|
@@ -605,7 +608,7 @@ console.log(lines.join('\\n'));
|
|
|
605
608
|
hooks: [
|
|
606
609
|
{
|
|
607
610
|
type: 'command',
|
|
608
|
-
command:
|
|
611
|
+
command: `npx ${spec} hooks post-edit "$TOOL_INPUT_file_path" --fail --error "$ERROR_MESSAGE"`
|
|
609
612
|
}
|
|
610
613
|
]
|
|
611
614
|
}
|
|
@@ -615,7 +618,7 @@ console.log(lines.join('\\n'));
|
|
|
615
618
|
hooks: [
|
|
616
619
|
{
|
|
617
620
|
type: 'command',
|
|
618
|
-
command:
|
|
621
|
+
command: `npx ${spec} hooks intelligence stats`
|
|
619
622
|
}
|
|
620
623
|
]
|
|
621
624
|
},
|
|
@@ -623,7 +626,7 @@ console.log(lines.join('\\n'));
|
|
|
623
626
|
hooks: [
|
|
624
627
|
{
|
|
625
628
|
type: 'command',
|
|
626
|
-
command:
|
|
629
|
+
command: `npx ${spec} workers status --active --json 2>/dev/null || true`
|
|
627
630
|
}
|
|
628
631
|
]
|
|
629
632
|
}
|
|
@@ -633,7 +636,7 @@ console.log(lines.join('\\n'));
|
|
|
633
636
|
hooks: [
|
|
634
637
|
{
|
|
635
638
|
type: 'command',
|
|
636
|
-
command:
|
|
639
|
+
command: `npx ${spec} workers cleanup --age 24 2>/dev/null || true`
|
|
637
640
|
}
|
|
638
641
|
]
|
|
639
642
|
}
|
|
@@ -644,7 +647,7 @@ console.log(lines.join('\\n'));
|
|
|
644
647
|
{
|
|
645
648
|
type: 'command',
|
|
646
649
|
timeout: 2000,
|
|
647
|
-
command:
|
|
650
|
+
command: `npx ${spec} hooks intelligence stats`
|
|
648
651
|
}
|
|
649
652
|
]
|
|
650
653
|
},
|
|
@@ -654,20 +657,17 @@ console.log(lines.join('\\n'));
|
|
|
654
657
|
type: 'command',
|
|
655
658
|
timeout: 5000,
|
|
656
659
|
background: true,
|
|
657
|
-
command:
|
|
660
|
+
command: `npx ${spec} workers dispatch-prompt "$USER_PROMPT" --session "$SESSION_ID" --json 2>/dev/null || true`
|
|
658
661
|
}
|
|
659
662
|
]
|
|
660
663
|
}
|
|
661
664
|
]
|
|
662
665
|
},
|
|
666
|
+
// Same rule as init: no npx/npm or whole MCP servers, which would
|
|
667
|
+
// let any package or tool run without a prompt.
|
|
663
668
|
permissions: {
|
|
664
669
|
allow: [
|
|
665
|
-
'Bash(
|
|
666
|
-
'Bash(agentic-flow:*)',
|
|
667
|
-
'Bash(npm run:*)',
|
|
668
|
-
'mcp__agentic-flow',
|
|
669
|
-
'mcp__claude-flow',
|
|
670
|
-
'mcp__ruv-swarm'
|
|
670
|
+
'Bash(agentic-flow:*)'
|
|
671
671
|
]
|
|
672
672
|
},
|
|
673
673
|
statusLine: options.statusline !== false ? {
|
|
@@ -679,8 +679,8 @@ console.log(lines.join('\\n'));
|
|
|
679
679
|
console.log('ā
Hooks initialized!');
|
|
680
680
|
console.log(` š Created: ${settingsPath}`);
|
|
681
681
|
console.log('\nš” Next steps:');
|
|
682
|
-
console.log(
|
|
683
|
-
console.log(
|
|
682
|
+
console.log(` 1. Run: npx ${spec} hooks pretrain`);
|
|
683
|
+
console.log(` 2. Run: npx ${spec} hooks build-agents`);
|
|
684
684
|
console.log(' 3. Start using Claude Code with intelligent routing!');
|
|
685
685
|
process.exit(0);
|
|
686
686
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EA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CLI interface for agentic-flow hook tools\n *\n * NOW WITH FULL RUVECTOR INTELLIGENCE:\n * - @ruvector/sona: Micro-LoRA (~0.05ms), EWC++, Trajectory tracking\n * - @ruvector/attention: MoE, Flash, Hyperbolic, Graph attention\n * - ruvector core: HNSW indexing (150x faster)\n *\n * Available as BOTH:\n * 1. CLI Commands (agentic-flow hooks ...)\n * 2. MCP Tools (via hooks-server.ts)\n */\n\nimport { Command } from 'commander';\nimport * as path from 'path';\n\n// Import hook tools\nimport { hookPreEditTool } from '../../mcp/fastmcp/tools/hooks/pre-edit.js';\nimport { hookPostEditTool } from '../../mcp/fastmcp/tools/hooks/post-edit.js';\nimport { hookPreCommandTool } from '../../mcp/fastmcp/tools/hooks/pre-command.js';\nimport { hookPostCommandTool } from '../../mcp/fastmcp/tools/hooks/post-command.js';\nimport { hookRouteTool } from '../../mcp/fastmcp/tools/hooks/route.js';\nimport { hookExplainTool } from '../../mcp/fastmcp/tools/hooks/explain.js';\nimport { hookPretrainTool } from '../../mcp/fastmcp/tools/hooks/pretrain.js';\nimport { hookBuildAgentsTool } from '../../mcp/fastmcp/tools/hooks/build-agents.js';\nimport { hookMetricsTool } from '../../mcp/fastmcp/tools/hooks/metrics.js';\nimport { hookTransferTool } from '../../mcp/fastmcp/tools/hooks/transfer.js';\n\n// Import intelligence tools (RuVector SONA + Attention + HNSW)\nimport {\n intelligenceRouteTool,\n intelligenceTrajectoryStartTool,\n intelligenceTrajectoryStepTool,\n intelligenceTrajectoryEndTool,\n intelligencePatternStoreTool,\n intelligencePatternSearchTool,\n intelligenceStatsTool,\n intelligenceLearnTool,\n intelligenceAttentionTool\n} from '../../mcp/fastmcp/tools/hooks/intelligence-tools.js';\n\nconst mockContext = {\n onProgress: (update: { progress: number; message: string }) => {\n if (process.env.VERBOSE) {\n console.log(`[${Math.round(update.progress * 100)}%] ${update.message}`);\n }\n }\n};\n\nexport function createHooksCommand(): Command {\n const hooks = new Command('hooks')\n .description('Self-learning intelligence hooks for agent routing and optimization')\n .addHelpCommand(true) // Enable 'hooks help <subcommand>'\n .action(() => {\n // Default action when no subcommand provided - show help\n hooks.outputHelp();\n });\n\n // Pre-edit hook\n hooks\n .command('pre-edit <filePath>')\n .description('Get context and agent suggestion before editing a file')\n .option('-t, --task <task>', 'Task description')\n .option('-j, --json', 'Output as JSON')\n .action(async (filePath: string, options: { task?: string; json?: boolean }) => {\n try {\n const result = await hookPreEditTool.execute(\n { filePath, task: options.task },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nšÆ Suggested Agent: ${result.suggestedAgent}`);\n console.log(`š Confidence: ${(result.confidence * 100).toFixed(1)}%`);\n if (result.relatedFiles?.length > 0) {\n console.log(`š Related Files:`);\n result.relatedFiles.forEach((f: string) => console.log(` - ${f}`));\n }\n console.log(`ā±ļø Latency: ${result.latencyMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Post-edit hook\n hooks\n .command('post-edit <filePath>')\n .description('Record edit outcome for learning')\n .option('-s, --success', 'Mark as successful edit')\n .option('-f, --fail', 'Mark as failed edit')\n .option('-a, --agent <agent>', 'Agent that performed the edit')\n .option('-d, --duration <ms>', 'Edit duration in milliseconds', parseInt)\n .option('-e, --error <message>', 'Error message if failed')\n .option('-j, --json', 'Output as JSON')\n .action(async (filePath: string, options: {\n success?: boolean;\n fail?: boolean;\n agent?: string;\n duration?: number;\n error?: string;\n json?: boolean;\n }) => {\n try {\n const success = options.success || !options.fail;\n const result = await hookPostEditTool.execute(\n {\n filePath,\n success,\n agent: options.agent,\n duration: options.duration,\n errorMessage: options.error\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\n${success ? 'ā
' : 'ā'} Edit recorded: ${filePath}`);\n console.log(`š Pattern updated: ${result.newPatternValue?.toFixed(2) || 'N/A'}`);\n console.log(`š Routing accuracy: ${(result.routingAccuracy * 100).toFixed(1)}%`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pre-command hook\n hooks\n .command('pre-command <command>')\n .description('Assess command risk before execution')\n .option('-j, --json', 'Output as JSON')\n .action(async (command: string, options: { json?: boolean }) => {\n try {\n const result = await hookPreCommandTool.execute({ command }, mockContext);\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const riskIcon = result.blocked ? 'š«' :\n result.riskCategory === 'safe' ? 'ā
' :\n result.riskCategory === 'caution' ? 'ā ļø' : 'ā';\n console.log(`\\n${riskIcon} Risk Level: ${result.riskCategory.toUpperCase()} (${(result.riskLevel * 100).toFixed(0)}%)`);\n if (result.blocked) {\n console.log(`š« Command BLOCKED - dangerous operation detected`);\n } else if (result.approved) {\n console.log(`ā
Command APPROVED`);\n }\n if (result.suggestions?.length > 0) {\n console.log(`š” Suggestions:`);\n result.suggestions.forEach((s: string) => console.log(` - ${s}`));\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Post-command hook\n hooks\n .command('post-command <command>')\n .description('Record command outcome for learning')\n .option('-c, --exit-code <code>', 'Exit code', parseInt, 0)\n .option('-o, --stdout <output>', 'Command stdout')\n .option('-e, --stderr <error>', 'Command stderr')\n .option('-j, --json', 'Output as JSON')\n .action(async (command: string, options: {\n exitCode?: number;\n stdout?: string;\n stderr?: string;\n json?: boolean;\n }) => {\n try {\n const result = await hookPostCommandTool.execute(\n {\n command,\n exitCode: options.exitCode ?? 0,\n stdout: options.stdout,\n stderr: options.stderr\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\n${result.commandSuccess ? 'ā
' : 'ā'} Command outcome recorded`);\n console.log(`š Learned: ${result.learned ? 'Yes' : 'No'}`);\n if (result.errorType) {\n console.log(`š Error type: ${result.errorType}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Route hook\n hooks\n .command('route <task>')\n .description('Route task to optimal agent using learned patterns')\n .option('-f, --file <filePath>', 'Context file path')\n .option('-e, --explore', 'Enable exploration mode')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n explore?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await hookRouteTool.execute(\n {\n task,\n context: options.file ? { file: options.file } : undefined,\n explore: options.explore\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nšÆ Recommended Agent: ${result.agent}`);\n console.log(`š Confidence: ${(result.confidence * 100).toFixed(1)}%`);\n if (result.explored) {\n console.log(`š Exploration mode: Active`);\n }\n console.log(`\\nš Routing Factors:`);\n result.factors.forEach((f: { name: string; score: number }) => {\n console.log(` ⢠${f.name}: ${(f.score * 100).toFixed(0)}%`);\n });\n if (result.alternatives?.length > 0) {\n console.log(`\\nš Alternatives:`);\n result.alternatives.forEach((a: { agent: string; score: number }) => {\n console.log(` - ${a.agent} (${(a.score * 100).toFixed(0)}%)`);\n });\n }\n console.log(`\\nā±ļø Latency: ${result.latencyMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Explain hook\n hooks\n .command('explain <task>')\n .description('Explain routing decision with full transparency')\n .option('-f, --file <filePath>', 'Context file path')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n json?: boolean;\n }) => {\n try {\n const result = await hookExplainTool.execute(\n { task, file: options.file },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Summary: ${result.summary}`);\n console.log(`\\nšÆ Recommended: ${result.recommendedAgent}`);\n console.log(`\\nš” Reasons:`);\n result.reasons.forEach((r: string) => console.log(` ⢠${r}`));\n console.log(`\\nš Agent Ranking:`);\n result.ranking.forEach((r: { rank: number; agent: string; score: number }) => {\n console.log(` ${r.rank}. ${r.agent} - ${(r.score * 100).toFixed(1)}%`);\n });\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pretrain hook\n hooks\n .command('pretrain')\n .description('Analyze repository to bootstrap intelligence')\n .option('-d, --depth <n>', 'Git history depth', parseInt, 50)\n .option('--skip-git', 'Skip git history analysis')\n .option('--skip-files', 'Skip file structure analysis')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n depth?: number;\n skipGit?: boolean;\n skipFiles?: boolean;\n json?: boolean;\n }) => {\n try {\n console.log('š§ Analyzing repository...\\n');\n const result = await hookPretrainTool.execute(\n {\n depth: options.depth ?? 50,\n skipGit: options.skipGit ?? false,\n skipFiles: options.skipFiles ?? false\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Pretrain Complete!`);\n console.log(` š Files analyzed: ${result.filesAnalyzed}`);\n console.log(` š§© Patterns created: ${result.patternsCreated}`);\n console.log(` š¾ Memories stored: ${result.memoriesStored}`);\n console.log(` š Co-edits found: ${result.coEditsFound || 0}`);\n if (result.languages?.length > 0) {\n console.log(` š Languages: ${result.languages.join(', ')}`);\n }\n console.log(` ā±ļø Duration: ${result.durationMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Build-agents hook\n hooks\n .command('build-agents')\n .description('Generate optimized agent configurations from pretrain data')\n .option('-f, --focus <mode>', 'Focus mode: quality|speed|security|testing|fullstack', 'quality')\n .option('-o, --output <dir>', 'Output directory', '.claude/agents')\n .option('--format <fmt>', 'Output format: yaml|json', 'yaml')\n .option('--no-prompts', 'Exclude system prompts')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n focus?: string;\n output?: string;\n format?: string;\n prompts?: boolean;\n json?: boolean;\n }) => {\n try {\n console.log(`šļø Building agents with focus: ${options.focus}...\\n`);\n const result = await hookBuildAgentsTool.execute(\n {\n focus: options.focus as 'quality' | 'speed' | 'security' | 'testing' | 'fullstack',\n output: options.output,\n format: options.format as 'yaml' | 'json',\n includePrompts: options.prompts !== false\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā
Agents Generated!`);\n console.log(` š¦ Total: ${result.agentsGenerated}`);\n console.log(` š Output: ${result.outputDir}`);\n console.log(` šÆ Focus: ${result.focus}`);\n console.log(`\\n Agents created:`);\n result.agents.forEach((a: string) => console.log(` ⢠${a}`));\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Metrics hook\n hooks\n .command('metrics')\n .alias('stats')\n .description('View learning metrics and performance dashboard')\n .option('-t, --timeframe <period>', 'Timeframe: 1h|24h|7d|30d', '24h')\n .option('-d, --detailed', 'Show detailed metrics')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n timeframe?: string;\n detailed?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await hookMetricsTool.execute(\n {\n timeframe: options.timeframe as '1h' | '24h' | '7d' | '30d',\n detailed: options.detailed\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Learning Metrics (${options.timeframe || '24h'})\\n`);\n console.log(`šÆ Routing:`);\n console.log(` Total routes: ${result.routing.total}`);\n console.log(` Successful: ${result.routing.successful}`);\n console.log(` Accuracy: ${(result.routing.accuracy * 100).toFixed(1)}%`);\n\n console.log(`\\nš Learning:`);\n console.log(` Patterns: ${result.learning.patterns}`);\n console.log(` Memories: ${result.learning.memories}`);\n console.log(` Error patterns: ${result.learning.errorPatterns}`);\n\n console.log(`\\nš Health: ${result.health.status.toUpperCase()}`);\n if (result.health.issues?.length > 0) {\n console.log(` Issues:`);\n result.health.issues.forEach((i: string) => console.log(` ā ļø ${i}`));\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Transfer hook\n hooks\n .command('transfer <sourceProject>')\n .description('Transfer learned patterns from another project')\n .option('-c, --min-confidence <n>', 'Minimum confidence threshold', parseFloat, 0.7)\n .option('-m, --max-patterns <n>', 'Maximum patterns to transfer', parseInt, 50)\n .option('--mode <mode>', 'Transfer mode: merge|replace|additive', 'merge')\n .option('-j, --json', 'Output as JSON')\n .action(async (sourceProject: string, options: {\n minConfidence?: number;\n maxPatterns?: number;\n mode?: string;\n json?: boolean;\n }) => {\n try {\n console.log(`š¤ Transferring patterns from: ${sourceProject}...\\n`);\n const result = await hookTransferTool.execute(\n {\n sourceProject,\n minConfidence: options.minConfidence,\n maxPatterns: options.maxPatterns,\n mode: options.mode as 'merge' | 'replace' | 'additive'\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā
Transfer Complete!`);\n console.log(` š„ Patterns transferred: ${result.transferred}`);\n console.log(` š Patterns adapted: ${result.adapted}`);\n console.log(` šÆ Mode: ${result.mode}`);\n if (result.targetStack?.length > 0) {\n console.log(` š ļø Target stack: ${result.targetStack.join(', ')}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Init command (creates .claude/settings.json with hooks)\n hooks\n .command('init')\n .description('Initialize hooks in project with .claude/settings.json')\n .option('--minimal', 'Minimal configuration')\n .option('--force', 'Overwrite existing configuration')\n .option('--no-statusline', 'Skip statusline generation')\n .action(async (options: { minimal?: boolean; force?: boolean; statusline?: boolean }) => {\n try {\n const fs = await import('fs');\n const settingsPath = path.join(process.cwd(), '.claude', 'settings.json');\n const statuslinePath = path.join(process.cwd(), '.claude', 'statusline.mjs');\n const claudeDir = path.dirname(settingsPath);\n\n // Check if exists\n if (fs.existsSync(settingsPath) && !options.force) {\n console.log('ā ļø Settings file already exists. Use --force to overwrite.');\n return;\n }\n\n // Create .claude directory\n if (!fs.existsSync(claudeDir)) {\n fs.mkdirSync(claudeDir, { recursive: true });\n }\n\n // Create statusline.mjs (compact colored format with agent stats)\n if (options.statusline !== false) {\n const statuslineContent = `#!/usr/bin/env node\n// Agentic Flow Intelligence Status Line - Compact Format with Colors\n// Works on Windows, Mac, and Linux - Queries SQLite for real stats\n\nimport { readFileSync, statSync, existsSync } from 'fs';\nimport { execSync } from 'child_process';\n\nconst INTEL_FILE = '.agentic-flow/intelligence.json';\nconst INTEL_DB = '.agentic-flow/intelligence.db';\n\n// Detect dark/light mode\nconst isDarkMode = (() => {\n const colorScheme = process.env.COLORFGBG || '';\n const termBg = process.env.TERM_BACKGROUND || '';\n const vscodeTheme = process.env.VSCODE_TERMINAL_COLOR_THEME || '';\n if (termBg === 'light') return false;\n if (vscodeTheme.toLowerCase().includes('light')) return false;\n if (colorScheme.startsWith('0;') || colorScheme.includes(';15')) return false;\n if (process.env.CLAUDE_CODE_THEME === 'light') return false;\n return true;\n})();\n\n// Color palettes\nconst colors = {\n dark: {\n reset: '\\\\x1b[0m', dim: '\\\\x1b[2m', bold: '\\\\x1b[1m',\n model: '\\\\x1b[38;5;208m', project: '\\\\x1b[38;5;39m', branch: '\\\\x1b[38;5;156m',\n brain: '\\\\x1b[38;5;213m', patterns: '\\\\x1b[38;5;220m', memory: '\\\\x1b[38;5;117m',\n trajectories: '\\\\x1b[38;5;183m', agents: '\\\\x1b[38;5;156m',\n target: '\\\\x1b[38;5;196m', learning: '\\\\x1b[38;5;226m', epsilon: '\\\\x1b[38;5;51m',\n success: '\\\\x1b[38;5;46m', symbol: '\\\\x1b[38;5;245m'\n },\n light: {\n reset: '\\\\x1b[0m', dim: '\\\\x1b[2m', bold: '\\\\x1b[1m',\n model: '\\\\x1b[38;5;166m', project: '\\\\x1b[38;5;27m', branch: '\\\\x1b[38;5;28m',\n brain: '\\\\x1b[38;5;129m', patterns: '\\\\x1b[38;5;136m', memory: '\\\\x1b[38;5;30m',\n trajectories: '\\\\x1b[38;5;91m', agents: '\\\\x1b[38;5;28m',\n target: '\\\\x1b[38;5;160m', learning: '\\\\x1b[38;5;136m', epsilon: '\\\\x1b[38;5;31m',\n success: '\\\\x1b[38;5;28m', symbol: '\\\\x1b[38;5;240m'\n }\n};\nconst c = isDarkMode ? colors.dark : colors.light;\n\nfunction readJson(file) {\n try { return JSON.parse(readFileSync(file, 'utf8')); } catch { return null; }\n}\n\nfunction querySqlite(db, sql) {\n // Pass db path and sql as separate arguments to avoid shell injection\n try {\n const { spawnSync } = require('child_process');\n const result = spawnSync('sqlite3', [db, sql], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 1000 });\n return result.stdout ? result.stdout.trim() : null;\n } catch { return null; }\n}\n\nfunction getGitBranch() {\n try { return execSync('git branch --show-current', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim(); }\n catch { return ''; }\n}\n\nfunction getProjectName() {\n try { return process.cwd().split('/').pop() || 'project'; } catch { return 'project'; }\n}\n\nfunction formatSize(bytes) {\n if (bytes < 1024) return \\`\\${bytes}B\\`;\n if (bytes < 1024 * 1024) return \\`\\${Math.round(bytes / 1024)}K\\`;\n return \\`\\${(bytes / (1024 * 1024)).toFixed(1)}M\\`;\n}\n\nconst LEARNING_RATE = parseFloat(process.env.AGENTIC_FLOW_LEARNING_RATE || '0.1');\nconst EPSILON = parseFloat(process.env.AGENTIC_FLOW_EPSILON || '0.1');\n\nconst intel = readJson(INTEL_FILE);\nlet dbStats = { totalTrajectories: 0, successfulRoutings: 0, totalRoutings: 0, totalPatterns: 0, totalAgents: 0, activeAgents: 0 };\n\nif (existsSync(INTEL_DB)) {\n const statsRow = querySqlite(INTEL_DB, 'SELECT * FROM stats LIMIT 1');\n if (statsRow) {\n const cols = statsRow.split('|');\n dbStats.totalTrajectories = parseInt(cols[1]) || 0;\n dbStats.totalRoutings = parseInt(cols[3]) || 0;\n dbStats.successfulRoutings = parseInt(cols[4]) || 0;\n dbStats.totalPatterns = parseInt(cols[5]) || 0;\n }\n const trajCount = querySqlite(INTEL_DB, 'SELECT COUNT(*) FROM trajectories');\n if (trajCount) dbStats.totalTrajectories = parseInt(trajCount) || dbStats.totalTrajectories;\n const patternCount = querySqlite(INTEL_DB, 'SELECT COUNT(*) FROM patterns');\n if (patternCount) dbStats.totalPatterns = parseInt(patternCount) || 0;\n}\n\nconst routes = dbStats.totalRoutings > 0 ? dbStats.totalRoutings : (intel?.metrics?.totalRoutes || 0);\nconst patterns = dbStats.totalPatterns > 0 ? dbStats.totalPatterns : (intel?.patterns ? Object.keys(intel.patterns).length : 0);\nconst memories = intel?.memories?.length || 0;\nconst trajectories = dbStats.totalTrajectories;\n\nlet agents = intel?.agents ? Object.keys(intel.agents).length : 66;\nlet activeAgents = intel?.agents ? Object.values(intel.agents).filter(a => a.status === 'active').length : 0;\n\nconst branch = getGitBranch();\nconst project = getProjectName();\n\nlet dbSize = 0;\nif (existsSync(INTEL_DB)) {\n try { dbSize = statSync(INTEL_DB).size; } catch {}\n}\n\nconst lines = [];\n\n// Line 1: Model + project + branch (colored)\nlet line1 = \\`\\${c.model}\\${c.bold}Opus 4.5\\${c.reset}\\`;\nline1 += \\` \\${c.dim}in\\${c.reset} \\${c.project}\\${project}\\${c.reset}\\`;\nif (branch) line1 += \\` \\${c.dim}on\\${c.reset} \\${c.symbol}ā\\${c.reset} \\${c.branch}\\${branch}\\${c.reset}\\`;\nlines.push(line1);\n\n// Line 2: RuVector stats (compact with symbols)\nlet line2 = \\`\\${c.brain}š§ RuVector\\${c.reset}\\`;\nline2 += \\` \\${c.symbol}ā\\${c.reset} \\${c.patterns}\\${patterns}\\${c.reset} \\${c.dim}patterns\\${c.reset}\\`;\nif (memories > 0 || dbSize > 0) {\n line2 += \\` \\${c.symbol}⬔\\${c.reset} \\${c.memory}\\${memories > 0 ? memories : formatSize(dbSize)}\\${c.reset} \\${c.dim}mem\\${c.reset}\\`;\n}\nif (trajectories > 0) line2 += \\` \\${c.symbol}ā\\${c.reset}\\${c.trajectories}\\${trajectories}\\${c.reset}\\`;\nif (agents > 0) line2 += \\` \\${c.symbol}#\\${c.reset}\\${c.agents}\\${activeAgents > 0 ? activeAgents + '/' : ''}\\${agents}\\${c.reset}\\`;\nlines.push(line2);\n\n// Line 3: Routing info (compact)\nconst lrPercent = Math.round(LEARNING_RATE * 100);\nconst epsPercent = Math.round(EPSILON * 100);\nlet line3 = \\`\\${c.target}šÆ Routing\\${c.reset} \\${c.dim}q-learning\\${c.reset}\\`;\nline3 += \\` \\${c.learning}lr:\\${lrPercent}%\\${c.reset} \\${c.epsilon}ε:\\${epsPercent}%\\${c.reset}\\`;\nif (routes > 0) {\n const successRate = dbStats.successfulRoutings > 0 ? Math.round((dbStats.successfulRoutings / routes) * 100) : 100;\n line3 += \\` \\${c.symbol}|\\${c.reset} \\${c.success}\\${successRate}% ā\\${c.reset}\\`;\n}\nlines.push(line3);\n\nconsole.log(lines.join('\\\\n'));\n`;\n fs.writeFileSync(statuslinePath, statuslineContent);\n console.log(` š Created: ${statuslinePath}`);\n }\n\n // Create settings with full capabilities\n const settings = {\n env: {\n AGENTIC_FLOW_INTELLIGENCE: 'true',\n AGENTIC_FLOW_LEARNING_RATE: '0.1',\n AGENTIC_FLOW_MEMORY_BACKEND: 'agentdb',\n AGENTIC_FLOW_WORKERS_ENABLED: 'true',\n AGENTIC_FLOW_MAX_WORKERS: '10'\n },\n hooks: {\n PreToolUse: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow hooks pre-edit \"$TOOL_INPUT_file_path\"'\n }\n ]\n },\n {\n matcher: 'Bash',\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow hooks pre-command \"$TOOL_INPUT_command\"'\n }\n ]\n }\n ],\n PostToolUse: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow hooks post-edit \"$TOOL_INPUT_file_path\" --success'\n }\n ]\n }\n ],\n PostToolUseFailure: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow hooks post-edit \"$TOOL_INPUT_file_path\" --fail --error \"$ERROR_MESSAGE\"'\n }\n ]\n }\n ],\n SessionStart: [\n {\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow hooks intelligence stats'\n }\n ]\n },\n {\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow workers status --active --json 2>/dev/null || true'\n }\n ]\n }\n ],\n SessionEnd: [\n {\n hooks: [\n {\n type: 'command',\n command: 'npx agentic-flow workers cleanup --age 24 2>/dev/null || true'\n }\n ]\n }\n ],\n UserPromptSubmit: [\n {\n hooks: [\n {\n type: 'command',\n timeout: 2000,\n command: 'npx agentic-flow hooks intelligence stats'\n }\n ]\n },\n {\n hooks: [\n {\n type: 'command',\n timeout: 5000,\n background: true,\n command: 'npx agentic-flow workers dispatch-prompt \"$USER_PROMPT\" --session \"$SESSION_ID\" --json 2>/dev/null || true'\n }\n ]\n }\n ]\n },\n permissions: {\n allow: [\n 'Bash(npx:*)',\n 'Bash(agentic-flow:*)',\n 'Bash(npm run:*)',\n 'mcp__agentic-flow',\n 'mcp__claude-flow',\n 'mcp__ruv-swarm'\n ]\n },\n statusLine: options.statusline !== false ? {\n type: 'command',\n command: 'node .claude/statusline.mjs'\n } : undefined\n };\n\n fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));\n console.log('ā
Hooks initialized!');\n console.log(` š Created: ${settingsPath}`);\n console.log('\\nš” Next steps:');\n console.log(' 1. Run: npx agentic-flow hooks pretrain');\n console.log(' 2. Run: npx agentic-flow hooks build-agents');\n console.log(' 3. Start using Claude Code with intelligent routing!');\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // ============================================\n // RUVECTOR INTELLIGENCE COMMANDS\n // SONA Micro-LoRA + MoE Attention + HNSW\n // ============================================\n\n // Create intelligence subcommand group\n const intelligence = new Command('intelligence')\n .alias('intel')\n .description('RuVector intelligence: SONA Micro-LoRA (~0.05ms) + MoE attention + HNSW (150x faster)');\n\n // Intelligence route command\n intelligence\n .command('route <task>')\n .description('Route task using SONA + MoE + HNSW (150x faster than brute force)')\n .option('-f, --file <path>', 'File context')\n .option('-e, --error <context>', 'Error context for debugging')\n .option('-k, --top-k <n>', 'Number of candidates', parseInt, 5)\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n error?: string;\n topK?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceRouteTool.execute(\n { task, file: options.file, errorContext: options.error, topK: options.topK },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā” RuVector Intelligence Route`);\n console.log(`šÆ Agent: ${result.agent}`);\n console.log(`š Confidence: ${((result.confidence || 0) * 100).toFixed(1)}%`);\n console.log(`š§ Engine: ${result.engine}`);\n console.log(`ā±ļø Latency: ${result.latencyMs?.toFixed(2)}ms`);\n if (result.features?.length > 0) {\n console.log(`š§ Features: ${result.features.join(', ')}`);\n }\n if (result.alternatives?.length > 0) {\n console.log(`\\nš Alternatives:`);\n result.alternatives.forEach((a: any) => {\n console.log(` - ${a.agent} (${((a.confidence || 0) * 100).toFixed(1)}%)`);\n });\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory start command\n intelligence\n .command('trajectory-start <task>')\n .description('Begin SONA trajectory for reinforcement learning')\n .requiredOption('-a, --agent <name>', 'Agent executing the task')\n .option('-c, --context <text>', 'Additional context')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n agent: string;\n context?: string;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceTrajectoryStartTool.execute(\n { task, agent: options.agent, context: options.context },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš¬ Trajectory Started`);\n console.log(`š ID: ${result.trajectoryId}`);\n console.log(`š¤ Agent: ${options.agent}`);\n console.log(`š§ Features: ${result.features?.join(', ')}`);\n console.log(`\\nš” Use this ID with trajectory-step and trajectory-end commands`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory step command\n intelligence\n .command('trajectory-step <trajectoryId>')\n .description('Record step in trajectory for reinforcement learning')\n .requiredOption('-a, --action <action>', 'Action taken')\n .requiredOption('-r, --reward <n>', 'Reward signal (-1 to 1)', parseFloat)\n .option('-f, --file <path>', 'File involved')\n .option('--error-fixed', 'Mark as error fix')\n .option('--test-passed', 'Mark as test passed')\n .option('-j, --json', 'Output as JSON')\n .action(async (trajectoryId: string, options: {\n action: string;\n reward: number;\n file?: string;\n errorFixed?: boolean;\n testPassed?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceTrajectoryStepTool.execute(\n {\n trajectoryId: parseInt(trajectoryId),\n action: options.action,\n reward: options.reward,\n file: options.file,\n errorFixed: options.errorFixed,\n testPassed: options.testPassed\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Step Recorded`);\n console.log(` Action: ${options.action}`);\n console.log(` Reward: ${options.reward}`);\n console.log(` Trajectory: ${trajectoryId}`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory end command\n intelligence\n .command('trajectory-end <trajectoryId>')\n .description('End trajectory and trigger SONA learning with EWC++')\n .option('-s, --success', 'Mark as successful')\n .option('-f, --fail', 'Mark as failed')\n .option('-q, --quality <n>', 'Quality score (0-1)', parseFloat, 0.8)\n .option('-j, --json', 'Output as JSON')\n .action(async (trajectoryId: string, options: {\n success?: boolean;\n fail?: boolean;\n quality?: number;\n json?: boolean;\n }) => {\n try {\n const success = options.success || !options.fail;\n const result = await intelligenceTrajectoryEndTool.execute(\n { trajectoryId: parseInt(trajectoryId), success, quality: options.quality },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Trajectory Completed`);\n console.log(` ${success ? 'ā
Success' : 'ā Failed'}`);\n console.log(` Quality: ${(options.quality || 0.8) * 100}%`);\n console.log(` Learning: EWC++ consolidation applied`);\n if (result.learningOutcome) {\n console.log(` Outcome: ${JSON.stringify(result.learningOutcome)}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pattern store command\n intelligence\n .command('pattern-store')\n .description('Store pattern in ReasoningBank (HNSW-indexed)')\n .requiredOption('-t, --task <task>', 'Task description')\n .requiredOption('-r, --resolution <text>', 'How it was resolved')\n .option('-s, --score <n>', 'Success score (0-1)', parseFloat, 0.9)\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n task: string;\n resolution: string;\n score?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligencePatternStoreTool.execute(\n { task: options.task, resolution: options.resolution, reward: options.score || 0.9 },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš¾ Pattern Stored`);\n console.log(` Task: ${options.task.slice(0, 50)}...`);\n console.log(` Score: ${((options.score || 0.9) * 100).toFixed(0)}%`);\n console.log(` Index: HNSW (150x faster retrieval)`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pattern search command\n intelligence\n .command('pattern-search <query>')\n .description('Search ReasoningBank using HNSW (150x faster)')\n .option('-k, --top-k <n>', 'Number of results', parseInt, 5)\n .option('-m, --min-reward <n>', 'Minimum reward filter', parseFloat)\n .option('-j, --json', 'Output as JSON')\n .action(async (query: string, options: {\n topK?: number;\n minReward?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligencePatternSearchTool.execute(\n { query, topK: options.topK, minReward: options.minReward },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Pattern Search Results`);\n console.log(` Query: \"${query.slice(0, 50)}\"`);\n console.log(` Engine: ${result.searchEngine}`);\n console.log(` Found: ${result.count} patterns`);\n if (result.patterns?.length > 0) {\n console.log(`\\n š Results:`);\n result.patterns.forEach((p: any, i: number) => {\n console.log(` ${i + 1}. [${((p.similarity || 0) * 100).toFixed(0)}%] ${p.resolution?.slice(0, 40)}...`);\n });\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Intelligence stats command\n intelligence\n .command('stats')\n .description('Get RuVector intelligence layer statistics')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: { json?: boolean }) => {\n try {\n const result = await intelligenceStatsTool.execute({}, mockContext);\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš RuVector Intelligence Stats`);\n console.log(`\\nš§ SONA Engine:`);\n console.log(` Micro-LoRA: ${result.features?.sona?.microLora || 'rank-1 (~0.05ms)'}`);\n console.log(` Base-LoRA: ${result.features?.sona?.baseLora || 'rank-8'}`);\n console.log(` EWC Lambda: ${result.features?.sona?.ewcLambda || 1000.0}`);\n console.log(`\\nā” Attention:`);\n console.log(` Type: ${result.features?.attention?.type || 'moe'}`);\n console.log(` Experts: ${result.features?.attention?.experts || 4}`);\n console.log(` Top-K: ${result.features?.attention?.topK || 2}`);\n console.log(`\\nš HNSW:`);\n console.log(` Enabled: ${result.features?.hnsw?.enabled ?? true}`);\n console.log(` Speedup: ${result.features?.hnsw?.speedup || '150x vs brute-force'}`);\n console.log(`\\nš Learning:`);\n console.log(` Trajectories: ${result.persistence?.trajectories ?? result.stats?.trajectoryCount ?? 0}`);\n console.log(` Active: ${result.stats?.activeTrajectories || 0}`);\n console.log(`\\nš¾ Persistence (SQLite):`);\n console.log(` Backend: ${result.persistence?.backend || 'sqlite'}`);\n console.log(` Routings: ${result.persistence?.routings ?? 0}`);\n console.log(` Patterns: ${result.persistence?.patterns ?? 0}`);\n console.log(` Operations: ${result.persistence?.operations ?? 0}`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Force learning command\n intelligence\n .command('learn')\n .description('Force immediate SONA learning cycle with EWC++ consolidation')\n .option('-r, --reason <text>', 'Reason for forcing learning')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: { reason?: string; json?: boolean }) => {\n try {\n const result = await intelligenceLearnTool.execute(\n { reason: options.reason },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Learning Cycle Complete`);\n console.log(` ${result.success ? 'ā
' : 'ā'} ${result.message}`);\n console.log(` Reason: ${result.reason || 'manual trigger'}`);\n console.log(` Features: ${result.features?.join(', ')}`);\n console.log(` Latency: ${result.latencyMs?.toFixed(2)}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Attention compute command\n intelligence\n .command('attention <query>')\n .description('Compute attention-weighted similarity using MoE/Flash/Hyperbolic')\n .requiredOption('-c, --candidates <texts...>', 'Candidate texts to score')\n .option('-t, --type <type>', 'Attention type: moe|flash|hyperbolic|graph|dual', 'moe')\n .option('-j, --json', 'Output as JSON')\n .action(async (query: string, options: {\n candidates: string[];\n type?: string;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceAttentionTool.execute(\n {\n query,\n candidates: options.candidates,\n attentionType: options.type as 'moe' | 'flash' | 'hyperbolic' | 'graph' | 'dual'\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš§ Attention Scores (${options.type || 'moe'})`);\n console.log(` Query: \"${query.slice(0, 40)}...\"`);\n console.log(`\\n š Results:`);\n result.results?.forEach((r: any, i: number) => {\n const bar = 'ā'.repeat(Math.round(r.score * 20));\n console.log(` ${i + 1}. ${bar} ${(r.score * 100).toFixed(1)}% \"${r.text}\"`);\n });\n console.log(`\\n ā±ļø Latency: ${result.latencyMs?.toFixed(2)}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Add intelligence subcommand to hooks\n hooks.addCommand(intelligence);\n\n return hooks;\n}\n\nexport default createHooksCommand;\n\n// CLI entry point when run directly\nconst isDirectRun = import.meta.url === `file://${process.argv[1]}`;\nif (isDirectRun) {\n const hooks = createHooksCommand();\n hooks.parse(process.argv);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/cli/commands/hooks.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAA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OR INTELLIGENCE:\n * - @ruvector/sona: Micro-LoRA (~0.05ms), EWC++, Trajectory tracking\n * - @ruvector/attention: MoE, Flash, Hyperbolic, Graph attention\n * - ruvector core: HNSW indexing (150x faster)\n *\n * Available as BOTH:\n * 1. CLI Commands (agentic-flow hooks ...)\n * 2. MCP Tools (via hooks-server.ts)\n */\n\nimport { Command } from 'commander';\nimport { packageSpec } from '../../utils/package-version.js';\nimport * as path from 'path';\n\n// Import hook tools\nimport { hookPreEditTool } from '../../mcp/fastmcp/tools/hooks/pre-edit.js';\nimport { hookPostEditTool } from '../../mcp/fastmcp/tools/hooks/post-edit.js';\nimport { hookPreCommandTool } from '../../mcp/fastmcp/tools/hooks/pre-command.js';\nimport { hookPostCommandTool } from '../../mcp/fastmcp/tools/hooks/post-command.js';\nimport { hookRouteTool } from '../../mcp/fastmcp/tools/hooks/route.js';\nimport { hookExplainTool } from '../../mcp/fastmcp/tools/hooks/explain.js';\nimport { hookPretrainTool } from '../../mcp/fastmcp/tools/hooks/pretrain.js';\nimport { hookBuildAgentsTool } from '../../mcp/fastmcp/tools/hooks/build-agents.js';\nimport { hookMetricsTool } from '../../mcp/fastmcp/tools/hooks/metrics.js';\nimport { hookTransferTool } from '../../mcp/fastmcp/tools/hooks/transfer.js';\n\n// Import intelligence tools (RuVector SONA + Attention + HNSW)\nimport {\n intelligenceRouteTool,\n intelligenceTrajectoryStartTool,\n intelligenceTrajectoryStepTool,\n intelligenceTrajectoryEndTool,\n intelligencePatternStoreTool,\n intelligencePatternSearchTool,\n intelligenceStatsTool,\n intelligenceLearnTool,\n intelligenceAttentionTool\n} from '../../mcp/fastmcp/tools/hooks/intelligence-tools.js';\n\nconst mockContext = {\n onProgress: (update: { progress: number; message: string }) => {\n if (process.env.VERBOSE) {\n console.log(`[${Math.round(update.progress * 100)}%] ${update.message}`);\n }\n }\n};\n\nexport function createHooksCommand(): Command {\n const hooks = new Command('hooks')\n .description('Self-learning intelligence hooks for agent routing and optimization')\n .addHelpCommand(true) // Enable 'hooks help <subcommand>'\n .action(() => {\n // Default action when no subcommand provided - show help\n hooks.outputHelp();\n });\n\n // Pre-edit hook\n hooks\n .command('pre-edit <filePath>')\n .description('Get context and agent suggestion before editing a file')\n .option('-t, --task <task>', 'Task description')\n .option('-j, --json', 'Output as JSON')\n .action(async (filePath: string, options: { task?: string; json?: boolean }) => {\n try {\n const result = await hookPreEditTool.execute(\n { filePath, task: options.task },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nšÆ Suggested Agent: ${result.suggestedAgent}`);\n console.log(`š Confidence: ${(result.confidence * 100).toFixed(1)}%`);\n if (result.relatedFiles?.length > 0) {\n console.log(`š Related Files:`);\n result.relatedFiles.forEach((f: string) => console.log(` - ${f}`));\n }\n console.log(`ā±ļø Latency: ${result.latencyMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Post-edit hook\n hooks\n .command('post-edit <filePath>')\n .description('Record edit outcome for learning')\n .option('-s, --success', 'Mark as successful edit')\n .option('-f, --fail', 'Mark as failed edit')\n .option('-a, --agent <agent>', 'Agent that performed the edit')\n .option('-d, --duration <ms>', 'Edit duration in milliseconds', parseInt)\n .option('-e, --error <message>', 'Error message if failed')\n .option('-j, --json', 'Output as JSON')\n .action(async (filePath: string, options: {\n success?: boolean;\n fail?: boolean;\n agent?: string;\n duration?: number;\n error?: string;\n json?: boolean;\n }) => {\n try {\n const success = options.success || !options.fail;\n const result = await hookPostEditTool.execute(\n {\n filePath,\n success,\n agent: options.agent,\n duration: options.duration,\n errorMessage: options.error\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\n${success ? 'ā
' : 'ā'} Edit recorded: ${filePath}`);\n console.log(`š Pattern updated: ${result.newPatternValue?.toFixed(2) || 'N/A'}`);\n console.log(`š Routing accuracy: ${(result.routingAccuracy * 100).toFixed(1)}%`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pre-command hook\n hooks\n .command('pre-command <command>')\n .description('Assess command risk before execution')\n .option('-j, --json', 'Output as JSON')\n .action(async (command: string, options: { json?: boolean }) => {\n try {\n const result = await hookPreCommandTool.execute({ command }, mockContext);\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n const riskIcon = result.blocked ? 'š«' :\n result.riskCategory === 'safe' ? 'ā
' :\n result.riskCategory === 'caution' ? 'ā ļø' : 'ā';\n console.log(`\\n${riskIcon} Risk Level: ${result.riskCategory.toUpperCase()} (${(result.riskLevel * 100).toFixed(0)}%)`);\n if (result.blocked) {\n console.log(`š« Command BLOCKED - dangerous operation detected`);\n } else if (result.approved) {\n console.log(`ā
Command APPROVED`);\n }\n if (result.suggestions?.length > 0) {\n console.log(`š” Suggestions:`);\n result.suggestions.forEach((s: string) => console.log(` - ${s}`));\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Post-command hook\n hooks\n .command('post-command <command>')\n .description('Record command outcome for learning')\n .option('-c, --exit-code <code>', 'Exit code', parseInt, 0)\n .option('-o, --stdout <output>', 'Command stdout')\n .option('-e, --stderr <error>', 'Command stderr')\n .option('-j, --json', 'Output as JSON')\n .action(async (command: string, options: {\n exitCode?: number;\n stdout?: string;\n stderr?: string;\n json?: boolean;\n }) => {\n try {\n const result = await hookPostCommandTool.execute(\n {\n command,\n exitCode: options.exitCode ?? 0,\n stdout: options.stdout,\n stderr: options.stderr\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\n${result.commandSuccess ? 'ā
' : 'ā'} Command outcome recorded`);\n console.log(`š Learned: ${result.learned ? 'Yes' : 'No'}`);\n if (result.errorType) {\n console.log(`š Error type: ${result.errorType}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Route hook\n hooks\n .command('route <task>')\n .description('Route task to optimal agent using learned patterns')\n .option('-f, --file <filePath>', 'Context file path')\n .option('-e, --explore', 'Enable exploration mode')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n explore?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await hookRouteTool.execute(\n {\n task,\n context: options.file ? { file: options.file } : undefined,\n explore: options.explore\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nšÆ Recommended Agent: ${result.agent}`);\n console.log(`š Confidence: ${(result.confidence * 100).toFixed(1)}%`);\n if (result.explored) {\n console.log(`š Exploration mode: Active`);\n }\n console.log(`\\nš Routing Factors:`);\n result.factors.forEach((f: { name: string; score: number }) => {\n console.log(` ⢠${f.name}: ${(f.score * 100).toFixed(0)}%`);\n });\n if (result.alternatives?.length > 0) {\n console.log(`\\nš Alternatives:`);\n result.alternatives.forEach((a: { agent: string; score: number }) => {\n console.log(` - ${a.agent} (${(a.score * 100).toFixed(0)}%)`);\n });\n }\n console.log(`\\nā±ļø Latency: ${result.latencyMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Explain hook\n hooks\n .command('explain <task>')\n .description('Explain routing decision with full transparency')\n .option('-f, --file <filePath>', 'Context file path')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n json?: boolean;\n }) => {\n try {\n const result = await hookExplainTool.execute(\n { task, file: options.file },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Summary: ${result.summary}`);\n console.log(`\\nšÆ Recommended: ${result.recommendedAgent}`);\n console.log(`\\nš” Reasons:`);\n result.reasons.forEach((r: string) => console.log(` ⢠${r}`));\n console.log(`\\nš Agent Ranking:`);\n result.ranking.forEach((r: { rank: number; agent: string; score: number }) => {\n console.log(` ${r.rank}. ${r.agent} - ${(r.score * 100).toFixed(1)}%`);\n });\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pretrain hook\n hooks\n .command('pretrain')\n .description('Analyze repository to bootstrap intelligence')\n .option('-d, --depth <n>', 'Git history depth', parseInt, 50)\n .option('--skip-git', 'Skip git history analysis')\n .option('--skip-files', 'Skip file structure analysis')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n depth?: number;\n skipGit?: boolean;\n skipFiles?: boolean;\n json?: boolean;\n }) => {\n try {\n console.log('š§ Analyzing repository...\\n');\n const result = await hookPretrainTool.execute(\n {\n depth: options.depth ?? 50,\n skipGit: options.skipGit ?? false,\n skipFiles: options.skipFiles ?? false\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Pretrain Complete!`);\n console.log(` š Files analyzed: ${result.filesAnalyzed}`);\n console.log(` š§© Patterns created: ${result.patternsCreated}`);\n console.log(` š¾ Memories stored: ${result.memoriesStored}`);\n console.log(` š Co-edits found: ${result.coEditsFound || 0}`);\n if (result.languages?.length > 0) {\n console.log(` š Languages: ${result.languages.join(', ')}`);\n }\n console.log(` ā±ļø Duration: ${result.durationMs}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Build-agents hook\n hooks\n .command('build-agents')\n .description('Generate optimized agent configurations from pretrain data')\n .option('-f, --focus <mode>', 'Focus mode: quality|speed|security|testing|fullstack', 'quality')\n .option('-o, --output <dir>', 'Output directory', '.claude/agents')\n .option('--format <fmt>', 'Output format: yaml|json', 'yaml')\n .option('--no-prompts', 'Exclude system prompts')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n focus?: string;\n output?: string;\n format?: string;\n prompts?: boolean;\n json?: boolean;\n }) => {\n try {\n console.log(`šļø Building agents with focus: ${options.focus}...\\n`);\n const result = await hookBuildAgentsTool.execute(\n {\n focus: options.focus as 'quality' | 'speed' | 'security' | 'testing' | 'fullstack',\n output: options.output,\n format: options.format as 'yaml' | 'json',\n includePrompts: options.prompts !== false\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā
Agents Generated!`);\n console.log(` š¦ Total: ${result.agentsGenerated}`);\n console.log(` š Output: ${result.outputDir}`);\n console.log(` šÆ Focus: ${result.focus}`);\n console.log(`\\n Agents created:`);\n result.agents.forEach((a: string) => console.log(` ⢠${a}`));\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Metrics hook\n hooks\n .command('metrics')\n .alias('stats')\n .description('View learning metrics and performance dashboard')\n .option('-t, --timeframe <period>', 'Timeframe: 1h|24h|7d|30d', '24h')\n .option('-d, --detailed', 'Show detailed metrics')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n timeframe?: string;\n detailed?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await hookMetricsTool.execute(\n {\n timeframe: options.timeframe as '1h' | '24h' | '7d' | '30d',\n detailed: options.detailed\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Learning Metrics (${options.timeframe || '24h'})\\n`);\n console.log(`šÆ Routing:`);\n console.log(` Total routes: ${result.routing.total}`);\n console.log(` Successful: ${result.routing.successful}`);\n console.log(` Accuracy: ${(result.routing.accuracy * 100).toFixed(1)}%`);\n\n console.log(`\\nš Learning:`);\n console.log(` Patterns: ${result.learning.patterns}`);\n console.log(` Memories: ${result.learning.memories}`);\n console.log(` Error patterns: ${result.learning.errorPatterns}`);\n\n console.log(`\\nš Health: ${result.health.status.toUpperCase()}`);\n if (result.health.issues?.length > 0) {\n console.log(` Issues:`);\n result.health.issues.forEach((i: string) => console.log(` ā ļø ${i}`));\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Transfer hook\n hooks\n .command('transfer <sourceProject>')\n .description('Transfer learned patterns from another project')\n .option('-c, --min-confidence <n>', 'Minimum confidence threshold', parseFloat, 0.7)\n .option('-m, --max-patterns <n>', 'Maximum patterns to transfer', parseInt, 50)\n .option('--mode <mode>', 'Transfer mode: merge|replace|additive', 'merge')\n .option('-j, --json', 'Output as JSON')\n .action(async (sourceProject: string, options: {\n minConfidence?: number;\n maxPatterns?: number;\n mode?: string;\n json?: boolean;\n }) => {\n try {\n console.log(`š¤ Transferring patterns from: ${sourceProject}...\\n`);\n const result = await hookTransferTool.execute(\n {\n sourceProject,\n minConfidence: options.minConfidence,\n maxPatterns: options.maxPatterns,\n mode: options.mode as 'merge' | 'replace' | 'additive'\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā
Transfer Complete!`);\n console.log(` š„ Patterns transferred: ${result.transferred}`);\n console.log(` š Patterns adapted: ${result.adapted}`);\n console.log(` šÆ Mode: ${result.mode}`);\n if (result.targetStack?.length > 0) {\n console.log(` š ļø Target stack: ${result.targetStack.join(', ')}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Init command (creates .claude/settings.json with hooks)\n hooks\n .command('init')\n .description('Initialize hooks in project with .claude/settings.json')\n .option('--minimal', 'Minimal configuration')\n .option('--force', 'Overwrite existing configuration')\n .option('--no-statusline', 'Skip statusline generation')\n .action(async (options: { minimal?: boolean; force?: boolean; statusline?: boolean }) => {\n try {\n const fs = await import('fs');\n const settingsPath = path.join(process.cwd(), '.claude', 'settings.json');\n const statuslinePath = path.join(process.cwd(), '.claude', 'statusline.mjs');\n const claudeDir = path.dirname(settingsPath);\n\n // Check if exists\n if (fs.existsSync(settingsPath) && !options.force) {\n console.log('ā ļø Settings file already exists. Use --force to overwrite.');\n return;\n }\n\n // Create .claude directory\n if (!fs.existsSync(claudeDir)) {\n fs.mkdirSync(claudeDir, { recursive: true });\n }\n\n // Create statusline.mjs (compact colored format with agent stats)\n if (options.statusline !== false) {\n const statuslineContent = `#!/usr/bin/env node\n// Agentic Flow Intelligence Status Line - Compact Format with Colors\n// Works on Windows, Mac, and Linux - Queries SQLite for real stats\n\nimport { readFileSync, statSync, existsSync } from 'fs';\nimport { execSync } from 'child_process';\n\nconst INTEL_FILE = '.agentic-flow/intelligence.json';\nconst INTEL_DB = '.agentic-flow/intelligence.db';\n\n// Detect dark/light mode\nconst isDarkMode = (() => {\n const colorScheme = process.env.COLORFGBG || '';\n const termBg = process.env.TERM_BACKGROUND || '';\n const vscodeTheme = process.env.VSCODE_TERMINAL_COLOR_THEME || '';\n if (termBg === 'light') return false;\n if (vscodeTheme.toLowerCase().includes('light')) return false;\n if (colorScheme.startsWith('0;') || colorScheme.includes(';15')) return false;\n if (process.env.CLAUDE_CODE_THEME === 'light') return false;\n return true;\n})();\n\n// Color palettes\nconst colors = {\n dark: {\n reset: '\\\\x1b[0m', dim: '\\\\x1b[2m', bold: '\\\\x1b[1m',\n model: '\\\\x1b[38;5;208m', project: '\\\\x1b[38;5;39m', branch: '\\\\x1b[38;5;156m',\n brain: '\\\\x1b[38;5;213m', patterns: '\\\\x1b[38;5;220m', memory: '\\\\x1b[38;5;117m',\n trajectories: '\\\\x1b[38;5;183m', agents: '\\\\x1b[38;5;156m',\n target: '\\\\x1b[38;5;196m', learning: '\\\\x1b[38;5;226m', epsilon: '\\\\x1b[38;5;51m',\n success: '\\\\x1b[38;5;46m', symbol: '\\\\x1b[38;5;245m'\n },\n light: {\n reset: '\\\\x1b[0m', dim: '\\\\x1b[2m', bold: '\\\\x1b[1m',\n model: '\\\\x1b[38;5;166m', project: '\\\\x1b[38;5;27m', branch: '\\\\x1b[38;5;28m',\n brain: '\\\\x1b[38;5;129m', patterns: '\\\\x1b[38;5;136m', memory: '\\\\x1b[38;5;30m',\n trajectories: '\\\\x1b[38;5;91m', agents: '\\\\x1b[38;5;28m',\n target: '\\\\x1b[38;5;160m', learning: '\\\\x1b[38;5;136m', epsilon: '\\\\x1b[38;5;31m',\n success: '\\\\x1b[38;5;28m', symbol: '\\\\x1b[38;5;240m'\n }\n};\nconst c = isDarkMode ? colors.dark : colors.light;\n\nfunction readJson(file) {\n try { return JSON.parse(readFileSync(file, 'utf8')); } catch { return null; }\n}\n\nfunction querySqlite(db, sql) {\n // Pass db path and sql as separate arguments to avoid shell injection\n try {\n const { spawnSync } = require('child_process');\n const result = spawnSync('sqlite3', [db, sql], { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 1000 });\n return result.stdout ? result.stdout.trim() : null;\n } catch { return null; }\n}\n\nfunction getGitBranch() {\n try { return execSync('git branch --show-current', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim(); }\n catch { return ''; }\n}\n\nfunction getProjectName() {\n try { return process.cwd().split('/').pop() || 'project'; } catch { return 'project'; }\n}\n\nfunction formatSize(bytes) {\n if (bytes < 1024) return \\`\\${bytes}B\\`;\n if (bytes < 1024 * 1024) return \\`\\${Math.round(bytes / 1024)}K\\`;\n return \\`\\${(bytes / (1024 * 1024)).toFixed(1)}M\\`;\n}\n\nconst LEARNING_RATE = parseFloat(process.env.AGENTIC_FLOW_LEARNING_RATE || '0.1');\nconst EPSILON = parseFloat(process.env.AGENTIC_FLOW_EPSILON || '0.1');\n\nconst intel = readJson(INTEL_FILE);\nlet dbStats = { totalTrajectories: 0, successfulRoutings: 0, totalRoutings: 0, totalPatterns: 0, totalAgents: 0, activeAgents: 0 };\n\nif (existsSync(INTEL_DB)) {\n const statsRow = querySqlite(INTEL_DB, 'SELECT * FROM stats LIMIT 1');\n if (statsRow) {\n const cols = statsRow.split('|');\n dbStats.totalTrajectories = parseInt(cols[1]) || 0;\n dbStats.totalRoutings = parseInt(cols[3]) || 0;\n dbStats.successfulRoutings = parseInt(cols[4]) || 0;\n dbStats.totalPatterns = parseInt(cols[5]) || 0;\n }\n const trajCount = querySqlite(INTEL_DB, 'SELECT COUNT(*) FROM trajectories');\n if (trajCount) dbStats.totalTrajectories = parseInt(trajCount) || dbStats.totalTrajectories;\n const patternCount = querySqlite(INTEL_DB, 'SELECT COUNT(*) FROM patterns');\n if (patternCount) dbStats.totalPatterns = parseInt(patternCount) || 0;\n}\n\nconst routes = dbStats.totalRoutings > 0 ? dbStats.totalRoutings : (intel?.metrics?.totalRoutes || 0);\nconst patterns = dbStats.totalPatterns > 0 ? dbStats.totalPatterns : (intel?.patterns ? Object.keys(intel.patterns).length : 0);\nconst memories = intel?.memories?.length || 0;\nconst trajectories = dbStats.totalTrajectories;\n\nlet agents = intel?.agents ? Object.keys(intel.agents).length : 66;\nlet activeAgents = intel?.agents ? Object.values(intel.agents).filter(a => a.status === 'active').length : 0;\n\nconst branch = getGitBranch();\nconst project = getProjectName();\n\nlet dbSize = 0;\nif (existsSync(INTEL_DB)) {\n try { dbSize = statSync(INTEL_DB).size; } catch {}\n}\n\nconst lines = [];\n\n// Line 1: Model + project + branch (colored)\nlet line1 = \\`\\${c.model}\\${c.bold}Opus 4.5\\${c.reset}\\`;\nline1 += \\` \\${c.dim}in\\${c.reset} \\${c.project}\\${project}\\${c.reset}\\`;\nif (branch) line1 += \\` \\${c.dim}on\\${c.reset} \\${c.symbol}ā\\${c.reset} \\${c.branch}\\${branch}\\${c.reset}\\`;\nlines.push(line1);\n\n// Line 2: RuVector stats (compact with symbols)\nlet line2 = \\`\\${c.brain}š§ RuVector\\${c.reset}\\`;\nline2 += \\` \\${c.symbol}ā\\${c.reset} \\${c.patterns}\\${patterns}\\${c.reset} \\${c.dim}patterns\\${c.reset}\\`;\nif (memories > 0 || dbSize > 0) {\n line2 += \\` \\${c.symbol}⬔\\${c.reset} \\${c.memory}\\${memories > 0 ? memories : formatSize(dbSize)}\\${c.reset} \\${c.dim}mem\\${c.reset}\\`;\n}\nif (trajectories > 0) line2 += \\` \\${c.symbol}ā\\${c.reset}\\${c.trajectories}\\${trajectories}\\${c.reset}\\`;\nif (agents > 0) line2 += \\` \\${c.symbol}#\\${c.reset}\\${c.agents}\\${activeAgents > 0 ? activeAgents + '/' : ''}\\${agents}\\${c.reset}\\`;\nlines.push(line2);\n\n// Line 3: Routing info (compact)\nconst lrPercent = Math.round(LEARNING_RATE * 100);\nconst epsPercent = Math.round(EPSILON * 100);\nlet line3 = \\`\\${c.target}šÆ Routing\\${c.reset} \\${c.dim}q-learning\\${c.reset}\\`;\nline3 += \\` \\${c.learning}lr:\\${lrPercent}%\\${c.reset} \\${c.epsilon}ε:\\${epsPercent}%\\${c.reset}\\`;\nif (routes > 0) {\n const successRate = dbStats.successfulRoutings > 0 ? Math.round((dbStats.successfulRoutings / routes) * 100) : 100;\n line3 += \\` \\${c.symbol}|\\${c.reset} \\${c.success}\\${successRate}% ā\\${c.reset}\\`;\n}\nlines.push(line3);\n\nconsole.log(lines.join('\\\\n'));\n`;\n fs.writeFileSync(statuslinePath, statuslineContent);\n console.log(` š Created: ${statuslinePath}`);\n }\n\n // Hooks run exactly this release, never a dist-tag\n const spec = packageSpec();\n\n // Create settings with full capabilities\n const settings = {\n env: {\n AGENTIC_FLOW_INTELLIGENCE: 'true',\n AGENTIC_FLOW_LEARNING_RATE: '0.1',\n AGENTIC_FLOW_MEMORY_BACKEND: 'agentdb',\n AGENTIC_FLOW_WORKERS_ENABLED: 'true',\n AGENTIC_FLOW_MAX_WORKERS: '10'\n },\n hooks: {\n PreToolUse: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} hooks pre-edit \"$TOOL_INPUT_file_path\"`\n }\n ]\n },\n {\n matcher: 'Bash',\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} hooks pre-command \"$TOOL_INPUT_command\"`\n }\n ]\n }\n ],\n PostToolUse: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} hooks post-edit \"$TOOL_INPUT_file_path\" --success`\n }\n ]\n }\n ],\n PostToolUseFailure: [\n {\n matcher: 'Edit|Write',\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} hooks post-edit \"$TOOL_INPUT_file_path\" --fail --error \"$ERROR_MESSAGE\"`\n }\n ]\n }\n ],\n SessionStart: [\n {\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} hooks intelligence stats`\n }\n ]\n },\n {\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} workers status --active --json 2>/dev/null || true`\n }\n ]\n }\n ],\n SessionEnd: [\n {\n hooks: [\n {\n type: 'command',\n command: `npx ${spec} workers cleanup --age 24 2>/dev/null || true`\n }\n ]\n }\n ],\n UserPromptSubmit: [\n {\n hooks: [\n {\n type: 'command',\n timeout: 2000,\n command: `npx ${spec} hooks intelligence stats`\n }\n ]\n },\n {\n hooks: [\n {\n type: 'command',\n timeout: 5000,\n background: true,\n command: `npx ${spec} workers dispatch-prompt \"$USER_PROMPT\" --session \"$SESSION_ID\" --json 2>/dev/null || true`\n }\n ]\n }\n ]\n },\n // Same rule as init: no npx/npm or whole MCP servers, which would\n // let any package or tool run without a prompt.\n permissions: {\n allow: [\n 'Bash(agentic-flow:*)'\n ]\n },\n statusLine: options.statusline !== false ? {\n type: 'command',\n command: 'node .claude/statusline.mjs'\n } : undefined\n };\n\n fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));\n console.log('ā
Hooks initialized!');\n console.log(` š Created: ${settingsPath}`);\n console.log('\\nš” Next steps:');\n console.log(` 1. Run: npx ${spec} hooks pretrain`);\n console.log(` 2. Run: npx ${spec} hooks build-agents`);\n console.log(' 3. Start using Claude Code with intelligent routing!');\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // ============================================\n // RUVECTOR INTELLIGENCE COMMANDS\n // SONA Micro-LoRA + MoE Attention + HNSW\n // ============================================\n\n // Create intelligence subcommand group\n const intelligence = new Command('intelligence')\n .alias('intel')\n .description('RuVector intelligence: SONA Micro-LoRA (~0.05ms) + MoE attention + HNSW (150x faster)');\n\n // Intelligence route command\n intelligence\n .command('route <task>')\n .description('Route task using SONA + MoE + HNSW (150x faster than brute force)')\n .option('-f, --file <path>', 'File context')\n .option('-e, --error <context>', 'Error context for debugging')\n .option('-k, --top-k <n>', 'Number of candidates', parseInt, 5)\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n file?: string;\n error?: string;\n topK?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceRouteTool.execute(\n { task, file: options.file, errorContext: options.error, topK: options.topK },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nā” RuVector Intelligence Route`);\n console.log(`šÆ Agent: ${result.agent}`);\n console.log(`š Confidence: ${((result.confidence || 0) * 100).toFixed(1)}%`);\n console.log(`š§ Engine: ${result.engine}`);\n console.log(`ā±ļø Latency: ${result.latencyMs?.toFixed(2)}ms`);\n if (result.features?.length > 0) {\n console.log(`š§ Features: ${result.features.join(', ')}`);\n }\n if (result.alternatives?.length > 0) {\n console.log(`\\nš Alternatives:`);\n result.alternatives.forEach((a: any) => {\n console.log(` - ${a.agent} (${((a.confidence || 0) * 100).toFixed(1)}%)`);\n });\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory start command\n intelligence\n .command('trajectory-start <task>')\n .description('Begin SONA trajectory for reinforcement learning')\n .requiredOption('-a, --agent <name>', 'Agent executing the task')\n .option('-c, --context <text>', 'Additional context')\n .option('-j, --json', 'Output as JSON')\n .action(async (task: string, options: {\n agent: string;\n context?: string;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceTrajectoryStartTool.execute(\n { task, agent: options.agent, context: options.context },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš¬ Trajectory Started`);\n console.log(`š ID: ${result.trajectoryId}`);\n console.log(`š¤ Agent: ${options.agent}`);\n console.log(`š§ Features: ${result.features?.join(', ')}`);\n console.log(`\\nš” Use this ID with trajectory-step and trajectory-end commands`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory step command\n intelligence\n .command('trajectory-step <trajectoryId>')\n .description('Record step in trajectory for reinforcement learning')\n .requiredOption('-a, --action <action>', 'Action taken')\n .requiredOption('-r, --reward <n>', 'Reward signal (-1 to 1)', parseFloat)\n .option('-f, --file <path>', 'File involved')\n .option('--error-fixed', 'Mark as error fix')\n .option('--test-passed', 'Mark as test passed')\n .option('-j, --json', 'Output as JSON')\n .action(async (trajectoryId: string, options: {\n action: string;\n reward: number;\n file?: string;\n errorFixed?: boolean;\n testPassed?: boolean;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceTrajectoryStepTool.execute(\n {\n trajectoryId: parseInt(trajectoryId),\n action: options.action,\n reward: options.reward,\n file: options.file,\n errorFixed: options.errorFixed,\n testPassed: options.testPassed\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Step Recorded`);\n console.log(` Action: ${options.action}`);\n console.log(` Reward: ${options.reward}`);\n console.log(` Trajectory: ${trajectoryId}`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Trajectory end command\n intelligence\n .command('trajectory-end <trajectoryId>')\n .description('End trajectory and trigger SONA learning with EWC++')\n .option('-s, --success', 'Mark as successful')\n .option('-f, --fail', 'Mark as failed')\n .option('-q, --quality <n>', 'Quality score (0-1)', parseFloat, 0.8)\n .option('-j, --json', 'Output as JSON')\n .action(async (trajectoryId: string, options: {\n success?: boolean;\n fail?: boolean;\n quality?: number;\n json?: boolean;\n }) => {\n try {\n const success = options.success || !options.fail;\n const result = await intelligenceTrajectoryEndTool.execute(\n { trajectoryId: parseInt(trajectoryId), success, quality: options.quality },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Trajectory Completed`);\n console.log(` ${success ? 'ā
Success' : 'ā Failed'}`);\n console.log(` Quality: ${(options.quality || 0.8) * 100}%`);\n console.log(` Learning: EWC++ consolidation applied`);\n if (result.learningOutcome) {\n console.log(` Outcome: ${JSON.stringify(result.learningOutcome)}`);\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pattern store command\n intelligence\n .command('pattern-store')\n .description('Store pattern in ReasoningBank (HNSW-indexed)')\n .requiredOption('-t, --task <task>', 'Task description')\n .requiredOption('-r, --resolution <text>', 'How it was resolved')\n .option('-s, --score <n>', 'Success score (0-1)', parseFloat, 0.9)\n .option('-j, --json', 'Output as JSON')\n .action(async (options: {\n task: string;\n resolution: string;\n score?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligencePatternStoreTool.execute(\n { task: options.task, resolution: options.resolution, reward: options.score || 0.9 },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš¾ Pattern Stored`);\n console.log(` Task: ${options.task.slice(0, 50)}...`);\n console.log(` Score: ${((options.score || 0.9) * 100).toFixed(0)}%`);\n console.log(` Index: HNSW (150x faster retrieval)`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Pattern search command\n intelligence\n .command('pattern-search <query>')\n .description('Search ReasoningBank using HNSW (150x faster)')\n .option('-k, --top-k <n>', 'Number of results', parseInt, 5)\n .option('-m, --min-reward <n>', 'Minimum reward filter', parseFloat)\n .option('-j, --json', 'Output as JSON')\n .action(async (query: string, options: {\n topK?: number;\n minReward?: number;\n json?: boolean;\n }) => {\n try {\n const result = await intelligencePatternSearchTool.execute(\n { query, topK: options.topK, minReward: options.minReward },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Pattern Search Results`);\n console.log(` Query: \"${query.slice(0, 50)}\"`);\n console.log(` Engine: ${result.searchEngine}`);\n console.log(` Found: ${result.count} patterns`);\n if (result.patterns?.length > 0) {\n console.log(`\\n š Results:`);\n result.patterns.forEach((p: any, i: number) => {\n console.log(` ${i + 1}. [${((p.similarity || 0) * 100).toFixed(0)}%] ${p.resolution?.slice(0, 40)}...`);\n });\n }\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Intelligence stats command\n intelligence\n .command('stats')\n .description('Get RuVector intelligence layer statistics')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: { json?: boolean }) => {\n try {\n const result = await intelligenceStatsTool.execute({}, mockContext);\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš RuVector Intelligence Stats`);\n console.log(`\\nš§ SONA Engine:`);\n console.log(` Micro-LoRA: ${result.features?.sona?.microLora || 'rank-1 (~0.05ms)'}`);\n console.log(` Base-LoRA: ${result.features?.sona?.baseLora || 'rank-8'}`);\n console.log(` EWC Lambda: ${result.features?.sona?.ewcLambda || 1000.0}`);\n console.log(`\\nā” Attention:`);\n console.log(` Type: ${result.features?.attention?.type || 'moe'}`);\n console.log(` Experts: ${result.features?.attention?.experts || 4}`);\n console.log(` Top-K: ${result.features?.attention?.topK || 2}`);\n console.log(`\\nš HNSW:`);\n console.log(` Enabled: ${result.features?.hnsw?.enabled ?? true}`);\n console.log(` Speedup: ${result.features?.hnsw?.speedup || '150x vs brute-force'}`);\n console.log(`\\nš Learning:`);\n console.log(` Trajectories: ${result.persistence?.trajectories ?? result.stats?.trajectoryCount ?? 0}`);\n console.log(` Active: ${result.stats?.activeTrajectories || 0}`);\n console.log(`\\nš¾ Persistence (SQLite):`);\n console.log(` Backend: ${result.persistence?.backend || 'sqlite'}`);\n console.log(` Routings: ${result.persistence?.routings ?? 0}`);\n console.log(` Patterns: ${result.persistence?.patterns ?? 0}`);\n console.log(` Operations: ${result.persistence?.operations ?? 0}`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Force learning command\n intelligence\n .command('learn')\n .description('Force immediate SONA learning cycle with EWC++ consolidation')\n .option('-r, --reason <text>', 'Reason for forcing learning')\n .option('-j, --json', 'Output as JSON')\n .action(async (options: { reason?: string; json?: boolean }) => {\n try {\n const result = await intelligenceLearnTool.execute(\n { reason: options.reason },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš Learning Cycle Complete`);\n console.log(` ${result.success ? 'ā
' : 'ā'} ${result.message}`);\n console.log(` Reason: ${result.reason || 'manual trigger'}`);\n console.log(` Features: ${result.features?.join(', ')}`);\n console.log(` Latency: ${result.latencyMs?.toFixed(2)}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Attention compute command\n intelligence\n .command('attention <query>')\n .description('Compute attention-weighted similarity using MoE/Flash/Hyperbolic')\n .requiredOption('-c, --candidates <texts...>', 'Candidate texts to score')\n .option('-t, --type <type>', 'Attention type: moe|flash|hyperbolic|graph|dual', 'moe')\n .option('-j, --json', 'Output as JSON')\n .action(async (query: string, options: {\n candidates: string[];\n type?: string;\n json?: boolean;\n }) => {\n try {\n const result = await intelligenceAttentionTool.execute(\n {\n query,\n candidates: options.candidates,\n attentionType: options.type as 'moe' | 'flash' | 'hyperbolic' | 'graph' | 'dual'\n },\n mockContext\n );\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`\\nš§ Attention Scores (${options.type || 'moe'})`);\n console.log(` Query: \"${query.slice(0, 40)}...\"`);\n console.log(`\\n š Results:`);\n result.results?.forEach((r: any, i: number) => {\n const bar = 'ā'.repeat(Math.round(r.score * 20));\n console.log(` ${i + 1}. ${bar} ${(r.score * 100).toFixed(1)}% \"${r.text}\"`);\n });\n console.log(`\\n ā±ļø Latency: ${result.latencyMs?.toFixed(2)}ms`);\n }\n process.exit(0);\n } catch (error) {\n console.error('Error:', error instanceof Error ? error.message : error);\n process.exit(1);\n }\n });\n\n // Add intelligence subcommand to hooks\n hooks.addCommand(intelligence);\n\n return hooks;\n}\n\nexport default createHooksCommand;\n\n// CLI entry point when run directly\nconst isDirectRun = import.meta.url === `file://${process.argv[1]}`;\nif (isDirectRun) {\n const hooks = createHooksCommand();\n hooks.parse(process.argv);\n}\n"]}
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
* Creates .claude/ folder structure and configuration files for Claude Code integration
|
|
5
5
|
* Copies all agents, commands, skills, and helpers from the package
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* exactly this release instead of whatever the @alpha tag points at later.
|
|
10
|
-
*/
|
|
11
|
-
export declare function readPackageVersion(): string;
|
|
7
|
+
import { readPackageVersion } from '../../utils/package-version.js';
|
|
8
|
+
export { readPackageVersion };
|
|
12
9
|
/**
|
|
13
10
|
* settings.json written by `init`. Hooks and the MCP server are pinned to
|
|
14
11
|
* `version`. Permissions do not pre-approve npx/npm or whole MCP servers:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";AACA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKpE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAqN9B;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,MAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwF3E;AAmED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuIrE"}
|
|
@@ -7,23 +7,10 @@
|
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
|
+
import { readPackageVersion } from '../../utils/package-version.js';
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
12
|
-
|
|
13
|
-
* The installed package version, so generated hooks and the MCP server run
|
|
14
|
-
* exactly this release instead of whatever the @alpha tag points at later.
|
|
15
|
-
*/
|
|
16
|
-
export function readPackageVersion() {
|
|
17
|
-
try {
|
|
18
|
-
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../../package.json'), 'utf-8'));
|
|
19
|
-
if (typeof pkg.version === 'string' && /^\d+\.\d+\.\d+[\w.+-]*$/.test(pkg.version))
|
|
20
|
-
return pkg.version;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
// fall through
|
|
24
|
-
}
|
|
25
|
-
return 'latest';
|
|
26
|
-
}
|
|
13
|
+
export { readPackageVersion };
|
|
27
14
|
const PACKAGE_SPEC = `agentic-flow@${readPackageVersion()}`;
|
|
28
15
|
const CLAUDE_MD_TEMPLATE = `# Claude Code Configuration - Agentic Flow
|
|
29
16
|
|