pi-gsd 1.11.3 → 1.11.4
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.
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
import { execSync } from "node:child_process";
|
|
20
20
|
import {
|
|
21
21
|
existsSync,
|
|
22
|
+
lstatSync,
|
|
22
23
|
mkdirSync,
|
|
23
24
|
readFileSync,
|
|
25
|
+
rmSync,
|
|
24
26
|
statSync,
|
|
25
27
|
symlinkSync,
|
|
26
28
|
writeFileSync,
|
|
@@ -38,7 +40,20 @@ import type { ContextUsage, ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
|
38
40
|
const ensureHarnessSymlink = (cwd: string): void => {
|
|
39
41
|
try {
|
|
40
42
|
const dest = join(cwd, ".pi", "gsd");
|
|
41
|
-
|
|
43
|
+
// If dest exists, verify it's a valid symlink with files inside.
|
|
44
|
+
// A stale real directory (from old build or worktree) must be replaced.
|
|
45
|
+
if (existsSync(dest)) {
|
|
46
|
+
try {
|
|
47
|
+
const stat = statSync(dest);
|
|
48
|
+
if (stat.isSymbolicLink?.() || lstatSync(dest).isSymbolicLink()) return; // valid symlink, done
|
|
49
|
+
// Real directory — check if it has the expected files
|
|
50
|
+
if (existsSync(join(dest, "workflows", "execute-phase.md"))) return; // looks complete
|
|
51
|
+
// Stale/incomplete directory — remove and replace with symlink
|
|
52
|
+
rmSync(dest, { recursive: true, force: true });
|
|
53
|
+
} catch {
|
|
54
|
+
return; // can't inspect, leave it
|
|
55
|
+
}
|
|
56
|
+
}
|
|
42
57
|
|
|
43
58
|
// Walk up from this extension file to the package root:
|
|
44
59
|
// <pkg>/.gsd/extensions/pi-gsd-hooks.ts → <pkg>
|