@harperfast/agent 0.11.2 → 0.11.3
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/dist/agent.js +20 -0
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -2157,6 +2157,26 @@ A new version of ${chalk10.bold(packageName)} is available! (${chalk10.dim(packa
|
|
|
2157
2157
|
);
|
|
2158
2158
|
console.log(`Automatically updating to the latest version...
|
|
2159
2159
|
`);
|
|
2160
|
+
let isGlobal = false;
|
|
2161
|
+
try {
|
|
2162
|
+
const globalRootResult = spawn3.sync("npm", ["root", "-g"], {
|
|
2163
|
+
encoding: "utf8"
|
|
2164
|
+
});
|
|
2165
|
+
const globalRoot = globalRootResult.stdout?.trim();
|
|
2166
|
+
if (globalRoot && process.argv[1] && process.argv[1].startsWith(globalRoot)) {
|
|
2167
|
+
isGlobal = true;
|
|
2168
|
+
}
|
|
2169
|
+
} catch {
|
|
2170
|
+
}
|
|
2171
|
+
if (isGlobal) {
|
|
2172
|
+
spawn3.sync("npm", ["install", "-g", `${packageName}@latest`], {
|
|
2173
|
+
stdio: "inherit"
|
|
2174
|
+
});
|
|
2175
|
+
const result2 = spawn3.sync("harper-agent", process.argv.slice(2), {
|
|
2176
|
+
stdio: "inherit"
|
|
2177
|
+
});
|
|
2178
|
+
process.exit(result2.status ?? 0);
|
|
2179
|
+
}
|
|
2160
2180
|
const lsResult = spawn3.sync("npm", ["cache", "npx", "ls", packageName], {
|
|
2161
2181
|
encoding: "utf8"
|
|
2162
2182
|
});
|