@memrosetta/cli 0.3.2 → 0.4.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.
- package/dist/chunk-356QK7TK.js +533 -0
- package/dist/chunk-3LSITXZ4.js +69 -0
- package/dist/chunk-6IOTBMUB.js +570 -0
- package/dist/chunk-BGXZ3MDD.js +341 -0
- package/dist/chunk-EZVP3OY7.js +52 -0
- package/dist/chunk-FCHV2JMZ.js +347 -0
- package/dist/{chunk-F7ZMZ6HN.js → chunk-HXZ7MAT6.js} +2 -1
- package/dist/chunk-IM6H35RB.js +341 -0
- package/dist/chunk-JGE6RXXH.js +48 -0
- package/dist/chunk-JPBSMZ26.js +343 -0
- package/dist/chunk-KSKRPUZZ.js +43 -0
- package/dist/chunk-L6S3TXHR.js +326 -0
- package/dist/{chunk-326TFH4F.js → chunk-OCCU5YEG.js} +11 -42
- package/dist/chunk-PW52BB6L.js +61 -0
- package/dist/chunk-RABFL4EN.js +528 -0
- package/dist/chunk-RDUU53MG.js +343 -0
- package/dist/chunk-RYPYJJ2K.js +70 -0
- package/dist/{chunk-CATBN3ZT.js → chunk-TQOH7ZXN.js} +6 -18
- package/dist/chunk-Y6NH6K27.js +209 -0
- package/dist/{clear-MTL4CQM3.js → clear-4RQW6SYW.js} +10 -5
- package/dist/clear-BYRCL5ZN.js +39 -0
- package/dist/clear-ETQ7XFMV.js +39 -0
- package/dist/clear-P6H55OKZ.js +39 -0
- package/dist/clear-T3TWJQKL.js +39 -0
- package/dist/{compress-Z46R4N4M.js → compress-HDNYPXZ3.js} +10 -5
- package/dist/compress-S6MS4QW7.js +33 -0
- package/dist/compress-TVWXLW3L.js +33 -0
- package/dist/compress-VLYNZ5BQ.js +33 -0
- package/dist/compress-ZXWRRGHT.js +33 -0
- package/dist/{count-4TZ3C524.js → count-26AGY5XL.js} +10 -5
- package/dist/count-AVG5ZIRW.js +24 -0
- package/dist/count-CJIYYJKN.js +24 -0
- package/dist/count-KFFD4ML7.js +24 -0
- package/dist/count-UUAD3GEJ.js +24 -0
- package/dist/{get-B6AL75EW.js → get-75MGS4LN.js} +4 -2
- package/dist/ingest-A3BAI2C4.js +95 -0
- package/dist/ingest-E7QDD5NY.js +95 -0
- package/dist/ingest-IGI7RXR4.js +95 -0
- package/dist/ingest-JPIHSH7W.js +95 -0
- package/dist/ingest-QGXA4Y6C.js +95 -0
- package/dist/init-2PRW64KV.js +146 -0
- package/dist/init-C3CONL23.js +146 -0
- package/dist/init-DAKOWQSW.js +169 -0
- package/dist/init-FYPMJDRN.js +146 -0
- package/dist/{init-C335O4TX.js → init-GCT4XEI6.js} +2 -2
- package/dist/init-HBEIXY3N.js +146 -0
- package/dist/init-MISGIVCC.js +146 -0
- package/dist/init-MNM4TXXJ.js +146 -0
- package/dist/{init-YAGOXYWG.js → init-OQW3KXTR.js} +2 -2
- package/dist/init-SIEKAILM.js +113 -0
- package/dist/init-TM7GTHTJ.js +146 -0
- package/dist/init-VYWOSISP.js +146 -0
- package/dist/init-WCL7FZOJ.js +182 -0
- package/dist/init-ZLUDTJAP.js +182 -0
- package/dist/{invalidate-C54IVIGL.js → invalidate-D2O4VWZU.js} +4 -2
- package/dist/{maintain-ZPHG47YY.js → maintain-B65WIMGJ.js} +10 -5
- package/dist/maintain-EWOU3DGT.js +37 -0
- package/dist/maintain-FELKLG7O.js +37 -0
- package/dist/maintain-WRRDXEG3.js +37 -0
- package/dist/maintain-XTCSOQBU.js +37 -0
- package/dist/{relate-R6DQUJCQ.js → relate-2QMG5H2I.js} +5 -3
- package/dist/relate-C22YYJZT.js +46 -0
- package/dist/relate-V5RYMJJ5.js +47 -0
- package/dist/relate-W4BXPFJA.js +46 -0
- package/dist/reset-45EUG44R.js +95 -0
- package/dist/reset-5NDHFUC3.js +95 -0
- package/dist/reset-C7I3LA5M.js +95 -0
- package/dist/reset-F6F2R6BR.js +95 -0
- package/dist/reset-K3K4K5CT.js +95 -0
- package/dist/reset-K4WZJ4WU.js +95 -0
- package/dist/{reset-P63V46RN.js → reset-NNQQJN6L.js} +2 -2
- package/dist/{reset-GPV46GSD.js → reset-P5FXLI4E.js} +2 -2
- package/dist/reset-SORHIEKY.js +112 -0
- package/dist/reset-SVJMWYAK.js +95 -0
- package/dist/reset-W22RJGYZ.js +112 -0
- package/dist/reset-W3QVA632.js +95 -0
- package/dist/reset-WYEU6XJQ.js +112 -0
- package/dist/{search-YEYKOEXC.js → search-2SU5WQYK.js} +9 -4
- package/dist/search-5EE3XB2R.js +48 -0
- package/dist/search-L6P3XY47.js +48 -0
- package/dist/search-UA7Y55LQ.js +48 -0
- package/dist/search-ZKLRJXFT.js +48 -0
- package/dist/{status-PYD6U7U7.js → status-3XVXJF7M.js} +1 -42
- package/dist/status-4THJLSJL.js +131 -0
- package/dist/status-4UYY7TOE.js +131 -0
- package/dist/status-7G3RMR6A.js +139 -0
- package/dist/status-7M4TJVDH.js +170 -0
- package/dist/status-7MEEKEC2.js +131 -0
- package/dist/status-BQL4VJ6Y.js +149 -0
- package/dist/status-BTEVCZ5K.js +125 -0
- package/dist/status-F3NZGGPH.js +131 -0
- package/dist/status-GQMXOMRN.js +131 -0
- package/dist/status-HJGTMHTD.js +131 -0
- package/dist/{status-AMMF6QGI.js → status-IEKR6SSH.js} +35 -6
- package/dist/status-JJGVWESB.js +139 -0
- package/dist/status-LDVRVYZH.js +131 -0
- package/dist/{status-XNQRRFWF.js → status-TATIX3R6.js} +1 -1
- package/dist/{store-ZMERYHI6.js → store-6D5OJ2DX.js} +12 -7
- package/dist/store-I4JNJWAZ.js +91 -0
- package/dist/store-R4LXYE57.js +91 -0
- package/dist/store-UMR2NOT7.js +91 -0
- package/dist/store-ZDI5AH4M.js +91 -0
- package/dist/update-XJLMXCDZ.js +36 -0
- package/dist/{working-memory-2RRQFX4Q.js → working-memory-2U33JHJB.js} +10 -6
- package/dist/working-memory-35TMFU3P.js +53 -0
- package/dist/working-memory-IBWGIXLW.js +53 -0
- package/dist/working-memory-RZE3GYQZ.js +53 -0
- package/dist/working-memory-WGB5DZ3B.js +53 -0
- package/package.json +4 -4
- package/dist/chunk-MWLPPS7U.js +0 -133
- package/dist/ingest-ZOR3XSAE.js +0 -152
- package/dist/init-7VFBCA4O.js +0 -26
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAgentsMdPath,
|
|
3
|
+
getCodexConfigFilePath,
|
|
4
|
+
getCursorMcpConfigPath,
|
|
5
|
+
getCursorRulesPath,
|
|
6
|
+
getGenericMCPPath,
|
|
7
|
+
isClaudeCodeInstalled,
|
|
8
|
+
registerClaudeCodeHooks,
|
|
9
|
+
registerCodexMCP,
|
|
10
|
+
registerCursorMCP,
|
|
11
|
+
registerGenericMCP,
|
|
12
|
+
updateClaudeMd
|
|
13
|
+
} from "./chunk-RABFL4EN.js";
|
|
14
|
+
import {
|
|
15
|
+
hasFlag,
|
|
16
|
+
optionalOption
|
|
17
|
+
} from "./chunk-TGGGIJC4.js";
|
|
18
|
+
import {
|
|
19
|
+
getConfig,
|
|
20
|
+
writeConfig
|
|
21
|
+
} from "./chunk-TU5EHSDE.js";
|
|
22
|
+
import {
|
|
23
|
+
getDefaultDbPath,
|
|
24
|
+
getEngine
|
|
25
|
+
} from "./chunk-2ZBEEETG.js";
|
|
26
|
+
import {
|
|
27
|
+
output
|
|
28
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
29
|
+
|
|
30
|
+
// src/commands/init.ts
|
|
31
|
+
import { existsSync } from "fs";
|
|
32
|
+
var LANG_FLAG_TO_PRESET = {
|
|
33
|
+
en: "en",
|
|
34
|
+
multi: "multilingual",
|
|
35
|
+
ko: "ko"
|
|
36
|
+
};
|
|
37
|
+
async function run(options) {
|
|
38
|
+
const { args, format, db, noEmbeddings } = options;
|
|
39
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
40
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
41
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
42
|
+
const langFlag = optionalOption(args, "--lang");
|
|
43
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
44
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
45
|
+
process.stderr.write(
|
|
46
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
47
|
+
`
|
|
48
|
+
);
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (embeddingPreset) {
|
|
53
|
+
const config = getConfig();
|
|
54
|
+
writeConfig({ ...config, embeddingPreset });
|
|
55
|
+
}
|
|
56
|
+
const dbPath = db ?? getDefaultDbPath();
|
|
57
|
+
const existed = existsSync(dbPath);
|
|
58
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
59
|
+
await engine.close();
|
|
60
|
+
const result = {
|
|
61
|
+
database: {
|
|
62
|
+
path: dbPath,
|
|
63
|
+
created: !existed
|
|
64
|
+
},
|
|
65
|
+
integrations: {}
|
|
66
|
+
};
|
|
67
|
+
registerGenericMCP();
|
|
68
|
+
result.integrations.mcp = {
|
|
69
|
+
registered: true,
|
|
70
|
+
path: getGenericMCPPath()
|
|
71
|
+
};
|
|
72
|
+
if (wantClaudeCode) {
|
|
73
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
74
|
+
const claudeMdOk = updateClaudeMd();
|
|
75
|
+
result.integrations.claudeCode = {
|
|
76
|
+
hooks: hooksOk,
|
|
77
|
+
mcp: true,
|
|
78
|
+
claudeMd: claudeMdOk
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (wantCursor) {
|
|
82
|
+
registerCursorMCP();
|
|
83
|
+
result.integrations.cursor = {
|
|
84
|
+
mcp: true,
|
|
85
|
+
path: getCursorMcpConfigPath(),
|
|
86
|
+
cursorRules: true,
|
|
87
|
+
cursorRulesPath: getCursorRulesPath()
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (wantCodex) {
|
|
91
|
+
registerCodexMCP();
|
|
92
|
+
result.integrations.codex = {
|
|
93
|
+
mcp: true,
|
|
94
|
+
path: getCodexConfigFilePath(),
|
|
95
|
+
agentsMd: true,
|
|
96
|
+
agentsMdPath: getAgentsMdPath()
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (format === "text") {
|
|
100
|
+
printTextOutput(result, wantClaudeCode, wantCursor, wantCodex);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
output(result, format);
|
|
104
|
+
}
|
|
105
|
+
function printTextOutput(result, claudeCode, cursor, codex = false) {
|
|
106
|
+
const w = (s) => process.stdout.write(s);
|
|
107
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
108
|
+
w(" What was set up:\n");
|
|
109
|
+
w(" ----------------------------------------\n");
|
|
110
|
+
w(` Database: ${result.database.path}`);
|
|
111
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
112
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
113
|
+
`);
|
|
114
|
+
const currentConfig = getConfig();
|
|
115
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
116
|
+
const presetLabels = {
|
|
117
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
118
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
119
|
+
};
|
|
120
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
121
|
+
`);
|
|
122
|
+
}
|
|
123
|
+
if (claudeCode) {
|
|
124
|
+
const cc = result.integrations.claudeCode;
|
|
125
|
+
if (cc.hooks) {
|
|
126
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
127
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
128
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
129
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
130
|
+
}
|
|
131
|
+
if (cc.claudeMd) {
|
|
132
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
133
|
+
} else {
|
|
134
|
+
w(" CLAUDE.md: already configured\n");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (cursor) {
|
|
138
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
139
|
+
`);
|
|
140
|
+
if (result.integrations.cursor.cursorRules) {
|
|
141
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
142
|
+
`);
|
|
143
|
+
} else {
|
|
144
|
+
w(" .cursorrules: already configured\n");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (codex) {
|
|
148
|
+
w(` Codex MCP: ${result.integrations.codex.path}
|
|
149
|
+
`);
|
|
150
|
+
if (result.integrations.codex.agentsMd) {
|
|
151
|
+
w(` AGENTS.md: ${result.integrations.codex.agentsMdPath} (memory instructions added)
|
|
152
|
+
`);
|
|
153
|
+
} else {
|
|
154
|
+
w(" AGENTS.md: already configured\n");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
w("\n");
|
|
158
|
+
if (!claudeCode && !cursor && !codex) {
|
|
159
|
+
w(" MCP is ready. Add --claude-code, --cursor, or --codex for tool-specific setup.\n");
|
|
160
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
161
|
+
w("\n");
|
|
162
|
+
}
|
|
163
|
+
if (claudeCode) {
|
|
164
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
run
|
|
169
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCursorMcpConfigPath,
|
|
3
|
+
getCursorRulesPath,
|
|
4
|
+
getGenericMCPPath,
|
|
5
|
+
isClaudeCodeInstalled,
|
|
6
|
+
registerClaudeCodeHooks,
|
|
7
|
+
registerCursorMCP,
|
|
8
|
+
registerGenericMCP,
|
|
9
|
+
updateClaudeMd
|
|
10
|
+
} from "./chunk-BGXZ3MDD.js";
|
|
11
|
+
import {
|
|
12
|
+
hasFlag,
|
|
13
|
+
optionalOption
|
|
14
|
+
} from "./chunk-PW52BB6L.js";
|
|
15
|
+
import {
|
|
16
|
+
getConfig,
|
|
17
|
+
writeConfig
|
|
18
|
+
} from "./chunk-TU5EHSDE.js";
|
|
19
|
+
import {
|
|
20
|
+
getDefaultDbPath,
|
|
21
|
+
getEngine
|
|
22
|
+
} from "./chunk-2ZBEEETG.js";
|
|
23
|
+
import {
|
|
24
|
+
output
|
|
25
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/init.ts
|
|
28
|
+
import { existsSync } from "fs";
|
|
29
|
+
var LANG_FLAG_TO_PRESET = {
|
|
30
|
+
en: "en",
|
|
31
|
+
multi: "multilingual",
|
|
32
|
+
ko: "ko"
|
|
33
|
+
};
|
|
34
|
+
async function run(options) {
|
|
35
|
+
const { args, format, db, noEmbeddings } = options;
|
|
36
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
37
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
38
|
+
const langFlag = optionalOption(args, "--lang");
|
|
39
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
40
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (embeddingPreset) {
|
|
49
|
+
const config = getConfig();
|
|
50
|
+
writeConfig({ ...config, embeddingPreset });
|
|
51
|
+
}
|
|
52
|
+
const dbPath = db ?? getDefaultDbPath();
|
|
53
|
+
const existed = existsSync(dbPath);
|
|
54
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
55
|
+
await engine.close();
|
|
56
|
+
const result = {
|
|
57
|
+
database: {
|
|
58
|
+
path: dbPath,
|
|
59
|
+
created: !existed
|
|
60
|
+
},
|
|
61
|
+
integrations: {}
|
|
62
|
+
};
|
|
63
|
+
registerGenericMCP();
|
|
64
|
+
result.integrations.mcp = {
|
|
65
|
+
registered: true,
|
|
66
|
+
path: getGenericMCPPath()
|
|
67
|
+
};
|
|
68
|
+
if (wantClaudeCode) {
|
|
69
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
70
|
+
const claudeMdOk = updateClaudeMd();
|
|
71
|
+
result.integrations.claudeCode = {
|
|
72
|
+
hooks: hooksOk,
|
|
73
|
+
mcp: true,
|
|
74
|
+
claudeMd: claudeMdOk
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (wantCursor) {
|
|
78
|
+
registerCursorMCP();
|
|
79
|
+
result.integrations.cursor = {
|
|
80
|
+
mcp: true,
|
|
81
|
+
path: getCursorMcpConfigPath(),
|
|
82
|
+
cursorRules: true,
|
|
83
|
+
cursorRulesPath: getCursorRulesPath()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (format === "text") {
|
|
87
|
+
printTextOutput(result, wantClaudeCode, wantCursor);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
output(result, format);
|
|
91
|
+
}
|
|
92
|
+
function printTextOutput(result, claudeCode, cursor) {
|
|
93
|
+
const w = (s) => process.stdout.write(s);
|
|
94
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
95
|
+
w(" What was set up:\n");
|
|
96
|
+
w(" ----------------------------------------\n");
|
|
97
|
+
w(` Database: ${result.database.path}`);
|
|
98
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
99
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
100
|
+
`);
|
|
101
|
+
const currentConfig = getConfig();
|
|
102
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
103
|
+
const presetLabels = {
|
|
104
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
105
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
106
|
+
};
|
|
107
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
if (claudeCode) {
|
|
111
|
+
const cc = result.integrations.claudeCode;
|
|
112
|
+
if (cc.hooks) {
|
|
113
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
114
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
115
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
116
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
117
|
+
}
|
|
118
|
+
if (cc.claudeMd) {
|
|
119
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
120
|
+
} else {
|
|
121
|
+
w(" CLAUDE.md: already configured\n");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (cursor) {
|
|
125
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
126
|
+
`);
|
|
127
|
+
if (result.integrations.cursor.cursorRules) {
|
|
128
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
129
|
+
`);
|
|
130
|
+
} else {
|
|
131
|
+
w(" .cursorrules: already configured\n");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
w("\n");
|
|
135
|
+
if (!claudeCode && !cursor) {
|
|
136
|
+
w(" MCP is ready. Add --claude-code or --cursor for tool-specific setup.\n");
|
|
137
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
138
|
+
w("\n");
|
|
139
|
+
}
|
|
140
|
+
if (claudeCode) {
|
|
141
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
run
|
|
146
|
+
};
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
registerCursorMCP,
|
|
11
11
|
registerGenericMCP,
|
|
12
12
|
updateClaudeMd
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-356QK7TK.js";
|
|
14
14
|
import {
|
|
15
15
|
hasFlag,
|
|
16
16
|
optionalOption
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TGGGIJC4.js";
|
|
18
18
|
import {
|
|
19
19
|
getDefaultDbPath,
|
|
20
20
|
getEngine
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCursorMcpConfigPath,
|
|
3
|
+
getCursorRulesPath,
|
|
4
|
+
getGenericMCPPath,
|
|
5
|
+
isClaudeCodeInstalled,
|
|
6
|
+
registerClaudeCodeHooks,
|
|
7
|
+
registerCursorMCP,
|
|
8
|
+
registerGenericMCP,
|
|
9
|
+
updateClaudeMd
|
|
10
|
+
} from "./chunk-IM6H35RB.js";
|
|
11
|
+
import {
|
|
12
|
+
hasFlag,
|
|
13
|
+
optionalOption
|
|
14
|
+
} from "./chunk-TGGGIJC4.js";
|
|
15
|
+
import {
|
|
16
|
+
getConfig,
|
|
17
|
+
writeConfig
|
|
18
|
+
} from "./chunk-TU5EHSDE.js";
|
|
19
|
+
import {
|
|
20
|
+
getDefaultDbPath,
|
|
21
|
+
getEngine
|
|
22
|
+
} from "./chunk-2ZBEEETG.js";
|
|
23
|
+
import {
|
|
24
|
+
output
|
|
25
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/init.ts
|
|
28
|
+
import { existsSync } from "fs";
|
|
29
|
+
var LANG_FLAG_TO_PRESET = {
|
|
30
|
+
en: "en",
|
|
31
|
+
multi: "multilingual",
|
|
32
|
+
ko: "ko"
|
|
33
|
+
};
|
|
34
|
+
async function run(options) {
|
|
35
|
+
const { args, format, db, noEmbeddings } = options;
|
|
36
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
37
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
38
|
+
const langFlag = optionalOption(args, "--lang");
|
|
39
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
40
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (embeddingPreset) {
|
|
49
|
+
const config = getConfig();
|
|
50
|
+
writeConfig({ ...config, embeddingPreset });
|
|
51
|
+
}
|
|
52
|
+
const dbPath = db ?? getDefaultDbPath();
|
|
53
|
+
const existed = existsSync(dbPath);
|
|
54
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
55
|
+
await engine.close();
|
|
56
|
+
const result = {
|
|
57
|
+
database: {
|
|
58
|
+
path: dbPath,
|
|
59
|
+
created: !existed
|
|
60
|
+
},
|
|
61
|
+
integrations: {}
|
|
62
|
+
};
|
|
63
|
+
registerGenericMCP();
|
|
64
|
+
result.integrations.mcp = {
|
|
65
|
+
registered: true,
|
|
66
|
+
path: getGenericMCPPath()
|
|
67
|
+
};
|
|
68
|
+
if (wantClaudeCode) {
|
|
69
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
70
|
+
const claudeMdOk = updateClaudeMd();
|
|
71
|
+
result.integrations.claudeCode = {
|
|
72
|
+
hooks: hooksOk,
|
|
73
|
+
mcp: true,
|
|
74
|
+
claudeMd: claudeMdOk
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (wantCursor) {
|
|
78
|
+
registerCursorMCP();
|
|
79
|
+
result.integrations.cursor = {
|
|
80
|
+
mcp: true,
|
|
81
|
+
path: getCursorMcpConfigPath(),
|
|
82
|
+
cursorRules: true,
|
|
83
|
+
cursorRulesPath: getCursorRulesPath()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (format === "text") {
|
|
87
|
+
printTextOutput(result, wantClaudeCode, wantCursor);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
output(result, format);
|
|
91
|
+
}
|
|
92
|
+
function printTextOutput(result, claudeCode, cursor) {
|
|
93
|
+
const w = (s) => process.stdout.write(s);
|
|
94
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
95
|
+
w(" What was set up:\n");
|
|
96
|
+
w(" ----------------------------------------\n");
|
|
97
|
+
w(` Database: ${result.database.path}`);
|
|
98
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
99
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
100
|
+
`);
|
|
101
|
+
const currentConfig = getConfig();
|
|
102
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
103
|
+
const presetLabels = {
|
|
104
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
105
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
106
|
+
};
|
|
107
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
if (claudeCode) {
|
|
111
|
+
const cc = result.integrations.claudeCode;
|
|
112
|
+
if (cc.hooks) {
|
|
113
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
114
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
115
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
116
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
117
|
+
}
|
|
118
|
+
if (cc.claudeMd) {
|
|
119
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
120
|
+
} else {
|
|
121
|
+
w(" CLAUDE.md: already configured\n");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (cursor) {
|
|
125
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
126
|
+
`);
|
|
127
|
+
if (result.integrations.cursor.cursorRules) {
|
|
128
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
129
|
+
`);
|
|
130
|
+
} else {
|
|
131
|
+
w(" .cursorrules: already configured\n");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
w("\n");
|
|
135
|
+
if (!claudeCode && !cursor) {
|
|
136
|
+
w(" MCP is ready. Add --claude-code or --cursor for tool-specific setup.\n");
|
|
137
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
138
|
+
w("\n");
|
|
139
|
+
}
|
|
140
|
+
if (claudeCode) {
|
|
141
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
run
|
|
146
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCursorMcpConfigPath,
|
|
3
|
+
getCursorRulesPath,
|
|
4
|
+
getGenericMCPPath,
|
|
5
|
+
isClaudeCodeInstalled,
|
|
6
|
+
registerClaudeCodeHooks,
|
|
7
|
+
registerCursorMCP,
|
|
8
|
+
registerGenericMCP,
|
|
9
|
+
updateClaudeMd
|
|
10
|
+
} from "./chunk-RDUU53MG.js";
|
|
11
|
+
import {
|
|
12
|
+
hasFlag,
|
|
13
|
+
optionalOption
|
|
14
|
+
} from "./chunk-HXZ7MAT6.js";
|
|
15
|
+
import {
|
|
16
|
+
getConfig,
|
|
17
|
+
writeConfig
|
|
18
|
+
} from "./chunk-TU5EHSDE.js";
|
|
19
|
+
import {
|
|
20
|
+
getDefaultDbPath,
|
|
21
|
+
getEngine
|
|
22
|
+
} from "./chunk-2ZBEEETG.js";
|
|
23
|
+
import {
|
|
24
|
+
output
|
|
25
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
26
|
+
|
|
27
|
+
// src/commands/init.ts
|
|
28
|
+
import { existsSync } from "fs";
|
|
29
|
+
var LANG_FLAG_TO_PRESET = {
|
|
30
|
+
en: "en",
|
|
31
|
+
multi: "multilingual",
|
|
32
|
+
ko: "ko"
|
|
33
|
+
};
|
|
34
|
+
async function run(options) {
|
|
35
|
+
const { args, format, db, noEmbeddings } = options;
|
|
36
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
37
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
38
|
+
const langFlag = optionalOption(args, "--lang");
|
|
39
|
+
const embeddingPreset = langFlag ? LANG_FLAG_TO_PRESET[langFlag] : void 0;
|
|
40
|
+
if (langFlag && !LANG_FLAG_TO_PRESET[langFlag]) {
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`Unknown --lang value: "${langFlag}". Supported: en, multi, ko
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (embeddingPreset) {
|
|
49
|
+
const config = getConfig();
|
|
50
|
+
writeConfig({ ...config, embeddingPreset });
|
|
51
|
+
}
|
|
52
|
+
const dbPath = db ?? getDefaultDbPath();
|
|
53
|
+
const existed = existsSync(dbPath);
|
|
54
|
+
const engine = await getEngine({ db: dbPath, noEmbeddings });
|
|
55
|
+
await engine.close();
|
|
56
|
+
const result = {
|
|
57
|
+
database: {
|
|
58
|
+
path: dbPath,
|
|
59
|
+
created: !existed
|
|
60
|
+
},
|
|
61
|
+
integrations: {}
|
|
62
|
+
};
|
|
63
|
+
registerGenericMCP();
|
|
64
|
+
result.integrations.mcp = {
|
|
65
|
+
registered: true,
|
|
66
|
+
path: getGenericMCPPath()
|
|
67
|
+
};
|
|
68
|
+
if (wantClaudeCode) {
|
|
69
|
+
const hooksOk = registerClaudeCodeHooks();
|
|
70
|
+
const claudeMdOk = updateClaudeMd();
|
|
71
|
+
result.integrations.claudeCode = {
|
|
72
|
+
hooks: hooksOk,
|
|
73
|
+
mcp: true,
|
|
74
|
+
claudeMd: claudeMdOk
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (wantCursor) {
|
|
78
|
+
registerCursorMCP();
|
|
79
|
+
result.integrations.cursor = {
|
|
80
|
+
mcp: true,
|
|
81
|
+
path: getCursorMcpConfigPath(),
|
|
82
|
+
cursorRules: true,
|
|
83
|
+
cursorRulesPath: getCursorRulesPath()
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (format === "text") {
|
|
87
|
+
printTextOutput(result, wantClaudeCode, wantCursor);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
output(result, format);
|
|
91
|
+
}
|
|
92
|
+
function printTextOutput(result, claudeCode, cursor) {
|
|
93
|
+
const w = (s) => process.stdout.write(s);
|
|
94
|
+
w("\nMemRosetta initialized successfully.\n\n");
|
|
95
|
+
w(" What was set up:\n");
|
|
96
|
+
w(" ----------------------------------------\n");
|
|
97
|
+
w(` Database: ${result.database.path}`);
|
|
98
|
+
w(result.database.created ? " (created)\n" : " (already exists)\n");
|
|
99
|
+
w(` MCP Server: ${result.integrations.mcp.path} (always included)
|
|
100
|
+
`);
|
|
101
|
+
const currentConfig = getConfig();
|
|
102
|
+
if (currentConfig.embeddingPreset && currentConfig.embeddingPreset !== "en") {
|
|
103
|
+
const presetLabels = {
|
|
104
|
+
multilingual: "multilingual (multilingual-e5-small)",
|
|
105
|
+
ko: "Korean (ko-sroberta-multitask)"
|
|
106
|
+
};
|
|
107
|
+
w(` Embeddings: ${presetLabels[currentConfig.embeddingPreset] ?? currentConfig.embeddingPreset}
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
if (claudeCode) {
|
|
111
|
+
const cc = result.integrations.claudeCode;
|
|
112
|
+
if (cc.hooks) {
|
|
113
|
+
w(" Stop Hook: ~/.claude/settings.json (auto-save on session end)\n");
|
|
114
|
+
} else if (!isClaudeCodeInstalled()) {
|
|
115
|
+
w(" Stop Hook: SKIPPED (Claude Code not found at ~/.claude)\n");
|
|
116
|
+
w(' Install Claude Code first, then run "memrosetta init --claude-code" again.\n');
|
|
117
|
+
}
|
|
118
|
+
if (cc.claudeMd) {
|
|
119
|
+
w(" CLAUDE.md: ~/.claude/CLAUDE.md (memory instructions added)\n");
|
|
120
|
+
} else {
|
|
121
|
+
w(" CLAUDE.md: already configured\n");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (cursor) {
|
|
125
|
+
w(` Cursor MCP: ${result.integrations.cursor.path}
|
|
126
|
+
`);
|
|
127
|
+
if (result.integrations.cursor.cursorRules) {
|
|
128
|
+
w(` .cursorrules: ${result.integrations.cursor.cursorRulesPath} (memory instructions added)
|
|
129
|
+
`);
|
|
130
|
+
} else {
|
|
131
|
+
w(" .cursorrules: already configured\n");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
w("\n");
|
|
135
|
+
if (!claudeCode && !cursor) {
|
|
136
|
+
w(" MCP is ready. Add --claude-code or --cursor for tool-specific setup.\n");
|
|
137
|
+
w(" Example: memrosetta init --claude-code\n");
|
|
138
|
+
w("\n");
|
|
139
|
+
}
|
|
140
|
+
if (claudeCode) {
|
|
141
|
+
w(" Restart Claude Code to activate.\n\n");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
run
|
|
146
|
+
};
|