unforgit 0.9.3 → 0.10.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/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
saveConfig,
|
|
36
36
|
shouldImportMarkdownMemory,
|
|
37
37
|
validateMemoryType
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-YDVVU3Z7.js";
|
|
39
39
|
|
|
40
40
|
// src/index.ts
|
|
41
41
|
import { Command as Command32 } from "commander";
|
|
@@ -141,7 +141,12 @@ var ALL_IDE_NAMES = [
|
|
|
141
141
|
"cursor",
|
|
142
142
|
"claude",
|
|
143
143
|
"vscode",
|
|
144
|
-
"windsurf"
|
|
144
|
+
"windsurf",
|
|
145
|
+
"cline",
|
|
146
|
+
"roo",
|
|
147
|
+
"codex",
|
|
148
|
+
"opencode",
|
|
149
|
+
"kilo"
|
|
145
150
|
];
|
|
146
151
|
var UNFORGIT_MARKER = "Unforgit Memory Integration";
|
|
147
152
|
var MEMORY_INSTRUCTIONS = `# Unforgit Memory Integration
|
|
@@ -242,6 +247,22 @@ function replaceMarkdownIfMissingMarker(filePath, content) {
|
|
|
242
247
|
fs.closeSync(fd);
|
|
243
248
|
}
|
|
244
249
|
}
|
|
250
|
+
function appendOrCreateTomlSection(filePath, sectionHeader, content) {
|
|
251
|
+
const dir = path.dirname(filePath);
|
|
252
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
253
|
+
const fd = fs.openSync(filePath, "a+");
|
|
254
|
+
try {
|
|
255
|
+
const existing = fs.readFileSync(fd, "utf-8");
|
|
256
|
+
if (existing.includes(sectionHeader)) {
|
|
257
|
+
return { path: filePath, action: "exists" };
|
|
258
|
+
}
|
|
259
|
+
const separator = existing.length === 0 ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
|
|
260
|
+
fs.writeSync(fd, separator + content + "\n", void 0, "utf-8");
|
|
261
|
+
return { path: filePath, action: existing.length === 0 ? "created" : "updated" };
|
|
262
|
+
} finally {
|
|
263
|
+
fs.closeSync(fd);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
245
266
|
var CURSOR_RULE_CONTENT = `---
|
|
246
267
|
description: Auto-manage repository memory with Unforgit via MCP tools
|
|
247
268
|
alwaysApply: true
|
|
@@ -296,11 +317,70 @@ function setupWindsurf(cwd4) {
|
|
|
296
317
|
});
|
|
297
318
|
return { ide: "windsurf", rules, mcp };
|
|
298
319
|
}
|
|
320
|
+
var CLINE_RULE_CONTENT = `${MEMORY_INSTRUCTIONS}
|
|
321
|
+
`;
|
|
322
|
+
function setupCline(cwd4) {
|
|
323
|
+
const rules = replaceMarkdownIfMissingMarker(
|
|
324
|
+
path.join(cwd4, ".clinerules", "unforgit-memory.md"),
|
|
325
|
+
CLINE_RULE_CONTENT
|
|
326
|
+
);
|
|
327
|
+
const mcp = upsertJsonMcp(path.join(cwd4, ".cline", "mcp.json"), "mcpServers", {
|
|
328
|
+
command: "unforgit-mcp",
|
|
329
|
+
args: []
|
|
330
|
+
});
|
|
331
|
+
return { ide: "cline", rules, mcp };
|
|
332
|
+
}
|
|
333
|
+
var ROO_RULE_CONTENT = `${MEMORY_INSTRUCTIONS}
|
|
334
|
+
`;
|
|
335
|
+
function setupRoo(cwd4) {
|
|
336
|
+
const rules = replaceMarkdownIfMissingMarker(
|
|
337
|
+
path.join(cwd4, ".roo", "rules", "unforgit-memory.md"),
|
|
338
|
+
ROO_RULE_CONTENT
|
|
339
|
+
);
|
|
340
|
+
const mcp = upsertJsonMcp(path.join(cwd4, ".roo", "mcp.json"), "mcpServers", {
|
|
341
|
+
command: "unforgit-mcp",
|
|
342
|
+
args: []
|
|
343
|
+
});
|
|
344
|
+
return { ide: "roo", rules, mcp };
|
|
345
|
+
}
|
|
346
|
+
function setupCodex(cwd4) {
|
|
347
|
+
const rules = appendOrCreateMarkdown(path.join(cwd4, "AGENTS.md"), MEMORY_INSTRUCTIONS);
|
|
348
|
+
const mcp = appendOrCreateTomlSection(
|
|
349
|
+
path.join(cwd4, ".codex", "config.toml"),
|
|
350
|
+
"[mcp_servers.unforgit]",
|
|
351
|
+
`[mcp_servers.unforgit]
|
|
352
|
+
command = "unforgit-mcp"
|
|
353
|
+
args = []`
|
|
354
|
+
);
|
|
355
|
+
return { ide: "codex", rules, mcp };
|
|
356
|
+
}
|
|
357
|
+
function setupOpenCode(cwd4) {
|
|
358
|
+
const rules = appendOrCreateMarkdown(path.join(cwd4, "AGENTS.md"), MEMORY_INSTRUCTIONS);
|
|
359
|
+
const mcp = upsertJsonMcp(path.join(cwd4, "opencode.json"), "mcp", {
|
|
360
|
+
type: "local",
|
|
361
|
+
command: ["unforgit-mcp"],
|
|
362
|
+
enabled: true
|
|
363
|
+
});
|
|
364
|
+
return { ide: "opencode", rules, mcp };
|
|
365
|
+
}
|
|
366
|
+
function setupKilo(cwd4) {
|
|
367
|
+
const rules = appendOrCreateMarkdown(path.join(cwd4, "AGENTS.md"), MEMORY_INSTRUCTIONS);
|
|
368
|
+
const mcp = upsertJsonMcp(path.join(cwd4, ".kilocode", "mcp.json"), "mcpServers", {
|
|
369
|
+
command: "unforgit-mcp",
|
|
370
|
+
args: []
|
|
371
|
+
});
|
|
372
|
+
return { ide: "kilo", rules, mcp };
|
|
373
|
+
}
|
|
299
374
|
var IDE_INDICATORS = {
|
|
300
375
|
cursor: [".cursor"],
|
|
301
376
|
claude: ["CLAUDE.md", ".claude"],
|
|
302
377
|
vscode: [".vscode"],
|
|
303
|
-
windsurf: [".windsurf", ".windsurfrules"]
|
|
378
|
+
windsurf: [".windsurf", ".windsurfrules"],
|
|
379
|
+
cline: [".cline", ".clinerules"],
|
|
380
|
+
roo: [".roo", ".roorules"],
|
|
381
|
+
codex: [".codex"],
|
|
382
|
+
opencode: ["opencode.json", ".opencode"],
|
|
383
|
+
kilo: [".kilocode", "kilo.json", "kilo.jsonc", ".kilo"]
|
|
304
384
|
};
|
|
305
385
|
function detectIdes(cwd4) {
|
|
306
386
|
const detected = [];
|
|
@@ -318,13 +398,23 @@ var IDE_HANDLERS = {
|
|
|
318
398
|
cursor: setupCursor,
|
|
319
399
|
claude: setupClaude,
|
|
320
400
|
vscode: setupVscode,
|
|
321
|
-
windsurf: setupWindsurf
|
|
401
|
+
windsurf: setupWindsurf,
|
|
402
|
+
cline: setupCline,
|
|
403
|
+
roo: setupRoo,
|
|
404
|
+
codex: setupCodex,
|
|
405
|
+
opencode: setupOpenCode,
|
|
406
|
+
kilo: setupKilo
|
|
322
407
|
};
|
|
323
408
|
var IDE_LABELS = {
|
|
324
409
|
cursor: "Cursor",
|
|
325
410
|
claude: "Claude Code",
|
|
326
411
|
vscode: "VS Code (Copilot)",
|
|
327
|
-
windsurf: "Windsurf"
|
|
412
|
+
windsurf: "Windsurf",
|
|
413
|
+
cline: "Cline",
|
|
414
|
+
roo: "Roo Code",
|
|
415
|
+
codex: "Codex CLI",
|
|
416
|
+
opencode: "OpenCode",
|
|
417
|
+
kilo: "Kilo Code"
|
|
328
418
|
};
|
|
329
419
|
function setupIdes(cwd4, ides) {
|
|
330
420
|
const results = [];
|
|
@@ -353,15 +443,29 @@ function logIdeResults(results) {
|
|
|
353
443
|
}
|
|
354
444
|
}
|
|
355
445
|
}
|
|
446
|
+
var IDE_ALIASES = {
|
|
447
|
+
"claude-code": "claude",
|
|
448
|
+
claude_code: "claude",
|
|
449
|
+
copilot: "vscode",
|
|
450
|
+
"vs-code": "vscode",
|
|
451
|
+
vs_code: "vscode",
|
|
452
|
+
roocode: "roo",
|
|
453
|
+
"roo-code": "roo",
|
|
454
|
+
open_code: "opencode",
|
|
455
|
+
"open-code": "opencode",
|
|
456
|
+
kilocode: "kilo",
|
|
457
|
+
"kilo-code": "kilo"
|
|
458
|
+
};
|
|
356
459
|
function parseIdeOption(value) {
|
|
357
460
|
if (value === "all") return [...ALL_IDE_NAMES];
|
|
358
461
|
const names = value.split(",").map((s) => s.trim().toLowerCase());
|
|
359
462
|
const valid = [];
|
|
360
|
-
for (const
|
|
463
|
+
for (const rawName of names) {
|
|
464
|
+
const name = IDE_ALIASES[rawName] ?? rawName;
|
|
361
465
|
if (ALL_IDE_NAMES.includes(name)) {
|
|
362
466
|
valid.push(name);
|
|
363
467
|
} else {
|
|
364
|
-
logger.warn(`Unknown IDE: "${
|
|
468
|
+
logger.warn(`Unknown IDE: "${rawName}". Valid options: ${ALL_IDE_NAMES.join(", ")}`);
|
|
365
469
|
}
|
|
366
470
|
}
|
|
367
471
|
return valid;
|