@claude-flow/cli 3.5.59 → 3.5.61
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/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +85 -41
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +63 -2
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline-generator.d.ts","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"statusline-generator.d.ts","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAszBrE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA8BnE"}
|
|
@@ -198,30 +198,59 @@ function getModelName() {
|
|
|
198
198
|
return 'Claude Code';
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
// Get learning stats from
|
|
201
|
+
// Get learning stats from real data sources (no heuristics)
|
|
202
202
|
function getLearningStats() {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
206
|
-
path.join(CWD, '.claude', 'memory.db'),
|
|
207
|
-
path.join(CWD, 'data', 'memory.db'),
|
|
208
|
-
path.join(CWD, '.agentdb', 'memory.db'),
|
|
209
|
-
];
|
|
203
|
+
let patterns = 0;
|
|
204
|
+
let sessions = 0;
|
|
210
205
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
sessions: Math.max(1, Math.floor(patterns / 10)),
|
|
219
|
-
};
|
|
206
|
+
// 1. Count real patterns from intelligence pattern store
|
|
207
|
+
const patternStorePath = path.join(CWD, '.claude-flow', 'data', 'patterns.json');
|
|
208
|
+
try {
|
|
209
|
+
if (fs.existsSync(patternStorePath)) {
|
|
210
|
+
const data = JSON.parse(fs.readFileSync(patternStorePath, 'utf-8'));
|
|
211
|
+
if (Array.isArray(data)) patterns = data.length;
|
|
212
|
+
else if (data && data.patterns) patterns = Array.isArray(data.patterns) ? data.patterns.length : Object.keys(data.patterns).length;
|
|
220
213
|
}
|
|
214
|
+
} catch { /* ignore */ }
|
|
215
|
+
|
|
216
|
+
// 2. Count patterns from auto-memory-store (real entries, not file size)
|
|
217
|
+
if (patterns === 0) {
|
|
218
|
+
const autoStorePath = path.join(CWD, '.claude-flow', 'data', 'auto-memory-store.json');
|
|
219
|
+
try {
|
|
220
|
+
if (fs.existsSync(autoStorePath)) {
|
|
221
|
+
const data = JSON.parse(fs.readFileSync(autoStorePath, 'utf-8'));
|
|
222
|
+
if (Array.isArray(data)) patterns = data.length;
|
|
223
|
+
else if (data && data.entries) patterns = data.entries.length;
|
|
224
|
+
}
|
|
225
|
+
} catch { /* ignore */ }
|
|
221
226
|
}
|
|
222
227
|
|
|
223
|
-
//
|
|
224
|
-
|
|
228
|
+
// 3. Count patterns from memory.db using row count (sqlite header bytes 28-31)
|
|
229
|
+
if (patterns === 0) {
|
|
230
|
+
const memoryPaths = [
|
|
231
|
+
path.join(CWD, '.claude-flow', 'memory.db'),
|
|
232
|
+
path.join(CWD, 'data', 'memory.db'),
|
|
233
|
+
path.join(CWD, '.swarm', 'memory.db'),
|
|
234
|
+
];
|
|
235
|
+
for (const dbPath of memoryPaths) {
|
|
236
|
+
try {
|
|
237
|
+
if (fs.existsSync(dbPath)) {
|
|
238
|
+
// Read SQLite header: page count at offset 28 (4 bytes big-endian)
|
|
239
|
+
const fd = fs.openSync(dbPath, 'r');
|
|
240
|
+
const buf = Buffer.alloc(4);
|
|
241
|
+
fs.readSync(fd, buf, 0, 4, 28);
|
|
242
|
+
fs.closeSync(fd);
|
|
243
|
+
const pageCount = buf.readUInt32BE(0);
|
|
244
|
+
// Each page typically holds ~10-50 rows; use page count as conservative estimate
|
|
245
|
+
// But report 0 if DB exists but has only schema pages (< 3)
|
|
246
|
+
patterns = pageCount > 2 ? pageCount - 2 : 0;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
} catch { /* ignore */ }
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// 4. Count real session files
|
|
225
254
|
try {
|
|
226
255
|
const sessDir = path.join(CWD, '.claude', 'sessions');
|
|
227
256
|
if (fs.existsSync(sessDir)) {
|
|
@@ -229,7 +258,17 @@ function getLearningStats() {
|
|
|
229
258
|
}
|
|
230
259
|
} catch { /* ignore */ }
|
|
231
260
|
|
|
232
|
-
|
|
261
|
+
// 5. Count session files from claude-flow
|
|
262
|
+
if (sessions === 0) {
|
|
263
|
+
try {
|
|
264
|
+
const cfSessDir = path.join(CWD, '.claude-flow', 'sessions');
|
|
265
|
+
if (fs.existsSync(cfSessDir)) {
|
|
266
|
+
sessions = fs.readdirSync(cfSessDir).filter(f => f.endsWith('.json')).length;
|
|
267
|
+
}
|
|
268
|
+
} catch { /* ignore */ }
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return { patterns, sessions };
|
|
233
272
|
}
|
|
234
273
|
|
|
235
274
|
// V3 progress from metrics files (pure file reads)
|
|
@@ -241,12 +280,12 @@ function getV3Progress() {
|
|
|
241
280
|
let dddProgress = dddData ? (dddData.progress || 0) : 0;
|
|
242
281
|
let domainsCompleted = Math.min(5, Math.floor(dddProgress / 20));
|
|
243
282
|
|
|
283
|
+
// Only derive DDD progress from real ddd-progress.json or real pattern data
|
|
284
|
+
// Don't inflate domains from pattern count — 0 means no DDD work tracked
|
|
244
285
|
if (dddProgress === 0 && learning.patterns > 0) {
|
|
245
|
-
if
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
else if (learning.patterns >= 50) domainsCompleted = 2;
|
|
249
|
-
else if (learning.patterns >= 10) domainsCompleted = 1;
|
|
286
|
+
// Conservative: only count domains if we have substantial real pattern data
|
|
287
|
+
// Each domain requires ~100 real stored patterns to claim completion
|
|
288
|
+
domainsCompleted = Math.min(5, Math.floor(learning.patterns / 100));
|
|
250
289
|
dddProgress = Math.floor((domainsCompleted / totalDomains) * 100);
|
|
251
290
|
}
|
|
252
291
|
|
|
@@ -338,28 +377,18 @@ function getSystemMetrics() {
|
|
|
338
377
|
if (learningData && learningData.intelligence && learningData.intelligence.score !== undefined) {
|
|
339
378
|
intelligencePct = Math.min(100, Math.floor(learningData.intelligence.score));
|
|
340
379
|
} else {
|
|
380
|
+
// Use real data only — patterns from actual store, vectors from actual DB
|
|
341
381
|
const fromPatterns = learning.patterns > 0 ? Math.min(100, Math.floor(learning.patterns / 20)) : 0;
|
|
342
382
|
const fromVectors = agentdb.vectorCount > 0 ? Math.min(100, Math.floor(agentdb.vectorCount / 20)) : 0;
|
|
343
383
|
intelligencePct = Math.max(fromPatterns, fromVectors);
|
|
344
384
|
}
|
|
345
|
-
|
|
346
|
-
// Maturity fallback (pure fs checks, no git exec)
|
|
347
|
-
if (intelligencePct === 0) {
|
|
348
|
-
let score = 0;
|
|
349
|
-
if (fs.existsSync(path.join(CWD, '.claude'))) score += 15;
|
|
350
|
-
const srcDirs = ['src', 'lib', 'app', 'packages', 'v3'];
|
|
351
|
-
for (const d of srcDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 15; break; } }
|
|
352
|
-
const testDirs = ['tests', 'test', '__tests__', 'spec'];
|
|
353
|
-
for (const d of testDirs) { if (fs.existsSync(path.join(CWD, d))) { score += 10; break; } }
|
|
354
|
-
const cfgFiles = ['package.json', 'tsconfig.json', 'pyproject.toml', 'Cargo.toml', 'go.mod'];
|
|
355
|
-
for (const f of cfgFiles) { if (fs.existsSync(path.join(CWD, f))) { score += 5; break; } }
|
|
356
|
-
intelligencePct = Math.min(100, score);
|
|
357
|
-
}
|
|
385
|
+
// No fake fallback — 0% means no real learning data exists
|
|
358
386
|
|
|
359
387
|
if (learningData && learningData.sessions && learningData.sessions.total !== undefined) {
|
|
360
388
|
contextPct = Math.min(100, learningData.sessions.total * 5);
|
|
361
389
|
} else {
|
|
362
|
-
|
|
390
|
+
// Real session count only — no heuristic derivation from patterns
|
|
391
|
+
contextPct = learning.sessions > 0 ? Math.min(100, learning.sessions * 5) : 0;
|
|
363
392
|
}
|
|
364
393
|
|
|
365
394
|
// Sub-agents from file metrics (no ps aux)
|
|
@@ -427,7 +456,7 @@ function getHooksStatus() {
|
|
|
427
456
|
return { enabled, total };
|
|
428
457
|
}
|
|
429
458
|
|
|
430
|
-
// AgentDB stats — count real entries
|
|
459
|
+
// AgentDB stats — count real entries from all data stores
|
|
431
460
|
function getAgentDBStats() {
|
|
432
461
|
let vectorCount = 0;
|
|
433
462
|
let dbSizeKB = 0;
|
|
@@ -446,7 +475,22 @@ function getAgentDBStats() {
|
|
|
446
475
|
} catch { /* fall back */ }
|
|
447
476
|
}
|
|
448
477
|
|
|
449
|
-
// 2. Count entries from
|
|
478
|
+
// 2. Count entries from hooks memory store (.claude-flow/memory/store.json)
|
|
479
|
+
const hooksStorePath = path.join(CWD, '.claude-flow', 'memory', 'store.json');
|
|
480
|
+
const hooksStoreStat = safeStat(hooksStorePath);
|
|
481
|
+
if (hooksStoreStat) {
|
|
482
|
+
dbSizeKB += hooksStoreStat.size / 1024;
|
|
483
|
+
try {
|
|
484
|
+
const store = JSON.parse(fs.readFileSync(hooksStorePath, 'utf-8'));
|
|
485
|
+
if (store && store.entries) {
|
|
486
|
+
const entryCount = Object.keys(store.entries).length;
|
|
487
|
+
vectorCount = Math.max(vectorCount, entryCount);
|
|
488
|
+
if (entryCount > 0) namespaces++;
|
|
489
|
+
}
|
|
490
|
+
} catch { /* fall back */ }
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// 3. Count entries from ranked-context.json
|
|
450
494
|
try {
|
|
451
495
|
const ranked = readJSON(path.join(CWD, '.claude-flow', 'data', 'ranked-context.json'));
|
|
452
496
|
if (ranked && ranked.entries && ranked.entries.length > vectorCount) vectorCount = ranked.entries.length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusline-generator.js","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;eAuBM,SAAS
|
|
1
|
+
{"version":3,"file":"statusline-generator.js","sourceRoot":"","sources":["../../../src/init/statusline-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;eAuBM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAW,EAAE,OA4BzB,CAAC;AAGF,eAAO,MAAM,SAAS,EAAE,OAsCvB,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAsG/B,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,OAmEpC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,OAsClC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,OA4CjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OA4IhC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAoE/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,OAqGhC,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,OA8KpC,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,OAwEpC,CAAC;AAGF,eAAO,MAAM,0BAA0B,EAAE,OAkHxC,CAAC;AA8PF,eAAO,MAAM,eAAe,EAAE,OA8C7B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,OAiGjC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAqD/B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OAgE/B,CAAC;AAiBF,eAAO,MAAM,eAAe,EAAE,OAyC7B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,OA8B/B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,OAuB7B,CAAC;AAqBF,eAAO,MAAM,iBAAiB,EAAE,OAuC/B,CAAC;AAGF,eAAO,MAAM,UAAU,EAAE,OAAO,EAwC/B,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1164,6 +1164,32 @@ export const hooksPostTask = {
|
|
|
1164
1164
|
catch { /* non-critical */ }
|
|
1165
1165
|
}
|
|
1166
1166
|
const duration = Date.now() - startTime;
|
|
1167
|
+
// Persist to auto-memory-store for statusline visibility
|
|
1168
|
+
try {
|
|
1169
|
+
const dataDir = join(getProjectCwd(), '.claude-flow', 'data');
|
|
1170
|
+
if (!existsSync(dataDir))
|
|
1171
|
+
mkdirSync(dataDir, { recursive: true });
|
|
1172
|
+
const storePath = join(dataDir, 'auto-memory-store.json');
|
|
1173
|
+
let store = [];
|
|
1174
|
+
try {
|
|
1175
|
+
if (existsSync(storePath)) {
|
|
1176
|
+
const parsed = JSON.parse(readFileSync(storePath, 'utf-8'));
|
|
1177
|
+
store = Array.isArray(parsed) ? parsed : [];
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
catch { /* start fresh */ }
|
|
1181
|
+
store.push({
|
|
1182
|
+
id: `task-${taskId}`,
|
|
1183
|
+
key: taskId,
|
|
1184
|
+
content: `Task ${success ? 'completed' : 'failed'}: ${taskText || taskId}${agent ? ` (agent: ${agent})` : ''}`,
|
|
1185
|
+
namespace: 'tasks',
|
|
1186
|
+
type: 'task-outcome',
|
|
1187
|
+
metadata: { agent, success, quality },
|
|
1188
|
+
createdAt: Date.now(),
|
|
1189
|
+
});
|
|
1190
|
+
writeFileSync(storePath, JSON.stringify(store, null, 2), 'utf-8');
|
|
1191
|
+
}
|
|
1192
|
+
catch { /* non-critical */ }
|
|
1167
1193
|
return {
|
|
1168
1194
|
taskId,
|
|
1169
1195
|
success,
|
|
@@ -1544,6 +1570,41 @@ export const hooksSessionStart = {
|
|
|
1544
1570
|
catch {
|
|
1545
1571
|
// Bridge not available
|
|
1546
1572
|
}
|
|
1573
|
+
// Persist session record to auto-memory-store for statusline visibility
|
|
1574
|
+
try {
|
|
1575
|
+
const dataDir = join(getProjectCwd(), '.claude-flow', 'data');
|
|
1576
|
+
if (!existsSync(dataDir))
|
|
1577
|
+
mkdirSync(dataDir, { recursive: true });
|
|
1578
|
+
const storePath = join(dataDir, 'auto-memory-store.json');
|
|
1579
|
+
let store = [];
|
|
1580
|
+
try {
|
|
1581
|
+
if (existsSync(storePath)) {
|
|
1582
|
+
const raw = readFileSync(storePath, 'utf-8');
|
|
1583
|
+
const parsed = JSON.parse(raw);
|
|
1584
|
+
store = Array.isArray(parsed) ? parsed : [];
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
catch { /* start fresh */ }
|
|
1588
|
+
// Add session entry (dedup by session ID)
|
|
1589
|
+
const entryId = `session-${sessionId}`;
|
|
1590
|
+
const existing = store.findIndex((e) => e.id === entryId);
|
|
1591
|
+
const entry = {
|
|
1592
|
+
id: entryId,
|
|
1593
|
+
key: sessionId,
|
|
1594
|
+
content: `Session started: ${sessionId}`,
|
|
1595
|
+
namespace: 'sessions',
|
|
1596
|
+
type: 'session',
|
|
1597
|
+
createdAt: Date.now(),
|
|
1598
|
+
};
|
|
1599
|
+
if (existing >= 0)
|
|
1600
|
+
store[existing] = entry;
|
|
1601
|
+
else
|
|
1602
|
+
store.push(entry);
|
|
1603
|
+
writeFileSync(storePath, JSON.stringify(store, null, 2), 'utf-8');
|
|
1604
|
+
}
|
|
1605
|
+
catch {
|
|
1606
|
+
// Non-critical — statusline just won't show this session
|
|
1607
|
+
}
|
|
1547
1608
|
return {
|
|
1548
1609
|
sessionId,
|
|
1549
1610
|
started: new Date().toISOString(),
|
|
@@ -1558,8 +1619,8 @@ export const hooksSessionStart = {
|
|
|
1558
1619
|
sessionMemory: sessionMemory || { controller: 'none', restoredPatterns: 0 },
|
|
1559
1620
|
previousSession: restoreLatest ? {
|
|
1560
1621
|
id: `session-${Date.now() - 86400000}`,
|
|
1561
|
-
tasksRestored: sessionMemory?.restoredPatterns ||
|
|
1562
|
-
memoryRestored: sessionMemory?.restoredPatterns ||
|
|
1622
|
+
tasksRestored: sessionMemory?.restoredPatterns || 0,
|
|
1623
|
+
memoryRestored: sessionMemory?.restoredPatterns || 0,
|
|
1563
1624
|
} : null,
|
|
1564
1625
|
};
|
|
1565
1626
|
},
|