@xqli02/mneme 0.1.3 → 0.1.5
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/package.json +1 -1
- package/src/commands/init.mjs +34 -8
- /package/src/templates/{AGENTS.md → en/AGENTS.md} +0 -0
- /package/src/templates/{facts-architecture.md → en/facts-architecture.md} +0 -0
- /package/src/templates/{facts-invariants.md → en/facts-invariants.md} +0 -0
- /package/src/templates/{facts-performance_rules.md → en/facts-performance_rules.md} +0 -0
- /package/src/templates/{facts-pitfalls.md → en/facts-pitfalls.md} +0 -0
- /package/src/templates/{opencode-prompt.md → en/opencode-prompt.md} +0 -0
package/package.json
CHANGED
package/src/commands/init.mjs
CHANGED
|
@@ -62,7 +62,7 @@ function scaffoldFiles(locale = "en") {
|
|
|
62
62
|
mkdirSync(dir, { recursive: true });
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const templatePath = LOCALIZABLE.has(templateName)
|
|
65
|
+
const templatePath = LOCALIZABLE.has(templateName)
|
|
66
66
|
? join(TEMPLATES_DIR, locale, templateName)
|
|
67
67
|
: join(TEMPLATES_DIR, templateName);
|
|
68
68
|
const content = readFileSync(templatePath, "utf-8");
|
|
@@ -251,11 +251,37 @@ function ensureDoltServer() {
|
|
|
251
251
|
mkdirSync(DOLT_DATA_DIR, { recursive: true });
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
// Check if
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
254
|
+
// Check if port is already in use (bash /dev/tcp returns 0 if open, 1 if refused)
|
|
255
|
+
const portInUse = run(`bash -c 'echo > /dev/tcp/127.0.0.1/${DOLT_PORT}' 2>&1`) !== null;
|
|
256
|
+
|
|
257
|
+
if (portInUse) {
|
|
258
|
+
// Port is occupied — check if it's our dolt server with the right data-dir
|
|
259
|
+
const psOutput = run(`ps aux 2>/dev/null`) ?? "";
|
|
260
|
+
const doltLines = psOutput.split("\n").filter((line) =>
|
|
261
|
+
line.includes("dolt") && line.includes("sql-server") && line.includes(`${DOLT_PORT}`)
|
|
262
|
+
&& !line.includes("grep")
|
|
263
|
+
);
|
|
264
|
+
// Prefer the actual dolt binary process over a bash wrapper
|
|
265
|
+
const doltProc = doltLines.find((l) => !l.includes("bash -c") && /\bdolt\s+sql-server\b/.test(l)) || doltLines[0];
|
|
266
|
+
|
|
267
|
+
if (doltProc && doltProc.includes(DOLT_DATA_DIR)) {
|
|
268
|
+
// Same data-dir, already running — nothing to do
|
|
269
|
+
log.ok(`dolt server already running ${color.dim(`(port ${DOLT_PORT}, data-dir ${DOLT_DATA_DIR})`)}`);
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (doltProc) {
|
|
274
|
+
// Dolt running but with a different data-dir — kill and restart
|
|
275
|
+
log.warn(`dolt server on port ${DOLT_PORT} uses a different data-dir, restarting...`);
|
|
276
|
+
// Extract PID from ps aux output (second column)
|
|
277
|
+
const pid = doltProc.trim().split(/\s+/)[1];
|
|
278
|
+
if (pid) run(`kill ${pid} 2>/dev/null`);
|
|
279
|
+
run("sleep 1");
|
|
280
|
+
} else {
|
|
281
|
+
// Port occupied by something else entirely
|
|
282
|
+
log.fail(`Port ${DOLT_PORT} is in use by a non-dolt process. Set MNEME_DOLT_PORT to use a different port.`);
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
259
285
|
}
|
|
260
286
|
|
|
261
287
|
log.info(`Starting dolt server (port ${DOLT_PORT}, data-dir ${DOLT_DATA_DIR})...`);
|
|
@@ -269,8 +295,8 @@ function ensureDoltServer() {
|
|
|
269
295
|
// Wait for server to be ready (up to 10s)
|
|
270
296
|
for (let i = 0; i < 10; i++) {
|
|
271
297
|
run("sleep 1");
|
|
272
|
-
const
|
|
273
|
-
if (
|
|
298
|
+
const alive = run(`bash -c 'echo > /dev/tcp/127.0.0.1/${DOLT_PORT}' 2>&1`) !== null;
|
|
299
|
+
if (alive) {
|
|
274
300
|
log.ok(`dolt server started ${color.dim(`(port ${DOLT_PORT})`)}`);
|
|
275
301
|
return true;
|
|
276
302
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|