promptgraph-mcp 2.0.3 → 2.0.5
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/github-import.js +20 -0
- package/index.js +2 -2
- package/package.json +1 -1
package/github-import.js
CHANGED
|
@@ -2,10 +2,25 @@ import { spawnSync } from 'child_process';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
+
import https from 'https';
|
|
5
6
|
import { globSync } from 'glob';
|
|
6
7
|
import { indexAll } from './indexer.js';
|
|
7
8
|
import { loadConfig, saveConfig, SKILLS_STORE_DIR } from './config.js';
|
|
8
9
|
|
|
10
|
+
function repoExists(repoUrl) {
|
|
11
|
+
const owner_repo = repoUrl.startsWith('http')
|
|
12
|
+
? repoUrl.replace(/^https?:\/\/github\.com\//, '').replace(/\.git$/, '')
|
|
13
|
+
: repoUrl;
|
|
14
|
+
return new Promise(resolve => {
|
|
15
|
+
const req = https.request(
|
|
16
|
+
{ host: 'github.com', path: `/${owner_repo}`, method: 'HEAD', headers: { 'User-Agent': 'promptgraph-mcp' } },
|
|
17
|
+
res => resolve(res.statusCode < 400)
|
|
18
|
+
);
|
|
19
|
+
req.on('error', () => resolve(false));
|
|
20
|
+
req.end();
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
9
24
|
// Directories likely to contain skills — checked in priority order
|
|
10
25
|
const SKILL_DIRS = ['skills', 'commands', 'prompts', 'agents', 'skills-store', 'slash-commands', 'custom-commands', 'templates'];
|
|
11
26
|
|
|
@@ -33,6 +48,11 @@ export async function importFromGitHub(repoUrl) {
|
|
|
33
48
|
const repoName = url.split('/').slice(-2).join('-').replace('.git', '');
|
|
34
49
|
const dest = path.join(SKILLS_STORE_DIR, 'github', repoName);
|
|
35
50
|
|
|
51
|
+
if (!fs.existsSync(dest)) {
|
|
52
|
+
const exists = await repoExists(repoUrl);
|
|
53
|
+
if (!exists) throw new Error(`Repository not found (404): ${url}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
36
56
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
37
57
|
|
|
38
58
|
if (fs.existsSync(dest)) {
|
package/index.js
CHANGED
|
@@ -417,9 +417,9 @@ if (args[0] === 'update') {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
info(`Current: ${chalk.gray('v' + currentVersion)} → Latest: ${chalk.white.bold('v' + latest)}`);
|
|
420
|
-
const updateSpin = (await import('./cli.js')).spinner(`Installing promptgraph-mcp
|
|
420
|
+
const updateSpin = (await import('./cli.js')).spinner(`Installing promptgraph-mcp@latest (v${latest})...`);
|
|
421
421
|
updateSpin.start();
|
|
422
|
-
const result = spawnSync('npm', ['install', '-g',
|
|
422
|
+
const result = spawnSync('npm', ['install', '-g', 'promptgraph-mcp@latest'], { encoding: 'utf8', stdio: 'pipe', shell: true });
|
|
423
423
|
updateSpin.stop();
|
|
424
424
|
|
|
425
425
|
if (result.status !== 0) {
|