promptgraph-mcp 2.9.11 → 2.9.13

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/README.md CHANGED
@@ -87,10 +87,18 @@ pg setup opencode
87
87
  **Option 2 — manual.** Add to `~/.config/opencode/opencode.json`:
88
88
  ```json
89
89
  {
90
- "plugin": ["promptgraph-mcp/plugin"]
90
+ "mcp": {
91
+ "promptgraph": {
92
+ "type": "local",
93
+ "command": ["cmd", "/c", "npx", "promptgraph-mcp"],
94
+ "enabled": true
95
+ }
96
+ }
91
97
  }
92
98
  ```
93
99
 
100
+ > **Linux/macOS:** use `"command": ["npx", "promptgraph-mcp"]` (without `cmd /c`).
101
+
94
102
  ### Other clients
95
103
 
96
104
  | Client | Command |
package/commands/init.js CHANGED
@@ -13,7 +13,7 @@ const PLATFORM_CONFIGS = {
13
13
  },
14
14
  'opencode': {
15
15
  label: 'OpenCode — opencode.json',
16
- snippet: { plugin: ['promptgraph-mcp/plugin'] },
16
+ snippet: { mcp: { promptgraph: { type: 'local', command: ['cmd', '/c', 'npx', 'promptgraph-mcp'], enabled: true } } },
17
17
  },
18
18
  'cursor': {
19
19
  label: 'Cursor — ~/.cursor/mcp.json',
package/indexer.js CHANGED
@@ -53,15 +53,7 @@ export async function indexBatch(db, skills, { fast = false } = {}) {
53
53
  }
54
54
  }
55
55
 
56
- let embeddings = [];
57
- if (!fast && allChunks.length) {
58
- const texts = allChunks.map(c => c.text);
59
- process.stdout.write(` Embedding ${texts.length} chunks...`);
60
- embeddings = await embedBatch(texts);
61
- process.stdout.write('\r' + ' '.repeat(40) + '\r');
62
- }
63
-
64
- // pass 1: upsert all skills + chunks (no edges yet)
56
+ // pass 1: upsert all skills metadata first (so chunks can reference them)
65
57
  db.transaction(() => {
66
58
  for (const skill of skills) {
67
59
  const id = skillId(skill.source, skill.name);
@@ -72,14 +64,29 @@ export async function indexBatch(db, skills, { fast = false } = {}) {
72
64
  deleteEdges.run(id);
73
65
  }
74
66
  }
75
- if (!fast) {
76
- for (let i = 0; i < allChunks.length; i++) {
77
- const { id, chunkIndex, text } = allChunks[i];
78
- upsertChunk.run(id, chunkIndex, text, vecToBlob(embeddings[i]));
79
- }
80
- }
81
67
  })();
82
68
 
69
+ // pass 1b: embed in batches of 50 with progress bar, save each batch immediately
70
+ if (!fast && allChunks.length) {
71
+ const EMBED_BATCH = 50;
72
+ const total = allChunks.length;
73
+ for (let i = 0; i < total; i += EMBED_BATCH) {
74
+ const batch = allChunks.slice(i, i + EMBED_BATCH);
75
+ const texts = batch.map(c => c.text);
76
+ const vecs = await embedBatch(texts);
77
+ db.transaction(() => {
78
+ for (let j = 0; j < batch.length; j++) {
79
+ const { id, chunkIndex, text } = batch[j];
80
+ upsertChunk.run(id, chunkIndex, text, vecToBlob(vecs[j]));
81
+ }
82
+ })();
83
+ const done = Math.min(i + EMBED_BATCH, total);
84
+ const pct = Math.round(done / total * 100);
85
+ process.stdout.write(`\r Embedding chunks... ${done}/${total} (${pct}%) `);
86
+ }
87
+ process.stdout.write('\r' + ' '.repeat(50) + '\r');
88
+ }
89
+
83
90
  // pass 2: resolve edges after all skills in batch are committed
84
91
  const resolveSameSource = db.prepare("SELECT id FROM skills WHERE name = ? AND source = ? LIMIT 1");
85
92
  const resolveAny = db.prepare("SELECT id FROM skills WHERE name = ? ORDER BY id LIMIT 1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.9.11",
3
+ "version": "2.9.13",
4
4
  "files": [
5
5
  "*.js",
6
6
  "commands/",
package/platform.js CHANGED
@@ -6,7 +6,9 @@ import { spawnSync } from 'child_process';
6
6
  const HOME = os.homedir();
7
7
 
8
8
  const STD_ENTRY = { command: 'npx', args: ['promptgraph-mcp'] };
9
- const OC_ENTRY = { type: 'local', command: ['npx', 'promptgraph-mcp'], enabled: true };
9
+ const OC_ENTRY = process.platform === 'win32'
10
+ ? { type: 'local', command: ['cmd', '/c', 'npx', 'promptgraph-mcp'], enabled: true }
11
+ : { type: 'local', command: ['npx', 'promptgraph-mcp'], enabled: true };
10
12
 
11
13
  // Shared helper: write standard mcpServers entry (Claude Code, Cursor, Windsurf, Codex format)
12
14
  function addStdMcp(configPath) {
@@ -26,14 +28,15 @@ function addClineMcp(configPath) {
26
28
  writeJson(configPath, json);
27
29
  }
28
30
 
29
- // OpenCode uses plugin array
31
+ // OpenCode uses mcp.promptgraph object
30
32
  function addOpenCodeMcp(configPath) {
31
33
  const json = readJson(configPath) || {};
32
- json.plugin = json.plugin || [];
33
- const entry = 'promptgraph-mcp/plugin';
34
- if (!json.plugin.includes(entry)) json.plugin.push(entry);
35
- fs.mkdirSync(path.dirname(configPath), { recursive: true });
36
- writeJson(configPath, json);
34
+ json.mcp = json.mcp || {};
35
+ if (!json.mcp.promptgraph) {
36
+ json.mcp.promptgraph = OC_ENTRY;
37
+ fs.mkdirSync(path.dirname(configPath), { recursive: true });
38
+ writeJson(configPath, json);
39
+ }
37
40
  }
38
41
 
39
42
  export const PLATFORMS = {
@@ -100,7 +103,7 @@ function isOpenCodeInstalled() {
100
103
  function isClaudeCodeInstalled() { return isBinaryInstalled('claude'); }
101
104
 
102
105
  function getOpenCodeConfig() {
103
- if (process.platform === 'win32') return path.join(HOME, 'AppData', 'Roaming', 'opencode', 'opencode.json');
106
+ if (process.platform === 'win32') return path.join(HOME, '.config', 'opencode', 'opencode.json');
104
107
  if (process.platform === 'darwin') return path.join(HOME, 'Library', 'Application Support', 'opencode', 'opencode.json');
105
108
  return path.join(HOME, '.config', 'opencode', 'opencode.json');
106
109
  }