promptgraph-mcp 2.0.8 → 2.0.9

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 +11 -7
  2. package/package.json +1 -1
package/github-import.js CHANGED
@@ -57,13 +57,17 @@ export async function importFromGitHub(repoUrl) {
57
57
 
58
58
  if (fs.existsSync(dest)) {
59
59
  console.log(`Updating ${repoName}...`);
60
- const pullResult = spawnSync('git', ['-C', dest, 'pull', '--depth=1'], { stdio: 'inherit' });
61
- if (pullResult.status !== 0) {
62
- // Force-push or unrelated histories re-clone from scratch
63
- console.log(`Pull failed (force-push?), re-cloning ${repoName}...`);
64
- fs.rmSync(dest, { recursive: true, force: true });
65
- const cloneResult = spawnSync('git', ['clone', '--depth=1', url, dest], { stdio: 'inherit' });
66
- if (cloneResult.status !== 0) throw new Error(`git clone failed for ${url}`);
60
+ // fetch + reset handles force-pushes and unrelated histories without re-cloning
61
+ const fetch = spawnSync('git', ['-C', dest, 'fetch', '--depth=1', 'origin'], { stdio: 'inherit' });
62
+ if (fetch.status !== 0) throw new Error(`git fetch failed for ${repoName}`);
63
+ const reset = spawnSync('git', ['-C', dest, 'reset', '--hard', 'origin/HEAD'], { stdio: 'pipe' });
64
+ if (reset.status !== 0) {
65
+ // fallback: try origin/main then origin/master
66
+ const main = spawnSync('git', ['-C', dest, 'reset', '--hard', 'origin/main'], { stdio: 'pipe' });
67
+ if (main.status !== 0) {
68
+ const master = spawnSync('git', ['-C', dest, 'reset', '--hard', 'origin/master'], { stdio: 'inherit' });
69
+ if (master.status !== 0) throw new Error(`git reset failed for ${repoName}`);
70
+ }
67
71
  }
68
72
  } else {
69
73
  console.log(`Cloning ${url}...`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "bin": {