@memoraone/mcp 0.1.20 → 0.1.21
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/cli.cjs +48 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var require_package = __commonJS({
|
|
|
30
30
|
"package.json"(exports2, module2) {
|
|
31
31
|
module2.exports = {
|
|
32
32
|
name: "@memoraone/mcp",
|
|
33
|
-
version: "0.1.
|
|
33
|
+
version: "0.1.21",
|
|
34
34
|
type: "module",
|
|
35
35
|
main: "dist/index.cjs",
|
|
36
36
|
bin: {
|
|
@@ -223,6 +223,8 @@ function encodeResolvedBinding(binding) {
|
|
|
223
223
|
var fs3 = __toESM(require("fs/promises"), 1);
|
|
224
224
|
var path3 = __toESM(require("path"), 1);
|
|
225
225
|
var MANAGED_MARKER = "<!-- MemoraOne managed IDE helper -->";
|
|
226
|
+
var GITIGNORE_MEMORAONE_COMMENT = "# MemoraOne local project binding / API key";
|
|
227
|
+
var GITIGNORE_MEMORAONE_ENTRY = "memoraone.m1";
|
|
226
228
|
var MEMORAONE_MCP_SERVER = {
|
|
227
229
|
command: "npx",
|
|
228
230
|
args: ["-y", "@memoraone/mcp"]
|
|
@@ -242,6 +244,40 @@ async function pathExists(filePath) {
|
|
|
242
244
|
return false;
|
|
243
245
|
}
|
|
244
246
|
}
|
|
247
|
+
function gitignoreAlreadyIgnoresMemoraoneM1(content) {
|
|
248
|
+
for (const line of content.split(/\r?\n/)) {
|
|
249
|
+
const trimmed = line.trim();
|
|
250
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
251
|
+
if (/^\/?memoraone\.m1\s*$/.test(trimmed)) return true;
|
|
252
|
+
}
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
function memoraoneGitignoreBlock() {
|
|
256
|
+
return `${GITIGNORE_MEMORAONE_COMMENT}
|
|
257
|
+
${GITIGNORE_MEMORAONE_ENTRY}
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
async function ensureGitignoreMemoraone(repoRoot, opts) {
|
|
261
|
+
if (opts.noGitignore) return "skipped";
|
|
262
|
+
const abs = path3.join(repoRoot, ".gitignore");
|
|
263
|
+
assertUnderRepoRoot(repoRoot, abs);
|
|
264
|
+
let prior = "";
|
|
265
|
+
let existed = false;
|
|
266
|
+
try {
|
|
267
|
+
prior = await fs3.readFile(abs, "utf8");
|
|
268
|
+
existed = true;
|
|
269
|
+
} catch (err) {
|
|
270
|
+
const code = err && typeof err === "object" && "code" in err ? err.code : void 0;
|
|
271
|
+
if (code !== "ENOENT") throw err;
|
|
272
|
+
}
|
|
273
|
+
if (gitignoreAlreadyIgnoresMemoraoneM1(prior)) return "skipped";
|
|
274
|
+
const block = memoraoneGitignoreBlock();
|
|
275
|
+
const separator = existed && prior.length > 0 ? prior.endsWith("\n") ? "\n" : "\n\n" : "";
|
|
276
|
+
const next = (existed ? prior : "") + separator + block;
|
|
277
|
+
if (opts.dryRun) return existed ? "updated" : "created";
|
|
278
|
+
await fs3.writeFile(abs, next, "utf8");
|
|
279
|
+
return existed ? "updated" : "created";
|
|
280
|
+
}
|
|
245
281
|
async function findRepoRoot(startDir) {
|
|
246
282
|
let current = path3.resolve(startDir);
|
|
247
283
|
const root = path3.parse(current).root;
|
|
@@ -372,6 +408,7 @@ function parseSetupIdeFlags(argv) {
|
|
|
372
408
|
let all = false;
|
|
373
409
|
let force = false;
|
|
374
410
|
let dryRun = false;
|
|
411
|
+
let noGitignore = false;
|
|
375
412
|
const unknown = [];
|
|
376
413
|
for (const a of argv) {
|
|
377
414
|
if (a === "--cursor") cursor = true;
|
|
@@ -380,6 +417,7 @@ function parseSetupIdeFlags(argv) {
|
|
|
380
417
|
else if (a === "--all") all = true;
|
|
381
418
|
else if (a === "--force") force = true;
|
|
382
419
|
else if (a === "--dry-run") dryRun = true;
|
|
420
|
+
else if (a === "--no-gitignore") noGitignore = true;
|
|
383
421
|
else if (a.startsWith("-")) unknown.push(a);
|
|
384
422
|
}
|
|
385
423
|
const specific = cursor || vscode || jetbrains;
|
|
@@ -389,7 +427,7 @@ function parseSetupIdeFlags(argv) {
|
|
|
389
427
|
} else {
|
|
390
428
|
targets = { cursor, vscode, jetbrains };
|
|
391
429
|
}
|
|
392
|
-
return { targets, force, dryRun, unknown };
|
|
430
|
+
return { targets, force, dryRun, noGitignore, unknown };
|
|
393
431
|
}
|
|
394
432
|
function summarizeOutcomes(outcomes) {
|
|
395
433
|
const created = [];
|
|
@@ -422,6 +460,10 @@ async function runSetupIdeFiles(o) {
|
|
|
422
460
|
error: "[setup-ide-files] No repo root found (looked for .git or memoraone.m1)."
|
|
423
461
|
};
|
|
424
462
|
}
|
|
463
|
+
outcomes[".gitignore"] = await ensureGitignoreMemoraone(repoRoot, {
|
|
464
|
+
dryRun: o.dryRun,
|
|
465
|
+
noGitignore: o.noGitignore ?? false
|
|
466
|
+
});
|
|
425
467
|
const cursorContent = `---
|
|
426
468
|
description: MemoraOne MCP \u2014 IDE agent instructions
|
|
427
469
|
---
|
|
@@ -458,7 +500,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
458
500
|
return { exitCode: 0, repoRoot, outcomes };
|
|
459
501
|
}
|
|
460
502
|
async function cliSetupIdeFiles(argv) {
|
|
461
|
-
const { targets, force, dryRun, unknown } = parseSetupIdeFlags(argv);
|
|
503
|
+
const { targets, force, dryRun, noGitignore, unknown } = parseSetupIdeFlags(argv);
|
|
462
504
|
if (unknown.length) {
|
|
463
505
|
console.error(`[setup-ide-files] Unknown option(s): ${unknown.join(", ")}`);
|
|
464
506
|
return 1;
|
|
@@ -467,7 +509,8 @@ async function cliSetupIdeFiles(argv) {
|
|
|
467
509
|
cwd: process.cwd(),
|
|
468
510
|
targets,
|
|
469
511
|
force,
|
|
470
|
-
dryRun
|
|
512
|
+
dryRun,
|
|
513
|
+
noGitignore
|
|
471
514
|
});
|
|
472
515
|
if (result.error) {
|
|
473
516
|
console.error(result.error);
|
|
@@ -492,7 +535,7 @@ if (args.includes("--version") || args.includes("-v")) {
|
|
|
492
535
|
}
|
|
493
536
|
if (args.includes("--help") || args.includes("-h")) {
|
|
494
537
|
console.log(
|
|
495
|
-
"Usage: memoraone-mcp [--version] [--help] [--daemon --project-id <uuid>]\n memoraone-mcp setup-ide-files [--all|--cursor|--vscode|--jetbrains] [--force] [--dry-run]"
|
|
538
|
+
"Usage: memoraone-mcp [--version] [--help] [--daemon --project-id <uuid>]\n memoraone-mcp setup-ide-files [--all|--cursor|--vscode|--jetbrains] [--force] [--dry-run] [--no-gitignore]"
|
|
496
539
|
);
|
|
497
540
|
process.exit(0);
|
|
498
541
|
}
|