@claude-flow/cli 3.0.0-alpha.66 → 3.0.0-alpha.68
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/README.md +106 -1
- package/dist/src/commands/embeddings.d.ts.map +1 -1
- package/dist/src/commands/embeddings.js +151 -26
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +54 -14
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +73 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/migrate.d.ts.map +1 -1
- package/dist/src/commands/migrate.js +14 -2
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -596,7 +596,7 @@ const explainCommand = {
|
|
|
596
596
|
// Pretrain subcommand
|
|
597
597
|
const pretrainCommand = {
|
|
598
598
|
name: 'pretrain',
|
|
599
|
-
description: 'Bootstrap intelligence from repository (4-step pipeline)',
|
|
599
|
+
description: 'Bootstrap intelligence from repository (4-step pipeline + embeddings)',
|
|
600
600
|
options: [
|
|
601
601
|
{
|
|
602
602
|
name: 'path',
|
|
@@ -618,17 +618,41 @@ const pretrainCommand = {
|
|
|
618
618
|
description: 'Skip cached analysis',
|
|
619
619
|
type: 'boolean',
|
|
620
620
|
default: false
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: 'with-embeddings',
|
|
624
|
+
description: 'Index documents for semantic search during pretraining',
|
|
625
|
+
type: 'boolean',
|
|
626
|
+
default: true
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'embedding-model',
|
|
630
|
+
description: 'ONNX embedding model',
|
|
631
|
+
type: 'string',
|
|
632
|
+
default: 'all-MiniLM-L6-v2',
|
|
633
|
+
choices: ['all-MiniLM-L6-v2', 'all-mpnet-base-v2']
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
name: 'file-types',
|
|
637
|
+
description: 'File extensions to index (comma-separated)',
|
|
638
|
+
type: 'string',
|
|
639
|
+
default: 'ts,js,py,md,json'
|
|
621
640
|
}
|
|
622
641
|
],
|
|
623
642
|
examples: [
|
|
624
|
-
{ command: 'claude-flow hooks pretrain', description: 'Pretrain
|
|
625
|
-
{ command: 'claude-flow hooks pretrain -p ../my-project --depth deep', description: 'Deep analysis of specific project' }
|
|
643
|
+
{ command: 'claude-flow hooks pretrain', description: 'Pretrain with embeddings indexing' },
|
|
644
|
+
{ command: 'claude-flow hooks pretrain -p ../my-project --depth deep', description: 'Deep analysis of specific project' },
|
|
645
|
+
{ command: 'claude-flow hooks pretrain --no-with-embeddings', description: 'Skip embedding indexing' },
|
|
646
|
+
{ command: 'claude-flow hooks pretrain --file-types ts,tsx,js', description: 'Index only TypeScript/JS files' }
|
|
626
647
|
],
|
|
627
648
|
action: async (ctx) => {
|
|
628
|
-
const
|
|
649
|
+
const repoPath = ctx.flags.path || '.';
|
|
629
650
|
const depth = ctx.flags.depth || 'medium';
|
|
651
|
+
const withEmbeddings = ctx.flags['with-embeddings'] !== false && ctx.flags.withEmbeddings !== false;
|
|
652
|
+
const embeddingModel = (ctx.flags['embedding-model'] || ctx.flags.embeddingModel || 'all-MiniLM-L6-v2');
|
|
653
|
+
const fileTypes = (ctx.flags['file-types'] || ctx.flags.fileTypes || 'ts,js,py,md,json');
|
|
630
654
|
output.writeln();
|
|
631
|
-
output.writeln(output.bold('Pretraining Intelligence (4-Step Pipeline)'));
|
|
655
|
+
output.writeln(output.bold('Pretraining Intelligence (4-Step Pipeline + Embeddings)'));
|
|
632
656
|
output.writeln();
|
|
633
657
|
const steps = [
|
|
634
658
|
{ name: 'RETRIEVE', desc: 'Top-k memory injection with MMR diversity' },
|
|
@@ -636,6 +660,10 @@ const pretrainCommand = {
|
|
|
636
660
|
{ name: 'DISTILL', desc: 'Extract strategy memories from trajectories' },
|
|
637
661
|
{ name: 'CONSOLIDATE', desc: 'Dedup, detect contradictions, prune old patterns' }
|
|
638
662
|
];
|
|
663
|
+
// Add embedding steps if enabled
|
|
664
|
+
if (withEmbeddings) {
|
|
665
|
+
steps.push({ name: 'EMBED', desc: `Index documents with ${embeddingModel} (ONNX)` }, { name: 'HYPERBOLIC', desc: 'Project to Poincaré ball for hierarchy preservation' });
|
|
666
|
+
}
|
|
639
667
|
const spinner = output.createSpinner({ text: 'Starting pretraining...', spinner: 'dots' });
|
|
640
668
|
try {
|
|
641
669
|
spinner.start();
|
|
@@ -646,9 +674,12 @@ const pretrainCommand = {
|
|
|
646
674
|
}
|
|
647
675
|
// Call MCP tool for pretraining
|
|
648
676
|
const result = await callMCPTool('hooks/pretrain', {
|
|
649
|
-
path,
|
|
677
|
+
path: repoPath,
|
|
650
678
|
depth,
|
|
651
679
|
skipCache: ctx.flags.skipCache || false,
|
|
680
|
+
withEmbeddings,
|
|
681
|
+
embeddingModel,
|
|
682
|
+
fileTypes: fileTypes.split(',').map((t) => t.trim()),
|
|
652
683
|
});
|
|
653
684
|
spinner.succeed('Pretraining completed');
|
|
654
685
|
if (ctx.flags.format === 'json') {
|
|
@@ -656,22 +687,31 @@ const pretrainCommand = {
|
|
|
656
687
|
return { success: true, data: result };
|
|
657
688
|
}
|
|
658
689
|
output.writeln();
|
|
690
|
+
// Base stats
|
|
691
|
+
const tableData = [
|
|
692
|
+
{ metric: 'Files Analyzed', value: result.stats.filesAnalyzed },
|
|
693
|
+
{ metric: 'Patterns Extracted', value: result.stats.patternsExtracted },
|
|
694
|
+
{ metric: 'Strategies Learned', value: result.stats.strategiesLearned },
|
|
695
|
+
{ metric: 'Trajectories Evaluated', value: result.stats.trajectoriesEvaluated },
|
|
696
|
+
{ metric: 'Contradictions Resolved', value: result.stats.contradictionsResolved },
|
|
697
|
+
];
|
|
698
|
+
// Add embedding stats if available
|
|
699
|
+
if (withEmbeddings && result.stats.documentsIndexed !== undefined) {
|
|
700
|
+
tableData.push({ metric: 'Documents Indexed', value: result.stats.documentsIndexed }, { metric: 'Embeddings Generated', value: result.stats.embeddingsGenerated || 0 }, { metric: 'Hyperbolic Projections', value: result.stats.hyperbolicProjections || 0 });
|
|
701
|
+
}
|
|
702
|
+
tableData.push({ metric: 'Duration', value: `${(result.duration / 1000).toFixed(1)}s` });
|
|
659
703
|
output.printTable({
|
|
660
704
|
columns: [
|
|
661
705
|
{ key: 'metric', header: 'Metric', width: 30 },
|
|
662
706
|
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
663
707
|
],
|
|
664
|
-
data:
|
|
665
|
-
{ metric: 'Files Analyzed', value: result.stats.filesAnalyzed },
|
|
666
|
-
{ metric: 'Patterns Extracted', value: result.stats.patternsExtracted },
|
|
667
|
-
{ metric: 'Strategies Learned', value: result.stats.strategiesLearned },
|
|
668
|
-
{ metric: 'Trajectories Evaluated', value: result.stats.trajectoriesEvaluated },
|
|
669
|
-
{ metric: 'Contradictions Resolved', value: result.stats.contradictionsResolved },
|
|
670
|
-
{ metric: 'Duration', value: `${(result.duration / 1000).toFixed(1)}s` }
|
|
671
|
-
]
|
|
708
|
+
data: tableData
|
|
672
709
|
});
|
|
673
710
|
output.writeln();
|
|
674
711
|
output.printSuccess('Repository intelligence bootstrapped successfully');
|
|
712
|
+
if (withEmbeddings) {
|
|
713
|
+
output.writeln(output.dim(' Semantic search enabled: Use "embeddings search -q <query>" to search'));
|
|
714
|
+
}
|
|
675
715
|
output.writeln(output.dim(' Next step: Run "claude-flow hooks build-agents" to generate optimized configs'));
|
|
676
716
|
return { success: true, data: result };
|
|
677
717
|
}
|