promptgraph-mcp 2.1.1 → 2.1.3
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/index.js +96 -1
- 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,100 @@ 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
|
+
// Marketplace skill-list bundles (installed individually, not whole repos)
|
|
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
|
+
if (installedBundles.length) {
|
|
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
|
+
console.log(' ' + purple('📦 Installed marketplace bundles'));
|
|
151
|
+
for (const b of installedBundles) {
|
|
152
|
+
const bundle = registryBundles.find(rb => rb.id === b);
|
|
153
|
+
const name = bundle ? chalk.white.bold(bundle.name || b) : chalk.white(b);
|
|
154
|
+
const cat = bundle?.category ? chalk.dim(` [${bundle.category}]`) : '';
|
|
155
|
+
const n = sourceCounts.get('marketplace') || 0;
|
|
156
|
+
console.log(` ${name}${cat} ${chalk.gray(n + ' skills')}`);
|
|
157
|
+
}
|
|
158
|
+
console.log();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Not-yet-indexed repos hint
|
|
162
|
+
const emptyRepos = githubSources.filter(s => (sourceCounts.get(s.source) || 0) === 0 && fs.existsSync(s.dir));
|
|
163
|
+
if (emptyRepos.length) {
|
|
164
|
+
console.log(' ' + chalk.yellow(`⚠ ${emptyRepos.length} repo(s) not indexed`) + chalk.gray(' → run: ') + chalk.cyan(`${bin} reindex`));
|
|
165
|
+
console.log();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
console.log(
|
|
169
|
+
boxen(
|
|
170
|
+
chalk.dim('full reindex ') + chalk.cyan(`${bin} reindex`) + '\n' +
|
|
171
|
+
chalk.dim('install bundle ') + chalk.cyan(`${bin} bundle install <id>`) + '\n' +
|
|
172
|
+
chalk.dim('browse market ') + chalk.cyan(`${bin} marketplace bundles`),
|
|
173
|
+
{ padding: { top: 0, bottom: 0, left: 1, right: 1 }, borderStyle: 'round', borderColor: '#4B5563', dimBorder: true }
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
console.log();
|
|
177
|
+
process.exit(0);
|
|
178
|
+
}
|
|
179
|
+
|
|
85
180
|
if (args[0] === 'marketplace' && (args[1] === 'bundles' || args[1] === 'bundle')) {
|
|
86
181
|
const { browseBundles } = await import('./marketplace.js');
|
|
87
182
|
const purple = chalk.hex('#7C3AED');
|