claude-memory-store 0.1.1 → 0.1.2
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/README.md +278 -76
- package/dist/atlas/client.d.ts +0 -2
- package/dist/atlas/client.d.ts.map +1 -1
- package/dist/atlas/client.js +0 -8
- package/dist/atlas/client.js.map +1 -1
- package/dist/atlas/embeddings.d.ts +31 -4
- package/dist/atlas/embeddings.d.ts.map +1 -1
- package/dist/atlas/embeddings.js +31 -4
- package/dist/atlas/embeddings.js.map +1 -1
- package/dist/atlas/indexes.d.ts.map +1 -1
- package/dist/atlas/indexes.js +5 -3
- package/dist/atlas/indexes.js.map +1 -1
- package/dist/atlas/vector.d.ts +11 -1
- package/dist/atlas/vector.d.ts.map +1 -1
- package/dist/atlas/vector.js +47 -3
- package/dist/atlas/vector.js.map +1 -1
- package/dist/bin/claude-memory.js +36 -35
- package/dist/bin/claude-memory.js.map +1 -1
- package/dist/bin/mcp-server.js +7 -21
- package/dist/bin/mcp-server.js.map +1 -1
- package/dist/cache/command-cache.js +1 -1
- package/dist/cache/command-cache.js.map +1 -1
- package/dist/cleanup.d.ts +6 -3
- package/dist/cleanup.d.ts.map +1 -1
- package/dist/cleanup.js +31 -11
- package/dist/cleanup.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +29 -0
- package/dist/decay.d.ts.map +1 -0
- package/dist/decay.js +58 -0
- package/dist/decay.js.map +1 -0
- package/dist/editor/charts.d.ts +9 -0
- package/dist/editor/charts.d.ts.map +1 -0
- package/dist/editor/charts.js +157 -0
- package/dist/editor/charts.js.map +1 -0
- package/dist/editor/colors.d.ts +28 -0
- package/dist/editor/colors.d.ts.map +1 -0
- package/dist/editor/colors.js +66 -0
- package/dist/editor/colors.js.map +1 -0
- package/dist/editor/dashboard.d.ts +26 -0
- package/dist/editor/dashboard.d.ts.map +1 -0
- package/dist/editor/dashboard.js +156 -0
- package/dist/editor/dashboard.js.map +1 -0
- package/dist/editor/interactive.d.ts +24 -0
- package/dist/editor/interactive.d.ts.map +1 -0
- package/dist/editor/interactive.js +533 -0
- package/dist/editor/interactive.js.map +1 -0
- package/dist/hooks/pre-tool-use.js +5 -4
- package/dist/hooks/pre-tool-use.js.map +1 -1
- package/dist/hooks/stop.d.ts +1 -0
- package/dist/hooks/stop.d.ts.map +1 -1
- package/dist/hooks/stop.js +72 -0
- package/dist/hooks/stop.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/memory/developer.d.ts.map +1 -1
- package/dist/memory/developer.js +4 -0
- package/dist/memory/developer.js.map +1 -1
- package/dist/memory/fading.d.ts +12 -0
- package/dist/memory/fading.d.ts.map +1 -0
- package/dist/memory/fading.js +45 -0
- package/dist/memory/fading.js.map +1 -0
- package/dist/memory/project.d.ts +2 -0
- package/dist/memory/project.d.ts.map +1 -1
- package/dist/memory/project.js +60 -0
- package/dist/memory/project.js.map +1 -1
- package/dist/memory/working.d.ts.map +1 -1
- package/dist/memory/working.js +1 -0
- package/dist/memory/working.js.map +1 -1
- package/dist/natural-language/parser.d.ts +6 -0
- package/dist/natural-language/parser.d.ts.map +1 -1
- package/dist/natural-language/parser.js +17 -0
- package/dist/natural-language/parser.js.map +1 -1
- package/dist/natural-language/router.d.ts.map +1 -1
- package/dist/natural-language/router.js +48 -33
- package/dist/natural-language/router.js.map +1 -1
- package/dist/slash-commands/recall.js +1 -1
- package/dist/slash-commands/recall.js.map +1 -1
- package/dist/slash-commands/remember.d.ts.map +1 -1
- package/dist/slash-commands/remember.js +8 -2
- package/dist/slash-commands/remember.js.map +1 -1
- package/dist/slash-commands/stats.d.ts.map +1 -1
- package/dist/slash-commands/stats.js +11 -0
- package/dist/slash-commands/stats.js.map +1 -1
- package/dist/startup/conversation.d.ts +1 -0
- package/dist/startup/conversation.d.ts.map +1 -1
- package/dist/startup/conversation.js +7 -1
- package/dist/startup/conversation.js.map +1 -1
- package/dist/startup/feature-search.d.ts +5 -0
- package/dist/startup/feature-search.d.ts.map +1 -1
- package/dist/startup/feature-search.js +10 -26
- package/dist/startup/feature-search.js.map +1 -1
- package/dist/startup/injector.d.ts +1 -0
- package/dist/startup/injector.d.ts.map +1 -1
- package/dist/startup/injector.js +23 -5
- package/dist/startup/injector.js.map +1 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +20 -4
- package/dist/summarizer.js.map +1 -1
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/config.js
CHANGED
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MAX_INJECTION_CHARS = exports.DUPLICATE_SIMILARITY_THRESHOLD = exports.VECTOR_RELEVANCE_THRESHOLD = void 0;
|
|
36
37
|
exports.getConfigDir = getConfigDir;
|
|
37
38
|
exports.getConfigPath = getConfigPath;
|
|
38
39
|
exports.ensureConfigDir = ensureConfigDir;
|
|
@@ -41,6 +42,8 @@ exports.saveConfig = saveConfig;
|
|
|
41
42
|
exports.getAtlasUri = getAtlasUri;
|
|
42
43
|
exports.isConfigured = isConfigured;
|
|
43
44
|
exports.getMemoryTtlDays = getMemoryTtlDays;
|
|
45
|
+
exports.getDecayHalfLifeDays = getDecayHalfLifeDays;
|
|
46
|
+
exports.getDecayDeathThreshold = getDecayDeathThreshold;
|
|
44
47
|
const fs = __importStar(require("node:fs"));
|
|
45
48
|
const path = __importStar(require("node:path"));
|
|
46
49
|
const os = __importStar(require("node:os"));
|
|
@@ -50,6 +53,8 @@ const DEFAULT_CONFIG = {
|
|
|
50
53
|
atlas_uri: '',
|
|
51
54
|
team_memory: false,
|
|
52
55
|
memory_ttl_days: 30,
|
|
56
|
+
decay_half_life_days: 7,
|
|
57
|
+
decay_death_threshold: 0.05,
|
|
53
58
|
};
|
|
54
59
|
function getConfigDir() {
|
|
55
60
|
return CONFIG_DIR;
|
|
@@ -94,4 +99,22 @@ function getMemoryTtlDays() {
|
|
|
94
99
|
const config = loadConfig();
|
|
95
100
|
return config.memory_ttl_days ?? 30;
|
|
96
101
|
}
|
|
102
|
+
// Minimum cosine similarity score for a memory result to be considered relevant.
|
|
103
|
+
// Tuned against real session data. Increase to reduce noise, decrease to improve recall.
|
|
104
|
+
exports.VECTOR_RELEVANCE_THRESHOLD = 0.70;
|
|
105
|
+
// Similarity threshold for duplicate detection.
|
|
106
|
+
// If a new memory scores >= this against an existing one, treat as duplicate.
|
|
107
|
+
// Higher = stricter dedup. Lower = more aggressive merging.
|
|
108
|
+
exports.DUPLICATE_SIMILARITY_THRESHOLD = 0.92;
|
|
109
|
+
// Maximum characters injected from memory per prompt.
|
|
110
|
+
// Prevents memory from accidentally consuming the context window.
|
|
111
|
+
exports.MAX_INJECTION_CHARS = 2000;
|
|
112
|
+
function getDecayHalfLifeDays() {
|
|
113
|
+
const config = loadConfig();
|
|
114
|
+
return config.decay_half_life_days ?? 7;
|
|
115
|
+
}
|
|
116
|
+
function getDecayDeathThreshold() {
|
|
117
|
+
const config = loadConfig();
|
|
118
|
+
return config.decay_death_threshold ?? 0.05;
|
|
119
|
+
}
|
|
97
120
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,oCAEC;AAED,sCAEC;AAED,0CAIC;AAED,gCAWC;AAED,gCAGC;AAED,kCAOC;AAED,oCAEC;AAED,4CAGC;AA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2) / halfLifeDays, t = days since last access.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Calculate the decay score for a memory document.
|
|
9
|
+
*
|
|
10
|
+
* @param lastAccessed - When the document was last accessed
|
|
11
|
+
* @param accessCount - How many times it has been accessed (defaults to 1 for backward compat)
|
|
12
|
+
* @param halfLifeDays - Half-life in days (default 7)
|
|
13
|
+
* @returns Score between 0 and 1
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateDecayScore(lastAccessed: Date, accessCount: number | undefined, halfLifeDays?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a document's decay score is below the death threshold.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isExpired(score: number, threshold?: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Estimate how many days until a document's score drops below the threshold,
|
|
22
|
+
* assuming no further accesses.
|
|
23
|
+
*
|
|
24
|
+
* Solves: threshold = exp(-λ * t) * (1 + ln(accessCount))
|
|
25
|
+
* → t = -ln(threshold / (1 + ln(accessCount))) / λ
|
|
26
|
+
* Returns days remaining from now (can be negative if already expired).
|
|
27
|
+
*/
|
|
28
|
+
export declare function estimateDaysUntilExpiration(lastAccessed: Date, accessCount: number | undefined, halfLifeDays?: number, threshold?: number): number;
|
|
29
|
+
//# sourceMappingURL=decay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decay.d.ts","sourceRoot":"","sources":["../src/decay.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,IAAI,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,GAAE,MAAU,GACvB,MAAM,CAcR;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAa,GACvB,OAAO,CAET;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,IAAI,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,GAAE,MAAU,EACxB,SAAS,GAAE,MAAa,GACvB,MAAM,CAaR"}
|
package/dist/decay.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Exponential decay with access-frequency weighting.
|
|
4
|
+
*
|
|
5
|
+
* score = min(1.0, exp(-λ * t) * (1 + ln(accessCount)))
|
|
6
|
+
* where λ = ln(2) / halfLifeDays, t = days since last access.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.calculateDecayScore = calculateDecayScore;
|
|
10
|
+
exports.isExpired = isExpired;
|
|
11
|
+
exports.estimateDaysUntilExpiration = estimateDaysUntilExpiration;
|
|
12
|
+
const LN2 = Math.LN2;
|
|
13
|
+
/**
|
|
14
|
+
* Calculate the decay score for a memory document.
|
|
15
|
+
*
|
|
16
|
+
* @param lastAccessed - When the document was last accessed
|
|
17
|
+
* @param accessCount - How many times it has been accessed (defaults to 1 for backward compat)
|
|
18
|
+
* @param halfLifeDays - Half-life in days (default 7)
|
|
19
|
+
* @returns Score between 0 and 1
|
|
20
|
+
*/
|
|
21
|
+
function calculateDecayScore(lastAccessed, accessCount, halfLifeDays = 7) {
|
|
22
|
+
if (!lastAccessed || !(lastAccessed instanceof Date) || isNaN(lastAccessed.getTime())) {
|
|
23
|
+
return 0; // Invalid date — treat as expired
|
|
24
|
+
}
|
|
25
|
+
if (halfLifeDays <= 0)
|
|
26
|
+
halfLifeDays = 7; // Guard against division by zero
|
|
27
|
+
const count = accessCount && accessCount > 0 ? accessCount : 1;
|
|
28
|
+
const lambda = LN2 / halfLifeDays;
|
|
29
|
+
const daysSinceAccess = (Date.now() - lastAccessed.getTime()) / 86_400_000;
|
|
30
|
+
const baseDecay = Math.exp(-lambda * daysSinceAccess);
|
|
31
|
+
const accessBoost = 1 + Math.log(count);
|
|
32
|
+
return Math.min(1.0, baseDecay * accessBoost);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check whether a document's decay score is below the death threshold.
|
|
36
|
+
*/
|
|
37
|
+
function isExpired(score, threshold = 0.05) {
|
|
38
|
+
return score < threshold;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Estimate how many days until a document's score drops below the threshold,
|
|
42
|
+
* assuming no further accesses.
|
|
43
|
+
*
|
|
44
|
+
* Solves: threshold = exp(-λ * t) * (1 + ln(accessCount))
|
|
45
|
+
* → t = -ln(threshold / (1 + ln(accessCount))) / λ
|
|
46
|
+
* Returns days remaining from now (can be negative if already expired).
|
|
47
|
+
*/
|
|
48
|
+
function estimateDaysUntilExpiration(lastAccessed, accessCount, halfLifeDays = 7, threshold = 0.05) {
|
|
49
|
+
const count = accessCount && accessCount > 0 ? accessCount : 1;
|
|
50
|
+
const lambda = LN2 / halfLifeDays;
|
|
51
|
+
const accessBoost = 1 + Math.log(count);
|
|
52
|
+
// Total days from last_accessed until score hits threshold
|
|
53
|
+
const totalDays = -Math.log(threshold / accessBoost) / lambda;
|
|
54
|
+
// Days elapsed since last access
|
|
55
|
+
const daysSinceAccess = (Date.now() - lastAccessed.getTime()) / 86_400_000;
|
|
56
|
+
return totalDays - daysSinceAccess;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=decay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decay.js","sourceRoot":"","sources":["../src/decay.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAYH,kDAkBC;AAKD,8BAKC;AAUD,kEAkBC;AAlED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;AAErB;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CACjC,YAAkB,EAClB,WAA+B,EAC/B,eAAuB,CAAC;IAExB,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,YAAY,YAAY,IAAI,CAAC,IAAI,KAAK,CAAC,YAAY,CA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M,CAAC;IAE9D,iCAAiC;IACjC,MAAM,eAAe,GACnB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC;IAErD,OAAO,SAAS,GAAG,eAAe,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function horizontalBar(value: number, max: number, width?: number): string;
|
|
2
|
+
export declare function sparkline(data: number[]): string;
|
|
3
|
+
export declare function healthGauge(percentage: number, width?: number): string;
|
|
4
|
+
export declare function boxPanel(title: string, lines: string[], width?: number): string;
|
|
5
|
+
export declare function coloredHeader(title: string, subtitle: string, width?: number): string;
|
|
6
|
+
export declare function miniBar(value: number, max: number, width?: number): string;
|
|
7
|
+
export declare function percentLabel(pct: number): string;
|
|
8
|
+
export declare function activityArrow(lastAccessed: Date, thresholdDays?: number): string;
|
|
9
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/editor/charts.ts"],"names":[],"mappings":"AAoCA,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,MAAW,GACjB,MAAM,CAeR;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAgBhD;AAID,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAW,GACjB,MAAM,CAWR;AAID,wBAAgB,QAAQ,CACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,GAAE,MAAW,GACjB,MAAM,CA4BR;AAID,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAW,GACjB,MAAM,CAoBR;AAID,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAY7E;AAID,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAID,wBAAgB,aAAa,CAAC,YAAY,EAAE,IAAI,EAAE,aAAa,GAAE,MAAU,GAAG,MAAM,CAInF"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.horizontalBar = horizontalBar;
|
|
4
|
+
exports.sparkline = sparkline;
|
|
5
|
+
exports.healthGauge = healthGauge;
|
|
6
|
+
exports.boxPanel = boxPanel;
|
|
7
|
+
exports.coloredHeader = coloredHeader;
|
|
8
|
+
exports.miniBar = miniBar;
|
|
9
|
+
exports.percentLabel = percentLabel;
|
|
10
|
+
exports.activityArrow = activityArrow;
|
|
11
|
+
const colors_js_1 = require("./colors.js");
|
|
12
|
+
// ─── Unicode block elements for sparklines ──────────────────────────────────
|
|
13
|
+
const SPARK_BLOCKS = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'];
|
|
14
|
+
// ─── Bar characters ─────────────────────────────────────────────────────────
|
|
15
|
+
const BAR_FILLED = '█';
|
|
16
|
+
const BAR_EMPTY = '░';
|
|
17
|
+
// ─── Box-drawing characters ─────────────────────────────────────────────────
|
|
18
|
+
const BOX = {
|
|
19
|
+
topLeft: '┌',
|
|
20
|
+
topRight: '┐',
|
|
21
|
+
bottomLeft: '└',
|
|
22
|
+
bottomRight: '┘',
|
|
23
|
+
horizontal: '─',
|
|
24
|
+
vertical: '│',
|
|
25
|
+
titleLeft: '─ ',
|
|
26
|
+
titleRight: ' ─',
|
|
27
|
+
};
|
|
28
|
+
const DOUBLE_BOX = {
|
|
29
|
+
topLeft: '╔',
|
|
30
|
+
topRight: '╗',
|
|
31
|
+
bottomLeft: '╚',
|
|
32
|
+
bottomRight: '╝',
|
|
33
|
+
horizontal: '═',
|
|
34
|
+
vertical: '║',
|
|
35
|
+
};
|
|
36
|
+
// ─── Horizontal Bar Chart ───────────────────────────────────────────────────
|
|
37
|
+
function horizontalBar(value, max, width = 20) {
|
|
38
|
+
if (max <= 0 || value <= 0) {
|
|
39
|
+
return (0, colors_js_1.dim)(BAR_EMPTY.repeat(width));
|
|
40
|
+
}
|
|
41
|
+
const ratio = Math.min(value / max, 1);
|
|
42
|
+
const filled = Math.round(ratio * width);
|
|
43
|
+
const empty = width - filled;
|
|
44
|
+
let colorFn;
|
|
45
|
+
if (ratio >= 0.7)
|
|
46
|
+
colorFn = colors_js_1.green;
|
|
47
|
+
else if (ratio >= 0.4)
|
|
48
|
+
colorFn = colors_js_1.yellow;
|
|
49
|
+
else
|
|
50
|
+
colorFn = colors_js_1.cyan;
|
|
51
|
+
return colorFn(BAR_FILLED.repeat(filled)) + (0, colors_js_1.dim)(BAR_EMPTY.repeat(empty));
|
|
52
|
+
}
|
|
53
|
+
// ─── Sparkline ──────────────────────────────────────────────────────────────
|
|
54
|
+
function sparkline(data) {
|
|
55
|
+
if (data.length === 0)
|
|
56
|
+
return '';
|
|
57
|
+
const max = Math.max(...data);
|
|
58
|
+
const min = Math.min(...data);
|
|
59
|
+
const range = max - min;
|
|
60
|
+
return (0, colors_js_1.cyan)(data
|
|
61
|
+
.map((v) => {
|
|
62
|
+
if (range === 0)
|
|
63
|
+
return SPARK_BLOCKS[0];
|
|
64
|
+
const idx = Math.round(((v - min) / range) * (SPARK_BLOCKS.length - 1));
|
|
65
|
+
return SPARK_BLOCKS[idx];
|
|
66
|
+
})
|
|
67
|
+
.join(''));
|
|
68
|
+
}
|
|
69
|
+
// ─── Health Gauge ───────────────────────────────────────────────────────────
|
|
70
|
+
function healthGauge(percentage, width = 10) {
|
|
71
|
+
const clamped = Math.max(0, Math.min(100, percentage));
|
|
72
|
+
const filled = Math.round((clamped / 100) * width);
|
|
73
|
+
const empty = width - filled;
|
|
74
|
+
let colorFn;
|
|
75
|
+
if (clamped > 70)
|
|
76
|
+
colorFn = colors_js_1.green;
|
|
77
|
+
else if (clamped >= 40)
|
|
78
|
+
colorFn = colors_js_1.yellow;
|
|
79
|
+
else
|
|
80
|
+
colorFn = colors_js_1.red;
|
|
81
|
+
return colorFn(BAR_FILLED.repeat(filled)) + (0, colors_js_1.dim)(BAR_EMPTY.repeat(empty));
|
|
82
|
+
}
|
|
83
|
+
// ─── Box Panel ──────────────────────────────────────────────────────────────
|
|
84
|
+
function boxPanel(title, lines, width = 60) {
|
|
85
|
+
const innerWidth = width - 2;
|
|
86
|
+
// Title bar
|
|
87
|
+
const titleStr = title ? `${BOX.titleLeft}${(0, colors_js_1.boldBlueBright)(title)}${BOX.titleRight}` : '';
|
|
88
|
+
const titleVisualLen = title ? 2 + title.length + 2 : 0;
|
|
89
|
+
const topPadding = innerWidth - titleVisualLen;
|
|
90
|
+
const topBorder = (0, colors_js_1.dimBlue)(BOX.topLeft) +
|
|
91
|
+
(title
|
|
92
|
+
? (0, colors_js_1.dimBlue)(BOX.horizontal) + titleStr + (0, colors_js_1.dimBlue)(BOX.horizontal.repeat(Math.max(0, topPadding - 1)))
|
|
93
|
+
: (0, colors_js_1.dimBlue)(BOX.horizontal.repeat(innerWidth))) +
|
|
94
|
+
(0, colors_js_1.dimBlue)(BOX.topRight);
|
|
95
|
+
// Content lines
|
|
96
|
+
const contentLines = lines.map((line) => {
|
|
97
|
+
const visLen = (0, colors_js_1.stripAnsi)(line).length;
|
|
98
|
+
const pad = Math.max(0, innerWidth - visLen);
|
|
99
|
+
return (0, colors_js_1.dimBlue)(BOX.vertical) + ' ' + line + ' '.repeat(Math.max(0, pad - 1)) + (0, colors_js_1.dimBlue)(BOX.vertical);
|
|
100
|
+
});
|
|
101
|
+
// Bottom border
|
|
102
|
+
const bottomBorder = (0, colors_js_1.dimBlue)(BOX.bottomLeft) +
|
|
103
|
+
(0, colors_js_1.dimBlue)(BOX.horizontal.repeat(innerWidth)) +
|
|
104
|
+
(0, colors_js_1.dimBlue)(BOX.bottomRight);
|
|
105
|
+
return [topBorder, ...contentLines, bottomBorder].join('\n');
|
|
106
|
+
}
|
|
107
|
+
// ─── Colored Header Banner ──────────────────────────────────────────────────
|
|
108
|
+
function coloredHeader(title, subtitle, width = 62) {
|
|
109
|
+
const innerWidth = width - 2;
|
|
110
|
+
const pad = (text, w) => {
|
|
111
|
+
const visLen = (0, colors_js_1.stripAnsi)(text).length;
|
|
112
|
+
const total = Math.max(0, w - visLen);
|
|
113
|
+
const left = Math.floor(total / 2);
|
|
114
|
+
const right = total - left;
|
|
115
|
+
return ' '.repeat(left) + text + ' '.repeat(right);
|
|
116
|
+
};
|
|
117
|
+
const titleLine = pad((0, colors_js_1.boldCyan)(`◆ ${title} ◆`), innerWidth);
|
|
118
|
+
const subtitleLine = pad((0, colors_js_1.dimWhite)(subtitle), innerWidth);
|
|
119
|
+
const top = (0, colors_js_1.brightCyan)(DOUBLE_BOX.topLeft + DOUBLE_BOX.horizontal.repeat(innerWidth) + DOUBLE_BOX.topRight);
|
|
120
|
+
const mid1 = (0, colors_js_1.brightCyan)(DOUBLE_BOX.vertical) + titleLine + (0, colors_js_1.brightCyan)(DOUBLE_BOX.vertical);
|
|
121
|
+
const mid2 = (0, colors_js_1.brightCyan)(DOUBLE_BOX.vertical) + subtitleLine + (0, colors_js_1.brightCyan)(DOUBLE_BOX.vertical);
|
|
122
|
+
const bottom = (0, colors_js_1.brightCyan)(DOUBLE_BOX.bottomLeft + DOUBLE_BOX.horizontal.repeat(innerWidth) + DOUBLE_BOX.bottomRight);
|
|
123
|
+
return [top, mid1, mid2, bottom].join('\n');
|
|
124
|
+
}
|
|
125
|
+
// ─── Category Mini-Bar (inline with menu items) ─────────────────────────────
|
|
126
|
+
function miniBar(value, max, width = 6) {
|
|
127
|
+
if (max <= 0 || value <= 0)
|
|
128
|
+
return (0, colors_js_1.dim)(BAR_EMPTY.repeat(width));
|
|
129
|
+
const ratio = Math.min(value / max, 1);
|
|
130
|
+
const filled = Math.round(ratio * width);
|
|
131
|
+
const empty = width - filled;
|
|
132
|
+
let colorFn;
|
|
133
|
+
if (ratio >= 0.7)
|
|
134
|
+
colorFn = colors_js_1.green;
|
|
135
|
+
else if (ratio >= 0.4)
|
|
136
|
+
colorFn = colors_js_1.yellow;
|
|
137
|
+
else
|
|
138
|
+
colorFn = colors_js_1.cyan;
|
|
139
|
+
return colorFn(BAR_FILLED.repeat(filled)) + (0, colors_js_1.dim)(BAR_EMPTY.repeat(empty));
|
|
140
|
+
}
|
|
141
|
+
// ─── Percentage Label ───────────────────────────────────────────────────────
|
|
142
|
+
function percentLabel(pct) {
|
|
143
|
+
const rounded = Math.round(pct);
|
|
144
|
+
if (rounded > 70)
|
|
145
|
+
return (0, colors_js_1.green)(`${rounded}%`);
|
|
146
|
+
if (rounded >= 40)
|
|
147
|
+
return (0, colors_js_1.yellow)(`${rounded}%`);
|
|
148
|
+
return (0, colors_js_1.red)(`${rounded}%`);
|
|
149
|
+
}
|
|
150
|
+
// ���── Recent Activity Indicator ───────────────────────────────────────────���──
|
|
151
|
+
function activityArrow(lastAccessed, thresholdDays = 3) {
|
|
152
|
+
const daysAgo = (Date.now() - lastAccessed.getTime()) / 86_400_000;
|
|
153
|
+
if (daysAgo <= thresholdDays)
|
|
154
|
+
return (0, colors_js_1.green)(' ▲');
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=charts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.js","sourceRoot":"","sources":["../../src/editor/charts.ts"],"names":[],"mappings":";;AAoCA,sCAmBC;AAID,8BAgBC;AAID,kCAcC;AAID,4BAgCC;AAID,sCAwBC;AAID,0BAYC;AAID,oCAKC;AAID,sCAIC;AA9LD,2CAIqB;AAErB,+EAA+E;AAC/E,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal ANSI color utilities — no external dependencies.
|
|
3
|
+
* Replaces chalk for the editor module to avoid ESM-in-CJS issues.
|
|
4
|
+
*/
|
|
5
|
+
export declare const red: (t: string) => string;
|
|
6
|
+
export declare const green: (t: string) => string;
|
|
7
|
+
export declare const yellow: (t: string) => string;
|
|
8
|
+
export declare const blue: (t: string) => string;
|
|
9
|
+
export declare const magenta: (t: string) => string;
|
|
10
|
+
export declare const cyan: (t: string) => string;
|
|
11
|
+
export declare const white: (t: string) => string;
|
|
12
|
+
export declare const brightRed: (t: string) => string;
|
|
13
|
+
export declare const brightGreen: (t: string) => string;
|
|
14
|
+
export declare const brightYellow: (t: string) => string;
|
|
15
|
+
export declare const brightCyan: (t: string) => string;
|
|
16
|
+
export declare const brightWhite: (t: string) => string;
|
|
17
|
+
export declare const bold: (t: string) => string;
|
|
18
|
+
export declare const dim: (t: string) => string;
|
|
19
|
+
export declare const italic: (t: string) => string;
|
|
20
|
+
export declare const underline: (t: string) => string;
|
|
21
|
+
export declare const boldWhite: (t: string) => string;
|
|
22
|
+
export declare const boldCyan: (t: string) => string;
|
|
23
|
+
export declare const boldMagenta: (t: string) => string;
|
|
24
|
+
export declare const dimBlue: (t: string) => string;
|
|
25
|
+
export declare const dimWhite: (t: string) => string;
|
|
26
|
+
export declare const boldBlueBright: (t: string) => string;
|
|
27
|
+
export declare function stripAnsi(s: string): string;
|
|
28
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/editor/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,WAAkB,CAAC;AAChD,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,WAAkB,CAAC;AAClD,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,WAAkB,CAAC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|
4
|
+
* Replaces chalk for the editor module to avoid ESM-in-CJS issues.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.boldBlueBright = exports.dimWhite = exports.dimBlue = exports.boldMagenta = exports.boldCyan = exports.boldWhite = exports.underline = exports.italic = exports.dim = exports.bold = exports.brightWhite = exports.brightCyan = exports.brightYellow = exports.brightGreen = exports.brightRed = exports.white = exports.cyan = exports.magenta = exports.blue = exports.yellow = exports.green = exports.red = void 0;
|
|
8
|
+
exports.stripAnsi = stripAnsi;
|
|
9
|
+
const ESC = '\x1b[';
|
|
10
|
+
const RESET = `${ESC}0m`;
|
|
11
|
+
function wrap(code, text) {
|
|
12
|
+
return `${ESC}${code}m${text}${RESET}`;
|
|
13
|
+
}
|
|
14
|
+
// ─── Basic colors ───────────────────────────────────────────────────────────
|
|
15
|
+
const red = (t) => wrap('31', t);
|
|
16
|
+
exports.red = red;
|
|
17
|
+
const green = (t) => wrap('32', t);
|
|
18
|
+
exports.green = green;
|
|
19
|
+
const yellow = (t) => wrap('33', t);
|
|
20
|
+
exports.yellow = yellow;
|
|
21
|
+
const blue = (t) => wrap('34', t);
|
|
22
|
+
exports.blue = blue;
|
|
23
|
+
const magenta = (t) => wrap('35', t);
|
|
24
|
+
exports.magenta = magenta;
|
|
25
|
+
const cyan = (t) => wrap('36', t);
|
|
26
|
+
exports.cyan = cyan;
|
|
27
|
+
const white = (t) => wrap('37', t);
|
|
28
|
+
exports.white = white;
|
|
29
|
+
// ─── Bright colors ──────────────────────────────────────────────────────────
|
|
30
|
+
const brightRed = (t) => wrap('91', t);
|
|
31
|
+
exports.brightRed = brightRed;
|
|
32
|
+
const brightGreen = (t) => wrap('92', t);
|
|
33
|
+
exports.brightGreen = brightGreen;
|
|
34
|
+
const brightYellow = (t) => wrap('93', t);
|
|
35
|
+
exports.brightYellow = brightYellow;
|
|
36
|
+
const brightCyan = (t) => wrap('96', t);
|
|
37
|
+
exports.brightCyan = brightCyan;
|
|
38
|
+
const brightWhite = (t) => wrap('97', t);
|
|
39
|
+
exports.brightWhite = brightWhite;
|
|
40
|
+
// ─── Modifiers ──────────────────────────────────────────────────────────────
|
|
41
|
+
const bold = (t) => wrap('1', t);
|
|
42
|
+
exports.bold = bold;
|
|
43
|
+
const dim = (t) => wrap('2', t);
|
|
44
|
+
exports.dim = dim;
|
|
45
|
+
const italic = (t) => wrap('3', t);
|
|
46
|
+
exports.italic = italic;
|
|
47
|
+
const underline = (t) => wrap('4', t);
|
|
48
|
+
exports.underline = underline;
|
|
49
|
+
// ─── Composable helpers ─────────────────────────────────────────────────────
|
|
50
|
+
const boldWhite = (t) => (0, exports.bold)((0, exports.white)(t));
|
|
51
|
+
exports.boldWhite = boldWhite;
|
|
52
|
+
const boldCyan = (t) => (0, exports.bold)((0, exports.brightCyan)(t));
|
|
53
|
+
exports.boldCyan = boldCyan;
|
|
54
|
+
const boldMagenta = (t) => (0, exports.bold)((0, exports.magenta)(t));
|
|
55
|
+
exports.boldMagenta = boldMagenta;
|
|
56
|
+
const dimBlue = (t) => (0, exports.dim)((0, exports.blue)(t));
|
|
57
|
+
exports.dimBlue = dimBlue;
|
|
58
|
+
const dimWhite = (t) => (0, exports.dim)((0, exports.white)(t));
|
|
59
|
+
exports.dimWhite = dimWhite;
|
|
60
|
+
const boldBlueBright = (t) => (0, exports.bold)((0, exports.brightCyan)(t));
|
|
61
|
+
exports.boldBlueBright = boldBlueBright;
|
|
62
|
+
// ─── Strip ANSI ─────────────────────────────────────────────────────────────
|
|
63
|
+
function stripAnsi(s) {
|
|
64
|
+
return s.replace(/\x1b\[[0-9;]*m/g, '');
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/editor/colors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA6CH,8BAEC;AA7CD,MAAM,GAAG,GAAG,OAAO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AAA9C,QAAA,QAAQ,YAAsC;AACpD,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,YAAI,EAAC,IAAA,eAAO,EAAC,CAAC,CAAC,CAAC,CAAC;AAA9C,QAAA,WAAW,eAAmC;AACpD,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,WAAG,EAAC,IAAA,YAAI,EAAC,CAAC,CAAC,CAAC,CAAC;AAAtC,QAAA,OAAO,WAA+B;AAC5C,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,WAAG,EAAC,IAAA,aAAK,EAAC,CAAC,CAAC,CAAC,CAAC;AAAxC,QAAA,QAAQ,YAAgC;AAC9C,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,YAAI,EAAC,IAAA,kBAAU,EAAC,CAAC,CAAC,CAAC,CAAC;AAApD,QAAA,cAAc,kBAAsC;AAEjE,+EAA+E;AAE/E,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface CategoryStats {
|
|
2
|
+
name: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
count: number;
|
|
5
|
+
avgHealth: number;
|
|
6
|
+
mostRecentAccess: Date | null;
|
|
7
|
+
}
|
|
8
|
+
interface DashboardData {
|
|
9
|
+
projectName: string;
|
|
10
|
+
categories: CategoryStats[];
|
|
11
|
+
totalItems: number;
|
|
12
|
+
activeItems: number;
|
|
13
|
+
decayingItems: number;
|
|
14
|
+
avgHealth: number;
|
|
15
|
+
dailyActivity: number[];
|
|
16
|
+
dailyAccesses: number[];
|
|
17
|
+
mostActiveCategory: string;
|
|
18
|
+
leastUsedCategory: string;
|
|
19
|
+
}
|
|
20
|
+
declare function gatherProjectStats(): Promise<DashboardData>;
|
|
21
|
+
declare function gatherDeveloperStats(): Promise<DashboardData>;
|
|
22
|
+
declare function formatDashboard(data: DashboardData, scope: 'project' | 'developer'): string;
|
|
23
|
+
export declare function renderDashboard(scope?: 'project' | 'developer'): Promise<string>;
|
|
24
|
+
export { gatherProjectStats, gatherDeveloperStats, formatDashboard };
|
|
25
|
+
export type { DashboardData, CategoryStats };
|
|
26
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/editor/dashboard.ts"],"names":[],"mappings":"AAqBA,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;CAC/B;AAED,UAAU,aAAa;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAoHD,iBAAe,kBAAkB,IAAI,OAAO,CAAC,aAAa,CAAC,CAG1D;AAED,iBAAe,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC,CAE5D;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,CA4CpF;AAED,wBAAsB,eAAe,CAAC,KAAK,GAAE,SAAS,GAAG,WAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,CAGjG;AAED,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,eAAe,EAAE,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderDashboard = renderDashboard;
|
|
4
|
+
exports.gatherProjectStats = gatherProjectStats;
|
|
5
|
+
exports.gatherDeveloperStats = gatherDeveloperStats;
|
|
6
|
+
exports.formatDashboard = formatDashboard;
|
|
7
|
+
const colors_js_1 = require("./colors.js");
|
|
8
|
+
const client_js_1 = require("../atlas/client.js");
|
|
9
|
+
const project_id_js_1 = require("../project-id.js");
|
|
10
|
+
const project_js_1 = require("../memory/project.js");
|
|
11
|
+
const decay_js_1 = require("../decay.js");
|
|
12
|
+
const config_js_1 = require("../config.js");
|
|
13
|
+
const charts_js_1 = require("./charts.js");
|
|
14
|
+
const PROJECT_TYPES = ['architecture', 'pattern', 'avoid', 'thread', 'command', 'context'];
|
|
15
|
+
const DEV_TYPES = ['preference', 'style', 'dev_default', 'dev_avoid'];
|
|
16
|
+
const DISPLAY_NAMES = {
|
|
17
|
+
architecture: 'Architecture',
|
|
18
|
+
pattern: 'Patterns',
|
|
19
|
+
avoid: 'Avoid Rules',
|
|
20
|
+
thread: 'Open Threads',
|
|
21
|
+
command: 'Commands',
|
|
22
|
+
context: 'Context',
|
|
23
|
+
preference: 'Preferences',
|
|
24
|
+
style: 'Style',
|
|
25
|
+
dev_default: 'Defaults',
|
|
26
|
+
dev_avoid: 'Dev Avoid',
|
|
27
|
+
};
|
|
28
|
+
async function gatherStats(types, filterField, filterId, projectName) {
|
|
29
|
+
const collection = await (0, client_js_1.getCollection)();
|
|
30
|
+
const halfLife = (0, config_js_1.getDecayHalfLifeDays)();
|
|
31
|
+
const deathThreshold = (0, config_js_1.getDecayDeathThreshold)();
|
|
32
|
+
const docs = await collection
|
|
33
|
+
.find({ [filterField]: filterId, type: { $in: types } }, { projection: { type: 1, last_accessed: 1, access_count: 1, created_at: 1 } })
|
|
34
|
+
.toArray();
|
|
35
|
+
const categories = [];
|
|
36
|
+
let totalHealth = 0;
|
|
37
|
+
let totalItems = 0;
|
|
38
|
+
let activeItems = 0;
|
|
39
|
+
let decayingItems = 0;
|
|
40
|
+
const now = Date.now();
|
|
41
|
+
const dailyActivity = new Array(7).fill(0);
|
|
42
|
+
const dailyAccesses = new Array(7).fill(0);
|
|
43
|
+
const categoryMap = new Map();
|
|
44
|
+
for (const type of types) {
|
|
45
|
+
categoryMap.set(type, { count: 0, healthSum: 0, mostRecent: null });
|
|
46
|
+
}
|
|
47
|
+
for (const doc of docs) {
|
|
48
|
+
const type = doc.type;
|
|
49
|
+
const cat = categoryMap.get(type);
|
|
50
|
+
if (!cat)
|
|
51
|
+
continue;
|
|
52
|
+
const lastAccessed = doc.last_accessed;
|
|
53
|
+
const accessCount = doc.access_count;
|
|
54
|
+
const score = (0, decay_js_1.calculateDecayScore)(lastAccessed, accessCount, halfLife);
|
|
55
|
+
cat.count++;
|
|
56
|
+
cat.healthSum += score * 100;
|
|
57
|
+
if (!cat.mostRecent || lastAccessed > cat.mostRecent) {
|
|
58
|
+
cat.mostRecent = lastAccessed;
|
|
59
|
+
}
|
|
60
|
+
totalItems++;
|
|
61
|
+
totalHealth += score * 100;
|
|
62
|
+
if (score >= 0.2)
|
|
63
|
+
activeItems++;
|
|
64
|
+
else if (score >= deathThreshold)
|
|
65
|
+
decayingItems++;
|
|
66
|
+
const daysAgo = Math.floor((now - lastAccessed.getTime()) / 86_400_000);
|
|
67
|
+
if (daysAgo >= 0 && daysAgo < 7) {
|
|
68
|
+
dailyActivity[6 - daysAgo]++;
|
|
69
|
+
dailyAccesses[6 - daysAgo] += accessCount || 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let maxCount = 0;
|
|
73
|
+
let minCount = Infinity;
|
|
74
|
+
let mostActiveCategory = 'None';
|
|
75
|
+
let leastUsedCategory = 'None';
|
|
76
|
+
for (const [type, cat] of categoryMap) {
|
|
77
|
+
categories.push({
|
|
78
|
+
name: type,
|
|
79
|
+
displayName: DISPLAY_NAMES[type] || type,
|
|
80
|
+
count: cat.count,
|
|
81
|
+
avgHealth: cat.count > 0 ? cat.healthSum / cat.count : 0,
|
|
82
|
+
mostRecentAccess: cat.mostRecent,
|
|
83
|
+
});
|
|
84
|
+
if (cat.count > maxCount) {
|
|
85
|
+
maxCount = cat.count;
|
|
86
|
+
mostActiveCategory = DISPLAY_NAMES[type] || type;
|
|
87
|
+
}
|
|
88
|
+
if (cat.count < minCount && cat.count > 0) {
|
|
89
|
+
minCount = cat.count;
|
|
90
|
+
leastUsedCategory = DISPLAY_NAMES[type] || type;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
projectName,
|
|
95
|
+
categories,
|
|
96
|
+
totalItems,
|
|
97
|
+
activeItems,
|
|
98
|
+
decayingItems,
|
|
99
|
+
avgHealth: totalItems > 0 ? totalHealth / totalItems : 0,
|
|
100
|
+
dailyActivity,
|
|
101
|
+
dailyAccesses,
|
|
102
|
+
mostActiveCategory,
|
|
103
|
+
leastUsedCategory,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async function gatherProjectStats() {
|
|
107
|
+
const pm = await (0, project_js_1.getProjectMeta)();
|
|
108
|
+
return gatherStats(PROJECT_TYPES, 'project_id', (0, project_id_js_1.getProjectId)(), pm?.project_name || 'Unknown Project');
|
|
109
|
+
}
|
|
110
|
+
async function gatherDeveloperStats() {
|
|
111
|
+
return gatherStats(DEV_TYPES, 'developer_id', (0, project_id_js_1.getDeveloperId)(), 'Developer Memory');
|
|
112
|
+
}
|
|
113
|
+
function formatDashboard(data, scope) {
|
|
114
|
+
const lines = [];
|
|
115
|
+
const title = scope === 'project' ? 'CLAUDE MEMORY BROWSER' : 'DEVELOPER MEMORY BROWSER';
|
|
116
|
+
lines.push((0, charts_js_1.coloredHeader)(title, `Project: ${data.projectName}`));
|
|
117
|
+
lines.push('');
|
|
118
|
+
// Memory Usage panel
|
|
119
|
+
const maxCount = Math.max(...data.categories.map((c) => c.count), 1);
|
|
120
|
+
const usageLines = [];
|
|
121
|
+
for (const cat of data.categories) {
|
|
122
|
+
const nameStr = (0, colors_js_1.boldWhite)(cat.displayName.padEnd(14));
|
|
123
|
+
const bar = (0, charts_js_1.horizontalBar)(cat.count, maxCount, 20);
|
|
124
|
+
const countStr = (0, colors_js_1.dim)(`${cat.count} item${cat.count !== 1 ? 's' : ''}`);
|
|
125
|
+
const pct = data.totalItems > 0 ? (0, charts_js_1.percentLabel)((cat.count / data.totalItems) * 100) : (0, colors_js_1.dim)('0%');
|
|
126
|
+
const arrow = cat.mostRecentAccess ? (0, charts_js_1.activityArrow)(cat.mostRecentAccess) : '';
|
|
127
|
+
usageLines.push(`${nameStr} ${bar} ${countStr.padEnd(12)} ${pct}${arrow}`);
|
|
128
|
+
}
|
|
129
|
+
lines.push((0, charts_js_1.boxPanel)('Memory Usage', usageLines, 70));
|
|
130
|
+
lines.push('');
|
|
131
|
+
// Health panel
|
|
132
|
+
const activePercent = data.totalItems > 0 ? Math.round((data.activeItems / data.totalItems) * 100) : 0;
|
|
133
|
+
const decayPercent = data.totalItems > 0 ? Math.round((data.decayingItems / data.totalItems) * 100) : 0;
|
|
134
|
+
const healthLines = [
|
|
135
|
+
`${(0, colors_js_1.dim)('Total:')} ${(0, colors_js_1.boldWhite)(String(data.totalItems))} items`,
|
|
136
|
+
`${(0, colors_js_1.dim)('Active:')} ${(0, colors_js_1.green)(String(data.activeItems))} (${activePercent}%)`,
|
|
137
|
+
`${(0, colors_js_1.dim)('Decaying:')} ${(0, colors_js_1.yellow)(String(data.decayingItems))} (${decayPercent}%)`,
|
|
138
|
+
`${(0, colors_js_1.dim)('Health:')} ${(0, charts_js_1.healthGauge)(data.avgHealth)} ${(0, charts_js_1.percentLabel)(data.avgHealth)}`,
|
|
139
|
+
];
|
|
140
|
+
lines.push((0, charts_js_1.boxPanel)('Health', healthLines, 32));
|
|
141
|
+
lines.push('');
|
|
142
|
+
// Activity panel
|
|
143
|
+
const activityLines = [
|
|
144
|
+
`${(0, colors_js_1.dim)('Last 7 days:')} ${(0, charts_js_1.sparkline)(data.dailyActivity)}`,
|
|
145
|
+
`${(0, colors_js_1.dim)('Accesses:')} ${(0, charts_js_1.sparkline)(data.dailyAccesses)}`,
|
|
146
|
+
`${(0, colors_js_1.dim)('Most active:')} ${(0, colors_js_1.white)(data.mostActiveCategory)}`,
|
|
147
|
+
`${(0, colors_js_1.dim)('Least used:')} ${(0, colors_js_1.white)(data.leastUsedCategory)}`,
|
|
148
|
+
];
|
|
149
|
+
lines.push((0, charts_js_1.boxPanel)('Activity', activityLines, 42));
|
|
150
|
+
return lines.join('\n');
|
|
151
|
+
}
|
|
152
|
+
async function renderDashboard(scope = 'project') {
|
|
153
|
+
const data = scope === 'project' ? await gatherProjectStats() : await gatherDeveloperStats();
|
|
154
|
+
return formatDashboard(data, scope);
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=dashboard.js.map
|