@claude-flow/cli 3.0.0-alpha.146 → 3.0.0-alpha.147

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.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AAm8H1E,eAAO,MAAM,YAAY,EAAE,OAiG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AAyjI1E,eAAO,MAAM,YAAY,EAAE,OAiG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -2725,7 +2725,59 @@ const statuslineCommand = {
2725
2725
  catch {
2726
2726
  // Ignore
2727
2727
  }
2728
- const intelligencePct = Math.min(100, Math.floor((learning.patterns / 10) * 1));
2728
+ // Calculate intelligence from multiple sources (matching statusline-generator.ts)
2729
+ let intelligencePct = 0;
2730
+ // 1. Check learning.json for REAL intelligence metrics first
2731
+ const learningJsonPaths = [
2732
+ path.join(process.cwd(), '.claude-flow', 'learning.json'),
2733
+ path.join(process.cwd(), '.claude', '.claude-flow', 'learning.json'),
2734
+ path.join(process.cwd(), '.swarm', 'learning.json'),
2735
+ ];
2736
+ for (const lPath of learningJsonPaths) {
2737
+ if (fs.existsSync(lPath)) {
2738
+ try {
2739
+ const data = JSON.parse(fs.readFileSync(lPath, 'utf-8'));
2740
+ if (data.intelligence?.score !== undefined) {
2741
+ intelligencePct = Math.min(100, Math.floor(data.intelligence.score));
2742
+ break;
2743
+ }
2744
+ }
2745
+ catch { /* ignore */ }
2746
+ }
2747
+ }
2748
+ // 2. Fallback: calculate from patterns and vectors
2749
+ if (intelligencePct === 0) {
2750
+ const fromPatterns = learning.patterns > 0 ? Math.min(100, Math.floor(learning.patterns / 10)) : 0;
2751
+ // Will be updated later with vector count
2752
+ intelligencePct = fromPatterns;
2753
+ }
2754
+ // 3. Fallback: calculate maturity score from project indicators
2755
+ if (intelligencePct === 0) {
2756
+ let maturityScore = 0;
2757
+ // Check for key project files/dirs
2758
+ if (fs.existsSync(path.join(process.cwd(), '.claude')))
2759
+ maturityScore += 15;
2760
+ if (fs.existsSync(path.join(process.cwd(), '.claude-flow')))
2761
+ maturityScore += 15;
2762
+ if (fs.existsSync(path.join(process.cwd(), 'CLAUDE.md')))
2763
+ maturityScore += 10;
2764
+ if (fs.existsSync(path.join(process.cwd(), 'claude-flow.config.json')))
2765
+ maturityScore += 10;
2766
+ if (fs.existsSync(path.join(process.cwd(), '.swarm')))
2767
+ maturityScore += 10;
2768
+ // Check for test files
2769
+ const testDirs = ['tests', '__tests__', 'test', 'v3/__tests__'];
2770
+ for (const dir of testDirs) {
2771
+ if (fs.existsSync(path.join(process.cwd(), dir))) {
2772
+ maturityScore += 10;
2773
+ break;
2774
+ }
2775
+ }
2776
+ // Check for hooks config
2777
+ if (fs.existsSync(path.join(process.cwd(), '.claude', 'settings.json')))
2778
+ maturityScore += 10;
2779
+ intelligencePct = Math.min(100, maturityScore);
2780
+ }
2729
2781
  const contextPct = Math.min(100, Math.floor(learning.sessions * 5));
2730
2782
  return { memoryMB, contextPct, intelligencePct, subAgents };
2731
2783
  }
@@ -2816,24 +2868,94 @@ const statuslineCommand = {
2816
2868
  }
2817
2869
  catch { /* ignore */ }
2818
2870
  }
2819
- // Get AgentDB stats
2871
+ // Get AgentDB stats (matching statusline-generator.ts paths)
2820
2872
  const agentdbStats = { vectorCount: 0, dbSizeKB: 0, hasHnsw: false };
