@claude-flow/cli 3.56.6 → 3.56.8
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/.claude/helpers/auto-memory-hook.mjs +109 -10
- package/.claude/helpers/helpers.manifest.json +4 -4
- package/.claude/helpers/intelligence.cjs +57 -4
- package/README.md +9 -3
- package/bin/cli.js +11 -1
- package/bin/mcp-server.js +11 -1
- package/catalog-manifest.json +2 -2
- package/dist/src/commands/coverage-reader.d.ts +29 -0
- package/dist/src/commands/coverage-reader.js +247 -0
- package/dist/src/commands/doctor-native-addon.d.ts +23 -0
- package/dist/src/commands/doctor-native-addon.js +135 -0
- package/dist/src/commands/doctor.js +3 -0
- package/dist/src/commands/hooks.js +17 -181
- package/dist/src/commands/index.js +2 -0
- package/dist/src/commands/init.d.ts +2 -0
- package/dist/src/commands/init.js +37 -5
- package/dist/src/commands/mods.d.ts +3 -0
- package/dist/src/commands/mods.js +19 -5
- package/dist/src/commands/tui.d.ts +12 -0
- package/dist/src/commands/tui.js +98 -0
- package/dist/src/fs-secure.d.ts +25 -0
- package/dist/src/fs-secure.js +51 -2
- package/dist/src/init/executor.js +11 -14
- package/dist/src/init/helper-commands.d.ts +2 -0
- package/dist/src/init/helper-commands.js +2 -0
- package/dist/src/init/helpers-generator.js +4 -1
- package/dist/src/init/settings-generator.js +3 -3
- package/dist/src/mcp-server.js +10 -2
- package/dist/src/mcp-tools/capability-brain.d.ts +1 -1
- package/dist/src/mcp-tools/capability-brain.js +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +26 -4
- package/dist/src/mcp-tools/memory-tools.js +2 -1
- package/dist/src/memory/live-memory-row.d.ts +3 -1
- package/dist/src/memory/live-memory-row.js +3 -1
- package/dist/src/memory/memory-bridge.d.ts +4 -0
- package/dist/src/memory/memory-bridge.js +3 -2
- package/dist/src/memory/memory-initializer.d.ts +4 -0
- package/dist/src/memory/memory-initializer.js +12 -11
- package/dist/src/mods/claude-installs.js +7 -3
- package/dist/src/mods/install.js +32 -12
- package/dist/src/mods/plugin-resolve.js +3 -1
- package/dist/src/mods/probe.js +92 -4
- package/dist/src/services/command-recording.d.ts +17 -0
- package/dist/src/services/command-recording.js +91 -0
- package/dist/src/services/policy-ledger-anchor.js +20 -2
- package/node_modules/@claude-flow/codex/README.md +20 -3
- package/node_modules/@claude-flow/codex/dist/cli.js +7 -0
- package/node_modules/@claude-flow/codex/dist/cli.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/index.d.ts +3 -3
- package/node_modules/@claude-flow/codex/dist/index.js +1 -1
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts +8 -3
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/dist/initializer.js +75 -13
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/types.d.ts +8 -0
- package/node_modules/@claude-flow/codex/dist/types.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/package.json +1 -1
- package/package.json +3 -3
- package/plugins/ruflo-console/dist/tui.mjs +279 -0
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
* node auto-memory-hook.mjs status # Show bridge status
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
15
|
-
import {
|
|
14
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, unlinkSync, rmdirSync, rmSync, statSync } from 'fs';
|
|
15
|
+
import { execFileSync } from 'child_process';
|
|
16
|
+
import { homedir } from 'os';
|
|
17
|
+
import { join, dirname, resolve, sep } from 'path';
|
|
16
18
|
import { fileURLToPath } from 'url';
|
|
17
19
|
|
|
18
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -77,6 +79,66 @@ process.on('SIGINT', () => { gracefulExit('SIGINT'); });
|
|
|
77
79
|
// Ensure data dir
|
|
78
80
|
if (!existsSync(DATA_DIR)) mkdirSync(DATA_DIR, { recursive: true });
|
|
79
81
|
|
|
82
|
+
// ============================================================================
|
|
83
|
+
// Store write safety (#4058): intelligence.cjs read-modify-writes the same
|
|
84
|
+
// file from the session-end hook, so writes are atomic (temp + rename) and
|
|
85
|
+
// serialised by a short directory lock. The lock is advisory and fails open:
|
|
86
|
+
// a hook must never hang, so after ~2 s it proceeds without it.
|
|
87
|
+
// ============================================================================
|
|
88
|
+
|
|
89
|
+
const LOCK_WAIT_MS = 2000;
|
|
90
|
+
const LOCK_STALE_MS = 10000;
|
|
91
|
+
function sleepSync(ms) { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); }
|
|
92
|
+
|
|
93
|
+
function withStoreLock(storePath, fn) {
|
|
94
|
+
const lock = storePath + '.lock';
|
|
95
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
96
|
+
let held = false;
|
|
97
|
+
for (;;) {
|
|
98
|
+
try { mkdirSync(lock); held = true; break; } catch (e) {
|
|
99
|
+
if (!e || e.code !== 'EEXIST') break;
|
|
100
|
+
try {
|
|
101
|
+
if (Date.now() - statSync(lock).mtimeMs > LOCK_STALE_MS) { rmSync(lock, { recursive: true, force: true }); continue; }
|
|
102
|
+
} catch { /* lock vanished: retry */ }
|
|
103
|
+
if (Date.now() > deadline) break;
|
|
104
|
+
sleepSync(10);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
try { return fn(); } finally { if (held) { try { rmdirSync(lock); } catch { /* already gone */ } } }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function writeFileAtomic(filePath, text) {
|
|
111
|
+
const tmp = filePath + '.' + process.pid + '.tmp';
|
|
112
|
+
try {
|
|
113
|
+
writeFileSync(tmp, text, 'utf-8');
|
|
114
|
+
renameSync(tmp, filePath);
|
|
115
|
+
} catch (e) {
|
|
116
|
+
try { unlinkSync(tmp); } catch { /* nothing to clean */ }
|
|
117
|
+
throw e;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Claude Code shares one auto-memory directory across every worktree of a
|
|
122
|
+
// repository, but findGitRoot() in the memory package stops at a worktree's
|
|
123
|
+
// `.git` FILE and keys the directory by the worktree path (#4058). Resolve the
|
|
124
|
+
// main checkout through git's common dir so both agree. No shell is involved.
|
|
125
|
+
function mainCheckoutRoot(dir) {
|
|
126
|
+
try {
|
|
127
|
+
if (!statSync(join(dir, '.git')).isFile()) return null;
|
|
128
|
+
const common = execFileSync('git', ['rev-parse', '--git-common-dir'], { cwd: dir, encoding: 'utf8', timeout: 5000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
129
|
+
if (!common) return null;
|
|
130
|
+
const abs = resolve(dir, common);
|
|
131
|
+
return abs.endsWith('/.git') || abs.endsWith('\\.git') ? dirname(abs) : null;
|
|
132
|
+
} catch { return null; }
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function worktreeMemoryDir() {
|
|
136
|
+
const main = mainCheckoutRoot(PROJECT_ROOT);
|
|
137
|
+
if (!main) return undefined;
|
|
138
|
+
const key = main.split(sep).join('/').replace(/[\/_:]/g, '-');
|
|
139
|
+
return join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'projects', key, 'memory');
|
|
140
|
+
}
|
|
141
|
+
|
|
80
142
|
// ============================================================================
|
|
81
143
|
// Simple JSON File Backend (implements IMemoryBackend interface)
|
|
82
144
|
// ============================================================================
|
|
@@ -85,6 +147,8 @@ class JsonFileBackend {
|
|
|
85
147
|
constructor(filePath) {
|
|
86
148
|
this.filePath = filePath;
|
|
87
149
|
this.entries = new Map();
|
|
150
|
+
this.loadedIds = new Set();
|
|
151
|
+
this.deletedIds = new Set();
|
|
88
152
|
}
|
|
89
153
|
|
|
90
154
|
async initialize() {
|
|
@@ -92,7 +156,7 @@ class JsonFileBackend {
|
|
|
92
156
|
try {
|
|
93
157
|
const data = JSON.parse(readFileSync(this.filePath, 'utf-8'));
|
|
94
158
|
if (Array.isArray(data)) {
|
|
95
|
-
for (const entry of data) this.entries.set(entry.id, entry);
|
|
159
|
+
for (const entry of data) { this.entries.set(entry.id, entry); this.loadedIds.add(entry.id); }
|
|
96
160
|
}
|
|
97
161
|
} catch { /* start fresh */ }
|
|
98
162
|
}
|
|
@@ -117,17 +181,26 @@ class JsonFileBackend {
|
|
|
117
181
|
this._persist();
|
|
118
182
|
return e;
|
|
119
183
|
}
|
|
120
|
-
async delete(id) { return this.entries.delete(id); }
|
|
184
|
+
async delete(id) { this.deletedIds.add(id); return this.entries.delete(id); }
|
|
121
185
|
async query(opts) {
|
|
122
186
|
let results = [...this.entries.values()];
|
|
123
187
|
if (opts?.namespace) results = results.filter(e => e.namespace === opts.namespace);
|
|
124
|
-
|
|
188
|
+
// MemoryQuery.type is the query mode (semantic|exact|prefix|tag|hybrid), not
|
|
189
|
+
// the entry's memory type: the bridge asks for { type: 'hybrid' } and a strict
|
|
190
|
+
// entry-type match returned nothing, so sync always reported 0 (#4058).
|
|
191
|
+
const MODES = ['semantic', 'exact', 'prefix', 'tag', 'hybrid'];
|
|
192
|
+
if (opts?.type && !MODES.includes(opts.type)) results = results.filter(e => e.type === opts.type);
|
|
193
|
+
if (opts?.memoryType) results = results.filter(e => e.type === opts.memoryType);
|
|
194
|
+
if (opts?.key) results = results.filter(e => e.key === opts.key);
|
|
195
|
+
if (opts?.keyPrefix) results = results.filter(e => typeof e.key === 'string' && e.key.startsWith(opts.keyPrefix));
|
|
196
|
+
if (Array.isArray(opts?.tags) && opts.tags.length) results = results.filter(e => opts.tags.every(t => (e.tags || []).includes(t)));
|
|
197
|
+
if (opts?.updatedAfter) results = results.filter(e => (e.updatedAt || 0) > opts.updatedAfter);
|
|
125
198
|
if (opts?.limit) results = results.slice(0, opts.limit);
|
|
126
199
|
return results;
|
|
127
200
|
}
|
|
128
201
|
async search() { return []; } // No vector search in JSON backend
|
|
129
202
|
async bulkInsert(entries) { for (const e of entries) this.entries.set(e.id, e); this._persist(); }
|
|
130
|
-
async bulkDelete(ids) { let n = 0; for (const id of ids) { if (this.entries.delete(id)) n++; } this._persist(); return n; }
|
|
203
|
+
async bulkDelete(ids) { let n = 0; for (const id of ids) { this.deletedIds.add(id); if (this.entries.delete(id)) n++; } this._persist(); return n; }
|
|
131
204
|
async count() { return this.entries.size; }
|
|
132
205
|
async listNamespaces() {
|
|
133
206
|
const ns = new Set();
|
|
@@ -137,7 +210,7 @@ class JsonFileBackend {
|
|
|
137
210
|
async clearNamespace(ns) {
|
|
138
211
|
let n = 0;
|
|
139
212
|
for (const [id, e] of this.entries) {
|
|
140
|
-
if (e.namespace === ns) { this.entries.delete(id); n++; }
|
|
213
|
+
if (e.namespace === ns) { this.deletedIds.add(id); this.entries.delete(id); n++; }
|
|
141
214
|
}
|
|
142
215
|
this._persist();
|
|
143
216
|
return n;
|
|
@@ -164,7 +237,22 @@ class JsonFileBackend {
|
|
|
164
237
|
|
|
165
238
|
_persist() {
|
|
166
239
|
try {
|
|
167
|
-
|
|
240
|
+
withStoreLock(this.filePath, () => {
|
|
241
|
+
// Keep entries another writer (intelligence.cjs, a parallel hook) added
|
|
242
|
+
// after we loaded; ours win on the same id, and our own deletes stay deleted.
|
|
243
|
+
const merged = new Map(this.entries);
|
|
244
|
+
try {
|
|
245
|
+
const onDisk = JSON.parse(readFileSync(this.filePath, 'utf-8'));
|
|
246
|
+
if (Array.isArray(onDisk)) {
|
|
247
|
+
for (const e of onDisk) {
|
|
248
|
+
if (e && !merged.has(e.id) && !this.loadedIds.has(e.id) && !this.deletedIds.has(e.id)) merged.set(e.id, e);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} catch { /* missing or unreadable: write ours */ }
|
|
252
|
+
writeFileAtomic(this.filePath, JSON.stringify([...merged.values()], null, 2));
|
|
253
|
+
for (const id of merged.keys()) this.loadedIds.add(id);
|
|
254
|
+
this.entries = merged;
|
|
255
|
+
});
|
|
168
256
|
} catch { /* best effort */ }
|
|
169
257
|
}
|
|
170
258
|
}
|
|
@@ -284,6 +372,8 @@ async function doImport() {
|
|
|
284
372
|
workingDir: PROJECT_ROOT,
|
|
285
373
|
syncMode: 'on-session-end',
|
|
286
374
|
};
|
|
375
|
+
const wtDir = worktreeMemoryDir();
|
|
376
|
+
if (wtDir) bridgeConfig.memoryDir = wtDir;
|
|
287
377
|
|
|
288
378
|
// Wire learning if enabled and available
|
|
289
379
|
if (config.learningBridge.enabled && memPkg.LearningBridge) {
|
|
@@ -344,6 +434,8 @@ async function doSync() {
|
|
|
344
434
|
workingDir: PROJECT_ROOT,
|
|
345
435
|
syncMode: 'on-session-end',
|
|
346
436
|
};
|
|
437
|
+
const wtDir = worktreeMemoryDir();
|
|
438
|
+
if (wtDir) bridgeConfig.memoryDir = wtDir;
|
|
347
439
|
|
|
348
440
|
if (config.learningBridge.enabled && memPkg.LearningBridge) {
|
|
349
441
|
bridgeConfig.learning = {
|
|
@@ -369,8 +461,11 @@ async function doSync() {
|
|
|
369
461
|
dim(`└─ Backend entries: ${entryCount}`);
|
|
370
462
|
|
|
371
463
|
// Curate MEMORY.md index with graph-aware ordering
|
|
464
|
+
let indexSkipped = null;
|
|
465
|
+
if (typeof bridge.on === 'function') bridge.on('index:skipped', (info) => { indexSkipped = info; });
|
|
372
466
|
await bridge.curateIndex();
|
|
373
|
-
|
|
467
|
+
if (indexSkipped) dim(`MEMORY.md index unchanged (${indexSkipped.reason || 'nothing to curate'})`);
|
|
468
|
+
else success('Curated MEMORY.md index');
|
|
374
469
|
} catch (err) {
|
|
375
470
|
dim(`Sync failed (non-critical): ${err.message}`);
|
|
376
471
|
}
|
|
@@ -408,7 +503,11 @@ async function doStatus() {
|
|
|
408
503
|
// Main
|
|
409
504
|
// ============================================================================
|
|
410
505
|
|
|
411
|
-
|
|
506
|
+
// Older settings.json files run `node -e "…import(file)" import`, where the
|
|
507
|
+
// subcommand lands in argv[1] and argv[2] is empty, so both hooks fell through
|
|
508
|
+
// to `status` and never imported or synced (#4058). Accept that shape too.
|
|
509
|
+
const COMMANDS = ['import', 'sync', 'status'];
|
|
510
|
+
const command = process.argv[2] || (COMMANDS.includes(process.argv[1]) ? process.argv[1] : 'status');
|
|
412
511
|
|
|
413
512
|
// Dynamic import() failures can surface as unhandled rejections on a later
|
|
414
513
|
// microtask even when the awaiting call site already caught them, which would
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest": {
|
|
3
|
-
"version": "3.56.
|
|
3
|
+
"version": "3.56.8",
|
|
4
4
|
"files": {
|
|
5
|
-
"auto-memory-hook.mjs": "
|
|
5
|
+
"auto-memory-hook.mjs": "631fac9d518835e2852a406888316bbbddddb49e7ed8e406d2e971f46833df9a",
|
|
6
6
|
"hook-handler.cjs": "0f855c667b8d2d04cb4fe91b14b351d14c3dfb30516dcd9d7ae156acbe0a689d",
|
|
7
|
-
"intelligence.cjs": "
|
|
7
|
+
"intelligence.cjs": "f486be296eb2f0518f34b8f4453d9d0a988845e4aec6d18d8d47725aca6dd38b",
|
|
8
8
|
"statusline.cjs": "d72417ecb38634011a19f095a30e07b9929e6f97663520172ece9be7491b2eaa",
|
|
9
9
|
"router.cjs": "16648b3c0d73b6681ac2d8d13def6a68286c57f5a11004de5b19a0fa088c833d"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"signature": "
|
|
12
|
+
"signature": "ld9RNoF9lnGKjlUpofQLwCZgtE9Y5QiNNkYZLGsSQhZGp51JhBnHymH9YWpFC3F1HBslxRnea6U2TVczJKK5Bg==",
|
|
13
13
|
"algorithm": "ed25519"
|
|
14
14
|
}
|
|
@@ -108,9 +108,60 @@ function readJSON(filePath) {
|
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
// Atomic (temp + rename): auto-memory-hook.mjs reads and writes the same store
|
|
112
|
+
// from the session hooks, and a reader must never see a half-written file (#4058).
|
|
111
113
|
function writeJSON(filePath, data) {
|
|
112
114
|
ensureDataDir();
|
|
113
|
-
|
|
115
|
+
const tmp = filePath + '.' + process.pid + '.tmp';
|
|
116
|
+
try {
|
|
117
|
+
fs.writeFileSync(tmp, JSON.stringify(data, null, 2), 'utf-8');
|
|
118
|
+
fs.renameSync(tmp, filePath);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
try { fs.unlinkSync(tmp); } catch { /* nothing to clean */ }
|
|
121
|
+
throw e;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Short advisory directory lock shared with auto-memory-hook.mjs. It fails open
|
|
126
|
+
// after ~2 s so a stuck lock can never hang a hook.
|
|
127
|
+
function withStoreLock(filePath, fn) {
|
|
128
|
+
const lock = filePath + '.lock';
|
|
129
|
+
const deadline = Date.now() + 2000;
|
|
130
|
+
let held = false;
|
|
131
|
+
for (;;) {
|
|
132
|
+
try { fs.mkdirSync(lock); held = true; break; } catch (e) {
|
|
133
|
+
if (!e || e.code !== 'EEXIST') break;
|
|
134
|
+
try {
|
|
135
|
+
if (Date.now() - fs.statSync(lock).mtimeMs > 10000) { fs.rmSync(lock, { recursive: true, force: true }); continue; }
|
|
136
|
+
} catch { /* lock vanished: retry */ }
|
|
137
|
+
if (Date.now() > deadline) break;
|
|
138
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
try { return fn(); } finally { if (held) { try { fs.rmdirSync(lock); } catch { /* already gone */ } } }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// IDs present when the store was read. Take this BEFORE deduping: those passes
|
|
145
|
+
// assign IDs to entries in place, and an entry that had none must still count as
|
|
146
|
+
// ours (not as something another writer added).
|
|
147
|
+
function storeIds(loaded) {
|
|
148
|
+
return new Set((Array.isArray(loaded) ? loaded : []).map((e) => e && e.id));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Write the store, keeping entries another writer added after we read it.
|
|
152
|
+
function writeStoreMerged(filePath, next, loadedIds) {
|
|
153
|
+
withStoreLock(filePath, () => {
|
|
154
|
+
let out = next;
|
|
155
|
+
try {
|
|
156
|
+
const current = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
157
|
+
if (Array.isArray(current)) {
|
|
158
|
+
const have = new Set(next.map((e) => e && e.id));
|
|
159
|
+
const added = current.filter((e) => e && e.id != null && !loadedIds.has(e.id) && !have.has(e.id));
|
|
160
|
+
if (added.length) out = next.concat(added);
|
|
161
|
+
}
|
|
162
|
+
} catch { /* missing or unreadable: write ours */ }
|
|
163
|
+
writeJSON(filePath, out);
|
|
164
|
+
});
|
|
114
165
|
}
|
|
115
166
|
|
|
116
167
|
function tokenize(text) {
|
|
@@ -475,13 +526,14 @@ function init() {
|
|
|
475
526
|
// Check if graph-state.json is fresh (within 60s of store)
|
|
476
527
|
const graphState = readJSON(GRAPH_PATH);
|
|
477
528
|
let store = readJSON(STORE_PATH);
|
|
529
|
+
const loadedIds = storeIds(store);
|
|
478
530
|
|
|
479
531
|
// Bootstrap from MEMORY.md files if store is empty
|
|
480
532
|
if (!store || !Array.isArray(store) || store.length === 0) {
|
|
481
533
|
const bootstrapped = bootstrapFromMemoryFiles();
|
|
482
534
|
if (bootstrapped.length > 0) {
|
|
483
535
|
store = bootstrapped;
|
|
484
|
-
|
|
536
|
+
writeStoreMerged(STORE_PATH, store, loadedIds);
|
|
485
537
|
} else {
|
|
486
538
|
return { nodes: 0, edges: 0, message: 'No memory entries to index' };
|
|
487
539
|
}
|
|
@@ -503,7 +555,7 @@ function init() {
|
|
|
503
555
|
`[INTELLIGENCE] Deduped store: ${store.length} -> ${deduped.length} entries ` +
|
|
504
556
|
`(by-id: ${store.length - beforeContentDedup} dropped, by-content: ${beforeContentDedup - deduped.length} dropped)\n`
|
|
505
557
|
);
|
|
506
|
-
|
|
558
|
+
writeStoreMerged(STORE_PATH, deduped, loadedIds);
|
|
507
559
|
}
|
|
508
560
|
|
|
509
561
|
// Skip rebuild if graph is fresh and store hasn't changed. #2920: nodeCount
|
|
@@ -834,6 +886,7 @@ function consolidate() {
|
|
|
834
886
|
return { entries: 0, edges: 0, newEntries: 0, message: 'No store to consolidate' };
|
|
835
887
|
}
|
|
836
888
|
|
|
889
|
+
const loadedIds = storeIds(store);
|
|
837
890
|
// Deduplicate store entries by ID before processing (fixes #1518)
|
|
838
891
|
const preDedupCount = store.length;
|
|
839
892
|
store = deduplicateById(store);
|
|
@@ -979,7 +1032,7 @@ function consolidate() {
|
|
|
979
1032
|
// RANKED_PATH are rewritten unconditionally just above; writing the
|
|
980
1033
|
// (already deduped, size-bounded per ADR-095 G6) store alongside them
|
|
981
1034
|
// costs nothing near the <500ms budget and removes the whole bug class.
|
|
982
|
-
|
|
1035
|
+
writeStoreMerged(STORE_PATH, store, loadedIds);
|
|
983
1036
|
|
|
984
1037
|
// 9. Save snapshot for delta tracking
|
|
985
1038
|
const updatedGraph = readJSON(GRAPH_PATH);
|
package/README.md
CHANGED
|
@@ -49,6 +49,10 @@ npx -y ruflo@latest mcp start
|
|
|
49
49
|
|
|
50
50
|
MCP exposes Ruflo tools to your client. The console and mods above are Claude Code integrations; hook support depends on the client.
|
|
51
51
|
|
|
52
|
+
<img src="docs/assets/readme/icons/terminal.svg" width="28" height="28" alt=""> **Prefer a plain terminal? Optional.** The console also runs on its own, with no Claude Code: `npx ruflo tui` (add `--plain` to print one frame for scripts). It shows Overview, Cost, Swarm, Events and Missions, plus an optional AI page. [Terminal UI guide](docs/USERGUIDE.md#terminal-ui-optional)
|
|
53
|
+
|
|
54
|
+
<p align="center"><img src="docs/assets/ruflo-tui-compact.svg" width="640" alt="Looping recording of the optional ruflo terminal UI cycling through Overview, Cost, Swarm, Events and Missions in a sample project"></p>
|
|
55
|
+
|
|
52
56
|
[Compare install paths](#quick-start) · [Open the console](#console-walkthrough) · [User guide](docs/USERGUIDE.md)
|
|
53
57
|
|
|
54
58
|
<div align="center">
|
|
@@ -116,9 +120,11 @@ User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM prov
|
|
|
116
120
|
|
|
117
121
|
<p align="center"><img src="docs/assets/readme/console.svg" alt="Mission control: inspect agent work" width="100%"></p>
|
|
118
122
|
|
|
119
|
-
<p align="center"><
|
|
123
|
+
<p align="center"><a href="https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg"><img src="docs/assets/ruflo-console-theme-compact.svg" width="100%" alt="Ruflo Orbital theme: animated boot checks, block logo, menu icons, rotating globe, swarm routing, six color palettes and responsive Theme Studio"></a></p>
|
|
124
|
+
|
|
125
|
+
[Open animated demo](https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/ruflo-console-theme-compact.svg) · [Theme Studio guide](plugins/ruflo-console/README.md) · [Workflow demo](docs/assets/ruflo-console-workflows.svg)
|
|
120
126
|
|
|
121
|
-
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Your agent cockpit.** Track workflows, agents, models, tokens and cost beside Claude Code. The animation shows
|
|
127
|
+
<img src="docs/assets/readme/console-icon-workflows.svg" width="28" height="28" alt=""> **Your agent cockpit.** Track workflows, agents, models, tokens and cost beside Claude Code. The 38 second animation shows **Orbital and Theme Studio** through actual renderer frames, including boot checks, six palettes, customization, saved themes, JSON import and resizing. This compact 3.84 MB SVG retains all 456 frames. Native host and AI provider execution are not demonstrated.
|
|
122
128
|
|
|
123
129
|
<img src="docs/assets/readme/console-icon-inspect.svg" width="28" height="28" alt=""> **Inspect any run.** Open agent logs and results, search, triage failures, replay and compare. Start with `npx ruflo init`, restart Claude Code, then `/ruflo`. [Full console tour](docs/assets/ruflo-console-walkthrough-wide.gif).
|
|
124
130
|
|
|
@@ -136,7 +142,7 @@ User → Ruflo (CLI/MCP) → Router → Swarm → Agents → Memory → LLM prov
|
|
|
136
142
|
4. **Verify the result.** Check that Missions contains the goal and Overview records the action. Creating a mission does not mean the feature has been implemented.
|
|
137
143
|
5. **Keep control.** **Take back control** pauses Claude's console tools. A later call should be refused until you restore control.
|
|
138
144
|
|
|
139
|
-
**What the recording demonstrates:** a real Claude Haiku session with `write + auto`, mission creation, page navigation, a refused swarm stop, and control being taken back. The steps above use `ask` so you approve creation yourself. The
|
|
145
|
+
**What the recording demonstrates:** a real Claude Haiku session with `write + auto`, mission creation, page navigation, a refused swarm stop, and control being taken back. The steps above use `ask` so you approve creation yourself. The linked workflow animation uses sample data, while the theme demo replays renderer frames. Neither is evidence of completed swarm work or memory recall.
|
|
140
146
|
|
|
141
147
|
[Implementation and recorded test findings](v3/docs/adr/ADR-444-claude-controls-the-console.md) · [Reproduction script](plugins/ruflo-console/scripts/e2e-control.sh)
|
|
142
148
|
|
package/bin/cli.js
CHANGED
|
@@ -257,7 +257,7 @@ if (isMCPMode) {
|
|
|
257
257
|
serverInfo: { name: 'ruflo', version: VERSION },
|
|
258
258
|
capabilities: {
|
|
259
259
|
tools: { listChanged: true },
|
|
260
|
-
resources: {
|
|
260
|
+
resources: {},
|
|
261
261
|
},
|
|
262
262
|
},
|
|
263
263
|
};
|
|
@@ -322,6 +322,16 @@ if (isMCPMode) {
|
|
|
322
322
|
}
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
// A declared capability must be served (ADR-490): no resources are exposed, so list answers are empty and a read is "not found".
|
|
326
|
+
case 'resources/list':
|
|
327
|
+
return { jsonrpc: '2.0', id: message.id, result: { resources: [] } };
|
|
328
|
+
|
|
329
|
+
case 'resources/templates/list':
|
|
330
|
+
return { jsonrpc: '2.0', id: message.id, result: { resourceTemplates: [] } };
|
|
331
|
+
|
|
332
|
+
case 'resources/read':
|
|
333
|
+
return { jsonrpc: '2.0', id: message.id, error: { code: -32002, message: 'Resource not found' } };
|
|
334
|
+
|
|
325
335
|
case 'notifications/initialized':
|
|
326
336
|
return null;
|
|
327
337
|
|
package/bin/mcp-server.js
CHANGED
|
@@ -146,7 +146,7 @@ async function handleMessage(message) {
|
|
|
146
146
|
serverInfo: { name: 'ruflo', version: VERSION },
|
|
147
147
|
capabilities: {
|
|
148
148
|
tools: { listChanged: true },
|
|
149
|
-
resources: {
|
|
149
|
+
resources: {},
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
152
|
};
|
|
@@ -208,6 +208,16 @@ async function handleMessage(message) {
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
// A declared capability must be served (ADR-490): no resources are exposed, so list answers are empty and a read is "not found".
|
|
212
|
+
case 'resources/list':
|
|
213
|
+
return { jsonrpc: '2.0', id: message.id, result: { resources: [] } };
|
|
214
|
+
|
|
215
|
+
case 'resources/templates/list':
|
|
216
|
+
return { jsonrpc: '2.0', id: message.id, result: { resourceTemplates: [] } };
|
|
217
|
+
|
|
218
|
+
case 'resources/read':
|
|
219
|
+
return { jsonrpc: '2.0', id: message.id, error: { code: -32002, message: 'Resource not found' } };
|
|
220
|
+
|
|
211
221
|
case 'notifications/initialized':
|
|
212
222
|
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Client initialized`);
|
|
213
223
|
return null; // No response for notifications
|
package/catalog-manifest.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface CoverageFileEntry {
|
|
2
|
+
filePath: string;
|
|
3
|
+
lines: number;
|
|
4
|
+
branches: number;
|
|
5
|
+
functions: number;
|
|
6
|
+
statements: number;
|
|
7
|
+
}
|
|
8
|
+
interface CoverageData {
|
|
9
|
+
found: boolean;
|
|
10
|
+
source: string;
|
|
11
|
+
entries: CoverageFileEntry[];
|
|
12
|
+
summary: {
|
|
13
|
+
totalFiles: number;
|
|
14
|
+
overallLineCoverage: number;
|
|
15
|
+
overallBranchCoverage: number;
|
|
16
|
+
overallFunctionCoverage: number;
|
|
17
|
+
overallStatementCoverage: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read coverage data from disk. Checks these locations in order:
|
|
22
|
+
* 1. coverage/coverage-summary.json (Jest/Istanbul)
|
|
23
|
+
* 2. coverage/lcov.info (lcov format)
|
|
24
|
+
* 3. coverage/coverage-final.json (Istanbul counters)
|
|
25
|
+
* 4. .nyc_output/out.json (nyc counters or legacy summary)
|
|
26
|
+
*/
|
|
27
|
+
export declare function readCoverageFromDisk(): CoverageData;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=coverage-reader.d.ts.map
|