@workser/cli 0.6.14 → 0.6.16
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
CHANGED
|
@@ -4071,84 +4071,6 @@ 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.
|
|
4152
4074
|
`
|
|
4153
4075
|
},
|
|
4154
4076
|
{
|
|
@@ -7537,154 +7459,8 @@ function formatRole(r) {
|
|
|
7537
7459
|
return `${label} ${agent} ${enabled} ${ready}${tail}`;
|
|
7538
7460
|
}
|
|
7539
7461
|
|
|
7540
|
-
// src/commands/cloud-agent.ts
|
|
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
7462
|
// src/commands/verify.ts
|
|
7687
|
-
var
|
|
7463
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
7688
7464
|
function registerVerify(program3) {
|
|
7689
7465
|
program3.command("verify").description(
|
|
7690
7466
|
"Run the project's checks (typecheck/lint/build) \u2014 use before declaring a task done"
|
|
@@ -7706,23 +7482,23 @@ function registerVerify(program3) {
|
|
|
7706
7482
|
function printVerify(res) {
|
|
7707
7483
|
if (!res) return;
|
|
7708
7484
|
if (!res.checks?.length) {
|
|
7709
|
-
line(
|
|
7485
|
+
line(import_picocolors17.default.dim(res.note ?? "No checks detected."));
|
|
7710
7486
|
return;
|
|
7711
7487
|
}
|
|
7712
7488
|
for (const c of res.checks) {
|
|
7713
7489
|
line(
|
|
7714
|
-
` ${c.ok ?
|
|
7490
|
+
` ${c.ok ? import_picocolors17.default.green("\u2713") : import_picocolors17.default.red("\u2717")} ${c.name}${c.ok ? "" : import_picocolors17.default.dim(` (exit ${c.exitCode})`)}`
|
|
7715
7491
|
);
|
|
7716
7492
|
}
|
|
7717
7493
|
if (res.ok) success("All checks passed");
|
|
7718
7494
|
else
|
|
7719
7495
|
line(
|
|
7720
|
-
|
|
7496
|
+
import_picocolors17.default.red("Some checks failed \u2014 fix the errors above and re-run ") + import_picocolors17.default.bold("workser verify") + import_picocolors17.default.red(".")
|
|
7721
7497
|
);
|
|
7722
7498
|
}
|
|
7723
7499
|
|
|
7724
7500
|
// src/commands/checkpoint.ts
|
|
7725
|
-
var
|
|
7501
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
7726
7502
|
function registerCheckpoint(program3) {
|
|
7727
7503
|
program3.command("checkpoint [label]").description(
|
|
7728
7504
|
"Save the current state of this folder so you can come back to it"
|
|
@@ -7739,8 +7515,8 @@ function registerCheckpoint(program3) {
|
|
|
7739
7515
|
ok(res, () => {
|
|
7740
7516
|
const p = res?.point;
|
|
7741
7517
|
success(`Saved a checkpoint${p?.label ? `: ${p.label}` : ""}`);
|
|
7742
|
-
if (p?.ref) line(
|
|
7743
|
-
line(
|
|
7518
|
+
if (p?.ref) line(import_picocolors18.default.dim(` ${p.ref.slice(0, 7)}`));
|
|
7519
|
+
line(import_picocolors18.default.dim(" Come back to it with `workser restore`."));
|
|
7744
7520
|
});
|
|
7745
7521
|
})
|
|
7746
7522
|
);
|
|
@@ -7766,12 +7542,12 @@ function registerCheckpoint(program3) {
|
|
|
7766
7542
|
);
|
|
7767
7543
|
if (res?.filesChanged) {
|
|
7768
7544
|
line(
|
|
7769
|
-
|
|
7545
|
+
import_picocolors18.default.dim(
|
|
7770
7546
|
` ${res.filesChanged} file${res.filesChanged === 1 ? "" : "s"} changed`
|
|
7771
7547
|
)
|
|
7772
7548
|
);
|
|
7773
7549
|
}
|
|
7774
|
-
line(
|
|
7550
|
+
line(import_picocolors18.default.dim(" This is reversible: `workser restore` again."));
|
|
7775
7551
|
});
|
|
7776
7552
|
})
|
|
7777
7553
|
);
|
|
@@ -7788,25 +7564,25 @@ function registerCheckpoint(program3) {
|
|
|
7788
7564
|
function printPoints(points) {
|
|
7789
7565
|
if (!points.length) {
|
|
7790
7566
|
info("No checkpoints yet for this folder.");
|
|
7791
|
-
line(
|
|
7567
|
+
line(import_picocolors18.default.dim(" Take one with `workser checkpoint`."));
|
|
7792
7568
|
return;
|
|
7793
7569
|
}
|
|
7794
|
-
line(
|
|
7570
|
+
line(import_picocolors18.default.bold("Checkpoints"));
|
|
7795
7571
|
for (const p of points) {
|
|
7796
7572
|
const when = p.at ? new Date(p.at).toLocaleString() : "";
|
|
7797
7573
|
line(
|
|
7798
|
-
` ${
|
|
7574
|
+
` ${import_picocolors18.default.dim(p.ref.slice(0, 7))} ${p.label}${when ? import_picocolors18.default.dim(` ${when}`) : ""}`
|
|
7799
7575
|
);
|
|
7800
7576
|
}
|
|
7801
7577
|
line(
|
|
7802
|
-
|
|
7578
|
+
import_picocolors18.default.dim(
|
|
7803
7579
|
"\nGo back with `workser restore <ref>`, or just `workser restore` for the newest."
|
|
7804
7580
|
)
|
|
7805
7581
|
);
|
|
7806
7582
|
}
|
|
7807
7583
|
|
|
7808
7584
|
// src/commands/sync.ts
|
|
7809
|
-
var
|
|
7585
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
7810
7586
|
function registerSync(program3) {
|
|
7811
7587
|
program3.command("sync").description(
|
|
7812
7588
|
"Reconcile this folder with the copy Workser holds (pull, then push)"
|
|
@@ -7833,7 +7609,7 @@ function registerSync(program3) {
|
|
|
7833
7609
|
warn(res?.message ?? "Couldn't sync this folder.");
|
|
7834
7610
|
if (res?.state === "diverged") {
|
|
7835
7611
|
line(
|
|
7836
|
-
|
|
7612
|
+
import_picocolors19.default.dim(
|
|
7837
7613
|
" This folder and Workser's copy have both changed. Open Workser to resolve it."
|
|
7838
7614
|
)
|
|
7839
7615
|
);
|
|
@@ -7845,7 +7621,7 @@ function registerSync(program3) {
|
|
|
7845
7621
|
return;
|
|
7846
7622
|
}
|
|
7847
7623
|
success("Synced");
|
|
7848
|
-
if (res?.ref) line(
|
|
7624
|
+
if (res?.ref) line(import_picocolors19.default.dim(` ${String(res.ref).slice(0, 7)}`));
|
|
7849
7625
|
});
|
|
7850
7626
|
if (refused) process.exitCode = 1;
|
|
7851
7627
|
})
|
|
@@ -7853,7 +7629,7 @@ function registerSync(program3) {
|
|
|
7853
7629
|
}
|
|
7854
7630
|
|
|
7855
7631
|
// src/commands/workflow.ts
|
|
7856
|
-
var
|
|
7632
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
7857
7633
|
function registerWorkflow(program3) {
|
|
7858
7634
|
const wf = program3.command("workflow").description("Create, run, and inspect workflow automations for the project");
|
|
7859
7635
|
wf.command("list").description("List the project's workflows").action(
|
|
@@ -7861,10 +7637,10 @@ function registerWorkflow(program3) {
|
|
|
7861
7637
|
const projectId = requireProject(ctx);
|
|
7862
7638
|
const items = await api(ctx, `/v1/projects/${projectId}/workflows`);
|
|
7863
7639
|
ok(items, () => {
|
|
7864
|
-
if (!items?.length) return line(
|
|
7640
|
+
if (!items?.length) return line(import_picocolors20.default.dim("No workflows yet. `workser workflow create`."));
|
|
7865
7641
|
for (const w of items) {
|
|
7866
|
-
const status = w.is_active ?
|
|
7867
|
-
line(`${w.id} ${
|
|
7642
|
+
const status = w.is_active ? import_picocolors20.default.green("active") : import_picocolors20.default.dim("inactive");
|
|
7643
|
+
line(`${w.id} ${import_picocolors20.default.bold(w.name ?? "Untitled")} ${status}`);
|
|
7868
7644
|
}
|
|
7869
7645
|
});
|
|
7870
7646
|
})
|
|
@@ -7876,7 +7652,7 @@ function registerWorkflow(program3) {
|
|
|
7876
7652
|
const res = await api(ctx, `/v1/projects/${projectId}/workflows`, {
|
|
7877
7653
|
body: { name: args[0], ...extra }
|
|
7878
7654
|
});
|
|
7879
|
-
ok(res, () => line(`Created workflow ${
|
|
7655
|
+
ok(res, () => line(`Created workflow ${import_picocolors20.default.bold(res.id)}.`));
|
|
7880
7656
|
})
|
|
7881
7657
|
);
|
|
7882
7658
|
wf.command("get <id>").description("Show a workflow's full definition").action(
|
|
@@ -7911,8 +7687,8 @@ function registerWorkflow(program3) {
|
|
|
7911
7687
|
action(async ({ ctx, args }) => {
|
|
7912
7688
|
const items = await api(ctx, `/v1/workflows/${args[0]}/executions`);
|
|
7913
7689
|
ok(items, () => {
|
|
7914
|
-
if (!items?.length) return line(
|
|
7915
|
-
for (const e of items) line(`${e.id} ${e.status ?? ""} ${
|
|
7690
|
+
if (!items?.length) return line(import_picocolors20.default.dim("No runs yet."));
|
|
7691
|
+
for (const e of items) line(`${e.id} ${e.status ?? ""} ${import_picocolors20.default.dim(e.started_at ?? "")}`);
|
|
7916
7692
|
});
|
|
7917
7693
|
})
|
|
7918
7694
|
);
|
|
@@ -7920,15 +7696,15 @@ function registerWorkflow(program3) {
|
|
|
7920
7696
|
action(async ({ ctx, args }) => {
|
|
7921
7697
|
const items = await api(ctx, `/v1/node-types`, { query: { q: args[0] } });
|
|
7922
7698
|
ok(items, () => {
|
|
7923
|
-
if (!items?.length) return line(
|
|
7924
|
-
for (const n of items) line(`${n.name ?? n.type} ${
|
|
7699
|
+
if (!items?.length) return line(import_picocolors20.default.dim("No matching node types."));
|
|
7700
|
+
for (const n of items) line(`${n.name ?? n.type} ${import_picocolors20.default.dim(n.category ?? "")}`);
|
|
7925
7701
|
});
|
|
7926
7702
|
})
|
|
7927
7703
|
);
|
|
7928
7704
|
}
|
|
7929
7705
|
|
|
7930
7706
|
// src/commands/connection.ts
|
|
7931
|
-
var
|
|
7707
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
7932
7708
|
function registerConnection(program3) {
|
|
7933
7709
|
const connection = program3.command("connection").description("Connect and use third-party app connections (Gmail, Slack, Stripe, ...)");
|
|
7934
7710
|
connection.command("list").description("List connectable toolkits and this project's existing connections").option("--toolkit <slug>", "filter connections to one toolkit").action(
|
|
@@ -7941,8 +7717,8 @@ function registerConnection(program3) {
|
|
|
7941
7717
|
ok({ catalog, connections }, () => {
|
|
7942
7718
|
const connected = new Set((connections ?? []).map((c) => c.toolkit ?? c.composio_app));
|
|
7943
7719
|
for (const t of catalog ?? []) {
|
|
7944
|
-
const status = connected.has(t.slug) ?
|
|
7945
|
-
line(`${t.slug} ${
|
|
7720
|
+
const status = connected.has(t.slug) ? import_picocolors21.default.green("connected") : import_picocolors21.default.dim("not connected");
|
|
7721
|
+
line(`${t.slug} ${import_picocolors21.default.bold(t.name ?? t.slug)} ${status}`);
|
|
7946
7722
|
}
|
|
7947
7723
|
});
|
|
7948
7724
|
})
|
|
@@ -7954,9 +7730,9 @@ function registerConnection(program3) {
|
|
|
7954
7730
|
query: { q: args[0], toolkit: opts.toolkit, limit: opts.limit }
|
|
7955
7731
|
});
|
|
7956
7732
|
ok(items, () => {
|
|
7957
|
-
if (!items?.length) return line(
|
|
7733
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No matching actions."));
|
|
7958
7734
|
for (const t of items) {
|
|
7959
|
-
line(`${t.slug} ${
|
|
7735
|
+
line(`${t.slug} ${import_picocolors21.default.dim(`[${t.toolkit}]`)} ${t.description ?? ""}`);
|
|
7960
7736
|
}
|
|
7961
7737
|
});
|
|
7962
7738
|
})
|
|
@@ -7973,7 +7749,7 @@ function registerConnection(program3) {
|
|
|
7973
7749
|
});
|
|
7974
7750
|
ok(
|
|
7975
7751
|
res,
|
|
7976
|
-
() => res.oauth_url ? line(`Open this URL to finish connecting: ${
|
|
7752
|
+
() => res.oauth_url ? line(`Open this URL to finish connecting: ${import_picocolors21.default.underline(res.oauth_url)}`) : line(`Connection ${res.connection_id} is ${res.status}.`)
|
|
7977
7753
|
);
|
|
7978
7754
|
})
|
|
7979
7755
|
);
|
|
@@ -7991,8 +7767,8 @@ function registerConnection(program3) {
|
|
|
7991
7767
|
const projectId = requireProject(ctx);
|
|
7992
7768
|
const items = await api(ctx, `/v1/projects/${projectId}/integrations/${args[0]}/tools`);
|
|
7993
7769
|
ok(items, () => {
|
|
7994
|
-
if (!items?.length) return line(
|
|
7995
|
-
for (const t of items) line(`${t.slug} ${
|
|
7770
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No tools found."));
|
|
7771
|
+
for (const t of items) line(`${t.slug} ${import_picocolors21.default.dim(t.description ?? "")}`);
|
|
7996
7772
|
});
|
|
7997
7773
|
})
|
|
7998
7774
|
);
|
|
@@ -8008,7 +7784,7 @@ function registerConnection(program3) {
|
|
|
8008
7784
|
}
|
|
8009
7785
|
|
|
8010
7786
|
// src/commands/tool.ts
|
|
8011
|
-
var
|
|
7787
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
8012
7788
|
function registerTool(program3) {
|
|
8013
7789
|
const tool = program3.command("tool").description(
|
|
8014
7790
|
"Computer-use tools: filesystem, shell, screenshot, input control, clipboard, notifications, basic browser"
|
|
@@ -8017,7 +7793,7 @@ function registerTool(program3) {
|
|
|
8017
7793
|
action(async ({ ctx }) => {
|
|
8018
7794
|
const tools = await api(ctx, "/v1/tool/list");
|
|
8019
7795
|
ok(tools, () => {
|
|
8020
|
-
if (!tools?.length) return line(
|
|
7796
|
+
if (!tools?.length) return line(import_picocolors22.default.dim("No tools available."));
|
|
8021
7797
|
const byCategory = /* @__PURE__ */ new Map();
|
|
8022
7798
|
for (const t of tools) {
|
|
8023
7799
|
const list = byCategory.get(t.category) ?? [];
|
|
@@ -8025,9 +7801,9 @@ function registerTool(program3) {
|
|
|
8025
7801
|
byCategory.set(t.category, list);
|
|
8026
7802
|
}
|
|
8027
7803
|
for (const [category, items] of byCategory) {
|
|
8028
|
-
line(
|
|
7804
|
+
line(import_picocolors22.default.bold(category) + ":");
|
|
8029
7805
|
for (const t of items) {
|
|
8030
|
-
line(` ${t.name} ${
|
|
7806
|
+
line(` ${t.name} ${import_picocolors22.default.dim(t.description ?? "")}`);
|
|
8031
7807
|
}
|
|
8032
7808
|
}
|
|
8033
7809
|
});
|
|
@@ -8045,7 +7821,7 @@ function registerTool(program3) {
|
|
|
8045
7821
|
}
|
|
8046
7822
|
|
|
8047
7823
|
// src/commands/memory.ts
|
|
8048
|
-
var
|
|
7824
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
8049
7825
|
function registerMemory(program3) {
|
|
8050
7826
|
const memory = program3.command("memory").description("Durable, cross-conversation project memory (shared with cloud agents on the same project)");
|
|
8051
7827
|
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(
|
|
@@ -8069,9 +7845,9 @@ function registerMemory(program3) {
|
|
|
8069
7845
|
});
|
|
8070
7846
|
ok(res, () => {
|
|
8071
7847
|
const results = res?.results ?? res ?? [];
|
|
8072
|
-
if (!results?.length) return line(
|
|
7848
|
+
if (!results?.length) return line(import_picocolors23.default.dim("No matching memories."));
|
|
8073
7849
|
for (const r of results) {
|
|
8074
|
-
line(`${
|
|
7850
|
+
line(`${import_picocolors23.default.dim(r.id ?? "?")} ${memoryText(r)}`);
|
|
8075
7851
|
}
|
|
8076
7852
|
});
|
|
8077
7853
|
})
|
|
@@ -8086,9 +7862,16 @@ function registerMemory(program3) {
|
|
|
8086
7862
|
})
|
|
8087
7863
|
);
|
|
8088
7864
|
}
|
|
7865
|
+
function memoryText(r) {
|
|
7866
|
+
const text = r?.memory ?? r?.chunk ?? r?.content ?? r?.text;
|
|
7867
|
+
if (typeof text === "string" && text.trim()) return text;
|
|
7868
|
+
const title = r?.documents?.[0]?.title;
|
|
7869
|
+
if (typeof title === "string" && title.trim()) return title;
|
|
7870
|
+
return import_picocolors23.default.dim("(no readable text on this row)");
|
|
7871
|
+
}
|
|
8089
7872
|
|
|
8090
7873
|
// src/commands/note.ts
|
|
8091
|
-
var
|
|
7874
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
8092
7875
|
function registerNote(program3) {
|
|
8093
7876
|
program3.command("note <text>").description("Leave a fact the rest of the team will need").addHelpText(
|
|
8094
7877
|
"after",
|
|
@@ -8125,14 +7908,14 @@ function registerNote(program3) {
|
|
|
8125
7908
|
}
|
|
8126
7909
|
ok(res, () => {
|
|
8127
7910
|
success("Noted for the team.");
|
|
8128
|
-
line(
|
|
7911
|
+
line(import_picocolors24.default.dim(` ${text}`));
|
|
8129
7912
|
});
|
|
8130
7913
|
})
|
|
8131
7914
|
);
|
|
8132
7915
|
}
|
|
8133
7916
|
|
|
8134
7917
|
// src/commands/business.ts
|
|
8135
|
-
var
|
|
7918
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
8136
7919
|
var RESOURCE_PATHS = {
|
|
8137
7920
|
"business-config": "business-config",
|
|
8138
7921
|
"business-settings": "business-settings",
|
|
@@ -8192,7 +7975,7 @@ function registerBusiness(program3) {
|
|
|
8192
7975
|
const projectId = requireProject(ctx);
|
|
8193
7976
|
const [resource] = args;
|
|
8194
7977
|
const res = await api(ctx, businessPath(projectId, resource), { body: JSON.parse(opts.body) });
|
|
8195
|
-
ok(res, () => line(`Created ${resource} ${
|
|
7978
|
+
ok(res, () => line(`Created ${resource} ${import_picocolors25.default.bold(res?.id ?? "")}.`));
|
|
8196
7979
|
})
|
|
8197
7980
|
);
|
|
8198
7981
|
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(
|
|
@@ -8234,7 +8017,7 @@ function businessPath(projectId, resource, subpath) {
|
|
|
8234
8017
|
}
|
|
8235
8018
|
|
|
8236
8019
|
// src/commands/artifact.ts
|
|
8237
|
-
var
|
|
8020
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
8238
8021
|
import { existsSync as existsSync2, statSync } from "fs";
|
|
8239
8022
|
import { resolve as resolve3, basename as basename3 } from "path";
|
|
8240
8023
|
var KINDS = [
|
|
@@ -8331,7 +8114,7 @@ function registerArtifact(program3) {
|
|
|
8331
8114
|
ok(
|
|
8332
8115
|
res,
|
|
8333
8116
|
() => success(
|
|
8334
|
-
`Recorded ${
|
|
8117
|
+
`Recorded ${import_picocolors26.default.bold(res?.title ?? "artifact")}${res?.kind ? import_picocolors26.default.dim(` (${res.kind})`) : ""}`
|
|
8335
8118
|
)
|
|
8336
8119
|
);
|
|
8337
8120
|
})
|
|
@@ -8363,13 +8146,13 @@ function registerArtifact(program3) {
|
|
|
8363
8146
|
artifact.command("run").description("Show the task/conversation this agent run is attached to").action(
|
|
8364
8147
|
action(async ({ ctx }) => {
|
|
8365
8148
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}`);
|
|
8366
|
-
ok(res, () =>
|
|
8149
|
+
ok(res, () => printRun(res));
|
|
8367
8150
|
})
|
|
8368
8151
|
);
|
|
8369
8152
|
}
|
|
8370
8153
|
function printArtifacts(rows) {
|
|
8371
8154
|
if (!rows.length) {
|
|
8372
|
-
line(
|
|
8155
|
+
line(import_picocolors26.default.dim("Nothing produced yet."));
|
|
8373
8156
|
return;
|
|
8374
8157
|
}
|
|
8375
8158
|
const byStep = /* @__PURE__ */ new Map();
|
|
@@ -8379,26 +8162,26 @@ function printArtifacts(rows) {
|
|
|
8379
8162
|
byStep.set(r.subtask_id, list);
|
|
8380
8163
|
}
|
|
8381
8164
|
for (const [stepId, items] of byStep) {
|
|
8382
|
-
line(
|
|
8165
|
+
line(import_picocolors26.default.bold(`step ${stepId}`));
|
|
8383
8166
|
for (const a of items) {
|
|
8384
|
-
const flag = a.promoted_at ?
|
|
8167
|
+
const flag = a.promoted_at ? import_picocolors26.default.green(" *") : " ";
|
|
8385
8168
|
const where = a.local_path || a.cloud_url || "";
|
|
8386
8169
|
line(
|
|
8387
|
-
`${flag} ${
|
|
8170
|
+
`${flag} ${import_picocolors26.default.dim(`[${a.kind}]`)} ${a.title ?? "(untitled)"}` + (where ? import_picocolors26.default.dim(` ${where}`) : "")
|
|
8388
8171
|
);
|
|
8389
|
-
if (a.description) line(
|
|
8172
|
+
if (a.description) line(import_picocolors26.default.dim(` ${a.description}`));
|
|
8390
8173
|
}
|
|
8391
8174
|
line("");
|
|
8392
8175
|
}
|
|
8393
|
-
line(
|
|
8176
|
+
line(import_picocolors26.default.dim("* = handed over as a deliverable; the rest is working material."));
|
|
8394
8177
|
}
|
|
8395
|
-
function
|
|
8178
|
+
function printRun(run) {
|
|
8396
8179
|
if (!run) return;
|
|
8397
|
-
line(` run ${
|
|
8180
|
+
line(` run ${import_picocolors26.default.bold(run.runId)}`);
|
|
8398
8181
|
if (run.taskId) line(` task ${run.taskId}`);
|
|
8399
8182
|
if (run.conversationId) line(` chat ${run.conversationId}`);
|
|
8400
8183
|
if (run.projectId) line(` project ${run.projectId}`);
|
|
8401
|
-
if (run.cwd) line(` folder ${
|
|
8184
|
+
if (run.cwd) line(` folder ${import_picocolors26.default.dim(run.cwd)}`);
|
|
8402
8185
|
}
|
|
8403
8186
|
|
|
8404
8187
|
// src/commands/image.ts
|
|
@@ -8579,7 +8362,7 @@ function registerAudio(program3) {
|
|
|
8579
8362
|
}
|
|
8580
8363
|
|
|
8581
8364
|
// src/commands/ask.ts
|
|
8582
|
-
var
|
|
8365
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
8583
8366
|
var TYPES = [
|
|
8584
8367
|
"input",
|
|
8585
8368
|
"choice",
|
|
@@ -8657,7 +8440,7 @@ function registerAsk(program3) {
|
|
|
8657
8440
|
code: "bad_request"
|
|
8658
8441
|
});
|
|
8659
8442
|
}
|
|
8660
|
-
info(
|
|
8443
|
+
info(import_picocolors27.default.dim("Waiting for the user to answer\u2026"));
|
|
8661
8444
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}/ask`, {
|
|
8662
8445
|
body: {
|
|
8663
8446
|
type,
|
|
@@ -8685,12 +8468,12 @@ function deriveTitle(message) {
|
|
|
8685
8468
|
function printAnswer(res) {
|
|
8686
8469
|
if (!res) return;
|
|
8687
8470
|
if (res.status === "answered") {
|
|
8688
|
-
line(` ${
|
|
8471
|
+
line(` ${import_picocolors27.default.green("answered")}`);
|
|
8689
8472
|
const value = extract(res.response);
|
|
8690
8473
|
if (value) line(` ${value}`);
|
|
8691
8474
|
return;
|
|
8692
8475
|
}
|
|
8693
|
-
line(` ${
|
|
8476
|
+
line(` ${import_picocolors27.default.yellow(res.status)} ${import_picocolors27.default.dim(res.reason ?? "")}`);
|
|
8694
8477
|
}
|
|
8695
8478
|
function extract(response) {
|
|
8696
8479
|
if (response == null) return "";
|
|
@@ -8709,7 +8492,7 @@ function extract(response) {
|
|
|
8709
8492
|
}
|
|
8710
8493
|
|
|
8711
8494
|
// src/commands/search.ts
|
|
8712
|
-
var
|
|
8495
|
+
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
8713
8496
|
function registerSearch(program3) {
|
|
8714
8497
|
program3.command("search <query>").description("Search the web (Google-grounded, server-side)").option("-n, --max-results <n>", "max results", "5").action(
|
|
8715
8498
|
action(async ({ ctx, args, opts }) => {
|
|
@@ -8722,9 +8505,9 @@ function registerSearch(program3) {
|
|
|
8722
8505
|
line("");
|
|
8723
8506
|
}
|
|
8724
8507
|
const results = res?.results ?? [];
|
|
8725
|
-
if (!results.length) return line(
|
|
8508
|
+
if (!results.length) return line(import_picocolors28.default.dim("No results."));
|
|
8726
8509
|
for (const r of results) {
|
|
8727
|
-
line(`${r.title ||
|
|
8510
|
+
line(`${r.title || import_picocolors28.default.dim("(untitled)")} ${import_picocolors28.default.dim(r.url)}`);
|
|
8728
8511
|
}
|
|
8729
8512
|
});
|
|
8730
8513
|
})
|
|
@@ -8732,7 +8515,7 @@ function registerSearch(program3) {
|
|
|
8732
8515
|
}
|
|
8733
8516
|
|
|
8734
8517
|
// src/commands/board.ts
|
|
8735
|
-
var
|
|
8518
|
+
var import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
8736
8519
|
|
|
8737
8520
|
// src/commands/record-step.ts
|
|
8738
8521
|
async function recordEntityStep(ctx, opts) {
|
|
@@ -8771,7 +8554,7 @@ function registerBoard(program3) {
|
|
|
8771
8554
|
}
|
|
8772
8555
|
ok(rows, () => {
|
|
8773
8556
|
if (!rows.length) {
|
|
8774
|
-
line(
|
|
8557
|
+
line(import_picocolors29.default.dim("No cards on the Board yet."));
|
|
8775
8558
|
return;
|
|
8776
8559
|
}
|
|
8777
8560
|
for (const r of rows) line(formatRow(r));
|
|
@@ -8786,7 +8569,7 @@ function registerBoard(program3) {
|
|
|
8786
8569
|
`/v1/projects/${projectId}/work-items/${args[0]}`
|
|
8787
8570
|
);
|
|
8788
8571
|
ok(row, () => {
|
|
8789
|
-
line(`${
|
|
8572
|
+
line(`${import_picocolors29.default.bold(row.title)} ${import_picocolors29.default.dim(row.id)}`);
|
|
8790
8573
|
line(`${statusTag(row.status)} priority ${row.priority}`);
|
|
8791
8574
|
if (row.ownerHuman) line(`owner: ${row.ownerHuman}`);
|
|
8792
8575
|
if (row.labels?.length) line(`labels: ${row.labels.join(", ")}`);
|
|
@@ -8827,7 +8610,7 @@ ${row.description}`);
|
|
|
8827
8610
|
refId: row?.id,
|
|
8828
8611
|
output: { workItem: row }
|
|
8829
8612
|
});
|
|
8830
|
-
ok(row, () => line(`Created work item ${
|
|
8613
|
+
ok(row, () => line(`Created work item ${import_picocolors29.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
8831
8614
|
})
|
|
8832
8615
|
);
|
|
8833
8616
|
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(
|
|
@@ -8861,7 +8644,7 @@ ${row.description}`);
|
|
|
8861
8644
|
);
|
|
8862
8645
|
}
|
|
8863
8646
|
const row = await patchItem(ctx, projectId, String(args[0]), body);
|
|
8864
|
-
ok(row, () => line(`Updated ${
|
|
8647
|
+
ok(row, () => line(`Updated ${import_picocolors29.default.bold(row.id)} \u2014 ${row.title} ${statusTag(row.status)}`));
|
|
8865
8648
|
})
|
|
8866
8649
|
);
|
|
8867
8650
|
board.command("move <id> <status>").description(
|
|
@@ -8872,14 +8655,14 @@ ${row.description}`);
|
|
|
8872
8655
|
const status = String(args[1]);
|
|
8873
8656
|
assertStatus(status);
|
|
8874
8657
|
const row = await patchItem(ctx, projectId, String(args[0]), { status });
|
|
8875
|
-
ok(row, () => line(`Moved ${
|
|
8658
|
+
ok(row, () => line(`Moved ${import_picocolors29.default.bold(row.title)} \u2192 ${statusTag(row.status)}`));
|
|
8876
8659
|
})
|
|
8877
8660
|
);
|
|
8878
8661
|
board.command("close <id>").description("Shorthand for `board move <id> done`").action(
|
|
8879
8662
|
action(async ({ ctx, args }) => {
|
|
8880
8663
|
const projectId = requireProject(ctx);
|
|
8881
8664
|
const row = await patchItem(ctx, projectId, String(args[0]), { status: "done" });
|
|
8882
|
-
ok(row, () => line(`Closed ${
|
|
8665
|
+
ok(row, () => line(`Closed ${import_picocolors29.default.bold(row.title)} ${statusTag(row.status)}`));
|
|
8883
8666
|
})
|
|
8884
8667
|
);
|
|
8885
8668
|
}
|
|
@@ -8912,23 +8695,23 @@ function assertPriority(value) {
|
|
|
8912
8695
|
}
|
|
8913
8696
|
}
|
|
8914
8697
|
function formatRow(r) {
|
|
8915
|
-
const labels = r.labels?.length ?
|
|
8916
|
-
const owner = r.ownerHuman ?
|
|
8917
|
-
return `${
|
|
8698
|
+
const labels = r.labels?.length ? import_picocolors29.default.dim(` [${r.labels.join(", ")}]`) : "";
|
|
8699
|
+
const owner = r.ownerHuman ? import_picocolors29.default.dim(` @${r.ownerHuman}`) : "";
|
|
8700
|
+
return `${import_picocolors29.default.dim(r.id)} ${statusTag(r.status)} ${r.title}${labels}${owner}`;
|
|
8918
8701
|
}
|
|
8919
8702
|
function statusTag(status) {
|
|
8920
8703
|
const label = status.padEnd(11);
|
|
8921
|
-
if (status === "done") return
|
|
8922
|
-
if (status === "in-progress") return
|
|
8923
|
-
if (status === "in-review") return
|
|
8924
|
-
return
|
|
8704
|
+
if (status === "done") return import_picocolors29.default.green(label);
|
|
8705
|
+
if (status === "in-progress") return import_picocolors29.default.yellow(label);
|
|
8706
|
+
if (status === "in-review") return import_picocolors29.default.cyan(label);
|
|
8707
|
+
return import_picocolors29.default.dim(label);
|
|
8925
8708
|
}
|
|
8926
8709
|
function collect2(value, previous) {
|
|
8927
8710
|
return [...previous, value];
|
|
8928
8711
|
}
|
|
8929
8712
|
|
|
8930
8713
|
// src/commands/task.ts
|
|
8931
|
-
var
|
|
8714
|
+
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
8932
8715
|
|
|
8933
8716
|
// src/subtask-attachments.ts
|
|
8934
8717
|
var MAX_REF_NOTE = 500;
|
|
@@ -9042,7 +8825,7 @@ function registerTask(program3) {
|
|
|
9042
8825
|
}) ?? [];
|
|
9043
8826
|
ok(rows, () => {
|
|
9044
8827
|
if (!rows.length) {
|
|
9045
|
-
line(
|
|
8828
|
+
line(import_picocolors30.default.dim("No tasks on the board yet."));
|
|
9046
8829
|
return;
|
|
9047
8830
|
}
|
|
9048
8831
|
for (const r of rows) line(formatRow2(r));
|
|
@@ -9151,10 +8934,10 @@ function registerTask(program3) {
|
|
|
9151
8934
|
};
|
|
9152
8935
|
ok(result, () => {
|
|
9153
8936
|
line(
|
|
9154
|
-
`${
|
|
8937
|
+
`${import_picocolors30.default.green("opened")} ${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`
|
|
9155
8938
|
);
|
|
9156
8939
|
if (channelMessage)
|
|
9157
|
-
line(
|
|
8940
|
+
line(import_picocolors30.default.dim("posted to the channel as Project Manager"));
|
|
9158
8941
|
if (channelMessageError) {
|
|
9159
8942
|
warn(
|
|
9160
8943
|
`Task opened, but its Project Manager card could not be posted: ${channelMessageError.message}`
|
|
@@ -9233,12 +9016,12 @@ function registerTask(program3) {
|
|
|
9233
9016
|
) : null;
|
|
9234
9017
|
ok(runner ?? row, () => {
|
|
9235
9018
|
line(
|
|
9236
|
-
`${
|
|
9019
|
+
`${import_picocolors30.default.green("added")} ${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`
|
|
9237
9020
|
);
|
|
9238
|
-
if (row.role) line(
|
|
9021
|
+
if (row.role) line(import_picocolors30.default.dim(`role: ${row.role}`));
|
|
9239
9022
|
if (runner) {
|
|
9240
9023
|
line(
|
|
9241
|
-
|
|
9024
|
+
import_picocolors30.default.dim(
|
|
9242
9025
|
`runs on: ${[opts.agent, opts.model, opts.effort].filter(Boolean).join(" \xB7 ")}`
|
|
9243
9026
|
)
|
|
9244
9027
|
);
|
|
@@ -9256,7 +9039,7 @@ function registerTask(program3) {
|
|
|
9256
9039
|
const rows = row.subtasks ?? [];
|
|
9257
9040
|
ok(rows, () => {
|
|
9258
9041
|
if (!rows.length) {
|
|
9259
|
-
line(
|
|
9042
|
+
line(import_picocolors30.default.dim("No subtasks yet."));
|
|
9260
9043
|
return;
|
|
9261
9044
|
}
|
|
9262
9045
|
rows.forEach((r, i) => line(formatSubtask(r, i + 1)));
|
|
@@ -9304,7 +9087,7 @@ function registerTask(program3) {
|
|
|
9304
9087
|
}
|
|
9305
9088
|
}
|
|
9306
9089
|
);
|
|
9307
|
-
ok(row, () => line(`${
|
|
9090
|
+
ok(row, () => line(`${import_picocolors30.default.green("updated")} ${import_picocolors30.default.bold(row.title)}`));
|
|
9308
9091
|
})
|
|
9309
9092
|
);
|
|
9310
9093
|
subtask.command("remove <id>").description("Remove a subtask (only before the work starts)").action(
|
|
@@ -9312,7 +9095,7 @@ function registerTask(program3) {
|
|
|
9312
9095
|
await api(ctx, `/v1/project-tasks/${encodeURIComponent(args[0])}`, {
|
|
9313
9096
|
method: "DELETE"
|
|
9314
9097
|
});
|
|
9315
|
-
ok({ removed: args[0] }, () => line(
|
|
9098
|
+
ok({ removed: args[0] }, () => line(import_picocolors30.default.green("removed")));
|
|
9316
9099
|
})
|
|
9317
9100
|
);
|
|
9318
9101
|
task.command("move <id> <status>").description(
|
|
@@ -9327,7 +9110,7 @@ function registerTask(program3) {
|
|
|
9327
9110
|
);
|
|
9328
9111
|
ok(
|
|
9329
9112
|
row,
|
|
9330
|
-
() => line(`${
|
|
9113
|
+
() => line(`${import_picocolors30.default.green("moved")} ${import_picocolors30.default.bold(row.title)} \u2192 ${args[1]}`)
|
|
9331
9114
|
);
|
|
9332
9115
|
})
|
|
9333
9116
|
);
|
|
@@ -9343,18 +9126,18 @@ function registerTask(program3) {
|
|
|
9343
9126
|
);
|
|
9344
9127
|
ok(row, () => {
|
|
9345
9128
|
if (!row?.queued) {
|
|
9346
|
-
line(
|
|
9129
|
+
line(import_picocolors30.default.yellow("could not resume it \u2014 check the step id"));
|
|
9347
9130
|
return;
|
|
9348
9131
|
}
|
|
9349
9132
|
const started = row.started ?? 0;
|
|
9350
9133
|
if (started > 0) {
|
|
9351
9134
|
line(
|
|
9352
|
-
`${
|
|
9135
|
+
`${import_picocolors30.default.green("resumed")} \u2014 ${started} step${started === 1 ? "" : "s"} started`
|
|
9353
9136
|
);
|
|
9354
9137
|
return;
|
|
9355
9138
|
}
|
|
9356
9139
|
line(
|
|
9357
|
-
`${
|
|
9140
|
+
`${import_picocolors30.default.green("resumed")} \u2014 it is queued, but nothing started yet. Check the plan is approved and that no step is blocking the rest.`
|
|
9358
9141
|
);
|
|
9359
9142
|
});
|
|
9360
9143
|
})
|
|
@@ -9368,11 +9151,11 @@ function registerTask(program3) {
|
|
|
9368
9151
|
);
|
|
9369
9152
|
ok(row, () => {
|
|
9370
9153
|
if (row?.reopened) {
|
|
9371
|
-
line(`${
|
|
9154
|
+
line(`${import_picocolors30.default.green("sent back")} \u2014 it will be picked up again`);
|
|
9372
9155
|
return;
|
|
9373
9156
|
}
|
|
9374
9157
|
line(
|
|
9375
|
-
|
|
9158
|
+
import_picocolors30.default.yellow(
|
|
9376
9159
|
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"
|
|
9377
9160
|
)
|
|
9378
9161
|
);
|
|
@@ -9389,7 +9172,7 @@ function registerTask(program3) {
|
|
|
9389
9172
|
`/v1/project-tasks/${encodeURIComponent(id)}/dispatch-check`,
|
|
9390
9173
|
{ method: "POST" }
|
|
9391
9174
|
);
|
|
9392
|
-
ok(row, () => line(
|
|
9175
|
+
ok(row, () => line(import_picocolors30.default.green("approved \u2014 you may start")));
|
|
9393
9176
|
})
|
|
9394
9177
|
);
|
|
9395
9178
|
task.command("start [id]").description(
|
|
@@ -9404,13 +9187,13 @@ function registerTask(program3) {
|
|
|
9404
9187
|
const started = row?.started ?? null;
|
|
9405
9188
|
if (started && started > 0) {
|
|
9406
9189
|
line(
|
|
9407
|
-
|
|
9190
|
+
import_picocolors30.default.green(
|
|
9408
9191
|
`started ${started} step${started === 1 ? "" : "s"} \u2014 they are running now`
|
|
9409
9192
|
)
|
|
9410
9193
|
);
|
|
9411
9194
|
return;
|
|
9412
9195
|
}
|
|
9413
|
-
line(
|
|
9196
|
+
line(import_picocolors30.default.yellow(row?.note ?? "Nothing started."));
|
|
9414
9197
|
});
|
|
9415
9198
|
})
|
|
9416
9199
|
);
|
|
@@ -9425,7 +9208,7 @@ function registerTask(program3) {
|
|
|
9425
9208
|
);
|
|
9426
9209
|
ok({ awaiting: row2.approval_state === "awaiting", task: row2 }, () => {
|
|
9427
9210
|
line(
|
|
9428
|
-
row2.approval_state === "awaiting" ?
|
|
9211
|
+
row2.approval_state === "awaiting" ? import_picocolors30.default.yellow(
|
|
9429
9212
|
"The plan is waiting on the owner. They see it in the task."
|
|
9430
9213
|
) : `Already ${row2.approval_state}.`
|
|
9431
9214
|
);
|
|
@@ -9450,7 +9233,7 @@ function registerTask(program3) {
|
|
|
9450
9233
|
);
|
|
9451
9234
|
ok(
|
|
9452
9235
|
row,
|
|
9453
|
-
() => line(`${
|
|
9236
|
+
() => line(`${import_picocolors30.default.green(row.approval_state)} ${import_picocolors30.default.bold(row.title)}`)
|
|
9454
9237
|
);
|
|
9455
9238
|
})
|
|
9456
9239
|
);
|
|
@@ -9466,7 +9249,7 @@ function registerTask(program3) {
|
|
|
9466
9249
|
`/v1/project-tasks/${encodeURIComponent(id)}/move`,
|
|
9467
9250
|
{ body: { status: "ready" } }
|
|
9468
9251
|
);
|
|
9469
|
-
ok(row, () => line(`${
|
|
9252
|
+
ok(row, () => line(`${import_picocolors30.default.green("ready")} ${import_picocolors30.default.bold(row.title)}`));
|
|
9470
9253
|
})
|
|
9471
9254
|
);
|
|
9472
9255
|
}
|
|
@@ -9511,24 +9294,24 @@ function assertOneOf(flag, value, allowed) {
|
|
|
9511
9294
|
}
|
|
9512
9295
|
}
|
|
9513
9296
|
function formatRow2(r) {
|
|
9514
|
-
const key =
|
|
9515
|
-
const steps = r.subtaskTotal ?
|
|
9516
|
-
const gate = r.approval_state === "awaiting" ?
|
|
9297
|
+
const key = import_picocolors30.default.dim((r.key ?? r.id.slice(0, 8)).padEnd(10));
|
|
9298
|
+
const steps = r.subtaskTotal ? import_picocolors30.default.dim(` ${r.subtaskDone}/${r.subtaskTotal}`) : "";
|
|
9299
|
+
const gate = r.approval_state === "awaiting" ? import_picocolors30.default.yellow(" awaiting approval") : "";
|
|
9517
9300
|
return `${key} ${statusTag2(r.status)} ${r.title}${steps}${gate}`;
|
|
9518
9301
|
}
|
|
9519
9302
|
function formatSubtask(r, index) {
|
|
9520
|
-
const n =
|
|
9521
|
-
const role = r.role ?
|
|
9522
|
-
const scope = r.scope_paths?.length ?
|
|
9303
|
+
const n = import_picocolors30.default.dim(String(index).padStart(2, "0"));
|
|
9304
|
+
const role = r.role ? import_picocolors30.default.dim(` [${r.role}]`) : "";
|
|
9305
|
+
const scope = r.scope_paths?.length ? import_picocolors30.default.dim(` owns: ${r.scope_paths.join(", ")}`) : "";
|
|
9523
9306
|
const head = `${n} ${statusTag2(r.status)} ${r.title}${role}${scope}`;
|
|
9524
9307
|
const summary = (r.result_summary ?? "").trim();
|
|
9525
9308
|
if (!summary) return head;
|
|
9526
9309
|
const wrapped = summary.split("\n").map((l) => ` ${l}`).join("\n");
|
|
9527
9310
|
return `${head}
|
|
9528
|
-
${
|
|
9311
|
+
${import_picocolors30.default.dim(wrapped)}`;
|
|
9529
9312
|
}
|
|
9530
9313
|
function printTask(row, goal) {
|
|
9531
|
-
line(`${
|
|
9314
|
+
line(`${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`);
|
|
9532
9315
|
line(`${statusTag2(row.status)} approval: ${row.approval_state}`);
|
|
9533
9316
|
if (row.summary) line(`
|
|
9534
9317
|
${row.summary}`);
|
|
@@ -9541,53 +9324,53 @@ touches: ${row.targets.map((t) => t.appName ?? t.ref ?? t.kind).join(", ")}`
|
|
|
9541
9324
|
}
|
|
9542
9325
|
if (row.subtasks?.length) {
|
|
9543
9326
|
line(`
|
|
9544
|
-
${
|
|
9327
|
+
${import_picocolors30.default.bold("subtasks")}`);
|
|
9545
9328
|
row.subtasks.forEach((s, i) => line(formatSubtask(s, i + 1)));
|
|
9546
9329
|
line(
|
|
9547
|
-
|
|
9330
|
+
import_picocolors30.default.dim(
|
|
9548
9331
|
`
|
|
9549
9332
|
Run \`workser artifact list\` to see what these subtasks produced,`
|
|
9550
9333
|
)
|
|
9551
9334
|
);
|
|
9552
9335
|
line(
|
|
9553
|
-
|
|
9336
|
+
import_picocolors30.default.dim(
|
|
9554
9337
|
`or \`workser artifact list --step <id>\` for one subtask's output alone.`
|
|
9555
9338
|
)
|
|
9556
9339
|
);
|
|
9557
9340
|
} else {
|
|
9558
|
-
line(
|
|
9341
|
+
line(import_picocolors30.default.dim("\nNo subtasks yet."));
|
|
9559
9342
|
}
|
|
9560
9343
|
}
|
|
9561
9344
|
function printGoalContext(row, goal) {
|
|
9562
9345
|
const mine = row.phase ?? null;
|
|
9563
9346
|
line(`
|
|
9564
|
-
${
|
|
9565
|
-
if (goal.outcome) line(
|
|
9347
|
+
${import_picocolors30.default.bold("part of")}: ${goal.title}`);
|
|
9348
|
+
if (goal.outcome) line(import_picocolors30.default.dim(`done means: ${goal.outcome}`));
|
|
9566
9349
|
const progress = goal.progress ?? [];
|
|
9567
9350
|
for (const p of progress) {
|
|
9568
9351
|
const where = p.total === 0 ? "not started" : `${p.done} of ${p.total} done`;
|
|
9569
|
-
const here = mine && p.name === mine ?
|
|
9570
|
-
const mark = p.state === "done" ?
|
|
9352
|
+
const here = mine && p.name === mine ? import_picocolors30.default.cyan(" <- this task") : "";
|
|
9353
|
+
const mark = p.state === "done" ? import_picocolors30.default.green("*") : import_picocolors30.default.dim("-");
|
|
9571
9354
|
line(` ${mark} ${p.name} \u2014 ${where}${here}`);
|
|
9572
9355
|
}
|
|
9573
9356
|
const next = progress.find((p) => p.state !== "done");
|
|
9574
9357
|
const running = progress.some((p) => p.state === "working");
|
|
9575
9358
|
if (next && !running) {
|
|
9576
9359
|
line(
|
|
9577
|
-
|
|
9360
|
+
import_picocolors30.default.dim(
|
|
9578
9361
|
`
|
|
9579
9362
|
Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to them in a sentence rather than starting it unasked.`
|
|
9580
9363
|
)
|
|
9581
9364
|
);
|
|
9582
9365
|
} else if (!next) {
|
|
9583
9366
|
line(
|
|
9584
|
-
|
|
9367
|
+
import_picocolors30.default.dim(
|
|
9585
9368
|
"\nEvery part of this plan is done. Say so, and offer to wrap it up."
|
|
9586
9369
|
)
|
|
9587
9370
|
);
|
|
9588
9371
|
}
|
|
9589
9372
|
line(
|
|
9590
|
-
|
|
9373
|
+
import_picocolors30.default.dim(
|
|
9591
9374
|
"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."
|
|
9592
9375
|
)
|
|
9593
9376
|
);
|
|
@@ -9595,22 +9378,22 @@ Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to t
|
|
|
9595
9378
|
function statusTag2(status) {
|
|
9596
9379
|
switch (status) {
|
|
9597
9380
|
case "ready":
|
|
9598
|
-
return
|
|
9381
|
+
return import_picocolors30.default.green("[ready]");
|
|
9599
9382
|
case "working":
|
|
9600
|
-
return
|
|
9383
|
+
return import_picocolors30.default.blue("[working]");
|
|
9601
9384
|
case "checking":
|
|
9602
|
-
return
|
|
9385
|
+
return import_picocolors30.default.cyan("[checking]");
|
|
9603
9386
|
case "accepted":
|
|
9604
|
-
return
|
|
9387
|
+
return import_picocolors30.default.green("[accepted]");
|
|
9605
9388
|
case "archived":
|
|
9606
|
-
return
|
|
9389
|
+
return import_picocolors30.default.dim("[archived]");
|
|
9607
9390
|
default:
|
|
9608
|
-
return
|
|
9391
|
+
return import_picocolors30.default.dim("[todo]");
|
|
9609
9392
|
}
|
|
9610
9393
|
}
|
|
9611
9394
|
|
|
9612
9395
|
// src/commands/goal.ts
|
|
9613
|
-
var
|
|
9396
|
+
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
9614
9397
|
var STATUSES3 = ["proposed", "agreed", "working", "delivered", "abandoned"];
|
|
9615
9398
|
function registerGoal(program3) {
|
|
9616
9399
|
const goal = program3.command("goal").description("Business goals and the phases that deliver them");
|
|
@@ -9622,7 +9405,7 @@ function registerGoal(program3) {
|
|
|
9622
9405
|
}) ?? [];
|
|
9623
9406
|
ok(rows, () => {
|
|
9624
9407
|
if (!rows.length) {
|
|
9625
|
-
line(
|
|
9408
|
+
line(import_picocolors31.default.dim("No goals yet \u2014 every task here stands on its own."));
|
|
9626
9409
|
return;
|
|
9627
9410
|
}
|
|
9628
9411
|
for (const g of rows) line(formatGoal(g));
|
|
@@ -9699,10 +9482,10 @@ function registerGoal(program3) {
|
|
|
9699
9482
|
}
|
|
9700
9483
|
});
|
|
9701
9484
|
ok(row, () => {
|
|
9702
|
-
success(`Proposed ${
|
|
9485
|
+
success(`Proposed ${import_picocolors31.default.bold(row?.title ?? "goal")}`);
|
|
9703
9486
|
printGoal(row);
|
|
9704
9487
|
line(
|
|
9705
|
-
|
|
9488
|
+
import_picocolors31.default.dim(
|
|
9706
9489
|
"\nNothing has been created yet. The owner agrees the shape first."
|
|
9707
9490
|
)
|
|
9708
9491
|
);
|
|
@@ -9731,7 +9514,7 @@ function registerGoal(program3) {
|
|
|
9731
9514
|
ok(
|
|
9732
9515
|
row,
|
|
9733
9516
|
() => line(
|
|
9734
|
-
row?.recorded ? met === true ?
|
|
9517
|
+
row?.recorded ? met === true ? import_picocolors31.default.green("recorded \u2014 met") : met === false ? import_picocolors31.default.yellow("recorded \u2014 not met") : import_picocolors31.default.dim("recorded \u2014 back to unchecked") : import_picocolors31.default.yellow(
|
|
9735
9518
|
"couldn't record it \u2014 check the goal id, the phase name and the criterion id"
|
|
9736
9519
|
)
|
|
9737
9520
|
)
|
|
@@ -9774,7 +9557,7 @@ function registerGoal(program3) {
|
|
|
9774
9557
|
}
|
|
9775
9558
|
ok({ goalId, phase, filed }, () => {
|
|
9776
9559
|
success(
|
|
9777
|
-
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${
|
|
9560
|
+
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${import_picocolors31.default.bold(phase)}`
|
|
9778
9561
|
);
|
|
9779
9562
|
});
|
|
9780
9563
|
})
|
|
@@ -9806,42 +9589,42 @@ function registerGoal(program3) {
|
|
|
9806
9589
|
function appScope(g) {
|
|
9807
9590
|
const n = g.appIds?.length ?? 0;
|
|
9808
9591
|
if (!n) return "";
|
|
9809
|
-
return
|
|
9592
|
+
return import_picocolors31.default.dim(` ${n} part${n === 1 ? "" : "s"} of the system`);
|
|
9810
9593
|
}
|
|
9811
9594
|
function formatGoal(g) {
|
|
9812
|
-
const where = g.currentPhase && g.status !== "delivered" ?
|
|
9813
|
-
const count = g.taskTotal != null ?
|
|
9814
|
-
return `${statusTag3(g.status)} ${g.title}${appScope(g)}${where}${count} ${
|
|
9595
|
+
const where = g.currentPhase && g.status !== "delivered" ? import_picocolors31.default.dim(` now: ${g.currentPhase}`) : "";
|
|
9596
|
+
const count = g.taskTotal != null ? import_picocolors31.default.dim(` ${g.taskDone}/${g.taskTotal} done`) : "";
|
|
9597
|
+
return `${statusTag3(g.status)} ${g.title}${appScope(g)}${where}${count} ${import_picocolors31.default.dim(g.id)}`;
|
|
9815
9598
|
}
|
|
9816
9599
|
function printGoal(g) {
|
|
9817
9600
|
if (!g) return;
|
|
9818
|
-
line(`${
|
|
9601
|
+
line(`${import_picocolors31.default.bold(g.title)} ${import_picocolors31.default.dim(g.id)}`);
|
|
9819
9602
|
line(statusTag3(g.status));
|
|
9820
9603
|
if (g.outcome) line(`
|
|
9821
9604
|
done means: ${g.outcome}`);
|
|
9822
9605
|
const progress = g.progress ?? [];
|
|
9823
9606
|
if (!progress.length) {
|
|
9824
|
-
line(
|
|
9607
|
+
line(import_picocolors31.default.dim("\nNo phases agreed yet."));
|
|
9825
9608
|
return;
|
|
9826
9609
|
}
|
|
9827
9610
|
line(`
|
|
9828
|
-
${
|
|
9611
|
+
${import_picocolors31.default.bold("phases")}`);
|
|
9829
9612
|
for (const p of progress) {
|
|
9830
|
-
const bar2 = p.total > 0 ? `${p.done}/${p.total} done` :
|
|
9831
|
-
const mark = p.state === "done" ?
|
|
9613
|
+
const bar2 = p.total > 0 ? `${p.done}/${p.total} done` : import_picocolors31.default.dim("nothing filed yet");
|
|
9614
|
+
const mark = p.state === "done" ? import_picocolors31.default.green("done") : p.state === "working" ? import_picocolors31.default.blue("working") : import_picocolors31.default.dim("waiting");
|
|
9832
9615
|
line(
|
|
9833
|
-
` ${
|
|
9616
|
+
` ${import_picocolors31.default.dim(String(p.index).padStart(2, "0"))} ${p.name} ${mark} ${import_picocolors31.default.dim(bar2)}`
|
|
9834
9617
|
);
|
|
9835
9618
|
for (const c of p.criteria ?? []) {
|
|
9836
|
-
const tick = c.met === true ?
|
|
9837
|
-
line(` ${tick} ${c.text} ${
|
|
9838
|
-
if (c.note) line(
|
|
9619
|
+
const tick = c.met === true ? import_picocolors31.default.green("\u2713") : c.met === false ? import_picocolors31.default.red("\u2717") : import_picocolors31.default.dim("\xB7");
|
|
9620
|
+
line(` ${tick} ${c.text} ${import_picocolors31.default.dim(c.id)}`);
|
|
9621
|
+
if (c.note) line(import_picocolors31.default.dim(` ${c.note}`));
|
|
9839
9622
|
}
|
|
9840
9623
|
}
|
|
9841
9624
|
const current = progress.find((p) => p.name === g.currentPhase);
|
|
9842
9625
|
if (current) {
|
|
9843
9626
|
line(
|
|
9844
|
-
|
|
9627
|
+
import_picocolors31.default.dim(
|
|
9845
9628
|
`
|
|
9846
9629
|
${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current.index} of ${progress.length}).`
|
|
9847
9630
|
)
|
|
@@ -9851,15 +9634,15 @@ ${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current
|
|
|
9851
9634
|
function statusTag3(status) {
|
|
9852
9635
|
switch (status) {
|
|
9853
9636
|
case "agreed":
|
|
9854
|
-
return
|
|
9637
|
+
return import_picocolors31.default.cyan("[agreed]");
|
|
9855
9638
|
case "working":
|
|
9856
|
-
return
|
|
9639
|
+
return import_picocolors31.default.blue("[working]");
|
|
9857
9640
|
case "delivered":
|
|
9858
|
-
return
|
|
9641
|
+
return import_picocolors31.default.green("[delivered]");
|
|
9859
9642
|
case "abandoned":
|
|
9860
|
-
return
|
|
9643
|
+
return import_picocolors31.default.dim("[abandoned]");
|
|
9861
9644
|
default:
|
|
9862
|
-
return
|
|
9645
|
+
return import_picocolors31.default.yellow("[proposed]");
|
|
9863
9646
|
}
|
|
9864
9647
|
}
|
|
9865
9648
|
|
|
@@ -10043,7 +9826,7 @@ function stripLeadingGlobalOptions(argv) {
|
|
|
10043
9826
|
}
|
|
10044
9827
|
|
|
10045
9828
|
// src/commands/decision.ts
|
|
10046
|
-
var
|
|
9829
|
+
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
10047
9830
|
function registerDecision(program3) {
|
|
10048
9831
|
const decision = program3.command("decision").description("Read and record the project's architecture decisions");
|
|
10049
9832
|
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(
|
|
@@ -10056,11 +9839,11 @@ function registerDecision(program3) {
|
|
|
10056
9839
|
rows = applyLimit(rows, opts.limit);
|
|
10057
9840
|
ok(rows, () => {
|
|
10058
9841
|
if (!rows.length) {
|
|
10059
|
-
line(
|
|
9842
|
+
line(import_picocolors32.default.dim("No decisions recorded yet."));
|
|
10060
9843
|
return;
|
|
10061
9844
|
}
|
|
10062
9845
|
for (const r of rows) {
|
|
10063
|
-
line(`${
|
|
9846
|
+
line(`${import_picocolors32.default.dim(r.id)} ${import_picocolors32.default.dim(shortDate(r.createdAt))} ${r.title}`);
|
|
10064
9847
|
line(` ${truncate(r.decision, 100)}`);
|
|
10065
9848
|
}
|
|
10066
9849
|
});
|
|
@@ -10074,16 +9857,16 @@ function registerDecision(program3) {
|
|
|
10074
9857
|
`/v1/projects/${projectId}/architecture-decisions/${args[0]}`
|
|
10075
9858
|
);
|
|
10076
9859
|
ok(row, () => {
|
|
10077
|
-
line(`${
|
|
10078
|
-
line(
|
|
9860
|
+
line(`${import_picocolors32.default.bold(row.title)} ${import_picocolors32.default.dim(row.id)}`);
|
|
9861
|
+
line(import_picocolors32.default.dim(`${row.status} \xB7 ${shortDate(row.createdAt)}`));
|
|
10079
9862
|
line(`
|
|
10080
|
-
${
|
|
9863
|
+
${import_picocolors32.default.bold("Context")}
|
|
10081
9864
|
${row.context}`);
|
|
10082
9865
|
line(`
|
|
10083
|
-
${
|
|
9866
|
+
${import_picocolors32.default.bold("Decision")}
|
|
10084
9867
|
${row.decision}`);
|
|
10085
9868
|
if (row.consequences) line(`
|
|
10086
|
-
${
|
|
9869
|
+
${import_picocolors32.default.bold("Consequences")}
|
|
10087
9870
|
${row.consequences}`);
|
|
10088
9871
|
});
|
|
10089
9872
|
})
|
|
@@ -10112,7 +9895,7 @@ ${row.consequences}`);
|
|
|
10112
9895
|
refId: row?.id,
|
|
10113
9896
|
output: { decision: row }
|
|
10114
9897
|
});
|
|
10115
|
-
ok(row, () => line(`Recorded decision ${
|
|
9898
|
+
ok(row, () => line(`Recorded decision ${import_picocolors32.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10116
9899
|
})
|
|
10117
9900
|
);
|
|
10118
9901
|
const requirement = program3.command("requirement").description("Read and record the project's requirements");
|
|
@@ -10124,11 +9907,11 @@ ${row.consequences}`);
|
|
|
10124
9907
|
rows = applyLimit(rows, opts.limit);
|
|
10125
9908
|
ok(rows, () => {
|
|
10126
9909
|
if (!rows.length) {
|
|
10127
|
-
line(
|
|
9910
|
+
line(import_picocolors32.default.dim("No requirements recorded yet."));
|
|
10128
9911
|
return;
|
|
10129
9912
|
}
|
|
10130
9913
|
for (const r of rows) {
|
|
10131
|
-
line(`${
|
|
9914
|
+
line(`${import_picocolors32.default.dim(r.id)} ${r.status.padEnd(9)} ${r.title}`);
|
|
10132
9915
|
}
|
|
10133
9916
|
});
|
|
10134
9917
|
})
|
|
@@ -10141,8 +9924,8 @@ ${row.consequences}`);
|
|
|
10141
9924
|
`/v1/projects/${projectId}/requirements/${args[0]}`
|
|
10142
9925
|
);
|
|
10143
9926
|
ok(row, () => {
|
|
10144
|
-
line(`${
|
|
10145
|
-
line(
|
|
9927
|
+
line(`${import_picocolors32.default.bold(row.title)} ${import_picocolors32.default.dim(row.id)}`);
|
|
9928
|
+
line(import_picocolors32.default.dim(`${row.status} \xB7 ${shortDate(row.createdAt)}`));
|
|
10146
9929
|
line(`
|
|
10147
9930
|
${row.body}`);
|
|
10148
9931
|
});
|
|
@@ -10168,7 +9951,7 @@ ${row.body}`);
|
|
|
10168
9951
|
refId: row?.id,
|
|
10169
9952
|
output: { requirement: row }
|
|
10170
9953
|
});
|
|
10171
|
-
ok(row, () => line(`Recorded requirement ${
|
|
9954
|
+
ok(row, () => line(`Recorded requirement ${import_picocolors32.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10172
9955
|
})
|
|
10173
9956
|
);
|
|
10174
9957
|
requirement.command("update <id>").description(
|
|
@@ -10197,7 +9980,7 @@ ${row.body}`);
|
|
|
10197
9980
|
code: "bad_request"
|
|
10198
9981
|
});
|
|
10199
9982
|
}
|
|
10200
|
-
ok(row, () => line(`Updated requirement ${
|
|
9983
|
+
ok(row, () => line(`Updated requirement ${import_picocolors32.default.bold(row.id)} \u2014 ${row.title} (${row.status})`));
|
|
10201
9984
|
})
|
|
10202
9985
|
);
|
|
10203
9986
|
}
|
|
@@ -10220,7 +10003,7 @@ function shortDate(iso) {
|
|
|
10220
10003
|
}
|
|
10221
10004
|
|
|
10222
10005
|
// src/commands/doc.ts
|
|
10223
|
-
var
|
|
10006
|
+
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
10224
10007
|
|
|
10225
10008
|
// src/mermaid-fences.ts
|
|
10226
10009
|
function hasDiagram(code) {
|
|
@@ -10265,13 +10048,13 @@ function registerDoc(program3) {
|
|
|
10265
10048
|
}) ?? [];
|
|
10266
10049
|
ok(rows, () => {
|
|
10267
10050
|
if (!rows.length) {
|
|
10268
|
-
line(
|
|
10051
|
+
line(import_picocolors33.default.dim("No documents yet."));
|
|
10269
10052
|
return;
|
|
10270
10053
|
}
|
|
10271
10054
|
for (const r of rows) {
|
|
10272
|
-
const link = r.workItemId ?
|
|
10273
|
-
const file = r.filePath ?
|
|
10274
|
-
line(`${
|
|
10055
|
+
const link = r.workItemId ? import_picocolors33.default.dim(` \u21B3 ${r.workItemId}`) : "";
|
|
10056
|
+
const file = r.filePath ? import_picocolors33.default.dim(` ${r.filePath}`) : "";
|
|
10057
|
+
line(`${import_picocolors33.default.dim(r.id)} ${r.title}${link}${file}`);
|
|
10275
10058
|
}
|
|
10276
10059
|
});
|
|
10277
10060
|
})
|
|
@@ -10285,17 +10068,17 @@ function registerDoc(program3) {
|
|
|
10285
10068
|
);
|
|
10286
10069
|
if (opts.markdown) {
|
|
10287
10070
|
ok({ id: row.id, title: row.title, filePath: row.filePath }, () => {
|
|
10288
|
-
line(`${
|
|
10071
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10289
10072
|
line(
|
|
10290
|
-
row.filePath ? `Read it at ${
|
|
10073
|
+
row.filePath ? `Read it at ${import_picocolors33.default.bold(row.filePath)} (relative to the project folder).` : import_picocolors33.default.dim("This document has no markdown mirror on disk yet.")
|
|
10291
10074
|
);
|
|
10292
10075
|
});
|
|
10293
10076
|
return;
|
|
10294
10077
|
}
|
|
10295
10078
|
ok(row, () => {
|
|
10296
|
-
line(`${
|
|
10297
|
-
if (row.workItemId) line(
|
|
10298
|
-
if (row.filePath) line(
|
|
10079
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10080
|
+
if (row.workItemId) line(import_picocolors33.default.dim(`linked to work item ${row.workItemId}`));
|
|
10081
|
+
if (row.filePath) line(import_picocolors33.default.dim(`markdown mirror: ${row.filePath}`));
|
|
10299
10082
|
line("");
|
|
10300
10083
|
line(row.contentJson);
|
|
10301
10084
|
});
|
|
@@ -10324,7 +10107,7 @@ function registerDoc(program3) {
|
|
|
10324
10107
|
refId: row?.id,
|
|
10325
10108
|
output: { document: row }
|
|
10326
10109
|
});
|
|
10327
|
-
ok(row, () => line(`Created document ${
|
|
10110
|
+
ok(row, () => line(`Created document ${import_picocolors33.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10328
10111
|
})
|
|
10329
10112
|
);
|
|
10330
10113
|
doc.command("diagram <id>").description(
|
|
@@ -10350,19 +10133,19 @@ function registerDoc(program3) {
|
|
|
10350
10133
|
diagrams: diagrams.map((code) => ({ kind: diagramKind(code), code }))
|
|
10351
10134
|
};
|
|
10352
10135
|
ok(payload, () => {
|
|
10353
|
-
line(`${
|
|
10136
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10354
10137
|
if (markdown === null) {
|
|
10355
10138
|
line(
|
|
10356
|
-
|
|
10139
|
+
import_picocolors33.default.dim(
|
|
10357
10140
|
row.filePath ? `Could not read ${row.filePath} from this folder.` : "This document has no markdown mirror on disk yet."
|
|
10358
10141
|
)
|
|
10359
10142
|
);
|
|
10360
10143
|
} else if (!diagrams.length) {
|
|
10361
|
-
line(
|
|
10144
|
+
line(import_picocolors33.default.dim("No diagrams in this document."));
|
|
10362
10145
|
} else {
|
|
10363
10146
|
for (const [i, code] of diagrams.entries()) {
|
|
10364
10147
|
const kind = diagramKind(code) ?? "diagram";
|
|
10365
|
-
line(`${
|
|
10148
|
+
line(`${import_picocolors33.default.dim(String(i + 1))} ${kind} ${import_picocolors33.default.dim(`${code.split("\n").length} lines`)}`);
|
|
10366
10149
|
}
|
|
10367
10150
|
}
|
|
10368
10151
|
});
|
|
@@ -10398,7 +10181,7 @@ function registerDoc(program3) {
|
|
|
10398
10181
|
code: "bad_request"
|
|
10399
10182
|
});
|
|
10400
10183
|
}
|
|
10401
|
-
ok(row, () => line(`Updated document ${
|
|
10184
|
+
ok(row, () => line(`Updated document ${import_picocolors33.default.bold(row.id)} \u2014 ${row.title}`));
|
|
10402
10185
|
})
|
|
10403
10186
|
);
|
|
10404
10187
|
}
|
|
@@ -10412,7 +10195,7 @@ function readMirror(cwd, filePath) {
|
|
|
10412
10195
|
}
|
|
10413
10196
|
|
|
10414
10197
|
// src/commands/design.ts
|
|
10415
|
-
var
|
|
10198
|
+
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
10416
10199
|
function registerDesign(program3) {
|
|
10417
10200
|
const design = program3.command("design").description("Read the project's brand (colours, fonts, logo)");
|
|
10418
10201
|
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(
|
|
@@ -10426,11 +10209,11 @@ function registerDesign(program3) {
|
|
|
10426
10209
|
if (opts.raw) {
|
|
10427
10210
|
ok(files, () => {
|
|
10428
10211
|
if (!files.length) {
|
|
10429
|
-
line(
|
|
10212
|
+
line(import_picocolors34.default.dim("No brand set for this project."));
|
|
10430
10213
|
return;
|
|
10431
10214
|
}
|
|
10432
10215
|
for (const f of files) {
|
|
10433
|
-
line(
|
|
10216
|
+
line(import_picocolors34.default.bold(f.path));
|
|
10434
10217
|
line(f.contents);
|
|
10435
10218
|
line("");
|
|
10436
10219
|
}
|
|
@@ -10447,21 +10230,21 @@ function registerDesign(program3) {
|
|
|
10447
10230
|
} : { hasBrand: false, colors: {}, fonts: {}, brand: {}, files: [] };
|
|
10448
10231
|
ok(summary, () => {
|
|
10449
10232
|
if (!tokens) {
|
|
10450
|
-
line(
|
|
10233
|
+
line(import_picocolors34.default.dim("No brand set for this project \u2014 choose sensible styling yourself."));
|
|
10451
10234
|
return;
|
|
10452
10235
|
}
|
|
10453
10236
|
for (const [name, value] of Object.entries(tokens.brand)) {
|
|
10454
|
-
line(`${
|
|
10237
|
+
line(`${import_picocolors34.default.dim(name.padEnd(12))} ${value}`);
|
|
10455
10238
|
}
|
|
10456
10239
|
for (const [name, value] of Object.entries(tokens.color)) {
|
|
10457
|
-
line(`${
|
|
10240
|
+
line(`${import_picocolors34.default.dim(`color.${name}`.padEnd(12))} ${value}`);
|
|
10458
10241
|
}
|
|
10459
10242
|
for (const [name, value] of Object.entries(tokens.font)) {
|
|
10460
|
-
line(`${
|
|
10243
|
+
line(`${import_picocolors34.default.dim(`font.${name}`.padEnd(12))} ${value}`);
|
|
10461
10244
|
}
|
|
10462
10245
|
line("");
|
|
10463
10246
|
line(
|
|
10464
|
-
|
|
10247
|
+
import_picocolors34.default.dim(
|
|
10465
10248
|
`Generated into the working tree as ${files.map((f) => f.path).join(", ")} \u2014 wire those in, never edit them.`
|
|
10466
10249
|
)
|
|
10467
10250
|
);
|
|
@@ -10492,7 +10275,7 @@ function unwrap(group) {
|
|
|
10492
10275
|
}
|
|
10493
10276
|
|
|
10494
10277
|
// src/commands/api.ts
|
|
10495
|
-
var
|
|
10278
|
+
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
10496
10279
|
import { readdirSync, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|
|
10497
10280
|
import { join as join3, relative, sep } from "path";
|
|
10498
10281
|
|
|
@@ -10606,10 +10389,10 @@ function registerApi(program3) {
|
|
|
10606
10389
|
const appId = requireApp2(opts.app);
|
|
10607
10390
|
const res = await api(ctx, `/v1/apps/${encodeURIComponent(appId)}/api/requests`);
|
|
10608
10391
|
ok(res, () => {
|
|
10609
|
-
for (const note of res?.notes ?? []) line(
|
|
10392
|
+
for (const note of res?.notes ?? []) line(import_picocolors35.default.dim(note));
|
|
10610
10393
|
for (const r of res?.requests ?? []) {
|
|
10611
10394
|
line(
|
|
10612
|
-
`${
|
|
10395
|
+
`${import_picocolors35.default.dim(r.method.padEnd(6))}${r.path}${r.note ? import_picocolors35.default.dim(` ${r.note}`) : ""}`
|
|
10613
10396
|
);
|
|
10614
10397
|
}
|
|
10615
10398
|
});
|
|
@@ -10643,14 +10426,14 @@ function registerApi(program3) {
|
|
|
10643
10426
|
);
|
|
10644
10427
|
ok(res, () => {
|
|
10645
10428
|
if (!res?.ok) {
|
|
10646
|
-
line(
|
|
10429
|
+
line(import_picocolors35.default.red(res?.error ?? "The service did not answer."));
|
|
10647
10430
|
return;
|
|
10648
10431
|
}
|
|
10649
10432
|
const code = `${res.status}${res.statusText ? ` ${res.statusText}` : ""}`;
|
|
10650
|
-
const colour2 = res.status && res.status < 300 ?
|
|
10651
|
-
line(`${colour2(code)} ${
|
|
10433
|
+
const colour2 = res.status && res.status < 300 ? import_picocolors35.default.green : res.status && res.status < 500 ? import_picocolors35.default.yellow : import_picocolors35.default.red;
|
|
10434
|
+
line(`${colour2(code)} ${import_picocolors35.default.dim(`${res.durationMs}ms ${res.url}`)}`);
|
|
10652
10435
|
if (res.body) line(res.body);
|
|
10653
|
-
if (res.truncated) line(
|
|
10436
|
+
if (res.truncated) line(import_picocolors35.default.dim("(answer truncated)"));
|
|
10654
10437
|
});
|
|
10655
10438
|
if (!res?.ok) process.exitCode = 1;
|
|
10656
10439
|
})
|
|
@@ -10670,15 +10453,15 @@ function registerApi(program3) {
|
|
|
10670
10453
|
for (const r of report.routes) {
|
|
10671
10454
|
const known = report.missing.some((m) => m.path === r.path);
|
|
10672
10455
|
line(
|
|
10673
|
-
`${known ?
|
|
10456
|
+
`${known ? import_picocolors35.default.yellow("undocumented") : import_picocolors35.default.green("documented ")} ${r.path}${import_picocolors35.default.dim(` ${r.file}`)}`
|
|
10674
10457
|
);
|
|
10675
10458
|
}
|
|
10676
10459
|
for (const p of report.stale) {
|
|
10677
|
-
line(`${
|
|
10460
|
+
line(`${import_picocolors35.default.dim("in spec only ")} ${p}`);
|
|
10678
10461
|
}
|
|
10679
10462
|
line("");
|
|
10680
10463
|
if (report.ok && specFile) success(summary);
|
|
10681
|
-
else line(
|
|
10464
|
+
else line(import_picocolors35.default.yellow(summary));
|
|
10682
10465
|
});
|
|
10683
10466
|
if (opts.check && !report.ok) {
|
|
10684
10467
|
throw new WorkserError(summary, { code: "bad_request" });
|
|
@@ -10749,7 +10532,7 @@ function listRepoFiles(root, maxDepth = 8) {
|
|
|
10749
10532
|
}
|
|
10750
10533
|
|
|
10751
10534
|
// src/commands/analysis.ts
|
|
10752
|
-
var
|
|
10535
|
+
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
10753
10536
|
import { readFileSync as readFileSync4 } from "fs";
|
|
10754
10537
|
function registerAnalysis(program3) {
|
|
10755
10538
|
const cmd = program3.command("analysis").description("Run Python analysis locally, recorded in the task");
|
|
@@ -10759,14 +10542,14 @@ function registerAnalysis(program3) {
|
|
|
10759
10542
|
const res = await api(ctx, path);
|
|
10760
10543
|
ok(res, () => {
|
|
10761
10544
|
line(
|
|
10762
|
-
`${res?.available ?
|
|
10545
|
+
`${res?.available ? import_picocolors36.default.green("python") : import_picocolors36.default.red("python")} ${res?.version ?? "not found"} ${import_picocolors36.default.dim(res?.python ?? "")}`
|
|
10763
10546
|
);
|
|
10764
10547
|
for (const lib of res?.libraries ?? []) {
|
|
10765
10548
|
line(
|
|
10766
|
-
`${lib.present ?
|
|
10549
|
+
`${lib.present ? import_picocolors36.default.green(lib.name) : import_picocolors36.default.yellow(lib.name)}${import_picocolors36.default.dim(lib.present ? "" : " missing")}`
|
|
10767
10550
|
);
|
|
10768
10551
|
}
|
|
10769
|
-
for (const note of res?.notes ?? []) line(
|
|
10552
|
+
for (const note of res?.notes ?? []) line(import_picocolors36.default.dim(note));
|
|
10770
10553
|
});
|
|
10771
10554
|
if (!res?.available) process.exitCode = 1;
|
|
10772
10555
|
})
|
|
@@ -10788,15 +10571,15 @@ function registerAnalysis(program3) {
|
|
|
10788
10571
|
);
|
|
10789
10572
|
ok(res, () => {
|
|
10790
10573
|
if (res?.stdout) line(res.stdout.replace(/\n$/, ""));
|
|
10791
|
-
if (res?.stderr) line(
|
|
10792
|
-
if (res?.truncated) line(
|
|
10574
|
+
if (res?.stderr) line(import_picocolors36.default.dim(res.stderr.replace(/\n$/, "")));
|
|
10575
|
+
if (res?.truncated) line(import_picocolors36.default.dim("(output truncated)"));
|
|
10793
10576
|
const took = `${Math.round((res?.durationMs ?? 0) / 100) / 10}s`;
|
|
10794
10577
|
line(
|
|
10795
|
-
res?.ok ?
|
|
10578
|
+
res?.ok ? import_picocolors36.default.green(`\u2713 ${res.summary ?? "It finished."}`) + import_picocolors36.default.dim(` ${took}`) : import_picocolors36.default.yellow(res?.summary ?? "It did not finish.") + import_picocolors36.default.dim(` ${took}`)
|
|
10796
10579
|
);
|
|
10797
10580
|
if (res && !res.sandboxed) {
|
|
10798
10581
|
line(
|
|
10799
|
-
|
|
10582
|
+
import_picocolors36.default.dim(
|
|
10800
10583
|
"This platform has no OS sandbox, so the script ran with your own file access."
|
|
10801
10584
|
)
|
|
10802
10585
|
);
|
|
@@ -10824,7 +10607,7 @@ function readCode(file, inline) {
|
|
|
10824
10607
|
}
|
|
10825
10608
|
|
|
10826
10609
|
// src/commands/scan.ts
|
|
10827
|
-
var
|
|
10610
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
10828
10611
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
10829
10612
|
import { existsSync as existsSync3, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
|
|
10830
10613
|
import { join as join4, relative as relative2, sep as sep2 } from "path";
|
|
@@ -11108,22 +10891,22 @@ function runPermissions(cwd, findings, checked, skipped) {
|
|
|
11108
10891
|
}
|
|
11109
10892
|
function print2(report, summary) {
|
|
11110
10893
|
for (const s of report.skipped) {
|
|
11111
|
-
line(`${
|
|
10894
|
+
line(`${import_picocolors37.default.yellow("not checked")} ${s.check}${import_picocolors37.default.dim(` \u2014 ${s.reason}`)}`);
|
|
11112
10895
|
}
|
|
11113
10896
|
for (const f of report.findings) {
|
|
11114
|
-
const where = f.file ?
|
|
10897
|
+
const where = f.file ? import_picocolors37.default.dim(` ${f.file}${f.line ? `:${f.line}` : ""}`) : "";
|
|
11115
10898
|
line(`${severityTag(f.severity)} ${f.title}${where}`);
|
|
11116
|
-
line(` ${
|
|
10899
|
+
line(` ${import_picocolors37.default.dim(f.fix)}`);
|
|
11117
10900
|
}
|
|
11118
10901
|
if (report.findings.length || report.skipped.length) line("");
|
|
11119
10902
|
if (report.ok && !report.skipped.length) success(summary);
|
|
11120
|
-
else if (report.ok) line(
|
|
11121
|
-
else line(
|
|
10903
|
+
else if (report.ok) line(import_picocolors37.default.yellow(summary));
|
|
10904
|
+
else line(import_picocolors37.default.red(summary));
|
|
11122
10905
|
}
|
|
11123
10906
|
function severityTag(severity) {
|
|
11124
|
-
if (severity === "high") return
|
|
11125
|
-
if (severity === "medium") return
|
|
11126
|
-
return
|
|
10907
|
+
if (severity === "high") return import_picocolors37.default.red("serious ");
|
|
10908
|
+
if (severity === "medium") return import_picocolors37.default.yellow("worth fixing");
|
|
10909
|
+
return import_picocolors37.default.dim("minor ");
|
|
11127
10910
|
}
|
|
11128
10911
|
function git(cwd, args) {
|
|
11129
10912
|
try {
|
|
@@ -11184,7 +10967,7 @@ function listRepoFiles2(root, maxDepth = 8) {
|
|
|
11184
10967
|
}
|
|
11185
10968
|
|
|
11186
10969
|
// src/commands/health.ts
|
|
11187
|
-
var
|
|
10970
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
11188
10971
|
function registerHealth(program3) {
|
|
11189
10972
|
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(
|
|
11190
10973
|
action(async ({ ctx, opts }) => {
|
|
@@ -11198,16 +10981,16 @@ function registerHealth(program3) {
|
|
|
11198
10981
|
}
|
|
11199
10982
|
function print3(res) {
|
|
11200
10983
|
if (!res?.checks?.length) {
|
|
11201
|
-
line(
|
|
10984
|
+
line(import_picocolors38.default.dim(res?.note ?? "Nothing to check."));
|
|
11202
10985
|
return;
|
|
11203
10986
|
}
|
|
11204
10987
|
for (const c of res.checks) {
|
|
11205
|
-
const mark = c.ok ?
|
|
11206
|
-
const timing =
|
|
11207
|
-
const detail = c.ok ? timing :
|
|
11208
|
-
line(` ${mark} ${c.appName} ${
|
|
10988
|
+
const mark = c.ok ? import_picocolors38.default.green("up ") : import_picocolors38.default.red("down");
|
|
10989
|
+
const timing = import_picocolors38.default.dim(`${c.ms}ms`);
|
|
10990
|
+
const detail = c.ok ? timing : import_picocolors38.default.dim(`${c.error ?? "no answer"}${c.failures > 1 ? ` \xB7 ${c.failures} in a row` : ""}`);
|
|
10991
|
+
line(` ${mark} ${c.appName} ${import_picocolors38.default.dim(`(${c.environment})`)} ${c.url} ${detail}`);
|
|
11209
10992
|
if (c.incidentOpened) {
|
|
11210
|
-
line(
|
|
10993
|
+
line(import_picocolors38.default.yellow(` An incident has been opened on the board for this.`));
|
|
11211
10994
|
}
|
|
11212
10995
|
}
|
|
11213
10996
|
const down = res.checks.filter((c) => !c.ok);
|
|
@@ -11220,14 +11003,14 @@ function print3(res) {
|
|
|
11220
11003
|
}
|
|
11221
11004
|
const production = down.filter((c) => c.environment === "production").length;
|
|
11222
11005
|
line(
|
|
11223
|
-
|
|
11006
|
+
import_picocolors38.default.red(
|
|
11224
11007
|
`${down.length} of ${res.checks.length} not answering` + (production ? ` \u2014 ${production} customer-facing.` : " (preview only).")
|
|
11225
11008
|
)
|
|
11226
11009
|
);
|
|
11227
11010
|
}
|
|
11228
11011
|
|
|
11229
11012
|
// src/commands/urls.ts
|
|
11230
|
-
var
|
|
11013
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
11231
11014
|
function registerUrls(program3) {
|
|
11232
11015
|
program3.command("urls").description("The stable preview and production addresses of every app in this project").option("--app <webAppId>", "just one app").action(
|
|
11233
11016
|
action(async ({ ctx, opts }) => {
|
|
@@ -11241,20 +11024,20 @@ function registerUrls(program3) {
|
|
|
11241
11024
|
const summary = urlsSummary(rows);
|
|
11242
11025
|
ok({ rows, summary }, () => {
|
|
11243
11026
|
for (const row of rows) {
|
|
11244
|
-
const label =
|
|
11245
|
-
const value = row.url ?
|
|
11027
|
+
const label = import_picocolors39.default.dim(row.environment.padEnd(10));
|
|
11028
|
+
const value = row.url ? import_picocolors39.default.cyan(row.url) : import_picocolors39.default.dim(row.note ?? "not published");
|
|
11246
11029
|
line(` ${row.appName.padEnd(22)} ${label} ${value}`);
|
|
11247
11030
|
}
|
|
11248
11031
|
line("");
|
|
11249
11032
|
if (rows.some((r) => r.url)) success(summary);
|
|
11250
|
-
else line(
|
|
11033
|
+
else line(import_picocolors39.default.yellow(summary));
|
|
11251
11034
|
});
|
|
11252
11035
|
})
|
|
11253
11036
|
);
|
|
11254
11037
|
}
|
|
11255
11038
|
|
|
11256
11039
|
// src/commands/deployments.ts
|
|
11257
|
-
var
|
|
11040
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
11258
11041
|
function registerDeployments(program3) {
|
|
11259
11042
|
const cmd = program3.command("deployments").description("Deployment history, and putting a build in front of customers");
|
|
11260
11043
|
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(
|
|
@@ -11272,7 +11055,7 @@ function registerDeployments(program3) {
|
|
|
11272
11055
|
ok(res, () => {
|
|
11273
11056
|
if (!items.length) {
|
|
11274
11057
|
return line(
|
|
11275
|
-
|
|
11058
|
+
import_picocolors40.default.dim(
|
|
11276
11059
|
environment ? `Nothing has been deployed to ${environment} yet.` : "Nothing has been deployed yet. `workser deploy` builds the first one."
|
|
11277
11060
|
)
|
|
11278
11061
|
);
|
|
@@ -11292,13 +11075,13 @@ function registerDeployments(program3) {
|
|
|
11292
11075
|
).catch(() => null) : null;
|
|
11293
11076
|
ok({ ...dep, logs }, () => {
|
|
11294
11077
|
line(formatDeployment(dep));
|
|
11295
|
-
if (dep?.error_message) line(
|
|
11078
|
+
if (dep?.error_message) line(import_picocolors40.default.red(` ${dep.error_message}`));
|
|
11296
11079
|
const events = logs?.events ?? [];
|
|
11297
11080
|
for (const e of events) {
|
|
11298
|
-
line(` ${
|
|
11081
|
+
line(` ${import_picocolors40.default.dim(String(e.type ?? "log"))} ${e.text ?? ""}`);
|
|
11299
11082
|
}
|
|
11300
11083
|
if (opts.logs && !events.length) {
|
|
11301
|
-
line(
|
|
11084
|
+
line(import_picocolors40.default.dim(" That build produced no output."));
|
|
11302
11085
|
}
|
|
11303
11086
|
});
|
|
11304
11087
|
})
|
|
@@ -11342,16 +11125,16 @@ function printPromoted(res, version) {
|
|
|
11342
11125
|
const what = version === null ? "the latest build" : `version ${version}`;
|
|
11343
11126
|
const url = res.url ?? res.vercel_url;
|
|
11344
11127
|
success(`Production is being rebuilt from ${what}.`);
|
|
11345
|
-
if (url) line(
|
|
11346
|
-
line(
|
|
11128
|
+
if (url) line(import_picocolors40.default.dim(`It will be at ${url}`));
|
|
11129
|
+
line(import_picocolors40.default.dim("`workser deploy status` follows it."));
|
|
11347
11130
|
}
|
|
11348
11131
|
function formatDeployment(d) {
|
|
11349
11132
|
if (!d) return "";
|
|
11350
|
-
const version = d.version !== void 0 ?
|
|
11351
|
-
const env =
|
|
11133
|
+
const version = d.version !== void 0 ? import_picocolors40.default.yellow(`v${d.version}`) : import_picocolors40.default.dim("v?");
|
|
11134
|
+
const env = import_picocolors40.default.dim((d.environment ?? "?").padEnd(10));
|
|
11352
11135
|
const app = d.webAppName ? `${d.webAppName} ` : "";
|
|
11353
|
-
const when =
|
|
11354
|
-
const url = d.url ? " " +
|
|
11136
|
+
const when = import_picocolors40.default.dim(formatTime2(d.created_at));
|
|
11137
|
+
const url = d.url ? " " + import_picocolors40.default.cyan(d.url) : "";
|
|
11355
11138
|
return `${version} ${env} ${colorStatus(d.status ?? "")} ${app}${when}${url}`;
|
|
11356
11139
|
}
|
|
11357
11140
|
function formatTime2(t) {
|
|
@@ -11361,7 +11144,7 @@ function formatTime2(t) {
|
|
|
11361
11144
|
}
|
|
11362
11145
|
|
|
11363
11146
|
// src/commands/usage.ts
|
|
11364
|
-
var
|
|
11147
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
11365
11148
|
|
|
11366
11149
|
// src/usage.ts
|
|
11367
11150
|
var NEAR_LIMIT_FRACTION = 0.8;
|
|
@@ -11456,7 +11239,7 @@ function registerUsage(program3) {
|
|
|
11456
11239
|
function print4(report) {
|
|
11457
11240
|
const dims = report.dimensions ?? [];
|
|
11458
11241
|
if (!dims.length) {
|
|
11459
|
-
return line(
|
|
11242
|
+
return line(import_picocolors41.default.dim("Nothing to measure for this project yet."));
|
|
11460
11243
|
}
|
|
11461
11244
|
const width = Math.max(...dims.map((d) => d.label.length));
|
|
11462
11245
|
for (const d of dims) {
|
|
@@ -11465,23 +11248,23 @@ function print4(report) {
|
|
|
11465
11248
|
line("");
|
|
11466
11249
|
const summary = usageSummary(report);
|
|
11467
11250
|
const worst = dims.map(usageState);
|
|
11468
|
-
if (worst.includes("over")) line(
|
|
11251
|
+
if (worst.includes("over")) line(import_picocolors41.default.red(summary));
|
|
11469
11252
|
else if (worst.includes("near") || worst.includes("unknown"))
|
|
11470
|
-
line(
|
|
11253
|
+
line(import_picocolors41.default.yellow(summary));
|
|
11471
11254
|
else success(summary);
|
|
11472
11255
|
}
|
|
11473
11256
|
function gauge(d, _labelWidth) {
|
|
11474
11257
|
const drawn = bar(d);
|
|
11475
|
-
return drawn ? ` ${
|
|
11258
|
+
return drawn ? ` ${import_picocolors41.default.dim(drawn)}` : "";
|
|
11476
11259
|
}
|
|
11477
11260
|
function colour(d) {
|
|
11478
11261
|
switch (usageState(d)) {
|
|
11479
11262
|
case "over":
|
|
11480
|
-
return d.kind === "hard" ?
|
|
11263
|
+
return d.kind === "hard" ? import_picocolors41.default.red : import_picocolors41.default.yellow;
|
|
11481
11264
|
case "near":
|
|
11482
|
-
return
|
|
11265
|
+
return import_picocolors41.default.yellow;
|
|
11483
11266
|
case "unknown":
|
|
11484
|
-
return
|
|
11267
|
+
return import_picocolors41.default.dim;
|
|
11485
11268
|
default:
|
|
11486
11269
|
return (s) => s;
|
|
11487
11270
|
}
|
|
@@ -11489,7 +11272,7 @@ function colour(d) {
|
|
|
11489
11272
|
|
|
11490
11273
|
// src/index.ts
|
|
11491
11274
|
var pkg = {
|
|
11492
|
-
version: true ? "0.6.
|
|
11275
|
+
version: true ? "0.6.16" : "0.0.0-dev"
|
|
11493
11276
|
};
|
|
11494
11277
|
var program2 = new Command();
|
|
11495
11278
|
program2.name("workser").description(
|
|
@@ -11522,7 +11305,6 @@ registerDomain(program2);
|
|
|
11522
11305
|
registerOpen(program2);
|
|
11523
11306
|
registerDoctor(program2);
|
|
11524
11307
|
registerAgent(program2);
|
|
11525
|
-
registerCloudAgent(program2);
|
|
11526
11308
|
registerVerify(program2);
|
|
11527
11309
|
registerApi(program2);
|
|
11528
11310
|
registerAnalysis(program2);
|