promptgraph-mcp 2.9.34 → 2.9.35
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 +26 -5
- package/package.json +1 -1
package/github-import.js
CHANGED
|
@@ -253,9 +253,13 @@ function sparseClone(url, dest, subdir) {
|
|
|
253
253
|
if (git(['init'], dest, 'pipe').status !== 0) return false;
|
|
254
254
|
if (git(['remote', 'add', 'origin', url], dest, 'pipe').status !== 0) return false;
|
|
255
255
|
|
|
256
|
-
// 2. sparse-checkout — non-cone mode with *.md
|
|
256
|
+
// 2. sparse-checkout — non-cone mode with *.md + script files
|
|
257
257
|
git(['sparse-checkout', 'init'], dest, 'pipe');
|
|
258
|
-
git(['sparse-checkout', 'set', '--no-cone',
|
|
258
|
+
git(['sparse-checkout', 'set', '--no-cone',
|
|
259
|
+
`${subdir}/*.md`, `${subdir}/**/*.md`,
|
|
260
|
+
`${subdir}/**/*.py`, `${subdir}/**/*.sh`, `${subdir}/**/*.js`,
|
|
261
|
+
`${subdir}/**/*.ts`, `${subdir}/**/*.rb`, `${subdir}/**/*.bash`,
|
|
262
|
+
], dest, 'pipe');
|
|
259
263
|
|
|
260
264
|
// 3. fetch + checkout (depth=1, skip large blobs)
|
|
261
265
|
const fetch = git(['fetch', '--depth=1', '--filter=blob:none', 'origin'], dest);
|
|
@@ -363,7 +367,11 @@ function sparseUpdate(dest, subdir) {
|
|
|
363
367
|
const fetch = git(['fetch', '--depth=1', 'origin'], dest);
|
|
364
368
|
if (fetch.status !== 0) return false;
|
|
365
369
|
|
|
366
|
-
git(['sparse-checkout', 'set', '--no-cone',
|
|
370
|
+
git(['sparse-checkout', 'set', '--no-cone',
|
|
371
|
+
`${subdir}/*.md`, `${subdir}/**/*.md`,
|
|
372
|
+
`${subdir}/**/*.py`, `${subdir}/**/*.sh`, `${subdir}/**/*.js`,
|
|
373
|
+
`${subdir}/**/*.ts`, `${subdir}/**/*.rb`, `${subdir}/**/*.bash`,
|
|
374
|
+
], dest, 'pipe');
|
|
367
375
|
|
|
368
376
|
for (const ref of ['origin/main', 'origin/master']) {
|
|
369
377
|
const r = git(['checkout', ref], dest, 'pipe');
|
|
@@ -376,7 +384,17 @@ function sparseUpdate(dest, subdir) {
|
|
|
376
384
|
|
|
377
385
|
// After checkout, force materialization of sparse-matched files.
|
|
378
386
|
function finalizeCheckout(dest, success) {
|
|
379
|
-
if (success)
|
|
387
|
+
if (success) {
|
|
388
|
+
forceMaterialize(dest);
|
|
389
|
+
// Make scripts executable on unix
|
|
390
|
+
if (process.platform !== 'win32') {
|
|
391
|
+
const scriptExts = ['.py', '.sh', '.bash', '.rb'];
|
|
392
|
+
try {
|
|
393
|
+
const scripts = globSync(`${dest}/**/*{${scriptExts.join(',')}}`, { absolute: true });
|
|
394
|
+
for (const s of scripts) { try { fs.chmodSync(s, 0o755); } catch {} }
|
|
395
|
+
} catch {}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
380
398
|
return success;
|
|
381
399
|
}
|
|
382
400
|
|
|
@@ -396,7 +414,10 @@ function fullClone(url, dest) {
|
|
|
396
414
|
if (git(['init'], dest, 'pipe').status !== 0) return false;
|
|
397
415
|
if (git(['remote', 'add', 'origin', url], dest, 'pipe').status !== 0) return false;
|
|
398
416
|
git(['sparse-checkout', 'init'], dest, 'pipe');
|
|
399
|
-
git(['sparse-checkout', 'set', '--no-cone',
|
|
417
|
+
git(['sparse-checkout', 'set', '--no-cone',
|
|
418
|
+
'*.md', '**/*.md',
|
|
419
|
+
'**/*.py', '**/*.sh', '**/*.js', '**/*.ts', '**/*.rb', '**/*.bash',
|
|
420
|
+
], dest, 'pipe');
|
|
400
421
|
const fetch = git(['fetch', '--depth=1', '--filter=blob:none', 'origin'], dest);
|
|
401
422
|
if (fetch.status !== 0) return false;
|
|
402
423
|
for (const branch of ['FETCH_HEAD', 'main', 'master']) {
|