@harperfast/agent 0.11.2 → 0.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.
- package/dist/agent.js +23 -0
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -682,7 +682,10 @@ import chalk4 from "chalk";
|
|
|
682
682
|
import { existsSync as existsSync3 } from "fs";
|
|
683
683
|
import { join as join5 } from "path";
|
|
684
684
|
function sayHi() {
|
|
685
|
+
const pkg = getOwnPackageJson();
|
|
686
|
+
const packageVersion = pkg.version;
|
|
685
687
|
const harperAppExists = existsSync3(join5(trackedState.cwd, "config.yaml"));
|
|
688
|
+
console.log(chalk4.dim(`Version: ${chalk4.cyan(packageVersion)}`) + ` ${chalk4.redBright("ALPHA")}`);
|
|
686
689
|
console.log(chalk4.dim(`Working directory: ${chalk4.cyan(trackedState.cwd)}`));
|
|
687
690
|
console.log(chalk4.dim(`Harper app detected: ${chalk4.cyan(harperAppExists ? "Yes" : "No")}`));
|
|
688
691
|
console.log(chalk4.dim(`Press Ctrl+C or hit enter twice to exit.
|
|
@@ -2157,6 +2160,26 @@ A new version of ${chalk10.bold(packageName)} is available! (${chalk10.dim(packa
|
|
|
2157
2160
|
);
|
|
2158
2161
|
console.log(`Automatically updating to the latest version...
|
|
2159
2162
|
`);
|
|
2163
|
+
let isGlobal = false;
|
|
2164
|
+
try {
|
|
2165
|
+
const globalRootResult = spawn3.sync("npm", ["root", "-g"], {
|
|
2166
|
+
encoding: "utf8"
|
|
2167
|
+
});
|
|
2168
|
+
const globalRoot = globalRootResult.stdout?.trim();
|
|
2169
|
+
if (globalRoot && process.argv[1] && process.argv[1].startsWith(globalRoot)) {
|
|
2170
|
+
isGlobal = true;
|
|
2171
|
+
}
|
|
2172
|
+
} catch {
|
|
2173
|
+
}
|
|
2174
|
+
if (isGlobal) {
|
|
2175
|
+
spawn3.sync("npm", ["install", "-g", `${packageName}@latest`], {
|
|
2176
|
+
stdio: "inherit"
|
|
2177
|
+
});
|
|
2178
|
+
const result2 = spawn3.sync("harper-agent", process.argv.slice(2), {
|
|
2179
|
+
stdio: "inherit"
|
|
2180
|
+
});
|
|
2181
|
+
process.exit(result2.status ?? 0);
|
|
2182
|
+
}
|
|
2160
2183
|
const lsResult = spawn3.sync("npm", ["cache", "npx", "ls", packageName], {
|
|
2161
2184
|
encoding: "utf8"
|
|
2162
2185
|
});
|