promptgraph-mcp 2.3.5 → 2.3.6

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.
Files changed (2) hide show
  1. package/github-import.js +18 -8
  2. package/package.json +1 -1
package/github-import.js CHANGED
@@ -81,9 +81,9 @@ function sparseClone(url, dest, subdir) {
81
81
  if (git(['init'], dest, 'pipe').status !== 0) return false;
82
82
  if (git(['remote', 'add', 'origin', url], dest, 'pipe').status !== 0) return false;
83
83
 
84
- // 2. sparse-checkout config
85
- git(['sparse-checkout', 'init', '--cone'], dest, 'pipe');
86
- git(['sparse-checkout', 'set', subdir], dest, 'pipe');
84
+ // 2. sparse-checkout — non-cone mode with *.md glob
85
+ git(['sparse-checkout', 'init'], dest, 'pipe');
86
+ git(['sparse-checkout', 'set', '--no-cone', `${subdir}/*.md`, `${subdir}/**/*.md`], dest, 'pipe');
87
87
 
88
88
  // 3. fetch + checkout (depth=1, skip large blobs)
89
89
  const fetch = git(['fetch', '--depth=1', '--filter=blob:none', 'origin'], dest);
@@ -134,7 +134,7 @@ function sparseUpdate(dest, subdir) {
134
134
  if (fetch.status !== 0) return false;
135
135
 
136
136
  // Ensure sparse-checkout still set correctly
137
- git(['sparse-checkout', 'set', subdir], dest, 'pipe');
137
+ git(['sparse-checkout', 'set', '--no-cone', `${subdir}/*.md`, `${subdir}/**/*.md`], dest, 'pipe');
138
138
 
139
139
  for (const ref of ['origin/HEAD', 'origin/main', 'origin/master']) {
140
140
  const r = git(['reset', '--hard', ref], dest, 'pipe');
@@ -143,8 +143,7 @@ function sparseUpdate(dest, subdir) {
143
143
  return false;
144
144
  }
145
145
 
146
- // Fallback: full clone (when no subdir found)
147
- // --filter=blob:none skips large binaries (images, zips) — only fetches text files
146
+ // Fallback: clone root but only checkout .md files
148
147
  function fullClone(url, dest) {
149
148
  if (fs.existsSync(dest)) {
150
149
  const fetch = git(['fetch', '--depth=1', '--filter=blob:none', 'origin'], dest);
@@ -154,7 +153,19 @@ function fullClone(url, dest) {
154
153
  }
155
154
  return false;
156
155
  }
157
- return git(['clone', '--depth=1', '--filter=blob:none', url, dest]).status === 0;
156
+ // init + sparse *.md + fetch + checkout
157
+ fs.mkdirSync(dest, { recursive: true });
158
+ if (git(['init'], dest, 'pipe').status !== 0) return false;
159
+ if (git(['remote', 'add', 'origin', url], dest, 'pipe').status !== 0) return false;
160
+ git(['sparse-checkout', 'init'], dest, 'pipe');
161
+ git(['sparse-checkout', 'set', '--no-cone', '*.md', '**/*.md'], dest, 'pipe');
162
+ const fetch = git(['fetch', '--depth=1', '--filter=blob:none', 'origin'], dest);
163
+ if (fetch.status !== 0) return false;
164
+ for (const branch of ['FETCH_HEAD', 'main', 'master']) {
165
+ const r = git(['checkout', branch], dest, 'pipe');
166
+ if (r.status === 0) return true;
167
+ }
168
+ return false;
158
169
  }
159
170
 
160
171
  // After clone: detect actual skills dir on disk
@@ -213,7 +224,6 @@ export async function importFromGitHub(repoUrl) {
213
224
  } else {
214
225
  console.log(`no subdir found, cloning root...`);
215
226
  cloneOk = fullClone(url, dest);
216
- if (cloneOk) cleanupRepoRoot(dest);
217
227
  }
218
228
 
219
229
  if (!cloneOk) throw new Error(`Clone failed for ${url}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {