promptgraph-mcp 2.9.3 → 2.9.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/commands/init.js CHANGED
@@ -2,17 +2,42 @@ import { colors, banner, success, error, info, section, table } from '../cli.js'
2
2
  import chalk from 'chalk';
3
3
  import boxen from 'boxen';
4
4
 
5
+ const PLATFORM_CONFIGS = {
6
+ 'claude-code': {
7
+ label: 'Claude Code — ~/.claude/settings.json',
8
+ snippet: { mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
9
+ },
10
+ 'claude-desktop': {
11
+ label: 'Claude Desktop — claude_desktop_config.json',
12
+ snippet: { mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
13
+ },
14
+ 'opencode': {
15
+ label: 'OpenCode — opencode.json',
16
+ snippet: { mcp: { promptgraph: { type: 'local', command: ['npx', 'promptgraph-mcp'], enabled: true } } },
17
+ },
18
+ 'cursor': {
19
+ label: 'Cursor — ~/.cursor/mcp.json',
20
+ snippet: { mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
21
+ },
22
+ 'windsurf': {
23
+ label: 'Windsurf — mcp_config.json',
24
+ snippet: { mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
25
+ },
26
+ 'cline': {
27
+ label: 'Cline — ~/.vscode/mcp.json',
28
+ snippet: { servers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
29
+ },
30
+ 'codex': {
31
+ label: 'OpenAI Codex CLI — ~/.codex/config.json',
32
+ snippet: { mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } },
33
+ },
34
+ };
35
+
5
36
  export default async function handler(args, bin) {
6
37
  const { promptConfig } = await import('../config.js');
7
38
  const { indexAll } = await import('../indexer.js');
8
- const os = await import('os');
9
- const fs = await import('fs');
10
- const path = await import('path');
11
- const commandsDir = path.default.join(os.default.homedir(), '.claude', 'commands');
12
- if (!fs.default.existsSync(commandsDir)) {
13
- console.log(chalk.yellow('⚠') + ' ' + chalk.gray('~/.claude/commands/ not found — is Claude Code installed?'));
14
- console.log(chalk.gray(' Install from: https://claude.ai/download\n'));
15
- }
39
+ const { detectPlatforms, PLATFORMS } = await import('../platform.js');
40
+
16
41
  if (!args.includes('--yes') && !args.includes('-y')) {
17
42
  const readline = await import('readline');
18
43
  const rl = readline.default.createInterface({ input: process.stdin, output: process.stdout });
@@ -26,12 +51,33 @@ export default async function handler(args, bin) {
26
51
  const config = await promptConfig();
27
52
  await indexAll();
28
53
  console.log();
29
- console.log(
30
- boxen(
31
- chalk.white.bold('Add to Claude Code settings.json:') + '\n\n' +
32
- chalk.gray(JSON.stringify({ mcpServers: { promptgraph: { command: 'npx', args: ['promptgraph-mcp'] } } }, null, 2)),
33
- { padding: 1, borderStyle: 'round', borderColor: '#7C3AED', dimBorder: true }
34
- )
35
- );
54
+
55
+ const detected = detectPlatforms().map(p => p.id);
56
+ const toShow = detected.length > 0 ? detected : ['claude-code', 'opencode'];
57
+
58
+ for (const id of toShow) {
59
+ const cfg = PLATFORM_CONFIGS[id];
60
+ if (!cfg) continue;
61
+ const platform = PLATFORMS[id];
62
+ if (platform) {
63
+ try { platform.addMcp(platform); } catch {}
64
+ }
65
+ console.log(
66
+ boxen(
67
+ chalk.white.bold(cfg.label) + '\n\n' +
68
+ chalk.gray(JSON.stringify(cfg.snippet, null, 2)),
69
+ { padding: 1, borderStyle: 'round', borderColor: '#7C3AED', dimBorder: true }
70
+ )
71
+ );
72
+ }
73
+
74
+ if (detected.length > 0) {
75
+ console.log(chalk.green(' ✓') + chalk.gray(' Config written automatically to detected platforms.'));
76
+ console.log(chalk.gray(' Restart your editor/client to activate.\n'));
77
+ } else {
78
+ console.log(chalk.gray(' Copy the snippet above into your editor config, then restart.\n'));
79
+ console.log(chalk.gray(' Or run: ') + chalk.white('pg setup <platform>') + chalk.gray(' (claude-code, opencode, cursor, windsurf, cline, codex)\n'));
80
+ }
81
+
36
82
  process.exit(0);
37
83
  }
package/marketplace.js CHANGED
@@ -100,7 +100,7 @@ function httpGet(url) {
100
100
  let data = '';
101
101
  res.setEncoding('utf8');
102
102
  res.on('data', c => data += c);
103
- res.on('end', () => resolve(data));
103
+ res.on('end', () => resolve(data.charCodeAt(0) === 0xFEFF ? data.slice(1) : data));
104
104
  });
105
105
  req.on('timeout', () => { req.destroy(new Error('request timed out')); });
106
106
  req.on('error', reject);
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "promptgraph-mcp",
3
- "version": "2.9.3",
4
- "files": [
5
- "*.js",
6
- "commands/",
7
- "src/",
8
- "README.md"
9
- ],
10
- "main": "index.js",
11
- "type": "module",
12
- "bin": {
13
- "pg": "index.js",
14
- "promptgraph": "index.js",
15
- "promptgraph-mcp": "index.js"
16
- },
17
- "scripts": {
18
- "start": "node index.js",
19
- "init": "node index.js init",
20
- "reindex": "node index.js reindex",
21
- "test": "vitest run"
22
- },
23
- "keywords": [
24
- "claude",
25
- "claude-code",
26
- "mcp",
27
- "ai",
28
- "skills",
29
- "embeddings"
30
- ],
31
- "author": "NeiP4n",
32
- "license": "MIT",
33
- "description": "Semantic skill router for Claude Code — load only the skills you need, save 20k+ tokens per session",
34
- "repository": {
35
- "type": "git",
36
- "url": "git+https://github.com/NeiP4n/promptgraph.git"
37
- },
38
- "homepage": "https://github.com/NeiP4n/promptgraph#readme",
39
- "engines": {
40
- "node": ">=18"
41
- },
42
- "dependencies": {
43
- "@modelcontextprotocol/sdk": "^1.29.0",
44
- "better-sqlite3": "^12.10.0",
45
- "boxen": "^8.0.1",
46
- "chalk": "^5.6.2",
47
- "chokidar": "^5.0.0",
48
- "fastembed": "^2.1.0",
49
- "glob": "^13.0.6",
50
- "gray-matter": "^4.0.3",
51
- "hnswlib-node": "^3.0.0",
52
- "ora": "^9.4.0"
53
- },
54
- "devDependencies": {
55
- "@vitest/coverage-v8": "^4.1.8",
56
- "vitest": "^4.1.8"
57
- },
58
- "overrides": {
59
- "tar": "^7.5.11"
60
- }
61
- }
1
+ {
2
+ "name": "promptgraph-mcp",
3
+ "version": "2.9.5",
4
+ "files": [
5
+ "*.js",
6
+ "commands/",
7
+ "src/",
8
+ "README.md"
9
+ ],
10
+ "main": "index.js",
11
+ "type": "module",
12
+ "bin": {
13
+ "pg": "index.js",
14
+ "promptgraph": "index.js",
15
+ "promptgraph-mcp": "index.js"
16
+ },
17
+ "scripts": {
18
+ "start": "node index.js",
19
+ "init": "node index.js init",
20
+ "reindex": "node index.js reindex",
21
+ "test": "vitest run"
22
+ },
23
+ "keywords": [
24
+ "claude",
25
+ "claude-code",
26
+ "mcp",
27
+ "ai",
28
+ "skills",
29
+ "embeddings"
30
+ ],
31
+ "author": "NeiP4n",
32
+ "license": "MIT",
33
+ "description": "Semantic skill router for Claude Code — load only the skills you need, save 20k+ tokens per session",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/NeiP4n/promptgraph.git"
37
+ },
38
+ "homepage": "https://github.com/NeiP4n/promptgraph#readme",
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.29.0",
44
+ "better-sqlite3": "^12.10.0",
45
+ "boxen": "^8.0.1",
46
+ "chalk": "^5.6.2",
47
+ "chokidar": "^5.0.0",
48
+ "fastembed": "^2.1.0",
49
+ "glob": "^13.0.6",
50
+ "gray-matter": "^4.0.3",
51
+ "hnswlib-node": "^3.0.0",
52
+ "ora": "^9.4.0"
53
+ },
54
+ "devDependencies": {
55
+ "@vitest/coverage-v8": "^4.1.8",
56
+ "vitest": "^4.1.8"
57
+ },
58
+ "overrides": {
59
+ "tar": "^7.5.11"
60
+ }
61
+ }