@slayzone/cli 0.39.0 → 0.40.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/slay.js +59 -5
- package/package.json +1 -1
package/dist/slay.js
CHANGED
|
@@ -17530,7 +17530,12 @@ ${t.description}`);
|
|
|
17530
17530
|
// src/commands/tasks/done.ts
|
|
17531
17531
|
async function doneAction(idPrefix, opts) {
|
|
17532
17532
|
idPrefix = await resolveId(idPrefix);
|
|
17533
|
-
const { data: task } = await apiPost(`/api/tasks/${encodeURIComponent(idPrefix)}/done`,
|
|
17533
|
+
const { data: task } = await apiPost(`/api/tasks/${encodeURIComponent(idPrefix)}/done`, {
|
|
17534
|
+
...opts.close ? { close: true } : {},
|
|
17535
|
+
// Completion stops every agent of the task; the hub refuses (409) while one
|
|
17536
|
+
// is mid-reply — this command's own agent included — unless --force.
|
|
17537
|
+
...opts.force ? { force: true } : {}
|
|
17538
|
+
});
|
|
17534
17539
|
console.log(`Done: ${task.id.slice(0, 8)} ${task.title}`);
|
|
17535
17540
|
if (opts.close && !task.closed) {
|
|
17536
17541
|
console.error("Warning: cannot close tab \u2014 no app window attached to this hub");
|
|
@@ -17645,6 +17650,7 @@ async function updateAction(idPrefix, opts) {
|
|
|
17645
17650
|
if (opts.description !== void 0) body.description = opts.description || null;
|
|
17646
17651
|
if (opts.appendDescription !== void 0) body.appendDescription = opts.appendDescription;
|
|
17647
17652
|
if (opts.status !== void 0) body.status = opts.status;
|
|
17653
|
+
if (opts.force) body.force = true;
|
|
17648
17654
|
if (opts.priority) body.priority = parseInt(opts.priority, 10);
|
|
17649
17655
|
if (typeof opts.due === "string") body.dueDate = opts.due;
|
|
17650
17656
|
else if (opts.due === false) body.dueDate = null;
|
|
@@ -23176,7 +23182,10 @@ function tasksCommand() {
|
|
|
23176
23182
|
"Task description (reference task specific artifacts via `[title](artifact:<artifact-id>)`)"
|
|
23177
23183
|
).option("--status <status>", "Initial status key").option("--priority <n>", "Priority 1-5 (1=highest)").option("--due <date>", "Due date (YYYY-MM-DD or ISO 8601)").option("--template <name|id>", "Task template for defaults").option("--external-id <id>", "External ID for deduplication (skips if already exists)").option("--external-provider <provider>", "External provider namespace", "cli").action(createAction);
|
|
23178
23184
|
cmd.command("view [id]").description("Show task details (id prefix supported; defaults to $SLAYZONE_TASK_ID)").action(viewAction);
|
|
23179
|
-
cmd.command("done [id]").description("Mark a task as done (id prefix supported; defaults to $SLAYZONE_TASK_ID)").option("--close", "Also close the task tab in the app").
|
|
23185
|
+
cmd.command("done [id]").description("Mark a task as done (id prefix supported; defaults to $SLAYZONE_TASK_ID)").option("--close", "Also close the task tab in the app").option(
|
|
23186
|
+
"--force",
|
|
23187
|
+
"Complete even while an agent of the task is mid-reply (completion stops every agent)"
|
|
23188
|
+
).action(doneAction);
|
|
23180
23189
|
cmd.command("reset-conversation [id]").description(
|
|
23181
23190
|
"Reset a task's agent session \u2014 the next agent spawn in that tab starts fresh. Sessions are per terminal tab; default = the main tab. Append-only (never deletes)."
|
|
23182
23191
|
).option(
|
|
@@ -23192,6 +23201,9 @@ function tasksCommand() {
|
|
|
23192
23201
|
).option(
|
|
23193
23202
|
"--worktree-path <path>",
|
|
23194
23203
|
"Link a git worktree to this task (auto-derives parent branch + repo from project layout)"
|
|
23204
|
+
).option(
|
|
23205
|
+
"--force",
|
|
23206
|
+
"With a done/canceled --status: complete even while an agent of the task is mid-reply (completion stops every agent)"
|
|
23195
23207
|
).action(updateAction);
|
|
23196
23208
|
cmd.command("progress <idOrValue> [value]").description(
|
|
23197
23209
|
"Set task progress 0-100. Use `<id> <value>` or `<value>` (id defaults to $SLAYZONE_TASK_ID)."
|
|
@@ -47489,7 +47501,7 @@ var import_node_child_process3 = require("node:child_process");
|
|
|
47489
47501
|
var import_node_fs11 = require("node:fs");
|
|
47490
47502
|
var import_node_module = require("node:module");
|
|
47491
47503
|
var import_node_path10 = require("node:path");
|
|
47492
|
-
var CLI_VERSION = true ? "0.
|
|
47504
|
+
var CLI_VERSION = true ? "0.40.0" : "";
|
|
47493
47505
|
function fail(message) {
|
|
47494
47506
|
console.error(message);
|
|
47495
47507
|
process.exit(1);
|
|
@@ -48456,7 +48468,7 @@ function hubComputersRequest(method, path12, body) {
|
|
|
48456
48468
|
);
|
|
48457
48469
|
}
|
|
48458
48470
|
function hubComputersCommand() {
|
|
48459
|
-
const computers = new Command("computers").description("List, revoke and
|
|
48471
|
+
const computers = new Command("computers").description("List, revoke, restore and replace the computers enrolled on a hub (admin)").showHelpAfterError(true);
|
|
48460
48472
|
computers.command("ls").description("List the computers enrolled on a hub (not revoked)").option("--json", "Output as JSON").action(async (opts) => {
|
|
48461
48473
|
const rows = await hubComputersRequest("GET", "/api/computers");
|
|
48462
48474
|
if (opts.json) {
|
|
@@ -48476,6 +48488,15 @@ function hubComputersCommand() {
|
|
|
48476
48488
|
`${r.id.padEnd(idW)} ${r.name.padEnd(nameW)} ${(r.connected ? "yes" : "no").padEnd(9)} ${seen}`
|
|
48477
48489
|
);
|
|
48478
48490
|
}
|
|
48491
|
+
const offers = await hubComputersRequest(
|
|
48492
|
+
"GET",
|
|
48493
|
+
"/api/hub/computers/takeovers"
|
|
48494
|
+
).catch(() => []);
|
|
48495
|
+
if (offers.length > 0)
|
|
48496
|
+
console.log(
|
|
48497
|
+
`
|
|
48498
|
+
A computer holds the chats of an offline computer (enrolled again?): ${offers.length} takeover${offers.length === 1 ? "" : "s"} offered. See \`slay hub computers takeovers\`.`
|
|
48499
|
+
);
|
|
48479
48500
|
});
|
|
48480
48501
|
computers.command("revoke <id>").description("Revoke a computer: drop its connection and refuse its key (reversible)").action(async (id) => {
|
|
48481
48502
|
await hubComputersRequest("PATCH", "/api/hub/computers", { id, revoked: true });
|
|
@@ -48485,6 +48506,39 @@ function hubComputersCommand() {
|
|
|
48485
48506
|
await hubComputersRequest("PATCH", "/api/hub/computers", { id, revoked: false });
|
|
48486
48507
|
console.log(`Restored computer ${id}.`);
|
|
48487
48508
|
});
|
|
48509
|
+
computers.command("takeovers").description("List computers that hold the chats of an offline computer (re-enrolled?)").option("--json", "Output as JSON").action(async (opts) => {
|
|
48510
|
+
const offers = await hubComputersRequest(
|
|
48511
|
+
"GET",
|
|
48512
|
+
"/api/hub/computers/takeovers"
|
|
48513
|
+
);
|
|
48514
|
+
if (opts.json) {
|
|
48515
|
+
console.log(JSON.stringify(offers, null, 2));
|
|
48516
|
+
return;
|
|
48517
|
+
}
|
|
48518
|
+
if (offers.length === 0) {
|
|
48519
|
+
console.log("No computer holds the chats of an offline one.");
|
|
48520
|
+
return;
|
|
48521
|
+
}
|
|
48522
|
+
for (const o of offers) {
|
|
48523
|
+
const chats = `${o.conversations} chat${o.conversations === 1 ? "" : "s"}`;
|
|
48524
|
+
const tasks = `${o.tasks} task${o.tasks === 1 ? "" : "s"}`;
|
|
48525
|
+
console.log(
|
|
48526
|
+
`${o.successor.name} (${o.successor.id}) holds ${chats} in ${tasks} of ${o.former.name} (${o.former.id}), which is offline${o.former.revoked ? " and revoked" : ""}.`
|
|
48527
|
+
);
|
|
48528
|
+
console.log(
|
|
48529
|
+
` If it is that computer enrolled again, replace it: slay hub computers replace ${o.former.id} --with ${o.successor.id}`
|
|
48530
|
+
);
|
|
48531
|
+
}
|
|
48532
|
+
});
|
|
48533
|
+
computers.command("replace <id>").description(
|
|
48534
|
+
"Replace an offline computer with the same machine enrolled again: its tasks, folders and chats move to the successor, and the old one is deleted"
|
|
48535
|
+
).requiredOption("--with <successor-id>", "The computer that takes over (the re-enrolled one)").action(async (id, opts) => {
|
|
48536
|
+
await hubComputersRequest("POST", "/api/hub/computers/replace", {
|
|
48537
|
+
id,
|
|
48538
|
+
successorId: opts.with
|
|
48539
|
+
});
|
|
48540
|
+
console.log(`Replaced computer ${id} with ${opts.with}; ${id} is deleted.`);
|
|
48541
|
+
});
|
|
48488
48542
|
return computers;
|
|
48489
48543
|
}
|
|
48490
48544
|
|
|
@@ -50117,7 +50171,7 @@ function updateCommand() {
|
|
|
50117
50171
|
}
|
|
50118
50172
|
|
|
50119
50173
|
// src/index.ts
|
|
50120
|
-
var program2 = new Command().name("slay").description("SlayZone CLI").version("0.
|
|
50174
|
+
var program2 = new Command().name("slay").description("SlayZone CLI").version("0.40.0").option("--dev", "Use development database (slayzone.dev.data.sqlite)").option("--hub <name|port>", "Target a specific hub on this machine (see `slay hub ls`)").showSuggestionAfterError(true).showHelpAfterError(true).hook("preAction", async (thisCommand) => {
|
|
50121
50175
|
const root = thisCommand.parent ?? thisCommand;
|
|
50122
50176
|
const opts = root.opts();
|
|
50123
50177
|
if (opts.dev) process.env.SLAYZONE_DEV = "1";
|