promptgraph-mcp 1.5.12 → 1.5.14
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 +37 -19
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -62,7 +62,9 @@ if (!args[0] && process.stdin.isTTY) {
|
|
|
62
62
|
process.exit(0);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
// Only reject an EXPLICIT unknown command. With no args (args[0] undefined),
|
|
66
|
+
// fall through to start the MCP server — never print to stdout here.
|
|
67
|
+
if (args[0] && !KNOWN_COMMANDS.has(args[0])) {
|
|
66
68
|
console.log(chalk.red('✗') + ' Unknown command: ' + chalk.white(args[0]));
|
|
67
69
|
console.log(chalk.gray(' Run `' + bin + ' help` to see available commands.\n'));
|
|
68
70
|
process.exit(1);
|
|
@@ -102,31 +104,47 @@ if (args[0] === 'marketplace') {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
const totalPages = Math.ceil(all.length / PER_PAGE);
|
|
105
|
-
const
|
|
107
|
+
const startIdx = (page - 1) * PER_PAGE;
|
|
108
|
+
const slice = all.slice(startIdx, startIdx + PER_PAGE);
|
|
109
|
+
const purple = chalk.hex('#7C3AED');
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
const wrap = (text, width, indent) => {
|
|
112
|
+
const words = (text || '').split(/\s+/);
|
|
113
|
+
const lines = [];
|
|
114
|
+
let line = '';
|
|
115
|
+
for (const w of words) {
|
|
116
|
+
if ((line + ' ' + w).trim().length > width) { lines.push(line.trim()); line = w; }
|
|
117
|
+
else line += ' ' + w;
|
|
118
|
+
}
|
|
119
|
+
if (line.trim()) lines.push(line.trim());
|
|
120
|
+
return lines.map(l => indent + chalk.gray(l)).join('\n');
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
console.log();
|
|
124
|
+
console.log(' ' + purple.bold('PromptGraph Marketplace'));
|
|
125
|
+
console.log(' ' + chalk.gray(`${all.length} skill${all.length === 1 ? '' : 's'} · page ${page}/${totalPages}`));
|
|
126
|
+
console.log(' ' + chalk.gray('─'.repeat(50)));
|
|
114
127
|
console.log();
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
128
|
+
|
|
129
|
+
slice.forEach((s, i) => {
|
|
130
|
+
const num = chalk.gray(String(startIdx + i + 1).padStart(2) + '.');
|
|
131
|
+
const stars = (s.stars > 0 ? chalk.yellow('★ ' + s.stars) : chalk.gray('★ 0'));
|
|
132
|
+
console.log(' ' + num + ' ' + chalk.white.bold(s.id) + ' ' + stars);
|
|
133
|
+
console.log(wrap(s.description, 64, ' '));
|
|
134
|
+
if (s.tags?.length) console.log(' ' + purple(s.tags.map(t => '#' + t).join(' ')));
|
|
135
|
+
console.log(' ' + chalk.gray('install: ') + chalk.cyan(`/pg-fetch ${s.id}`));
|
|
120
136
|
console.log();
|
|
121
|
-
}
|
|
137
|
+
});
|
|
122
138
|
|
|
139
|
+
console.log(' ' + chalk.gray('─'.repeat(50)));
|
|
123
140
|
if (totalPages > 1) {
|
|
124
141
|
const nav = [];
|
|
125
|
-
if (page > 1) nav.push(`${bin} marketplace ${page - 1}`);
|
|
126
|
-
if (page < totalPages) nav.push(`${bin} marketplace ${page + 1}`);
|
|
127
|
-
console.log(
|
|
142
|
+
if (page > 1) nav.push(chalk.cyan(`${bin} marketplace ${page - 1}`) + chalk.gray(' ‹ prev'));
|
|
143
|
+
if (page < totalPages) nav.push(chalk.gray('next › ') + chalk.cyan(`${bin} marketplace ${page + 1}`));
|
|
144
|
+
console.log(' ' + nav.join(' '));
|
|
128
145
|
}
|
|
129
|
-
console.log(chalk.gray('
|
|
146
|
+
console.log(' ' + chalk.gray('publish a skill: ') + chalk.cyan('/pg-publish <file.md>') + chalk.gray(' (via your AI assistant)'));
|
|
147
|
+
console.log();
|
|
130
148
|
process.exit(0);
|
|
131
149
|
}
|
|
132
150
|
|