claude-task-worker 0.85.0 → 0.87.0
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/index.js +47 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4243,6 +4243,15 @@ init_run_command();
|
|
|
4243
4243
|
var PLUGIN_NAME = "claude-task-worker";
|
|
4244
4244
|
var MARKETPLACE_NAME = "claude-task-worker";
|
|
4245
4245
|
var MARKETPLACE_SOURCE = "getty104/claude-task-worker";
|
|
4246
|
+
var GLOBAL_NPM_PACKAGES = [PLUGIN_NAME, CODEGRAPH_PACKAGE, DESIGN_MD_PACKAGE, PEN_PACKAGE];
|
|
4247
|
+
async function printGlobalPackageVersions(logPrefix) {
|
|
4248
|
+
console.log(`[${logPrefix}] Installed versions:`);
|
|
4249
|
+
try {
|
|
4250
|
+
await runCommand("npm", ["ls", "-g", "--depth=0", ...GLOBAL_NPM_PACKAGES]);
|
|
4251
|
+
} catch (err) {
|
|
4252
|
+
console.error(`[${logPrefix}] Some packages are missing from the global install: ${err.message}`);
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4246
4255
|
async function addMarketplace() {
|
|
4247
4256
|
console.log(`[install] Adding marketplace: ${MARKETPLACE_SOURCE}...`);
|
|
4248
4257
|
try {
|
|
@@ -4284,6 +4293,7 @@ async function install() {
|
|
|
4284
4293
|
const codegraphOk = await installCodegraphCli("install");
|
|
4285
4294
|
const designMdOk = await installDesignMdCli("install");
|
|
4286
4295
|
const penOk = await installPenCli("install");
|
|
4296
|
+
await printGlobalPackageVersions("install");
|
|
4287
4297
|
if (!pluginOk || !cliOk || !codegraphOk || !designMdOk || !penOk) {
|
|
4288
4298
|
process.exitCode = 1;
|
|
4289
4299
|
}
|
|
@@ -4502,6 +4512,7 @@ async function update() {
|
|
|
4502
4512
|
const codegraphOk = await upgradeCodegraphCli("update");
|
|
4503
4513
|
const designMdOk = await installDesignMdCli("update");
|
|
4504
4514
|
const penOk = await installPenCli("update");
|
|
4515
|
+
await printGlobalPackageVersions("update");
|
|
4505
4516
|
if (!marketplaceOk || !pluginOk || !cliOk || !codegraphOk || !designMdOk || !penOk) {
|
|
4506
4517
|
process.exitCode = 1;
|
|
4507
4518
|
}
|
|
@@ -4512,12 +4523,43 @@ async function update() {
|
|
|
4512
4523
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
4513
4524
|
import { dirname as dirname3, join as join8 } from "node:path";
|
|
4514
4525
|
import { fileURLToPath } from "node:url";
|
|
4515
|
-
|
|
4526
|
+
import { styleText } from "node:util";
|
|
4527
|
+
var REGISTRY_URL = "https://registry.npmjs.org/claude-task-worker/latest";
|
|
4528
|
+
var FETCH_TIMEOUT_MS = 3e3;
|
|
4529
|
+
function localVersion() {
|
|
4516
4530
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
4517
4531
|
const pkgPath = join8(here, "..", "package.json");
|
|
4532
|
+
const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
|
|
4533
|
+
return pkg.version ?? "unknown";
|
|
4534
|
+
}
|
|
4535
|
+
function isOutdated(current, latest) {
|
|
4536
|
+
const parse = (v) => v.split("-")[0].split(".").map(Number);
|
|
4537
|
+
const a = parse(current);
|
|
4538
|
+
const b = parse(latest);
|
|
4539
|
+
for (let i = 0; i < 3; i++) {
|
|
4540
|
+
const x = a[i] ?? 0;
|
|
4541
|
+
const y = b[i] ?? 0;
|
|
4542
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) return false;
|
|
4543
|
+
if (x !== y) return y > x;
|
|
4544
|
+
}
|
|
4545
|
+
return false;
|
|
4546
|
+
}
|
|
4547
|
+
async function notifyIfOutdated() {
|
|
4548
|
+
try {
|
|
4549
|
+
const current = localVersion();
|
|
4550
|
+
const res = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
|
|
4551
|
+
if (!res.ok) return;
|
|
4552
|
+
const { version: latest } = await res.json();
|
|
4553
|
+
if (!latest || !isOutdated(current, latest)) return;
|
|
4554
|
+
console.log(
|
|
4555
|
+
styleText("yellow", "[update] A new version of claude-task-worker is available: ") + styleText("dim", current) + styleText("yellow", " -> ") + styleText(["green", "bold"], latest) + styleText("yellow", ". Run ") + styleText("cyan", '"claude-task-worker update"') + styleText("yellow", " to update.")
|
|
4556
|
+
);
|
|
4557
|
+
} catch {
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
function version() {
|
|
4518
4561
|
try {
|
|
4519
|
-
|
|
4520
|
-
console.log(pkg.version ?? "unknown");
|
|
4562
|
+
console.log(localVersion());
|
|
4521
4563
|
} catch (err) {
|
|
4522
4564
|
console.error(`[version] Failed to read version: ${err.message}`);
|
|
4523
4565
|
process.exitCode = 1;
|
|
@@ -4661,8 +4703,10 @@ Example:
|
|
|
4661
4703
|
var workerType = process.argv[2];
|
|
4662
4704
|
if (workerType === "version" || workerType === "--version" || workerType === "-v") {
|
|
4663
4705
|
version();
|
|
4706
|
+
await notifyIfOutdated();
|
|
4664
4707
|
process.exit(process.exitCode ?? 0);
|
|
4665
4708
|
}
|
|
4709
|
+
void notifyIfOutdated();
|
|
4666
4710
|
if (!workerType) {
|
|
4667
4711
|
printUsage();
|
|
4668
4712
|
process.exit(1);
|