@kendoo.agentdesk/agentdesk 0.5.2 → 0.5.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/bin/agentdesk.mjs +42 -16
- package/package.json +1 -1
package/bin/agentdesk.mjs
CHANGED
|
@@ -10,26 +10,39 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
10
10
|
const __dirname = dirname(__filename);
|
|
11
11
|
const pkg = JSON.parse(readFileSync(join(__dirname, "../package.json"), "utf-8"));
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const command = args[0];
|
|
15
|
+
|
|
16
|
+
// Blocking update check — require update for major/minor bumps, warn for patches
|
|
17
|
+
if (command !== "update") {
|
|
15
18
|
try {
|
|
16
19
|
const res = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, { signal: AbortSignal.timeout(3000) });
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
if (res.ok) {
|
|
21
|
+
const { version } = await res.json();
|
|
22
|
+
if (version !== pkg.version) {
|
|
23
|
+
const [curMajor, curMinor] = pkg.version.split(".").map(Number);
|
|
24
|
+
const [latMajor, latMinor] = version.split(".").map(Number);
|
|
25
|
+
const breaking = latMajor > curMajor || latMinor > curMinor;
|
|
26
|
+
|
|
27
|
+
const dim = "\x1b[2m";
|
|
28
|
+
const red = "\x1b[31m";
|
|
29
|
+
const yellow = "\x1b[33m";
|
|
30
|
+
const green = "\x1b[32m";
|
|
31
|
+
const cyan = "\x1b[36m";
|
|
32
|
+
const reset = "\x1b[0m";
|
|
33
|
+
|
|
34
|
+
if (breaking) {
|
|
35
|
+
console.log(`\n ${red}Update required:${reset} ${dim}${pkg.version}${reset} → ${green}${version}${reset}`);
|
|
36
|
+
console.log(` Run: ${cyan}agentdesk update${reset}\n`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
} else {
|
|
39
|
+
console.log(`\n ${yellow}Update available:${reset} ${dim}${pkg.version}${reset} → ${green}${version}${reset}`);
|
|
40
|
+
console.log(` Run: ${cyan}agentdesk update${reset}\n`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
44
|
} catch {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const args = process.argv.slice(2);
|
|
32
|
-
const command = args[0];
|
|
45
|
+
}
|
|
33
46
|
|
|
34
47
|
if (!command || command === "help" || command === "--help") {
|
|
35
48
|
console.log(`
|
|
@@ -46,6 +59,7 @@ if (!command || command === "help" || command === "--help") {
|
|
|
46
59
|
agentdesk init Set up project and configure tracker
|
|
47
60
|
agentdesk team <TASK-ID> Run a team session on an existing task
|
|
48
61
|
agentdesk team -d "..." Create a task and run a session
|
|
62
|
+
agentdesk update Update to the latest version
|
|
49
63
|
|
|
50
64
|
Options:
|
|
51
65
|
--description, -d Task description or requirements
|
|
@@ -112,6 +126,18 @@ else if (command === "team") {
|
|
|
112
126
|
process.exit(code);
|
|
113
127
|
}
|
|
114
128
|
|
|
129
|
+
else if (command === "update") {
|
|
130
|
+
const { execSync } = await import("child_process");
|
|
131
|
+
console.log(`\n Updating ${pkg.name}...\n`);
|
|
132
|
+
try {
|
|
133
|
+
execSync(`npm i -g ${pkg.name}@latest`, { stdio: "inherit" });
|
|
134
|
+
console.log(`\n Updated successfully.\n`);
|
|
135
|
+
} catch {
|
|
136
|
+
console.error(`\n Update failed. Try manually: npm i -g ${pkg.name}@latest\n`);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
115
141
|
else if (command === "server") {
|
|
116
142
|
try {
|
|
117
143
|
await import("../server/index.mjs");
|