opcode-pg-memory 2.2.6 → 2.2.7

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.
Files changed (2) hide show
  1. package/dist/cli.js +42 -2
  2. package/package.json +70 -70
package/dist/cli.js CHANGED
@@ -4951,14 +4951,16 @@ var init_esm = __esm(() => {
4951
4951
  });
4952
4952
 
4953
4953
  // src/cli.ts
4954
- import { mkdirSync, writeFileSync, readFileSync, existsSync } from "node:fs";
4955
- import { join } from "node:path";
4954
+ import { mkdirSync, writeFileSync, readFileSync, existsSync, copyFileSync, readdirSync, statSync } from "node:fs";
4955
+ import { join, dirname } from "node:path";
4956
4956
  import { homedir } from "node:os";
4957
+ var __dirname = "C:\\Users\\Grace\\.config\\opencode\\plugins\\opcode-pg-memory\\src";
4957
4958
  var OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode");
4958
4959
  var OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command");
4959
4960
  var OPENCODE_SKILLS_DIR = join(homedir(), ".config", "opencode", "skills");
4960
4961
  var PLUGIN_NAME = "opcode-pg-memory";
4961
4962
  var REPO_URL = "https://github.com/Vbs313/opcode-pg-memory";
4963
+ var OPENCODE_CACHE_DIR = join(homedir(), ".cache", "opencode", "packages", "opcode-pg-memory@latest");
4962
4964
  var PG_MEMORY_INIT_COMMAND = `---
4963
4965
  description: Initialize pg-memory with codebase knowledge
4964
4966
  ---
@@ -5181,6 +5183,43 @@ if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
5181
5183
  printHelp();
5182
5184
  process.exit(0);
5183
5185
  }
5186
+ function populateOpencodeCache() {
5187
+ const cacheDist = join(OPENCODE_CACHE_DIR, "dist");
5188
+ const sourceDist = join(__dirname, "..", "dist");
5189
+ if (!existsSync(sourceDist)) {
5190
+ console.log(" dist/ not found at", sourceDist, "- plugin not running from npm package, skipping cache");
5191
+ return false;
5192
+ }
5193
+ if (!existsSync(cacheDist)) {
5194
+ mkdirSync(cacheDist, { recursive: true });
5195
+ }
5196
+ function copyDir(src, dest) {
5197
+ mkdirSync(dest, { recursive: true });
5198
+ for (const entry of readdirSync(src)) {
5199
+ const srcPath = join(src, entry);
5200
+ const destPath = join(dest, entry);
5201
+ if (statSync(srcPath).isDirectory()) {
5202
+ copyDir(srcPath, destPath);
5203
+ } else {
5204
+ copyFileSync(srcPath, destPath);
5205
+ }
5206
+ }
5207
+ }
5208
+ copyDir(sourceDist, cacheDist);
5209
+ console.log(` Populated OpenCode cache: ${cacheDist}`);
5210
+ const cacheDir = OPENCODE_CACHE_DIR;
5211
+ const sourceFiles = [".env.example", "README.md", "LICENSE", "scripts/migration-v2.sql", "package.json"];
5212
+ for (const file of sourceFiles) {
5213
+ const srcFile = join(__dirname, "..", file);
5214
+ const destFile = join(cacheDir, file);
5215
+ const destDir = dirname(destFile);
5216
+ if (existsSync(srcFile)) {
5217
+ mkdirSync(destDir, { recursive: true });
5218
+ copyFileSync(srcFile, destFile);
5219
+ }
5220
+ }
5221
+ return true;
5222
+ }
5184
5223
  if (cmd === "install") {
5185
5224
  console.log(`
5186
5225
  OpenCode PG Memory installer
@@ -5198,6 +5237,7 @@ OpenCode PG Memory installer
5198
5237
  createReflectCommand();
5199
5238
  createSkill();
5200
5239
  createAgentsTemplate();
5240
+ populateOpencodeCache();
5201
5241
  console.log(`
5202
5242
  Setup complete!`);
