@memrosetta/cli 0.5.1 → 0.5.3
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/chunk-47SU2YUJ.js +64 -0
- package/dist/chunk-C4ANKSCI.js +151 -0
- package/dist/chunk-CEHRM6IW.js +151 -0
- package/dist/chunk-G2W4YK2T.js +56 -0
- package/dist/chunk-GGXC7TAJ.js +139 -0
- package/dist/chunk-GRNZVSAF.js +56 -0
- package/dist/chunk-GZINXXM4.js +139 -0
- package/dist/chunk-RZFCVYTK.js +71 -0
- package/dist/chunk-US6CEDMU.js +66 -0
- package/dist/chunk-VMGX5FCY.js +64 -0
- package/dist/chunk-WYHEAKPC.js +71 -0
- package/dist/clear-32Y3U2WR.js +39 -0
- package/dist/clear-AFEJPCDA.js +39 -0
- package/dist/compress-CL5D4VVJ.js +33 -0
- package/dist/compress-UUEO7WCU.js +33 -0
- package/dist/count-U2ML5ZON.js +24 -0
- package/dist/count-VVOGYSM7.js +24 -0
- package/dist/duplicates-CEJ7WSGW.js +149 -0
- package/dist/duplicates-IBUS7CJS.js +149 -0
- package/dist/enforce-T7AS4PVD.js +381 -0
- package/dist/enforce-TC5SDPEZ.js +381 -0
- package/dist/feedback-3PJTTEOD.js +51 -0
- package/dist/feedback-IB7BHIRP.js +51 -0
- package/dist/get-TQ2U7HCD.js +30 -0
- package/dist/get-WPZIHQKW.js +30 -0
- package/dist/hooks/on-prompt.js +3 -3
- package/dist/hooks/on-stop.js +3 -3
- package/dist/index.js +30 -20
- package/dist/ingest-37UXPVT5.js +97 -0
- package/dist/ingest-TPQRH34A.js +97 -0
- package/dist/init-6YQL3RCQ.js +210 -0
- package/dist/init-LHXRCCLX.js +210 -0
- package/dist/invalidate-ER2TFFWK.js +40 -0
- package/dist/invalidate-PVHUGAJ6.js +40 -0
- package/dist/maintain-NICAXFK6.js +37 -0
- package/dist/maintain-Q553GBSF.js +37 -0
- package/dist/migrate-CZL3YNQK.js +255 -0
- package/dist/migrate-FI26FSBP.js +255 -0
- package/dist/relate-5TN2WEG3.js +57 -0
- package/dist/relate-KLBMYWB3.js +57 -0
- package/dist/reset-IPOAKTJM.js +132 -0
- package/dist/search-AYZBKRXF.js +48 -0
- package/dist/search-JQ3MLRKS.js +48 -0
- package/dist/status-JF2V7ZBX.js +184 -0
- package/dist/status-UV66PWUD.js +184 -0
- package/dist/store-AAJCT3PX.js +101 -0
- package/dist/store-OVDS57U5.js +101 -0
- package/dist/sync-56KJTKE7.js +542 -0
- package/dist/sync-BCKBYRXY.js +542 -0
- package/dist/working-memory-CJARSGEK.js +53 -0
- package/dist/working-memory-Z3RUGSTQ.js +53 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
parseGlobalArgs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-US6CEDMU.js";
|
|
5
5
|
import {
|
|
6
6
|
closeEngine
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-47SU2YUJ.js";
|
|
8
8
|
import {
|
|
9
9
|
outputError
|
|
10
10
|
} from "./chunk-ET6TNQOJ.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-WYHEAKPC.js";
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
var HELP_TEXT = `memrosetta - AI long-term memory engine CLI
|
|
@@ -117,77 +117,77 @@ async function main() {
|
|
|
117
117
|
try {
|
|
118
118
|
switch (command) {
|
|
119
119
|
case "store": {
|
|
120
|
-
const mod = await import("./store-
|
|
120
|
+
const mod = await import("./store-OVDS57U5.js");
|
|
121
121
|
await mod.run(commandOptions);
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
case "search": {
|
|
125
|
-
const mod = await import("./search-
|
|
125
|
+
const mod = await import("./search-AYZBKRXF.js");
|
|
126
126
|
await mod.run(commandOptions);
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
case "ingest": {
|
|
130
|
-
const mod = await import("./ingest-
|
|
130
|
+
const mod = await import("./ingest-37UXPVT5.js");
|
|
131
131
|
await mod.run(commandOptions);
|
|
132
132
|
break;
|
|
133
133
|
}
|
|
134
134
|
case "get": {
|
|
135
|
-
const mod = await import("./get-
|
|
135
|
+
const mod = await import("./get-WPZIHQKW.js");
|
|
136
136
|
await mod.run(commandOptions);
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
case "count": {
|
|
140
|
-
const mod = await import("./count-
|
|
140
|
+
const mod = await import("./count-VVOGYSM7.js");
|
|
141
141
|
await mod.run(commandOptions);
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
case "clear": {
|
|
145
|
-
const mod = await import("./clear-
|
|
145
|
+
const mod = await import("./clear-32Y3U2WR.js");
|
|
146
146
|
await mod.run(commandOptions);
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
149
|
case "relate": {
|
|
150
|
-
const mod = await import("./relate-
|
|
150
|
+
const mod = await import("./relate-5TN2WEG3.js");
|
|
151
151
|
await mod.run(commandOptions);
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
154
|
case "invalidate": {
|
|
155
|
-
const mod = await import("./invalidate-
|
|
155
|
+
const mod = await import("./invalidate-ER2TFFWK.js");
|
|
156
156
|
await mod.run(commandOptions);
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case "feedback": {
|
|
160
|
-
const mod = await import("./feedback-
|
|
160
|
+
const mod = await import("./feedback-IB7BHIRP.js");
|
|
161
161
|
await mod.run(commandOptions);
|
|
162
162
|
break;
|
|
163
163
|
}
|
|
164
164
|
case "working-memory": {
|
|
165
|
-
const mod = await import("./working-memory-
|
|
165
|
+
const mod = await import("./working-memory-Z3RUGSTQ.js");
|
|
166
166
|
await mod.run(commandOptions);
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
169
169
|
case "maintain": {
|
|
170
|
-
const mod = await import("./maintain-
|
|
170
|
+
const mod = await import("./maintain-Q553GBSF.js");
|
|
171
171
|
await mod.run(commandOptions);
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
174
|
case "compress": {
|
|
175
|
-
const mod = await import("./compress-
|
|
175
|
+
const mod = await import("./compress-UUEO7WCU.js");
|
|
176
176
|
await mod.run(commandOptions);
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
case "status": {
|
|
180
|
-
const mod = await import("./status-
|
|
180
|
+
const mod = await import("./status-JF2V7ZBX.js");
|
|
181
181
|
await mod.run(commandOptions);
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case "init": {
|
|
185
|
-
const mod = await import("./init-
|
|
185
|
+
const mod = await import("./init-LHXRCCLX.js");
|
|
186
186
|
await mod.run(commandOptions);
|
|
187
187
|
break;
|
|
188
188
|
}
|
|
189
189
|
case "reset": {
|
|
190
|
-
const mod = await import("./reset-
|
|
190
|
+
const mod = await import("./reset-IPOAKTJM.js");
|
|
191
191
|
await mod.run(commandOptions);
|
|
192
192
|
break;
|
|
193
193
|
}
|
|
@@ -197,12 +197,22 @@ async function main() {
|
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
case "sync": {
|
|
200
|
-
const mod = await import("./sync-
|
|
200
|
+
const mod = await import("./sync-56KJTKE7.js");
|
|
201
201
|
await mod.run(commandOptions);
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
204
|
case "enforce": {
|
|
205
|
-
const mod = await import("./enforce-
|
|
205
|
+
const mod = await import("./enforce-T7AS4PVD.js");
|
|
206
|
+
await mod.run(commandOptions);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
case "migrate": {
|
|
210
|
+
const mod = await import("./migrate-CZL3YNQK.js");
|
|
211
|
+
await mod.run(commandOptions);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case "duplicates": {
|
|
215
|
+
const mod = await import("./duplicates-CEJ7WSGW.js");
|
|
206
216
|
await mod.run(commandOptions);
|
|
207
217
|
break;
|
|
208
218
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseTranscriptContent
|
|
3
|
+
} from "./chunk-UKGD7QXV.js";
|
|
4
|
+
import {
|
|
5
|
+
classifyTurn
|
|
6
|
+
} from "./chunk-CEHRM6IW.js";
|
|
7
|
+
import {
|
|
8
|
+
optionalOption
|
|
9
|
+
} from "./chunk-US6CEDMU.js";
|
|
10
|
+
import {
|
|
11
|
+
getEngine
|
|
12
|
+
} from "./chunk-47SU2YUJ.js";
|
|
13
|
+
import {
|
|
14
|
+
output,
|
|
15
|
+
outputError
|
|
16
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
17
|
+
import {
|
|
18
|
+
getDefaultUserId
|
|
19
|
+
} from "./chunk-WYHEAKPC.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/ingest.ts
|
|
22
|
+
import { readFileSync } from "fs";
|
|
23
|
+
function turnsToMemories(turns, userId, namespace, sessionShort) {
|
|
24
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
25
|
+
const memories = [];
|
|
26
|
+
for (let i = 0; i < turns.length; i++) {
|
|
27
|
+
const turn = turns[i];
|
|
28
|
+
if (turn.content.length < 20) continue;
|
|
29
|
+
const content = turn.content.length > 500 ? turn.content.slice(0, 497) + "..." : turn.content;
|
|
30
|
+
memories.push({
|
|
31
|
+
userId,
|
|
32
|
+
namespace: namespace ?? `session-${sessionShort}`,
|
|
33
|
+
memoryType: classifyTurn(turn),
|
|
34
|
+
content,
|
|
35
|
+
documentDate: now,
|
|
36
|
+
sourceId: `cc-${sessionShort}-${i}`,
|
|
37
|
+
confidence: turn.role === "user" ? 0.9 : 0.8
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return memories;
|
|
41
|
+
}
|
|
42
|
+
async function readStdin() {
|
|
43
|
+
const chunks = [];
|
|
44
|
+
for await (const chunk of process.stdin) {
|
|
45
|
+
chunks.push(chunk);
|
|
46
|
+
}
|
|
47
|
+
return Buffer.concat(chunks).toString("utf-8").trim();
|
|
48
|
+
}
|
|
49
|
+
async function run(options) {
|
|
50
|
+
const { args, format, db, noEmbeddings } = options;
|
|
51
|
+
const userId = optionalOption(args, "--user") ?? getDefaultUserId();
|
|
52
|
+
const file = optionalOption(args, "--file");
|
|
53
|
+
const namespace = optionalOption(args, "--namespace");
|
|
54
|
+
let content;
|
|
55
|
+
if (file) {
|
|
56
|
+
try {
|
|
57
|
+
content = readFileSync(file, "utf-8");
|
|
58
|
+
} catch (err) {
|
|
59
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
60
|
+
outputError(`Failed to read file: ${msg}`, format);
|
|
61
|
+
process.exitCode = 1;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
content = await readStdin();
|
|
66
|
+
}
|
|
67
|
+
if (!content) {
|
|
68
|
+
outputError("No transcript content provided", format);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const parsed = parseTranscriptContent(content);
|
|
73
|
+
const sessionShort = parsed.sessionId ? parsed.sessionId.slice(0, 8) : "unknown";
|
|
74
|
+
const memories = turnsToMemories(
|
|
75
|
+
parsed.turns,
|
|
76
|
+
userId,
|
|
77
|
+
namespace,
|
|
78
|
+
sessionShort
|
|
79
|
+
);
|
|
80
|
+
if (memories.length === 0) {
|
|
81
|
+
output({ stored: 0, message: "No memories extracted from transcript" }, format);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
85
|
+
const stored = await engine.storeBatch(memories);
|
|
86
|
+
output(
|
|
87
|
+
{
|
|
88
|
+
stored: stored.length,
|
|
89
|
+
sessionId: parsed.sessionId || void 0,
|
|
90
|
+
namespace: namespace ?? `session-${sessionShort}`
|
|
91
|
+
},
|
|
92
|
+
format
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
run
|
|
97
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseTranscriptContent
|
|
3
|
+
} from "./chunk-UKGD7QXV.js";
|
|
4
|
+
import {
|
|
5
|
+
classifyTurn
|
|
6
|
+
} from "./chunk-C4ANKSCI.js";
|
|
7
|
+
import {
|
|
8
|
+
optionalOption
|
|
9
|
+
} from "./chunk-US6CEDMU.js";
|
|
10
|
+
import {
|
|
11
|
+
getEngine
|
|
12
|
+
} from "./chunk-VMGX5FCY.js";
|
|
13
|
+
import {
|
|
14
|
+
output,
|
|
15
|
+
outputError
|
|
16
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
17
|
+
import {
|
|
18
|
+
getDefaultUserId
|
|
19
|
+
} from "./chunk-RZFCVYTK.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/ingest.ts
|
|
22
|
+
import { readFileSync } from "fs";
|
|
23
|
+
function turnsToMemories(turns, userId, namespace, sessionShort) {
|
|
24
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
25
|
+
const memories = [];
|
|
26
|
+
for (let i = 0; i < turns.length; i++) {
|
|
27
|
+
const turn = turns[i];
|
|
28
|
+
if (turn.content.length < 20) continue;
|
|
29
|
+
const content = turn.content.length > 500 ? turn.content.slice(0, 497) + "..." : turn.content;
|
|
30
|
+
memories.push({
|
|
31
|
+
userId,
|
|
32
|
+
namespace: namespace ?? `session-${sessionShort}`,
|
|
33
|
+
memoryType: classifyTurn(turn),
|
|
34
|
+
content,
|
|
35
|
+
documentDate: now,
|
|
36
|
+
sourceId: `cc-${sessionShort}-${i}`,
|
|
37
|
+
confidence: turn.role === "user" ? 0.9 : 0.8
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return memories;
|
|
41
|
+
}
|
|
42
|
+
async function readStdin() {
|
|
43
|
+
const chunks = [];
|
|
44
|
+
for await (const chunk of process.stdin) {
|
|
45
|
+
chunks.push(chunk);
|
|
46
|
+
}
|
|
47
|
+
return Buffer.concat(chunks).toString("utf-8").trim();
|
|
48
|
+
}
|
|
49
|
+
async function run(options) {
|
|
50
|
+
const { args, format, db, noEmbeddings } = options;
|
|
51
|
+
const userId = optionalOption(args, "--user") ?? getDefaultUserId();
|
|
52
|
+
const file = optionalOption(args, "--file");
|
|
53
|
+
const namespace = optionalOption(args, "--namespace");
|
|
54
|
+
let content;
|
|
55
|
+
if (file) {
|
|
56
|
+
try {
|
|
57
|
+
content = readFileSync(file, "utf-8");
|
|
58
|
+
} catch (err) {
|
|
59
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
60
|
+
outputError(`Failed to read file: ${msg}`, format);
|
|
61
|
+
process.exitCode = 1;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
content = await readStdin();
|
|
66
|
+
}
|
|
67
|
+
if (!content) {
|
|
68
|
+
outputError("No transcript content provided", format);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const parsed = parseTranscriptContent(content);
|
|
73
|
+
const sessionShort = parsed.sessionId ? parsed.sessionId.slice(0, 8) : "unknown";
|
|
74
|
+
const memories = turnsToMemories(
|
|
75
|
+
parsed.turns,
|
|
76
|
+
userId,
|
|
77
|
+
namespace,
|
|
78
|
+
sessionShort
|
|
79
|
+
);
|
|
80
|
+
if (memories.length === 0) {
|
|
81
|
+
output({ stored: 0, message: "No memories extracted from transcript" }, format);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
85
|
+
const stored = await engine.storeBatch(memories);
|
|
86
|
+
output(
|
|
87
|
+
{
|
|
88
|
+
stored: stored.length,
|
|
89
|
+
sessionId: parsed.sessionId || void 0,
|
|
90
|
+
namespace: namespace ?? `session-${sessionShort}`
|
|
91
|
+
},
|
|
92
|
+
format
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
run
|
|
97
|
+
};
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAgentsMdPath,
|
|
3
|
+
getCodexConfigFilePath,
|
|
4
|
+
getCodexHooksPath,
|
|
5
|
+
getCursorMcpConfigPath,
|
|
6
|
+
getCursorRulesPath,
|
|
7
|
+
getGeminiMdPath,
|
|
8
|
+
getGeminiSettingsFilePath,
|
|
9
|
+
getGenericMCPPath,
|
|
10
|
+
isClaudeCodeInstalled,
|
|
11
|
+
registerClaudeCodeHooks,
|
|
12
|
+
registerCodexHooks,
|
|
13
|
+
registerCodexMCP,
|
|
14
|
+
registerCursorMCP,
|
|
15
|
+
registerGeminiMCP,
|
|
16
|
+
registerGenericMCP,
|
|
17
|
+
updateClaudeMd
|
|
18
|
+
} from "./chunk-4LNXT25H.js";
|
|
19
|
+
import {
|
|
20
|
+
hasFlag,
|
|
21
|
+
optionalOption
|
|
22
|
+
} from "./chunk-US6CEDMU.js";
|
|
23
|
+
import {
|
|
24
|
+
getDefaultDbPath,
|
|
25
|
+
getEngine
|
|
26
|
+
} from "./chunk-VMGX5FCY.js";
|
|
27
|
+
import {
|
|
28
|
+
output
|
|
29
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
30
|
+
import {
|
|
31
|
+
getConfig,
|
|
32
|
+
writeConfig
|
|
33
|
+
} from "./chunk-RZFCVYTK.js";
|
|
34
|
+
|
|
35
|
+
// src/commands/init.ts
|
|
36
|
+
import { existsSync } from "fs";
|
|
37
|
+
var LANG_FLAG_TO_PRESET = {
|
|
38
|
+
en: "en",
|
|
39
|
+
multi: "multilingual",
|
|
40
|
+
ko: "ko"
|
|
41
|
+
};
|
|
42
|
+
async function run(options) {
|
|
43
|
+
const { args, format, db, noEmbeddings } = options;
|
|
44
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
45
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
46
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
47
|
+
const wantGemini = hasFlag(args, "--gemini");
|
|
48
|
+
const langFlag = optionalOption(args, "--lang");
|
|
49
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
50
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
51
|
+
process.stderr.write(
|
|
52
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
53
|
+
`
|
|
54
|
+
);
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
{
|
|
59
|
+
const config2 = getConfig();
|
|
60
|
+
const updates = {};
|
|
61
|
+
if (db) {
|
|
62
|
+
updates.dbPath = db;
|
|
63
|
+
}
|
|
64
|
+
if (noEmbeddings) {
|
|
65
|
+
updates.enableEmbeddings = false;
|
|
66
|
+
}
|
|
67
|
+
if (embeddingPreset) {
|
|
68
|
+
updates.embeddingPreset = embeddingPreset;
|
|
69
|
+
}
|
|
70
|
+
if (Object.keys(updates).length > 0) {
|
|
71
|
+
writeConfig({ ...config2, ...updates });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const config = getConfig();
|
|
75
|
+
const dbPath = db ?? config.dbPath ?? getDefaultDbPath();
|
|
76
|
+
const existed = existsSync(dbPath);
|
|
77
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
78
|
+
await engine.close();
|
|
79
|
+
const result = {
|
|
80
|
+
database: {
|
|
81
|
+
path: dbPath,
|
|
82
|
+
created: !existed
|
|
83
|
+
},
|
|
84
|
+
integrations: {}
|
|
85
|
+
};
|
|
86
|
+
registerGenericMCP();
|
|
87
|
+
result.integrations.mcp = {
|
|
88
|
+
registered: true,
|
|
89
|
+
path: getGenericMCPPath()
|
|
90
|
+
};
|
|
91
|
+
if (wantClaudeCode) {
|
|
92
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
93
|
+
const claudeMdOk = updateClaudeMd();
|
|
94
|
+
result.integrations.claudeCode = {
|
|
95
|
+
hooks: hooksOk,
|
|
96
|
+
mcp: true,
|
|
97
|
+
claudeMd: claudeMdOk
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (wantCursor) {
|
|
101
|
+
const cursorRulesUpdated = registerCursorMCP();
|
|
102
|
+
result.integrations.cursor = {
|
|
103
|
+
mcp: true,
|
|
104
|
+
path: getCursorMcpConfigPath(),
|
|
105
|
+
cursorRules: cursorRulesUpdated,
|
|
106
|
+
cursorRulesPath: getCursorRulesPath()
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (wantCodex) {
|
|
110
|
+
const agentsMdUpdated = registerCodexMCP();
|
|
111
|
+
const hooksRegistered = registerCodexHooks();
|
|
112
|
+
result.integrations.codex = {
|
|
113
|
+
mcp: true,
|
|
114
|
+
path: getCodexConfigFilePath(),
|
|
115
|
+
agentsMd: agentsMdUpdated,
|
|
116
|
+
agentsMdPath: getAgentsMdPath(),
|
|
117
|
+
stopHook: hooksRegistered,
|
|
118
|
+
stopHookPath: getCodexHooksPath()
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (wantGemini) {
|
|
122
|
+
const geminiMdUpdated = registerGeminiMCP();
|
|
123
|
+
result.integrations.gemini = {
|
|
124
|
+
mcp: true,
|
|
125
|
+
path: getGeminiSettingsFilePath(),
|
|
126
|
+
geminiMd: geminiMdUpdated,
|
|
127
|
+
geminiMdPath: getGeminiMdPath()
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (format === "text") {
|
|
131
|
+
printTextOutput(result, wantClaudeCode, wantCursor, wantCodex, wantGemini);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
output(result, format);
|
|
135
|
+
}
|
|
136
|
+
function printTextOutput(result, claudeCode, cursor, codex = false, gemini = false) {
|
|
137
|
+
const w = (s) => process.stdout.write(s);
|
|
138
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
139
|
+
w(" What was set up:\n");
|
|
140
|
+
w(" ----------------------------------------\n");
|
|
141
|
+
w(` Database: ${result.database.path}`);
|
|
142
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
143
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
144
|
+
`);
|
|
145
|
+
const currentConfig = getConfig();
|
|
146
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
147
|
+
const presetLabels = {
|
|
148
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
149
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
150
|
+
};
|
|
151
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
152
|
+
`);
|
|
153
|
+
}
|
|
154
|
+
if (claudeCode) {
|
|
155
|
+
const cc = result.integrations.claudeCode;
|
|
156
|
+
if (cc.hooks) {
|
|
157
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
158
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
159
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
160
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
161
|
+
}
|
|
162
|
+
if (cc.claudeMd) {
|
|
163
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
164
|
+
} else {
|
|
165
|
+
w(" CLAUDE.md: already configured\n");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (cursor) {
|
|
169
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
170
|
+
`);
|
|
171
|
+
if (result.integrations.cursor.cursorRules) {
|
|
172
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
173
|
+
`);
|
|
174
|
+
} else {
|
|
175
|
+
w(" .cursorrules: already configured\n");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (codex) {
|
|
179
|
+
w(` Codex MCP: ${result.integrations.codex.path}
|
|
180
|
+
`);
|
|
181
|
+
if (result.integrations.codex.agentsMd) {
|
|
182
|
+
w(` AGENTS.md: ${result.integrations.codex.agentsMdPath} (memory instructions added)
|
|
183
|
+
`);
|
|
184
|
+
} else {
|
|
185
|
+
w(" AGENTS.md: already configured\n");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (gemini) {
|
|
189
|
+
w(` Gemini MCP: ${result.integrations.gemini.path}
|
|
190
|
+
`);
|
|
191
|
+
if (result.integrations.gemini.geminiMd) {
|
|
192
|
+
w(` GEMINI.md: ${result.integrations.gemini.geminiMdPath} (memory instructions added)
|
|
193
|
+
`);
|
|
194
|
+
} else {
|
|
195
|
+
w(" GEMINI.md: already configured\n");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
w("\n");
|
|
199
|
+
if (!claudeCode && !cursor && !codex && !gemini) {
|
|
200
|
+
w(" MCP is ready. Add --claude-code, --cursor, --codex, or --gemini for tool-specific setup.\n");
|
|
201
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
202
|
+
w("\n");
|
|
203
|
+
}
|
|
204
|
+
if (claudeCode) {
|
|
205
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
run
|
|
210
|
+
};
|