@memrosetta/cli 0.4.0 → 0.4.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/dist/chunk-72IW6TAV.js +59 -0
- package/dist/chunk-MISLIVUL.js +70 -0
- package/dist/chunk-NU5ZJJXP.js +63 -0
- package/dist/chunk-SEPYQK3J.js +60 -0
- package/dist/clear-47OFIDME.js +39 -0
- package/dist/clear-5SZVGYBX.js +39 -0
- package/dist/compress-SEFTKZMU.js +33 -0
- package/dist/compress-YNY6YNFU.js +33 -0
- package/dist/count-AMSEVDWR.js +24 -0
- package/dist/count-Z67KBEMV.js +24 -0
- package/dist/feedback-QDOWDWHM.js +40 -0
- package/dist/feedback-XGBKFQXC.js +40 -0
- package/dist/get-NY5H3MUA.js +30 -0
- package/dist/hooks/on-prompt.js +2 -2
- package/dist/hooks/on-stop.js +2 -2
- package/dist/index.js +35 -18
- package/dist/ingest-GSJMWDV5.js +95 -0
- package/dist/ingest-TZEVA25F.js +95 -0
- package/dist/init-GRVRJ6RO.js +205 -0
- package/dist/init-LK4UQISR.js +205 -0
- package/dist/invalidate-BY5VNFSE.js +25 -0
- package/dist/maintain-SGM56XKE.js +37 -0
- package/dist/maintain-VX2VWB2L.js +37 -0
- package/dist/relate-L5464WV5.js +47 -0
- package/dist/relate-SGZLG7JU.js +47 -0
- package/dist/reset-CYY4KYAB.js +129 -0
- package/dist/search-BJ2YV5IS.js +48 -0
- package/dist/search-PT4POELX.js +48 -0
- package/dist/status-TVY32MZD.js +218 -0
- package/dist/store-2USP33HQ.js +91 -0
- package/dist/store-XCFYGYBE.js +91 -0
- package/dist/sync-643GTA5X.js +319 -0
- package/dist/sync-7TONPJBY.js +351 -0
- package/dist/sync-BPVMHW34.js +319 -0
- package/dist/sync-OZQLBYT2.js +317 -0
- package/dist/sync-WURX2HJZ.js +321 -0
- package/dist/working-memory-UYVEJJYW.js +53 -0
- package/dist/working-memory-VP6L2QV6.js +53 -0
- package/package.json +5 -4
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAgentsMdPath,
|
|
3
|
+
getCodexConfigFilePath,
|
|
4
|
+
getCursorMcpConfigPath,
|
|
5
|
+
getCursorRulesPath,
|
|
6
|
+
getGeminiMdPath,
|
|
7
|
+
getGeminiSettingsFilePath,
|
|
8
|
+
getGenericMCPPath,
|
|
9
|
+
isClaudeCodeInstalled,
|
|
10
|
+
registerClaudeCodeHooks,
|
|
11
|
+
registerCodexMCP,
|
|
12
|
+
registerCursorMCP,
|
|
13
|
+
registerGeminiMCP,
|
|
14
|
+
registerGenericMCP,
|
|
15
|
+
updateClaudeMd
|
|
16
|
+
} from "./chunk-IS4IKWPL.js";
|
|
17
|
+
import {
|
|
18
|
+
hasFlag,
|
|
19
|
+
optionalOption
|
|
20
|
+
} from "./chunk-VZQURGWB.js";
|
|
21
|
+
import {
|
|
22
|
+
getDefaultDbPath,
|
|
23
|
+
getEngine
|
|
24
|
+
} from "./chunk-72IW6TAV.js";
|
|
25
|
+
import {
|
|
26
|
+
output
|
|
27
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
28
|
+
import {
|
|
29
|
+
getConfig,
|
|
30
|
+
writeConfig
|
|
31
|
+
} from "./chunk-SEPYQK3J.js";
|
|
32
|
+
|
|
33
|
+
// src/commands/init.ts
|
|
34
|
+
import { existsSync } from "fs";
|
|
35
|
+
var LANG_FLAG_TO_PRESET = {
|
|
36
|
+
en: "en",
|
|
37
|
+
multi: "multilingual",
|
|
38
|
+
ko: "ko"
|
|
39
|
+
};
|
|
40
|
+
async function run(options) {
|
|
41
|
+
const { args, format, db, noEmbeddings } = options;
|
|
42
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
43
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
44
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
45
|
+
const wantGemini = hasFlag(args, "--gemini");
|
|
46
|
+
const langFlag = optionalOption(args, "--lang");
|
|
47
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
48
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
49
|
+
process.stderr.write(
|
|
50
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
51
|
+
`
|
|
52
|
+
);
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
{
|
|
57
|
+
const config2 = getConfig();
|
|
58
|
+
const updates = {};
|
|
59
|
+
if (db) {
|
|
60
|
+
updates.dbPath = db;
|
|
61
|
+
}
|
|
62
|
+
if (noEmbeddings) {
|
|
63
|
+
updates.enableEmbeddings = false;
|
|
64
|
+
}
|
|
65
|
+
if (embeddingPreset) {
|
|
66
|
+
updates.embeddingPreset = embeddingPreset;
|
|
67
|
+
}
|
|
68
|
+
if (Object.keys(updates).length > 0) {
|
|
69
|
+
writeConfig({ ...config2, ...updates });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const config = getConfig();
|
|
73
|
+
const dbPath = db ?? config.dbPath ?? getDefaultDbPath();
|
|
74
|
+
const existed = existsSync(dbPath);
|
|
75
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
76
|
+
await engine.close();
|
|
77
|
+
const result = {
|
|
78
|
+
database: {
|
|
79
|
+
path: dbPath,
|
|
80
|
+
created: !existed
|
|
81
|
+
},
|
|
82
|
+
integrations: {}
|
|
83
|
+
};
|
|
84
|
+
registerGenericMCP();
|
|
85
|
+
result.integrations.mcp = {
|
|
86
|
+
registered: true,
|
|
87
|
+
path: getGenericMCPPath()
|
|
88
|
+
};
|
|
89
|
+
if (wantClaudeCode) {
|
|
90
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
91
|
+
const claudeMdOk = updateClaudeMd();
|
|
92
|
+
result.integrations.claudeCode = {
|
|
93
|
+
hooks: hooksOk,
|
|
94
|
+
mcp: true,
|
|
95
|
+
claudeMd: claudeMdOk
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (wantCursor) {
|
|
99
|
+
const cursorRulesUpdated = registerCursorMCP();
|
|
100
|
+
result.integrations.cursor = {
|
|
101
|
+
mcp: true,
|
|
102
|
+
path: getCursorMcpConfigPath(),
|
|
103
|
+
cursorRules: cursorRulesUpdated,
|
|
104
|
+
cursorRulesPath: getCursorRulesPath()
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
if (wantCodex) {
|
|
108
|
+
const agentsMdUpdated = registerCodexMCP();
|
|
109
|
+
result.integrations.codex = {
|
|
110
|
+
mcp: true,
|
|
111
|
+
path: getCodexConfigFilePath(),
|
|
112
|
+
agentsMd: agentsMdUpdated,
|
|
113
|
+
agentsMdPath: getAgentsMdPath()
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (wantGemini) {
|
|
117
|
+
const geminiMdUpdated = registerGeminiMCP();
|
|
118
|
+
result.integrations.gemini = {
|
|
119
|
+
mcp: true,
|
|
120
|
+
path: getGeminiSettingsFilePath(),
|
|
121
|
+
geminiMd: geminiMdUpdated,
|
|
122
|
+
geminiMdPath: getGeminiMdPath()
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (format === "text") {
|
|
126
|
+
printTextOutput(result, wantClaudeCode, wantCursor, wantCodex, wantGemini);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
output(result, format);
|
|
130
|
+
}
|
|
131
|
+
function printTextOutput(result, claudeCode, cursor, codex = false, gemini = false) {
|
|
132
|
+
const w = (s) => process.stdout.write(s);
|
|
133
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
134
|
+
w(" What was set up:\n");
|
|
135
|
+
w(" ----------------------------------------\n");
|
|
136
|
+
w(` Database: ${result.database.path}`);
|
|
137
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
138
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
139
|
+
`);
|
|
140
|
+
const currentConfig = getConfig();
|
|
141
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
142
|
+
const presetLabels = {
|
|
143
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
144
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
145
|
+
};
|
|
146
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
147
|
+
`);
|
|
148
|
+
}
|
|
149
|
+
if (claudeCode) {
|
|
150
|
+
const cc = result.integrations.claudeCode;
|
|
151
|
+
if (cc.hooks) {
|
|
152
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
153
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
154
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
155
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
156
|
+
}
|
|
157
|
+
if (cc.claudeMd) {
|
|
158
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
159
|
+
} else {
|
|
160
|
+
w(" CLAUDE.md: already configured\n");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (cursor) {
|
|
164
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
165
|
+
`);
|
|
166
|
+
if (result.integrations.cursor.cursorRules) {
|
|
167
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
168
|
+
`);
|
|
169
|
+
} else {
|
|
170
|
+
w(" .cursorrules: already configured\n");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (codex) {
|
|
174
|
+
w(` Codex MCP: ${result.integrations.codex.path}
|
|
175
|
+
`);
|
|
176
|
+
if (result.integrations.codex.agentsMd) {
|
|
177
|
+
w(` AGENTS.md: ${result.integrations.codex.agentsMdPath} (memory instructions added)
|
|
178
|
+
`);
|
|
179
|
+
} else {
|
|
180
|
+
w(" AGENTS.md: already configured\n");
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (gemini) {
|
|
184
|
+
w(` Gemini MCP: ${result.integrations.gemini.path}
|
|
185
|
+
`);
|
|
186
|
+
if (result.integrations.gemini.geminiMd) {
|
|
187
|
+
w(` GEMINI.md: ${result.integrations.gemini.geminiMdPath} (memory instructions added)
|
|
188
|
+
`);
|
|
189
|
+
} else {
|
|
190
|
+
w(" GEMINI.md: already configured\n");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
w("\n");
|
|
194
|
+
if (!claudeCode && !cursor && !codex && !gemini) {
|
|
195
|
+
w(" MCP is ready. Add --claude-code, --cursor, --codex, or --gemini for tool-specific setup.\n");
|
|
196
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
197
|
+
w("\n");
|
|
198
|
+
}
|
|
199
|
+
if (claudeCode) {
|
|
200
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export {
|
|
204
|
+
run
|
|
205
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEngine
|
|
3
|
+
} from "./chunk-72IW6TAV.js";
|
|
4
|
+
import {
|
|
5
|
+
output,
|
|
6
|
+
outputError
|
|
7
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
8
|
+
import "./chunk-SEPYQK3J.js";
|
|
9
|
+
|
|
10
|
+
// src/commands/invalidate.ts
|
|
11
|
+
async function run(options) {
|
|
12
|
+
const { args, format, db, noEmbeddings } = options;
|
|
13
|
+
const memoryId = args.find((a) => !a.startsWith("-"));
|
|
14
|
+
if (!memoryId) {
|
|
15
|
+
outputError("Usage: memrosetta invalidate <memoryId>", format);
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
20
|
+
await engine.invalidate(memoryId);
|
|
21
|
+
output({ memoryId, invalidated: true }, format);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
run
|
|
25
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption
|
|
3
|
+
} from "./chunk-NU5ZJJXP.js";
|
|
4
|
+
import {
|
|
5
|
+
getEngine
|
|
6
|
+
} from "./chunk-72IW6TAV.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
10
|
+
import {
|
|
11
|
+
getDefaultUserId
|
|
12
|
+
} from "./chunk-SEPYQK3J.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/maintain.ts
|
|
15
|
+
async function run(options) {
|
|
16
|
+
const { args, format, db, noEmbeddings } = options;
|
|
17
|
+
const userId = optionalOption(args, "--user") ?? getDefaultUserId();
|
|
18
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
19
|
+
const result = await engine.maintain(userId);
|
|
20
|
+
if (format === "text") {
|
|
21
|
+
process.stdout.write(`Maintenance completed for user: ${userId}
|
|
22
|
+
`);
|
|
23
|
+
process.stdout.write(` Activation scores updated: ${result.activationUpdated}
|
|
24
|
+
`);
|
|
25
|
+
process.stdout.write(` Tiers updated: ${result.tiersUpdated}
|
|
26
|
+
`);
|
|
27
|
+
process.stdout.write(` Groups compressed: ${result.compressed}
|
|
28
|
+
`);
|
|
29
|
+
process.stdout.write(` Memories archived: ${result.removed}
|
|
30
|
+
`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
output({ userId, ...result }, format);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
run
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption
|
|
3
|
+
} from "./chunk-VZQURGWB.js";
|
|
4
|
+
import {
|
|
5
|
+
getEngine
|
|
6
|
+
} from "./chunk-72IW6TAV.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
10
|
+
import {
|
|
11
|
+
getDefaultUserId
|
|
12
|
+
} from "./chunk-SEPYQK3J.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/maintain.ts
|
|
15
|
+
async function run(options) {
|
|
16
|
+
const { args, format, db, noEmbeddings } = options;
|
|
17
|
+
const userId = optionalOption(args, "--user") ?? getDefaultUserId();
|
|
18
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
19
|
+
const result = await engine.maintain(userId);
|
|
20
|
+
if (format === "text") {
|
|
21
|
+
process.stdout.write(`Maintenance completed for user: ${userId}
|
|
22
|
+
`);
|
|
23
|
+
process.stdout.write(` Activation scores updated: ${result.activationUpdated}
|
|
24
|
+
`);
|
|
25
|
+
process.stdout.write(` Tiers updated: ${result.tiersUpdated}
|
|
26
|
+
`);
|
|
27
|
+
process.stdout.write(` Groups compressed: ${result.compressed}
|
|
28
|
+
`);
|
|
29
|
+
process.stdout.write(` Memories archived: ${result.removed}
|
|
30
|
+
`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
output({ userId, ...result }, format);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
run
|
|
37
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption,
|
|
3
|
+
requireOption
|
|
4
|
+
} from "./chunk-VZQURGWB.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-72IW6TAV.js";
|
|
8
|
+
import {
|
|
9
|
+
output,
|
|
10
|
+
outputError
|
|
11
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
12
|
+
import "./chunk-SEPYQK3J.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/relate.ts
|
|
15
|
+
var VALID_RELATION_TYPES = /* @__PURE__ */ new Set([
|
|
16
|
+
"updates",
|
|
17
|
+
"extends",
|
|
18
|
+
"derives",
|
|
19
|
+
"contradicts",
|
|
20
|
+
"supports"
|
|
21
|
+
]);
|
|
22
|
+
async function run(options) {
|
|
23
|
+
const { args, format, db, noEmbeddings } = options;
|
|
24
|
+
const src = requireOption(args, "--src", "source memory ID");
|
|
25
|
+
const dst = requireOption(args, "--dst", "destination memory ID");
|
|
26
|
+
const relationType = requireOption(args, "--type", "relation type");
|
|
27
|
+
const reason = optionalOption(args, "--reason");
|
|
28
|
+
if (!VALID_RELATION_TYPES.has(relationType)) {
|
|
29
|
+
outputError(
|
|
30
|
+
`Invalid relation type: ${relationType}. Must be one of: updates, extends, derives, contradicts, supports`,
|
|
31
|
+
format
|
|
32
|
+
);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
37
|
+
const relation = await engine.relate(
|
|
38
|
+
src,
|
|
39
|
+
dst,
|
|
40
|
+
relationType,
|
|
41
|
+
reason
|
|
42
|
+
);
|
|
43
|
+
output(relation, format);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
run
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption,
|
|
3
|
+
requireOption
|
|
4
|
+
} from "./chunk-NU5ZJJXP.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-72IW6TAV.js";
|
|
8
|
+
import {
|
|
9
|
+
output,
|
|
10
|
+
outputError
|
|
11
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
12
|
+
import "./chunk-SEPYQK3J.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/relate.ts
|
|
15
|
+
var VALID_RELATION_TYPES = /* @__PURE__ */ new Set([
|
|
16
|
+
"updates",
|
|
17
|
+
"extends",
|
|
18
|
+
"derives",
|
|
19
|
+
"contradicts",
|
|
20
|
+
"supports"
|
|
21
|
+
]);
|
|
22
|
+
async function run(options) {
|
|
23
|
+
const { args, format, db, noEmbeddings } = options;
|
|
24
|
+
const src = requireOption(args, "--src", "source memory ID");
|
|
25
|
+
const dst = requireOption(args, "--dst", "destination memory ID");
|
|
26
|
+
const relationType = requireOption(args, "--type", "relation type");
|
|
27
|
+
const reason = optionalOption(args, "--reason");
|
|
28
|
+
if (!VALID_RELATION_TYPES.has(relationType)) {
|
|
29
|
+
outputError(
|
|
30
|
+
`Invalid relation type: ${relationType}. Must be one of: updates, extends, derives, contradicts, supports`,
|
|
31
|
+
format
|
|
32
|
+
);
|
|
33
|
+
process.exitCode = 1;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const engine = await getEngine({ db, noEmbeddings });
|
|
37
|
+
const relation = await engine.relate(
|
|
38
|
+
src,
|
|
39
|
+
dst,
|
|
40
|
+
relationType,
|
|
41
|
+
reason
|
|
42
|
+
);
|
|
43
|
+
output(relation, format);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
run
|
|
47
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
removeAgentsMdSection,
|
|
3
|
+
removeClaudeCodeHooks,
|
|
4
|
+
removeClaudeMdSection,
|
|
5
|
+
removeCodexMCP,
|
|
6
|
+
removeCursorMCP,
|
|
7
|
+
removeCursorRulesSection,
|
|
8
|
+
removeGeminiMCP,
|
|
9
|
+
removeGeminiMdSection,
|
|
10
|
+
removeGenericMCP
|
|
11
|
+
} from "./chunk-IS4IKWPL.js";
|
|
12
|
+
import {
|
|
13
|
+
hasFlag
|
|
14
|
+
} from "./chunk-NU5ZJJXP.js";
|
|
15
|
+
import {
|
|
16
|
+
output
|
|
17
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/reset.ts
|
|
20
|
+
async function run(options) {
|
|
21
|
+
const { args, format } = options;
|
|
22
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
23
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
24
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
25
|
+
const wantGemini = hasFlag(args, "--gemini");
|
|
26
|
+
const wantMCP = hasFlag(args, "--mcp");
|
|
27
|
+
const wantAll = hasFlag(args, "--all");
|
|
28
|
+
const noFlags = !wantClaudeCode && !wantCursor && !wantCodex && !wantGemini && !wantMCP && !wantAll;
|
|
29
|
+
if (noFlags) {
|
|
30
|
+
const msg = "Usage: memrosetta reset [--claude-code] [--cursor] [--codex] [--gemini] [--mcp] [--all]\n\nFlags:\n --claude-code Remove Claude Code hooks, MCP, and CLAUDE.md section\n --cursor Remove Cursor MCP configuration\n --codex Remove Codex MCP configuration and AGENTS.md section\n --gemini Remove Gemini MCP configuration and GEMINI.md section\n --mcp Remove generic MCP configuration (~/.mcp.json)\n --all Remove all integrations\n";
|
|
31
|
+
if (format === "text") {
|
|
32
|
+
process.stdout.write(msg);
|
|
33
|
+
} else {
|
|
34
|
+
output({ error: "No flags specified. Use --claude-code, --cursor, --codex, --gemini, --mcp, or --all." }, format);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const result = {
|
|
39
|
+
removed: {
|
|
40
|
+
claudeCodeHooks: false,
|
|
41
|
+
claudeMd: false,
|
|
42
|
+
mcp: false,
|
|
43
|
+
cursor: false,
|
|
44
|
+
cursorRules: false,
|
|
45
|
+
codex: false,
|
|
46
|
+
agentsMd: false,
|
|
47
|
+
gemini: false,
|
|
48
|
+
geminiMd: false
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (wantClaudeCode || wantAll) {
|
|
52
|
+
const hooksRemoved = removeClaudeCodeHooks();
|
|
53
|
+
const mdRemoved = removeClaudeMdSection();
|
|
54
|
+
const mcpRemoved = removeGenericMCP();
|
|
55
|
+
result.removed.claudeCodeHooks = hooksRemoved;
|
|
56
|
+
result.removed.claudeMd = mdRemoved;
|
|
57
|
+
if (!wantMCP) {
|
|
58
|
+
result.removed.mcp = mcpRemoved;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (wantCursor || wantAll) {
|
|
62
|
+
const removed = removeCursorMCP();
|
|
63
|
+
result.removed.cursor = removed;
|
|
64
|
+
const rulesRemoved = removeCursorRulesSection();
|
|
65
|
+
result.removed.cursorRules = rulesRemoved;
|
|
66
|
+
}
|
|
67
|
+
if (wantCodex || wantAll) {
|
|
68
|
+
const removed = removeCodexMCP();
|
|
69
|
+
result.removed.codex = removed;
|
|
70
|
+
const mdRemoved = removeAgentsMdSection();
|
|
71
|
+
result.removed.agentsMd = mdRemoved;
|
|
72
|
+
}
|
|
73
|
+
if (wantGemini || wantAll) {
|
|
74
|
+
const removed = removeGeminiMCP();
|
|
75
|
+
result.removed.gemini = removed;
|
|
76
|
+
const mdRemoved = removeGeminiMdSection();
|
|
77
|
+
result.removed.geminiMd = mdRemoved;
|
|
78
|
+
}
|
|
79
|
+
if (wantMCP || wantAll) {
|
|
80
|
+
const removed = removeGenericMCP();
|
|
81
|
+
result.removed.mcp = removed;
|
|
82
|
+
}
|
|
83
|
+
if (format === "text") {
|
|
84
|
+
printTextOutput(result);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
output(result, format);
|
|
88
|
+
}
|
|
89
|
+
function printTextOutput(result) {
|
|
90
|
+
const w = (s) => process.stdout.write(s);
|
|
91
|
+
const removed = result.removed;
|
|
92
|
+
if (removed.claudeCodeHooks) {
|
|
93
|
+
w("Removed Claude Code hooks from ~/.claude/settings.json\n");
|
|
94
|
+
}
|
|
95
|
+
if (removed.claudeMd) {
|
|
96
|
+
w("Removed MemRosetta section from ~/.claude/CLAUDE.md\n");
|
|
97
|
+
}
|
|
98
|
+
if (removed.mcp) {
|
|
99
|
+
w("Removed MCP server from ~/.mcp.json\n");
|
|
100
|
+
}
|
|
101
|
+
if (removed.cursor) {
|
|
102
|
+
w("Removed Cursor MCP from ~/.cursor/mcp.json\n");
|
|
103
|
+
}
|
|
104
|
+
if (removed.cursorRules) {
|
|
105
|
+
w("Removed MemRosetta section from ~/.cursorrules\n");
|
|
106
|
+
}
|
|
107
|
+
if (removed.codex) {
|
|
108
|
+
w("Removed Codex MCP from ~/.codex/config.toml\n");
|
|
109
|
+
}
|
|
110
|
+
if (removed.agentsMd) {
|
|
111
|
+
w("Removed MemRosetta section from AGENTS.md\n");
|
|
112
|
+
}
|
|
113
|
+
if (removed.gemini) {
|
|
114
|
+
w("Removed Gemini MCP from ~/.gemini/settings.json\n");
|
|
115
|
+
}
|
|
116
|
+
if (removed.geminiMd) {
|
|
117
|
+
w("Removed MemRosetta section from GEMINI.md\n");
|
|
118
|
+
}
|
|
119
|
+
const anyRemoved = removed.claudeCodeHooks || removed.claudeMd || removed.mcp || removed.cursor || removed.cursorRules || removed.codex || removed.agentsMd || removed.gemini || removed.geminiMd;
|
|
120
|
+
if (!anyRemoved) {
|
|
121
|
+
w("Nothing to remove (no integrations were configured).\n");
|
|
122
|
+
}
|
|
123
|
+
w(
|
|
124
|
+
"\nNote: ~/.memrosetta/ directory preserved. Delete manually if needed:\n rm -rf ~/.memrosetta\n"
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
run
|
|
129
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption,
|
|
3
|
+
requireOption
|
|
4
|
+
} from "./chunk-VZQURGWB.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-72IW6TAV.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,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption,
|
|
3
|
+
requireOption
|
|
4
|
+
} from "./chunk-NU5ZJJXP.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-72IW6TAV.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
|
+
};
|