@memrosetta/cli 0.4.7 → 0.5.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.
Files changed (43) hide show
  1. package/dist/chunk-2MO65JLK.js +139 -0
  2. package/dist/chunk-5PH2RDAS.js +750 -0
  3. package/dist/chunk-IKIJVRHU.js +16 -0
  4. package/dist/chunk-PMQKXYS6.js +752 -0
  5. package/dist/chunk-SYPVELIW.js +64 -0
  6. package/dist/chunk-TSA67QME.js +56 -0
  7. package/dist/chunk-UKGD7QXV.js +81 -0
  8. package/dist/chunk-UOT33X3Q.js +750 -0
  9. package/dist/chunk-VR3TRSC7.js +148 -0
  10. package/dist/clear-HNVVALWL.js +39 -0
  11. package/dist/compress-VZJHSVJK.js +33 -0
  12. package/dist/count-WRCFIWWS.js +24 -0
  13. package/dist/enforce-PHO4L7C2.js +381 -0
  14. package/dist/feedback-JXSKOFRS.js +51 -0
  15. package/dist/feedback-O6NKG46O.js +51 -0
  16. package/dist/hooks/enforce-claude-code.js +119 -0
  17. package/dist/hooks/on-prompt.js +9 -5
  18. package/dist/hooks/on-stop.js +8 -4
  19. package/dist/index.js +22 -16
  20. package/dist/ingest-JWLBIFEI.js +97 -0
  21. package/dist/init-ARU2CIOH.js +205 -0
  22. package/dist/init-C2MCDVWL.js +205 -0
  23. package/dist/init-LIWL7Y3H.js +205 -0
  24. package/dist/init-VUJX3RRW.js +205 -0
  25. package/dist/invalidate-QPOV2E5U.js +40 -0
  26. package/dist/invalidate-VUHHNZUX.js +40 -0
  27. package/dist/maintain-UUZ76QET.js +37 -0
  28. package/dist/relate-MIOQYWTI.js +57 -0
  29. package/dist/relate-TEZ3GIIY.js +57 -0
  30. package/dist/reset-HQFOMYVP.js +129 -0
  31. package/dist/reset-OVU4A575.js +129 -0
  32. package/dist/reset-T6DPQCWI.js +129 -0
  33. package/dist/reset-WMDSMCAR.js +129 -0
  34. package/dist/search-IXV43G2C.js +48 -0
  35. package/dist/status-BLHKHB34.js +184 -0
  36. package/dist/status-CNGR7YDV.js +184 -0
  37. package/dist/status-IHYARQXU.js +184 -0
  38. package/dist/store-DTN3PTFQ.js +101 -0
  39. package/dist/store-V7I5RJ6Y.js +101 -0
  40. package/dist/sync-EHYMBZHE.js +542 -0
  41. package/dist/sync-UJBD7575.js +542 -0
  42. package/dist/working-memory-CH524PJA.js +53 -0
  43. package/package.json +6 -5
