moflo 4.8.29 → 4.8.31

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.
@@ -33,46 +33,24 @@ npx flo doctor --fix # Verify everything is working
33
33
 
34
34
  ## Building from Source
35
35
 
36
- Moflo is a TypeScript monorepo using **project references** (`tsc -b`). The root `tsconfig.json` is a solution-style config that delegates to `src/tsconfig.json`, which references all 17 `@claude-flow/*` sub-packages.
36
+ **Full instructions: [`docs/BUILD.md`](../../../docs/BUILD.md)** the canonical, step-by-step build/test/publish process. Always follow it.
37
37
 
38
- ### Build Commands
38
+ Quick reference (from project root only):
39
39
 
40
40
  ```bash
41
- npm run build # Runs tsc -b (project references build)
42
- npm run build:ts # Build @claude-flow/cli only (legacy shortcut)
43
- npm run build:guidance # Build @claude-flow/guidance only (legacy shortcut)
41
+ git pull origin main # ALWAYS pull first
42
+ npm run build # tsc -b (project references)
43
+ npm test # 0 failures required
44
+ npm version patch --no-git-tag-version # Bump + sync cli version
45
+ npm run build # Rebuild with new version
46
+ npm publish --otp=XXX # Requires 2FA OTP
44
47
  ```
45
48
 
46
- ### Architecture
47
-
48
- ```
49
- tsconfig.json → Solution root (references src/)
50
- src/tsconfig.json → References all @claude-flow/* packages
51
- src/tsconfig.base.json → Shared compilerOptions (ES2022, bundler, composite)
52
- src/@claude-flow/shared/ → Base types (no deps)
53
- src/@claude-flow/cli/ → CLI + MCP server (depends on shared, swarm)
54
- src/@claude-flow/hooks/ → Hook system (depends on shared, neural, memory)
55
- src/@claude-flow/memory/ → Memory backends (no deps)
56
- src/@claude-flow/guidance/ → Guidance indexing (depends on hooks)
57
- src/@claude-flow/testing/ → Regression tests (depends on shared, memory, swarm)
58
- ... (17 packages total)
59
- ```
60
-
61
- ### Important Rules
62
-
63
- 1. **Always build from root** — `npm run build` (which runs `tsc -b`) builds all packages in dependency order. Do NOT build individual packages in isolation unless you know what you're doing.
64
- 2. **Never bypass the build** — The `dist/` directories contain compiled JS that ships with `npm publish`. If you edit `.ts` source, you MUST rebuild before publishing.
65
- 3. **Do not work around build errors** — If `tsc -b` fails, fix the type errors. Do not manually compile individual packages to skip errors, as this leads to drift between source and compiled output.
66
- 4. **Sub-packages need `composite: true`** — Every sub-package tsconfig must have `"composite": true` in compilerOptions for project references to work.
67
- 5. **Cross-package imports need `paths`** — If package A imports from `@claude-flow/B`, package A's tsconfig needs both a `"references"` entry and a `"paths"` mapping pointing to B's source.
68
-
69
- ### Publishing
70
-
71
- ```bash
72
- npm version patch # Bump version (auto-syncs cli sub-package version)
73
- npm run build # MUST succeed with zero errors
74
- npm publish --otp=XXX # Requires 2FA OTP
75
- ```
49
+ **Critical rules:**
50
+ - npm only — no pnpm, yarn, or bun
51
+ - Always build from root (`npm run build`) — never cd into subdirectories
52
+ - Never publish without a successful build — `prepublishOnly` masks failures
53
+ - Never publish without tests passing
76
54
 
77
55
  ---
78
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.8.29",
3
+ "version": "4.8.31",
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",
@@ -12,7 +12,8 @@ async function getRealSearchFunction() {
12
12
  const { searchEntries } = await import('../memory/memory-initializer.js');
13
13
  searchEntriesFn = searchEntries;
14
14
  }
15
- catch {
15
+ catch (err) {
16
+ console.error('[hooks-tools] Failed to load memory-initializer searchEntries:', err instanceof Error ? err.message : String(err));
16
17
  searchEntriesFn = null;
17
18
  }
18
19
  }
