@workser/cli 0.6.13 → 0.6.14
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 +472 -247
- package/package.json +1 -1
- package/skills/workser/SKILL.md +4 -4
- package/skills/workser/reference/cloud-agents.md +77 -0
package/dist/index.js
CHANGED
|
@@ -4071,6 +4071,84 @@ Two things worth knowing:
|
|
|
4071
4071
|
|
|
4072
4072
|
An app that has never been published has no address, so there is nothing to
|
|
4073
4073
|
check. That is reported as a note, not as a pass.
|
|
4074
|
+
`
|
|
4075
|
+
},
|
|
4076
|
+
{
|
|
4077
|
+
topic: "cloud-agents",
|
|
4078
|
+
title: "Ship an agent inside the app",
|
|
4079
|
+
summary: "Create an AI agent that runs on Workser and can be called from this project's apps.",
|
|
4080
|
+
commands: ["cloud-agent"],
|
|
4081
|
+
source: "skills/workser/reference/cloud-agents.md",
|
|
4082
|
+
body: `# Ship an agent inside the app
|
|
4083
|
+
|
|
4084
|
+
\`workser cloud-agent\` creates an AI agent that runs on **Workser's**
|
|
4085
|
+
infrastructure, keeps its own memory and tools, and can be called from the web,
|
|
4086
|
+
mobile, API or Python apps in this project.
|
|
4087
|
+
|
|
4088
|
+
**This is not \`workser agent\`.** That one hands a subtask to a coding agent on
|
|
4089
|
+
this machine \u2014 a teammate helping you build. This one is a thing the project
|
|
4090
|
+
*ships*: it works for the user after you are gone.
|
|
4091
|
+
|
|
4092
|
+
\`\`\`
|
|
4093
|
+
workser cloud-agent list
|
|
4094
|
+
workser cloud-agent create "Order desk" --instructions "..."
|
|
4095
|
+
workser cloud-agent show <agentId>
|
|
4096
|
+
workser cloud-agent run <agentId> "<what to do>"
|
|
4097
|
+
workser cloud-agent runs <agentId> # recent runs
|
|
4098
|
+
workser cloud-agent runs <runId> # one run, with what it cost
|
|
4099
|
+
\`\`\`
|
|
4100
|
+
|
|
4101
|
+
Every call is scoped to the project this folder belongs to.
|
|
4102
|
+
|
|
4103
|
+
## When to reach for this
|
|
4104
|
+
|
|
4105
|
+
When the user describes a job that **keeps happening** and needs judgement:
|
|
4106
|
+
"check every order for stock and email me the problems", "read the LINE
|
|
4107
|
+
messages and file them", "reconcile these invoices". That is an agent.
|
|
4108
|
+
|
|
4109
|
+
A one-off transformation is not an agent \u2014 write the code. A fixed sequence of
|
|
4110
|
+
steps with no judgement in it is not an agent either \u2014 that is \`workser
|
|
4111
|
+
workflow\`.
|
|
4112
|
+
|
|
4113
|
+
## Calling it from the app you are building
|
|
4114
|
+
|
|
4115
|
+
Do NOT shell out to the CLI from app code. Use the SDK, which streams:
|
|
4116
|
+
|
|
4117
|
+
\`\`\`ts
|
|
4118
|
+
import { workser } from '@workser/app';
|
|
4119
|
+
|
|
4120
|
+
const run = await workser.agents.run(agentId, { message }, {
|
|
4121
|
+
referenceUserId: user.id, // who it is acting for
|
|
4122
|
+
});
|
|
4123
|
+
|
|
4124
|
+
for await (const event of workser.agents.stream(run.id)) {
|
|
4125
|
+
// event.type, event.data \u2014 forward these to the browser
|
|
4126
|
+
}
|
|
4127
|
+
\`\`\`
|
|
4128
|
+
|
|
4129
|
+
\`stream()\` reconnects itself through dropped connections, so the person
|
|
4130
|
+
watching sees the agent think. See the \`workser-sdk\` skill, \`reference/agents.md\`.
|
|
4131
|
+
|
|
4132
|
+
## Things that will bite you
|
|
4133
|
+
|
|
4134
|
+
1. **A run costs money by the minute.** It is metered \u2014 runtime, workspace, and
|
|
4135
|
+
a per-run fee \u2014 so a loop that starts agents is a loop that spends. Cancel
|
|
4136
|
+
what you abandon: \`workser cloud-agent runs <runId>\` shows the cost.
|
|
4137
|
+
|
|
4138
|
+
2. **Instructions are the product.** The agent does what its instructions say,
|
|
4139
|
+
in the user's own words. Write them the way you would brief a new colleague:
|
|
4140
|
+
what to do, what to leave alone, when to ask. Vague instructions are the
|
|
4141
|
+
single biggest cause of an agent that "doesn't work".
|
|
4142
|
+
|
|
4143
|
+
3. **Free plans cannot run agents at all**, and a trial has a small allowance.
|
|
4144
|
+
A \`402\` with \`spend_limit_reached\` is not a bug \u2014 tell the user what it says
|
|
4145
|
+
and point them at their plan.
|
|
4146
|
+
|
|
4147
|
+
4. **Say who it is for.** An agent acting for one of the app's customers needs
|
|
4148
|
+
\`referenceUserId\`, or its memory and audit trail belong to nobody.
|
|
4149
|
+
|
|
4150
|
+
5. **Do not invent an agent the user did not ask for.** Creating one is cheap;
|
|
4151
|
+
an agent nobody wanted, quietly costing money per run, is not.
|
|
4074
4152
|
`
|
|
4075
4153
|
},
|
|
4076
4154
|
{
|
|
@@ -7459,8 +7537,154 @@ function formatRole(r) {
|
|
|
7459
7537
|
return `${label} ${agent} ${enabled} ${ready}${tail}`;
|
|
7460
7538
|
}
|
|
7461
7539
|
|
|
7462
|
-
// src/commands/
|
|
7540
|
+
// src/commands/cloud-agent.ts
|
|
7463
7541
|
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
7542
|
+
function registerCloudAgent(program3) {
|
|
7543
|
+
const cloud = program3.command("cloud-agent").description(
|
|
7544
|
+
"Agents that run in the cloud and can be called from this project's apps (not the local coding agents \u2014 that's `workser agent`)"
|
|
7545
|
+
);
|
|
7546
|
+
cloud.command("list").description("List this project's cloud agents").action(
|
|
7547
|
+
action(async ({ ctx }) => {
|
|
7548
|
+
const res = await api(ctx, "/v1/cloud-agents");
|
|
7549
|
+
const agents = res?.agents ?? res ?? [];
|
|
7550
|
+
ok(res, () => {
|
|
7551
|
+
if (!agents.length) {
|
|
7552
|
+
line(import_picocolors17.default.dim("No cloud agents yet."));
|
|
7553
|
+
line(
|
|
7554
|
+
import_picocolors17.default.dim("Create one: ") + import_picocolors17.default.bold('workser cloud-agent create "Order desk" --instructions "..."')
|
|
7555
|
+
);
|
|
7556
|
+
return;
|
|
7557
|
+
}
|
|
7558
|
+
for (const a of agents) {
|
|
7559
|
+
line(
|
|
7560
|
+
`${import_picocolors17.default.bold(a.name ?? a.id)} ${import_picocolors17.default.dim(a.id)}` + (a.status ? ` ${import_picocolors17.default.dim(a.status)}` : "")
|
|
7561
|
+
);
|
|
7562
|
+
if (a.description) line(" " + import_picocolors17.default.dim(a.description));
|
|
7563
|
+
}
|
|
7564
|
+
});
|
|
7565
|
+
})
|
|
7566
|
+
);
|
|
7567
|
+
cloud.command("create <name>").description("Create a cloud agent in this project").option("--description <text>", "What it is for, in the owner's words").option(
|
|
7568
|
+
"--instructions <text>",
|
|
7569
|
+
"The agent's standing instructions \u2014 what it should always do"
|
|
7570
|
+
).action(
|
|
7571
|
+
action(async ({ ctx, args, opts }) => {
|
|
7572
|
+
const res = await api(ctx, "/v1/cloud-agents", {
|
|
7573
|
+
method: "POST",
|
|
7574
|
+
body: {
|
|
7575
|
+
name: args[0],
|
|
7576
|
+
description: opts.description,
|
|
7577
|
+
instructions: opts.instructions
|
|
7578
|
+
}
|
|
7579
|
+
});
|
|
7580
|
+
ok(res, () => {
|
|
7581
|
+
line(import_picocolors17.default.green("Created ") + import_picocolors17.default.bold(res?.name ?? args[0]));
|
|
7582
|
+
if (res?.id) line(import_picocolors17.default.dim(res.id));
|
|
7583
|
+
line("");
|
|
7584
|
+
line(
|
|
7585
|
+
import_picocolors17.default.dim("Give it work: ") + import_picocolors17.default.bold(`workser cloud-agent run ${res?.id ?? "<id>"} "..."`)
|
|
7586
|
+
);
|
|
7587
|
+
});
|
|
7588
|
+
})
|
|
7589
|
+
);
|
|
7590
|
+
cloud.command("show <agentId>").description("One cloud agent, with its configuration").action(
|
|
7591
|
+
action(async ({ ctx, args }) => {
|
|
7592
|
+
const res = await api(ctx, `/v1/cloud-agents/${encodeURIComponent(args[0])}`);
|
|
7593
|
+
ok(res, () => {
|
|
7594
|
+
line(import_picocolors17.default.bold(res?.name ?? args[0]));
|
|
7595
|
+
if (res?.description) line(import_picocolors17.default.dim(res.description));
|
|
7596
|
+
if (res?.instructions) {
|
|
7597
|
+
line("");
|
|
7598
|
+
line(import_picocolors17.default.bold("instructions:"));
|
|
7599
|
+
line(res.instructions);
|
|
7600
|
+
}
|
|
7601
|
+
});
|
|
7602
|
+
})
|
|
7603
|
+
);
|
|
7604
|
+
cloud.command("run <agentId> <message>").description("Give a cloud agent something to do").action(
|
|
7605
|
+
action(async ({ ctx, args }) => {
|
|
7606
|
+
const res = await api(
|
|
7607
|
+
ctx,
|
|
7608
|
+
`/v1/cloud-agents/${encodeURIComponent(args[0])}/runs`,
|
|
7609
|
+
{ method: "POST", body: { input: { message: args[1] } } }
|
|
7610
|
+
);
|
|
7611
|
+
ok(res, () => {
|
|
7612
|
+
line(import_picocolors17.default.green("Started run ") + import_picocolors17.default.bold(res?.id ?? ""));
|
|
7613
|
+
line(
|
|
7614
|
+
import_picocolors17.default.dim("Follow it: ") + import_picocolors17.default.bold(`workser cloud-agent runs ${res?.id ?? "<runId>"}`)
|
|
7615
|
+
);
|
|
7616
|
+
});
|
|
7617
|
+
})
|
|
7618
|
+
);
|
|
7619
|
+
cloud.command("runs [agentIdOrRunId]").description("Recent runs for an agent, or one run in detail").option("--limit <n>", "How many to list", "10").action(
|
|
7620
|
+
action(async ({ ctx, args, opts }) => {
|
|
7621
|
+
const id = args[0];
|
|
7622
|
+
if (!id) {
|
|
7623
|
+
warn("Give an agent id to list its runs, or a run id to inspect one.");
|
|
7624
|
+
return;
|
|
7625
|
+
}
|
|
7626
|
+
try {
|
|
7627
|
+
const run = await api(
|
|
7628
|
+
ctx,
|
|
7629
|
+
`/v1/cloud-agents/runs/${encodeURIComponent(id)}`
|
|
7630
|
+
);
|
|
7631
|
+
ok(run, () => printRun(run));
|
|
7632
|
+
return;
|
|
7633
|
+
} catch {
|
|
7634
|
+
}
|
|
7635
|
+
const res = await api(
|
|
7636
|
+
ctx,
|
|
7637
|
+
`/v1/cloud-agents/${encodeURIComponent(id)}/runs`,
|
|
7638
|
+
{ query: { limit: opts.limit } }
|
|
7639
|
+
);
|
|
7640
|
+
const runs = res?.runs ?? res ?? [];
|
|
7641
|
+
ok(res, () => {
|
|
7642
|
+
if (!runs.length) {
|
|
7643
|
+
line(import_picocolors17.default.dim("No runs yet."));
|
|
7644
|
+
return;
|
|
7645
|
+
}
|
|
7646
|
+
for (const r of runs) printRun(r, true);
|
|
7647
|
+
});
|
|
7648
|
+
})
|
|
7649
|
+
);
|
|
7650
|
+
}
|
|
7651
|
+
function printRun(run, compact = false) {
|
|
7652
|
+
const status = String(run?.status ?? "").toLowerCase();
|
|
7653
|
+
const colour2 = status === "completed" ? import_picocolors17.default.green : status === "failed" ? import_picocolors17.default.red : import_picocolors17.default.yellow;
|
|
7654
|
+
line(
|
|
7655
|
+
`${colour2(status || "unknown")} ${import_picocolors17.default.bold(run?.id ?? "")}` + (run?.duration_ms ? ` ${import_picocolors17.default.dim(formatDuration(run.duration_ms))}` : "")
|
|
7656
|
+
);
|
|
7657
|
+
const breakdown = run?.cost_breakdown;
|
|
7658
|
+
if (breakdown) {
|
|
7659
|
+
if (!breakdown.settled) {
|
|
7660
|
+
line(" " + import_picocolors17.default.dim("cost: still being worked out"));
|
|
7661
|
+
} else {
|
|
7662
|
+
line(" " + import_picocolors17.default.dim(`cost: $${Number(breakdown.total_usd).toFixed(4)}`));
|
|
7663
|
+
line(
|
|
7664
|
+
" " + import_picocolors17.default.dim(
|
|
7665
|
+
`model $${Number(breakdown.model_usd).toFixed(4)} \xB7 infrastructure $${Number(breakdown.infrastructure_usd).toFixed(4)}`
|
|
7666
|
+
)
|
|
7667
|
+
);
|
|
7668
|
+
}
|
|
7669
|
+
} else if (run?.cost_usd !== void 0 && run?.cost_usd !== null) {
|
|
7670
|
+
line(" " + import_picocolors17.default.dim(`model cost: $${Number(run.cost_usd).toFixed(4)}`));
|
|
7671
|
+
}
|
|
7672
|
+
if (!compact && run?.output) {
|
|
7673
|
+
line("");
|
|
7674
|
+
line(typeof run.output === "string" ? run.output : JSON.stringify(run.output, null, 2));
|
|
7675
|
+
}
|
|
7676
|
+
if (run?.error?.message) line(" " + import_picocolors17.default.red(run.error.message));
|
|
7677
|
+
}
|
|
7678
|
+
function formatDuration(ms) {
|
|
7679
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
7680
|
+
const seconds = Math.round(ms / 1e3);
|
|
7681
|
+
if (seconds < 60) return `${seconds}s`;
|
|
7682
|
+
const minutes = Math.floor(seconds / 60);
|
|
7683
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
7684
|
+
}
|
|
7685
|
+
|
|
7686
|
+
// src/commands/verify.ts
|
|
7687
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
7464
7688
|
function registerVerify(program3) {
|
|
7465
7689
|
program3.command("verify").description(
|
|
7466
7690
|
"Run the project's checks (typecheck/lint/build) \u2014 use before declaring a task done"
|
|
@@ -7482,23 +7706,23 @@ function registerVerify(program3) {
|
|
|
7482
7706
|
function printVerify(res) {
|
|
7483
7707
|
if (!res) return;
|
|
7484
7708
|
if (!res.checks?.length) {
|
|
7485
|
-
line(
|
|
7709
|
+
line(import_picocolors18.default.dim(res.note ?? "No checks detected."));
|
|
7486
7710
|
return;
|
|
7487
7711
|
}
|
|
7488
7712
|
for (const c of res.checks) {
|
|
7489
7713
|
line(
|
|
7490
|
-
` ${c.ok ?
|
|
7714
|
+
` ${c.ok ? import_picocolors18.default.green("\u2713") : import_picocolors18.default.red("\u2717")} ${c.name}${c.ok ? "" : import_picocolors18.default.dim(` (exit ${c.exitCode})`)}`
|
|
7491
7715
|
);
|
|
7492
7716
|
}
|
|
7493
7717
|
if (res.ok) success("All checks passed");
|
|
7494
7718
|
else
|
|
7495
7719
|
line(
|
|
7496
|
-
|
|
7720
|
+
import_picocolors18.default.red("Some checks failed \u2014 fix the errors above and re-run ") + import_picocolors18.default.bold("workser verify") + import_picocolors18.default.red(".")
|
|
7497
7721
|
);
|
|
7498
7722
|
}
|
|
7499
7723
|
|
|
7500
7724
|
// src/commands/checkpoint.ts
|
|
7501
|
-
var
|
|
7725
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
7502
7726
|
function registerCheckpoint(program3) {
|
|
7503
7727
|
program3.command("checkpoint [label]").description(
|
|
7504
7728
|
"Save the current state of this folder so you can come back to it"
|
|
@@ -7515,8 +7739,8 @@ function registerCheckpoint(program3) {
|
|
|
7515
7739
|
ok(res, () => {
|
|
7516
7740
|
const p = res?.point;
|
|
7517
7741
|
success(`Saved a checkpoint${p?.label ? `: ${p.label}` : ""}`);
|
|
7518
|
-
if (p?.ref) line(
|
|
7519
|
-
line(
|
|
7742
|
+
if (p?.ref) line(import_picocolors19.default.dim(` ${p.ref.slice(0, 7)}`));
|
|
7743
|
+
line(import_picocolors19.default.dim(" Come back to it with `workser restore`."));
|
|
7520
7744
|
});
|
|
7521
7745
|
})
|
|
7522
7746
|
);
|
|
@@ -7542,12 +7766,12 @@ function registerCheckpoint(program3) {
|
|
|
7542
7766
|
);
|
|
7543
7767
|
if (res?.filesChanged) {
|
|
7544
7768
|
line(
|
|
7545
|
-
|
|
7769
|
+
import_picocolors19.default.dim(
|
|
7546
7770
|
` ${res.filesChanged} file${res.filesChanged === 1 ? "" : "s"} changed`
|
|
7547
7771
|
)
|
|
7548
7772
|
);
|
|
7549
7773
|
}
|
|
7550
|
-
line(
|
|
7774
|
+
line(import_picocolors19.default.dim(" This is reversible: `workser restore` again."));
|
|
7551
7775
|
});
|
|
7552
7776
|
})
|
|
7553
7777
|
);
|
|
@@ -7564,25 +7788,25 @@ function registerCheckpoint(program3) {
|
|
|
7564
7788
|
function printPoints(points) {
|
|
7565
7789
|
if (!points.length) {
|
|
7566
7790
|
info("No checkpoints yet for this folder.");
|
|
7567
|
-
line(
|
|
7791
|
+
line(import_picocolors19.default.dim(" Take one with `workser checkpoint`."));
|
|
7568
7792
|
return;
|
|
7569
7793
|
}
|
|
7570
|
-
line(
|
|
7794
|
+
line(import_picocolors19.default.bold("Checkpoints"));
|
|
7571
7795
|
for (const p of points) {
|
|
7572
7796
|
const when = p.at ? new Date(p.at).toLocaleString() : "";
|
|
7573
7797
|
line(
|
|
7574
|
-
` ${
|
|
7798
|
+
` ${import_picocolors19.default.dim(p.ref.slice(0, 7))} ${p.label}${when ? import_picocolors19.default.dim(` ${when}`) : ""}`
|
|
7575
7799
|
);
|
|
7576
7800
|
}
|
|
7577
7801
|
line(
|
|
7578
|
-
|
|
7802
|
+
import_picocolors19.default.dim(
|
|
7579
7803
|
"\nGo back with `workser restore <ref>`, or just `workser restore` for the newest."
|
|
7580
7804
|
)
|
|
7581
7805
|
);
|
|
7582
7806
|
}
|
|
7583
7807
|
|
|
7584
7808
|
// src/commands/sync.ts
|
|
7585
|
-
var
|
|
7809
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
7586
7810
|
function registerSync(program3) {
|
|
7587
7811
|
program3.command("sync").description(
|
|
7588
7812
|
"Reconcile this folder with the copy Workser holds (pull, then push)"
|
|
@@ -7609,7 +7833,7 @@ function registerSync(program3) {
|
|
|
7609
7833
|
warn(res?.message ?? "Couldn't sync this folder.");
|
|
7610
7834
|
if (res?.state === "diverged") {
|
|
7611
7835
|
line(
|
|
7612
|
-
|
|
7836
|
+
import_picocolors20.default.dim(
|
|
7613
7837
|
" This folder and Workser's copy have both changed. Open Workser to resolve it."
|
|
7614
7838
|
)
|
|
7615
7839
|
);
|
|
@@ -7621,7 +7845,7 @@ function registerSync(program3) {
|
|
|
7621
7845
|
return;
|
|
7622
7846
|
}
|
|
7623
7847
|
success("Synced");
|
|
7624
|
-
if (res?.ref) line(
|
|
7848
|
+
if (res?.ref) line(import_picocolors20.default.dim(` ${String(res.ref).slice(0, 7)}`));
|
|
7625
7849
|
});
|
|
7626
7850
|
if (refused) process.exitCode = 1;
|
|
7627
7851
|
})
|
|
@@ -7629,7 +7853,7 @@ function registerSync(program3) {
|
|
|
7629
7853
|
}
|
|
7630
7854
|
|
|
7631
7855
|
// src/commands/workflow.ts
|
|
7632
|
-
var
|
|
7856
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
7633
7857
|
function registerWorkflow(program3) {
|
|
7634
7858
|
const wf = program3.command("workflow").description("Create, run, and inspect workflow automations for the project");
|
|
7635
7859
|
wf.command("list").description("List the project's workflows").action(
|
|
@@ -7637,10 +7861,10 @@ function registerWorkflow(program3) {
|
|
|
7637
7861
|
const projectId = requireProject(ctx);
|
|
7638
7862
|
const items = await api(ctx, `/v1/projects/${projectId}/workflows`);
|
|
7639
7863
|
ok(items, () => {
|
|
7640
|
-
if (!items?.length) return line(
|
|
7864
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No workflows yet. `workser workflow create`."));
|
|
7641
7865
|
for (const w of items) {
|
|
7642
|
-
const status = w.is_active ?
|
|
7643
|
-
line(`${w.id} ${
|
|
7866
|
+
const status = w.is_active ? import_picocolors21.default.green("active") : import_picocolors21.default.dim("inactive");
|
|
7867
|
+
line(`${w.id} ${import_picocolors21.default.bold(w.name ?? "Untitled")} ${status}`);
|
|
7644
7868
|
}
|
|
7645
7869
|
});
|
|
7646
7870
|
})
|
|
@@ -7652,7 +7876,7 @@ function registerWorkflow(program3) {
|
|
|
7652
7876
|
const res = await api(ctx, `/v1/projects/${projectId}/workflows`, {
|
|
7653
7877
|
body: { name: args[0], ...extra }
|
|
7654
7878
|
});
|
|
7655
|
-
ok(res, () => line(`Created workflow ${
|
|
7879
|
+
ok(res, () => line(`Created workflow ${import_picocolors21.default.bold(res.id)}.`));
|
|
7656
7880
|
})
|
|
7657
7881
|
);
|
|
7658
7882
|
wf.command("get <id>").description("Show a workflow's full definition").action(
|
|
@@ -7687,8 +7911,8 @@ function registerWorkflow(program3) {
|
|
|
7687
7911
|
action(async ({ ctx, args }) => {
|
|
7688
7912
|
const items = await api(ctx, `/v1/workflows/${args[0]}/executions`);
|
|
7689
7913
|
ok(items, () => {
|
|
7690
|
-
if (!items?.length) return line(
|
|
7691
|
-
for (const e of items) line(`${e.id} ${e.status ?? ""} ${
|
|
7914
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No runs yet."));
|
|
7915
|
+
for (const e of items) line(`${e.id} ${e.status ?? ""} ${import_picocolors21.default.dim(e.started_at ?? "")}`);
|
|
7692
7916
|
});
|
|
7693
7917
|
})
|
|
7694
7918
|
);
|
|
@@ -7696,15 +7920,15 @@ function registerWorkflow(program3) {
|
|
|
7696
7920
|
action(async ({ ctx, args }) => {
|
|
7697
7921
|
const items = await api(ctx, `/v1/node-types`, { query: { q: args[0] } });
|
|
7698
7922
|
ok(items, () => {
|
|
7699
|
-
if (!items?.length) return line(
|
|
7700
|
-
for (const n of items) line(`${n.name ?? n.type} ${
|
|
7923
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No matching node types."));
|
|
7924
|
+
for (const n of items) line(`${n.name ?? n.type} ${import_picocolors21.default.dim(n.category ?? "")}`);
|
|
7701
7925
|
});
|
|
7702
7926
|
})
|
|
7703
7927
|
);
|
|
7704
7928
|
}
|
|
7705
7929
|
|
|
7706
7930
|
// src/commands/connection.ts
|
|
7707
|
-
var
|
|
7931
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
7708
7932
|
function registerConnection(program3) {
|
|
7709
7933
|
const connection = program3.command("connection").description("Connect and use third-party app connections (Gmail, Slack, Stripe, ...)");
|
|
7710
7934
|
connection.command("list").description("List connectable toolkits and this project's existing connections").option("--toolkit <slug>", "filter connections to one toolkit").action(
|
|
@@ -7717,8 +7941,8 @@ function registerConnection(program3) {
|
|
|
7717
7941
|
ok({ catalog, connections }, () => {
|
|
7718
7942
|
const connected = new Set((connections ?? []).map((c) => c.toolkit ?? c.composio_app));
|
|
7719
7943
|
for (const t of catalog ?? []) {
|
|
7720
|
-
const status = connected.has(t.slug) ?
|
|
7721
|
-
line(`${t.slug} ${
|
|
7944
|
+
const status = connected.has(t.slug) ? import_picocolors22.default.green("connected") : import_picocolors22.default.dim("not connected");
|
|
7945
|
+
line(`${t.slug} ${import_picocolors22.default.bold(t.name ?? t.slug)} ${status}`);
|
|
7722
7946
|
}
|
|
7723
7947
|
});
|
|
7724
7948
|
})
|
|
@@ -7730,9 +7954,9 @@ function registerConnection(program3) {
|
|
|
7730
7954
|
query: { q: args[0], toolkit: opts.toolkit, limit: opts.limit }
|
|
7731
7955
|
});
|
|
7732
7956
|
ok(items, () => {
|
|
7733
|
-
if (!items?.length) return line(
|
|
7957
|
+
if (!items?.length) return line(import_picocolors22.default.dim("No matching actions."));
|
|
7734
7958
|
for (const t of items) {
|
|
7735
|
-
line(`${t.slug} ${
|
|
7959
|
+
line(`${t.slug} ${import_picocolors22.default.dim(`[${t.toolkit}]`)} ${t.description ?? ""}`);
|
|
7736
7960
|
}
|
|
7737
7961
|
});
|
|
7738
7962
|
})
|
|
@@ -7749,7 +7973,7 @@ function registerConnection(program3) {
|
|
|
7749
7973
|
});
|
|
7750
7974
|
ok(
|
|
7751
7975
|
res,
|
|
7752
|
-
() => res.oauth_url ? line(`Open this URL to finish connecting: ${
|
|
7976
|
+
() => res.oauth_url ? line(`Open this URL to finish connecting: ${import_picocolors22.default.underline(res.oauth_url)}`) : line(`Connection ${res.connection_id} is ${res.status}.`)
|
|
7753
7977
|
);
|
|
7754
7978
|
})
|
|
7755
7979
|
);
|
|
@@ -7767,8 +7991,8 @@ function registerConnection(program3) {
|
|
|
7767
7991
|
const projectId = requireProject(ctx);
|
|
7768
7992
|
const items = await api(ctx, `/v1/projects/${projectId}/integrations/${args[0]}/tools`);
|
|
7769
7993
|
ok(items, () => {
|
|
7770
|
-
if (!items?.length) return line(
|
|
7771
|
-
for (const t of items) line(`${t.slug} ${
|
|
7994
|
+
if (!items?.length) return line(import_picocolors22.default.dim("No tools found."));
|
|
7995
|
+
for (const t of items) line(`${t.slug} ${import_picocolors22.default.dim(t.description ?? "")}`);
|
|
7772
7996
|
});
|
|
7773
7997
|
})
|
|
7774
7998
|
);
|
|
@@ -7784,7 +8008,7 @@ function registerConnection(program3) {
|
|
|
7784
8008
|
}
|
|
7785
8009
|
|
|
7786
8010
|
// src/commands/tool.ts
|
|
7787
|
-
var
|
|
8011
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
7788
8012
|
function registerTool(program3) {
|
|
7789
8013
|
const tool = program3.command("tool").description(
|
|
7790
8014
|
"Computer-use tools: filesystem, shell, screenshot, input control, clipboard, notifications, basic browser"
|
|
@@ -7793,7 +8017,7 @@ function registerTool(program3) {
|
|
|
7793
8017
|
action(async ({ ctx }) => {
|
|
7794
8018
|
const tools = await api(ctx, "/v1/tool/list");
|
|
7795
8019
|
ok(tools, () => {
|
|
7796
|
-
if (!tools?.length) return line(
|
|
8020
|
+
if (!tools?.length) return line(import_picocolors23.default.dim("No tools available."));
|
|
7797
8021
|
const byCategory = /* @__PURE__ */ new Map();
|
|
7798
8022
|
for (const t of tools) {
|
|
7799
8023
|
const list = byCategory.get(t.category) ?? [];
|
|
@@ -7801,9 +8025,9 @@ function registerTool(program3) {
|
|
|
7801
8025
|
byCategory.set(t.category, list);
|
|
7802
8026
|
}
|
|
7803
8027
|
for (const [category, items] of byCategory) {
|
|
7804
|
-
line(
|
|
8028
|
+
line(import_picocolors23.default.bold(category) + ":");
|
|
7805
8029
|
for (const t of items) {
|
|
7806
|
-
line(` ${t.name} ${
|
|
8030
|
+
line(` ${t.name} ${import_picocolors23.default.dim(t.description ?? "")}`);
|
|
7807
8031
|
}
|
|
7808
8032
|
}
|
|
7809
8033
|
});
|
|
@@ -7821,7 +8045,7 @@ function registerTool(program3) {
|
|
|
7821
8045
|
}
|
|
7822
8046
|
|
|
7823
8047
|
// src/commands/memory.ts
|
|
7824
|
-
var
|
|
8048
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
7825
8049
|
function registerMemory(program3) {
|
|
7826
8050
|
const memory = program3.command("memory").description("Durable, cross-conversation project memory (shared with cloud agents on the same project)");
|
|
7827
8051
|
memory.command("add <content>").description("Store something worth remembering across future conversations").option("--metadata <json>", "extra metadata for filtering, as a JSON string").option("--id <customId>", "custom id for dedup/updates").action(
|
|
@@ -7845,9 +8069,9 @@ function registerMemory(program3) {
|
|
|
7845
8069
|
});
|
|
7846
8070
|
ok(res, () => {
|
|
7847
8071
|
const results = res?.results ?? res ?? [];
|
|
7848
|
-
if (!results?.length) return line(
|
|
8072
|
+
if (!results?.length) return line(import_picocolors24.default.dim("No matching memories."));
|
|
7849
8073
|
for (const r of results) {
|
|
7850
|
-
line(`${
|
|
8074
|
+
line(`${import_picocolors24.default.dim(r.id ?? "?")} ${r.memory ?? r.content ?? ""}`);
|
|
7851
8075
|
}
|
|
7852
8076
|
});
|
|
7853
8077
|
})
|
|
@@ -7864,7 +8088,7 @@ function registerMemory(program3) {
|
|
|
7864
8088
|
}
|
|
7865
8089
|
|
|
7866
8090
|
// src/commands/note.ts
|
|
7867
|
-
var
|
|
8091
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
7868
8092
|
function registerNote(program3) {
|
|
7869
8093
|
program3.command("note <text>").description("Leave a fact the rest of the team will need").addHelpText(
|
|
7870
8094
|
"after",
|
|
@@ -7901,14 +8125,14 @@ function registerNote(program3) {
|
|
|
7901
8125
|
}
|
|
7902
8126
|
ok(res, () => {
|
|
7903
8127
|
success("Noted for the team.");
|
|
7904
|
-
line(
|
|
8128
|
+
line(import_picocolors25.default.dim(` ${text}`));
|
|
7905
8129
|
});
|
|
7906
8130
|
})
|
|
7907
8131
|
);
|
|
7908
8132
|
}
|
|
7909
8133
|
|
|
7910
8134
|
// src/commands/business.ts
|
|
7911
|
-
var
|
|
8135
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
7912
8136
|
var RESOURCE_PATHS = {
|
|
7913
8137
|
"business-config": "business-config",
|
|
7914
8138
|
"business-settings": "business-settings",
|
|
@@ -7968,7 +8192,7 @@ function registerBusiness(program3) {
|
|
|
7968
8192
|
const projectId = requireProject(ctx);
|
|
7969
8193
|
const [resource] = args;
|
|
7970
8194
|
const res = await api(ctx, businessPath(projectId, resource), { body: JSON.parse(opts.body) });
|
|
7971
|
-
ok(res, () => line(`Created ${resource} ${
|
|
8195
|
+
ok(res, () => line(`Created ${resource} ${import_picocolors26.default.bold(res?.id ?? "")}.`));
|
|
7972
8196
|
})
|
|
7973
8197
|
);
|
|
7974
8198
|
biz.command("update <resource> <id>").description("Update a record by id (PATCH/PUT \u2014 matches the underlying route)").option("--body <json>", "changed fields as a JSON object string", "{}").action(
|
|
@@ -8010,7 +8234,7 @@ function businessPath(projectId, resource, subpath) {
|
|
|
8010
8234
|
}
|
|
8011
8235
|
|
|
8012
8236
|
// src/commands/artifact.ts
|
|
8013
|
-
var
|
|
8237
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
8014
8238
|
import { existsSync as existsSync2, statSync } from "fs";
|
|
8015
8239
|
import { resolve as resolve3, basename as basename3 } from "path";
|
|
8016
8240
|
var KINDS = [
|
|
@@ -8107,7 +8331,7 @@ function registerArtifact(program3) {
|
|
|
8107
8331
|
ok(
|
|
8108
8332
|
res,
|
|
8109
8333
|
() => success(
|
|
8110
|
-
`Recorded ${
|
|
8334
|
+
`Recorded ${import_picocolors27.default.bold(res?.title ?? "artifact")}${res?.kind ? import_picocolors27.default.dim(` (${res.kind})`) : ""}`
|
|
8111
8335
|
)
|
|
8112
8336
|
);
|
|
8113
8337
|
})
|
|
@@ -8139,13 +8363,13 @@ function registerArtifact(program3) {
|
|
|
8139
8363
|
artifact.command("run").description("Show the task/conversation this agent run is attached to").action(
|
|
8140
8364
|
action(async ({ ctx }) => {
|
|
8141
8365
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}`);
|
|
8142
|
-
ok(res, () =>
|
|
8366
|
+
ok(res, () => printRun2(res));
|
|
8143
8367
|
})
|
|
8144
8368
|
);
|
|
8145
8369
|
}
|
|
8146
8370
|
function printArtifacts(rows) {
|
|
8147
8371
|
if (!rows.length) {
|
|
8148
|
-
line(
|
|
8372
|
+
line(import_picocolors27.default.dim("Nothing produced yet."));
|
|
8149
8373
|
return;
|
|
8150
8374
|
}
|
|
8151
8375
|
const byStep = /* @__PURE__ */ new Map();
|
|
@@ -8155,26 +8379,26 @@ function printArtifacts(rows) {
|
|
|
8155
8379
|
byStep.set(r.subtask_id, list);
|
|
8156
8380
|
}
|
|
8157
8381
|
for (const [stepId, items] of byStep) {
|
|
8158
|
-
line(
|
|
8382
|
+
line(import_picocolors27.default.bold(`step ${stepId}`));
|
|
8159
8383
|
for (const a of items) {
|
|
8160
|
-
const flag = a.promoted_at ?
|
|
8384
|
+
const flag = a.promoted_at ? import_picocolors27.default.green(" *") : " ";
|
|
8161
8385
|
const where = a.local_path || a.cloud_url || "";
|
|
8162
8386
|
line(
|
|
8163
|
-
`${flag} ${
|
|
8387
|
+
`${flag} ${import_picocolors27.default.dim(`[${a.kind}]`)} ${a.title ?? "(untitled)"}` + (where ? import_picocolors27.default.dim(` ${where}`) : "")
|
|
8164
8388
|
);
|
|
8165
|
-
if (a.description) line(
|
|
8389
|
+
if (a.description) line(import_picocolors27.default.dim(` ${a.description}`));
|
|
8166
8390
|
}
|
|
8167
8391
|
line("");
|
|
8168
8392
|
}
|
|
8169
|
-
line(
|
|
8393
|
+
line(import_picocolors27.default.dim("* = handed over as a deliverable; the rest is working material."));
|
|
8170
8394
|
}
|
|
8171
|
-
function
|
|
8395
|
+
function printRun2(run) {
|
|
8172
8396
|
if (!run) return;
|
|
8173
|
-
line(` run ${
|
|
8397
|
+
line(` run ${import_picocolors27.default.bold(run.runId)}`);
|
|
8174
8398
|
if (run.taskId) line(` task ${run.taskId}`);
|
|
8175
8399
|
if (run.conversationId) line(` chat ${run.conversationId}`);
|
|
8176
8400
|
if (run.projectId) line(` project ${run.projectId}`);
|
|
8177
|
-
if (run.cwd) line(` folder ${
|
|
8401
|
+
if (run.cwd) line(` folder ${import_picocolors27.default.dim(run.cwd)}`);
|
|
8178
8402
|
}
|
|
8179
8403
|
|
|
8180
8404
|
// src/commands/image.ts
|
|
@@ -8355,7 +8579,7 @@ function registerAudio(program3) {
|
|
|
8355
8579
|
}
|
|
8356
8580
|
|
|
8357
8581
|
// src/commands/ask.ts
|
|
8358
|
-
var
|
|
8582
|
+
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
8359
8583
|
var TYPES = [
|
|
8360
8584
|
"input",
|
|
8361
8585
|
"choice",
|
|
@@ -8433,7 +8657,7 @@ function registerAsk(program3) {
|
|
|
8433
8657
|
code: "bad_request"
|
|
8434
8658
|
});
|
|
8435
8659
|
}
|
|
8436
|
-
info(
|
|
8660
|
+
info(import_picocolors28.default.dim("Waiting for the user to answer\u2026"));
|
|
8437
8661
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}/ask`, {
|
|
8438
8662
|
body: {
|
|
8439
8663
|
type,
|
|
@@ -8461,12 +8685,12 @@ function deriveTitle(message) {
|
|
|
8461
8685
|
function printAnswer(res) {
|
|
8462
8686
|
if (!res) return;
|
|
8463
8687
|
if (res.status === "answered") {
|
|
8464
|
-
line(` ${
|
|
8688
|
+
line(` ${import_picocolors28.default.green("answered")}`);
|
|
8465
8689
|
const value = extract(res.response);
|
|
8466
8690
|
if (value) line(` ${value}`);
|
|
8467
8691
|
return;
|
|
8468
8692
|
}
|
|
8469
|
-
line(` ${
|
|
8693
|
+
line(` ${import_picocolors28.default.yellow(res.status)} ${import_picocolors28.default.dim(res.reason ?? "")}`);
|
|
8470
8694
|
}
|
|
8471
8695
|
function extract(response) {
|
|
8472
8696
|
if (response == null) return "";
|
|
@@ -8485,7 +8709,7 @@ function extract(response) {
|
|
|
8485
8709
|
}
|
|
8486
8710
|
|
|
8487
8711
|
// src/commands/search.ts
|
|
8488
|
-
var
|
|
8712
|
+
var import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
8489
8713
|
function registerSearch(program3) {
|
|
8490
8714
|
program3.command("search <query>").description("Search the web (Google-grounded, server-side)").option("-n, --max-results <n>", "max results", "5").action(
|
|
8491
8715
|
action(async ({ ctx, args, opts }) => {
|
|
@@ -8498,9 +8722,9 @@ function registerSearch(program3) {
|
|
|
8498
8722
|
line("");
|
|
8499
8723
|
}
|
|
8500
8724
|
const results = res?.results ?? [];
|
|
8501
|
-
if (!results.length) return line(
|
|
8725
|
+
if (!results.length) return line(import_picocolors29.default.dim("No results."));
|
|
8502
8726
|
for (const r of results) {
|
|
8503
|
-
line(`${r.title ||
|
|
8727
|
+
line(`${r.title || import_picocolors29.default.dim("(untitled)")} ${import_picocolors29.default.dim(r.url)}`);
|
|
8504
8728
|
}
|
|
8505
8729
|
});
|
|
8506
8730
|
})
|
|
@@ -8508,7 +8732,7 @@ function registerSearch(program3) {
|
|
|
8508
8732
|
}
|
|
8509
8733
|
|
|
8510
8734
|
// src/commands/board.ts
|
|
8511
|
-
var
|
|
8735
|
+
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
8512
8736
|
|
|
8513
8737
|
// src/commands/record-step.ts
|
|
8514
8738
|
async function recordEntityStep(ctx, opts) {
|
|
@@ -8547,7 +8771,7 @@ function registerBoard(program3) {
|
|
|
8547
8771
|
}
|
|
8548
8772
|
ok(rows, () => {
|
|
8549
8773
|
if (!rows.length) {
|
|
8550
|
-
line(
|
|
8774
|
+
line(import_picocolors30.default.dim("No cards on the Board yet."));
|
|
8551
8775
|
return;
|
|
8552
8776
|
}
|
|
8553
8777
|
for (const r of rows) line(formatRow(r));
|
|
@@ -8562,7 +8786,7 @@ function registerBoard(program3) {
|
|
|
8562
8786
|
`/v1/projects/${projectId}/work-items/${args[0]}`
|
|
8563
8787
|
);
|
|
8564
8788
|
ok(row, () => {
|
|
8565
|
-
line(`${
|
|
8789
|
+
line(`${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.id)}`);
|
|
8566
8790
|
line(`${statusTag(row.status)} priority ${row.priority}`);
|
|
8567
8791
|
if (row.ownerHuman) line(`owner: ${row.ownerHuman}`);
|
|
8568
8792
|
if (row.labels?.length) line(`labels: ${row.labels.join(", ")}`);
|
|
@@ -8603,7 +8827,7 @@ ${row.description}`);
|
|
|
8603
8827
|
refId: row?.id,
|
|
8604
8828
|
output: { workItem: row }
|
|
8605
8829
|
});
|
|
8606
|
-
ok(row, () => line(`Created work item ${
|
|
8830
|
+
ok(row, () => line(`Created work item ${import_picocolors30.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
8607
8831
|
})
|
|
8608
8832
|
);
|
|
8609
8833
|
board.command("update <id>").description("Change fields on a card \u2014 pass only what changes").option("--title <text>", "new title").option("--description <text>", "new description").option("--status <value>", STATUSES.join(" | ")).option("--priority <value>", PRIORITIES.join(" | ")).option(
|
|
@@ -8637,7 +8861,7 @@ ${row.description}`);
|
|
|
8637
8861
|
);
|
|
8638
8862
|
}
|
|
8639
8863
|
const row = await patchItem(ctx, projectId, String(args[0]), body);
|
|
8640
|
-
ok(row, () => line(`Updated ${
|
|
8864
|
+
ok(row, () => line(`Updated ${import_picocolors30.default.bold(row.id)} \u2014 ${row.title} ${statusTag(row.status)}`));
|
|
8641
8865
|
})
|
|
8642
8866
|
);
|
|
8643
8867
|
board.command("move <id> <status>").description(
|
|
@@ -8648,14 +8872,14 @@ ${row.description}`);
|
|
|
8648
8872
|
const status = String(args[1]);
|
|
8649
8873
|
assertStatus(status);
|
|
8650
8874
|
const row = await patchItem(ctx, projectId, String(args[0]), { status });
|
|
8651
|
-
ok(row, () => line(`Moved ${
|
|
8875
|
+
ok(row, () => line(`Moved ${import_picocolors30.default.bold(row.title)} \u2192 ${statusTag(row.status)}`));
|
|
8652
8876
|
})
|
|
8653
8877
|
);
|
|
8654
8878
|
board.command("close <id>").description("Shorthand for `board move <id> done`").action(
|
|
8655
8879
|
action(async ({ ctx, args }) => {
|
|
8656
8880
|
const projectId = requireProject(ctx);
|
|
8657
8881
|
const row = await patchItem(ctx, projectId, String(args[0]), { status: "done" });
|
|
8658
|
-
ok(row, () => line(`Closed ${
|
|
8882
|
+
ok(row, () => line(`Closed ${import_picocolors30.default.bold(row.title)} ${statusTag(row.status)}`));
|
|
8659
8883
|
})
|
|
8660
8884
|
);
|
|
8661
8885
|
}
|
|
@@ -8688,23 +8912,23 @@ function assertPriority(value) {
|
|
|
8688
8912
|
}
|
|
8689
8913
|
}
|
|
8690
8914
|
function formatRow(r) {
|
|
8691
|
-
const labels = r.labels?.length ?
|
|
8692
|
-
const owner = r.ownerHuman ?
|
|
8693
|
-
return `${
|
|
8915
|
+
const labels = r.labels?.length ? import_picocolors30.default.dim(` [${r.labels.join(", ")}]`) : "";
|
|
8916
|
+
const owner = r.ownerHuman ? import_picocolors30.default.dim(` @${r.ownerHuman}`) : "";
|
|
8917
|
+
return `${import_picocolors30.default.dim(r.id)} ${statusTag(r.status)} ${r.title}${labels}${owner}`;
|
|
8694
8918
|
}
|
|
8695
8919
|
function statusTag(status) {
|
|
8696
8920
|
const label = status.padEnd(11);
|
|
8697
|
-
if (status === "done") return
|
|
8698
|
-
if (status === "in-progress") return
|
|
8699
|
-
if (status === "in-review") return
|
|
8700
|
-
return
|
|
8921
|
+
if (status === "done") return import_picocolors30.default.green(label);
|
|
8922
|
+
if (status === "in-progress") return import_picocolors30.default.yellow(label);
|
|
8923
|
+
if (status === "in-review") return import_picocolors30.default.cyan(label);
|
|
8924
|
+
return import_picocolors30.default.dim(label);
|
|
8701
8925
|
}
|
|
8702
8926
|
function collect2(value, previous) {
|
|
8703
8927
|
return [...previous, value];
|
|
8704
8928
|
}
|
|
8705
8929
|
|
|
8706
8930
|
// src/commands/task.ts
|
|
8707
|
-
var
|
|
8931
|
+
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
8708
8932
|
|
|
8709
8933
|
// src/subtask-attachments.ts
|
|
8710
8934
|
var MAX_REF_NOTE = 500;
|
|
@@ -8818,7 +9042,7 @@ function registerTask(program3) {
|
|
|
8818
9042
|
}) ?? [];
|
|
8819
9043
|
ok(rows, () => {
|
|
8820
9044
|
if (!rows.length) {
|
|
8821
|
-
line(
|
|
9045
|
+
line(import_picocolors31.default.dim("No tasks on the board yet."));
|
|
8822
9046
|
return;
|
|
8823
9047
|
}
|
|
8824
9048
|
for (const r of rows) line(formatRow2(r));
|
|
@@ -8927,10 +9151,10 @@ function registerTask(program3) {
|
|
|
8927
9151
|
};
|
|
8928
9152
|
ok(result, () => {
|
|
8929
9153
|
line(
|
|
8930
|
-
`${
|
|
9154
|
+
`${import_picocolors31.default.green("opened")} ${import_picocolors31.default.bold(row.title)} ${import_picocolors31.default.dim(row.key ?? row.id)}`
|
|
8931
9155
|
);
|
|
8932
9156
|
if (channelMessage)
|
|
8933
|
-
line(
|
|
9157
|
+
line(import_picocolors31.default.dim("posted to the channel as Project Manager"));
|
|
8934
9158
|
if (channelMessageError) {
|
|
8935
9159
|
warn(
|
|
8936
9160
|
`Task opened, but its Project Manager card could not be posted: ${channelMessageError.message}`
|
|
@@ -9009,12 +9233,12 @@ function registerTask(program3) {
|
|
|
9009
9233
|
) : null;
|
|
9010
9234
|
ok(runner ?? row, () => {
|
|
9011
9235
|
line(
|
|
9012
|
-
`${
|
|
9236
|
+
`${import_picocolors31.default.green("added")} ${import_picocolors31.default.bold(row.title)} ${import_picocolors31.default.dim(row.key ?? row.id)}`
|
|
9013
9237
|
);
|
|
9014
|
-
if (row.role) line(
|
|
9238
|
+
if (row.role) line(import_picocolors31.default.dim(`role: ${row.role}`));
|
|
9015
9239
|
if (runner) {
|
|
9016
9240
|
line(
|
|
9017
|
-
|
|
9241
|
+
import_picocolors31.default.dim(
|
|
9018
9242
|
`runs on: ${[opts.agent, opts.model, opts.effort].filter(Boolean).join(" \xB7 ")}`
|
|
9019
9243
|
)
|
|
9020
9244
|
);
|
|
@@ -9032,7 +9256,7 @@ function registerTask(program3) {
|
|
|
9032
9256
|
const rows = row.subtasks ?? [];
|
|
9033
9257
|
ok(rows, () => {
|
|
9034
9258
|
if (!rows.length) {
|
|
9035
|
-
line(
|
|
9259
|
+
line(import_picocolors31.default.dim("No subtasks yet."));
|
|
9036
9260
|
return;
|
|
9037
9261
|
}
|
|
9038
9262
|
rows.forEach((r, i) => line(formatSubtask(r, i + 1)));
|
|
@@ -9080,7 +9304,7 @@ function registerTask(program3) {
|
|
|
9080
9304
|
}
|
|
9081
9305
|
}
|
|
9082
9306
|
);
|
|
9083
|
-
ok(row, () => line(`${
|
|
9307
|
+
ok(row, () => line(`${import_picocolors31.default.green("updated")} ${import_picocolors31.default.bold(row.title)}`));
|
|
9084
9308
|
})
|
|
9085
9309
|
);
|
|
9086
9310
|
subtask.command("remove <id>").description("Remove a subtask (only before the work starts)").action(
|
|
@@ -9088,7 +9312,7 @@ function registerTask(program3) {
|
|
|
9088
9312
|
await api(ctx, `/v1/project-tasks/${encodeURIComponent(args[0])}`, {
|
|
9089
9313
|
method: "DELETE"
|
|
9090
9314
|
});
|
|
9091
|
-
ok({ removed: args[0] }, () => line(
|
|
9315
|
+
ok({ removed: args[0] }, () => line(import_picocolors31.default.green("removed")));
|
|
9092
9316
|
})
|
|
9093
9317
|
);
|
|
9094
9318
|
task.command("move <id> <status>").description(
|
|
@@ -9103,7 +9327,7 @@ function registerTask(program3) {
|
|
|
9103
9327
|
);
|
|
9104
9328
|
ok(
|
|
9105
9329
|
row,
|
|
9106
|
-
() => line(`${
|
|
9330
|
+
() => line(`${import_picocolors31.default.green("moved")} ${import_picocolors31.default.bold(row.title)} \u2192 ${args[1]}`)
|
|
9107
9331
|
);
|
|
9108
9332
|
})
|
|
9109
9333
|
);
|
|
@@ -9119,18 +9343,18 @@ function registerTask(program3) {
|
|
|
9119
9343
|
);
|
|
9120
9344
|
ok(row, () => {
|
|
9121
9345
|
if (!row?.queued) {
|
|
9122
|
-
line(
|
|
9346
|
+
line(import_picocolors31.default.yellow("could not resume it \u2014 check the step id"));
|
|
9123
9347
|
return;
|
|
9124
9348
|
}
|
|
9125
9349
|
const started = row.started ?? 0;
|
|
9126
9350
|
if (started > 0) {
|
|
9127
9351
|
line(
|
|
9128
|
-
`${
|
|
9352
|
+
`${import_picocolors31.default.green("resumed")} \u2014 ${started} step${started === 1 ? "" : "s"} started`
|
|
9129
9353
|
);
|
|
9130
9354
|
return;
|
|
9131
9355
|
}
|
|
9132
9356
|
line(
|
|
9133
|
-
`${
|
|
9357
|
+
`${import_picocolors31.default.green("resumed")} \u2014 it is queued, but nothing started yet. Check the plan is approved and that no step is blocking the rest.`
|
|
9134
9358
|
);
|
|
9135
9359
|
});
|
|
9136
9360
|
})
|
|
@@ -9144,11 +9368,11 @@ function registerTask(program3) {
|
|
|
9144
9368
|
);
|
|
9145
9369
|
ok(row, () => {
|
|
9146
9370
|
if (row?.reopened) {
|
|
9147
|
-
line(`${
|
|
9371
|
+
line(`${import_picocolors31.default.green("sent back")} \u2014 it will be picked up again`);
|
|
9148
9372
|
return;
|
|
9149
9373
|
}
|
|
9150
9374
|
line(
|
|
9151
|
-
|
|
9375
|
+
import_picocolors31.default.yellow(
|
|
9152
9376
|
row?.reason === "already_open" ? "already waiting to be picked up \u2014 nothing to send back" : row?.reason === "still_working" ? "still working \u2014 let it finish before sending it back" : "could not send that step back"
|
|
9153
9377
|
)
|
|
9154
9378
|
);
|
|
@@ -9165,7 +9389,7 @@ function registerTask(program3) {
|
|
|
9165
9389
|
`/v1/project-tasks/${encodeURIComponent(id)}/dispatch-check`,
|
|
9166
9390
|
{ method: "POST" }
|
|
9167
9391
|
);
|
|
9168
|
-
ok(row, () => line(
|
|
9392
|
+
ok(row, () => line(import_picocolors31.default.green("approved \u2014 you may start")));
|
|
9169
9393
|
})
|
|
9170
9394
|
);
|
|
9171
9395
|
task.command("start [id]").description(
|
|
@@ -9180,13 +9404,13 @@ function registerTask(program3) {
|
|
|
9180
9404
|
const started = row?.started ?? null;
|
|
9181
9405
|
if (started && started > 0) {
|
|
9182
9406
|
line(
|
|
9183
|
-
|
|
9407
|
+
import_picocolors31.default.green(
|
|
9184
9408
|
`started ${started} step${started === 1 ? "" : "s"} \u2014 they are running now`
|
|
9185
9409
|
)
|
|
9186
9410
|
);
|
|
9187
9411
|
return;
|
|
9188
9412
|
}
|
|
9189
|
-
line(
|
|
9413
|
+
line(import_picocolors31.default.yellow(row?.note ?? "Nothing started."));
|
|
9190
9414
|
});
|
|
9191
9415
|
})
|
|
9192
9416
|
);
|
|
@@ -9201,7 +9425,7 @@ function registerTask(program3) {
|
|
|
9201
9425
|
);
|
|
9202
9426
|
ok({ awaiting: row2.approval_state === "awaiting", task: row2 }, () => {
|
|
9203
9427
|
line(
|
|
9204
|
-
row2.approval_state === "awaiting" ?
|
|
9428
|
+
row2.approval_state === "awaiting" ? import_picocolors31.default.yellow(
|
|
9205
9429
|
"The plan is waiting on the owner. They see it in the task."
|
|
9206
9430
|
) : `Already ${row2.approval_state}.`
|
|
9207
9431
|
);
|
|
@@ -9226,7 +9450,7 @@ function registerTask(program3) {
|
|
|
9226
9450
|
);
|
|
9227
9451
|
ok(
|
|
9228
9452
|
row,
|
|
9229
|
-
() => line(`${
|
|
9453
|
+
() => line(`${import_picocolors31.default.green(row.approval_state)} ${import_picocolors31.default.bold(row.title)}`)
|
|
9230
9454
|
);
|
|
9231
9455
|
})
|
|
9232
9456
|
);
|
|
@@ -9242,7 +9466,7 @@ function registerTask(program3) {
|
|
|
9242
9466
|
`/v1/project-tasks/${encodeURIComponent(id)}/move`,
|
|
9243
9467
|
{ body: { status: "ready" } }
|
|
9244
9468
|
);
|
|
9245
|
-
ok(row, () => line(`${
|
|
9469
|
+
ok(row, () => line(`${import_picocolors31.default.green("ready")} ${import_picocolors31.default.bold(row.title)}`));
|
|
9246
9470
|
})
|
|
9247
9471
|
);
|
|
9248
9472
|
}
|
|
@@ -9287,24 +9511,24 @@ function assertOneOf(flag, value, allowed) {
|
|
|
9287
9511
|
}
|
|
9288
9512
|
}
|
|
9289
9513
|
function formatRow2(r) {
|
|
9290
|
-
const key =
|
|
9291
|
-
const steps = r.subtaskTotal ?
|
|
9292
|
-
const gate = r.approval_state === "awaiting" ?
|
|
9514
|
+
const key = import_picocolors31.default.dim((r.key ?? r.id.slice(0, 8)).padEnd(10));
|
|
9515
|
+
const steps = r.subtaskTotal ? import_picocolors31.default.dim(` ${r.subtaskDone}/${r.subtaskTotal}`) : "";
|
|
9516
|
+
const gate = r.approval_state === "awaiting" ? import_picocolors31.default.yellow(" awaiting approval") : "";
|
|
9293
9517
|
return `${key} ${statusTag2(r.status)} ${r.title}${steps}${gate}`;
|
|
9294
9518
|
}
|
|
9295
9519
|
function formatSubtask(r, index) {
|
|
9296
|
-
const n =
|
|
9297
|
-
const role = r.role ?
|
|
9298
|
-
const scope = r.scope_paths?.length ?
|
|
9520
|
+
const n = import_picocolors31.default.dim(String(index).padStart(2, "0"));
|
|
9521
|
+
const role = r.role ? import_picocolors31.default.dim(` [${r.role}]`) : "";
|
|
9522
|
+
const scope = r.scope_paths?.length ? import_picocolors31.default.dim(` owns: ${r.scope_paths.join(", ")}`) : "";
|
|
9299
9523
|
const head = `${n} ${statusTag2(r.status)} ${r.title}${role}${scope}`;
|
|
9300
9524
|
const summary = (r.result_summary ?? "").trim();
|
|
9301
9525
|
if (!summary) return head;
|
|
9302
9526
|
const wrapped = summary.split("\n").map((l) => ` ${l}`).join("\n");
|
|
9303
9527
|
return `${head}
|
|
9304
|
-
${
|
|
9528
|
+
${import_picocolors31.default.dim(wrapped)}`;
|
|
9305
9529
|
}
|
|
9306
9530
|
function printTask(row, goal) {
|
|
9307
|
-
line(`${
|
|
9531
|
+
line(`${import_picocolors31.default.bold(row.title)} ${import_picocolors31.default.dim(row.key ?? row.id)}`);
|
|
9308
9532
|
line(`${statusTag2(row.status)} approval: ${row.approval_state}`);
|
|
9309
9533
|
if (row.summary) line(`
|
|
9310
9534
|
${row.summary}`);
|
|
@@ -9317,53 +9541,53 @@ touches: ${row.targets.map((t) => t.appName ?? t.ref ?? t.kind).join(", ")}`
|
|
|
9317
9541
|
}
|
|
9318
9542
|
if (row.subtasks?.length) {
|
|
9319
9543
|
line(`
|
|
9320
|
-
${
|
|
9544
|
+
${import_picocolors31.default.bold("subtasks")}`);
|
|
9321
9545
|
row.subtasks.forEach((s, i) => line(formatSubtask(s, i + 1)));
|
|
9322
9546
|
line(
|
|
9323
|
-
|
|
9547
|
+
import_picocolors31.default.dim(
|
|
9324
9548
|
`
|
|
9325
9549
|
Run \`workser artifact list\` to see what these subtasks produced,`
|
|
9326
9550
|
)
|
|
9327
9551
|
);
|
|
9328
9552
|
line(
|
|
9329
|
-
|
|
9553
|
+
import_picocolors31.default.dim(
|
|
9330
9554
|
`or \`workser artifact list --step <id>\` for one subtask's output alone.`
|
|
9331
9555
|
)
|
|
9332
9556
|
);
|
|
9333
9557
|
} else {
|
|
9334
|
-
line(
|
|
9558
|
+
line(import_picocolors31.default.dim("\nNo subtasks yet."));
|
|
9335
9559
|
}
|
|
9336
9560
|
}
|
|
9337
9561
|
function printGoalContext(row, goal) {
|
|
9338
9562
|
const mine = row.phase ?? null;
|
|
9339
9563
|
line(`
|
|
9340
|
-
${
|
|
9341
|
-
if (goal.outcome) line(
|
|
9564
|
+
${import_picocolors31.default.bold("part of")}: ${goal.title}`);
|
|
9565
|
+
if (goal.outcome) line(import_picocolors31.default.dim(`done means: ${goal.outcome}`));
|
|
9342
9566
|
const progress = goal.progress ?? [];
|
|
9343
9567
|
for (const p of progress) {
|
|
9344
9568
|
const where = p.total === 0 ? "not started" : `${p.done} of ${p.total} done`;
|
|
9345
|
-
const here = mine && p.name === mine ?
|
|
9346
|
-
const mark = p.state === "done" ?
|
|
9569
|
+
const here = mine && p.name === mine ? import_picocolors31.default.cyan(" <- this task") : "";
|
|
9570
|
+
const mark = p.state === "done" ? import_picocolors31.default.green("*") : import_picocolors31.default.dim("-");
|
|
9347
9571
|
line(` ${mark} ${p.name} \u2014 ${where}${here}`);
|
|
9348
9572
|
}
|
|
9349
9573
|
const next = progress.find((p) => p.state !== "done");
|
|
9350
9574
|
const running = progress.some((p) => p.state === "working");
|
|
9351
9575
|
if (next && !running) {
|
|
9352
9576
|
line(
|
|
9353
|
-
|
|
9577
|
+
import_picocolors31.default.dim(
|
|
9354
9578
|
`
|
|
9355
9579
|
Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to them in a sentence rather than starting it unasked.`
|
|
9356
9580
|
)
|
|
9357
9581
|
);
|
|
9358
9582
|
} else if (!next) {
|
|
9359
9583
|
line(
|
|
9360
|
-
|
|
9584
|
+
import_picocolors31.default.dim(
|
|
9361
9585
|
"\nEvery part of this plan is done. Say so, and offer to wrap it up."
|
|
9362
9586
|
)
|
|
9363
9587
|
);
|
|
9364
9588
|
}
|
|
9365
9589
|
line(
|
|
9366
|
-
|
|
9590
|
+
import_picocolors31.default.dim(
|
|
9367
9591
|
"The plan is a reference for what was agreed, not a rule about what may run. Work can start on any part at any time if they ask for it."
|
|
9368
9592
|
)
|
|
9369
9593
|
);
|
|
@@ -9371,22 +9595,22 @@ Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to t
|
|
|
9371
9595
|
function statusTag2(status) {
|
|
9372
9596
|
switch (status) {
|
|
9373
9597
|
case "ready":
|
|
9374
|
-
return
|
|
9598
|
+
return import_picocolors31.default.green("[ready]");
|
|
9375
9599
|
case "working":
|
|
9376
|
-
return
|
|
9600
|
+
return import_picocolors31.default.blue("[working]");
|
|
9377
9601
|
case "checking":
|
|
9378
|
-
return
|
|
9602
|
+
return import_picocolors31.default.cyan("[checking]");
|
|
9379
9603
|
case "accepted":
|
|
9380
|
-
return
|
|
9604
|
+
return import_picocolors31.default.green("[accepted]");
|
|
9381
9605
|
case "archived":
|
|
9382
|
-
return
|
|
9606
|
+
return import_picocolors31.default.dim("[archived]");
|
|
9383
9607
|
default:
|
|
9384
|
-
return
|
|
9608
|
+
return import_picocolors31.default.dim("[todo]");
|
|
9385
9609
|
}
|
|
9386
9610
|
}
|
|
9387
9611
|
|
|
9388
9612
|
// src/commands/goal.ts
|
|
9389
|
-
var
|
|
9613
|
+
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
9390
9614
|
var STATUSES3 = ["proposed", "agreed", "working", "delivered", "abandoned"];
|
|
9391
9615
|
function registerGoal(program3) {
|
|
9392
9616
|
const goal = program3.command("goal").description("Business goals and the phases that deliver them");
|
|
@@ -9398,7 +9622,7 @@ function registerGoal(program3) {
|
|
|
9398
9622
|
}) ?? [];
|
|
9399
9623
|
ok(rows, () => {
|
|
9400
9624
|
if (!rows.length) {
|
|
9401
|
-
line(
|
|
9625
|
+
line(import_picocolors32.default.dim("No goals yet \u2014 every task here stands on its own."));
|
|
9402
9626
|
return;
|
|
9403
9627
|
}
|
|
9404
9628
|
for (const g of rows) line(formatGoal(g));
|
|
@@ -9475,10 +9699,10 @@ function registerGoal(program3) {
|
|
|
9475
9699
|
}
|
|
9476
9700
|
});
|
|
9477
9701
|
ok(row, () => {
|
|
9478
|
-
success(`Proposed ${
|
|
9702
|
+
success(`Proposed ${import_picocolors32.default.bold(row?.title ?? "goal")}`);
|
|
9479
9703
|
printGoal(row);
|
|
9480
9704
|
line(
|
|
9481
|
-
|
|
9705
|
+
import_picocolors32.default.dim(
|
|
9482
9706
|
"\nNothing has been created yet. The owner agrees the shape first."
|
|
9483
9707
|
)
|
|
9484
9708
|
);
|
|
@@ -9507,7 +9731,7 @@ function registerGoal(program3) {
|
|
|
9507
9731
|
ok(
|
|
9508
9732
|
row,
|
|
9509
9733
|
() => line(
|
|
9510
|
-
row?.recorded ? met === true ?
|
|
9734
|
+
row?.recorded ? met === true ? import_picocolors32.default.green("recorded \u2014 met") : met === false ? import_picocolors32.default.yellow("recorded \u2014 not met") : import_picocolors32.default.dim("recorded \u2014 back to unchecked") : import_picocolors32.default.yellow(
|
|
9511
9735
|
"couldn't record it \u2014 check the goal id, the phase name and the criterion id"
|
|
9512
9736
|
)
|
|
9513
9737
|
)
|
|
@@ -9550,7 +9774,7 @@ function registerGoal(program3) {
|
|
|
9550
9774
|
}
|
|
9551
9775
|
ok({ goalId, phase, filed }, () => {
|
|
9552
9776
|
success(
|
|
9553
|
-
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${
|
|
9777
|
+
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${import_picocolors32.default.bold(phase)}`
|
|
9554
9778
|
);
|
|
9555
9779
|
});
|
|
9556
9780
|
})
|
|
@@ -9582,42 +9806,42 @@ function registerGoal(program3) {
|
|
|
9582
9806
|
function appScope(g) {
|
|
9583
9807
|
const n = g.appIds?.length ?? 0;
|
|
9584
9808
|
if (!n) return "";
|
|
9585
|
-
return
|
|
9809
|
+
return import_picocolors32.default.dim(` ${n} part${n === 1 ? "" : "s"} of the system`);
|
|
9586
9810
|
}
|
|
9587
9811
|
function formatGoal(g) {
|
|
9588
|
-
const where = g.currentPhase && g.status !== "delivered" ?
|
|
9589
|
-
const count = g.taskTotal != null ?
|
|
9590
|
-
return `${statusTag3(g.status)} ${g.title}${appScope(g)}${where}${count} ${
|
|
9812
|
+
const where = g.currentPhase && g.status !== "delivered" ? import_picocolors32.default.dim(` now: ${g.currentPhase}`) : "";
|
|
9813
|
+
const count = g.taskTotal != null ? import_picocolors32.default.dim(` ${g.taskDone}/${g.taskTotal} done`) : "";
|
|
9814
|
+
return `${statusTag3(g.status)} ${g.title}${appScope(g)}${where}${count} ${import_picocolors32.default.dim(g.id)}`;
|
|
9591
9815
|
}
|
|
9592
9816
|
function printGoal(g) {
|
|
9593
9817
|
if (!g) return;
|
|
9594
|
-
line(`${
|
|
9818
|
+
line(`${import_picocolors32.default.bold(g.title)} ${import_picocolors32.default.dim(g.id)}`);
|
|
9595
9819
|
line(statusTag3(g.status));
|
|
9596
9820
|
if (g.outcome) line(`
|
|
9597
9821
|
done means: ${g.outcome}`);
|
|
9598
9822
|
const progress = g.progress ?? [];
|
|
9599
9823
|
if (!progress.length) {
|
|
9600
|
-
line(
|
|
9824
|
+
line(import_picocolors32.default.dim("\nNo phases agreed yet."));
|
|
9601
9825
|
return;
|
|
9602
9826
|
}
|
|
9603
9827
|
line(`
|
|
9604
|
-
${
|
|
9828
|
+
${import_picocolors32.default.bold("phases")}`);
|
|
9605
9829
|
for (const p of progress) {
|
|
9606
|
-
const bar2 = p.total > 0 ? `${p.done}/${p.total} done` :
|
|
9607
|
-
const mark = p.state === "done" ?
|
|
9830
|
+
const bar2 = p.total > 0 ? `${p.done}/${p.total} done` : import_picocolors32.default.dim("nothing filed yet");
|
|
9831
|
+
const mark = p.state === "done" ? import_picocolors32.default.green("done") : p.state === "working" ? import_picocolors32.default.blue("working") : import_picocolors32.default.dim("waiting");
|
|
9608
9832
|
line(
|
|
9609
|
-
` ${
|
|
9833
|
+
` ${import_picocolors32.default.dim(String(p.index).padStart(2, "0"))} ${p.name} ${mark} ${import_picocolors32.default.dim(bar2)}`
|
|
9610
9834
|
);
|
|
9611
9835
|
for (const c of p.criteria ?? []) {
|
|
9612
|
-
const tick = c.met === true ?
|
|
9613
|
-
line(` ${tick} ${c.text} ${
|
|
9614
|
-
if (c.note) line(
|
|
9836
|
+
const tick = c.met === true ? import_picocolors32.default.green("\u2713") : c.met === false ? import_picocolors32.default.red("\u2717") : import_picocolors32.default.dim("\xB7");
|
|
9837
|
+
line(` ${tick} ${c.text} ${import_picocolors32.default.dim(c.id)}`);
|
|
9838
|
+
if (c.note) line(import_picocolors32.default.dim(` ${c.note}`));
|
|
9615
9839
|
}
|
|
9616
9840
|
}
|
|
9617
9841
|
const current = progress.find((p) => p.name === g.currentPhase);
|
|
9618
9842
|
if (current) {
|
|
9619
9843
|
line(
|
|
9620
|
-
|
|
9844
|
+
import_picocolors32.default.dim(
|
|
9621
9845
|
`
|
|
9622
9846
|
${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current.index} of ${progress.length}).`
|
|
9623
9847
|
)
|
|
@@ -9627,15 +9851,15 @@ ${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current
|
|
|
9627
9851
|
function statusTag3(status) {
|
|
9628
9852
|
switch (status) {
|
|
9629
9853
|
case "agreed":
|
|
9630
|
-
return
|
|
9854
|
+
return import_picocolors32.default.cyan("[agreed]");
|
|
9631
9855
|
case "working":
|
|
9632
|
-
return
|
|
9856
|
+
return import_picocolors32.default.blue("[working]");
|
|
9633
9857
|
case "delivered":
|
|
9634
|
-
return
|
|
9858
|
+
return import_picocolors32.default.green("[delivered]");
|
|
9635
9859
|
case "abandoned":
|
|
9636
|
-
return
|
|
9860
|
+
return import_picocolors32.default.dim("[abandoned]");
|
|
9637
9861
|
default:
|
|
9638
|
-
return
|
|
9862
|
+
return import_picocolors32.default.yellow("[proposed]");
|
|
9639
9863
|
}
|
|
9640
9864
|
}
|
|
9641
9865
|
|
|
@@ -9819,7 +10043,7 @@ function stripLeadingGlobalOptions(argv) {
|
|
|
9819
10043
|
}
|
|
9820
10044
|
|
|
9821
10045
|
// src/commands/decision.ts
|
|
9822
|
-
var
|
|
10046
|
+
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
9823
10047
|
function registerDecision(program3) {
|
|
9824
10048
|
const decision = program3.command("decision").description("Read and record the project's architecture decisions");
|
|
9825
10049
|
decision.command("list").description("Every decision on record \u2014 read this before changing how something works").option("--limit <n>", "cap the number returned (newest first)").action(
|
|
@@ -9832,11 +10056,11 @@ function registerDecision(program3) {
|
|
|
9832
10056
|
rows = applyLimit(rows, opts.limit);
|
|
9833
10057
|
ok(rows, () => {
|
|
9834
10058
|
if (!rows.length) {
|
|
9835
|
-
line(
|
|
10059
|
+
line(import_picocolors33.default.dim("No decisions recorded yet."));
|
|
9836
10060
|
return;
|
|
9837
10061
|
}
|
|
9838
10062
|
for (const r of rows) {
|
|
9839
|
-
line(`${
|
|
10063
|
+
line(`${import_picocolors33.default.dim(r.id)} ${import_picocolors33.default.dim(shortDate(r.createdAt))} ${r.title}`);
|
|
9840
10064
|
line(` ${truncate(r.decision, 100)}`);
|
|
9841
10065
|
}
|
|
9842
10066
|
});
|
|
@@ -9850,16 +10074,16 @@ function registerDecision(program3) {
|
|
|
9850
10074
|
`/v1/projects/${projectId}/architecture-decisions/${args[0]}`
|
|
9851
10075
|
);
|
|
9852
10076
|
ok(row, () => {
|
|
9853
|
-
line(`${
|
|
9854
|
-
line(
|
|
10077
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10078
|
+
line(import_picocolors33.default.dim(`${row.status} \xB7 ${shortDate(row.createdAt)}`));
|
|
9855
10079
|
line(`
|
|
9856
|
-
${
|
|
10080
|
+
${import_picocolors33.default.bold("Context")}
|
|
9857
10081
|
${row.context}`);
|
|
9858
10082
|
line(`
|
|
9859
|
-
${
|
|
10083
|
+
${import_picocolors33.default.bold("Decision")}
|
|
9860
10084
|
${row.decision}`);
|
|
9861
10085
|
if (row.consequences) line(`
|
|
9862
|
-
${
|
|
10086
|
+
${import_picocolors33.default.bold("Consequences")}
|
|
9863
10087
|
${row.consequences}`);
|
|
9864
10088
|
});
|
|
9865
10089
|
})
|
|
@@ -9888,7 +10112,7 @@ ${row.consequences}`);
|
|
|
9888
10112
|
refId: row?.id,
|
|
9889
10113
|
output: { decision: row }
|
|
9890
10114
|
});
|
|
9891
|
-
ok(row, () => line(`Recorded decision ${
|
|
10115
|
+
ok(row, () => line(`Recorded decision ${import_picocolors33.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
9892
10116
|
})
|
|
9893
10117
|
);
|
|
9894
10118
|
const requirement = program3.command("requirement").description("Read and record the project's requirements");
|
|
@@ -9900,11 +10124,11 @@ ${row.consequences}`);
|
|
|
9900
10124
|
rows = applyLimit(rows, opts.limit);
|
|
9901
10125
|
ok(rows, () => {
|
|
9902
10126
|
if (!rows.length) {
|
|
9903
|
-
line(
|
|
10127
|
+
line(import_picocolors33.default.dim("No requirements recorded yet."));
|
|
9904
10128
|
return;
|
|
9905
10129
|
}
|
|
9906
10130
|
for (const r of rows) {
|
|
9907
|
-
line(`${
|
|
10131
|
+
line(`${import_picocolors33.default.dim(r.id)} ${r.status.padEnd(9)} ${r.title}`);
|
|
9908
10132
|
}
|
|
9909
10133
|
});
|
|
9910
10134
|
})
|
|
@@ -9917,8 +10141,8 @@ ${row.consequences}`);
|
|
|
9917
10141
|
`/v1/projects/${projectId}/requirements/${args[0]}`
|
|
9918
10142
|
);
|
|
9919
10143
|
ok(row, () => {
|
|
9920
|
-
line(`${
|
|
9921
|
-
line(
|
|
10144
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10145
|
+
line(import_picocolors33.default.dim(`${row.status} \xB7 ${shortDate(row.createdAt)}`));
|
|
9922
10146
|
line(`
|
|
9923
10147
|
${row.body}`);
|
|
9924
10148
|
});
|
|
@@ -9944,7 +10168,7 @@ ${row.body}`);
|
|
|
9944
10168
|
refId: row?.id,
|
|
9945
10169
|
output: { requirement: row }
|
|
9946
10170
|
});
|
|
9947
|
-
ok(row, () => line(`Recorded requirement ${
|
|
10171
|
+
ok(row, () => line(`Recorded requirement ${import_picocolors33.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
9948
10172
|
})
|
|
9949
10173
|
);
|
|
9950
10174
|
requirement.command("update <id>").description(
|
|
@@ -9973,7 +10197,7 @@ ${row.body}`);
|
|
|
9973
10197
|
code: "bad_request"
|
|
9974
10198
|
});
|
|
9975
10199
|
}
|
|
9976
|
-
ok(row, () => line(`Updated requirement ${
|
|
10200
|
+
ok(row, () => line(`Updated requirement ${import_picocolors33.default.bold(row.id)} \u2014 ${row.title} (${row.status})`));
|
|
9977
10201
|
})
|
|
9978
10202
|
);
|
|
9979
10203
|
}
|
|
@@ -9996,7 +10220,7 @@ function shortDate(iso) {
|
|
|
9996
10220
|
}
|
|
9997
10221
|
|
|
9998
10222
|
// src/commands/doc.ts
|
|
9999
|
-
var
|
|
10223
|
+
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
10000
10224
|
|
|
10001
10225
|
// src/mermaid-fences.ts
|
|
10002
10226
|
function hasDiagram(code) {
|
|
@@ -10041,13 +10265,13 @@ function registerDoc(program3) {
|
|
|
10041
10265
|
}) ?? [];
|
|
10042
10266
|
ok(rows, () => {
|
|
10043
10267
|
if (!rows.length) {
|
|
10044
|
-
line(
|
|
10268
|
+
line(import_picocolors34.default.dim("No documents yet."));
|
|
10045
10269
|
return;
|
|
10046
10270
|
}
|
|
10047
10271
|
for (const r of rows) {
|
|
10048
|
-
const link = r.workItemId ?
|
|
10049
|
-
const file = r.filePath ?
|
|
10050
|
-
line(`${
|
|
10272
|
+
const link = r.workItemId ? import_picocolors34.default.dim(` \u21B3 ${r.workItemId}`) : "";
|
|
10273
|
+
const file = r.filePath ? import_picocolors34.default.dim(` ${r.filePath}`) : "";
|
|
10274
|
+
line(`${import_picocolors34.default.dim(r.id)} ${r.title}${link}${file}`);
|
|
10051
10275
|
}
|
|
10052
10276
|
});
|
|
10053
10277
|
})
|
|
@@ -10061,17 +10285,17 @@ function registerDoc(program3) {
|
|
|
10061
10285
|
);
|
|
10062
10286
|
if (opts.markdown) {
|
|
10063
10287
|
ok({ id: row.id, title: row.title, filePath: row.filePath }, () => {
|
|
10064
|
-
line(`${
|
|
10288
|
+
line(`${import_picocolors34.default.bold(row.title)} ${import_picocolors34.default.dim(row.id)}`);
|
|
10065
10289
|
line(
|
|
10066
|
-
row.filePath ? `Read it at ${
|
|
10290
|
+
row.filePath ? `Read it at ${import_picocolors34.default.bold(row.filePath)} (relative to the project folder).` : import_picocolors34.default.dim("This document has no markdown mirror on disk yet.")
|
|
10067
10291
|
);
|
|
10068
10292
|
});
|
|
10069
10293
|
return;
|
|
10070
10294
|
}
|
|
10071
10295
|
ok(row, () => {
|
|
10072
|
-
line(`${
|
|
10073
|
-
if (row.workItemId) line(
|
|
10074
|
-
if (row.filePath) line(
|
|
10296
|
+
line(`${import_picocolors34.default.bold(row.title)} ${import_picocolors34.default.dim(row.id)}`);
|
|
10297
|
+
if (row.workItemId) line(import_picocolors34.default.dim(`linked to work item ${row.workItemId}`));
|
|
10298
|
+
if (row.filePath) line(import_picocolors34.default.dim(`markdown mirror: ${row.filePath}`));
|
|
10075
10299
|
line("");
|
|
10076
10300
|
line(row.contentJson);
|
|
10077
10301
|
});
|
|
@@ -10100,7 +10324,7 @@ function registerDoc(program3) {
|
|
|
10100
10324
|
refId: row?.id,
|
|
10101
10325
|
output: { document: row }
|
|
10102
10326
|
});
|
|
10103
|
-
ok(row, () => line(`Created document ${
|
|
10327
|
+
ok(row, () => line(`Created document ${import_picocolors34.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10104
10328
|
})
|
|
10105
10329
|
);
|
|
10106
10330
|
doc.command("diagram <id>").description(
|
|
@@ -10126,19 +10350,19 @@ function registerDoc(program3) {
|
|
|
10126
10350
|
diagrams: diagrams.map((code) => ({ kind: diagramKind(code), code }))
|
|
10127
10351
|
};
|
|
10128
10352
|
ok(payload, () => {
|
|
10129
|
-
line(`${
|
|
10353
|
+
line(`${import_picocolors34.default.bold(row.title)} ${import_picocolors34.default.dim(row.id)}`);
|
|
10130
10354
|
if (markdown === null) {
|
|
10131
10355
|
line(
|
|
10132
|
-
|
|
10356
|
+
import_picocolors34.default.dim(
|
|
10133
10357
|
row.filePath ? `Could not read ${row.filePath} from this folder.` : "This document has no markdown mirror on disk yet."
|
|
10134
10358
|
)
|
|
10135
10359
|
);
|
|
10136
10360
|
} else if (!diagrams.length) {
|
|
10137
|
-
line(
|
|
10361
|
+
line(import_picocolors34.default.dim("No diagrams in this document."));
|
|
10138
10362
|
} else {
|
|
10139
10363
|
for (const [i, code] of diagrams.entries()) {
|
|
10140
10364
|
const kind = diagramKind(code) ?? "diagram";
|
|
10141
|
-
line(`${
|
|
10365
|
+
line(`${import_picocolors34.default.dim(String(i + 1))} ${kind} ${import_picocolors34.default.dim(`${code.split("\n").length} lines`)}`);
|
|
10142
10366
|
}
|
|
10143
10367
|
}
|
|
10144
10368
|
});
|
|
@@ -10174,7 +10398,7 @@ function registerDoc(program3) {
|
|
|
10174
10398
|
code: "bad_request"
|
|
10175
10399
|
});
|
|
10176
10400
|
}
|
|
10177
|
-
ok(row, () => line(`Updated document ${
|
|
10401
|
+
ok(row, () => line(`Updated document ${import_picocolors34.default.bold(row.id)} \u2014 ${row.title}`));
|
|
10178
10402
|
})
|
|
10179
10403
|
);
|
|
10180
10404
|
}
|
|
@@ -10188,7 +10412,7 @@ function readMirror(cwd, filePath) {
|
|
|
10188
10412
|
}
|
|
10189
10413
|
|
|
10190
10414
|
// src/commands/design.ts
|
|
10191
|
-
var
|
|
10415
|
+
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
10192
10416
|
function registerDesign(program3) {
|
|
10193
10417
|
const design = program3.command("design").description("Read the project's brand (colours, fonts, logo)");
|
|
10194
10418
|
design.command("show").description("Show this project's brand \u2014 read it before writing any UI").option("--raw", "print the generated token files verbatim instead of a summary").action(
|
|
@@ -10202,11 +10426,11 @@ function registerDesign(program3) {
|
|
|
10202
10426
|
if (opts.raw) {
|
|
10203
10427
|
ok(files, () => {
|
|
10204
10428
|
if (!files.length) {
|
|
10205
|
-
line(
|
|
10429
|
+
line(import_picocolors35.default.dim("No brand set for this project."));
|
|
10206
10430
|
return;
|
|
10207
10431
|
}
|
|
10208
10432
|
for (const f of files) {
|
|
10209
|
-
line(
|
|
10433
|
+
line(import_picocolors35.default.bold(f.path));
|
|
10210
10434
|
line(f.contents);
|
|
10211
10435
|
line("");
|
|
10212
10436
|
}
|
|
@@ -10223,21 +10447,21 @@ function registerDesign(program3) {
|
|
|
10223
10447
|
} : { hasBrand: false, colors: {}, fonts: {}, brand: {}, files: [] };
|
|
10224
10448
|
ok(summary, () => {
|
|
10225
10449
|
if (!tokens) {
|
|
10226
|
-
line(
|
|
10450
|
+
line(import_picocolors35.default.dim("No brand set for this project \u2014 choose sensible styling yourself."));
|
|
10227
10451
|
return;
|
|
10228
10452
|
}
|
|
10229
10453
|
for (const [name, value] of Object.entries(tokens.brand)) {
|
|
10230
|
-
line(`${
|
|
10454
|
+
line(`${import_picocolors35.default.dim(name.padEnd(12))} ${value}`);
|
|
10231
10455
|
}
|
|
10232
10456
|
for (const [name, value] of Object.entries(tokens.color)) {
|
|
10233
|
-
line(`${
|
|
10457
|
+
line(`${import_picocolors35.default.dim(`color.${name}`.padEnd(12))} ${value}`);
|
|
10234
10458
|
}
|
|
10235
10459
|
for (const [name, value] of Object.entries(tokens.font)) {
|
|
10236
|
-
line(`${
|
|
10460
|
+
line(`${import_picocolors35.default.dim(`font.${name}`.padEnd(12))} ${value}`);
|
|
10237
10461
|
}
|
|
10238
10462
|
line("");
|
|
10239
10463
|
line(
|
|
10240
|
-
|
|
10464
|
+
import_picocolors35.default.dim(
|
|
10241
10465
|
`Generated into the working tree as ${files.map((f) => f.path).join(", ")} \u2014 wire those in, never edit them.`
|
|
10242
10466
|
)
|
|
10243
10467
|
);
|
|
@@ -10268,7 +10492,7 @@ function unwrap(group) {
|
|
|
10268
10492
|
}
|
|
10269
10493
|
|
|
10270
10494
|
// src/commands/api.ts
|
|
10271
|
-
var
|
|
10495
|
+
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
10272
10496
|
import { readdirSync, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|
|
10273
10497
|
import { join as join3, relative, sep } from "path";
|
|
10274
10498
|
|
|
@@ -10382,10 +10606,10 @@ function registerApi(program3) {
|
|
|
10382
10606
|
const appId = requireApp2(opts.app);
|
|
10383
10607
|
const res = await api(ctx, `/v1/apps/${encodeURIComponent(appId)}/api/requests`);
|
|
10384
10608
|
ok(res, () => {
|
|
10385
|
-
for (const note of res?.notes ?? []) line(
|
|
10609
|
+
for (const note of res?.notes ?? []) line(import_picocolors36.default.dim(note));
|
|
10386
10610
|
for (const r of res?.requests ?? []) {
|
|
10387
10611
|
line(
|
|
10388
|
-
`${
|
|
10612
|
+
`${import_picocolors36.default.dim(r.method.padEnd(6))}${r.path}${r.note ? import_picocolors36.default.dim(` ${r.note}`) : ""}`
|
|
10389
10613
|
);
|
|
10390
10614
|
}
|
|
10391
10615
|
});
|
|
@@ -10419,14 +10643,14 @@ function registerApi(program3) {
|
|
|
10419
10643
|
);
|
|
10420
10644
|
ok(res, () => {
|
|
10421
10645
|
if (!res?.ok) {
|
|
10422
|
-
line(
|
|
10646
|
+
line(import_picocolors36.default.red(res?.error ?? "The service did not answer."));
|
|
10423
10647
|
return;
|
|
10424
10648
|
}
|
|
10425
10649
|
const code = `${res.status}${res.statusText ? ` ${res.statusText}` : ""}`;
|
|
10426
|
-
const colour2 = res.status && res.status < 300 ?
|
|
10427
|
-
line(`${colour2(code)} ${
|
|
10650
|
+
const colour2 = res.status && res.status < 300 ? import_picocolors36.default.green : res.status && res.status < 500 ? import_picocolors36.default.yellow : import_picocolors36.default.red;
|
|
10651
|
+
line(`${colour2(code)} ${import_picocolors36.default.dim(`${res.durationMs}ms ${res.url}`)}`);
|
|
10428
10652
|
if (res.body) line(res.body);
|
|
10429
|
-
if (res.truncated) line(
|
|
10653
|
+
if (res.truncated) line(import_picocolors36.default.dim("(answer truncated)"));
|
|
10430
10654
|
});
|
|
10431
10655
|
if (!res?.ok) process.exitCode = 1;
|
|
10432
10656
|
})
|
|
@@ -10446,15 +10670,15 @@ function registerApi(program3) {
|
|
|
10446
10670
|
for (const r of report.routes) {
|
|
10447
10671
|
const known = report.missing.some((m) => m.path === r.path);
|
|
10448
10672
|
line(
|
|
10449
|
-
`${known ?
|
|
10673
|
+
`${known ? import_picocolors36.default.yellow("undocumented") : import_picocolors36.default.green("documented ")} ${r.path}${import_picocolors36.default.dim(` ${r.file}`)}`
|
|
10450
10674
|
);
|
|
10451
10675
|
}
|
|
10452
10676
|
for (const p of report.stale) {
|
|
10453
|
-
line(`${
|
|
10677
|
+
line(`${import_picocolors36.default.dim("in spec only ")} ${p}`);
|
|
10454
10678
|
}
|
|
10455
10679
|
line("");
|
|
10456
10680
|
if (report.ok && specFile) success(summary);
|
|
10457
|
-
else line(
|
|
10681
|
+
else line(import_picocolors36.default.yellow(summary));
|
|
10458
10682
|
});
|
|
10459
10683
|
if (opts.check && !report.ok) {
|
|
10460
10684
|
throw new WorkserError(summary, { code: "bad_request" });
|
|
@@ -10525,7 +10749,7 @@ function listRepoFiles(root, maxDepth = 8) {
|
|
|
10525
10749
|
}
|
|
10526
10750
|
|
|
10527
10751
|
// src/commands/analysis.ts
|
|
10528
|
-
var
|
|
10752
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
10529
10753
|
import { readFileSync as readFileSync4 } from "fs";
|
|
10530
10754
|
function registerAnalysis(program3) {
|
|
10531
10755
|
const cmd = program3.command("analysis").description("Run Python analysis locally, recorded in the task");
|
|
@@ -10535,14 +10759,14 @@ function registerAnalysis(program3) {
|
|
|
10535
10759
|
const res = await api(ctx, path);
|
|
10536
10760
|
ok(res, () => {
|
|
10537
10761
|
line(
|
|
10538
|
-
`${res?.available ?
|
|
10762
|
+
`${res?.available ? import_picocolors37.default.green("python") : import_picocolors37.default.red("python")} ${res?.version ?? "not found"} ${import_picocolors37.default.dim(res?.python ?? "")}`
|
|
10539
10763
|
);
|
|
10540
10764
|
for (const lib of res?.libraries ?? []) {
|
|
10541
10765
|
line(
|
|
10542
|
-
`${lib.present ?
|
|
10766
|
+
`${lib.present ? import_picocolors37.default.green(lib.name) : import_picocolors37.default.yellow(lib.name)}${import_picocolors37.default.dim(lib.present ? "" : " missing")}`
|
|
10543
10767
|
);
|
|
10544
10768
|
}
|
|
10545
|
-
for (const note of res?.notes ?? []) line(
|
|
10769
|
+
for (const note of res?.notes ?? []) line(import_picocolors37.default.dim(note));
|
|
10546
10770
|
});
|
|
10547
10771
|
if (!res?.available) process.exitCode = 1;
|
|
10548
10772
|
})
|
|
@@ -10564,15 +10788,15 @@ function registerAnalysis(program3) {
|
|
|
10564
10788
|
);
|
|
10565
10789
|
ok(res, () => {
|
|
10566
10790
|
if (res?.stdout) line(res.stdout.replace(/\n$/, ""));
|
|
10567
|
-
if (res?.stderr) line(
|
|
10568
|
-
if (res?.truncated) line(
|
|
10791
|
+
if (res?.stderr) line(import_picocolors37.default.dim(res.stderr.replace(/\n$/, "")));
|
|
10792
|
+
if (res?.truncated) line(import_picocolors37.default.dim("(output truncated)"));
|
|
10569
10793
|
const took = `${Math.round((res?.durationMs ?? 0) / 100) / 10}s`;
|
|
10570
10794
|
line(
|
|
10571
|
-
res?.ok ?
|
|
10795
|
+
res?.ok ? import_picocolors37.default.green(`\u2713 ${res.summary ?? "It finished."}`) + import_picocolors37.default.dim(` ${took}`) : import_picocolors37.default.yellow(res?.summary ?? "It did not finish.") + import_picocolors37.default.dim(` ${took}`)
|
|
10572
10796
|
);
|
|
10573
10797
|
if (res && !res.sandboxed) {
|
|
10574
10798
|
line(
|
|
10575
|
-
|
|
10799
|
+
import_picocolors37.default.dim(
|
|
10576
10800
|
"This platform has no OS sandbox, so the script ran with your own file access."
|
|
10577
10801
|
)
|
|
10578
10802
|
);
|
|
@@ -10600,7 +10824,7 @@ function readCode(file, inline) {
|
|
|
10600
10824
|
}
|
|
10601
10825
|
|
|
10602
10826
|
// src/commands/scan.ts
|
|
10603
|
-
var
|
|
10827
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
10604
10828
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
10605
10829
|
import { existsSync as existsSync3, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
|
|
10606
10830
|
import { join as join4, relative as relative2, sep as sep2 } from "path";
|
|
@@ -10884,22 +11108,22 @@ function runPermissions(cwd, findings, checked, skipped) {
|
|
|
10884
11108
|
}
|
|
10885
11109
|
function print2(report, summary) {
|
|
10886
11110
|
for (const s of report.skipped) {
|
|
10887
|
-
line(`${
|
|
11111
|
+
line(`${import_picocolors38.default.yellow("not checked")} ${s.check}${import_picocolors38.default.dim(` \u2014 ${s.reason}`)}`);
|
|
10888
11112
|
}
|
|
10889
11113
|
for (const f of report.findings) {
|
|
10890
|
-
const where = f.file ?
|
|
11114
|
+
const where = f.file ? import_picocolors38.default.dim(` ${f.file}${f.line ? `:${f.line}` : ""}`) : "";
|
|
10891
11115
|
line(`${severityTag(f.severity)} ${f.title}${where}`);
|
|
10892
|
-
line(` ${
|
|
11116
|
+
line(` ${import_picocolors38.default.dim(f.fix)}`);
|
|
10893
11117
|
}
|
|
10894
11118
|
if (report.findings.length || report.skipped.length) line("");
|
|
10895
11119
|
if (report.ok && !report.skipped.length) success(summary);
|
|
10896
|
-
else if (report.ok) line(
|
|
10897
|
-
else line(
|
|
11120
|
+
else if (report.ok) line(import_picocolors38.default.yellow(summary));
|
|
11121
|
+
else line(import_picocolors38.default.red(summary));
|
|
10898
11122
|
}
|
|
10899
11123
|
function severityTag(severity) {
|
|
10900
|
-
if (severity === "high") return
|
|
10901
|
-
if (severity === "medium") return
|
|
10902
|
-
return
|
|
11124
|
+
if (severity === "high") return import_picocolors38.default.red("serious ");
|
|
11125
|
+
if (severity === "medium") return import_picocolors38.default.yellow("worth fixing");
|
|
11126
|
+
return import_picocolors38.default.dim("minor ");
|
|
10903
11127
|
}
|
|
10904
11128
|
function git(cwd, args) {
|
|
10905
11129
|
try {
|
|
@@ -10960,7 +11184,7 @@ function listRepoFiles2(root, maxDepth = 8) {
|
|
|
10960
11184
|
}
|
|
10961
11185
|
|
|
10962
11186
|
// src/commands/health.ts
|
|
10963
|
-
var
|
|
11187
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
10964
11188
|
function registerHealth(program3) {
|
|
10965
11189
|
program3.command("health").description("Check that the published apps in this project are still answering").option("--app <webAppId>", "check one app rather than all of them").action(
|
|
10966
11190
|
action(async ({ ctx, opts }) => {
|
|
@@ -10974,16 +11198,16 @@ function registerHealth(program3) {
|
|
|
10974
11198
|
}
|
|
10975
11199
|
function print3(res) {
|
|
10976
11200
|
if (!res?.checks?.length) {
|
|
10977
|
-
line(
|
|
11201
|
+
line(import_picocolors39.default.dim(res?.note ?? "Nothing to check."));
|
|
10978
11202
|
return;
|
|
10979
11203
|
}
|
|
10980
11204
|
for (const c of res.checks) {
|
|
10981
|
-
const mark = c.ok ?
|
|
10982
|
-
const timing =
|
|
10983
|
-
const detail = c.ok ? timing :
|
|
10984
|
-
line(` ${mark} ${c.appName} ${
|
|
11205
|
+
const mark = c.ok ? import_picocolors39.default.green("up ") : import_picocolors39.default.red("down");
|
|
11206
|
+
const timing = import_picocolors39.default.dim(`${c.ms}ms`);
|
|
11207
|
+
const detail = c.ok ? timing : import_picocolors39.default.dim(`${c.error ?? "no answer"}${c.failures > 1 ? ` \xB7 ${c.failures} in a row` : ""}`);
|
|
11208
|
+
line(` ${mark} ${c.appName} ${import_picocolors39.default.dim(`(${c.environment})`)} ${c.url} ${detail}`);
|
|
10985
11209
|
if (c.incidentOpened) {
|
|
10986
|
-
line(
|
|
11210
|
+
line(import_picocolors39.default.yellow(` An incident has been opened on the board for this.`));
|
|
10987
11211
|
}
|
|
10988
11212
|
}
|
|
10989
11213
|
const down = res.checks.filter((c) => !c.ok);
|
|
@@ -10996,14 +11220,14 @@ function print3(res) {
|
|
|
10996
11220
|
}
|
|
10997
11221
|
const production = down.filter((c) => c.environment === "production").length;
|
|
10998
11222
|
line(
|
|
10999
|
-
|
|
11223
|
+
import_picocolors39.default.red(
|
|
11000
11224
|
`${down.length} of ${res.checks.length} not answering` + (production ? ` \u2014 ${production} customer-facing.` : " (preview only).")
|
|
11001
11225
|
)
|
|
11002
11226
|
);
|
|
11003
11227
|
}
|
|
11004
11228
|
|
|
11005
11229
|
// src/commands/urls.ts
|
|
11006
|
-
var
|
|
11230
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
11007
11231
|
function registerUrls(program3) {
|
|
11008
11232
|
program3.command("urls").description("The stable preview and production addresses of every app in this project").option("--app <webAppId>", "just one app").action(
|
|
11009
11233
|
action(async ({ ctx, opts }) => {
|
|
@@ -11017,20 +11241,20 @@ function registerUrls(program3) {
|
|
|
11017
11241
|
const summary = urlsSummary(rows);
|
|
11018
11242
|
ok({ rows, summary }, () => {
|
|
11019
11243
|
for (const row of rows) {
|
|
11020
|
-
const label =
|
|
11021
|
-
const value = row.url ?
|
|
11244
|
+
const label = import_picocolors40.default.dim(row.environment.padEnd(10));
|
|
11245
|
+
const value = row.url ? import_picocolors40.default.cyan(row.url) : import_picocolors40.default.dim(row.note ?? "not published");
|
|
11022
11246
|
line(` ${row.appName.padEnd(22)} ${label} ${value}`);
|
|
11023
11247
|
}
|
|
11024
11248
|
line("");
|
|
11025
11249
|
if (rows.some((r) => r.url)) success(summary);
|
|
11026
|
-
else line(
|
|
11250
|
+
else line(import_picocolors40.default.yellow(summary));
|
|
11027
11251
|
});
|
|
11028
11252
|
})
|
|
11029
11253
|
);
|
|
11030
11254
|
}
|
|
11031
11255
|
|
|
11032
11256
|
// src/commands/deployments.ts
|
|
11033
|
-
var
|
|
11257
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
11034
11258
|
function registerDeployments(program3) {
|
|
11035
11259
|
const cmd = program3.command("deployments").description("Deployment history, and putting a build in front of customers");
|
|
11036
11260
|
cmd.command("list").description("What has been built, newest first").option("--app <webAppId>", "just one app (default: every app in the project)").option("--env <environment>", "preview or production").option("--limit <n>", "how many to show", "20").action(
|
|
@@ -11048,7 +11272,7 @@ function registerDeployments(program3) {
|
|
|
11048
11272
|
ok(res, () => {
|
|
11049
11273
|
if (!items.length) {
|
|
11050
11274
|
return line(
|
|
11051
|
-
|
|
11275
|
+
import_picocolors41.default.dim(
|
|
11052
11276
|
environment ? `Nothing has been deployed to ${environment} yet.` : "Nothing has been deployed yet. `workser deploy` builds the first one."
|
|
11053
11277
|
)
|
|
11054
11278
|
);
|
|
@@ -11068,13 +11292,13 @@ function registerDeployments(program3) {
|
|
|
11068
11292
|
).catch(() => null) : null;
|
|
11069
11293
|
ok({ ...dep, logs }, () => {
|
|
11070
11294
|
line(formatDeployment(dep));
|
|
11071
|
-
if (dep?.error_message) line(
|
|
11295
|
+
if (dep?.error_message) line(import_picocolors41.default.red(` ${dep.error_message}`));
|
|
11072
11296
|
const events = logs?.events ?? [];
|
|
11073
11297
|
for (const e of events) {
|
|
11074
|
-
line(` ${
|
|
11298
|
+
line(` ${import_picocolors41.default.dim(String(e.type ?? "log"))} ${e.text ?? ""}`);
|
|
11075
11299
|
}
|
|
11076
11300
|
if (opts.logs && !events.length) {
|
|
11077
|
-
line(
|
|
11301
|
+
line(import_picocolors41.default.dim(" That build produced no output."));
|
|
11078
11302
|
}
|
|
11079
11303
|
});
|
|
11080
11304
|
})
|
|
@@ -11118,16 +11342,16 @@ function printPromoted(res, version) {
|
|
|
11118
11342
|
const what = version === null ? "the latest build" : `version ${version}`;
|
|
11119
11343
|
const url = res.url ?? res.vercel_url;
|
|
11120
11344
|
success(`Production is being rebuilt from ${what}.`);
|
|
11121
|
-
if (url) line(
|
|
11122
|
-
line(
|
|
11345
|
+
if (url) line(import_picocolors41.default.dim(`It will be at ${url}`));
|
|
11346
|
+
line(import_picocolors41.default.dim("`workser deploy status` follows it."));
|
|
11123
11347
|
}
|
|
11124
11348
|
function formatDeployment(d) {
|
|
11125
11349
|
if (!d) return "";
|
|
11126
|
-
const version = d.version !== void 0 ?
|
|
11127
|
-
const env =
|
|
11350
|
+
const version = d.version !== void 0 ? import_picocolors41.default.yellow(`v${d.version}`) : import_picocolors41.default.dim("v?");
|
|
11351
|
+
const env = import_picocolors41.default.dim((d.environment ?? "?").padEnd(10));
|
|
11128
11352
|
const app = d.webAppName ? `${d.webAppName} ` : "";
|
|
11129
|
-
const when =
|
|
11130
|
-
const url = d.url ? " " +
|
|
11353
|
+
const when = import_picocolors41.default.dim(formatTime2(d.created_at));
|
|
11354
|
+
const url = d.url ? " " + import_picocolors41.default.cyan(d.url) : "";
|
|
11131
11355
|
return `${version} ${env} ${colorStatus(d.status ?? "")} ${app}${when}${url}`;
|
|
11132
11356
|
}
|
|
11133
11357
|
function formatTime2(t) {
|
|
@@ -11137,7 +11361,7 @@ function formatTime2(t) {
|
|
|
11137
11361
|
}
|
|
11138
11362
|
|
|
11139
11363
|
// src/commands/usage.ts
|
|
11140
|
-
var
|
|
11364
|
+
var import_picocolors42 = __toESM(require_picocolors(), 1);
|
|
11141
11365
|
|
|
11142
11366
|
// src/usage.ts
|
|
11143
11367
|
var NEAR_LIMIT_FRACTION = 0.8;
|
|
@@ -11232,7 +11456,7 @@ function registerUsage(program3) {
|
|
|
11232
11456
|
function print4(report) {
|
|
11233
11457
|
const dims = report.dimensions ?? [];
|
|
11234
11458
|
if (!dims.length) {
|
|
11235
|
-
return line(
|
|
11459
|
+
return line(import_picocolors42.default.dim("Nothing to measure for this project yet."));
|
|
11236
11460
|
}
|
|
11237
11461
|
const width = Math.max(...dims.map((d) => d.label.length));
|
|
11238
11462
|
for (const d of dims) {
|
|
@@ -11241,23 +11465,23 @@ function print4(report) {
|
|
|
11241
11465
|
line("");
|
|
11242
11466
|
const summary = usageSummary(report);
|
|
11243
11467
|
const worst = dims.map(usageState);
|
|
11244
|
-
if (worst.includes("over")) line(
|
|
11468
|
+
if (worst.includes("over")) line(import_picocolors42.default.red(summary));
|
|
11245
11469
|
else if (worst.includes("near") || worst.includes("unknown"))
|
|
11246
|
-
line(
|
|
11470
|
+
line(import_picocolors42.default.yellow(summary));
|
|
11247
11471
|
else success(summary);
|
|
11248
11472
|
}
|
|
11249
11473
|
function gauge(d, _labelWidth) {
|
|
11250
11474
|
const drawn = bar(d);
|
|
11251
|
-
return drawn ? ` ${
|
|
11475
|
+
return drawn ? ` ${import_picocolors42.default.dim(drawn)}` : "";
|
|
11252
11476
|
}
|
|
11253
11477
|
function colour(d) {
|
|
11254
11478
|
switch (usageState(d)) {
|
|
11255
11479
|
case "over":
|
|
11256
|
-
return d.kind === "hard" ?
|
|
11480
|
+
return d.kind === "hard" ? import_picocolors42.default.red : import_picocolors42.default.yellow;
|
|
11257
11481
|
case "near":
|
|
11258
|
-
return
|
|
11482
|
+
return import_picocolors42.default.yellow;
|
|
11259
11483
|
case "unknown":
|
|
11260
|
-
return
|
|
11484
|
+
return import_picocolors42.default.dim;
|
|
11261
11485
|
default:
|
|
11262
11486
|
return (s) => s;
|
|
11263
11487
|
}
|
|
@@ -11265,7 +11489,7 @@ function colour(d) {
|
|
|
11265
11489
|
|
|
11266
11490
|
// src/index.ts
|
|
11267
11491
|
var pkg = {
|
|
11268
|
-
version: true ? "0.6.
|
|
11492
|
+
version: true ? "0.6.14" : "0.0.0-dev"
|
|
11269
11493
|
};
|
|
11270
11494
|
var program2 = new Command();
|
|
11271
11495
|
program2.name("workser").description(
|
|
@@ -11298,6 +11522,7 @@ registerDomain(program2);
|
|
|
11298
11522
|
registerOpen(program2);
|
|
11299
11523
|
registerDoctor(program2);
|
|
11300
11524
|
registerAgent(program2);
|
|
11525
|
+
registerCloudAgent(program2);
|
|
11301
11526
|
registerVerify(program2);
|
|
11302
11527
|
registerApi(program2);
|
|
11303
11528
|
registerAnalysis(program2);
|