moflo 4.6.11 → 4.7.1

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.
Files changed (35) hide show
  1. package/.claude/helpers/hook-handler.cjs +35 -6
  2. package/.claude/settings.json +4 -4
  3. package/.claude/workflow-state.json +5 -0
  4. package/README.md +11 -1
  5. package/bin/hooks.mjs +519 -0
  6. package/bin/session-start-launcher.mjs +63 -0
  7. package/bin/setup-project.mjs +1 -1
  8. package/package.json +3 -2
  9. package/src/@claude-flow/cli/README.md +452 -7536
  10. package/src/@claude-flow/cli/dist/src/commands/doctor.js +1 -1
  11. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +4 -4
  12. package/src/@claude-flow/cli/dist/src/commands/init.js +35 -8
  13. package/src/@claude-flow/cli/dist/src/commands/swarm.js +2 -2
  14. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +316 -294
  15. package/src/@claude-flow/cli/dist/src/init/executor.js +461 -465
  16. package/src/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +0 -36
  17. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +146 -1124
  18. package/src/@claude-flow/cli/dist/src/init/index.d.ts +1 -1
  19. package/src/@claude-flow/cli/dist/src/init/index.js +1 -1
  20. package/src/@claude-flow/cli/dist/src/init/mcp-generator.js +6 -3
  21. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +108 -424
  22. package/src/@claude-flow/cli/dist/src/init/settings-generator.js +50 -120
  23. package/src/@claude-flow/cli/dist/src/init/types.d.ts +2 -0
  24. package/src/@claude-flow/cli/dist/src/init/types.js +2 -0
  25. package/src/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +275 -32
  26. package/src/@claude-flow/cli/dist/src/plugins/store/discovery.js +4 -204
  27. package/src/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +4 -4
  28. package/src/@claude-flow/cli/dist/src/runtime/headless.d.ts +3 -3
  29. package/src/@claude-flow/cli/dist/src/runtime/headless.js +31 -31
  30. package/src/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +3 -3
  31. package/src/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +3 -1
  32. package/src/@claude-flow/cli/dist/src/services/headless-worker-executor.js +14 -0
  33. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +21 -1
  34. package/src/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +4 -4
  35. package/src/@claude-flow/cli/package.json +1 -1
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Fast session-start launcher — single hook that replaces all SessionStart entries.
4
+ *
5
+ * Spawns background tasks via spawn(detached + unref) and exits immediately.
6
+ *
7
+ * Invoked by: node .claude/scripts/session-start-launcher.mjs
8
+ */
9
+
10
+ import { spawn } from 'child_process';
11
+ import { existsSync } from 'fs';
12
+ import { resolve, dirname } from 'path';
13
+ import { fileURLToPath } from 'url';
14
+
15
+ const __dirname = dirname(fileURLToPath(import.meta.url));
16
+ const projectRoot = resolve(__dirname, '../..');
17
+
18
+ // ── 1. Helper: fire-and-forget a background process ─────────────────────────
19
+ function fireAndForget(cmd, args, label) {
20
+ try {
21
+ const proc = spawn(cmd, args, {
22
+ cwd: projectRoot,
23
+ stdio: 'ignore', // Don't hold stdio pipes open
24
+ detached: true, // New process group
25
+ shell: false,
26
+ windowsHide: true // No console popup on Windows
27
+ });
28
+ proc.unref(); // Let this process exit without waiting
29
+ } catch {
30
+ // If spawn fails (e.g. node not found), don't block startup
31
+ }
32
+ }
33
+
34
+ // ── 2. Reset workflow state for new session ──────────────────────────────────
35
+ import { writeFileSync, mkdirSync } from 'fs';
36
+ const stateDir = resolve(projectRoot, '.claude');
37
+ const stateFile = resolve(stateDir, 'workflow-state.json');
38
+ try {
39
+ if (!existsSync(stateDir)) mkdirSync(stateDir, { recursive: true });
40
+ writeFileSync(stateFile, JSON.stringify({
41
+ tasksCreated: false,
42
+ taskCount: 0,
43
+ memorySearched: false,
44
+ sessionStart: new Date().toISOString()
45
+ }, null, 2));
46
+ } catch {
47
+ // Non-fatal - workflow gate will use defaults
48
+ }
49
+
50
+ // ── 3. Spawn background tasks ───────────────────────────────────────────────
51
+ const localCli = resolve(projectRoot, 'node_modules/moflo/src/@claude-flow/cli/bin/cli.js');
52
+ const hasLocalCli = existsSync(localCli);
53
+
54
+ // hooks.mjs session-start (daemon, indexer, pretrain, HNSW, neural patterns)
55
+ const hooksScript = resolve(projectRoot, '.claude/scripts/hooks.mjs');
56
+ if (existsSync(hooksScript)) {
57
+ fireAndForget('node', [hooksScript, 'session-start'], 'hooks session-start');
58
+ }
59
+
60
+ // Patches are now baked into moflo@4.0.0 source — no runtime patching needed.
61
+
62
+ // ── 4. Done — exit immediately ──────────────────────────────────────────────
63
+ process.exit(0);
@@ -41,7 +41,7 @@ Your first tool call for every new user prompt MUST be a memory search. Do this
41
41
  WHY: Memory contains curated solutions, patterns, and architectural context from previous work. Without it, you will miss existing solutions, repeat mistakes that were already solved, and waste time re-discovering what is already known. Memory search is faster than file scanning.
42
42
 
43
43
  HOW: Use ToolSearch to load \`mcp__claude-flow__memory_search\`, then call it with a query describing your task. If MCP is unavailable, use:
44
- \`node .claude/scripts/semantic-search.mjs "[task description]" --namespace guidance\`
44
+ \`node bin/semantic-search.mjs "[task description]" --namespace guidance\`
45
45
 
46
46
  ### Namespaces to search:
47
47
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "moflo",
3
- "version": "4.6.11",
3
+ "version": "4.7.1",
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",
@@ -56,7 +56,8 @@
56
56
  "security:audit": "npm audit --audit-level high",
57
57
  "security:fix": "npm audit fix",
58
58
  "security:test": "npm run test:security",
59
- "moflo:security": "npm run security:audit && npm run security:test"
59
+ "moflo:security": "npm run security:audit && npm run security:test",
60
+ "version": "node -e \"const v=require('./package.json').version;const p='src/@claude-flow/cli/package.json';const j=JSON.parse(require('fs').readFileSync(p));j.version=v;require('fs').writeFileSync(p,JSON.stringify(j,null,2)+'\\n')\" && git add src/@claude-flow/cli/package.json"
60
61
  },
61
62
  "dependencies": {
62
63
  "@ruvector/learning-wasm": "^0.1.29",