moflo 4.6.12 → 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 (30) hide show
  1. package/.claude/settings.json +4 -4
  2. package/.claude/workflow-state.json +1 -5
  3. package/README.md +1 -1
  4. package/bin/hooks.mjs +7 -3
  5. package/bin/setup-project.mjs +1 -1
  6. package/package.json +1 -1
  7. package/src/@claude-flow/cli/README.md +452 -7536
  8. package/src/@claude-flow/cli/dist/src/commands/doctor.js +1 -1
  9. package/src/@claude-flow/cli/dist/src/commands/embeddings.js +4 -4
  10. package/src/@claude-flow/cli/dist/src/commands/init.js +35 -8
  11. package/src/@claude-flow/cli/dist/src/commands/swarm.js +2 -2
  12. package/src/@claude-flow/cli/dist/src/init/claudemd-generator.js +316 -294
  13. package/src/@claude-flow/cli/dist/src/init/executor.js +461 -465
  14. package/src/@claude-flow/cli/dist/src/init/helpers-generator.d.ts +0 -36
  15. package/src/@claude-flow/cli/dist/src/init/helpers-generator.js +146 -1124
  16. package/src/@claude-flow/cli/dist/src/init/index.d.ts +1 -1
  17. package/src/@claude-flow/cli/dist/src/init/index.js +1 -1
  18. package/src/@claude-flow/cli/dist/src/init/moflo-init.js +78 -5
  19. package/src/@claude-flow/cli/dist/src/init/settings-generator.js +50 -120
  20. package/src/@claude-flow/cli/dist/src/mcp-tools/hooks-tools.js +275 -32
  21. package/src/@claude-flow/cli/dist/src/plugins/store/discovery.js +4 -204
  22. package/src/@claude-flow/cli/dist/src/plugins/tests/standalone-test.js +4 -4
  23. package/src/@claude-flow/cli/dist/src/runtime/headless.d.ts +3 -3
  24. package/src/@claude-flow/cli/dist/src/runtime/headless.js +31 -31
  25. package/src/@claude-flow/cli/dist/src/services/agentic-flow-bridge.d.ts +3 -3
  26. package/src/@claude-flow/cli/dist/src/services/agentic-flow-bridge.js +3 -1
  27. package/src/@claude-flow/cli/dist/src/services/headless-worker-executor.js +14 -0
  28. package/src/@claude-flow/cli/dist/src/services/workflow-gate.js +21 -1
  29. package/src/@claude-flow/cli/dist/src/transfer/store/tests/standalone-test.js +4 -4
  30. package/src/@claude-flow/cli/package.json +1 -1
@@ -4,9 +4,9 @@
4
4
  * Runs without TTY for daemon processes and scheduled tasks
5
5
  *
6
6
  * Usage:
7
- * npx @claude-flow/cli headless --worker <type>
8
- * npx @claude-flow/cli headless --daemon
9
- * npx @claude-flow/cli headless --benchmark
7
+ * npx moflo headless --worker <type>
8
+ * npx moflo headless --daemon
9
+ * npx moflo headless --benchmark
10
10
  *
11
11
  * Environment:
12
12
  * CLAUDE_FLOW_HEADLESS=true
