claude-flow 3.7.0-alpha.29 → 3.7.0-alpha.30

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "3.7.0-alpha.29",
3
+ "version": "3.7.0-alpha.30",
4
4
  "description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -1394,14 +1394,44 @@ export const hooksPretrain = {
1394
1394
  // (readdirSync/statSync already imported statically at the top.)
1395
1395
  const extCounts = {};
1396
1396
  let filesAnalyzed = 0;
1397
+ // #1953: separate budget for code files. The old code gated the
1398
+ // import-pattern extraction on `filesAnalyzed <= 50`, which counts
1399
+ // EVERY directory entry (including .md/.yaml/.db/.log). In any
1400
+ // markdown/docs-heavy repo, the depth-first walker burned through the
1401
+ // 50-file budget on non-code files before reaching any source — so
1402
+ // `patternsExtracted: 0` even when hundreds of `.ts`/`.js` files existed.
1403
+ let codeFilesScanned = 0;
1397
1404
  let totalLines = 0;
1398
1405
  const maxDepth = depth === 'shallow' ? 2 : depth === 'deep' ? 6 : 4;
1399
1406
  const patterns = [];
1407
+ // #1953: recurse into directories that typically contain code first
1408
+ // (`src/`, `apps/`, `packages/`, `lib/`, `crates/`, `workers/`, `server/`)
1409
+ // before docs / specs / planning dirs, so the import-extraction budget
1410
+ // is spent on the highest-signal directories even in mixed repos.
1411
+ const CODE_DIR_PREFIXES = new Set([
1412
+ 'src', 'apps', 'packages', 'lib', 'crates', 'workers',
1413
+ 'server', 'backend', 'frontend', 'app', 'cli', 'core',
1414
+ ]);
1415
+ const scoreEntry = (name) => {
1416
+ if (CODE_DIR_PREFIXES.has(name))
1417
+ return 0;
1418
+ // Deprioritise common docs / output directories.
1419
+ if (/^(docs?|specs?|_.*|examples?|samples?|out|build|target|coverage|tests?)$/.test(name))
1420
+ return 2;
1421
+ return 1;
1422
+ };
1400
1423
  const scan = (dir, currentDepth) => {
1401
1424
  if (currentDepth > maxDepth)
1402
1425
  return;
1403
1426
  try {
1404
1427
  const entries = readdirSync(dir, { withFileTypes: true });
1428
+ // Sort: code-likely dirs first, files mixed in by name, deprioritised
1429
+ // dirs last. Stable for deterministic test behaviour.
1430
+ entries.sort((a, b) => {
1431
+ const sa = a.isDirectory() ? scoreEntry(a.name) : 1;
1432
+ const sb = b.isDirectory() ? scoreEntry(b.name) : 1;
1433
+ return sa - sb;
1434
+ });
1405
1435
  for (const entry of entries) {
1406
1436
  if (entry.name.startsWith('.') || entry.name === 'node_modules' || entry.name === 'dist')
1407
1437
  continue;
@@ -1415,15 +1445,18 @@ export const hooksPretrain = {
1415
1445
  extCounts[ext] = (extCounts[ext] || 0) + 1;
1416
1446
  filesAnalyzed++;
1417
1447
  // For code files, count lines and extract imports
1418
- if (['.ts', '.js', '.py', '.go', '.rs', '.java'].includes(ext)) {
1448
+ if (['.ts', '.js', '.tsx', '.jsx', '.mjs', '.cjs', '.py', '.go', '.rs', '.java'].includes(ext)) {
1419
1449
  try {
1420
1450
  const content = readFileSync(full, 'utf-8');
1421
1451
  const lines = content.split('\n');
1422
1452
  totalLines += lines.length;
1423
- // Extract import patterns (first 50 files max for performance)
1424
- if (filesAnalyzed <= 50) {
1425
- for (const line of lines.slice(0, 30)) {
1426
- if (line.startsWith('import ') || line.startsWith('from ') || line.startsWith('const ') && line.includes('require(')) {
1453
+ // #1953: gate on the code-file count, not every-file count.
1454
+ // Also widened the per-file scan window from 30 → 80 lines:
1455
+ // modern TS files often have license headers + JSDoc + type
1456
+ // imports before the first `import` statement.
1457
+ if (++codeFilesScanned <= 50) {
1458
+ for (const line of lines.slice(0, 80)) {
1459
+ if (line.startsWith('import ') || line.startsWith('from ') || (line.startsWith('const ') && line.includes('require('))) {
1427
1460
  const trimmed = line.trim();
1428
1461
  if (trimmed.length < 120 && !patterns.includes(trimmed))
1429
1462
  patterns.push(trimmed);
@@ -1458,7 +1491,7 @@ export const hooksPretrain = {
1458
1491
  // #1847: when the corpus contains files but no patterns were extracted
1459
1492
  // (typical for Markdown vaults), make the source-code-only extraction
1460
1493
  // contract explicit so users don't conclude the hook system is broken.
1461
- const SUPPORTED_EXTRACTION_EXTS = ['.ts', '.js', '.py', '.go', '.rs', '.java'];
1494
+ const SUPPORTED_EXTRACTION_EXTS = ['.ts', '.js', '.tsx', '.jsx', '.mjs', '.cjs', '.py', '.go', '.rs', '.java'];
1462
1495
  let note;
1463
1496
  if (filesAnalyzed > 0 && patterns.length === 0) {
1464
1497
  const codeFileCount = SUPPORTED_EXTRACTION_EXTS.reduce((sum, ext) => sum + (extCounts[ext] ?? 0), 0);
@@ -104,6 +104,15 @@ function resolveProjectMemoryDir(claudeProjectsDir, projectPathOverride) {
104
104
  candidates.add(stripped);
105
105
  // Candidate 4: spaces replaced with dashes (Claude Code's space rule)
106
106
  candidates.add(source.replace(/\//g, '-').replace(/ /g, '-'));
107
+ // Candidate 5 (#1939): native Win32 path on a Win32 Claude Code install.
108
+ // `C:\Users\tobia\OneDrive\Desktop\Claude Stuff` →
109
+ // `C--Users-tobia-OneDrive-Desktop-Claude-Stuff`. Claude Code's on-disk
110
+ // slug replaces drive-colon AND backslashes AND whitespace with `-`.
111
+ // The earlier candidates only handled forward slashes, so a Win32+Win32
112
+ // setup never matched.
113
+ if (/^[A-Za-z]:[\\/]/.test(source)) {
114
+ candidates.add(source.replace(/[:\\/]/g, '-').replace(/\s+/g, '-'));
115
+ }
107
116
  }
108
117
  for (const projectHash of candidates) {
109
118
  const memDir = join(claudeProjectsDir, projectHash, 'memory');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.7.0-alpha.29",
3
+ "version": "3.7.0-alpha.30",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",