promptgraph-mcp 2.9.4 → 2.9.6

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
  }
@@ -0,0 +1,40 @@
1
+ import chalk from 'chalk';
2
+ import { success, error, info } from '../cli.js';
3
+
4
+ export default async function handler(args, bin) {
5
+ const query = args.slice(1).join(' ').trim();
6
+ if (!query) {
7
+ console.log(chalk.yellow('Usage: ') + chalk.white(`${bin} install <bundle-name>`));
8
+ console.log(chalk.gray(' Examples:'));
9
+ console.log(chalk.gray(` ${bin} install engineering-best-practices`));
10
+ console.log(chalk.gray(` ${bin} install pg-000001`));
11
+ console.log(chalk.gray(` ${bin} install "LLM Prompts"`));
12
+ console.log(chalk.gray(`\n Browse: ${bin} marketplace\n`));
13
+ process.exit(1);
14
+ }
15
+
16
+ const { installBundle } = await import('../marketplace.js');
17
+ const ora = (await import('ora')).default;
18
+
19
+ const spinner = ora({ text: chalk.gray(`Installing "${query}"...`), color: 'magenta' }).start();
20
+ const result = await installBundle(query);
21
+ spinner.stop();
22
+
23
+ if (result.error) {
24
+ error(result.error);
25
+ console.log(chalk.gray(` Try: ${bin} marketplace (browse & search)`));
26
+ process.exit(1);
27
+ }
28
+
29
+ if (result.type === 'repo_import') {
30
+ success(`Installed ${chalk.white(result.bundle)}`);
31
+ info(chalk.gray(`Run ${chalk.white('pg reindex')} to enable semantic search`));
32
+ } else {
33
+ const ok = result.installed?.length ?? 0;
34
+ const fail = result.failed?.length ?? 0;
35
+ success(`Installed ${chalk.white(result.bundle)} — ${ok} skill${ok !== 1 ? 's' : ''}${fail > 0 ? chalk.red(` (${fail} failed)`) : ''}`);
36
+ if (ok > 0) info(chalk.gray(`Run ${chalk.white('pg reindex')} to enable semantic search`));
37
+ }
38
+
39
+ process.exit(0);
40
+ }
package/index.js CHANGED
@@ -18,7 +18,7 @@ const args = process.argv.slice(2);
18
18
  const rawBin = process.argv[1]?.split(/[\\/]/).pop()?.replace(/\.js$/, '');
19
19
  const bin = (rawBin && rawBin !== 'index') ? rawBin : 'pg';
20
20
 
21
- const KNOWN_COMMANDS = new Set(['init', 'reindex', 'update', 'import', 'setup', 'validate', 'marketplace', 'doctor', 'search', 'help', '--help', '-h', 'bundle', 'status', 'train']);
21
+ const KNOWN_COMMANDS = new Set(['init', 'reindex', 'update', 'import', 'install', 'setup', 'validate', 'marketplace', 'doctor', 'search', 'help', '--help', '-h', 'bundle', 'status', 'train']);
22
22
 
23
23
  function showHelp() {
24
24
  console.log(
@@ -35,6 +35,7 @@ function showHelp() {
35
35
  ['search <query>', 'Search skills from the terminal'],
36
36
  ['import <owner/repo>', 'Import skills from GitHub'],
37
37
  ['status', 'Show installed skills, repos, and bundles'],
38
+ ['install <name>', 'Install a bundle by name, code, or id'],
38
39
  ['marketplace', 'Interactive TUI: browse + search + install skills & bundles'],
39
40
  ['bundle update [id]', 'Update all (or one) installed GitHub bundles'],
40
41
  ['validate <file.md>', 'Validate a skill before publishing'],
@@ -81,6 +82,7 @@ const COMMAND_MAP = {
81
82
  search: './commands/search.js',
82
83
  bundle: './commands/bundle.js',
83
84
  import: './commands/import.js',
85
+ install: './commands/install.js',
84
86
  setup: './commands/setup.js',
85
87
  init: './commands/init.js',
86
88
  update: './commands/update.js',
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "promptgraph-mcp",
3
- "version": "2.9.4",
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.6",
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
+ }