promptgraph-mcp 2.1.1 → 2.1.2

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/index.js +102 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -16,7 +16,7 @@ const args = process.argv.slice(2);
16
16
  const rawBin = process.argv[1]?.split(/[\\/]/).pop()?.replace(/\.js$/, '');
17
17
  const bin = (rawBin && rawBin !== 'index') ? rawBin : 'pg';
18
18
 
19
- const KNOWN_COMMANDS = new Set(['init', 'reindex', 'update', 'import', 'setup', 'validate', 'marketplace', 'doctor', 'search', 'help', '--help', '-h', 'bundle']);
19
+ const KNOWN_COMMANDS = new Set(['init', 'reindex', 'update', 'import', 'setup', 'validate', 'marketplace', 'doctor', 'search', 'help', '--help', '-h', 'bundle', 'status']);
20
20
 
21
21
  function showHelp() {
22
22
  console.log(
@@ -32,6 +32,7 @@ function showHelp() {
32
32
  ['reindex', 'Re-index all skills'],
33
33
  ['search <query>', 'Search skills from the terminal'],
34
34
  ['import <owner/repo>', 'Import skills from GitHub'],
35
+ ['status', 'Show installed skills, repos, and bundles'],
35
36
  ['marketplace [cat]', 'Browse skills by category (Engineering, Coding, …)'],
36
37
  ['marketplace bundles', 'Browse skill bundles grouped by category'],
37
38
  ['validate <file.md>', 'Validate a skill before publishing'],
@@ -82,6 +83,106 @@ if (args[0] === 'doctor') {
82
83
  process.exit(0);
83
84
  }
84
85
 
86
+ if (args[0] === 'status') {
87
+ const { loadConfig: _lc } = await import('./config.js');
88
+ const { getDb } = await import('./db.js');
89
+ const { fetchText } = await import('./marketplace.js');
90
+ const purple = chalk.hex('#7C3AED');
91
+ const cfg = _lc();
92
+ const db = getDb();
93
+
94
+ // Skills per source from DB
95
+ const sourceCounts = new Map();
96
+ for (const row of db.prepare('SELECT source, COUNT(*) as n FROM skills GROUP BY source').all()) {
97
+ sourceCounts.set(row.source, row.n);
98
+ }
99
+ const totalSkills = db.prepare('SELECT COUNT(*) as n FROM skills').get().n;
100
+
101
+ console.log();
102
+ console.log(' ' + purple.bold('◆ PromptGraph Status'));
103
+ console.log(' ' + chalk.gray('─'.repeat(56)));
104
+ console.log();
105
+ console.log(' ' + chalk.bold.white(`${totalSkills} skills indexed`) + chalk.gray(` · ${cfg.sources.length} sources`));
106
+ console.log();
107
+
108
+ // Sources grouped by type
109
+ const githubSources = cfg.sources.filter(s => s.source.startsWith('github:'));
110
+ const localSources = cfg.sources.filter(s => !s.source.startsWith('github:'));
111
+
112
+ if (localSources.length) {
113
+ console.log(' ' + purple('📁 Local'));
114
+ for (const s of localSources) {
115
+ const n = sourceCounts.get(s.source) || 0;
116
+ const exists = fs.existsSync(s.dir);
117
+ const label = exists ? chalk.white(s.source) : chalk.gray(s.source + ' (missing)');
118
+ console.log(' ' + label + chalk.gray(` ${n} skills · ${s.dir}`));
119
+ }
120
+ console.log();
121
+ }
122
+
123
+ if (githubSources.length) {
124
+ console.log(' ' + purple('🌐 GitHub repos'));
125
+ for (const s of githubSources) {
126
+ const n = sourceCounts.get(s.source) || 0;
127
+ const repoName = s.source.replace('github:', '');
128
+ const exists = fs.existsSync(s.dir);
129
+ const label = exists ? chalk.white(repoName) : chalk.gray(repoName + ' (not cloned)');
130
+ console.log(' ' + label + chalk.gray(` ${n} skills`));
131
+ console.log(' ' + chalk.dim(s.dir));
132
+ }
133
+ console.log();
134
+ }
135
+
136
+ // Installed bundles from marketplace config
137
+ const marketplaceDir = path.join(os.homedir(), '.claude', 'skills-store', 'marketplace');
138
+ const installedBundles = fs.existsSync(marketplaceDir)
139
+ ? fs.readdirSync(marketplaceDir, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => d.name)
140
+ : [];
141
+
142
+ // Cross-reference with registry
143
+ let registryBundles = [];
144
+ try {
145
+ const REGISTRY_URL = 'https://raw.githubusercontent.com/NeiP4n/promptgraph-registry/main/registry.json';
146
+ const text = await fetchText(REGISTRY_URL);
147
+ registryBundles = JSON.parse(text).bundles || [];
148
+ } catch {}
149
+
150
+ const githubBundles = githubSources.map(s => {
151
+ const repoName = s.source.replace('github:', '');
152
+ const bundle = registryBundles.find(b => b.repo_url && repoName.toLowerCase().includes(b.id.split('-').slice(-1)[0].toLowerCase()));
153
+ return { repoName, bundle, source: s };
154
+ });
155
+
156
+ if (githubBundles.length || installedBundles.length) {
157
+ console.log(' ' + purple('📦 Installed bundles'));
158
+ for (const { repoName, bundle } of githubBundles) {
159
+ const n = sourceCounts.get(`github:${repoName}`) || 0;
160
+ const name = bundle ? chalk.white.bold(bundle.name || bundle.id) : chalk.white(repoName);
161
+ const cat = bundle?.category ? chalk.dim(` [${bundle.category}]`) : '';
162
+ console.log(` ${name}${cat} ${chalk.gray(n + ' skills')} ${chalk.blue('GitHub')}`);
163
+ }
164
+ for (const b of installedBundles) {
165
+ const bundle = registryBundles.find(rb => rb.id === b);
166
+ const name = bundle ? chalk.white.bold(bundle.name || b) : chalk.white(b);
167
+ const cat = bundle?.category ? chalk.dim(` [${bundle.category}]`) : '';
168
+ const n = sourceCounts.get('marketplace') || 0;
169
+ console.log(` ${name}${cat} ${chalk.gray(n + ' skills')} ${chalk.dim('marketplace')}`);
170
+ }
171
+ console.log();
172
+ }
173
+
174
+ console.log(
175
+ boxen(
176
+ chalk.dim('full reindex ') + chalk.cyan(`${bin} reindex`) + '\n' +
177
+ chalk.dim('install bundle ') + chalk.cyan(`${bin} bundle install <id>`) + '\n' +
178
+ chalk.dim('browse market ') + chalk.cyan(`${bin} marketplace bundles`),
179
+ { padding: { top: 0, bottom: 0, left: 1, right: 1 }, borderStyle: 'round', borderColor: '#4B5563', dimBorder: true }
180
+ )
181
+ );
182
+ console.log();
183
+ process.exit(0);
184
+ }
185
+
85
186
  if (args[0] === 'marketplace' && (args[1] === 'bundles' || args[1] === 'bundle')) {
86
187
  const { browseBundles } = await import('./marketplace.js');
87
188
  const purple = chalk.hex('#7C3AED');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {