@memrosetta/cli 0.5.0 → 0.5.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-47SU2YUJ.js +64 -0
- package/dist/chunk-4LNXT25H.js +891 -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/enforce-codex.js +88 -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-ISP73KEC.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/reset-P62B444X.js +132 -0
- package/dist/search-AYZBKRXF.js +48 -0
- package/dist/search-JQ3MLRKS.js +48 -0
- package/dist/status-FWHUUZ4R.js +184 -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 +6 -5
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
removeAgentsMdSection,
|
|
3
|
+
removeClaudeCodeHooks,
|
|
4
|
+
removeClaudeMdSection,
|
|
5
|
+
removeCodexHooks,
|
|
6
|
+
removeCodexMCP,
|
|
7
|
+
removeCursorMCP,
|
|
8
|
+
removeCursorRulesSection,
|
|
9
|
+
removeGeminiMCP,
|
|
10
|
+
removeGeminiMdSection,
|
|
11
|
+
removeGenericMCP
|
|
12
|
+
} from "./chunk-4LNXT25H.js";
|
|
13
|
+
import {
|
|
14
|
+
hasFlag
|
|
15
|
+
} from "./chunk-US6CEDMU.js";
|
|
16
|
+
import {
|
|
17
|
+
output
|
|
18
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/reset.ts
|
|
21
|
+
async function run(options) {
|
|
22
|
+
const { args, format } = options;
|
|
23
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
24
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
25
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
26
|
+
const wantGemini = hasFlag(args, "--gemini");
|
|
27
|
+
const wantMCP = hasFlag(args, "--mcp");
|
|
28
|
+
const wantAll = hasFlag(args, "--all");
|
|
29
|
+
const noFlags = !wantClaudeCode && !wantCursor && !wantCodex && !wantGemini && !wantMCP && !wantAll;
|
|
30
|
+
if (noFlags) {
|
|
31
|
+
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";
|
|
32
|
+
if (format === "text") {
|
|
33
|
+
process.stdout.write(msg);
|
|
34
|
+
} else {
|
|
35
|
+
output({ error: "No flags specified. Use --claude-code, --cursor, --codex, --gemini, --mcp, or --all." }, format);
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const result = {
|
|
40
|
+
removed: {
|
|
41
|
+
claudeCodeHooks: false,
|
|
42
|
+
claudeMd: false,
|
|
43
|
+
mcp: false,
|
|
44
|
+
cursor: false,
|
|
45
|
+
cursorRules: false,
|
|
46
|
+
codex: false,
|
|
47
|
+
agentsMd: false,
|
|
48
|
+
gemini: false,
|
|
49
|
+
geminiMd: false
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (wantClaudeCode || wantAll) {
|
|
53
|
+
const hooksRemoved = removeClaudeCodeHooks();
|
|
54
|
+
const mdRemoved = removeClaudeMdSection();
|
|
55
|
+
const mcpRemoved = removeGenericMCP();
|
|
56
|
+
result.removed.claudeCodeHooks = hooksRemoved;
|
|
57
|
+
result.removed.claudeMd = mdRemoved;
|
|
58
|
+
if (!wantMCP) {
|
|
59
|
+
result.removed.mcp = mcpRemoved;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (wantCursor || wantAll) {
|
|
63
|
+
const removed = removeCursorMCP();
|
|
64
|
+
result.removed.cursor = removed;
|
|
65
|
+
const rulesRemoved = removeCursorRulesSection();
|
|
66
|
+
result.removed.cursorRules = rulesRemoved;
|
|
67
|
+
}
|
|
68
|
+
if (wantCodex || wantAll) {
|
|
69
|
+
const removed = removeCodexMCP();
|
|
70
|
+
result.removed.codex = removed;
|
|
71
|
+
const mdRemoved = removeAgentsMdSection();
|
|
72
|
+
result.removed.agentsMd = mdRemoved;
|
|
73
|
+
const stopHookRemoved = removeCodexHooks();
|
|
74
|
+
result.removed.codexStopHook = stopHookRemoved;
|
|
75
|
+
}
|
|
76
|
+
if (wantGemini || wantAll) {
|
|
77
|
+
const removed = removeGeminiMCP();
|
|
78
|
+
result.removed.gemini = removed;
|
|
79
|
+
const mdRemoved = removeGeminiMdSection();
|
|
80
|
+
result.removed.geminiMd = mdRemoved;
|
|
81
|
+
}
|
|
82
|
+
if (wantMCP || wantAll) {
|
|
83
|
+
const removed = removeGenericMCP();
|
|
84
|
+
result.removed.mcp = removed;
|
|
85
|
+
}
|
|
86
|
+
if (format === "text") {
|
|
87
|
+
printTextOutput(result);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
output(result, format);
|
|
91
|
+
}
|
|
92
|
+
function printTextOutput(result) {
|
|
93
|
+
const w = (s) => process.stdout.write(s);
|
|
94
|
+
const removed = result.removed;
|
|
95
|
+
if (removed.claudeCodeHooks) {
|
|
96
|
+
w("Removed Claude Code hooks from ~/.claude/settings.json\n");
|
|
97
|
+
}
|
|
98
|
+
if (removed.claudeMd) {
|
|
99
|
+
w("Removed MemRosetta section from ~/.claude/CLAUDE.md\n");
|
|
100
|
+
}
|
|
101
|
+
if (removed.mcp) {
|
|
102
|
+
w("Removed MCP server from ~/.mcp.json\n");
|
|
103
|
+
}
|
|
104
|
+
if (removed.cursor) {
|
|
105
|
+
w("Removed Cursor MCP from ~/.cursor/mcp.json\n");
|
|
106
|
+
}
|
|
107
|
+
if (removed.cursorRules) {
|
|
108
|
+
w("Removed MemRosetta section from ~/.cursorrules\n");
|
|
109
|
+
}
|
|
110
|
+
if (removed.codex) {
|
|
111
|
+
w("Removed Codex MCP from ~/.codex/config.toml\n");
|
|
112
|
+
}
|
|
113
|
+
if (removed.agentsMd) {
|
|
114
|
+
w("Removed MemRosetta section from AGENTS.md\n");
|
|
115
|
+
}
|
|
116
|
+
if (removed.gemini) {
|
|
117
|
+
w("Removed Gemini MCP from ~/.gemini/settings.json\n");
|
|
118
|
+
}
|
|
119
|
+
if (removed.geminiMd) {
|
|
120
|
+
w("Removed MemRosetta section from GEMINI.md\n");
|
|
121
|
+
}
|
|
122
|
+
const anyRemoved = removed.claudeCodeHooks || removed.claudeMd || removed.mcp || removed.cursor || removed.cursorRules || removed.codex || removed.agentsMd || removed.gemini || removed.geminiMd;
|
|
123
|
+
if (!anyRemoved) {
|
|
124
|
+
w("Nothing to remove (no integrations were configured).\n");
|
|
125
|
+
}
|
|
126
|
+
w(
|
|
127
|
+
"\nNote: ~/.memrosetta/ directory preserved. Delete manually if needed:\n rm -rf ~/.memrosetta\n"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
run
|
|
132
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
removeAgentsMdSection,
|
|
3
|
+
removeClaudeCodeHooks,
|
|
4
|
+
removeClaudeMdSection,
|
|
5
|
+
removeCodexHooks,
|
|
6
|
+
removeCodexMCP,
|
|
7
|
+
removeCursorMCP,
|
|
8
|
+
removeCursorRulesSection,
|
|
9
|
+
removeGeminiMCP,
|
|
10
|
+
removeGeminiMdSection,
|
|
11
|
+
removeGenericMCP
|
|
12
|
+
} from "./chunk-4LNXT25H.js";
|
|
13
|
+
import {
|
|
14
|
+
hasFlag
|
|
15
|
+
} from "./chunk-SYPVELIW.js";
|
|
16
|
+
import {
|
|
17
|
+
output
|
|
18
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/reset.ts
|
|
21
|
+
async function run(options) {
|
|
22
|
+
const { args, format } = options;
|
|
23
|
+
const wantClaudeCode = hasFlag(args, "--claude-code");
|
|
24
|
+
const wantCursor = hasFlag(args, "--cursor");
|
|
25
|
+
const wantCodex = hasFlag(args, "--codex");
|
|
26
|
+
const wantGemini = hasFlag(args, "--gemini");
|
|
27
|
+
const wantMCP = hasFlag(args, "--mcp");
|
|
28
|
+
const wantAll = hasFlag(args, "--all");
|
|
29
|
+
const noFlags = !wantClaudeCode && !wantCursor && !wantCodex && !wantGemini && !wantMCP && !wantAll;
|
|
30
|
+
if (noFlags) {
|
|
31
|
+
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";
|
|
32
|
+
if (format === "text") {
|
|
33
|
+
process.stdout.write(msg);
|
|
34
|
+
} else {
|
|
35
|
+
output({ error: "No flags specified. Use --claude-code, --cursor, --codex, --gemini, --mcp, or --all." }, format);
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const result = {
|
|
40
|
+
removed: {
|
|
41
|
+
claudeCodeHooks: false,
|
|
42
|
+
claudeMd: false,
|
|
43
|
+
mcp: false,
|
|
44
|
+
cursor: false,
|
|
45
|
+
cursorRules: false,
|
|
46
|
+
codex: false,
|
|
47
|
+
agentsMd: false,
|
|
48
|
+
gemini: false,
|
|
49
|
+
geminiMd: false
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
if (wantClaudeCode || wantAll) {
|
|
53
|
+
const hooksRemoved = removeClaudeCodeHooks();
|
|
54
|
+
const mdRemoved = removeClaudeMdSection();
|
|
55
|
+
const mcpRemoved = removeGenericMCP();
|
|
56
|
+
result.removed.claudeCodeHooks = hooksRemoved;
|
|
57
|
+
result.removed.claudeMd = mdRemoved;
|
|
58
|
+
if (!wantMCP) {
|
|
59
|
+
result.removed.mcp = mcpRemoved;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (wantCursor || wantAll) {
|
|
63
|
+
const removed = removeCursorMCP();
|
|
64
|
+
result.removed.cursor = removed;
|
|
65
|
+
const rulesRemoved = removeCursorRulesSection();
|
|
66
|
+
result.removed.cursorRules = rulesRemoved;
|
|
67
|
+
}
|
|
68
|
+
if (wantCodex || wantAll) {
|
|
69
|
+
const removed = removeCodexMCP();
|
|
70
|
+
result.removed.codex = removed;
|
|
71
|
+
const mdRemoved = removeAgentsMdSection();
|
|
72
|
+
result.removed.agentsMd = mdRemoved;
|
|
73
|
+
const stopHookRemoved = removeCodexHooks();
|
|
74
|
+
result.removed.codexStopHook = stopHookRemoved;
|
|
75
|
+
}
|
|
76
|
+
if (wantGemini || wantAll) {
|
|
77
|
+
const removed = removeGeminiMCP();
|
|
78
|
+
result.removed.gemini = removed;
|
|
79
|
+
const mdRemoved = removeGeminiMdSection();
|
|
80
|
+
result.removed.geminiMd = mdRemoved;
|
|
81
|
+
}
|
|
82
|
+
if (wantMCP || wantAll) {
|
|
83
|
+
const removed = removeGenericMCP();
|
|
84
|
+
result.removed.mcp = removed;
|
|
85
|
+
}
|
|
86
|
+
if (format === "text") {
|
|
87
|
+
printTextOutput(result);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
output(result, format);
|
|
91
|
+
}
|
|
92
|
+
function printTextOutput(result) {
|
|
93
|
+
const w = (s) => process.stdout.write(s);
|
|
94
|
+
const removed = result.removed;
|
|
95
|
+
if (removed.claudeCodeHooks) {
|
|
96
|
+
w("Removed Claude Code hooks from ~/.claude/settings.json\n");
|
|
97
|
+
}
|
|
98
|
+
if (removed.claudeMd) {
|
|
99
|
+
w("Removed MemRosetta section from ~/.claude/CLAUDE.md\n");
|
|
100
|
+
}
|
|
101
|
+
if (removed.mcp) {
|
|
102
|
+
w("Removed MCP server from ~/.mcp.json\n");
|
|
103
|
+
}
|
|
104
|
+
if (removed.cursor) {
|
|
105
|
+
w("Removed Cursor MCP from ~/.cursor/mcp.json\n");
|
|
106
|
+
}
|
|
107
|
+
if (removed.cursorRules) {
|
|
108
|
+
w("Removed MemRosetta section from ~/.cursorrules\n");
|
|
109
|
+
}
|
|
110
|
+
if (removed.codex) {
|
|
111
|
+
w("Removed Codex MCP from ~/.codex/config.toml\n");
|
|
112
|
+
}
|
|
113
|
+
if (removed.agentsMd) {
|
|
114
|
+
w("Removed MemRosetta section from AGENTS.md\n");
|
|
115
|
+
}
|
|
116
|
+
if (removed.gemini) {
|
|
117
|
+
w("Removed Gemini MCP from ~/.gemini/settings.json\n");
|
|
118
|
+
}
|
|
119
|
+
if (removed.geminiMd) {
|
|
120
|
+
w("Removed MemRosetta section from GEMINI.md\n");
|
|
121
|
+
}
|
|
122
|
+
const anyRemoved = removed.claudeCodeHooks || removed.claudeMd || removed.mcp || removed.cursor || removed.cursorRules || removed.codex || removed.agentsMd || removed.gemini || removed.geminiMd;
|
|
123
|
+
if (!anyRemoved) {
|
|
124
|
+
w("Nothing to remove (no integrations were configured).\n");
|
|
125
|
+
}
|
|
126
|
+
w(
|
|
127
|
+
"\nNote: ~/.memrosetta/ directory preserved. Delete manually if needed:\n rm -rf ~/.memrosetta\n"
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
run
|
|
132
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
optionalOption,
|
|
3
|
+
requireOption
|
|
4
|
+
} from "./chunk-US6CEDMU.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-47SU2YUJ.js";
|
|
8
|
+
import {
|
|
9
|
+
output,
|
|
10
|
+
outputError
|
|
11
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
12
|
+
import {
|
|
13
|
+
getDefaultUserId
|
|
14
|
+
} from "./chunk-WYHEAKPC.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-US6CEDMU.js";
|
|
5
|
+
import {
|
|
6
|
+
getEngine
|
|
7
|
+
} from "./chunk-VMGX5FCY.js";
|
|
8
|
+
import {
|
|
9
|
+
output,
|
|
10
|
+
outputError
|
|
11
|
+
} from "./chunk-ET6TNQOJ.js";
|
|
12
|
+
import {
|
|
13
|
+
getDefaultUserId
|
|
14
|
+
} from "./chunk-RZFCVYTK.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-4LNXT25H.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
|
+
};
|