5203
5243
  console.log(`
package/package.json CHANGED
@@ -1,70 +1,70 @@
1
- {
2
- "name": "opcode-pg-memory",
3
- "version": "2.2.6",
4
- "description": "OpenCode plugin for persistent memory using PostgreSQL + pgvector four-layer memory architecture with topic segmentation",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "opcode-pg-memory": "dist/cli.js"
10
- },
11
- "scripts": {
12
- "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && bun build ./mcp-server.ts --outfile ./dist/mcp-server.js --target node && tsc --emitDeclarationOnly",
13
- "typecheck": "tsc --noEmit",
14
- "clean": "rimraf dist"
15
- },
16
- "keywords": [
17
- "opencode",
18
- "plugin",
19
- "memory",
20
- "postgresql",
21
- "pgvector",
22
- "hindsight",
23
- "mcp",
24
- "agent"
25
- ],
26
- "author": "Vbs313",
27
- "license": "GPL-3.0",
28
- "repository": {
29
- "type": "git",
30
- "url": "git+https://github.com/Vbs313/opcode-pg-memory.git"
31
- },
32
- "opencode": {
33
- "type": "plugin",
34
- "hooks": [
35
- "chat.message",
36
- "event",
37
- "tool.execute.before",
38
- "tool.execute.after",
39
- "experimental.session.compacting",
40
- "experimental.chat.system.transform"
41
- ]
42
- },
43
- "files": [
44
- "dist",
45
- "scripts/migration-v2.sql",
46
- ".env.example",
47
- "README.md"
48
- ],
49
- "dependencies": {
50
- "pg": "^8.11.3",
51
- "pgvector": "^0.1.8",
52
- "@modelcontextprotocol/sdk": "^0.5.0",
53
- "uuid": "^9.0.1",
54
- "openai": "^4.20.0",
55
- "dotenv": "^16.3.1"
56
- },
57
- "devDependencies": {
58
- "@types/node": "^20.10.0",
59
- "@types/pg": "^8.10.9",
60
- "@types/uuid": "^9.0.7",
61
- "typescript": "^5.3.2",
62
- "rimraf": "^5.0.5",
63
- "jest": "^29.7.0",
64
- "ts-jest": "^29.1.1",
65
- "@types/jest": "^29.5.10"
66
- },
67
- "engines": {
68
- "node": ">=18.0.0"
69
- }
70
- }
1
+ {
2
+ "name": "opcode-pg-memory",
3
+ "version": "2.2.7",
4
+ "description": "OpenCode plugin for persistent memory using PostgreSQL + pgvector �?four-layer memory architecture with topic segmentation",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "opcode-pg-memory": "dist/cli.js"
10
+ },
11
+ "scripts": {
12
+ "build": "bun build ./src/index.ts --outdir ./dist --target node && bun build ./src/cli.ts --outfile ./dist/cli.js --target node && bun build ./mcp-server.ts --outfile ./dist/mcp-server.js --target node && tsc --emitDeclarationOnly",
13
+ "typecheck": "tsc --noEmit",
14
+ "clean": "rimraf dist"
15
+ },
16
+ "keywords": [
17
+ "opencode",
18
+ "plugin",
19
+ "memory",
20
+ "postgresql",
21
+ "pgvector",
22
+ "hindsight",
23
+ "mcp",
24
+ "agent"
25
+ ],
26
+ "author": "Vbs313",
27
+ "license": "GPL-3.0",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/Vbs313/opcode-pg-memory.git"
31
+ },
32
+ "opencode": {
33
+ "type": "plugin",
34
+ "hooks": [
35
+ "chat.message",
36
+ "event",
37
+ "tool.execute.before",
38
+ "tool.execute.after",
39
+ "experimental.session.compacting",
40
+ "experimental.chat.system.transform"
41
+ ]
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "scripts/migration-v2.sql",
46
+ ".env.example",
47
+ "README.md"
48
+ ],
49
+ "dependencies": {
50
+ "pg": "^8.11.3",
51
+ "pgvector": "^0.1.8",
52
+ "@modelcontextprotocol/sdk": "^0.5.0",
53
+ "uuid": "^9.0.1",
54
+ "openai": "^4.20.0",
55
+ "dotenv": "^16.3.1"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20.10.0",
59
+ "@types/pg": "^8.10.9",
60
+ "@types/uuid": "^9.0.7",
61
+ "typescript": "^5.3.2",
62
+ "rimraf": "^5.0.5",
63
+ "jest": "^29.7.0",
64
+ "ts-jest": "^29.1.1",
65
+ "@types/jest": "^29.5.10"
66
+ },
67
+ "engines": {
68
+ "node": ">=18.0.0"
69
+ }
70
+ }