agentloom 0.1.1 → 0.1.2
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/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ export async function runCli(argv) {
|
|
|
54
54
|
await runRoutedCommand(route, parsed, cwd, command);
|
|
55
55
|
if (shouldBootstrapManageAgents) {
|
|
56
56
|
const bootstrapArgs = buildManageAgentsBootstrapArgs(parsed, cwd);
|
|
57
|
-
await
|
|
57
|
+
await runSkillCommand(parseArgs(bootstrapArgs), cwd);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function printHelp() {
|
|
@@ -5,4 +5,5 @@ type MaybeNotifyOptions = {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function maybeNotifyVersionUpdate(options: MaybeNotifyOptions): Promise<void>;
|
|
7
7
|
export declare function isNewerVersion(candidate: string, current: string): boolean;
|
|
8
|
+
export declare function promptAndUpdate(current: string, latest: string): Promise<"updated" | "declined" | "failed">;
|
|
8
9
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
1
2
|
import fs from "node:fs";
|
|
2
3
|
import https from "node:https";
|
|
3
4
|
import os from "node:os";
|
|
4
5
|
import path from "node:path";
|
|
6
|
+
import { confirm, isCancel } from "@clack/prompts";
|
|
5
7
|
import { ensureDir, writeJsonAtomic } from "./fs.js";
|
|
6
8
|
const UPDATE_CACHE_PATH = path.join(os.homedir(), ".agents", ".agentloom-version-cache.json");
|
|
7
9
|
const CHECK_INTERVAL_MS = 12 * 60 * 60 * 1000;
|
|
@@ -25,7 +27,7 @@ export async function maybeNotifyVersionUpdate(options) {
|
|
|
25
27
|
if (cache.latestVersion &&
|
|
26
28
|
isNewerVersion(cache.latestVersion, options.currentVersion) &&
|
|
27
29
|
cache.lastNotifiedVersion !== cache.latestVersion) {
|
|
28
|
-
|
|
30
|
+
await promptAndUpdate(options.currentVersion, cache.latestVersion);
|
|
29
31
|
cache.lastNotifiedVersion = cache.latestVersion;
|
|
30
32
|
writeVersionCache(cache);
|
|
31
33
|
}
|
|
@@ -44,7 +46,7 @@ export async function maybeNotifyVersionUpdate(options) {
|
|
|
44
46
|
cache.latestVersion = latest;
|
|
45
47
|
if (isNewerVersion(latest, options.currentVersion) &&
|
|
46
48
|
cache.lastNotifiedVersion !== latest) {
|
|
47
|
-
|
|
49
|
+
await promptAndUpdate(options.currentVersion, latest);
|
|
48
50
|
cache.lastNotifiedVersion = latest;
|
|
49
51
|
}
|
|
50
52
|
writeVersionCache(cache);
|
|
@@ -109,8 +111,24 @@ function fetchLatestVersion(packageName) {
|
|
|
109
111
|
req.on("error", () => resolve(null));
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
+
export async function promptAndUpdate(current, latest) {
|
|
115
|
+
const accepted = await confirm({
|
|
116
|
+
message: `Update available: ${current} → ${latest}. Update now?`,
|
|
117
|
+
initialValue: true,
|
|
118
|
+
});
|
|
119
|
+
if (isCancel(accepted) || !accepted)
|
|
120
|
+
return "declined";
|
|
121
|
+
console.log(`\nUpdating agentloom to ${latest}...\n`);
|
|
122
|
+
const result = spawnSync("npm", ["i", "-g", "agentloom"], {
|
|
123
|
+
stdio: "inherit",
|
|
124
|
+
});
|
|
125
|
+
if (result.status === 0) {
|
|
126
|
+
console.log(`\nUpdated to ${latest}. Please re-run your command.\n`);
|
|
127
|
+
process.exit(0);
|
|
128
|
+
return "updated"; // unreachable, but satisfies type checker
|
|
129
|
+
}
|
|
130
|
+
console.error(`\nUpdate failed. You can update manually: npm i -g agentloom\n`);
|
|
131
|
+
return "failed";
|
|
114
132
|
}
|
|
115
133
|
function readVersionCache() {
|
|
116
134
|
try {
|