promptgraph-mcp 2.2.0 → 2.2.1
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 +29 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -246,12 +246,40 @@ if (args[0] === 'marketplace') {
|
|
|
246
246
|
|
|
247
247
|
if (args[0] === 'validate') {
|
|
248
248
|
const { validateSkill } = await import('./validator.js');
|
|
249
|
+
const { isSkillFile } = await import('./parser.js');
|
|
249
250
|
const file = args[1];
|
|
250
251
|
if (!file) { error('Usage: ' + bin + ' validate <skill.md>'); process.exit(1); }
|
|
252
|
+
|
|
253
|
+
const raw = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : null;
|
|
254
|
+
|
|
255
|
+
// Show indexing score breakdown
|
|
256
|
+
if (raw) {
|
|
257
|
+
const { skillScore: _score } = await import('./parser.js').catch(() => ({}));
|
|
258
|
+
const willIndex = isSkillFile(file, raw);
|
|
259
|
+
const scoreLabel = willIndex ? chalk.green('✓ will be indexed') : chalk.red('✗ will be skipped by indexer');
|
|
260
|
+
console.log(chalk.bold('\n Indexing check: ') + scoreLabel);
|
|
261
|
+
|
|
262
|
+
// Show which signals were detected
|
|
263
|
+
const lines = raw.split('\n').filter(l => l.trim());
|
|
264
|
+
const signals = [];
|
|
265
|
+
try { const { data } = (await import('gray-matter')).default(raw); if (data.name) signals.push(chalk.green('+4 frontmatter name:')); } catch {}
|
|
266
|
+
if (/^#{1,3}\s+(steps?|usage|instructions?|how\s+to|when\s+to\s+use|workflow)/im.test(raw)) signals.push(chalk.green('+2 instructional headers (## Steps / ## Usage)'));
|
|
267
|
+
if (lines.filter(l => /^#{1,3}\s/.test(l)).some(h => /\b(run|use|fix|debug|check|create|deploy|scan|audit)\b/i.test(h))) signals.push(chalk.green('+2 imperative verbs in headers'));
|
|
268
|
+
if (raw.includes('```')) signals.push(chalk.green('+1 code block'));
|
|
269
|
+
if (lines.some(l => /^\d+\.\s/.test(l))) signals.push(chalk.green('+1 numbered list'));
|
|
270
|
+
if (lines.some(l => /^[-*+]\s/.test(l))) signals.push(chalk.green('+1 bullet list'));
|
|
271
|
+
const firstH = lines.find(l => /^#{1,3}\s/.test(l))?.replace(/^#+\s*/, '') || '';
|
|
272
|
+
if (/^(overview|introduction|about|background|welcome)/i.test(firstH)) signals.push(chalk.red('-3 first header looks like docs ("' + firstH + '")'));
|
|
273
|
+
if (signals.length) {
|
|
274
|
+
signals.forEach(s => console.log(' ' + s));
|
|
275
|
+
}
|
|
276
|
+
console.log();
|
|
277
|
+
}
|
|
278
|
+
|
|
251
279
|
const result = validateSkill(file);
|
|
252
280
|
result.warnings.forEach(w => console.log(chalk.yellow('⚠') + ' ' + chalk.gray(w)));
|
|
253
281
|
if (result.ok) {
|
|
254
|
-
success('Skill is valid');
|
|
282
|
+
success('Skill is valid — ready to publish');
|
|
255
283
|
process.exit(0);
|
|
256
284
|
} else {
|
|
257
285
|
error('Validation failed:');
|