@@ -0,0 +1,48 @@
1
+ import {
2
+ optionalOption,
3
+ requireOption
4
+ } from "./chunk-SYPVELIW.js";
5
+ import {
6
+ getEngine
7
+ } from "./chunk-VAVUPQZA.js";
8
+ import {
9
+ output,
10
+ outputError
11
+ } from "./chunk-ET6TNQOJ.js";
12
+ import {
13
+ getDefaultUserId
14
+ } from "./chunk-SEPYQK3J.js";
15
+
16
+ // src/commands/search.ts
17
+ async function run(options) {
18
+ const { args, format, db, noEmbeddings } = options;
19
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
20
+ const query = requireOption(args, "--query", "query");
21
+ const limitRaw = optionalOption(args, "--limit");
22
+ const namespace = optionalOption(args, "--namespace");
23
+ const typesRaw = optionalOption(args, "--types");
24
+ const minConfidenceRaw = optionalOption(args, "--min-confidence");
25
+ const limit = limitRaw ? parseInt(limitRaw, 10) : 5;
26
+ if (isNaN(limit) || limit < 1) {
27
+ outputError("Invalid limit value", format);
28
+ process.exitCode = 1;
29
+ return;
30
+ }
31
+ const memoryTypes = typesRaw ? typesRaw.split(",") : void 0;
32
+ const minConfidence = minConfidenceRaw ? parseFloat(minConfidenceRaw) : void 0;
33
+ const engine = await getEngine({ db, noEmbeddings });
34
+ const response = await engine.search({
35
+ userId,
36
+ query,
37
+ namespace,
38
+ limit,
39
+ filters: {
40
+ memoryTypes,
41
+ minConfidence
42
+ }
43
+ });
44
+ output(response, format);
45
+ }
46
+ export {
47
+ run
48
+ };
@@ -0,0 +1,184 @@
1
+ import {
2
+ isClaudeCodeConfigured,
3
+ isCodexConfigured,
4
+ isCursorConfigured,
5
+ isGeminiConfigured,
6
+ isGenericMCPConfigured
7
+ } from "./chunk-PMQKXYS6.js";
8
+ import {
9
+ resolveCliVersion
10
+ } from "./chunk-YXK6FDB6.js";
11
+ import {
12
+ getDefaultDbPath
13
+ } from "./chunk-VAVUPQZA.js";
14
+ import {
15
+ output
16
+ } from "./chunk-ET6TNQOJ.js";
17
+ import {
18
+ getConfig
19
+ } from "./chunk-SEPYQK3J.js";
20
+
21
+ // src/commands/status.ts
22
+ import { existsSync, statSync } from "fs";
23
+ async function run(options) {
24
+ const { format, db, noEmbeddings } = options;
25
+ const config = getConfig();
26
+ const dbPath = db ?? config.dbPath ?? getDefaultDbPath();
27
+ const exists = existsSync(dbPath);
28
+ let sizeBytes = 0;
29
+ let sizeFormatted = "0B";
30
+ let memoryCount = 0;
31
+ let userList = [];
32
+ let qualityFresh = 0;
33
+ let qualityInvalidated = 0;
34
+ let qualityWithRelations = 0;
35
+ let qualityAvgActivation = 0;
36
+ const embeddingsEnabled = !noEmbeddings && config.enableEmbeddings !== false;
37
+ if (exists) {
38
+ const stat = statSync(dbPath);
39
+ sizeBytes = stat.size;
40
+ sizeFormatted = formatSize(sizeBytes);
41
+ try {
42
+ const Database = (await import("better-sqlite3")).default;
43
+ const dbConn = new Database(dbPath);
44
+ dbConn.pragma("journal_mode = WAL");
45
+ const countRow = dbConn.prepare("SELECT COUNT(*) as count FROM memories").get();
46
+ memoryCount = countRow.count;
47
+ const userRows = dbConn.prepare("SELECT DISTINCT user_id FROM memories ORDER BY user_id").all();
48
+ userList = userRows.map((r) => r.user_id);
49
+ const freshRow = dbConn.prepare(
50
+ "SELECT COUNT(*) as c FROM memories WHERE is_latest = 1 AND invalidated_at IS NULL"
51
+ ).get();
52
+ qualityFresh = freshRow.c;
53
+ const invalidatedRow = dbConn.prepare(
54
+ "SELECT COUNT(*) as c FROM memories WHERE invalidated_at IS NOT NULL"
55
+ ).get();
56
+ qualityInvalidated = invalidatedRow.c;
57
+ const relationsRow = dbConn.prepare(
58
+ "SELECT COUNT(DISTINCT src_memory_id) + COUNT(DISTINCT dst_memory_id) as c FROM memory_relations"
59
+ ).get();
60
+ qualityWithRelations = relationsRow.c;
61
+ const avgRow = dbConn.prepare(
62
+ "SELECT AVG(activation_score) as avg FROM memories WHERE is_latest = 1"
63
+ ).get();
64
+ qualityAvgActivation = avgRow.avg ?? 0;
65
+ dbConn.close();
66
+ } catch {
67
+ }
68
+ }
69
+ const claudeCodeStatus = isClaudeCodeConfigured();
70
+ const cursorStatus = isCursorConfigured();
71
+ const codexStatus = isCodexConfigured();
72
+ const geminiStatus = isGeminiConfigured();
73
+ const mcpStatus = isGenericMCPConfigured();
74
+ if (format === "text") {
75
+ process.stdout.write("MemRosetta Status\n");
76
+ process.stdout.write(`${"=".repeat(40)}
77
+
78
+ `);
79
+ process.stdout.write(
80
+ `Database: ${dbPath} (${exists ? `exists, ${sizeFormatted}` : "not found"})
81
+ `
82
+ );
83
+ process.stdout.write(`Memories: ${memoryCount}
84
+ `);
85
+ if (userList.length > 0) {
86
+ process.stdout.write(
87
+ `Users: ${userList.length} (${userList.join(", ")})
88
+ `
89
+ );
90
+ } else {
91
+ process.stdout.write("Users: 0\n");
92
+ }
93
+ const embeddingModelLabel = getEmbeddingModelLabel();
94
+ process.stdout.write(
95
+ `Embeddings: ${embeddingsEnabled ? `enabled (${embeddingModelLabel})` : "disabled"}
96
+ `
97
+ );
98
+ if (memoryCount > 0) {
99
+ process.stdout.write("\nQuality:\n");
100
+ process.stdout.write(
101
+ ` Fresh (is_latest=1): ${qualityFresh} / ${memoryCount}
102
+ `
103
+ );
104
+ process.stdout.write(` Invalidated: ${qualityInvalidated}
105
+ `);
106
+ process.stdout.write(` With relations: ${qualityWithRelations}
107
+ `);
108
+ process.stdout.write(
109
+ ` Avg activation: ${qualityAvgActivation.toFixed(2)}
110
+ `
111
+ );
112
+ }
113
+ process.stdout.write("\nIntegrations:\n");
114
+ process.stdout.write(
115
+ ` Claude Code: ${claudeCodeStatus ? "configured (hooks + MCP)" : "not configured"}
116
+ `
117
+ );
118
+ process.stdout.write(
119
+ ` Cursor: ${cursorStatus ? "configured (MCP)" : "not configured"}
120
+ `
121
+ );
122
+ process.stdout.write(
123
+ ` Codex: ${codexStatus ? "configured (MCP)" : "not configured"}
124
+ `
125
+ );
126
+ process.stdout.write(
127
+ ` Gemini: ${geminiStatus ? "configured (MCP)" : "not configured"}
128
+ `
129
+ );
130
+ process.stdout.write(
131
+ ` MCP (generic): ${mcpStatus ? "configured" : "not configured"}
132
+ `
133
+ );
134
+ return;
135
+ }
136
+ output(
137
+ {
138
+ version: resolveCliVersion(),
139
+ database: {
140
+ path: dbPath,
141
+ exists,
142
+ sizeBytes,
143
+ sizeFormatted
144
+ },
145
+ memories: memoryCount,
146
+ users: userList,
147
+ quality: {
148
+ fresh: qualityFresh,
149
+ invalidated: qualityInvalidated,
150
+ withRelations: qualityWithRelations,
151
+ avgActivation: qualityAvgActivation
152
+ },
153
+ embeddings: embeddingsEnabled,
154
+ embeddingModel: getEmbeddingModelLabel(),
155
+ embeddingPreset: getConfig().embeddingPreset ?? "en",
156
+ integrations: {
157
+ claudeCode: claudeCodeStatus,
158
+ cursor: cursorStatus,
159
+ codex: codexStatus,
160
+ gemini: geminiStatus,
161
+ mcp: mcpStatus
162
+ }
163
+ },
164
+ format
165
+ );
166
+ }
167
+ function formatSize(bytes) {
168
+ if (bytes < 1024) return `${bytes}B`;
169
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
170
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
171
+ }
172
+ var PRESET_MODEL_LABELS = {
173
+ en: "bge-small-en-v1.5",
174
+ multilingual: "multilingual-e5-small",
175
+ ko: "ko-sroberta-multitask"
176
+ };
177
+ function getEmbeddingModelLabel() {
178
+ const config = getConfig();
179
+ const preset = config.embeddingPreset ?? "en";
180
+ return PRESET_MODEL_LABELS[preset] ?? preset;
181
+ }
182
+ export {
183
+ run
184
+ };
@@ -0,0 +1,184 @@
1
+ import {
2
+ isClaudeCodeConfigured,
3
+ isCodexConfigured,
4
+ isCursorConfigured,
5
+ isGeminiConfigured,
6
+ isGenericMCPConfigured
7
+ } from "./chunk-UOT33X3Q.js";
8
+ import {
9
+ resolveCliVersion
10
+ } from "./chunk-YXK6FDB6.js";
11
+ import {
12
+ getDefaultDbPath
13
+ } from "./chunk-VAVUPQZA.js";
14
+ import {
15
+ output
16
+ } from "./chunk-ET6TNQOJ.js";
17
+ import {
18
+ getConfig
19
+ } from "./chunk-SEPYQK3J.js";
20
+
21
+ // src/commands/status.ts
22
+ import { existsSync, statSync } from "fs";
23
+ async function run(options) {
24
+ const { format, db, noEmbeddings } = options;
25
+ const config = getConfig();
26
+ const dbPath = db ?? config.dbPath ?? getDefaultDbPath();
27
+ const exists = existsSync(dbPath);
28
+ let sizeBytes = 0;
29
+ let sizeFormatted = "0B";
30
+ let memoryCount = 0;
31
+ let userList = [];
32
+ let qualityFresh = 0;
33
+ let qualityInvalidated = 0;
34
+ let qualityWithRelations = 0;
35
+ let qualityAvgActivation = 0;
36
+ const embeddingsEnabled = !noEmbeddings && config.enableEmbeddings !== false;
37
+ if (exists) {
38
+ const stat = statSync(dbPath);
39
+ sizeBytes = stat.size;
40
+ sizeFormatted = formatSize(sizeBytes);
41
+ try {
42
+ const Database = (await import("better-sqlite3")).default;
43
+ const dbConn = new Database(dbPath);
44
+ dbConn.pragma("journal_mode = WAL");
45
+ const countRow = dbConn.prepare("SELECT COUNT(*) as count FROM memories").get();
46
+ memoryCount = countRow.count;
47
+ const userRows = dbConn.prepare("SELECT DISTINCT user_id FROM memories ORDER BY user_id").all();
48
+ userList = userRows.map((r) => r.user_id);
49
+ const freshRow = dbConn.prepare(
50
+ "SELECT COUNT(*) as c FROM memories WHERE is_latest = 1 AND invalidated_at IS NULL"
51
+ ).get();
52
+ qualityFresh = freshRow.c;
53
+ const invalidatedRow = dbConn.prepare(
54
+ "SELECT COUNT(*) as c FROM memories WHERE invalidated_at IS NOT NULL"
55
+ ).get();
56
+ qualityInvalidated = invalidatedRow.c;
57
+ const relationsRow = dbConn.prepare(
58
+ "SELECT COUNT(DISTINCT src_memory_id) + COUNT(DISTINCT dst_memory_id) as c FROM memory_relations"
59
+ ).get();
60
+ qualityWithRelations = relationsRow.c;
61
+ const avgRow = dbConn.prepare(
62
+ "SELECT AVG(activation_score) as avg FROM memories WHERE is_latest = 1"
63
+ ).get();
64
+ qualityAvgActivation = avgRow.avg ?? 0;
65
+ dbConn.close();
66
+ } catch {
67
+ }
68
+ }
69
+ const claudeCodeStatus = isClaudeCodeConfigured();
70
+ const cursorStatus = isCursorConfigured();
71
+ const codexStatus = isCodexConfigured();
72
+ const geminiStatus = isGeminiConfigured();
73
+ const mcpStatus = isGenericMCPConfigured();
74
+ if (format === "text") {
75
+ process.stdout.write("MemRosetta Status\n");
76
+ process.stdout.write(`${"=".repeat(40)}
77
+
78
+ `);
79
+ process.stdout.write(
80
+ `Database: ${dbPath} (${exists ? `exists, ${sizeFormatted}` : "not found"})
81
+ `
82
+ );
83
+ process.stdout.write(`Memories: ${memoryCount}
84
+ `);
85
+ if (userList.length > 0) {
86
+ process.stdout.write(
87
+ `Users: ${userList.length} (${userList.join(", ")})
88
+ `
89
+ );
90
+ } else {
91
+ process.stdout.write("Users: 0\n");
92
+ }
93
+ const embeddingModelLabel = getEmbeddingModelLabel();
94
+ process.stdout.write(
95
+ `Embeddings: ${embeddingsEnabled ? `enabled (${embeddingModelLabel})` : "disabled"}
96
+ `
97
+ );
98
+ if (memoryCount > 0) {
99
+ process.stdout.write("\nQuality:\n");
100
+ process.stdout.write(
101
+ ` Fresh (is_latest=1): ${qualityFresh} / ${memoryCount}
102
+ `
103
+ );
104
+ process.stdout.write(` Invalidated: ${qualityInvalidated}
105
+ `);
106
+ process.stdout.write(` With relations: ${qualityWithRelations}
107
+ `);
108
+ process.stdout.write(
109
+ ` Avg activation: ${qualityAvgActivation.toFixed(2)}
110
+ `
111
+ );
112
+ }
113
+ process.stdout.write("\nIntegrations:\n");
114
+ process.stdout.write(
115
+ ` Claude Code: ${claudeCodeStatus ? "configured (hooks + MCP)" : "not configured"}
116
+ `
117
+ );
118
+ process.stdout.write(
119
+ ` Cursor: ${cursorStatus ? "configured (MCP)" : "not configured"}
120
+ `
121
+ );
122
+ process.stdout.write(
123
+ ` Codex: ${codexStatus ? "configured (MCP)" : "not configured"}
124
+ `
125
+ );
126
+ process.stdout.write(
127
+ ` Gemini: ${geminiStatus ? "configured (MCP)" : "not configured"}
128
+ `
129
+ );
130
+ process.stdout.write(
131
+ ` MCP (generic): ${mcpStatus ? "configured" : "not configured"}
132
+ `
133
+ );
134
+ return;
135
+ }
136
+ output(
137
+ {
138
+ version: resolveCliVersion(),
139
+ database: {
140
+ path: dbPath,
141
+ exists,
142
+ sizeBytes,
143
+ sizeFormatted
144
+ },
145
+ memories: memoryCount,
146
+ users: userList,
147
+ quality: {
148
+ fresh: qualityFresh,
149
+ invalidated: qualityInvalidated,
150
+ withRelations: qualityWithRelations,
151
+ avgActivation: qualityAvgActivation
152
+ },
153
+ embeddings: embeddingsEnabled,
154
+ embeddingModel: getEmbeddingModelLabel(),
155
+ embeddingPreset: getConfig().embeddingPreset ?? "en",
156
+ integrations: {
157
+ claudeCode: claudeCodeStatus,
158
+ cursor: cursorStatus,
159
+ codex: codexStatus,
160
+ gemini: geminiStatus,
161
+ mcp: mcpStatus
162
+ }
163
+ },
164
+ format
165
+ );
166
+ }
167
+ function formatSize(bytes) {
168
+ if (bytes < 1024) return `${bytes}B`;
169
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
170
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
171
+ }
172
+ var PRESET_MODEL_LABELS = {
173
+ en: "bge-small-en-v1.5",
174
+ multilingual: "multilingual-e5-small",
175
+ ko: "ko-sroberta-multitask"
176
+ };
177
+ function getEmbeddingModelLabel() {
178
+ const config = getConfig();
179
+ const preset = config.embeddingPreset ?? "en";
180
+ return PRESET_MODEL_LABELS[preset] ?? preset;
181
+ }
182
+ export {
183
+ run
184
+ };
@@ -0,0 +1,184 @@
1
+ import {
2
+ isClaudeCodeConfigured,
3
+ isCodexConfigured,
4
+ isCursorConfigured,
5
+ isGeminiConfigured,
6
+ isGenericMCPConfigured
7
+ } from "./chunk-5PH2RDAS.js";
8
+ import {
9
+ resolveCliVersion
10
+ } from "./chunk-YXK6FDB6.js";
11
+ import {
12
+ getDefaultDbPath
13
+ } from "./chunk-VAVUPQZA.js";
14
+ import {
15
+ output
16
+ } from "./chunk-ET6TNQOJ.js";
17
+ import {
18
+ getConfig
19
+ } from "./chunk-SEPYQK3J.js";
20
+
21
+ // src/commands/status.ts
22
+ import { existsSync, statSync } from "fs";
23
+ async function run(options) {
24
+ const { format, db, noEmbeddings } = options;
25
+ const config = getConfig();
26
+ const dbPath = db ?? config.dbPath ?? getDefaultDbPath();
27
+ const exists = existsSync(dbPath);
28
+ let sizeBytes = 0;
29
+ let sizeFormatted = "0B";
30
+ let memoryCount = 0;
31
+ let userList = [];
32
+ let qualityFresh = 0;
33
+ let qualityInvalidated = 0;
34
+ let qualityWithRelations = 0;
35
+ let qualityAvgActivation = 0;
36
+ const embeddingsEnabled = !noEmbeddings && config.enableEmbeddings !== false;
37
+ if (exists) {
38
+ const stat = statSync(dbPath);
39
+ sizeBytes = stat.size;
40
+ sizeFormatted = formatSize(sizeBytes);
41
+ try {
42
+ const Database = (await import("better-sqlite3")).default;
43
+ const dbConn = new Database(dbPath);
44
+ dbConn.pragma("journal_mode = WAL");
45
+ const countRow = dbConn.prepare("SELECT COUNT(*) as count FROM memories").get();
46
+ memoryCount = countRow.count;
47
+ const userRows = dbConn.prepare("SELECT DISTINCT user_id FROM memories ORDER BY user_id").all();
48
+ userList = userRows.map((r) => r.user_id);
49
+ const freshRow = dbConn.prepare(
50
+ "SELECT COUNT(*) as c FROM memories WHERE is_latest = 1 AND invalidated_at IS NULL"
51
+ ).get();
52
+ qualityFresh = freshRow.c;
53
+ const invalidatedRow = dbConn.prepare(
54
+ "SELECT COUNT(*) as c FROM memories WHERE invalidated_at IS NOT NULL"
55
+ ).get();
56
+ qualityInvalidated = invalidatedRow.c;
57
+ const relationsRow = dbConn.prepare(
58
+ "SELECT COUNT(DISTINCT src_memory_id) + COUNT(DISTINCT dst_memory_id) as c FROM memory_relations"
59
+ ).get();
60
+ qualityWithRelations = relationsRow.c;
61
+ const avgRow = dbConn.prepare(
62
+ "SELECT AVG(activation_score) as avg FROM memories WHERE is_latest = 1"
63
+ ).get();
64
+ qualityAvgActivation = avgRow.avg ?? 0;
65
+ dbConn.close();
66
+ } catch {
67
+ }
68
+ }
69
+ const claudeCodeStatus = isClaudeCodeConfigured();
70
+ const cursorStatus = isCursorConfigured();
71
+ const codexStatus = isCodexConfigured();
72
+ const geminiStatus = isGeminiConfigured();
73
+ const mcpStatus = isGenericMCPConfigured();
74
+ if (format === "text") {
75
+ process.stdout.write("MemRosetta Status\n");
76
+ process.stdout.write(`${"=".repeat(40)}
77
+
78
+ `);
79
+ process.stdout.write(
80
+ `Database: ${dbPath} (${exists ? `exists, ${sizeFormatted}` : "not found"})
81
+ `
82
+ );
83
+ process.stdout.write(`Memories: ${memoryCount}
84
+ `);
85
+ if (userList.length > 0) {
86
+ process.stdout.write(
87
+ `Users: ${userList.length} (${userList.join(", ")})
88
+ `
89
+ );
90
+ } else {
91
+ process.stdout.write("Users: 0\n");
92
+ }
93
+ const embeddingModelLabel = getEmbeddingModelLabel();
94
+ process.stdout.write(
95
+ `Embeddings: ${embeddingsEnabled ? `enabled (${embeddingModelLabel})` : "disabled"}
96
+ `
97
+ );
98
+ if (memoryCount > 0) {
99
+ process.stdout.write("\nQuality:\n");
100
+ process.stdout.write(
101
+ ` Fresh (is_latest=1): ${qualityFresh} / ${memoryCount}
102
+ `
103
+ );
104
+ process.stdout.write(` Invalidated: ${qualityInvalidated}
105
+ `);
106
+ process.stdout.write(` With relations: ${qualityWithRelations}
107
+ `);
108
+ process.stdout.write(
109
+ ` Avg activation: ${qualityAvgActivation.toFixed(2)}
110
+ `
111
+ );
112
+ }
113
+ process.stdout.write("\nIntegrations:\n");
114
+ process.stdout.write(
115
+ ` Claude Code: ${claudeCodeStatus ? "configured (hooks + MCP)" : "not configured"}
116
+ `
117
+ );
118
+ process.stdout.write(
119
+ ` Cursor: ${cursorStatus ? "configured (MCP)" : "not configured"}
120
+ `
121
+ );
122
+ process.stdout.write(
123
+ ` Codex: ${codexStatus ? "configured (MCP)" : "not configured"}
124
+ `
125
+ );
126
+ process.stdout.write(
127
+ ` Gemini: ${geminiStatus ? "configured (MCP)" : "not configured"}
128
+ `
129
+ );
130
+ process.stdout.write(
131
+ ` MCP (generic): ${mcpStatus ? "configured" : "not configured"}
132
+ `
133
+ );
134
+ return;
135
+ }
136
+ output(
137
+ {
138
+ version: resolveCliVersion(),
139
+ database: {
140
+ path: dbPath,
141
+ exists,
142
+ sizeBytes,
143
+ sizeFormatted
144
+ },
145
+ memories: memoryCount,
146
+ users: userList,
147
+ quality: {
148
+ fresh: qualityFresh,
149
+ invalidated: qualityInvalidated,
150
+ withRelations: qualityWithRelations,
151
+ avgActivation: qualityAvgActivation
152
+ },
153
+ embeddings: embeddingsEnabled,
154
+ embeddingModel: getEmbeddingModelLabel(),
155
+ embeddingPreset: getConfig().embeddingPreset ?? "en",
156
+ integrations: {
157
+ claudeCode: claudeCodeStatus,
158
+ cursor: cursorStatus,
159
+ codex: codexStatus,
160
+ gemini: geminiStatus,
161
+ mcp: mcpStatus
162
+ }
163
+ },
164
+ format
165
+ );
166
+ }
167
+ function formatSize(bytes) {
168
+ if (bytes < 1024) return `${bytes}B`;
169
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
170
+ return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
171
+ }
172
+ var PRESET_MODEL_LABELS = {
173
+ en: "bge-small-en-v1.5",
174
+ multilingual: "multilingual-e5-small",
175
+ ko: "ko-sroberta-multitask"
176
+ };
177
+ function getEmbeddingModelLabel() {
178
+ const config = getConfig();
179
+ const preset = config.embeddingPreset ?? "en";
180
+ return PRESET_MODEL_LABELS[preset] ?? preset;
181
+ }
182
+ export {
183
+ run
184
+ };
@@ -0,0 +1,101 @@
1
+ import {
2
+ buildMemoryCreatedOp,
3
+ openCliSyncContext
4
+ } from "./chunk-2MO65JLK.js";
5
+ import {
6
+ hasFlag,
7
+ optionalOption,
8
+ requireOption
9
+ } from "./chunk-SYPVELIW.js";
10
+ import {
11
+ getEngine,
12
+ resolveDbPath
13
+ } from "./chunk-VAVUPQZA.js";
14
+ import {
15
+ output,
16
+ outputError
17
+ } from "./chunk-ET6TNQOJ.js";
18
+ import {
19
+ getDefaultUserId
20
+ } from "./chunk-SEPYQK3J.js";
21
+
22
+ // src/commands/store.ts
23
+ var VALID_TYPES = /* @__PURE__ */ new Set(["fact", "preference", "decision", "event"]);
24
+ async function readStdin() {
25
+ const chunks = [];
26
+ for await (const chunk of process.stdin) {
27
+ chunks.push(chunk);
28
+ }
29
+ return Buffer.concat(chunks).toString("utf-8").trim();
30
+ }
31
+ async function run(options) {
32
+ const { args, format, db, noEmbeddings } = options;
33
+ let input;
34
+ if (hasFlag(args, "--stdin")) {
35
+ const raw = await readStdin();
36
+ try {
37
+ const parsed = JSON.parse(raw);
38
+ if (!parsed.content || !parsed.memoryType) {
39
+ outputError(
40
+ "stdin JSON must have content and memoryType",
41
+ format
42
+ );
43
+ process.exitCode = 1;
44
+ return;
45
+ }
46
+ input = {
47
+ userId: parsed.userId ? String(parsed.userId) : getDefaultUserId(),
48
+ content: String(parsed.content),
49
+ memoryType: String(parsed.memoryType),
50
+ namespace: parsed.namespace ? String(parsed.namespace) : void 0,
51
+ keywords: Array.isArray(parsed.keywords) ? parsed.keywords : void 0,
52
+ confidence: typeof parsed.confidence === "number" ? parsed.confidence : void 0,
53
+ sourceId: parsed.sourceId ? String(parsed.sourceId) : void 0
54
+ };
55
+ } catch {
56
+ outputError("Invalid JSON from stdin", format);
57
+ process.exitCode = 1;
58
+ return;
59
+ }
60
+ } else {
61
+ const userId = optionalOption(args, "--user") ?? getDefaultUserId();
62
+ const content = requireOption(args, "--content", "content");
63
+ const memoryType = requireOption(args, "--type", "type");
64
+ if (!VALID_TYPES.has(memoryType)) {
65
+ outputError(
66
+ `Invalid type: ${memoryType}. Must be one of: fact, preference, decision, event`,
67
+ format
68
+ );
69
+ process.exitCode = 1;
70
+ return;
71
+ }
72
+ const namespace = optionalOption(args, "--namespace");
73
+ const keywordsRaw = optionalOption(args, "--keywords");
74
+ const confidenceRaw = optionalOption(args, "--confidence");
75
+ const sourceId = optionalOption(args, "--source-id");
76
+ const eventStart = optionalOption(args, "--event-start");
77
+ const eventEnd = optionalOption(args, "--event-end");
78
+ input = {
79
+ userId,
80
+ content,
81
+ memoryType,
82
+ namespace,
83
+ keywords: keywordsRaw ? keywordsRaw.split(",") : void 0,
84
+ confidence: confidenceRaw ? parseFloat(confidenceRaw) : void 0,
85
+ sourceId,
86
+ eventDateStart: eventStart,
87
+ eventDateEnd: eventEnd
88
+ };
89
+ }
90
+ const engine = await getEngine({ db, noEmbeddings });
91
+ const memory = await engine.store(input);
92
+ const sync = await openCliSyncContext(resolveDbPath(db));
93
+ if (sync.enabled) {
94
+ sync.enqueue(buildMemoryCreatedOp(sync, memory));
95
+ sync.close();
96
+ }
97
+ output(memory, format);
98
+ }
99
+ export {
100
+ run
101
+ };