claude-flow 3.7.0-alpha.81 → 3.7.0

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.81",
3
+ "version": "3.7.0",
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",
@@ -33,9 +33,26 @@ function getProcessMemoryUsage() {
33
33
  return (usedMemory / totalMemory) * 100;
34
34
  }
35
35
  // Check if project is initialized
36
+ //
37
+ // #2120 — the old check required `.claude-flow/config.yaml`, which
38
+ // missed projects that were initialized via `ruflo memory init` (writes
39
+ // `.swarm/memory.db` but no config.yaml) or via the auto-memory bridge.
40
+ // Reporter @alexandrelealbess on WSL2 had a 251-entry `.swarm/memory.db`
41
+ // and a running MCP, yet `ruflo status` reported "not initialized".
42
+ //
43
+ // Now: any of these signals counts as initialized:
44
+ // - `.claude-flow/config.yaml` (the canonical `ruflo init` output)
45
+ // - `.claude-flow/config.json` (same, alt format)
46
+ // - `.swarm/memory.db` (the `ruflo memory init` output)
47
+ // - `.claude/settings.json` (the Claude Code hook surface)
36
48
  function isInitialized(cwd) {
37
- const configPath = path.join(cwd, '.claude-flow', 'config.yaml');
38
- return fs.existsSync(configPath);
49
+ const candidates = [
50
+ path.join(cwd, '.claude-flow', 'config.yaml'),
51
+ path.join(cwd, '.claude-flow', 'config.json'),
52
+ path.join(cwd, '.swarm', 'memory.db'),
53
+ path.join(cwd, '.claude', 'settings.json'),
54
+ ];
55
+ return candidates.some((p) => fs.existsSync(p));
39
56
  }
40
57
  // Format uptime
41
58
  function formatUptime(ms) {
@@ -729,10 +729,19 @@ export async function bridgeListEntries(options) {
729
729
  const { namespace, limit = 20, offset = 0 } = options;
730
730
  const nsFilter = namespace ? `AND namespace = ?` : '';
731
731
  const nsParams = namespace ? [namespace] : [];
732
+ // #2120 — `status IS NULL` accepted alongside `'active'`. Old
733
+ // databases imported by the auto-memory bridge (before the status
734
+ // column existed) end up with NULL status after schema migration if
735
+ // the migration ran on an existing DB without a backfill. Reporter
736
+ // @alexandrelealbess on WSL2 had 251 entries with NULL status, so
737
+ // the `status = 'active'` filter matched zero. Treat NULL as
738
+ // "legacy-active" — the safe default for any entry that predates the
739
+ // status column.
740
+ const statusFilter = `(status = 'active' OR status IS NULL)`;
732
741
  // Count
733
742
  let total = 0;
734
743
  try {
735
- const countStmt = ctx.db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE status = 'active' ${nsFilter}`);
744
+ const countStmt = ctx.db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE ${statusFilter} ${nsFilter}`);
736
745
  const countRow = countStmt.get(...nsParams);
737
746
  total = countRow?.cnt ?? 0;
738
747
  }
@@ -745,7 +754,7 @@ export async function bridgeListEntries(options) {
745
754
  const stmt = ctx.db.prepare(`
746
755
  SELECT id, key, namespace, content, embedding, access_count, created_at, updated_at
747
756
  FROM memory_entries
748
- WHERE status = 'active' ${nsFilter}
757
+ WHERE ${statusFilter} ${nsFilter}
749
758
  ORDER BY updated_at DESC
750
759
  LIMIT ? OFFSET ?
751
760
  `);
@@ -921,6 +921,23 @@ export async function ensureSchemaColumns(dbPath) {
921
921
  }
922
922
  }
923
923
  }
924
+ // #2120 — Belt-and-suspenders backfill. `ALTER TABLE ADD COLUMN
925
+ // status TEXT DEFAULT 'active'` should populate existing rows with
926
+ // 'active' in modern SQLite, but: (a) some auto-memory bridge writes
927
+ // happen via INSERT paths that pass an explicit NULL, (b) some
928
+ // historical sql.js builds skipped the DEFAULT backfill, (c)
929
+ // entries can be migrated in from older snapshots. After ensuring
930
+ // the column exists, force-backfill any remaining NULL → 'active'.
931
+ // Safe on already-correct DBs (0 rows updated).
932
+ if (columnsAdded.includes('status') || existingColumns.has('status')) {
933
+ try {
934
+ db.run(`UPDATE memory_entries SET status = 'active' WHERE status IS NULL`);
935
+ modified = true;
936
+ }
937
+ catch {
938
+ /* table is read-only or doesn't exist — skip */
939
+ }
940
+ }
924
941
  if (modified) {
925
942
  // Save updated database
926
943
  const data = db.export();
@@ -2080,10 +2097,13 @@ export async function listEntries(options) {
2080
2097
  const SQL = await initSqlJs();
2081
2098
  const fileBuffer = readFileMaybeEncrypted(dbPath, null);
2082
2099
  const db = new SQL.Database(fileBuffer);
2100
+ // #2120 — accept `status IS NULL` alongside `'active'`. Old DBs
2101
+ // that predate the status column may have NULL after migration.
2102
+ // See memory-bridge.ts:bridgeListEntries for full context.
2083
2103
  // Get total count
2084
2104
  const countStmt = namespace
2085
- ? db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE status = 'active' AND namespace = ?`)
2086
- : db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE status = 'active'`);
2105
+ ? db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE (status = 'active' OR status IS NULL) AND namespace = ?`)
2106
+ : db.prepare(`SELECT COUNT(*) as cnt FROM memory_entries WHERE (status = 'active' OR status IS NULL)`);
2087
2107
  if (namespace) {
2088
2108
  countStmt.bind([namespace]);
2089
2109
  }
@@ -2097,9 +2117,10 @@ export async function listEntries(options) {
2097
2117
  // Get entries
2098
2118
  const safeLimit = parseInt(String(limit), 10) || 100;
2099
2119
  const safeOffset = parseInt(String(offset), 10) || 0;
2120
+ // #2120 — same NULL-as-active acceptance as the count above.
2100
2121
  const listStmt = namespace
2101
- ? db.prepare(`SELECT id, key, namespace, content, embedding, access_count, created_at, updated_at FROM memory_entries WHERE status = 'active' AND namespace = ? ORDER BY updated_at DESC LIMIT ? OFFSET ?`)
2102
- : db.prepare(`SELECT id, key, namespace, content, embedding, access_count, created_at, updated_at FROM memory_entries WHERE status = 'active' ORDER BY updated_at DESC LIMIT ? OFFSET ?`);
2122
+ ? db.prepare(`SELECT id, key, namespace, content, embedding, access_count, created_at, updated_at FROM memory_entries WHERE (status = 'active' OR status IS NULL) AND namespace = ? ORDER BY updated_at DESC LIMIT ? OFFSET ?`)
2123
+ : db.prepare(`SELECT id, key, namespace, content, embedding, access_count, created_at, updated_at FROM memory_entries WHERE (status = 'active' OR status IS NULL) ORDER BY updated_at DESC LIMIT ? OFFSET ?`);
2103
2124
  if (namespace) {
2104
2125
  listStmt.bind([namespace, safeLimit, safeOffset]);
2105
2126
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.7.0-alpha.81",
3
+ "version": "3.7.0",
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",