@@ -26,7 +27,8 @@ async function getRealStoreFunction() {
26
27
  const { storeEntry } = await import('../memory/memory-initializer.js');
27
28
  storeEntryFn = storeEntry;
28
29
  }
29
- catch {
30
+ catch (err) {
31
+ console.error('[hooks-tools] Failed to load memory-initializer storeEntry:', err instanceof Error ? err.message : String(err));
30
32
  storeEntryFn = null;
31
33
  }
32
34
  }
@@ -1410,11 +1412,15 @@ export const hooksPretrain = {
1410
1412
  handler: async (params) => {
1411
1413
  const repoPath = resolve(params.path || '.');
1412
1414
  const depth = params.depth || 'medium';
1413
- const fileTypesStr = params.fileTypes || 'ts,js,py,md';
1415
+ // Handle fileTypes as either string ("ts,js,py") or array (["ts","js","py"])
1416
+ const rawFileTypes = params.fileTypes;
1417
+ const fileTypesArr = Array.isArray(rawFileTypes)
1418
+ ? rawFileTypes.map((t) => String(t).trim())
1419
+ : (typeof rawFileTypes === 'string' ? rawFileTypes : 'ts,js,py,md').split(',').map(e => e.trim());
1414
1420
  const startTime = Date.now();
1415
1421
  // Determine file limit by depth
1416
1422
  const fileLimit = depth === 'deep' ? 100 : depth === 'shallow' ? 30 : 60;
1417
- const extensions = new Set(fileTypesStr.split(',').map(e => e.trim()));
1423
+ const extensions = new Set(fileTypesArr);
1418
1424
  // Phase 1: Retrieve - collect source files
1419
1425
  const retrieveStart = Date.now();
1420
1426
  const files = collectFiles(repoPath, extensions, fileLimit);
@@ -1460,7 +1466,7 @@ export const hooksPretrain = {
1460
1466
  return {
1461
1467
  path: repoPath,
1462
1468
  depth,
1463
- fileTypes: fileTypesStr,
1469
+ fileTypes: fileTypesArr.join(','),
1464
1470
  stats: {
1465
1471
  filesAnalyzed: files.length,
1466
1472
  patternsExtracted: patterns.length,
@@ -2274,7 +2280,7 @@ export const hooksPatternSearch = {
2274
2280
  query: { type: 'string', description: 'Search query' },
2275
2281
  topK: { type: 'number', description: 'Number of results' },
2276
2282
  minConfidence: { type: 'number', description: 'Minimum similarity threshold (0-1)' },
2277
- namespace: { type: 'string', description: 'Namespace to search (default: pattern)' },
2283
+ namespace: { type: 'string', description: 'Namespace to search (default: patterns)' },
2278
2284
  },
2279
2285
  required: ['query'],
2280
2286
  },
@@ -2282,7 +2288,7 @@ export const hooksPatternSearch = {
2282
2288
  const query = params.query;
2283
2289
  const topK = params.topK || 5;
2284
2290
  const minConfidence = params.minConfidence || 0.3;
2285
- const namespace = params.namespace || 'pattern';
2291
+ const namespace = params.namespace || 'patterns';
2286
2292
  // Phase 3: Try ReasoningBank search via bridge first
2287
2293
  try {
2288
2294
  const bridge = await import('../memory/memory-bridge.js');
@@ -2338,7 +2344,7 @@ export const hooksPatternSearch = {
2338
2344
  results: [],
2339
2345
  searchTimeMs: searchResult.searchTime,
2340
2346
  backend: 'real-vector-search',
2341
- note: searchResult.error || 'No matching patterns found. Store patterns first using memory/store with namespace "pattern".',
2347
+ note: searchResult.error || 'No matching patterns found. Store patterns first using memory/store with namespace "patterns".',
2342
2348
  };
2343
2349
  }
2344
2350
  catch (error) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.8.29",
3
+ "version": "4.8.31",
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",