@@ -62,34 +62,34 @@ function parseArgs() {
62
62
  * Show help message
63
63
  */
64
64
  function showHelp() {
65
- console.log(`
66
- Headless Runtime for MoFlo V4
67
-
68
- Usage:
69
- headless --worker <type> Run a specific worker
70
- headless --daemon Start background daemon
71
- headless --benchmark Run performance benchmarks
72
- headless --status Show system status
73
-
74
- Workers: ${HEADLESS_WORKER_TYPES.join(', ')}
75
-
76
- Options:
77
- -w, --worker <type> Worker type to run
78
- -d, --daemon Run as daemon
79
- -b, --benchmark Run benchmarks
80
- -s, --status Show status
81
- -t, --timeout <ms> Execution timeout (default: 60000)
82
- -v, --verbose Verbose output
83
- -h, --help Show help
84
-
85
- Environment:
86
- CLAUDE_FLOW_HEADLESS=true Enable headless mode
87
- CLAUDE_CODE_HEADLESS=true Enable Claude Code headless
88
-
89
- Examples:
90
- headless --worker audit --timeout 120000
91
- headless --daemon
92
- headless --benchmark
65
+ console.log(`
66
+ Headless Runtime for MoFlo V4
67
+
68
+ Usage:
69
+ headless --worker <type> Run a specific worker
70
+ headless --daemon Start background daemon
71
+ headless --benchmark Run performance benchmarks
72
+ headless --status Show system status
73
+
74
+ Workers: ${HEADLESS_WORKER_TYPES.join(', ')}
75
+
76
+ Options:
77
+ -w, --worker <type> Worker type to run
78
+ -d, --daemon Run as daemon
79
+ -b, --benchmark Run benchmarks
80
+ -s, --status Show status
81
+ -t, --timeout <ms> Execution timeout (default: 60000)
82
+ -v, --verbose Verbose output
83
+ -h, --help Show help
84
+
85
+ Environment:
86
+ CLAUDE_FLOW_HEADLESS=true Enable headless mode
87
+ CLAUDE_CODE_HEADLESS=true Enable Claude Code headless
88
+
89
+ Examples:
90
+ headless --worker audit --timeout 120000
91
+ headless --daemon
92
+ headless --benchmark
93
93
  `);
94
94
  }
95
95
  /**
@@ -12,17 +12,17 @@
12
12
  * Returns null if agentic-flow is not installed.
13
13
  * Race-safe: concurrent callers share the same import Promise.
14
14
  */
15
- export declare function getReasoningBank(): Promise<typeof import("agentic-flow/reasoningbank") | null>;
15
+ export declare function getReasoningBank(): Promise<any>;
16
16
  /**
17
17
  * Load the ModelRouter module (multi-provider LLM routing).
18
18
  * Returns null if agentic-flow is not installed.
19
19
  */
20
- export declare function getRouter(): Promise<typeof import("agentic-flow/router") | null>;
20
+ export declare function getRouter(): Promise<any>;
21
21
  /**
22
22
  * Load the Orchestration module (workflow engine).
23
23
  * Returns null if agentic-flow is not installed.
24
24
  */
25
- export declare function getOrchestration(): Promise<typeof import("agentic-flow/orchestration") | null>;
25
+ export declare function getOrchestration(): Promise<any>;
26
26
  /**
27
27
  * Compute an embedding vector via ReasoningBank, falling back to null.
28
28
  */
@@ -43,7 +43,9 @@ export function getRouter() {
43
43
  */
44
44
  export function getOrchestration() {
45
45
  if (_orchestrationP === null) {
46
- _orchestrationP = import('agentic-flow/orchestration').catch(() => null);
46
+ // Use dynamic string to prevent vite from statically resolving the subpath
47
+ const mod = 'agentic-flow' + '/orchestration';
48
+ _orchestrationP = import(/* @vite-ignore */ mod).catch(() => null);
47
49
  }
48
50
  return _orchestrationP;
49
51
  }
@@ -374,6 +374,20 @@ export class HeadlessWorkerExecutor extends EventEmitter {
374
374
  };
375
375
  // Ensure log directory exists
376
376
  this.ensureLogDir();
377
+ // Kill child processes on parent exit to prevent orphaned node processes.
378
+ // Uses 'exit' (not 'beforeExit') so it fires even on explicit process.exit().
379
+ // The handler must be synchronous — no async work allowed in 'exit' handlers.
380
+ process.on('exit', () => {
381
+ for (const [, entry] of this.processPool) {
382
+ try {
383
+ clearTimeout(entry.timeout);
384
+ entry.process.kill('SIGTERM');
385
+ }
386
+ catch {
387
+ // Process already gone — ignore
388
+ }
389
+ }
390
+ });
377
391
  }
378
392
  // ============================================
379
393
  // Public API
@@ -177,7 +177,7 @@ export class WorkflowGateService {
177
177
  if (now - lastBlocked > 2000) {
178
178
  state.lastBlockedAt = new Date(now).toISOString();
179
179
  this.writeState(state);
180
- message = 'BLOCKED: Search memory before exploring files. Use mcp__claude-flow__memory_search with namespace "code-map", "patterns", or "guidance".';
180
+ message = 'BLOCKED: Search memory before exploring files. Use mcp__claude-flow__memory_search with namespace "code-map", "patterns", "knowledge", or "guidance".';
181
181
  }
182
182
  return { allowed: false, message };
183
183
  }
@@ -351,6 +351,26 @@ export function processGateCommand(command, env = process.env) {
351
351
  console.log(bracket);
352
352
  process.exit(0);
353
353
  }
354
+ case 'compact-guidance': {
355
+ console.log('Pre-Compact Guidance:');
356
+ console.log('IMPORTANT: Before compacting, preserve key context:');
357
+ console.log(' - Check CLAUDE.md for project rules and architecture');
358
+ console.log(' - Memory namespaces: guidance, code-map, patterns, knowledge');
359
+ console.log(' - Use memory search to recover context after compact');
360
+ console.log(' - Batch all operations in single messages (GOLDEN RULE)');
361
+ process.exit(0);
362
+ }
363
+ case 'check-dangerous-command': {
364
+ const cmd = (env.TOOL_INPUT_command || '').toLowerCase();
365
+ const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:', 'mkfs.', '> /dev/sda'];
366
+ for (const pattern of dangerous) {
367
+ if (cmd.includes(pattern)) {
368
+ console.log(`[BLOCKED] Dangerous command detected: ${pattern}`);
369
+ process.exit(2);
370
+ }
371
+ }
372
+ process.exit(0);
373
+ }
354
374
  case 'session-reset':
355
375
  gate.sessionReset();
356
376
  process.exit(0);
@@ -175,10 +175,10 @@ async function main() {
175
175
  console.log(' 🎉 All tests passed! Pattern Store is working correctly.');
176
176
  console.log('');
177
177
  console.log(' Available CLI Commands:');
178
- console.log(' npx @claude-flow/cli patterns list');
179
- console.log(' npx @claude-flow/cli patterns list --featured');
180
- console.log(' npx @claude-flow/cli patterns search -q "agent"');
181
- console.log(' npx @claude-flow/cli patterns info -n <pattern-id>');
178
+ console.log(' npx moflo patterns list');
179
+ console.log(' npx moflo patterns list --featured');
180
+ console.log(' npx moflo patterns search -q "agent"');
181
+ console.log(' npx moflo patterns info -n <pattern-id>');
182
182
  console.log('');
183
183
  }
184
184
  process.exit(failed > 0 ? 1 : 0);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moflo/cli",
3
- "version": "4.6.12",
3
+ "version": "4.7.1",
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",