@maximalabs/dev-mcp-suite 0.0.0-stage ā 3.6.1
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/.env.example +69 -0
- package/CHANGELOG.md +281 -0
- package/CODEX_DEV_MCP_GUIDE.md +297 -0
- package/LICENSE +21 -0
- package/README.md +193 -2
- package/armada/package.json +14 -0
- package/armada/server.js +329 -0
- package/backfill-sessions-v2.mjs +288 -0
- package/bin/_meta.mjs +73 -0
- package/bin/armada-mcp.mjs +12 -0
- package/bin/checkpoint.mjs +9 -0
- package/bin/context-pack.mjs +9 -0
- package/bin/devjournal.mjs +9 -0
- package/bin/init.mjs +25 -0
- package/bin/project-memory.mjs +10 -0
- package/bin/provider-smoke.mjs +278 -0
- package/bin/prune.mjs +158 -0
- package/bin/stats.mjs +101 -0
- package/bin/ui.mjs +5 -0
- package/checkpoint/package.json +14 -0
- package/checkpoint/server.js +318 -0
- package/context-pack/package.json +14 -0
- package/context-pack/server.js +747 -0
- package/devjournal/compress.js +75 -0
- package/devjournal/env.js +3 -0
- package/devjournal/package.json +14 -0
- package/devjournal/provider-chain.js +109 -0
- package/devjournal/rerank.js +120 -0
- package/devjournal/server.js +415 -0
- package/docs/ROADMAP.md +77 -0
- package/docs/clients/antigravity.md +52 -0
- package/docs/clients/claude-code.md +46 -0
- package/docs/clients/codex.md +39 -0
- package/docs/clients/generic-mcp.md +45 -0
- package/docs/clients/hermes.md +48 -0
- package/docs/configuration.md +123 -0
- package/docs/privacy.md +39 -0
- package/docs/providers.md +13 -0
- package/docs/superpowers/plans/2026-06-15-hardening-v1-2-implementation.md +60 -0
- package/docs/superpowers/plans/2026-06-15-provider-chain-v1-1-implementation.md +65 -0
- package/docs/superpowers/plans/2026-06-15-provider-client-agnostic-config.md +41 -0
- package/docs/superpowers/plans/2026-06-15-trust-release-implementation.md +62 -0
- package/docs/superpowers/plans/2026-06-18-v1-5-0-knowledge-graph.md +792 -0
- package/docs/superpowers/specs/2026-06-15-provider-chain-v1-1-design.md +89 -0
- package/docs/superpowers/specs/2026-06-15-trust-release-design.md +164 -0
- package/docs/superpowers/specs/2026-06-18-dev-mcp-suite-v1-5-0-knowledge-graph-design.md +386 -0
- package/docs/superpowers/specs/2026-07-22-v2-0-0-peak-intelligence.md +50 -0
- package/docs/superpowers/specs/2026-07-22-v3-0-0-god-tier.md +32 -0
- package/lib/init-wizard.js +120 -0
- package/lib/provider-smoke.js +234 -0
- package/lib/prune.js +114 -0
- package/lib/stats.js +269 -0
- package/lib/ui-server.js +151 -0
- package/lib/update-check.js +125 -0
- package/package.json +71 -4
- package/project-memory/auto-indexer.js +152 -0
- package/project-memory/dedup.js +49 -0
- package/project-memory/embedding.js +174 -0
- package/project-memory/env.js +3 -0
- package/project-memory/global-index.js +46 -0
- package/project-memory/graph.js +93 -0
- package/project-memory/local-embed.js +92 -0
- package/project-memory/package.json +14 -0
- package/project-memory/provider-chain.js +109 -0
- package/project-memory/rerank.js +120 -0
- package/project-memory/server.js +931 -0
- package/project-memory/swarm.js +56 -0
- package/run-tests.mjs +54 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Backfill v2 ā deeper session extraction + correct (original) timestamps.
|
|
4
|
+
*
|
|
5
|
+
* Improvements over v1:
|
|
6
|
+
* - Uses the session's ORIGINAL start timestamp (from session_meta) for both
|
|
7
|
+
* the project-memory note 'created' and the devjournal entry 'ts'.
|
|
8
|
+
* - Extracts richer content: all user prompts, plan steps (update_plan),
|
|
9
|
+
* shell commands run, files touched (apply_patch / write paths / cmd heuristics),
|
|
10
|
+
* counts (turns, commands), and the final agent summary.
|
|
11
|
+
* - Writes a richer Markdown body and richer tags.
|
|
12
|
+
* - Idempotent via its own state file (separate from v1).
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* node backfill-sessions-v2.mjs --dry
|
|
16
|
+
* node backfill-sessions-v2.mjs --min-prompts 2 [--wipe]
|
|
17
|
+
*
|
|
18
|
+
* --wipe : delete existing vault+journal entries that came from backfill
|
|
19
|
+
* (kind/type == 'session') before re-importing, so you don't get dupes.
|
|
20
|
+
*/
|
|
21
|
+
import fs from "fs";
|
|
22
|
+
import path from "path";
|
|
23
|
+
import os from "os";
|
|
24
|
+
import { McpClient } from "./_testkit/harness.mjs";
|
|
25
|
+
|
|
26
|
+
const HOME = os.homedir();
|
|
27
|
+
const SESS_ROOT = path.join(HOME, ".codex", "sessions");
|
|
28
|
+
const MEM_ROOT = path.join(HOME, ".codex", "memories");
|
|
29
|
+
const VAULT = path.join(MEM_ROOT, "vault");
|
|
30
|
+
const JOURNAL = path.join(MEM_ROOT, "journal");
|
|
31
|
+
const STATE_FILE = path.join(MEM_ROOT, ".backfill-v2-state.json");
|
|
32
|
+
|
|
33
|
+
const args = process.argv.slice(2);
|
|
34
|
+
const DRY = args.includes("--dry");
|
|
35
|
+
const WIPE = args.includes("--wipe");
|
|
36
|
+
const MIN_PROMPTS = (() => { const i = args.indexOf("--min-prompts"); return i !== -1 ? Number(args[i + 1] || 1) : 1; })();
|
|
37
|
+
|
|
38
|
+
function* walk(dir) {
|
|
39
|
+
let es; try { es = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
40
|
+
for (const e of es) {
|
|
41
|
+
const p = path.join(dir, e.name);
|
|
42
|
+
if (e.isDirectory()) yield* walk(p);
|
|
43
|
+
else if (e.isFile() && e.name.endsWith(".jsonl")) yield p;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function textFromContent(c) {
|
|
47
|
+
if (typeof c === "string") return c;
|
|
48
|
+
if (Array.isArray(c)) return c.map((x) => x?.text || "").join(" ").trim();
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
function clip(s, n) { s = String(s || "").replace(/\s+/g, " ").trim(); return s.length > n ? s.slice(0, n) + "ā¦" : s; }
|
|
52
|
+
|
|
53
|
+
function firstCmdToken(cmd) {
|
|
54
|
+
// crude: pull the program + maybe subcommand
|
|
55
|
+
const c = String(cmd || "").trim();
|
|
56
|
+
const m = c.match(/^[A-Za-z0-9_./-]+(\s+[A-Za-z0-9_-]+)?/);
|
|
57
|
+
return m ? m[0] : "";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function looksLikePath(raw) {
|
|
61
|
+
let p = String(raw || "").trim();
|
|
62
|
+
if (!p) return null;
|
|
63
|
+
// strip surrounding quotes
|
|
64
|
+
p = p.replace(/^['"]|['"]$/g, "");
|
|
65
|
+
// reject obvious non-paths
|
|
66
|
+
if (p.length < 3 || p.length > 200) return null;
|
|
67
|
+
if (/[\s'"`(){}<>|;]/.test(p)) return null; // whitespace / shell / code punctuation
|
|
68
|
+
if (/^-/.test(p)) return null; // flags like -100, -rf
|
|
69
|
+
if (/^\d+$/.test(p)) return null; // pure numbers
|
|
70
|
+
if (/^(https?|ftp):/.test(p)) return null; // urls
|
|
71
|
+
if (p === "/dev/null" || p === "/dev/stdin" || p === "/dev/stdout") return null;
|
|
72
|
+
if (/^[a-z]{1,4}\.(json|status|tipe|score|data|body|text|value|length)$/.test(p)) return null; // method calls: r.json res.body
|
|
73
|
+
if (/\.[A-Za-z]+-[A-Za-z]/.test(p)) return null; // code expr like b.score-a.score
|
|
74
|
+
if (!p.includes("/") && (p.match(/\./g) || []).length >= 2) return null; // chained member access: m.rows.length, e.currentTarget.form
|
|
75
|
+
// JS-ish member access: Foo.bar, a.replace, JSON.stringify (dot but no slash, lowerCamel/UpperCamel)
|
|
76
|
+
const hasSlash = p.includes("/");
|
|
77
|
+
const hasExt = /\.[A-Za-z0-9]{1,6}$/.test(p);
|
|
78
|
+
if (!hasSlash && !hasExt) return null; // must look like a path or have a file extension
|
|
79
|
+
// if it has a dot but no slash, ensure it's a real ext, not method call (e.g. s.replace)
|
|
80
|
+
if (!hasSlash && hasExt) {
|
|
81
|
+
const parts = p.split(".");
|
|
82
|
+
const base = parts[0];
|
|
83
|
+
const ext = parts[parts.length - 1];
|
|
84
|
+
// method/property access like s.replace, k.tipe, r.status, Math.round, JSON.stringify
|
|
85
|
+
if (parts.length === 2 && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(base) && /^[a-z]/.test(ext)) {
|
|
86
|
+
// looks like identifier.method ā only accept if it has a known file extension
|
|
87
|
+
const knownExt = ["js","mjs","cjs","ts","tsx","jsx","py","go","rs","java","rb","php","c","cpp","h","sh","json","md","txt","yml","yaml","toml","css","html","sql","env","lock","cfg","ini","xml","csv"];
|
|
88
|
+
if (!knownExt.includes(ext.toLowerCase())) return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// collapse redirect/glob artifacts
|
|
92
|
+
if (/[*?]/.test(p)) return null;
|
|
93
|
+
return p;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function parseSession(file) {
|
|
97
|
+
let cwd = null, startTs = null, id = null, model = null;
|
|
98
|
+
const userMsgs = [];
|
|
99
|
+
let lastAssistant = "";
|
|
100
|
+
let plan = null;
|
|
101
|
+
const cmds = [];
|
|
102
|
+
const tools = {};
|
|
103
|
+
const files = new Set();
|
|
104
|
+
let turns = 0, reasoningCount = 0;
|
|
105
|
+
|
|
106
|
+
for (const line of fs.readFileSync(file, "utf8").split("\n")) {
|
|
107
|
+
if (!line.trim()) continue;
|
|
108
|
+
let d; try { d = JSON.parse(line); } catch { continue; }
|
|
109
|
+
const p = d.payload || {};
|
|
110
|
+
if (d.type === "session_meta") { cwd = p.cwd || cwd; startTs = p.timestamp || startTs; id = p.id || id; model = p.model_provider || model; }
|
|
111
|
+
if (d.type === "turn_context") { if (!cwd) cwd = p.cwd || cwd; }
|
|
112
|
+
if (d.type === "event_msg" && p.type === "task_started") turns++;
|
|
113
|
+
if (d.type === "event_msg" && p.type === "agent_reasoning") reasoningCount++;
|
|
114
|
+
if (d.type === "event_msg" && p.type === "user_message") {
|
|
115
|
+
const m = (p.message || "").trim();
|
|
116
|
+
if (m && !m.startsWith("<environment_context") && !m.startsWith("[Context:") &&
|
|
117
|
+
!m.startsWith("<INSTRUCTIONS") && !m.startsWith("# AGENTS.md")) userMsgs.push(m);
|
|
118
|
+
}
|
|
119
|
+
if (d.type === "response_item" && p.type === "message" && p.role === "assistant") {
|
|
120
|
+
const t = textFromContent(p.content);
|
|
121
|
+
if (t) lastAssistant = t;
|
|
122
|
+
}
|
|
123
|
+
if (d.type === "response_item" && p.type === "function_call") {
|
|
124
|
+
const name = p.name || "?";
|
|
125
|
+
tools[name] = (tools[name] || 0) + 1;
|
|
126
|
+
let a = {}; try { a = JSON.parse(p.arguments || "{}"); } catch { /* ignore */ }
|
|
127
|
+
if (name === "exec_command" && a.cmd) cmds.push(a.cmd);
|
|
128
|
+
if (name === "update_plan" && Array.isArray(a.plan)) plan = a.plan.map((s) => s.step);
|
|
129
|
+
// file heuristics
|
|
130
|
+
if (a.path) { const v = looksLikePath(a.path); if (v) files.add(v); }
|
|
131
|
+
if (name === "apply_patch" && typeof a.input === "string") {
|
|
132
|
+
for (const mm of a.input.matchAll(/\*\*\* (?:Add|Update|Delete) File: (.+)/g)) {
|
|
133
|
+
const v = looksLikePath(mm[1]); if (v) files.add(v);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (name === "exec_command" && a.cmd) {
|
|
137
|
+
const fm = String(a.cmd).match(/(?:cat|vim|nano|touch|rm|cp|mv|head|tail|less|sed -n|node|python3?)\s+([^\s|;&>]+)/g) || [];
|
|
138
|
+
for (const x of fm) { const parts = x.split(/\s+/); const cand = looksLikePath(parts[parts.length - 1]); if (cand) files.add(cand); }
|
|
139
|
+
const apply = String(a.cmd).match(/(?:>|>>)\s*([A-Za-z0-9_./-]+)/g) || [];
|
|
140
|
+
for (const x of apply) { const v = looksLikePath(x.replace(/^>+\s*/, "")); if (v) files.add(v); }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (!id) id = path.basename(file).replace(/\.jsonl$/, "");
|
|
145
|
+
return { file, id, cwd, startTs, model, userMsgs, lastAssistant, plan, cmds, tools, files: [...files], turns, reasoningCount };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function buildBody(s) {
|
|
149
|
+
const lines = [];
|
|
150
|
+
lines.push(`Session ${s.id}`);
|
|
151
|
+
lines.push(`Started: ${s.startTs}`);
|
|
152
|
+
lines.push(`Project: ${s.cwd}`);
|
|
153
|
+
lines.push(`Turns: ${s.turns} | prompts: ${s.userMsgs.length} | commands: ${s.cmds.length} | reasoning steps: ${s.reasoningCount}`);
|
|
154
|
+
const toolList = Object.entries(s.tools).sort((a, b) => b[1] - a[1]).map(([k, v]) => `${k}Ć${v}`).join(", ");
|
|
155
|
+
if (toolList) lines.push(`Tools: ${toolList}`);
|
|
156
|
+
|
|
157
|
+
if (s.userMsgs.length) {
|
|
158
|
+
lines.push(`\n## Prompts (${s.userMsgs.length})`);
|
|
159
|
+
s.userMsgs.slice(0, 20).forEach((m, i) => lines.push(`${i + 1}. ${clip(m, 220)}`));
|
|
160
|
+
if (s.userMsgs.length > 20) lines.push(`⦠+${s.userMsgs.length - 20} more`);
|
|
161
|
+
}
|
|
162
|
+
if (s.plan && s.plan.length) {
|
|
163
|
+
lines.push(`\n## Plan`);
|
|
164
|
+
s.plan.slice(0, 20).forEach((p) => lines.push(`- ${clip(p, 120)}`));
|
|
165
|
+
}
|
|
166
|
+
if (s.cmds.length) {
|
|
167
|
+
lines.push(`\n## Commands (${s.cmds.length}, sample)`);
|
|
168
|
+
const sample = s.cmds.slice(0, 25);
|
|
169
|
+
sample.forEach((c) => lines.push(`$ ${clip(c, 160)}`));
|
|
170
|
+
if (s.cmds.length > 25) lines.push(`⦠+${s.cmds.length - 25} more`);
|
|
171
|
+
}
|
|
172
|
+
if (s.files.length) {
|
|
173
|
+
lines.push(`\n## Files touched (${s.files.length})`);
|
|
174
|
+
s.files.slice(0, 40).forEach((f) => lines.push(`- ${f}`));
|
|
175
|
+
if (s.files.length > 40) lines.push(`⦠+${s.files.length - 40} more`);
|
|
176
|
+
}
|
|
177
|
+
if (s.lastAssistant) {
|
|
178
|
+
lines.push(`\n## Final assistant note`);
|
|
179
|
+
lines.push(clip(s.lastAssistant, 800));
|
|
180
|
+
}
|
|
181
|
+
return lines.join("\n");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function topicTags(s) {
|
|
185
|
+
// derive a few tags from frequent command tokens
|
|
186
|
+
const freq = {};
|
|
187
|
+
for (const c of s.cmds) { const t = firstCmdToken(c).split(/\s+/)[0]; if (t) freq[t] = (freq[t] || 0) + 1; }
|
|
188
|
+
return Object.entries(freq).sort((a, b) => b[1] - a[1]).slice(0, 4).map(([k]) => k);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function loadState() { try { return JSON.parse(fs.readFileSync(STATE_FILE, "utf8")); } catch { return { done: {} }; } }
|
|
192
|
+
function saveState(st) { fs.mkdirSync(path.dirname(STATE_FILE), { recursive: true }); fs.writeFileSync(STATE_FILE, JSON.stringify(st, null, 2)); }
|
|
193
|
+
|
|
194
|
+
// ---- wipe old backfill entries (kind/type session) ----
|
|
195
|
+
function wipeSessionEntries() {
|
|
196
|
+
let removedNotes = 0, removedJ = 0;
|
|
197
|
+
// vault
|
|
198
|
+
for (const idxFile of (function* () { for (const d of safeList(VAULT)) yield path.join(VAULT, d, "index.json"); })()) {
|
|
199
|
+
if (!fs.existsSync(idxFile)) continue;
|
|
200
|
+
let idx; try { idx = JSON.parse(fs.readFileSync(idxFile, "utf8")); } catch { continue; }
|
|
201
|
+
const pdir = path.dirname(idxFile);
|
|
202
|
+
for (const [id, n] of Object.entries(idx.notes || {})) {
|
|
203
|
+
if (n.kind === "session") {
|
|
204
|
+
try { fs.unlinkSync(path.join(pdir, n.file)); } catch { /* ignore */ }
|
|
205
|
+
delete idx.notes[id]; removedNotes++;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
fs.writeFileSync(idxFile, JSON.stringify(idx, null, 2));
|
|
209
|
+
}
|
|
210
|
+
// journal: rewrite jsonl/md without session-type entries
|
|
211
|
+
for (const d of safeList(JOURNAL)) {
|
|
212
|
+
const jdir = path.join(JOURNAL, d);
|
|
213
|
+
const jsonl = path.join(jdir, "journal.jsonl");
|
|
214
|
+
if (!fs.existsSync(jsonl)) continue;
|
|
215
|
+
const kept = [];
|
|
216
|
+
for (const line of fs.readFileSync(jsonl, "utf8").split("\n")) {
|
|
217
|
+
if (!line.trim()) continue;
|
|
218
|
+
let e; try { e = JSON.parse(line); } catch { continue; }
|
|
219
|
+
if (e.type === "session") { removedJ++; continue; }
|
|
220
|
+
kept.push(line);
|
|
221
|
+
}
|
|
222
|
+
fs.writeFileSync(jsonl, kept.length ? kept.join("\n") + "\n" : "");
|
|
223
|
+
// rebuild md mirror minimally
|
|
224
|
+
const md = path.join(jdir, "journal.md");
|
|
225
|
+
const mdLines = kept.map((l) => { const e = JSON.parse(l); return `\n## ${e.ts} ā ${e.type}${e.title ? `: ${e.title}` : ""}\n${e.body || ""}\n`; });
|
|
226
|
+
fs.writeFileSync(md, mdLines.join(""));
|
|
227
|
+
}
|
|
228
|
+
return { removedNotes, removedJ };
|
|
229
|
+
}
|
|
230
|
+
function safeList(dir) { try { return fs.readdirSync(dir).filter((n) => fs.statSync(path.join(dir, n)).isDirectory()); } catch { return []; } }
|
|
231
|
+
|
|
232
|
+
// ---- collect ----
|
|
233
|
+
const state = loadState();
|
|
234
|
+
const sessions = [];
|
|
235
|
+
for (const f of walk(SESS_ROOT)) {
|
|
236
|
+
let s; try { s = parseSession(f); } catch { continue; }
|
|
237
|
+
if (!s.cwd) continue;
|
|
238
|
+
if (s.userMsgs.length < MIN_PROMPTS) continue;
|
|
239
|
+
sessions.push(s);
|
|
240
|
+
}
|
|
241
|
+
sessions.sort((a, b) => String(a.startTs).localeCompare(String(b.startTs)));
|
|
242
|
+
|
|
243
|
+
if (WIPE && !DRY) {
|
|
244
|
+
const { removedNotes, removedJ } = wipeSessionEntries();
|
|
245
|
+
console.log(`Wiped ${removedNotes} session notes + ${removedJ} session journal entries.`);
|
|
246
|
+
state.done = {}; // re-import everything fresh
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const pending = sessions.filter((s) => !state.done[s.id]);
|
|
250
|
+
|
|
251
|
+
console.log(`Sessions >= ${MIN_PROMPTS} prompts: ${sessions.length}. Done: ${sessions.length - pending.length}. Pending: ${pending.length}.`);
|
|
252
|
+
|
|
253
|
+
if (DRY) {
|
|
254
|
+
const ex = pending.find((s) => s.cmds.length > 5) || pending[0];
|
|
255
|
+
if (ex) {
|
|
256
|
+
console.log(`\n--- Example deep extraction (${ex.id}) ---`);
|
|
257
|
+
console.log(`date: ${ex.startTs}`);
|
|
258
|
+
console.log(`cwd: ${ex.cwd}`);
|
|
259
|
+
console.log(`turns=${ex.turns} prompts=${ex.userMsgs.length} cmds=${ex.cmds.length} files=${ex.files.length}`);
|
|
260
|
+
console.log(`tags: session,backfill,${ex.startTs?.slice(0,10)},${topicTags(ex).join(",")}`);
|
|
261
|
+
console.log("\n" + buildBody(ex).slice(0, 1200));
|
|
262
|
+
}
|
|
263
|
+
process.exit(0);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const env = { MEMORY_VAULT_DIR: VAULT, JOURNAL_DIR: JOURNAL, NINEROUTER_KEY: "", EMBED_KEY: "", RERANK_ENABLED: "0" };
|
|
267
|
+
const mem = new McpClient(path.join(import.meta.dirname, "project-memory", "server.js"), env);
|
|
268
|
+
const jrnl = new McpClient(path.join(import.meta.dirname, "devjournal", "server.js"), env);
|
|
269
|
+
await mem.start(); await jrnl.start();
|
|
270
|
+
|
|
271
|
+
let ok = 0, errs = 0;
|
|
272
|
+
for (const s of pending) {
|
|
273
|
+
const date = (s.startTs || "").slice(0, 10);
|
|
274
|
+
const title = clip(s.userMsgs[0] || "(no prompt)", 90);
|
|
275
|
+
const body = buildBody(s);
|
|
276
|
+
const tags = ["session", "backfill", date, ...topicTags(s)];
|
|
277
|
+
try {
|
|
278
|
+
await mem.callTool("memory_save", { dir: s.cwd, title: `[session ${date}] ${title}`, content: body, tags, kind: "session", created: s.startTs }, 60000);
|
|
279
|
+
await jrnl.callTool("journal_log", { dir: s.cwd, title: `Session ${date}: ${title}`, type: "session", ts: s.startTs,
|
|
280
|
+
body: `turns=${s.turns} cmds=${s.cmds.length} files=${s.files.length} | ${clip(s.userMsgs.join(" | "), 300)}` }, 60000);
|
|
281
|
+
state.done[s.id] = { cwd: s.cwd, ts: s.startTs };
|
|
282
|
+
ok++;
|
|
283
|
+
if (ok % 20 === 0) { saveState(state); console.log(` ...${ok} written`); }
|
|
284
|
+
} catch (e) { errs++; console.log(` ! ${s.id}: ${e.message}`); }
|
|
285
|
+
}
|
|
286
|
+
saveState(state);
|
|
287
|
+
await mem.stop(); await jrnl.stop();
|
|
288
|
+
console.log(`\nDone. Wrote ${ok}, errors ${errs}. State: ${STATE_FILE}`);
|
package/bin/_meta.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { checkForUpdates } from "../lib/update-check.js";
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
function pkgVersion() {
|
|
9
|
+
try {
|
|
10
|
+
const raw = fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8");
|
|
11
|
+
return JSON.parse(raw).version || "unknown";
|
|
12
|
+
} catch { return "unknown"; }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function redactKey(name) {
|
|
16
|
+
const v = String(process.env[name] || "");
|
|
17
|
+
return v ? `set (${v.length} chars)` : "not set";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function doctorLines(meta) {
|
|
21
|
+
const lines = [];
|
|
22
|
+
lines.push(`${meta.title} doctor`);
|
|
23
|
+
lines.push(`version: ${pkgVersion()}`);
|
|
24
|
+
lines.push(`node: ${process.version}`);
|
|
25
|
+
for (const [label, name] of meta.storage || []) {
|
|
26
|
+
lines.push(`${label}: ${process.env[name] || meta.storageDefaults?.[name] || "(default)"}`);
|
|
27
|
+
}
|
|
28
|
+
const det = /^(1|true|yes|on)$/i.test(String(process.env.MCP_DETERMINISTIC_FALLBACK || "").trim());
|
|
29
|
+
lines.push(`deterministic no-network: ${det ? "on" : "off"}`);
|
|
30
|
+
if (meta.usesModel) {
|
|
31
|
+
lines.push("model/provider config (keys redacted):");
|
|
32
|
+
lines.push(` MCP_LLM_BASE_URL: ${process.env.MCP_LLM_BASE_URL || "(unset)"}`);
|
|
33
|
+
lines.push(` MCP_LLM_API_KEY: ${redactKey("MCP_LLM_API_KEY")}`);
|
|
34
|
+
lines.push(` MCP_PROVIDER_PRIMARY: ${process.env.MCP_PROVIDER_PRIMARY || "(unset)"}`);
|
|
35
|
+
lines.push(` MCP_PROVIDER_PRIMARY_API_KEY: ${redactKey("MCP_PROVIDER_PRIMARY_API_KEY")}`);
|
|
36
|
+
lines.push(` MCP_EMBED_API_KEY: ${redactKey("MCP_EMBED_API_KEY")}`);
|
|
37
|
+
lines.push(` MCP_RERANK_API_KEY: ${redactKey("MCP_RERANK_API_KEY")}`);
|
|
38
|
+
} else {
|
|
39
|
+
lines.push("model/provider config: not used by this server");
|
|
40
|
+
}
|
|
41
|
+
return lines;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function handleCliMeta(meta) {
|
|
45
|
+
// Non-blocking update check on startup (cached 24h, logged to stderr)
|
|
46
|
+
checkForUpdates().catch(() => {});
|
|
47
|
+
|
|
48
|
+
const argv = process.argv.slice(2);
|
|
49
|
+
if (argv.includes("-v") || argv.includes("--version")) {
|
|
50
|
+
process.stdout.write(`${pkgVersion()}\n`);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
if (argv.includes("-h") || argv.includes("--help")) {
|
|
54
|
+
const out = [
|
|
55
|
+
`${meta.title} (${meta.bin}) v${pkgVersion()}`,
|
|
56
|
+
"",
|
|
57
|
+
"An MCP server that speaks JSON-RPC over stdio. Launch it from an MCP client.",
|
|
58
|
+
"",
|
|
59
|
+
"Usage:",
|
|
60
|
+
` ${meta.bin} start the MCP stdio server`,
|
|
61
|
+
` ${meta.bin} --version print version`,
|
|
62
|
+
` ${meta.bin} --doctor print config diagnostics (API keys redacted)`,
|
|
63
|
+
` ${meta.bin} --help show this help`,
|
|
64
|
+
];
|
|
65
|
+
process.stdout.write(out.join("\n") + "\n");
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
if (argv.includes("--doctor")) {
|
|
69
|
+
process.stdout.write(doctorLines(meta).join("\n") + "\n");
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { handleCliMeta } from "./_meta.mjs";
|
|
3
|
+
handleCliMeta({
|
|
4
|
+
bin: "armada-mcp",
|
|
5
|
+
title: "Armada Fleet MCP",
|
|
6
|
+
usesModel: false,
|
|
7
|
+
storage: [
|
|
8
|
+
["bus url", "ARMADA_BUS_URL"],
|
|
9
|
+
["bus token", "ARMADA_BUS_TOKEN"],
|
|
10
|
+
],
|
|
11
|
+
});
|
|
12
|
+
import("../armada/server.js");
|
package/bin/init.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runInitWizard } from "../lib/init-wizard.js";
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
console.log("š ļø Dev MCP Suite ā Auto-Config Installer Wizard");
|
|
6
|
+
console.log("==================================================");
|
|
7
|
+
|
|
8
|
+
const dryRun = process.argv.includes("--dry-run");
|
|
9
|
+
const { detectedCount, results } = await runInitWizard({ dryRun });
|
|
10
|
+
|
|
11
|
+
if (!detectedCount) {
|
|
12
|
+
console.log("ā¹ļø No supported AI client directories detected (~/.codex, ~/.claude, ~/.cursor, etc.).");
|
|
13
|
+
console.log("See README.md for manual configuration instructions.");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
for (const r of results) {
|
|
18
|
+
console.log(`ā
[${r.status}] Configured ${r.name} -> ${r.path}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.log("\nš All detected AI tools have been successfully configured with @maximalabs/dev-mcp-suite!");
|
|
22
|
+
console.log("Restart your AI coding client to start using the 4 MCP servers.");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { handleCliMeta } from "./_meta.mjs";
|
|
3
|
+
handleCliMeta({
|
|
4
|
+
bin: "project-memory-mcp",
|
|
5
|
+
title: "Project Memory MCP",
|
|
6
|
+
usesModel: true,
|
|
7
|
+
storage: [["vault", "MEMORY_VAULT_DIR"]],
|
|
8
|
+
});
|
|
9
|
+
const { ProjectMemoryServer } = await import("../project-memory/server.js");
|
|
10
|
+
new ProjectMemoryServer().run().catch(console.error);
|