@selesai/code 0.1.8 → 0.1.10
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.
|
@@ -63,6 +63,18 @@ export function resolveWindowsPiCliScript(deps: PiSpawnDeps = {}): string | unde
|
|
|
63
63
|
|
|
64
64
|
if (argv1) {
|
|
65
65
|
const argvPath = normalizePath(argv1);
|
|
66
|
+
// Resolve symlinks before checking the extension: a renamed fork like
|
|
67
|
+
// "selesai" is typically a symlink to dist/cli.js, so the raw argv1 has
|
|
68
|
+
// no .js extension and would otherwise fail the runnable-script check.
|
|
69
|
+
let resolved = argvPath;
|
|
70
|
+
try {
|
|
71
|
+
resolved = fs.realpathSync(argvPath);
|
|
72
|
+
} catch {
|
|
73
|
+
// realpath is best-effort; fall back to the raw path.
|
|
74
|
+
}
|
|
75
|
+
if (isRunnableNodeScript(resolved, existsSync)) {
|
|
76
|
+
return resolved;
|
|
77
|
+
}
|
|
66
78
|
if (isRunnableNodeScript(argvPath, existsSync)) {
|
|
67
79
|
return argvPath;
|
|
68
80
|
}
|
|
@@ -100,16 +112,18 @@ export function resolveWindowsPiCliScript(deps: PiSpawnDeps = {}): string | unde
|
|
|
100
112
|
}
|
|
101
113
|
|
|
102
114
|
export function getPiSpawnCommand(args: string[], deps: PiSpawnDeps = {}): PiSpawnCommand {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
115
|
+
// On all platforms, prefer the running CLI script (process.argv[1]) so a
|
|
116
|
+
// renamed fork like "selesai" spawns its own binary instead of the upstream
|
|
117
|
+
// "pi" from PATH (which has a different agent dir / providers / auth).
|
|
118
|
+
const piCliPath = resolveWindowsPiCliScript(deps);
|
|
119
|
+
if (piCliPath) {
|
|
120
|
+
return {
|
|
121
|
+
command: deps.execPath ?? process.execPath,
|
|
122
|
+
args: [piCliPath, ...args],
|
|
123
|
+
};
|
|
112
124
|
}
|
|
113
125
|
|
|
126
|
+
// Fall back to the upstream binary name only if the CLI script could not be
|
|
127
|
+
// resolved. "pi" remains the historical default for stock pi installs.
|
|
114
128
|
return { command: "pi", args };
|
|
115
129
|
}
|