nexrall-code 0.5.163 → 0.5.164
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 +38 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -173092,6 +173092,17 @@ function killJob(job, dir = bgDir()) {
|
|
|
173092
173092
|
}
|
|
173093
173093
|
}
|
|
173094
173094
|
}
|
|
173095
|
+
function removeJob(job, dir = bgDir()) {
|
|
173096
|
+
if (job.state === "running")
|
|
173097
|
+
return { ok: false, error: `Job ${job.id} is still running \u2014 stop it first (nex kill ${job.id}).` };
|
|
173098
|
+
for (const suffix of [".json", ".log", ".code", ".killed"]) {
|
|
173099
|
+
try {
|
|
173100
|
+
fs25.rmSync(path25.join(dir, job.id + suffix), { force: true });
|
|
173101
|
+
} catch {
|
|
173102
|
+
}
|
|
173103
|
+
}
|
|
173104
|
+
return { ok: true };
|
|
173105
|
+
}
|
|
173095
173106
|
var ago = (t2) => {
|
|
173096
173107
|
const s2 = Math.max(0, Math.round((Date.now() - t2) / 1e3));
|
|
173097
173108
|
return s2 < 90 ? `${s2}s` : s2 < 5400 ? `${Math.round(s2 / 60)}m` : `${Math.round(s2 / 3600)}h`;
|
|
@@ -173467,6 +173478,33 @@ program2.command("attach <id>").description("Watch a background job live, readab
|
|
|
173467
173478
|
}
|
|
173468
173479
|
process.exit(await followLog(r2.job, true, void 0, void 0, true));
|
|
173469
173480
|
});
|
|
173481
|
+
program2.command("stop <id>").description("Stop a running background job (same as kill; matches Claude Code's name)").action((id) => {
|
|
173482
|
+
const r2 = resolveJob(id);
|
|
173483
|
+
if (!r2.ok) {
|
|
173484
|
+
console.error(r2.error);
|
|
173485
|
+
process.exit(1);
|
|
173486
|
+
}
|
|
173487
|
+
if (!killJob(r2.job)) {
|
|
173488
|
+
console.error(`Job ${r2.job.id} is not running (${r2.job.state}).`);
|
|
173489
|
+
process.exit(1);
|
|
173490
|
+
}
|
|
173491
|
+
console.log(`Stopped job ${r2.job.id}`);
|
|
173492
|
+
process.exit(0);
|
|
173493
|
+
});
|
|
173494
|
+
program2.command("rm <id>").description("Delete a finished background job's records (log included)").action((id) => {
|
|
173495
|
+
const r2 = resolveJob(id);
|
|
173496
|
+
if (!r2.ok) {
|
|
173497
|
+
console.error(r2.error);
|
|
173498
|
+
process.exit(1);
|
|
173499
|
+
}
|
|
173500
|
+
const res = removeJob(r2.job);
|
|
173501
|
+
if (!res.ok) {
|
|
173502
|
+
console.error(res.error);
|
|
173503
|
+
process.exit(1);
|
|
173504
|
+
}
|
|
173505
|
+
console.log(`Removed job ${r2.job.id}`);
|
|
173506
|
+
process.exit(0);
|
|
173507
|
+
});
|
|
173470
173508
|
program2.command("kill <id>").description("Stop a background job").action((id) => {
|
|
173471
173509
|
const r2 = resolveJob(id);
|
|
173472
173510
|
if (!r2.ok) {
|