@lotargo/memory_plugin 1.2.3 → 1.2.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/mcp-server/setup.js +41 -2
- package/opencode-plugin/index.js +19 -2
- package/package.json +1 -1
package/mcp-server/setup.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdir } from "fs/promises";
|
|
1
|
+
import { readFile, writeFile, mkdir, cp, readdir } from "fs/promises";
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
4
|
import { homedir } from "os";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
5
6
|
|
|
6
7
|
export async function runSetup() {
|
|
7
8
|
const args = process.argv.slice(2);
|
|
@@ -181,6 +182,44 @@ export async function runSetup() {
|
|
|
181
182
|
console.log(" [SKIP] Global prompt setup skipped:", err.message);
|
|
182
183
|
}
|
|
183
184
|
|
|
185
|
+
// 6. Global & Local Skill Installation (Antigravity, Codex, Claude Code)
|
|
186
|
+
try {
|
|
187
|
+
const packageDir = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
188
|
+
const packageSkillsDir = join(packageDir, "skills");
|
|
189
|
+
if (existsSync(packageSkillsDir)) {
|
|
190
|
+
const opencodeDir = process.env.OPENCODE_CONFIG_DIR || join(home, ".config", "opencode");
|
|
191
|
+
const targets = [
|
|
192
|
+
{ name: "OpenCode", dir: join(opencodeDir, "skills") },
|
|
193
|
+
{ name: "Antigravity", dir: join(home, ".gemini", "config", "skills") },
|
|
194
|
+
{ name: "Codex", dir: join(home, ".codex", "skills") },
|
|
195
|
+
{ name: "Claude Code", dir: join(home, ".claude", "skills") },
|
|
196
|
+
];
|
|
197
|
+
const cwd = process.cwd();
|
|
198
|
+
if (existsSync(join(cwd, ".agents"))) {
|
|
199
|
+
targets.push({ name: "Antigravity (local)", dir: join(cwd, ".agents", "skills") });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
for (const target of targets) {
|
|
203
|
+
try {
|
|
204
|
+
await mkdir(target.dir, { recursive: true });
|
|
205
|
+
const entries = await readdir(packageSkillsDir, { withFileTypes: true });
|
|
206
|
+
for (const entry of entries) {
|
|
207
|
+
if (entry.isDirectory()) {
|
|
208
|
+
const src = join(packageSkillsDir, entry.name);
|
|
209
|
+
const dest = join(target.dir, entry.name);
|
|
210
|
+
await cp(src, dest, { recursive: true });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
console.log(` [OK] ${target.name}: installed skills to ${target.dir}`);
|
|
214
|
+
} catch (e) {
|
|
215
|
+
console.log(` [SKIP] ${target.name} skill installation skipped:`, e.message);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} catch (err) {
|
|
220
|
+
console.log(" [SKIP] Skill installation skipped:", err.message);
|
|
221
|
+
}
|
|
222
|
+
|
|
184
223
|
console.log(`\nSetup complete. Configured ${configuredCount} environment(s).\n`);
|
|
185
224
|
}
|
|
186
225
|
|
package/opencode-plugin/index.js
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
|
-
const { readFile, writeFile, mkdir } = await import("fs/promises");
|
|
1
|
+
const { readFile, writeFile, mkdir, cp, readdir } = await import("fs/promises");
|
|
2
2
|
const { existsSync } = await import("fs");
|
|
3
|
-
const { join, basename } = await import("path");
|
|
3
|
+
const { join, basename, dirname } = await import("path");
|
|
4
4
|
const { homedir } = await import("os");
|
|
5
|
+
const { fileURLToPath } = await import("url");
|
|
5
6
|
|
|
6
7
|
const CONFIG_DIR = process.env.OPENCODE_CONFIG_DIR || join(homedir(), ".config", "opencode");
|
|
7
8
|
const MEMORY_DIR = join(CONFIG_DIR, "memory");
|
|
9
|
+
const SKILLS_DIR = join(CONFIG_DIR, "skills");
|
|
8
10
|
const GLOBAL_KEY = "global";
|
|
9
11
|
|
|
10
12
|
async function ensureDir() {
|
|
11
13
|
if (!existsSync(MEMORY_DIR)) await mkdir(MEMORY_DIR, { recursive: true });
|
|
14
|
+
try {
|
|
15
|
+
const pluginDir = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const packageSkillsDir = join(pluginDir, "..", "skills");
|
|
17
|
+
if (existsSync(packageSkillsDir)) {
|
|
18
|
+
await mkdir(SKILLS_DIR, { recursive: true });
|
|
19
|
+
const entries = await readdir(packageSkillsDir, { withFileTypes: true });
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
if (entry.isDirectory()) {
|
|
22
|
+
const src = join(packageSkillsDir, entry.name);
|
|
23
|
+
const dest = join(SKILLS_DIR, entry.name);
|
|
24
|
+
await cp(src, dest, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch (e) {}
|
|
12
29
|
}
|
|
13
30
|
|
|
14
31
|
function projectName(worktree, directory) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lotargo/memory_plugin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Persistent memory agent for coding AI tools — remembers user preferences and project context across sessions. Works with Antigravity, OpenCode, Claude Code, and Codex.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "opencode-plugin/index.js",
|