engramx 2.0.2 → 3.0.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/CHANGELOG.md +271 -0
- package/README.md +161 -17
- package/dist/{aider-context-BC5R2ZTA.js → aider-context-6IDE3R7U.js} +1 -1
- package/dist/check-2Z3MPZEJ.js +12 -0
- package/dist/{chunk-PEH54LYC.js → chunk-645NBY6L.js} +42 -5
- package/dist/chunk-73IBCRFI.js +215 -0
- package/dist/{chunk-SJT7VS2G.js → chunk-B4UOE64J.js} +46 -11
- package/dist/chunk-FKY6HIT2.js +99 -0
- package/dist/{chunk-533LR4I7.js → chunk-G4U3QOOW.js} +13 -97
- package/dist/chunk-RJC6RNXJ.js +1405 -0
- package/dist/chunk-RM2TBOVW.js +121 -0
- package/dist/chunk-SMU4WR3D.js +187 -0
- package/dist/{chunk-C6GBUOAL.js → chunk-VLTWBTQ7.js} +14 -15
- package/dist/chunk-XVYE4OX2.js +232 -0
- package/dist/chunk-ZUC6OXSL.js +178 -0
- package/dist/cli.js +818 -1533
- package/dist/{core-6IY5L6II.js → core-77F2BVYV.js} +2 -2
- package/dist/{cursor-mdc-GJ7E5LDD.js → cursor-mdc-EEO7PYZ3.js} +1 -1
- package/dist/{exporter-GWU2GF23.js → exporter-ZYJ4WM2F.js} +1 -1
- package/dist/{importer-V62NGZRK.js → importer-4UWQDH4W.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/install-YVMVCFQW.js +121 -0
- package/dist/mcp-client-ROOJF76V.js +9 -0
- package/dist/mcp-config-QD4NPVXB.js +12 -0
- package/dist/{migrate-UKCO6BUU.js → migrate-KJ5K5NWO.js} +1 -1
- package/dist/notify-5POGKMRX.js +36 -0
- package/dist/{plugin-loader-STTGYIL5.js → plugin-loader-SQQB6V74.js} +69 -23
- package/dist/report-C3GTM3HY.js +12 -0
- package/dist/resolver-H7GXVP73.js +21 -0
- package/dist/serve.js +5 -4
- package/dist/{server-KUG7U6SG.js → server-2ZQKXJ5M.js} +74 -4
- package/dist/{windsurf-rules-C7SVDHBL.js → windsurf-rules-XF7MYF6J.js} +1 -1
- package/dist/wizard-UH27IO4I.js +274 -0
- package/package.json +3 -2
- package/dist/{tuner-KFNNGKG3.js → tuner-Y2YENAZC.js} +3 -3
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildReport,
|
|
3
|
+
formatReport
|
|
4
|
+
} from "./chunk-XVYE4OX2.js";
|
|
5
|
+
import "./chunk-RM2TBOVW.js";
|
|
6
|
+
import {
|
|
7
|
+
installEngramHooks
|
|
8
|
+
} from "./chunk-SMU4WR3D.js";
|
|
9
|
+
import "./chunk-G4U3QOOW.js";
|
|
10
|
+
import {
|
|
11
|
+
init
|
|
12
|
+
} from "./chunk-B4UOE64J.js";
|
|
13
|
+
import "./chunk-645NBY6L.js";
|
|
14
|
+
|
|
15
|
+
// src/setup/wizard.ts
|
|
16
|
+
import chalk from "chalk";
|
|
17
|
+
import readline from "readline/promises";
|
|
18
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync, mkdirSync } from "fs";
|
|
19
|
+
import { dirname, join as join2, resolve as pathResolve } from "path";
|
|
20
|
+
import { homedir as homedir2 } from "os";
|
|
21
|
+
|
|
22
|
+
// src/setup/detect.ts
|
|
23
|
+
import { existsSync, readFileSync } from "fs";
|
|
24
|
+
import { join } from "path";
|
|
25
|
+
import { homedir } from "os";
|
|
26
|
+
function detectClaudeCode(projectRoot) {
|
|
27
|
+
const settingsCandidates = [
|
|
28
|
+
join(projectRoot, ".claude", "settings.local.json"),
|
|
29
|
+
join(projectRoot, ".claude", "settings.json"),
|
|
30
|
+
join(homedir(), ".claude", "settings.json")
|
|
31
|
+
];
|
|
32
|
+
const settingsPresent = settingsCandidates.some(existsSync);
|
|
33
|
+
const claudeCliPresent = existsSync(join(homedir(), ".claude")) || existsSync("/usr/local/bin/claude") || existsSync(join(homedir(), ".local/bin/claude"));
|
|
34
|
+
const installed = settingsPresent || claudeCliPresent;
|
|
35
|
+
let configured = false;
|
|
36
|
+
try {
|
|
37
|
+
configured = settingsCandidates.filter(existsSync).some((p) => readFileSync(p, "utf-8").includes("engram intercept"));
|
|
38
|
+
} catch {
|
|
39
|
+
configured = false;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
name: "Claude Code",
|
|
43
|
+
installed,
|
|
44
|
+
configured,
|
|
45
|
+
status: !installed ? "not detected" : configured ? "Sentinel hook installed" : "detected \u2014 hook not yet installed"
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function detectCursor(projectRoot) {
|
|
49
|
+
const cursorConfigs = [
|
|
50
|
+
join(homedir(), "Library/Application Support/Cursor"),
|
|
51
|
+
join(homedir(), ".config/Cursor"),
|
|
52
|
+
join(homedir(), "AppData/Roaming/Cursor")
|
|
53
|
+
];
|
|
54
|
+
const installed = cursorConfigs.some(existsSync);
|
|
55
|
+
const configured = existsSync(
|
|
56
|
+
join(projectRoot, ".cursor", "rules", "engram-context.mdc")
|
|
57
|
+
);
|
|
58
|
+
return {
|
|
59
|
+
name: "Cursor",
|
|
60
|
+
installed,
|
|
61
|
+
configured,
|
|
62
|
+
status: !installed ? "not detected" : configured ? "MDC adapter present" : "detected \u2014 run `engram gen-mdc`"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function detectWindsurf(projectRoot) {
|
|
66
|
+
const configured = existsSync(join(projectRoot, ".windsurfrules"));
|
|
67
|
+
return {
|
|
68
|
+
name: "Windsurf",
|
|
69
|
+
installed: configured,
|
|
70
|
+
configured,
|
|
71
|
+
status: configured ? ".windsurfrules present" : "run `engram gen-windsurfrules` to add"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function detectContinue() {
|
|
75
|
+
const path = join(homedir(), ".continue", "config.json");
|
|
76
|
+
const installed = existsSync(path);
|
|
77
|
+
let configured = false;
|
|
78
|
+
if (installed) {
|
|
79
|
+
try {
|
|
80
|
+
configured = readFileSync(path, "utf-8").includes("engram");
|
|
81
|
+
} catch {
|
|
82
|
+
configured = false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
name: "Continue.dev",
|
|
87
|
+
installed,
|
|
88
|
+
configured,
|
|
89
|
+
status: !installed ? "not detected" : configured ? "engram configured" : "detected \u2014 add engram MCP server to config"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function detectAider(projectRoot) {
|
|
93
|
+
const configured = existsSync(join(projectRoot, ".aider-context.md"));
|
|
94
|
+
const installed = configured || existsSync(join(homedir(), ".aider"));
|
|
95
|
+
return {
|
|
96
|
+
name: "Aider",
|
|
97
|
+
installed,
|
|
98
|
+
configured,
|
|
99
|
+
status: !installed ? "not detected" : configured ? ".aider-context.md present" : "detected \u2014 run `engram gen-aider`"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function detectAllIdes(projectRoot) {
|
|
103
|
+
return [
|
|
104
|
+
detectClaudeCode(projectRoot),
|
|
105
|
+
detectCursor(projectRoot),
|
|
106
|
+
detectWindsurf(projectRoot),
|
|
107
|
+
detectContinue(),
|
|
108
|
+
detectAider(projectRoot)
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/setup/wizard.ts
|
|
113
|
+
async function ask(rl, question, fallback) {
|
|
114
|
+
const prompt = `${question} ${fallback ? "[Y/n]" : "[y/N]"} `;
|
|
115
|
+
const answer = (await rl.question(prompt)).trim().toLowerCase();
|
|
116
|
+
if (answer === "") return fallback;
|
|
117
|
+
return answer === "y" || answer === "yes";
|
|
118
|
+
}
|
|
119
|
+
function banner(line) {
|
|
120
|
+
console.log(chalk.bold(line));
|
|
121
|
+
}
|
|
122
|
+
function step(n, title) {
|
|
123
|
+
console.log("");
|
|
124
|
+
console.log(chalk.cyan(`\u2500\u2500 step ${n} \xB7 `) + chalk.bold(title));
|
|
125
|
+
}
|
|
126
|
+
function done(msg) {
|
|
127
|
+
console.log(chalk.green(" \u2713 ") + msg);
|
|
128
|
+
}
|
|
129
|
+
function skip(msg) {
|
|
130
|
+
console.log(chalk.dim(" \xB7 ") + chalk.dim(msg));
|
|
131
|
+
}
|
|
132
|
+
function warn(msg) {
|
|
133
|
+
console.log(chalk.yellow(" \u26A0 ") + msg);
|
|
134
|
+
}
|
|
135
|
+
async function ensureGraphInit(opts, rl) {
|
|
136
|
+
const root = pathResolve(opts.projectPath);
|
|
137
|
+
const dbPath = join2(root, ".engram", "graph.db");
|
|
138
|
+
if (existsSync2(dbPath)) {
|
|
139
|
+
skip("graph.db already exists at .engram/graph.db \u2014 skipping init");
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (opts.dryRun) {
|
|
143
|
+
skip("[dry-run] would run `engram init`");
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const go = opts.yes || rl === null || await ask(rl, "Index this repository now?", true);
|
|
147
|
+
if (!go) {
|
|
148
|
+
skip("skipped by user");
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
console.log(chalk.dim(" \u2192 running engram init..."));
|
|
152
|
+
const result = await init(root);
|
|
153
|
+
done(
|
|
154
|
+
`${result.nodes} nodes, ${result.edges} edges from ${result.fileCount} files (${result.timeMs}ms)`
|
|
155
|
+
);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
async function ensureHookInstalled(opts, rl) {
|
|
159
|
+
const root = pathResolve(opts.projectPath);
|
|
160
|
+
const scope = opts.settingsScope ?? "local";
|
|
161
|
+
const settingsPath = scope === "user" ? join2(homedir2(), ".claude", "settings.json") : scope === "project" ? join2(root, ".claude", "settings.json") : join2(root, ".claude", "settings.local.json");
|
|
162
|
+
const existing = existsSync2(settingsPath) ? readFileSync2(settingsPath, "utf-8") : "";
|
|
163
|
+
if (existing.includes("engram intercept")) {
|
|
164
|
+
skip(`Sentinel hook already in ${scope}-scope settings`);
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
if (opts.dryRun) {
|
|
168
|
+
skip(`[dry-run] would install Sentinel hook (${scope} scope)`);
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
const go = opts.yes || rl === null || await ask(rl, `Install Sentinel hook in ${scope} scope?`, true);
|
|
172
|
+
if (!go) {
|
|
173
|
+
skip("skipped by user");
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
let settings = {};
|
|
177
|
+
if (existing) {
|
|
178
|
+
try {
|
|
179
|
+
settings = JSON.parse(existing);
|
|
180
|
+
} catch {
|
|
181
|
+
warn(`settings file at ${settingsPath} is not valid JSON \u2014 aborting`);
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const result = installEngramHooks(settings);
|
|
186
|
+
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
187
|
+
writeFileSync(settingsPath, JSON.stringify(result.updated, null, 2) + "\n", "utf-8");
|
|
188
|
+
done(`Sentinel hook installed (${scope} scope)`);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
async function offerIdeAdapters(opts, rl) {
|
|
192
|
+
const root = pathResolve(opts.projectPath);
|
|
193
|
+
const detected = detectAllIdes(root);
|
|
194
|
+
const installedIdes = detected.filter((d) => d.installed);
|
|
195
|
+
if (installedIdes.length === 0) {
|
|
196
|
+
skip("no IDEs detected beyond Claude Code");
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
console.log(chalk.dim(" Detected:"));
|
|
200
|
+
for (const d of installedIdes) {
|
|
201
|
+
console.log(
|
|
202
|
+
chalk.dim(` \xB7 ${d.name.padEnd(14)} \u2014 ${d.status}`)
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
if (opts.dryRun) {
|
|
206
|
+
skip("[dry-run] adapters left alone");
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
const unconfigured = installedIdes.filter((d) => !d.configured);
|
|
210
|
+
if (unconfigured.length === 0) {
|
|
211
|
+
done("all detected IDEs already have engram adapters");
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
214
|
+
const suggest = {
|
|
215
|
+
Cursor: "engram gen-mdc",
|
|
216
|
+
Windsurf: "engram gen-windsurfrules",
|
|
217
|
+
Aider: "engram gen-aider"
|
|
218
|
+
};
|
|
219
|
+
const suggested = [];
|
|
220
|
+
for (const ide of unconfigured) {
|
|
221
|
+
const cmd = suggest[ide.name];
|
|
222
|
+
if (cmd) suggested.push({ name: ide.name, cmd });
|
|
223
|
+
}
|
|
224
|
+
if (suggested.length === 0) {
|
|
225
|
+
const claudeCode = unconfigured.find((d) => d.name === "Claude Code");
|
|
226
|
+
if (claudeCode) {
|
|
227
|
+
skip("Claude Code hook declined or missing \u2014 re-run `engram install-hook`");
|
|
228
|
+
} else {
|
|
229
|
+
done("no additional adapters needed");
|
|
230
|
+
}
|
|
231
|
+
return [];
|
|
232
|
+
}
|
|
233
|
+
console.log("");
|
|
234
|
+
console.log(chalk.dim(" Next steps for detected IDEs:"));
|
|
235
|
+
const run = [];
|
|
236
|
+
for (const s of suggested) {
|
|
237
|
+
console.log(chalk.white(` $ ${s.cmd}`));
|
|
238
|
+
run.push(s.name);
|
|
239
|
+
}
|
|
240
|
+
return run;
|
|
241
|
+
}
|
|
242
|
+
async function runSetup(opts) {
|
|
243
|
+
const root = pathResolve(opts.projectPath);
|
|
244
|
+
banner(`
|
|
245
|
+
\u26A1 engram setup \u2014 ${root}`);
|
|
246
|
+
console.log(
|
|
247
|
+
chalk.dim(
|
|
248
|
+
` Running ${opts.yes ? "non-interactively" : "interactively"}${opts.dryRun ? " (dry-run)" : ""}
|
|
249
|
+
`
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
const rl = opts.yes || opts.dryRun ? null : readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
253
|
+
let initRan = false;
|
|
254
|
+
let hookInstalled = false;
|
|
255
|
+
let ideAdapters = [];
|
|
256
|
+
try {
|
|
257
|
+
step(1, "graph");
|
|
258
|
+
initRan = await ensureGraphInit(opts, rl);
|
|
259
|
+
step(2, "hook");
|
|
260
|
+
hookInstalled = await ensureHookInstalled(opts, rl);
|
|
261
|
+
step(3, "adapters");
|
|
262
|
+
ideAdapters = await offerIdeAdapters(opts, rl);
|
|
263
|
+
step(4, "verify");
|
|
264
|
+
const report = buildReport(root, opts.engramVersion);
|
|
265
|
+
console.log(formatReport(report, false));
|
|
266
|
+
const exitCode = report.overallSeverity === "ok" ? 0 : report.overallSeverity === "warn" ? 1 : 2;
|
|
267
|
+
return { initRan, hookInstalled, ideAdaptersRun: ideAdapters, exitCode };
|
|
268
|
+
} finally {
|
|
269
|
+
rl?.close();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
runSetup
|
|
274
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "engramx",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "The context spine for AI coding agents.
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "The context spine for AI coding agents. 9 built-in providers + mcpConfig plugin contract (wrap any MCP server in 10 lines), generic MCP-client aggregator (stdio), pre-mortem mistake-guard, bi-temporal mistake memory, Anthropic Auto-Memory bridge, SSE streaming context packets, dual-emit AGENTS.md+CLAUDE.md. 90.8% measured real-world token savings (reproducible bench included). Local SQLite, zero cloud.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/NickCirv/engram.git"
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"CHANGELOG.md"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
59
60
|
"chalk": "^5.6.2",
|
|
60
61
|
"commander": "^14.0.3",
|
|
61
62
|
"sql.js": "^1.14.1",
|