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.
- package/github-import.js +11 -7
- 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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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}...`);
|