2821
- const agentdbPaths = [
2822
- path.join(process.cwd(), '.claude-flow', 'memory', 'agentdb.db'),
2873
+ // Check for direct database files first
2874
+ const dbPaths = [
2823
2875
  path.join(process.cwd(), '.swarm', 'memory.db'),
2876
+ path.join(process.cwd(), '.claude-flow', 'memory.db'),
2877
+ path.join(process.cwd(), '.claude', 'memory.db'),
2878
+ path.join(process.cwd(), 'data', 'memory.db'),
2879
+ path.join(process.cwd(), 'memory.db'),
2880
+ path.join(process.cwd(), '.agentdb', 'memory.db'),
2881
+ path.join(process.cwd(), '.claude-flow', 'memory', 'agentdb.db'),
2824
2882
  ];
2825
- for (const dbPath of agentdbPaths) {
2883
+ for (const dbPath of dbPaths) {
2826
2884
  if (fs.existsSync(dbPath)) {
2827
2885
  try {
2828
2886
  const stats = fs.statSync(dbPath);
2829
2887
  agentdbStats.dbSizeKB = Math.round(stats.size / 1024);
2830
- agentdbStats.vectorCount = Math.floor(agentdbStats.dbSizeKB / 4);
2888
+ agentdbStats.vectorCount = Math.floor(agentdbStats.dbSizeKB / 2);
2831
2889
  agentdbStats.hasHnsw = agentdbStats.vectorCount > 100;
2832
2890
  break;
2833
2891
  }
2834
2892
  catch { /* ignore */ }
2835
2893
  }
2836
2894
  }
2895
+ // Check for AgentDB directories if no direct db found
2896
+ if (agentdbStats.vectorCount === 0) {
2897
+ const agentdbDirs = [
2898
+ path.join(process.cwd(), '.claude-flow', 'agentdb'),
2899
+ path.join(process.cwd(), '.swarm', 'agentdb'),
2900
+ path.join(process.cwd(), 'data', 'agentdb'),
2901
+ path.join(process.cwd(), '.agentdb'),
2902
+ ];
2903
+ for (const dir of agentdbDirs) {
2904
+ if (fs.existsSync(dir)) {
2905
+ try {
2906
+ const files = fs.readdirSync(dir);
2907
+ for (const f of files) {
2908
+ if (f.endsWith('.db') || f.endsWith('.sqlite')) {
2909
+ const filePath = path.join(dir, f);
2910
+ const fileStat = fs.statSync(filePath);
2911
+ agentdbStats.dbSizeKB += Math.round(fileStat.size / 1024);
2912
+ }
2913
+ }
2914
+ agentdbStats.vectorCount = Math.floor(agentdbStats.dbSizeKB / 2);
2915
+ agentdbStats.hasHnsw = agentdbStats.vectorCount > 100;
2916
+ if (agentdbStats.vectorCount > 0)
2917
+ break;
2918
+ }
2919
+ catch { /* ignore */ }
2920
+ }
2921
+ }
2922
+ }
2923
+ // Check for HNSW index files
2924
+ const hnswPaths = [
2925
+ path.join(process.cwd(), '.claude-flow', 'hnsw'),
2926
+ path.join(process.cwd(), '.swarm', 'hnsw'),
2927
+ path.join(process.cwd(), 'data', 'hnsw'),
2928
+ ];
2929
+ for (const hnswPath of hnswPaths) {
2930
+ if (fs.existsSync(hnswPath)) {
2931
+ agentdbStats.hasHnsw = true;
2932
+ try {
2933
+ const hnswFiles = fs.readdirSync(hnswPath);
2934
+ const indexFile = hnswFiles.find(f => f.endsWith('.index'));
2935
+ if (indexFile) {
2936
+ const indexStat = fs.statSync(path.join(hnswPath, indexFile));
2937
+ const hnswVectors = Math.floor(indexStat.size / 512);
2938
+ agentdbStats.vectorCount = Math.max(agentdbStats.vectorCount, hnswVectors);
2939
+ }
2940
+ }
2941
+ catch { /* ignore */ }
2942
+ break;
2943
+ }
2944
+ }
2945
+ // Check for vectors.json file
2946
+ const vectorsPath = path.join(process.cwd(), '.claude-flow', 'vectors.json');
2947
+ if (fs.existsSync(vectorsPath) && agentdbStats.vectorCount === 0) {
2948
+ try {
2949
+ const data = JSON.parse(fs.readFileSync(vectorsPath, 'utf-8'));
2950
+ if (Array.isArray(data)) {
2951
+ agentdbStats.vectorCount = data.length;
2952
+ }
2953
+ else if (data.vectors) {
2954
+ agentdbStats.vectorCount = Object.keys(data.vectors).length;
2955
+ }
2956
+ }
2957
+ catch { /* ignore */ }
2958
+ }
2837
2959
  // Get test stats
2838
2960
  const testStats = { testFiles: 0, testCases: 0 };
2839
2961
  const testPaths = ['tests', '__tests__', 'test', 'spec'];