moflo 4.8.6 → 4.8.8

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.
@@ -501,6 +501,25 @@ async function main() {
501
501
 
502
502
  log('═══════════════════════════════════════════════════════════');
503
503
 
504
+ // Update vector-stats cache for statusline display
505
+ try {
506
+ const dbSizeKB = Math.floor(readFileSync(DB_PATH).length / 1024);
507
+ const hnswExists = existsSync(resolve(projectRoot, '.swarm', 'hnsw.index'))
508
+ || existsSync(resolve(projectRoot, '.claude-flow', 'hnsw.index'));
509
+ const cacheData = {
510
+ vectorCount: stats.withEmbeddings,
511
+ dbSizeKB,
512
+ namespaces: nsStats.length,
513
+ hasHnsw: hnswExists,
514
+ updatedAt: Date.now(),
515
+ };
516
+ // Write to both locations so statusline finds it regardless of which dir it checks
517
+ for (const cacheDir of [resolve(projectRoot, '.claude-flow'), resolve(projectRoot, '.swarm')]) {
518
+ if (!existsSync(cacheDir)) mkdirSync(cacheDir, { recursive: true });
519
+ writeFileSync(resolve(cacheDir, 'vector-stats.json'), JSON.stringify(cacheData));
520
+ }
521
+ } catch { /* non-fatal */ }
522
+
504
523
  db.close();
505
524
  }
506
525
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.8.6",
3
+ "version": "4.8.8",
4
4
  "description": "MoFlo — AI agent orchestration for Claude Code. Forked from ruflo/claude-flow with patches applied to source, plus feature-level orchestration.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -83,7 +83,7 @@
83
83
  "@types/bcrypt": "^5.0.2",
84
84
  "@types/node": "^20.19.37",
85
85
  "eslint": "^8.0.0",
86
- "moflo": "^4.8.4",
86
+ "moflo": "^4.8.6",
87
87
  "tsx": "^4.21.0",
88
88
  "typescript": "^5.9.3",
89
89
  "vitest": "^4.0.0"
@@ -15,6 +15,44 @@ import { fileURLToPath } from 'url';
15
15
  // ============================================================================
16
16
  // Init
17
17
  // ============================================================================
18
+ /**
19
+ * Discover guidance directories by checking top-level candidates AND walking
20
+ * the project tree for subproject .claude/guidance dirs (monorepo support).
21
+ */
22
+ function discoverGuidanceDirs(root) {
23
+ const TOP_LEVEL = ['.claude/guidance', 'docs/guides', 'docs', 'architecture', 'adr', '.cursor/rules'];
24
+ const found = TOP_LEVEL.filter(d => fs.existsSync(path.join(root, d)));
25
+ // Walk up to 3 levels deep looking for .claude/guidance in subprojects
26
+ const SKIP = new Set(['node_modules', '.git', 'dist', 'build', 'coverage', '.next', '.reports', '.swarm', '.claude-flow', 'packages']);
27
+ function walk(dir, depth) {
28
+ if (depth > 3)
29
+ return;
30
+ try {
31
+ const entries = fs.readdirSync(path.join(root, dir), { withFileTypes: true });
32
+ for (const entry of entries) {
33
+ if (!entry.isDirectory() || SKIP.has(entry.name))
34
+ continue;
35
+ const rel = dir ? `${dir}/${entry.name}` : entry.name;
36
+ const guidancePath = `${rel}/.claude/guidance`;
37
+ if (fs.existsSync(path.join(root, guidancePath))) {
38
+ // Verify it has .md files
39
+ try {
40
+ const files = fs.readdirSync(path.join(root, guidancePath));
41
+ if (files.some(f => f.endsWith('.md')))
42
+ found.push(guidancePath);
43
+ }
44
+ catch { /* skip unreadable */ }
45
+ }
46
+ else {
47
+ walk(rel, depth + 1);
48
+ }
49
+ }
50
+ }
51
+ catch { /* skip unreadable directories */ }
52
+ }
53
+ walk('', 0);
54
+ return found;
55
+ }
18
56
  /**
19
57
  * Discover source directories by walking the project tree.
20
58
  * Finds directories named 'src' (or top-level 'packages', 'lib', etc.)
@@ -71,8 +109,7 @@ function discoverSrcDirs(root) {
71
109
  async function runWizard(root) {
72
110
  const { confirm, input } = await import('../prompt.js');
73
111
  // Detect project structure
74
- const guidanceCandidates = ['.claude/guidance', 'docs/guides', 'docs', 'architecture', 'adr', '.cursor/rules'];
75
- const detectedGuidance = guidanceCandidates.filter(d => fs.existsSync(path.join(root, d)));
112
+ const detectedGuidance = discoverGuidanceDirs(root);
76
113
  const detectedSrc = discoverSrcDirs(root);
77
114
  // Ask questions
78
115
  const guidance = await confirm({
@@ -117,8 +154,7 @@ async function runWizard(root) {
117
154
  * Get default answers (--yes mode).
118
155
  */
119
156
  function defaultAnswers(root) {
120
- const guidanceCandidates = ['.claude/guidance', 'docs/guides', 'docs', 'architecture', 'adr', '.cursor/rules'];
121
- const guidanceDirs = guidanceCandidates.filter(d => fs.existsSync(path.join(root, d)));
157
+ const guidanceDirs = discoverGuidanceDirs(root);
122
158
  if (guidanceDirs.length === 0)
123
159
  guidanceDirs.push('.claude/guidance');
124
160
  const srcDirs = discoverSrcDirs(root);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.8.6",
3
+ "version": "4.8.8",
4
4
  "type": "module",
5
5
  "description": "MoFlo CLI — AI agent orchestration with specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",