@workser/cli 0.6.15 → 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 +254 -737
- package/package.json +1 -1
- package/skills/workser/SKILL.md +0 -1
- package/skills/workser/reference/agent-cloud.md +21 -0
package/dist/index.js
CHANGED
|
@@ -3663,137 +3663,6 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
|
3663
3663
|
|
|
3664
3664
|
// src/help-content.ts
|
|
3665
3665
|
var HELP_TOPICS = [
|
|
3666
|
-
{
|
|
3667
|
-
topic: "agent-cloud",
|
|
3668
|
-
title: "Ship an agent inside the app",
|
|
3669
|
-
summary: "Create an AI agent that runs on Workser and can be called from this project's apps.",
|
|
3670
|
-
commands: ["agent-cloud"],
|
|
3671
|
-
source: "skills/workser/reference/agent-cloud.md",
|
|
3672
|
-
body: `# Ship an agent inside the app
|
|
3673
|
-
|
|
3674
|
-
\`workser agent-cloud\` creates an AI agent that runs on **Workser's**
|
|
3675
|
-
infrastructure, keeps its own memory and tools, and can be called from the web,
|
|
3676
|
-
mobile, API or Python apps in this project.
|
|
3677
|
-
|
|
3678
|
-
**This is not \`workser agent\`.** That one hands a subtask to a coding agent on
|
|
3679
|
-
this machine \u2014 a teammate helping you build. This one is a thing the project
|
|
3680
|
-
*ships*: it works for the user after you are gone.
|
|
3681
|
-
|
|
3682
|
-
\`\`\`
|
|
3683
|
-
workser agent-cloud list
|
|
3684
|
-
workser agent-cloud create "Order desk" --instructions "..."
|
|
3685
|
-
workser agent-cloud show <agentId>
|
|
3686
|
-
workser agent-cloud run <agentId> "<what to do>"
|
|
3687
|
-
workser agent-cloud runs <agentId> # recent runs
|
|
3688
|
-
workser agent-cloud runs <runId> # one run, with what it cost
|
|
3689
|
-
\`\`\`
|
|
3690
|
-
|
|
3691
|
-
Every call is scoped to the project this folder belongs to.
|
|
3692
|
-
|
|
3693
|
-
## Creating one is not finishing one
|
|
3694
|
-
|
|
3695
|
-
An agent created with a name and a sentence knows nothing about the business.
|
|
3696
|
-
Teaching it is the actual work, and it is all here:
|
|
3697
|
-
|
|
3698
|
-
\`\`\`
|
|
3699
|
-
workser agent-cloud set <id> system_prompt="..." handle="orderdesk"
|
|
3700
|
-
workser agent-cloud add <id> skill name="Refunds" instructions_md="..."
|
|
3701
|
-
workser agent-cloud add <id> knowledge name="Price list" content_text="..."
|
|
3702
|
-
workser agent-cloud add <id> tool display_name="Send email" provider="gmail" \\
|
|
3703
|
-
provider_tool_id="GMAIL_SEND_EMAIL"
|
|
3704
|
-
workser agent-cloud add <id> secret key="STRIPE_KEY" value="..."
|
|
3705
|
-
workser agent-cloud add <id> subagent subagent_id=<otherId> name="researcher"
|
|
3706
|
-
workser agent-cloud get <id> skill # what it has
|
|
3707
|
-
workser agent-cloud remove <id> skill <itemId>
|
|
3708
|
-
\`\`\`
|
|
3709
|
-
|
|
3710
|
-
\`add\` takes \`key=value\` pairs and REFUSES a field it does not know, rather than
|
|
3711
|
-
sending it. That matters: the API silently drops unknown fields, so a typo
|
|
3712
|
-
would otherwise be accepted, dropped, and reported as success \u2014 leaving an
|
|
3713
|
-
agent that had been told nothing.
|
|
3714
|
-
|
|
3715
|
-
## Nothing takes effect until you publish
|
|
3716
|
-
|
|
3717
|
-
**This is the step to not forget.** The runtime resolves the PUBLISHED version
|
|
3718
|
-
of an agent and never the draft, so every \`set\` and \`add\` above is inert until:
|
|
3719
|
-
|
|
3720
|
-
\`\`\`
|
|
3721
|
-
workser agent-cloud publish <id> --note "taught it refunds"
|
|
3722
|
-
\`\`\`
|
|
3723
|
-
|
|
3724
|
-
Before publishing, try the setup without putting it live:
|
|
3725
|
-
|
|
3726
|
-
\`\`\`
|
|
3727
|
-
workser agent-cloud try <id> "a customer wants a refund on order 1042"
|
|
3728
|
-
\`\`\`
|
|
3729
|
-
|
|
3730
|
-
A \`try\` runs the draft, costs the same as a real run, and changes nothing that
|
|
3731
|
-
customers can reach.
|
|
3732
|
-
|
|
3733
|
-
## Choosing how it thinks and what it runs on
|
|
3734
|
-
|
|
3735
|
-
\`\`\`
|
|
3736
|
-
workser agent-cloud models # cheapest first, on Workser credit
|
|
3737
|
-
workser agent-cloud models --all # includes ones needing your own key
|
|
3738
|
-
workser agent-cloud set <id> default_provider=openrouter default_model=...
|
|
3739
|
-
|
|
3740
|
-
workser agent-cloud machines # video, data analysis, design, ...
|
|
3741
|
-
\`\`\`
|
|
3742
|
-
|
|
3743
|
-
A model marked "needs your own key" will make \`publish\` FAIL unless a matching
|
|
3744
|
-
secret is stored first. Add the key with \`add <id> secret\` before setting it.
|
|
3745
|
-
|
|
3746
|
-
## When to reach for this
|
|
3747
|
-
|
|
3748
|
-
When the user describes a job that **keeps happening** and needs judgement:
|
|
3749
|
-
"check every order for stock and email me the problems", "read the LINE
|
|
3750
|
-
messages and file them", "reconcile these invoices". That is an agent.
|
|
3751
|
-
|
|
3752
|
-
A one-off transformation is not an agent \u2014 write the code. A fixed sequence of
|
|
3753
|
-
steps with no judgement in it is not an agent either \u2014 that is \`workser
|
|
3754
|
-
workflow\`.
|
|
3755
|
-
|
|
3756
|
-
## Calling it from the app you are building
|
|
3757
|
-
|
|
3758
|
-
Do NOT shell out to the CLI from app code. Use the SDK, which streams:
|
|
3759
|
-
|
|
3760
|
-
\`\`\`ts
|
|
3761
|
-
import { workser } from '@workser/app';
|
|
3762
|
-
|
|
3763
|
-
const run = await workser.agents.run(agentId, { message }, {
|
|
3764
|
-
referenceUserId: user.id, // who it is acting for
|
|
3765
|
-
});
|
|
3766
|
-
|
|
3767
|
-
for await (const event of workser.agents.stream(run.id)) {
|
|
3768
|
-
// event.type, event.data \u2014 forward these to the browser
|
|
3769
|
-
}
|
|
3770
|
-
\`\`\`
|
|
3771
|
-
|
|
3772
|
-
\`stream()\` reconnects itself through dropped connections, so the person
|
|
3773
|
-
watching sees the agent think. See the \`workser-sdk\` skill, \`reference/agents.md\`.
|
|
3774
|
-
|
|
3775
|
-
## Things that will bite you
|
|
3776
|
-
|
|
3777
|
-
1. **A run costs money by the minute.** It is metered \u2014 runtime, workspace, and
|
|
3778
|
-
a per-run fee \u2014 so a loop that starts agents is a loop that spends. Cancel
|
|
3779
|
-
what you abandon: \`workser agent-cloud runs <runId>\` shows the cost.
|
|
3780
|
-
|
|
3781
|
-
2. **Instructions are the product.** The agent does what its instructions say,
|
|
3782
|
-
in the user's own words. Write them the way you would brief a new colleague:
|
|
3783
|
-
what to do, what to leave alone, when to ask. Vague instructions are the
|
|
3784
|
-
single biggest cause of an agent that "doesn't work".
|
|
3785
|
-
|
|
3786
|
-
3. **Free plans cannot run agents at all**, and a trial has a small allowance.
|
|
3787
|
-
A \`402\` with \`spend_limit_reached\` is not a bug \u2014 tell the user what it says
|
|
3788
|
-
and point them at their plan.
|
|
3789
|
-
|
|
3790
|
-
4. **Say who it is for.** An agent acting for one of the app's customers needs
|
|
3791
|
-
\`referenceUserId\`, or its memory and audit trail belong to nobody.
|
|
3792
|
-
|
|
3793
|
-
5. **Do not invent an agent the user did not ask for.** Creating one is cheap;
|
|
3794
|
-
an agent nobody wanted, quietly costing money per run, is not.
|
|
3795
|
-
`
|
|
3796
|
-
},
|
|
3797
3666
|
{
|
|
3798
3667
|
topic: "analysis",
|
|
3799
3668
|
title: "Analysis \u2014 running Python on this project's data",
|
|
@@ -7590,366 +7459,8 @@ function formatRole(r) {
|
|
|
7590
7459
|
return `${label} ${agent} ${enabled} ${ready}${tail}`;
|
|
7591
7460
|
}
|
|
7592
7461
|
|
|
7593
|
-
// src/commands/agent-cloud.ts
|
|
7594
|
-
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
7595
|
-
function registerAgentCloud(program3) {
|
|
7596
|
-
const cloud = program3.command("agent-cloud").description(
|
|
7597
|
-
"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`)"
|
|
7598
|
-
);
|
|
7599
|
-
cloud.command("list").description("List this project's cloud agents").action(
|
|
7600
|
-
action(async ({ ctx }) => {
|
|
7601
|
-
const res = await api(ctx, "/v1/agent-cloud");
|
|
7602
|
-
const agents = res?.agents ?? res ?? [];
|
|
7603
|
-
ok(res, () => {
|
|
7604
|
-
if (!agents.length) {
|
|
7605
|
-
line(import_picocolors17.default.dim("No cloud agents yet."));
|
|
7606
|
-
line(
|
|
7607
|
-
import_picocolors17.default.dim("Create one: ") + import_picocolors17.default.bold('workser agent-cloud create "Order desk" --instructions "..."')
|
|
7608
|
-
);
|
|
7609
|
-
return;
|
|
7610
|
-
}
|
|
7611
|
-
for (const a of agents) {
|
|
7612
|
-
line(
|
|
7613
|
-
`${import_picocolors17.default.bold(a.name ?? a.id)} ${import_picocolors17.default.dim(a.id)}` + (a.status ? ` ${import_picocolors17.default.dim(a.status)}` : "")
|
|
7614
|
-
);
|
|
7615
|
-
if (a.description) line(" " + import_picocolors17.default.dim(a.description));
|
|
7616
|
-
}
|
|
7617
|
-
});
|
|
7618
|
-
})
|
|
7619
|
-
);
|
|
7620
|
-
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(
|
|
7621
|
-
"--instructions <text>",
|
|
7622
|
-
"The agent's standing instructions \u2014 what it should always do"
|
|
7623
|
-
).action(
|
|
7624
|
-
action(async ({ ctx, args, opts }) => {
|
|
7625
|
-
const res = await api(ctx, "/v1/agent-cloud", {
|
|
7626
|
-
method: "POST",
|
|
7627
|
-
body: {
|
|
7628
|
-
name: args[0],
|
|
7629
|
-
description: opts.description,
|
|
7630
|
-
instructions: opts.instructions
|
|
7631
|
-
}
|
|
7632
|
-
});
|
|
7633
|
-
ok(res, () => {
|
|
7634
|
-
line(import_picocolors17.default.green("Created ") + import_picocolors17.default.bold(res?.name ?? args[0]));
|
|
7635
|
-
if (res?.id) line(import_picocolors17.default.dim(res.id));
|
|
7636
|
-
line("");
|
|
7637
|
-
line(
|
|
7638
|
-
import_picocolors17.default.dim("Give it work: ") + import_picocolors17.default.bold(`workser agent-cloud run ${res?.id ?? "<id>"} "..."`)
|
|
7639
|
-
);
|
|
7640
|
-
});
|
|
7641
|
-
})
|
|
7642
|
-
);
|
|
7643
|
-
cloud.command("show <agentId>").description("One cloud agent, with its configuration").action(
|
|
7644
|
-
action(async ({ ctx, args }) => {
|
|
7645
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}`);
|
|
7646
|
-
ok(res, () => {
|
|
7647
|
-
line(import_picocolors17.default.bold(res?.name ?? args[0]));
|
|
7648
|
-
if (res?.description) line(import_picocolors17.default.dim(res.description));
|
|
7649
|
-
if (res?.instructions) {
|
|
7650
|
-
line("");
|
|
7651
|
-
line(import_picocolors17.default.bold("instructions:"));
|
|
7652
|
-
line(res.instructions);
|
|
7653
|
-
}
|
|
7654
|
-
});
|
|
7655
|
-
})
|
|
7656
|
-
);
|
|
7657
|
-
cloud.command("run <agentId> <message>").description("Give a cloud agent something to do").action(
|
|
7658
|
-
action(async ({ ctx, args }) => {
|
|
7659
|
-
const res = await api(
|
|
7660
|
-
ctx,
|
|
7661
|
-
`/v1/agent-cloud/${encodeURIComponent(args[0])}/runs`,
|
|
7662
|
-
{ method: "POST", body: { input: { message: args[1] } } }
|
|
7663
|
-
);
|
|
7664
|
-
ok(res, () => {
|
|
7665
|
-
line(import_picocolors17.default.green("Started run ") + import_picocolors17.default.bold(res?.id ?? ""));
|
|
7666
|
-
line(
|
|
7667
|
-
import_picocolors17.default.dim("Follow it: ") + import_picocolors17.default.bold(`workser agent-cloud runs ${res?.id ?? "<runId>"}`)
|
|
7668
|
-
);
|
|
7669
|
-
});
|
|
7670
|
-
})
|
|
7671
|
-
);
|
|
7672
|
-
cloud.command("runs [agentIdOrRunId]").description("Recent runs for an agent, or one run in detail").option("--limit <n>", "How many to list", "10").action(
|
|
7673
|
-
action(async ({ ctx, args, opts }) => {
|
|
7674
|
-
const id = args[0];
|
|
7675
|
-
if (!id) {
|
|
7676
|
-
warn("Give an agent id to list its runs, or a run id to inspect one.");
|
|
7677
|
-
return;
|
|
7678
|
-
}
|
|
7679
|
-
try {
|
|
7680
|
-
const run = await api(
|
|
7681
|
-
ctx,
|
|
7682
|
-
`/v1/agent-cloud/runs/${encodeURIComponent(id)}`
|
|
7683
|
-
);
|
|
7684
|
-
ok(run, () => printRun(run));
|
|
7685
|
-
return;
|
|
7686
|
-
} catch {
|
|
7687
|
-
}
|
|
7688
|
-
const res = await api(
|
|
7689
|
-
ctx,
|
|
7690
|
-
`/v1/agent-cloud/${encodeURIComponent(id)}/runs`,
|
|
7691
|
-
{ query: { limit: opts.limit } }
|
|
7692
|
-
);
|
|
7693
|
-
const runs = res?.runs ?? res ?? [];
|
|
7694
|
-
ok(res, () => {
|
|
7695
|
-
if (!runs.length) {
|
|
7696
|
-
line(import_picocolors17.default.dim("No runs yet."));
|
|
7697
|
-
return;
|
|
7698
|
-
}
|
|
7699
|
-
for (const r of runs) printRun(r, true);
|
|
7700
|
-
});
|
|
7701
|
-
})
|
|
7702
|
-
);
|
|
7703
|
-
const COLLECTIONS = {
|
|
7704
|
-
skill: {
|
|
7705
|
-
path: "skills",
|
|
7706
|
-
key: "skills",
|
|
7707
|
-
label: "skill",
|
|
7708
|
-
fields: ["name", "description", "instructions_md"],
|
|
7709
|
-
required: ["name"]
|
|
7710
|
-
},
|
|
7711
|
-
tool: {
|
|
7712
|
-
path: "tools",
|
|
7713
|
-
key: "tools",
|
|
7714
|
-
label: "action",
|
|
7715
|
-
fields: ["display_name", "provider", "provider_tool_id", "description"],
|
|
7716
|
-
required: ["display_name"]
|
|
7717
|
-
},
|
|
7718
|
-
mcp: {
|
|
7719
|
-
path: "mcp-servers",
|
|
7720
|
-
key: "servers",
|
|
7721
|
-
label: "MCP server",
|
|
7722
|
-
fields: ["name", "url"],
|
|
7723
|
-
required: ["name", "url"]
|
|
7724
|
-
},
|
|
7725
|
-
knowledge: {
|
|
7726
|
-
path: "resources",
|
|
7727
|
-
key: "resources",
|
|
7728
|
-
label: "reference material",
|
|
7729
|
-
fields: ["name", "content_text"],
|
|
7730
|
-
required: ["name"]
|
|
7731
|
-
},
|
|
7732
|
-
secret: {
|
|
7733
|
-
path: "secrets",
|
|
7734
|
-
key: "secrets",
|
|
7735
|
-
label: "stored key",
|
|
7736
|
-
fields: ["key", "value", "description"],
|
|
7737
|
-
required: ["key", "value"]
|
|
7738
|
-
},
|
|
7739
|
-
subagent: {
|
|
7740
|
-
path: "subagents",
|
|
7741
|
-
key: "subagents",
|
|
7742
|
-
label: "team member",
|
|
7743
|
-
fields: ["subagent_id", "name", "description"],
|
|
7744
|
-
required: ["subagent_id", "name"]
|
|
7745
|
-
},
|
|
7746
|
-
workflow: {
|
|
7747
|
-
path: "workflows",
|
|
7748
|
-
key: "workflows",
|
|
7749
|
-
label: "workflow",
|
|
7750
|
-
fields: ["workflow_id", "description"],
|
|
7751
|
-
required: ["workflow_id"]
|
|
7752
|
-
}
|
|
7753
|
-
};
|
|
7754
|
-
const kinds = Object.keys(COLLECTIONS).join(" | ");
|
|
7755
|
-
cloud.command("get <agentId> <kind>").description(`What an agent has been given (${kinds})`).action(
|
|
7756
|
-
action(async ({ ctx, args }) => {
|
|
7757
|
-
const spec = COLLECTIONS[args[1]];
|
|
7758
|
-
if (!spec) throw new Error(`Unknown kind "${args[1]}". One of: ${kinds}`);
|
|
7759
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}/${spec.path}`);
|
|
7760
|
-
const items = res?.[spec.key] ?? [];
|
|
7761
|
-
ok(res, () => {
|
|
7762
|
-
if (!items.length) {
|
|
7763
|
-
line(import_picocolors17.default.dim(`No ${spec.label} yet.`));
|
|
7764
|
-
return;
|
|
7765
|
-
}
|
|
7766
|
-
for (const i of items) {
|
|
7767
|
-
const title = i.name ?? i.display_name ?? i.key ?? i.workflow_id ?? i.id;
|
|
7768
|
-
line(`${import_picocolors17.default.bold(title)} ${import_picocolors17.default.dim(i.id)}`);
|
|
7769
|
-
if (i.description) line(" " + import_picocolors17.default.dim(i.description));
|
|
7770
|
-
if (i.is_enabled === false) line(" " + import_picocolors17.default.yellow("turned off"));
|
|
7771
|
-
}
|
|
7772
|
-
});
|
|
7773
|
-
})
|
|
7774
|
-
);
|
|
7775
|
-
cloud.command("add <agentId> <kind> [pairs...]").description(
|
|
7776
|
-
`Give an agent something (${kinds}). Pairs are key=value, e.g. name="Refunds"`
|
|
7777
|
-
).action(
|
|
7778
|
-
action(async ({ ctx, args }) => {
|
|
7779
|
-
const spec = COLLECTIONS[args[1]];
|
|
7780
|
-
if (!spec) throw new Error(`Unknown kind "${args[1]}". One of: ${kinds}`);
|
|
7781
|
-
const body = parsePairs(args[2] ?? [], spec.fields);
|
|
7782
|
-
const missing = spec.required.filter((f) => !body[f]);
|
|
7783
|
-
if (missing.length) {
|
|
7784
|
-
throw new Error(
|
|
7785
|
-
`A ${spec.label} needs ${missing.join(" and ")}. Accepted: ${spec.fields.join(", ")}`
|
|
7786
|
-
);
|
|
7787
|
-
}
|
|
7788
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}/${spec.path}`, {
|
|
7789
|
-
method: "POST",
|
|
7790
|
-
body
|
|
7791
|
-
});
|
|
7792
|
-
ok(res, () => {
|
|
7793
|
-
line(import_picocolors17.default.green(`Added the ${spec.label}.`) + " " + import_picocolors17.default.dim(res?.id ?? ""));
|
|
7794
|
-
line(
|
|
7795
|
-
import_picocolors17.default.dim("Not live yet \u2014 run ") + import_picocolors17.default.bold(`workser agent-cloud publish ${args[0]}`) + import_picocolors17.default.dim(" when the setup is ready.")
|
|
7796
|
-
);
|
|
7797
|
-
});
|
|
7798
|
-
})
|
|
7799
|
-
);
|
|
7800
|
-
cloud.command("remove <agentId> <kind> <itemId>").description(`Take something away from an agent (${kinds})`).action(
|
|
7801
|
-
action(async ({ ctx, args }) => {
|
|
7802
|
-
const spec = COLLECTIONS[args[1]];
|
|
7803
|
-
if (!spec) throw new Error(`Unknown kind "${args[1]}". One of: ${kinds}`);
|
|
7804
|
-
const res = await api(
|
|
7805
|
-
ctx,
|
|
7806
|
-
`/v1/agent-cloud/${encodeURIComponent(args[0])}/${spec.path}/${encodeURIComponent(args[2])}`,
|
|
7807
|
-
{ method: "DELETE" }
|
|
7808
|
-
);
|
|
7809
|
-
ok(res, () => line(import_picocolors17.default.green(`Removed the ${spec.label}.`)));
|
|
7810
|
-
})
|
|
7811
|
-
);
|
|
7812
|
-
cloud.command("set <agentId> [pairs...]").description(
|
|
7813
|
-
"Change the brief or the model. Pairs: name, description, system_prompt, handle, default_provider, default_model"
|
|
7814
|
-
).action(
|
|
7815
|
-
action(async ({ ctx, args }) => {
|
|
7816
|
-
const body = parsePairs(args[1] ?? [], [
|
|
7817
|
-
"name",
|
|
7818
|
-
"description",
|
|
7819
|
-
"system_prompt",
|
|
7820
|
-
"handle",
|
|
7821
|
-
"default_provider",
|
|
7822
|
-
"default_model"
|
|
7823
|
-
]);
|
|
7824
|
-
if (!Object.keys(body).length) {
|
|
7825
|
-
throw new Error(
|
|
7826
|
-
'Nothing to change. Example: workser agent-cloud set <id> system_prompt="Always check stock first"'
|
|
7827
|
-
);
|
|
7828
|
-
}
|
|
7829
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}`, {
|
|
7830
|
-
method: "PATCH",
|
|
7831
|
-
body
|
|
7832
|
-
});
|
|
7833
|
-
ok(res, () => {
|
|
7834
|
-
line(import_picocolors17.default.green("Saved."));
|
|
7835
|
-
line(
|
|
7836
|
-
import_picocolors17.default.dim("Not live yet \u2014 run ") + import_picocolors17.default.bold(`workser agent-cloud publish ${args[0]}`) + import_picocolors17.default.dim(".")
|
|
7837
|
-
);
|
|
7838
|
-
});
|
|
7839
|
-
})
|
|
7840
|
-
);
|
|
7841
|
-
cloud.command("publish <agentId>").description("Put the current setup live \u2014 nothing takes effect until this runs").option("--note <text>", "What changed, for the version history").action(
|
|
7842
|
-
action(async ({ ctx, args, opts }) => {
|
|
7843
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}/publish`, {
|
|
7844
|
-
method: "POST",
|
|
7845
|
-
body: { changelog: opts.note }
|
|
7846
|
-
});
|
|
7847
|
-
ok(
|
|
7848
|
-
res,
|
|
7849
|
-
() => line(import_picocolors17.default.green(`Live${res?.version ? ` \u2014 version ${res.version}` : ""}.`))
|
|
7850
|
-
);
|
|
7851
|
-
})
|
|
7852
|
-
);
|
|
7853
|
-
cloud.command("try <agentId> <message>").description("Run the current setup WITHOUT publishing it").action(
|
|
7854
|
-
action(async ({ ctx, args }) => {
|
|
7855
|
-
const res = await api(ctx, `/v1/agent-cloud/${encodeURIComponent(args[0])}/test-runs`, {
|
|
7856
|
-
method: "POST",
|
|
7857
|
-
body: { input: { message: args[1] } }
|
|
7858
|
-
});
|
|
7859
|
-
ok(res, () => {
|
|
7860
|
-
line(import_picocolors17.default.green("Trying it \u2014 nothing has gone live."));
|
|
7861
|
-
if (res?.run_id) {
|
|
7862
|
-
line(
|
|
7863
|
-
import_picocolors17.default.dim("Watch it: ") + import_picocolors17.default.bold(`workser agent-cloud runs ${res.run_id}`)
|
|
7864
|
-
);
|
|
7865
|
-
}
|
|
7866
|
-
});
|
|
7867
|
-
})
|
|
7868
|
-
);
|
|
7869
|
-
cloud.command("machines").description("The pre-built machines an agent can run on").action(
|
|
7870
|
-
action(async ({ ctx }) => {
|
|
7871
|
-
const res = await api(ctx, "/v1/agent-cloud/catalog/machines");
|
|
7872
|
-
ok(res, () => {
|
|
7873
|
-
for (const m of res?.machines ?? []) {
|
|
7874
|
-
line(`${import_picocolors17.default.bold(m.label)} ${import_picocolors17.default.dim(m.alias)}`);
|
|
7875
|
-
line(" " + import_picocolors17.default.dim(m.description));
|
|
7876
|
-
}
|
|
7877
|
-
});
|
|
7878
|
-
})
|
|
7879
|
-
);
|
|
7880
|
-
cloud.command("models").description("Models this organisation can run an agent on, cheapest first").option("--all", "Include models that need your own provider key").action(
|
|
7881
|
-
action(async ({ ctx, opts }) => {
|
|
7882
|
-
const res = await api(ctx, "/v1/agent-cloud/catalog/models/live");
|
|
7883
|
-
const models = (res?.models ?? []).filter(
|
|
7884
|
-
(m) => opts.all || m.credit_tier === "PLATFORM_CREDITS"
|
|
7885
|
-
);
|
|
7886
|
-
ok(res, () => {
|
|
7887
|
-
if (!models.length) {
|
|
7888
|
-
warn("The live model list could not be read.");
|
|
7889
|
-
return;
|
|
7890
|
-
}
|
|
7891
|
-
for (const m of models.slice(0, 40)) {
|
|
7892
|
-
const price = typeof m.input_price_per_million_usd === "number" ? `$${m.input_price_per_million_usd.toFixed(2)}/M in` : "price unknown";
|
|
7893
|
-
const byok = m.credit_tier === "PLATFORM_CREDITS" ? "" : import_picocolors17.default.yellow(" needs your own key");
|
|
7894
|
-
line(`${import_picocolors17.default.bold(m.id)} ${import_picocolors17.default.dim(price)}${byok}`);
|
|
7895
|
-
}
|
|
7896
|
-
});
|
|
7897
|
-
})
|
|
7898
|
-
);
|
|
7899
|
-
}
|
|
7900
|
-
function printRun(run, compact = false) {
|
|
7901
|
-
const status = String(run?.status ?? "").toLowerCase();
|
|
7902
|
-
const colour2 = status === "completed" ? import_picocolors17.default.green : status === "failed" ? import_picocolors17.default.red : import_picocolors17.default.yellow;
|
|
7903
|
-
line(
|
|
7904
|
-
`${colour2(status || "unknown")} ${import_picocolors17.default.bold(run?.id ?? "")}` + (run?.duration_ms ? ` ${import_picocolors17.default.dim(formatDuration(run.duration_ms))}` : "")
|
|
7905
|
-
);
|
|
7906
|
-
const breakdown = run?.cost_breakdown;
|
|
7907
|
-
if (breakdown) {
|
|
7908
|
-
if (!breakdown.settled) {
|
|
7909
|
-
line(" " + import_picocolors17.default.dim("cost: still being worked out"));
|
|
7910
|
-
} else {
|
|
7911
|
-
line(" " + import_picocolors17.default.dim(`cost: $${Number(breakdown.total_usd).toFixed(4)}`));
|
|
7912
|
-
line(
|
|
7913
|
-
" " + import_picocolors17.default.dim(
|
|
7914
|
-
`model $${Number(breakdown.model_usd).toFixed(4)} \xB7 infrastructure $${Number(breakdown.infrastructure_usd).toFixed(4)}`
|
|
7915
|
-
)
|
|
7916
|
-
);
|
|
7917
|
-
}
|
|
7918
|
-
} else if (run?.cost_usd !== void 0 && run?.cost_usd !== null) {
|
|
7919
|
-
line(" " + import_picocolors17.default.dim(`model cost: $${Number(run.cost_usd).toFixed(4)}`));
|
|
7920
|
-
}
|
|
7921
|
-
if (!compact && run?.output) {
|
|
7922
|
-
line("");
|
|
7923
|
-
line(typeof run.output === "string" ? run.output : JSON.stringify(run.output, null, 2));
|
|
7924
|
-
}
|
|
7925
|
-
if (run?.error?.message) line(" " + import_picocolors17.default.red(run.error.message));
|
|
7926
|
-
}
|
|
7927
|
-
function formatDuration(ms) {
|
|
7928
|
-
if (ms < 1e3) return `${ms}ms`;
|
|
7929
|
-
const seconds = Math.round(ms / 1e3);
|
|
7930
|
-
if (seconds < 60) return `${seconds}s`;
|
|
7931
|
-
const minutes = Math.floor(seconds / 60);
|
|
7932
|
-
return `${minutes}m ${seconds % 60}s`;
|
|
7933
|
-
}
|
|
7934
|
-
function parsePairs(pairs, allowed) {
|
|
7935
|
-
const out = {};
|
|
7936
|
-
for (const raw of pairs) {
|
|
7937
|
-
const at = raw.indexOf("=");
|
|
7938
|
-
if (at < 1) {
|
|
7939
|
-
throw new Error(`"${raw}" is not a key=value pair.`);
|
|
7940
|
-
}
|
|
7941
|
-
const key = raw.slice(0, at).trim();
|
|
7942
|
-
const value = raw.slice(at + 1);
|
|
7943
|
-
if (!allowed.includes(key)) {
|
|
7944
|
-
throw new Error(`"${key}" is not a field here. Accepted: ${allowed.join(", ")}`);
|
|
7945
|
-
}
|
|
7946
|
-
if (value) out[key] = value;
|
|
7947
|
-
}
|
|
7948
|
-
return out;
|
|
7949
|
-
}
|
|
7950
|
-
|
|
7951
7462
|
// src/commands/verify.ts
|
|
7952
|
-
var
|
|
7463
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
7953
7464
|
function registerVerify(program3) {
|
|
7954
7465
|
program3.command("verify").description(
|
|
7955
7466
|
"Run the project's checks (typecheck/lint/build) \u2014 use before declaring a task done"
|
|
@@ -7971,23 +7482,23 @@ function registerVerify(program3) {
|
|
|
7971
7482
|
function printVerify(res) {
|
|
7972
7483
|
if (!res) return;
|
|
7973
7484
|
if (!res.checks?.length) {
|
|
7974
|
-
line(
|
|
7485
|
+
line(import_picocolors17.default.dim(res.note ?? "No checks detected."));
|
|
7975
7486
|
return;
|
|
7976
7487
|
}
|
|
7977
7488
|
for (const c of res.checks) {
|
|
7978
7489
|
line(
|
|
7979
|
-
` ${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})`)}`
|
|
7980
7491
|
);
|
|
7981
7492
|
}
|
|
7982
7493
|
if (res.ok) success("All checks passed");
|
|
7983
7494
|
else
|
|
7984
7495
|
line(
|
|
7985
|
-
|
|
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(".")
|
|
7986
7497
|
);
|
|
7987
7498
|
}
|
|
7988
7499
|
|
|
7989
7500
|
// src/commands/checkpoint.ts
|
|
7990
|
-
var
|
|
7501
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
7991
7502
|
function registerCheckpoint(program3) {
|
|
7992
7503
|
program3.command("checkpoint [label]").description(
|
|
7993
7504
|
"Save the current state of this folder so you can come back to it"
|
|
@@ -8004,8 +7515,8 @@ function registerCheckpoint(program3) {
|
|
|
8004
7515
|
ok(res, () => {
|
|
8005
7516
|
const p = res?.point;
|
|
8006
7517
|
success(`Saved a checkpoint${p?.label ? `: ${p.label}` : ""}`);
|
|
8007
|
-
if (p?.ref) line(
|
|
8008
|
-
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`."));
|
|
8009
7520
|
});
|
|
8010
7521
|
})
|
|
8011
7522
|
);
|
|
@@ -8031,12 +7542,12 @@ function registerCheckpoint(program3) {
|
|
|
8031
7542
|
);
|
|
8032
7543
|
if (res?.filesChanged) {
|
|
8033
7544
|
line(
|
|
8034
|
-
|
|
7545
|
+
import_picocolors18.default.dim(
|
|
8035
7546
|
` ${res.filesChanged} file${res.filesChanged === 1 ? "" : "s"} changed`
|
|
8036
7547
|
)
|
|
8037
7548
|
);
|
|
8038
7549
|
}
|
|
8039
|
-
line(
|
|
7550
|
+
line(import_picocolors18.default.dim(" This is reversible: `workser restore` again."));
|
|
8040
7551
|
});
|
|
8041
7552
|
})
|
|
8042
7553
|
);
|
|
@@ -8053,25 +7564,25 @@ function registerCheckpoint(program3) {
|
|
|
8053
7564
|
function printPoints(points) {
|
|
8054
7565
|
if (!points.length) {
|
|
8055
7566
|
info("No checkpoints yet for this folder.");
|
|
8056
|
-
line(
|
|
7567
|
+
line(import_picocolors18.default.dim(" Take one with `workser checkpoint`."));
|
|
8057
7568
|
return;
|
|
8058
7569
|
}
|
|
8059
|
-
line(
|
|
7570
|
+
line(import_picocolors18.default.bold("Checkpoints"));
|
|
8060
7571
|
for (const p of points) {
|
|
8061
7572
|
const when = p.at ? new Date(p.at).toLocaleString() : "";
|
|
8062
7573
|
line(
|
|
8063
|
-
` ${
|
|
7574
|
+
` ${import_picocolors18.default.dim(p.ref.slice(0, 7))} ${p.label}${when ? import_picocolors18.default.dim(` ${when}`) : ""}`
|
|
8064
7575
|
);
|
|
8065
7576
|
}
|
|
8066
7577
|
line(
|
|
8067
|
-
|
|
7578
|
+
import_picocolors18.default.dim(
|
|
8068
7579
|
"\nGo back with `workser restore <ref>`, or just `workser restore` for the newest."
|
|
8069
7580
|
)
|
|
8070
7581
|
);
|
|
8071
7582
|
}
|
|
8072
7583
|
|
|
8073
7584
|
// src/commands/sync.ts
|
|
8074
|
-
var
|
|
7585
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
8075
7586
|
function registerSync(program3) {
|
|
8076
7587
|
program3.command("sync").description(
|
|
8077
7588
|
"Reconcile this folder with the copy Workser holds (pull, then push)"
|
|
@@ -8098,7 +7609,7 @@ function registerSync(program3) {
|
|
|
8098
7609
|
warn(res?.message ?? "Couldn't sync this folder.");
|
|
8099
7610
|
if (res?.state === "diverged") {
|
|
8100
7611
|
line(
|
|
8101
|
-
|
|
7612
|
+
import_picocolors19.default.dim(
|
|
8102
7613
|
" This folder and Workser's copy have both changed. Open Workser to resolve it."
|
|
8103
7614
|
)
|
|
8104
7615
|
);
|
|
@@ -8110,7 +7621,7 @@ function registerSync(program3) {
|
|
|
8110
7621
|
return;
|
|
8111
7622
|
}
|
|
8112
7623
|
success("Synced");
|
|
8113
|
-
if (res?.ref) line(
|
|
7624
|
+
if (res?.ref) line(import_picocolors19.default.dim(` ${String(res.ref).slice(0, 7)}`));
|
|
8114
7625
|
});
|
|
8115
7626
|
if (refused) process.exitCode = 1;
|
|
8116
7627
|
})
|
|
@@ -8118,7 +7629,7 @@ function registerSync(program3) {
|
|
|
8118
7629
|
}
|
|
8119
7630
|
|
|
8120
7631
|
// src/commands/workflow.ts
|
|
8121
|
-
var
|
|
7632
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
8122
7633
|
function registerWorkflow(program3) {
|
|
8123
7634
|
const wf = program3.command("workflow").description("Create, run, and inspect workflow automations for the project");
|
|
8124
7635
|
wf.command("list").description("List the project's workflows").action(
|
|
@@ -8126,10 +7637,10 @@ function registerWorkflow(program3) {
|
|
|
8126
7637
|
const projectId = requireProject(ctx);
|
|
8127
7638
|
const items = await api(ctx, `/v1/projects/${projectId}/workflows`);
|
|
8128
7639
|
ok(items, () => {
|
|
8129
|
-
if (!items?.length) return line(
|
|
7640
|
+
if (!items?.length) return line(import_picocolors20.default.dim("No workflows yet. `workser workflow create`."));
|
|
8130
7641
|
for (const w of items) {
|
|
8131
|
-
const status = w.is_active ?
|
|
8132
|
-
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}`);
|
|
8133
7644
|
}
|
|
8134
7645
|
});
|
|
8135
7646
|
})
|
|
@@ -8141,7 +7652,7 @@ function registerWorkflow(program3) {
|
|
|
8141
7652
|
const res = await api(ctx, `/v1/projects/${projectId}/workflows`, {
|
|
8142
7653
|
body: { name: args[0], ...extra }
|
|
8143
7654
|
});
|
|
8144
|
-
ok(res, () => line(`Created workflow ${
|
|
7655
|
+
ok(res, () => line(`Created workflow ${import_picocolors20.default.bold(res.id)}.`));
|
|
8145
7656
|
})
|
|
8146
7657
|
);
|
|
8147
7658
|
wf.command("get <id>").description("Show a workflow's full definition").action(
|
|
@@ -8176,8 +7687,8 @@ function registerWorkflow(program3) {
|
|
|
8176
7687
|
action(async ({ ctx, args }) => {
|
|
8177
7688
|
const items = await api(ctx, `/v1/workflows/${args[0]}/executions`);
|
|
8178
7689
|
ok(items, () => {
|
|
8179
|
-
if (!items?.length) return line(
|
|
8180
|
-
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 ?? "")}`);
|
|
8181
7692
|
});
|
|
8182
7693
|
})
|
|
8183
7694
|
);
|
|
@@ -8185,15 +7696,15 @@ function registerWorkflow(program3) {
|
|
|
8185
7696
|
action(async ({ ctx, args }) => {
|
|
8186
7697
|
const items = await api(ctx, `/v1/node-types`, { query: { q: args[0] } });
|
|
8187
7698
|
ok(items, () => {
|
|
8188
|
-
if (!items?.length) return line(
|
|
8189
|
-
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 ?? "")}`);
|
|
8190
7701
|
});
|
|
8191
7702
|
})
|
|
8192
7703
|
);
|
|
8193
7704
|
}
|
|
8194
7705
|
|
|
8195
7706
|
// src/commands/connection.ts
|
|
8196
|
-
var
|
|
7707
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
8197
7708
|
function registerConnection(program3) {
|
|
8198
7709
|
const connection = program3.command("connection").description("Connect and use third-party app connections (Gmail, Slack, Stripe, ...)");
|
|
8199
7710
|
connection.command("list").description("List connectable toolkits and this project's existing connections").option("--toolkit <slug>", "filter connections to one toolkit").action(
|
|
@@ -8206,8 +7717,8 @@ function registerConnection(program3) {
|
|
|
8206
7717
|
ok({ catalog, connections }, () => {
|
|
8207
7718
|
const connected = new Set((connections ?? []).map((c) => c.toolkit ?? c.composio_app));
|
|
8208
7719
|
for (const t of catalog ?? []) {
|
|
8209
|
-
const status = connected.has(t.slug) ?
|
|
8210
|
-
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}`);
|
|
8211
7722
|
}
|
|
8212
7723
|
});
|
|
8213
7724
|
})
|
|
@@ -8219,9 +7730,9 @@ function registerConnection(program3) {
|
|
|
8219
7730
|
query: { q: args[0], toolkit: opts.toolkit, limit: opts.limit }
|
|
8220
7731
|
});
|
|
8221
7732
|
ok(items, () => {
|
|
8222
|
-
if (!items?.length) return line(
|
|
7733
|
+
if (!items?.length) return line(import_picocolors21.default.dim("No matching actions."));
|
|
8223
7734
|
for (const t of items) {
|
|
8224
|
-
line(`${t.slug} ${
|
|
7735
|
+
line(`${t.slug} ${import_picocolors21.default.dim(`[${t.toolkit}]`)} ${t.description ?? ""}`);
|
|
8225
7736
|
}
|
|
8226
7737
|
});
|
|
8227
7738
|
})
|
|
@@ -8238,7 +7749,7 @@ function registerConnection(program3) {
|
|
|
8238
7749
|
});
|
|
8239
7750
|
ok(
|
|
8240
7751
|
res,
|
|
8241
|
-
() => 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}.`)
|
|
8242
7753
|
);
|
|
8243
7754
|
})
|
|
8244
7755
|
);
|
|
@@ -8256,8 +7767,8 @@ function registerConnection(program3) {
|
|
|
8256
7767
|
const projectId = requireProject(ctx);
|
|
8257
7768
|
const items = await api(ctx, `/v1/projects/${projectId}/integrations/${args[0]}/tools`);
|
|
8258
7769
|
ok(items, () => {
|
|
8259
|
-
if (!items?.length) return line(
|
|
8260
|
-
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 ?? "")}`);
|
|
8261
7772
|
});
|
|
8262
7773
|
})
|
|
8263
7774
|
);
|
|
@@ -8273,7 +7784,7 @@ function registerConnection(program3) {
|
|
|
8273
7784
|
}
|
|
8274
7785
|
|
|
8275
7786
|
// src/commands/tool.ts
|
|
8276
|
-
var
|
|
7787
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
8277
7788
|
function registerTool(program3) {
|
|
8278
7789
|
const tool = program3.command("tool").description(
|
|
8279
7790
|
"Computer-use tools: filesystem, shell, screenshot, input control, clipboard, notifications, basic browser"
|
|
@@ -8282,7 +7793,7 @@ function registerTool(program3) {
|
|
|
8282
7793
|
action(async ({ ctx }) => {
|
|
8283
7794
|
const tools = await api(ctx, "/v1/tool/list");
|
|
8284
7795
|
ok(tools, () => {
|
|
8285
|
-
if (!tools?.length) return line(
|
|
7796
|
+
if (!tools?.length) return line(import_picocolors22.default.dim("No tools available."));
|
|
8286
7797
|
const byCategory = /* @__PURE__ */ new Map();
|
|
8287
7798
|
for (const t of tools) {
|
|
8288
7799
|
const list = byCategory.get(t.category) ?? [];
|
|
@@ -8290,9 +7801,9 @@ function registerTool(program3) {
|
|
|
8290
7801
|
byCategory.set(t.category, list);
|
|
8291
7802
|
}
|
|
8292
7803
|
for (const [category, items] of byCategory) {
|
|
8293
|
-
line(
|
|
7804
|
+
line(import_picocolors22.default.bold(category) + ":");
|
|
8294
7805
|
for (const t of items) {
|
|
8295
|
-
line(` ${t.name} ${
|
|
7806
|
+
line(` ${t.name} ${import_picocolors22.default.dim(t.description ?? "")}`);
|
|
8296
7807
|
}
|
|
8297
7808
|
}
|
|
8298
7809
|
});
|
|
@@ -8310,7 +7821,7 @@ function registerTool(program3) {
|
|
|
8310
7821
|
}
|
|
8311
7822
|
|
|
8312
7823
|
// src/commands/memory.ts
|
|
8313
|
-
var
|
|
7824
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
8314
7825
|
function registerMemory(program3) {
|
|
8315
7826
|
const memory = program3.command("memory").description("Durable, cross-conversation project memory (shared with cloud agents on the same project)");
|
|
8316
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(
|
|
@@ -8334,9 +7845,9 @@ function registerMemory(program3) {
|
|
|
8334
7845
|
});
|
|
8335
7846
|
ok(res, () => {
|
|
8336
7847
|
const results = res?.results ?? res ?? [];
|
|
8337
|
-
if (!results?.length) return line(
|
|
7848
|
+
if (!results?.length) return line(import_picocolors23.default.dim("No matching memories."));
|
|
8338
7849
|
for (const r of results) {
|
|
8339
|
-
line(`${
|
|
7850
|
+
line(`${import_picocolors23.default.dim(r.id ?? "?")} ${memoryText(r)}`);
|
|
8340
7851
|
}
|
|
8341
7852
|
});
|
|
8342
7853
|
})
|
|
@@ -8351,9 +7862,16 @@ function registerMemory(program3) {
|
|
|
8351
7862
|
})
|
|
8352
7863
|
);
|
|
8353
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
|
+
}
|
|
8354
7872
|
|
|
8355
7873
|
// src/commands/note.ts
|
|
8356
|
-
var
|
|
7874
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
8357
7875
|
function registerNote(program3) {
|
|
8358
7876
|
program3.command("note <text>").description("Leave a fact the rest of the team will need").addHelpText(
|
|
8359
7877
|
"after",
|
|
@@ -8390,14 +7908,14 @@ function registerNote(program3) {
|
|
|
8390
7908
|
}
|
|
8391
7909
|
ok(res, () => {
|
|
8392
7910
|
success("Noted for the team.");
|
|
8393
|
-
line(
|
|
7911
|
+
line(import_picocolors24.default.dim(` ${text}`));
|
|
8394
7912
|
});
|
|
8395
7913
|
})
|
|
8396
7914
|
);
|
|
8397
7915
|
}
|
|
8398
7916
|
|
|
8399
7917
|
// src/commands/business.ts
|
|
8400
|
-
var
|
|
7918
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
8401
7919
|
var RESOURCE_PATHS = {
|
|
8402
7920
|
"business-config": "business-config",
|
|
8403
7921
|
"business-settings": "business-settings",
|
|
@@ -8457,7 +7975,7 @@ function registerBusiness(program3) {
|
|
|
8457
7975
|
const projectId = requireProject(ctx);
|
|
8458
7976
|
const [resource] = args;
|
|
8459
7977
|
const res = await api(ctx, businessPath(projectId, resource), { body: JSON.parse(opts.body) });
|
|
8460
|
-
ok(res, () => line(`Created ${resource} ${
|
|
7978
|
+
ok(res, () => line(`Created ${resource} ${import_picocolors25.default.bold(res?.id ?? "")}.`));
|
|
8461
7979
|
})
|
|
8462
7980
|
);
|
|
8463
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(
|
|
@@ -8499,7 +8017,7 @@ function businessPath(projectId, resource, subpath) {
|
|
|
8499
8017
|
}
|
|
8500
8018
|
|
|
8501
8019
|
// src/commands/artifact.ts
|
|
8502
|
-
var
|
|
8020
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
8503
8021
|
import { existsSync as existsSync2, statSync } from "fs";
|
|
8504
8022
|
import { resolve as resolve3, basename as basename3 } from "path";
|
|
8505
8023
|
var KINDS = [
|
|
@@ -8596,7 +8114,7 @@ function registerArtifact(program3) {
|
|
|
8596
8114
|
ok(
|
|
8597
8115
|
res,
|
|
8598
8116
|
() => success(
|
|
8599
|
-
`Recorded ${
|
|
8117
|
+
`Recorded ${import_picocolors26.default.bold(res?.title ?? "artifact")}${res?.kind ? import_picocolors26.default.dim(` (${res.kind})`) : ""}`
|
|
8600
8118
|
)
|
|
8601
8119
|
);
|
|
8602
8120
|
})
|
|
@@ -8628,13 +8146,13 @@ function registerArtifact(program3) {
|
|
|
8628
8146
|
artifact.command("run").description("Show the task/conversation this agent run is attached to").action(
|
|
8629
8147
|
action(async ({ ctx }) => {
|
|
8630
8148
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}`);
|
|
8631
|
-
ok(res, () =>
|
|
8149
|
+
ok(res, () => printRun(res));
|
|
8632
8150
|
})
|
|
8633
8151
|
);
|
|
8634
8152
|
}
|
|
8635
8153
|
function printArtifacts(rows) {
|
|
8636
8154
|
if (!rows.length) {
|
|
8637
|
-
line(
|
|
8155
|
+
line(import_picocolors26.default.dim("Nothing produced yet."));
|
|
8638
8156
|
return;
|
|
8639
8157
|
}
|
|
8640
8158
|
const byStep = /* @__PURE__ */ new Map();
|
|
@@ -8644,26 +8162,26 @@ function printArtifacts(rows) {
|
|
|
8644
8162
|
byStep.set(r.subtask_id, list);
|
|
8645
8163
|
}
|
|
8646
8164
|
for (const [stepId, items] of byStep) {
|
|
8647
|
-
line(
|
|
8165
|
+
line(import_picocolors26.default.bold(`step ${stepId}`));
|
|
8648
8166
|
for (const a of items) {
|
|
8649
|
-
const flag = a.promoted_at ?
|
|
8167
|
+
const flag = a.promoted_at ? import_picocolors26.default.green(" *") : " ";
|
|
8650
8168
|
const where = a.local_path || a.cloud_url || "";
|
|
8651
8169
|
line(
|
|
8652
|
-
`${flag} ${
|
|
8170
|
+
`${flag} ${import_picocolors26.default.dim(`[${a.kind}]`)} ${a.title ?? "(untitled)"}` + (where ? import_picocolors26.default.dim(` ${where}`) : "")
|
|
8653
8171
|
);
|
|
8654
|
-
if (a.description) line(
|
|
8172
|
+
if (a.description) line(import_picocolors26.default.dim(` ${a.description}`));
|
|
8655
8173
|
}
|
|
8656
8174
|
line("");
|
|
8657
8175
|
}
|
|
8658
|
-
line(
|
|
8176
|
+
line(import_picocolors26.default.dim("* = handed over as a deliverable; the rest is working material."));
|
|
8659
8177
|
}
|
|
8660
|
-
function
|
|
8178
|
+
function printRun(run) {
|
|
8661
8179
|
if (!run) return;
|
|
8662
|
-
line(` run ${
|
|
8180
|
+
line(` run ${import_picocolors26.default.bold(run.runId)}`);
|
|
8663
8181
|
if (run.taskId) line(` task ${run.taskId}`);
|
|
8664
8182
|
if (run.conversationId) line(` chat ${run.conversationId}`);
|
|
8665
8183
|
if (run.projectId) line(` project ${run.projectId}`);
|
|
8666
|
-
if (run.cwd) line(` folder ${
|
|
8184
|
+
if (run.cwd) line(` folder ${import_picocolors26.default.dim(run.cwd)}`);
|
|
8667
8185
|
}
|
|
8668
8186
|
|
|
8669
8187
|
// src/commands/image.ts
|
|
@@ -8844,7 +8362,7 @@ function registerAudio(program3) {
|
|
|
8844
8362
|
}
|
|
8845
8363
|
|
|
8846
8364
|
// src/commands/ask.ts
|
|
8847
|
-
var
|
|
8365
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
8848
8366
|
var TYPES = [
|
|
8849
8367
|
"input",
|
|
8850
8368
|
"choice",
|
|
@@ -8922,7 +8440,7 @@ function registerAsk(program3) {
|
|
|
8922
8440
|
code: "bad_request"
|
|
8923
8441
|
});
|
|
8924
8442
|
}
|
|
8925
|
-
info(
|
|
8443
|
+
info(import_picocolors27.default.dim("Waiting for the user to answer\u2026"));
|
|
8926
8444
|
const res = await api(ctx, `/v1/runs/${runTarget(ctx)}/ask`, {
|
|
8927
8445
|
body: {
|
|
8928
8446
|
type,
|
|
@@ -8950,12 +8468,12 @@ function deriveTitle(message) {
|
|
|
8950
8468
|
function printAnswer(res) {
|
|
8951
8469
|
if (!res) return;
|
|
8952
8470
|
if (res.status === "answered") {
|
|
8953
|
-
line(` ${
|
|
8471
|
+
line(` ${import_picocolors27.default.green("answered")}`);
|
|
8954
8472
|
const value = extract(res.response);
|
|
8955
8473
|
if (value) line(` ${value}`);
|
|
8956
8474
|
return;
|
|
8957
8475
|
}
|
|
8958
|
-
line(` ${
|
|
8476
|
+
line(` ${import_picocolors27.default.yellow(res.status)} ${import_picocolors27.default.dim(res.reason ?? "")}`);
|
|
8959
8477
|
}
|
|
8960
8478
|
function extract(response) {
|
|
8961
8479
|
if (response == null) return "";
|
|
@@ -8974,7 +8492,7 @@ function extract(response) {
|
|
|
8974
8492
|
}
|
|
8975
8493
|
|
|
8976
8494
|
// src/commands/search.ts
|
|
8977
|
-
var
|
|
8495
|
+
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
8978
8496
|
function registerSearch(program3) {
|
|
8979
8497
|
program3.command("search <query>").description("Search the web (Google-grounded, server-side)").option("-n, --max-results <n>", "max results", "5").action(
|
|
8980
8498
|
action(async ({ ctx, args, opts }) => {
|
|
@@ -8987,9 +8505,9 @@ function registerSearch(program3) {
|
|
|
8987
8505
|
line("");
|
|
8988
8506
|
}
|
|
8989
8507
|
const results = res?.results ?? [];
|
|
8990
|
-
if (!results.length) return line(
|
|
8508
|
+
if (!results.length) return line(import_picocolors28.default.dim("No results."));
|
|
8991
8509
|
for (const r of results) {
|
|
8992
|
-
line(`${r.title ||
|
|
8510
|
+
line(`${r.title || import_picocolors28.default.dim("(untitled)")} ${import_picocolors28.default.dim(r.url)}`);
|
|
8993
8511
|
}
|
|
8994
8512
|
});
|
|
8995
8513
|
})
|
|
@@ -8997,7 +8515,7 @@ function registerSearch(program3) {
|
|
|
8997
8515
|
}
|
|
8998
8516
|
|
|
8999
8517
|
// src/commands/board.ts
|
|
9000
|
-
var
|
|
8518
|
+
var import_picocolors29 = __toESM(require_picocolors(), 1);
|
|
9001
8519
|
|
|
9002
8520
|
// src/commands/record-step.ts
|
|
9003
8521
|
async function recordEntityStep(ctx, opts) {
|
|
@@ -9036,7 +8554,7 @@ function registerBoard(program3) {
|
|
|
9036
8554
|
}
|
|
9037
8555
|
ok(rows, () => {
|
|
9038
8556
|
if (!rows.length) {
|
|
9039
|
-
line(
|
|
8557
|
+
line(import_picocolors29.default.dim("No cards on the Board yet."));
|
|
9040
8558
|
return;
|
|
9041
8559
|
}
|
|
9042
8560
|
for (const r of rows) line(formatRow(r));
|
|
@@ -9051,7 +8569,7 @@ function registerBoard(program3) {
|
|
|
9051
8569
|
`/v1/projects/${projectId}/work-items/${args[0]}`
|
|
9052
8570
|
);
|
|
9053
8571
|
ok(row, () => {
|
|
9054
|
-
line(`${
|
|
8572
|
+
line(`${import_picocolors29.default.bold(row.title)} ${import_picocolors29.default.dim(row.id)}`);
|
|
9055
8573
|
line(`${statusTag(row.status)} priority ${row.priority}`);
|
|
9056
8574
|
if (row.ownerHuman) line(`owner: ${row.ownerHuman}`);
|
|
9057
8575
|
if (row.labels?.length) line(`labels: ${row.labels.join(", ")}`);
|
|
@@ -9092,7 +8610,7 @@ ${row.description}`);
|
|
|
9092
8610
|
refId: row?.id,
|
|
9093
8611
|
output: { workItem: row }
|
|
9094
8612
|
});
|
|
9095
|
-
ok(row, () => line(`Created work item ${
|
|
8613
|
+
ok(row, () => line(`Created work item ${import_picocolors29.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
9096
8614
|
})
|
|
9097
8615
|
);
|
|
9098
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(
|
|
@@ -9126,7 +8644,7 @@ ${row.description}`);
|
|
|
9126
8644
|
);
|
|
9127
8645
|
}
|
|
9128
8646
|
const row = await patchItem(ctx, projectId, String(args[0]), body);
|
|
9129
|
-
ok(row, () => line(`Updated ${
|
|
8647
|
+
ok(row, () => line(`Updated ${import_picocolors29.default.bold(row.id)} \u2014 ${row.title} ${statusTag(row.status)}`));
|
|
9130
8648
|
})
|
|
9131
8649
|
);
|
|
9132
8650
|
board.command("move <id> <status>").description(
|
|
@@ -9137,14 +8655,14 @@ ${row.description}`);
|
|
|
9137
8655
|
const status = String(args[1]);
|
|
9138
8656
|
assertStatus(status);
|
|
9139
8657
|
const row = await patchItem(ctx, projectId, String(args[0]), { status });
|
|
9140
|
-
ok(row, () => line(`Moved ${
|
|
8658
|
+
ok(row, () => line(`Moved ${import_picocolors29.default.bold(row.title)} \u2192 ${statusTag(row.status)}`));
|
|
9141
8659
|
})
|
|
9142
8660
|
);
|
|
9143
8661
|
board.command("close <id>").description("Shorthand for `board move <id> done`").action(
|
|
9144
8662
|
action(async ({ ctx, args }) => {
|
|
9145
8663
|
const projectId = requireProject(ctx);
|
|
9146
8664
|
const row = await patchItem(ctx, projectId, String(args[0]), { status: "done" });
|
|
9147
|
-
ok(row, () => line(`Closed ${
|
|
8665
|
+
ok(row, () => line(`Closed ${import_picocolors29.default.bold(row.title)} ${statusTag(row.status)}`));
|
|
9148
8666
|
})
|
|
9149
8667
|
);
|
|
9150
8668
|
}
|
|
@@ -9177,23 +8695,23 @@ function assertPriority(value) {
|
|
|
9177
8695
|
}
|
|
9178
8696
|
}
|
|
9179
8697
|
function formatRow(r) {
|
|
9180
|
-
const labels = r.labels?.length ?
|
|
9181
|
-
const owner = r.ownerHuman ?
|
|
9182
|
-
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}`;
|
|
9183
8701
|
}
|
|
9184
8702
|
function statusTag(status) {
|
|
9185
8703
|
const label = status.padEnd(11);
|
|
9186
|
-
if (status === "done") return
|
|
9187
|
-
if (status === "in-progress") return
|
|
9188
|
-
if (status === "in-review") return
|
|
9189
|
-
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);
|
|
9190
8708
|
}
|
|
9191
8709
|
function collect2(value, previous) {
|
|
9192
8710
|
return [...previous, value];
|
|
9193
8711
|
}
|
|
9194
8712
|
|
|
9195
8713
|
// src/commands/task.ts
|
|
9196
|
-
var
|
|
8714
|
+
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
9197
8715
|
|
|
9198
8716
|
// src/subtask-attachments.ts
|
|
9199
8717
|
var MAX_REF_NOTE = 500;
|
|
@@ -9307,7 +8825,7 @@ function registerTask(program3) {
|
|
|
9307
8825
|
}) ?? [];
|
|
9308
8826
|
ok(rows, () => {
|
|
9309
8827
|
if (!rows.length) {
|
|
9310
|
-
line(
|
|
8828
|
+
line(import_picocolors30.default.dim("No tasks on the board yet."));
|
|
9311
8829
|
return;
|
|
9312
8830
|
}
|
|
9313
8831
|
for (const r of rows) line(formatRow2(r));
|
|
@@ -9416,10 +8934,10 @@ function registerTask(program3) {
|
|
|
9416
8934
|
};
|
|
9417
8935
|
ok(result, () => {
|
|
9418
8936
|
line(
|
|
9419
|
-
`${
|
|
8937
|
+
`${import_picocolors30.default.green("opened")} ${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`
|
|
9420
8938
|
);
|
|
9421
8939
|
if (channelMessage)
|
|
9422
|
-
line(
|
|
8940
|
+
line(import_picocolors30.default.dim("posted to the channel as Project Manager"));
|
|
9423
8941
|
if (channelMessageError) {
|
|
9424
8942
|
warn(
|
|
9425
8943
|
`Task opened, but its Project Manager card could not be posted: ${channelMessageError.message}`
|
|
@@ -9498,12 +9016,12 @@ function registerTask(program3) {
|
|
|
9498
9016
|
) : null;
|
|
9499
9017
|
ok(runner ?? row, () => {
|
|
9500
9018
|
line(
|
|
9501
|
-
`${
|
|
9019
|
+
`${import_picocolors30.default.green("added")} ${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`
|
|
9502
9020
|
);
|
|
9503
|
-
if (row.role) line(
|
|
9021
|
+
if (row.role) line(import_picocolors30.default.dim(`role: ${row.role}`));
|
|
9504
9022
|
if (runner) {
|
|
9505
9023
|
line(
|
|
9506
|
-
|
|
9024
|
+
import_picocolors30.default.dim(
|
|
9507
9025
|
`runs on: ${[opts.agent, opts.model, opts.effort].filter(Boolean).join(" \xB7 ")}`
|
|
9508
9026
|
)
|
|
9509
9027
|
);
|
|
@@ -9521,7 +9039,7 @@ function registerTask(program3) {
|
|
|
9521
9039
|
const rows = row.subtasks ?? [];
|
|
9522
9040
|
ok(rows, () => {
|
|
9523
9041
|
if (!rows.length) {
|
|
9524
|
-
line(
|
|
9042
|
+
line(import_picocolors30.default.dim("No subtasks yet."));
|
|
9525
9043
|
return;
|
|
9526
9044
|
}
|
|
9527
9045
|
rows.forEach((r, i) => line(formatSubtask(r, i + 1)));
|
|
@@ -9569,7 +9087,7 @@ function registerTask(program3) {
|
|
|
9569
9087
|
}
|
|
9570
9088
|
}
|
|
9571
9089
|
);
|
|
9572
|
-
ok(row, () => line(`${
|
|
9090
|
+
ok(row, () => line(`${import_picocolors30.default.green("updated")} ${import_picocolors30.default.bold(row.title)}`));
|
|
9573
9091
|
})
|
|
9574
9092
|
);
|
|
9575
9093
|
subtask.command("remove <id>").description("Remove a subtask (only before the work starts)").action(
|
|
@@ -9577,7 +9095,7 @@ function registerTask(program3) {
|
|
|
9577
9095
|
await api(ctx, `/v1/project-tasks/${encodeURIComponent(args[0])}`, {
|
|
9578
9096
|
method: "DELETE"
|
|
9579
9097
|
});
|
|
9580
|
-
ok({ removed: args[0] }, () => line(
|
|
9098
|
+
ok({ removed: args[0] }, () => line(import_picocolors30.default.green("removed")));
|
|
9581
9099
|
})
|
|
9582
9100
|
);
|
|
9583
9101
|
task.command("move <id> <status>").description(
|
|
@@ -9592,7 +9110,7 @@ function registerTask(program3) {
|
|
|
9592
9110
|
);
|
|
9593
9111
|
ok(
|
|
9594
9112
|
row,
|
|
9595
|
-
() => line(`${
|
|
9113
|
+
() => line(`${import_picocolors30.default.green("moved")} ${import_picocolors30.default.bold(row.title)} \u2192 ${args[1]}`)
|
|
9596
9114
|
);
|
|
9597
9115
|
})
|
|
9598
9116
|
);
|
|
@@ -9608,18 +9126,18 @@ function registerTask(program3) {
|
|
|
9608
9126
|
);
|
|
9609
9127
|
ok(row, () => {
|
|
9610
9128
|
if (!row?.queued) {
|
|
9611
|
-
line(
|
|
9129
|
+
line(import_picocolors30.default.yellow("could not resume it \u2014 check the step id"));
|
|
9612
9130
|
return;
|
|
9613
9131
|
}
|
|
9614
9132
|
const started = row.started ?? 0;
|
|
9615
9133
|
if (started > 0) {
|
|
9616
9134
|
line(
|
|
9617
|
-
`${
|
|
9135
|
+
`${import_picocolors30.default.green("resumed")} \u2014 ${started} step${started === 1 ? "" : "s"} started`
|
|
9618
9136
|
);
|
|
9619
9137
|
return;
|
|
9620
9138
|
}
|
|
9621
9139
|
line(
|
|
9622
|
-
`${
|
|
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.`
|
|
9623
9141
|
);
|
|
9624
9142
|
});
|
|
9625
9143
|
})
|
|
@@ -9633,11 +9151,11 @@ function registerTask(program3) {
|
|
|
9633
9151
|
);
|
|
9634
9152
|
ok(row, () => {
|
|
9635
9153
|
if (row?.reopened) {
|
|
9636
|
-
line(`${
|
|
9154
|
+
line(`${import_picocolors30.default.green("sent back")} \u2014 it will be picked up again`);
|
|
9637
9155
|
return;
|
|
9638
9156
|
}
|
|
9639
9157
|
line(
|
|
9640
|
-
|
|
9158
|
+
import_picocolors30.default.yellow(
|
|
9641
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"
|
|
9642
9160
|
)
|
|
9643
9161
|
);
|
|
@@ -9654,7 +9172,7 @@ function registerTask(program3) {
|
|
|
9654
9172
|
`/v1/project-tasks/${encodeURIComponent(id)}/dispatch-check`,
|
|
9655
9173
|
{ method: "POST" }
|
|
9656
9174
|
);
|
|
9657
|
-
ok(row, () => line(
|
|
9175
|
+
ok(row, () => line(import_picocolors30.default.green("approved \u2014 you may start")));
|
|
9658
9176
|
})
|
|
9659
9177
|
);
|
|
9660
9178
|
task.command("start [id]").description(
|
|
@@ -9669,13 +9187,13 @@ function registerTask(program3) {
|
|
|
9669
9187
|
const started = row?.started ?? null;
|
|
9670
9188
|
if (started && started > 0) {
|
|
9671
9189
|
line(
|
|
9672
|
-
|
|
9190
|
+
import_picocolors30.default.green(
|
|
9673
9191
|
`started ${started} step${started === 1 ? "" : "s"} \u2014 they are running now`
|
|
9674
9192
|
)
|
|
9675
9193
|
);
|
|
9676
9194
|
return;
|
|
9677
9195
|
}
|
|
9678
|
-
line(
|
|
9196
|
+
line(import_picocolors30.default.yellow(row?.note ?? "Nothing started."));
|
|
9679
9197
|
});
|
|
9680
9198
|
})
|
|
9681
9199
|
);
|
|
@@ -9690,7 +9208,7 @@ function registerTask(program3) {
|
|
|
9690
9208
|
);
|
|
9691
9209
|
ok({ awaiting: row2.approval_state === "awaiting", task: row2 }, () => {
|
|
9692
9210
|
line(
|
|
9693
|
-
row2.approval_state === "awaiting" ?
|
|
9211
|
+
row2.approval_state === "awaiting" ? import_picocolors30.default.yellow(
|
|
9694
9212
|
"The plan is waiting on the owner. They see it in the task."
|
|
9695
9213
|
) : `Already ${row2.approval_state}.`
|
|
9696
9214
|
);
|
|
@@ -9715,7 +9233,7 @@ function registerTask(program3) {
|
|
|
9715
9233
|
);
|
|
9716
9234
|
ok(
|
|
9717
9235
|
row,
|
|
9718
|
-
() => line(`${
|
|
9236
|
+
() => line(`${import_picocolors30.default.green(row.approval_state)} ${import_picocolors30.default.bold(row.title)}`)
|
|
9719
9237
|
);
|
|
9720
9238
|
})
|
|
9721
9239
|
);
|
|
@@ -9731,7 +9249,7 @@ function registerTask(program3) {
|
|
|
9731
9249
|
`/v1/project-tasks/${encodeURIComponent(id)}/move`,
|
|
9732
9250
|
{ body: { status: "ready" } }
|
|
9733
9251
|
);
|
|
9734
|
-
ok(row, () => line(`${
|
|
9252
|
+
ok(row, () => line(`${import_picocolors30.default.green("ready")} ${import_picocolors30.default.bold(row.title)}`));
|
|
9735
9253
|
})
|
|
9736
9254
|
);
|
|
9737
9255
|
}
|
|
@@ -9776,24 +9294,24 @@ function assertOneOf(flag, value, allowed) {
|
|
|
9776
9294
|
}
|
|
9777
9295
|
}
|
|
9778
9296
|
function formatRow2(r) {
|
|
9779
|
-
const key =
|
|
9780
|
-
const steps = r.subtaskTotal ?
|
|
9781
|
-
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") : "";
|
|
9782
9300
|
return `${key} ${statusTag2(r.status)} ${r.title}${steps}${gate}`;
|
|
9783
9301
|
}
|
|
9784
9302
|
function formatSubtask(r, index) {
|
|
9785
|
-
const n =
|
|
9786
|
-
const role = r.role ?
|
|
9787
|
-
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(", ")}`) : "";
|
|
9788
9306
|
const head = `${n} ${statusTag2(r.status)} ${r.title}${role}${scope}`;
|
|
9789
9307
|
const summary = (r.result_summary ?? "").trim();
|
|
9790
9308
|
if (!summary) return head;
|
|
9791
9309
|
const wrapped = summary.split("\n").map((l) => ` ${l}`).join("\n");
|
|
9792
9310
|
return `${head}
|
|
9793
|
-
${
|
|
9311
|
+
${import_picocolors30.default.dim(wrapped)}`;
|
|
9794
9312
|
}
|
|
9795
9313
|
function printTask(row, goal) {
|
|
9796
|
-
line(`${
|
|
9314
|
+
line(`${import_picocolors30.default.bold(row.title)} ${import_picocolors30.default.dim(row.key ?? row.id)}`);
|
|
9797
9315
|
line(`${statusTag2(row.status)} approval: ${row.approval_state}`);
|
|
9798
9316
|
if (row.summary) line(`
|
|
9799
9317
|
${row.summary}`);
|
|
@@ -9806,53 +9324,53 @@ touches: ${row.targets.map((t) => t.appName ?? t.ref ?? t.kind).join(", ")}`
|
|
|
9806
9324
|
}
|
|
9807
9325
|
if (row.subtasks?.length) {
|
|
9808
9326
|
line(`
|
|
9809
|
-
${
|
|
9327
|
+
${import_picocolors30.default.bold("subtasks")}`);
|
|
9810
9328
|
row.subtasks.forEach((s, i) => line(formatSubtask(s, i + 1)));
|
|
9811
9329
|
line(
|
|
9812
|
-
|
|
9330
|
+
import_picocolors30.default.dim(
|
|
9813
9331
|
`
|
|
9814
9332
|
Run \`workser artifact list\` to see what these subtasks produced,`
|
|
9815
9333
|
)
|
|
9816
9334
|
);
|
|
9817
9335
|
line(
|
|
9818
|
-
|
|
9336
|
+
import_picocolors30.default.dim(
|
|
9819
9337
|
`or \`workser artifact list --step <id>\` for one subtask's output alone.`
|
|
9820
9338
|
)
|
|
9821
9339
|
);
|
|
9822
9340
|
} else {
|
|
9823
|
-
line(
|
|
9341
|
+
line(import_picocolors30.default.dim("\nNo subtasks yet."));
|
|
9824
9342
|
}
|
|
9825
9343
|
}
|
|
9826
9344
|
function printGoalContext(row, goal) {
|
|
9827
9345
|
const mine = row.phase ?? null;
|
|
9828
9346
|
line(`
|
|
9829
|
-
${
|
|
9830
|
-
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}`));
|
|
9831
9349
|
const progress = goal.progress ?? [];
|
|
9832
9350
|
for (const p of progress) {
|
|
9833
9351
|
const where = p.total === 0 ? "not started" : `${p.done} of ${p.total} done`;
|
|
9834
|
-
const here = mine && p.name === mine ?
|
|
9835
|
-
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("-");
|
|
9836
9354
|
line(` ${mark} ${p.name} \u2014 ${where}${here}`);
|
|
9837
9355
|
}
|
|
9838
9356
|
const next = progress.find((p) => p.state !== "done");
|
|
9839
9357
|
const running = progress.some((p) => p.state === "working");
|
|
9840
9358
|
if (next && !running) {
|
|
9841
9359
|
line(
|
|
9842
|
-
|
|
9360
|
+
import_picocolors30.default.dim(
|
|
9843
9361
|
`
|
|
9844
9362
|
Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to them in a sentence rather than starting it unasked.`
|
|
9845
9363
|
)
|
|
9846
9364
|
);
|
|
9847
9365
|
} else if (!next) {
|
|
9848
9366
|
line(
|
|
9849
|
-
|
|
9367
|
+
import_picocolors30.default.dim(
|
|
9850
9368
|
"\nEvery part of this plan is done. Say so, and offer to wrap it up."
|
|
9851
9369
|
)
|
|
9852
9370
|
);
|
|
9853
9371
|
}
|
|
9854
9372
|
line(
|
|
9855
|
-
|
|
9373
|
+
import_picocolors30.default.dim(
|
|
9856
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."
|
|
9857
9375
|
)
|
|
9858
9376
|
);
|
|
@@ -9860,22 +9378,22 @@ Nothing is running. The next part waiting is "${next.name}" \u2014 offer it to t
|
|
|
9860
9378
|
function statusTag2(status) {
|
|
9861
9379
|
switch (status) {
|
|
9862
9380
|
case "ready":
|
|
9863
|
-
return
|
|
9381
|
+
return import_picocolors30.default.green("[ready]");
|
|
9864
9382
|
case "working":
|
|
9865
|
-
return
|
|
9383
|
+
return import_picocolors30.default.blue("[working]");
|
|
9866
9384
|
case "checking":
|
|
9867
|
-
return
|
|
9385
|
+
return import_picocolors30.default.cyan("[checking]");
|
|
9868
9386
|
case "accepted":
|
|
9869
|
-
return
|
|
9387
|
+
return import_picocolors30.default.green("[accepted]");
|
|
9870
9388
|
case "archived":
|
|
9871
|
-
return
|
|
9389
|
+
return import_picocolors30.default.dim("[archived]");
|
|
9872
9390
|
default:
|
|
9873
|
-
return
|
|
9391
|
+
return import_picocolors30.default.dim("[todo]");
|
|
9874
9392
|
}
|
|
9875
9393
|
}
|
|
9876
9394
|
|
|
9877
9395
|
// src/commands/goal.ts
|
|
9878
|
-
var
|
|
9396
|
+
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
9879
9397
|
var STATUSES3 = ["proposed", "agreed", "working", "delivered", "abandoned"];
|
|
9880
9398
|
function registerGoal(program3) {
|
|
9881
9399
|
const goal = program3.command("goal").description("Business goals and the phases that deliver them");
|
|
@@ -9887,7 +9405,7 @@ function registerGoal(program3) {
|
|
|
9887
9405
|
}) ?? [];
|
|
9888
9406
|
ok(rows, () => {
|
|
9889
9407
|
if (!rows.length) {
|
|
9890
|
-
line(
|
|
9408
|
+
line(import_picocolors31.default.dim("No goals yet \u2014 every task here stands on its own."));
|
|
9891
9409
|
return;
|
|
9892
9410
|
}
|
|
9893
9411
|
for (const g of rows) line(formatGoal(g));
|
|
@@ -9964,10 +9482,10 @@ function registerGoal(program3) {
|
|
|
9964
9482
|
}
|
|
9965
9483
|
});
|
|
9966
9484
|
ok(row, () => {
|
|
9967
|
-
success(`Proposed ${
|
|
9485
|
+
success(`Proposed ${import_picocolors31.default.bold(row?.title ?? "goal")}`);
|
|
9968
9486
|
printGoal(row);
|
|
9969
9487
|
line(
|
|
9970
|
-
|
|
9488
|
+
import_picocolors31.default.dim(
|
|
9971
9489
|
"\nNothing has been created yet. The owner agrees the shape first."
|
|
9972
9490
|
)
|
|
9973
9491
|
);
|
|
@@ -9996,7 +9514,7 @@ function registerGoal(program3) {
|
|
|
9996
9514
|
ok(
|
|
9997
9515
|
row,
|
|
9998
9516
|
() => line(
|
|
9999
|
-
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(
|
|
10000
9518
|
"couldn't record it \u2014 check the goal id, the phase name and the criterion id"
|
|
10001
9519
|
)
|
|
10002
9520
|
)
|
|
@@ -10039,7 +9557,7 @@ function registerGoal(program3) {
|
|
|
10039
9557
|
}
|
|
10040
9558
|
ok({ goalId, phase, filed }, () => {
|
|
10041
9559
|
success(
|
|
10042
|
-
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${
|
|
9560
|
+
`Filed ${filed.length} ${filed.length === 1 ? "task" : "tasks"} under ${import_picocolors31.default.bold(phase)}`
|
|
10043
9561
|
);
|
|
10044
9562
|
});
|
|
10045
9563
|
})
|
|
@@ -10071,42 +9589,42 @@ function registerGoal(program3) {
|
|
|
10071
9589
|
function appScope(g) {
|
|
10072
9590
|
const n = g.appIds?.length ?? 0;
|
|
10073
9591
|
if (!n) return "";
|
|
10074
|
-
return
|
|
9592
|
+
return import_picocolors31.default.dim(` ${n} part${n === 1 ? "" : "s"} of the system`);
|
|
10075
9593
|
}
|
|
10076
9594
|
function formatGoal(g) {
|
|
10077
|
-
const where = g.currentPhase && g.status !== "delivered" ?
|
|
10078
|
-
const count = g.taskTotal != null ?
|
|
10079
|
-
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)}`;
|
|
10080
9598
|
}
|
|
10081
9599
|
function printGoal(g) {
|
|
10082
9600
|
if (!g) return;
|
|
10083
|
-
line(`${
|
|
9601
|
+
line(`${import_picocolors31.default.bold(g.title)} ${import_picocolors31.default.dim(g.id)}`);
|
|
10084
9602
|
line(statusTag3(g.status));
|
|
10085
9603
|
if (g.outcome) line(`
|
|
10086
9604
|
done means: ${g.outcome}`);
|
|
10087
9605
|
const progress = g.progress ?? [];
|
|
10088
9606
|
if (!progress.length) {
|
|
10089
|
-
line(
|
|
9607
|
+
line(import_picocolors31.default.dim("\nNo phases agreed yet."));
|
|
10090
9608
|
return;
|
|
10091
9609
|
}
|
|
10092
9610
|
line(`
|
|
10093
|
-
${
|
|
9611
|
+
${import_picocolors31.default.bold("phases")}`);
|
|
10094
9612
|
for (const p of progress) {
|
|
10095
|
-
const bar2 = p.total > 0 ? `${p.done}/${p.total} done` :
|
|
10096
|
-
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");
|
|
10097
9615
|
line(
|
|
10098
|
-
` ${
|
|
9616
|
+
` ${import_picocolors31.default.dim(String(p.index).padStart(2, "0"))} ${p.name} ${mark} ${import_picocolors31.default.dim(bar2)}`
|
|
10099
9617
|
);
|
|
10100
9618
|
for (const c of p.criteria ?? []) {
|
|
10101
|
-
const tick = c.met === true ?
|
|
10102
|
-
line(` ${tick} ${c.text} ${
|
|
10103
|
-
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}`));
|
|
10104
9622
|
}
|
|
10105
9623
|
}
|
|
10106
9624
|
const current = progress.find((p) => p.name === g.currentPhase);
|
|
10107
9625
|
if (current) {
|
|
10108
9626
|
line(
|
|
10109
|
-
|
|
9627
|
+
import_picocolors31.default.dim(
|
|
10110
9628
|
`
|
|
10111
9629
|
${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current.index} of ${progress.length}).`
|
|
10112
9630
|
)
|
|
@@ -10116,15 +9634,15 @@ ${current.name} \u2014 ${current.done} of ${current.total} done (phase ${current
|
|
|
10116
9634
|
function statusTag3(status) {
|
|
10117
9635
|
switch (status) {
|
|
10118
9636
|
case "agreed":
|
|
10119
|
-
return
|
|
9637
|
+
return import_picocolors31.default.cyan("[agreed]");
|
|
10120
9638
|
case "working":
|
|
10121
|
-
return
|
|
9639
|
+
return import_picocolors31.default.blue("[working]");
|
|
10122
9640
|
case "delivered":
|
|
10123
|
-
return
|
|
9641
|
+
return import_picocolors31.default.green("[delivered]");
|
|
10124
9642
|
case "abandoned":
|
|
10125
|
-
return
|
|
9643
|
+
return import_picocolors31.default.dim("[abandoned]");
|
|
10126
9644
|
default:
|
|
10127
|
-
return
|
|
9645
|
+
return import_picocolors31.default.yellow("[proposed]");
|
|
10128
9646
|
}
|
|
10129
9647
|
}
|
|
10130
9648
|
|
|
@@ -10308,7 +9826,7 @@ function stripLeadingGlobalOptions(argv) {
|
|
|
10308
9826
|
}
|
|
10309
9827
|
|
|
10310
9828
|
// src/commands/decision.ts
|
|
10311
|
-
var
|
|
9829
|
+
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
10312
9830
|
function registerDecision(program3) {
|
|
10313
9831
|
const decision = program3.command("decision").description("Read and record the project's architecture decisions");
|
|
10314
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(
|
|
@@ -10321,11 +9839,11 @@ function registerDecision(program3) {
|
|
|
10321
9839
|
rows = applyLimit(rows, opts.limit);
|
|
10322
9840
|
ok(rows, () => {
|
|
10323
9841
|
if (!rows.length) {
|
|
10324
|
-
line(
|
|
9842
|
+
line(import_picocolors32.default.dim("No decisions recorded yet."));
|
|
10325
9843
|
return;
|
|
10326
9844
|
}
|
|
10327
9845
|
for (const r of rows) {
|
|
10328
|
-
line(`${
|
|
9846
|
+
line(`${import_picocolors32.default.dim(r.id)} ${import_picocolors32.default.dim(shortDate(r.createdAt))} ${r.title}`);
|
|
10329
9847
|
line(` ${truncate(r.decision, 100)}`);
|
|
10330
9848
|
}
|
|
10331
9849
|
});
|
|
@@ -10339,16 +9857,16 @@ function registerDecision(program3) {
|
|
|
10339
9857
|
`/v1/projects/${projectId}/architecture-decisions/${args[0]}`
|
|
10340
9858
|
);
|
|
10341
9859
|
ok(row, () => {
|
|
10342
|
-
line(`${
|
|
10343
|
-
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)}`));
|
|
10344
9862
|
line(`
|
|
10345
|
-
${
|
|
9863
|
+
${import_picocolors32.default.bold("Context")}
|
|
10346
9864
|
${row.context}`);
|
|
10347
9865
|
line(`
|
|
10348
|
-
${
|
|
9866
|
+
${import_picocolors32.default.bold("Decision")}
|
|
10349
9867
|
${row.decision}`);
|
|
10350
9868
|
if (row.consequences) line(`
|
|
10351
|
-
${
|
|
9869
|
+
${import_picocolors32.default.bold("Consequences")}
|
|
10352
9870
|
${row.consequences}`);
|
|
10353
9871
|
});
|
|
10354
9872
|
})
|
|
@@ -10377,7 +9895,7 @@ ${row.consequences}`);
|
|
|
10377
9895
|
refId: row?.id,
|
|
10378
9896
|
output: { decision: row }
|
|
10379
9897
|
});
|
|
10380
|
-
ok(row, () => line(`Recorded decision ${
|
|
9898
|
+
ok(row, () => line(`Recorded decision ${import_picocolors32.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10381
9899
|
})
|
|
10382
9900
|
);
|
|
10383
9901
|
const requirement = program3.command("requirement").description("Read and record the project's requirements");
|
|
@@ -10389,11 +9907,11 @@ ${row.consequences}`);
|
|
|
10389
9907
|
rows = applyLimit(rows, opts.limit);
|
|
10390
9908
|
ok(rows, () => {
|
|
10391
9909
|
if (!rows.length) {
|
|
10392
|
-
line(
|
|
9910
|
+
line(import_picocolors32.default.dim("No requirements recorded yet."));
|
|
10393
9911
|
return;
|
|
10394
9912
|
}
|
|
10395
9913
|
for (const r of rows) {
|
|
10396
|
-
line(`${
|
|
9914
|
+
line(`${import_picocolors32.default.dim(r.id)} ${r.status.padEnd(9)} ${r.title}`);
|
|
10397
9915
|
}
|
|
10398
9916
|
});
|
|
10399
9917
|
})
|
|
@@ -10406,8 +9924,8 @@ ${row.consequences}`);
|
|
|
10406
9924
|
`/v1/projects/${projectId}/requirements/${args[0]}`
|
|
10407
9925
|
);
|
|
10408
9926
|
ok(row, () => {
|
|
10409
|
-
line(`${
|
|
10410
|
-
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)}`));
|
|
10411
9929
|
line(`
|
|
10412
9930
|
${row.body}`);
|
|
10413
9931
|
});
|
|
@@ -10433,7 +9951,7 @@ ${row.body}`);
|
|
|
10433
9951
|
refId: row?.id,
|
|
10434
9952
|
output: { requirement: row }
|
|
10435
9953
|
});
|
|
10436
|
-
ok(row, () => line(`Recorded requirement ${
|
|
9954
|
+
ok(row, () => line(`Recorded requirement ${import_picocolors32.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10437
9955
|
})
|
|
10438
9956
|
);
|
|
10439
9957
|
requirement.command("update <id>").description(
|
|
@@ -10462,7 +9980,7 @@ ${row.body}`);
|
|
|
10462
9980
|
code: "bad_request"
|
|
10463
9981
|
});
|
|
10464
9982
|
}
|
|
10465
|
-
ok(row, () => line(`Updated requirement ${
|
|
9983
|
+
ok(row, () => line(`Updated requirement ${import_picocolors32.default.bold(row.id)} \u2014 ${row.title} (${row.status})`));
|
|
10466
9984
|
})
|
|
10467
9985
|
);
|
|
10468
9986
|
}
|
|
@@ -10485,7 +10003,7 @@ function shortDate(iso) {
|
|
|
10485
10003
|
}
|
|
10486
10004
|
|
|
10487
10005
|
// src/commands/doc.ts
|
|
10488
|
-
var
|
|
10006
|
+
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
10489
10007
|
|
|
10490
10008
|
// src/mermaid-fences.ts
|
|
10491
10009
|
function hasDiagram(code) {
|
|
@@ -10530,13 +10048,13 @@ function registerDoc(program3) {
|
|
|
10530
10048
|
}) ?? [];
|
|
10531
10049
|
ok(rows, () => {
|
|
10532
10050
|
if (!rows.length) {
|
|
10533
|
-
line(
|
|
10051
|
+
line(import_picocolors33.default.dim("No documents yet."));
|
|
10534
10052
|
return;
|
|
10535
10053
|
}
|
|
10536
10054
|
for (const r of rows) {
|
|
10537
|
-
const link = r.workItemId ?
|
|
10538
|
-
const file = r.filePath ?
|
|
10539
|
-
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}`);
|
|
10540
10058
|
}
|
|
10541
10059
|
});
|
|
10542
10060
|
})
|
|
@@ -10550,17 +10068,17 @@ function registerDoc(program3) {
|
|
|
10550
10068
|
);
|
|
10551
10069
|
if (opts.markdown) {
|
|
10552
10070
|
ok({ id: row.id, title: row.title, filePath: row.filePath }, () => {
|
|
10553
|
-
line(`${
|
|
10071
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10554
10072
|
line(
|
|
10555
|
-
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.")
|
|
10556
10074
|
);
|
|
10557
10075
|
});
|
|
10558
10076
|
return;
|
|
10559
10077
|
}
|
|
10560
10078
|
ok(row, () => {
|
|
10561
|
-
line(`${
|
|
10562
|
-
if (row.workItemId) line(
|
|
10563
|
-
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}`));
|
|
10564
10082
|
line("");
|
|
10565
10083
|
line(row.contentJson);
|
|
10566
10084
|
});
|
|
@@ -10589,7 +10107,7 @@ function registerDoc(program3) {
|
|
|
10589
10107
|
refId: row?.id,
|
|
10590
10108
|
output: { document: row }
|
|
10591
10109
|
});
|
|
10592
|
-
ok(row, () => line(`Created document ${
|
|
10110
|
+
ok(row, () => line(`Created document ${import_picocolors33.default.bold(row?.id ?? "")} \u2014 ${title}`));
|
|
10593
10111
|
})
|
|
10594
10112
|
);
|
|
10595
10113
|
doc.command("diagram <id>").description(
|
|
@@ -10615,19 +10133,19 @@ function registerDoc(program3) {
|
|
|
10615
10133
|
diagrams: diagrams.map((code) => ({ kind: diagramKind(code), code }))
|
|
10616
10134
|
};
|
|
10617
10135
|
ok(payload, () => {
|
|
10618
|
-
line(`${
|
|
10136
|
+
line(`${import_picocolors33.default.bold(row.title)} ${import_picocolors33.default.dim(row.id)}`);
|
|
10619
10137
|
if (markdown === null) {
|
|
10620
10138
|
line(
|
|
10621
|
-
|
|
10139
|
+
import_picocolors33.default.dim(
|
|
10622
10140
|
row.filePath ? `Could not read ${row.filePath} from this folder.` : "This document has no markdown mirror on disk yet."
|
|
10623
10141
|
)
|
|
10624
10142
|
);
|
|
10625
10143
|
} else if (!diagrams.length) {
|
|
10626
|
-
line(
|
|
10144
|
+
line(import_picocolors33.default.dim("No diagrams in this document."));
|
|
10627
10145
|
} else {
|
|
10628
10146
|
for (const [i, code] of diagrams.entries()) {
|
|
10629
10147
|
const kind = diagramKind(code) ?? "diagram";
|
|
10630
|
-
line(`${
|
|
10148
|
+
line(`${import_picocolors33.default.dim(String(i + 1))} ${kind} ${import_picocolors33.default.dim(`${code.split("\n").length} lines`)}`);
|
|
10631
10149
|
}
|
|
10632
10150
|
}
|
|
10633
10151
|
});
|
|
@@ -10663,7 +10181,7 @@ function registerDoc(program3) {
|
|
|
10663
10181
|
code: "bad_request"
|
|
10664
10182
|
});
|
|
10665
10183
|
}
|
|
10666
|
-
ok(row, () => line(`Updated document ${
|
|
10184
|
+
ok(row, () => line(`Updated document ${import_picocolors33.default.bold(row.id)} \u2014 ${row.title}`));
|
|
10667
10185
|
})
|
|
10668
10186
|
);
|
|
10669
10187
|
}
|
|
@@ -10677,7 +10195,7 @@ function readMirror(cwd, filePath) {
|
|
|
10677
10195
|
}
|
|
10678
10196
|
|
|
10679
10197
|
// src/commands/design.ts
|
|
10680
|
-
var
|
|
10198
|
+
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
10681
10199
|
function registerDesign(program3) {
|
|
10682
10200
|
const design = program3.command("design").description("Read the project's brand (colours, fonts, logo)");
|
|
10683
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(
|
|
@@ -10691,11 +10209,11 @@ function registerDesign(program3) {
|
|
|
10691
10209
|
if (opts.raw) {
|
|
10692
10210
|
ok(files, () => {
|
|
10693
10211
|
if (!files.length) {
|
|
10694
|
-
line(
|
|
10212
|
+
line(import_picocolors34.default.dim("No brand set for this project."));
|
|
10695
10213
|
return;
|
|
10696
10214
|
}
|
|
10697
10215
|
for (const f of files) {
|
|
10698
|
-
line(
|
|
10216
|
+
line(import_picocolors34.default.bold(f.path));
|
|
10699
10217
|
line(f.contents);
|
|
10700
10218
|
line("");
|
|
10701
10219
|
}
|
|
@@ -10712,21 +10230,21 @@ function registerDesign(program3) {
|
|
|
10712
10230
|
} : { hasBrand: false, colors: {}, fonts: {}, brand: {}, files: [] };
|
|
10713
10231
|
ok(summary, () => {
|
|
10714
10232
|
if (!tokens) {
|
|
10715
|
-
line(
|
|
10233
|
+
line(import_picocolors34.default.dim("No brand set for this project \u2014 choose sensible styling yourself."));
|
|
10716
10234
|
return;
|
|
10717
10235
|
}
|
|
10718
10236
|
for (const [name, value] of Object.entries(tokens.brand)) {
|
|
10719
|
-
line(`${
|
|
10237
|
+
line(`${import_picocolors34.default.dim(name.padEnd(12))} ${value}`);
|
|
10720
10238
|
}
|
|
10721
10239
|
for (const [name, value] of Object.entries(tokens.color)) {
|
|
10722
|
-
line(`${
|
|
10240
|
+
line(`${import_picocolors34.default.dim(`color.${name}`.padEnd(12))} ${value}`);
|
|
10723
10241
|
}
|
|
10724
10242
|
for (const [name, value] of Object.entries(tokens.font)) {
|
|
10725
|
-
line(`${
|
|
10243
|
+
line(`${import_picocolors34.default.dim(`font.${name}`.padEnd(12))} ${value}`);
|
|
10726
10244
|
}
|
|
10727
10245
|
line("");
|
|
10728
10246
|
line(
|
|
10729
|
-
|
|
10247
|
+
import_picocolors34.default.dim(
|
|
10730
10248
|
`Generated into the working tree as ${files.map((f) => f.path).join(", ")} \u2014 wire those in, never edit them.`
|
|
10731
10249
|
)
|
|
10732
10250
|
);
|
|
@@ -10757,7 +10275,7 @@ function unwrap(group) {
|
|
|
10757
10275
|
}
|
|
10758
10276
|
|
|
10759
10277
|
// src/commands/api.ts
|
|
10760
|
-
var
|
|
10278
|
+
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
10761
10279
|
import { readdirSync, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
|
|
10762
10280
|
import { join as join3, relative, sep } from "path";
|
|
10763
10281
|
|
|
@@ -10871,10 +10389,10 @@ function registerApi(program3) {
|
|
|
10871
10389
|
const appId = requireApp2(opts.app);
|
|
10872
10390
|
const res = await api(ctx, `/v1/apps/${encodeURIComponent(appId)}/api/requests`);
|
|
10873
10391
|
ok(res, () => {
|
|
10874
|
-
for (const note of res?.notes ?? []) line(
|
|
10392
|
+
for (const note of res?.notes ?? []) line(import_picocolors35.default.dim(note));
|
|
10875
10393
|
for (const r of res?.requests ?? []) {
|
|
10876
10394
|
line(
|
|
10877
|
-
`${
|
|
10395
|
+
`${import_picocolors35.default.dim(r.method.padEnd(6))}${r.path}${r.note ? import_picocolors35.default.dim(` ${r.note}`) : ""}`
|
|
10878
10396
|
);
|
|
10879
10397
|
}
|
|
10880
10398
|
});
|
|
@@ -10908,14 +10426,14 @@ function registerApi(program3) {
|
|
|
10908
10426
|
);
|
|
10909
10427
|
ok(res, () => {
|
|
10910
10428
|
if (!res?.ok) {
|
|
10911
|
-
line(
|
|
10429
|
+
line(import_picocolors35.default.red(res?.error ?? "The service did not answer."));
|
|
10912
10430
|
return;
|
|
10913
10431
|
}
|
|
10914
10432
|
const code = `${res.status}${res.statusText ? ` ${res.statusText}` : ""}`;
|
|
10915
|
-
const colour2 = res.status && res.status < 300 ?
|
|
10916
|
-
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}`)}`);
|
|
10917
10435
|
if (res.body) line(res.body);
|
|
10918
|
-
if (res.truncated) line(
|
|
10436
|
+
if (res.truncated) line(import_picocolors35.default.dim("(answer truncated)"));
|
|
10919
10437
|
});
|
|
10920
10438
|
if (!res?.ok) process.exitCode = 1;
|
|
10921
10439
|
})
|
|
@@ -10935,15 +10453,15 @@ function registerApi(program3) {
|
|
|
10935
10453
|
for (const r of report.routes) {
|
|
10936
10454
|
const known = report.missing.some((m) => m.path === r.path);
|
|
10937
10455
|
line(
|
|
10938
|
-
`${known ?
|
|
10456
|
+
`${known ? import_picocolors35.default.yellow("undocumented") : import_picocolors35.default.green("documented ")} ${r.path}${import_picocolors35.default.dim(` ${r.file}`)}`
|
|
10939
10457
|
);
|
|
10940
10458
|
}
|
|
10941
10459
|
for (const p of report.stale) {
|
|
10942
|
-
line(`${
|
|
10460
|
+
line(`${import_picocolors35.default.dim("in spec only ")} ${p}`);
|
|
10943
10461
|
}
|
|
10944
10462
|
line("");
|
|
10945
10463
|
if (report.ok && specFile) success(summary);
|
|
10946
|
-
else line(
|
|
10464
|
+
else line(import_picocolors35.default.yellow(summary));
|
|
10947
10465
|
});
|
|
10948
10466
|
if (opts.check && !report.ok) {
|
|
10949
10467
|
throw new WorkserError(summary, { code: "bad_request" });
|
|
@@ -11014,7 +10532,7 @@ function listRepoFiles(root, maxDepth = 8) {
|
|
|
11014
10532
|
}
|
|
11015
10533
|
|
|
11016
10534
|
// src/commands/analysis.ts
|
|
11017
|
-
var
|
|
10535
|
+
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
11018
10536
|
import { readFileSync as readFileSync4 } from "fs";
|
|
11019
10537
|
function registerAnalysis(program3) {
|
|
11020
10538
|
const cmd = program3.command("analysis").description("Run Python analysis locally, recorded in the task");
|
|
@@ -11024,14 +10542,14 @@ function registerAnalysis(program3) {
|
|
|
11024
10542
|
const res = await api(ctx, path);
|
|
11025
10543
|
ok(res, () => {
|
|
11026
10544
|
line(
|
|
11027
|
-
`${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 ?? "")}`
|
|
11028
10546
|
);
|
|
11029
10547
|
for (const lib of res?.libraries ?? []) {
|
|
11030
10548
|
line(
|
|
11031
|
-
`${lib.present ?
|
|
10549
|
+
`${lib.present ? import_picocolors36.default.green(lib.name) : import_picocolors36.default.yellow(lib.name)}${import_picocolors36.default.dim(lib.present ? "" : " missing")}`
|
|
11032
10550
|
);
|
|
11033
10551
|
}
|
|
11034
|
-
for (const note of res?.notes ?? []) line(
|
|
10552
|
+
for (const note of res?.notes ?? []) line(import_picocolors36.default.dim(note));
|
|
11035
10553
|
});
|
|
11036
10554
|
if (!res?.available) process.exitCode = 1;
|
|
11037
10555
|
})
|
|
@@ -11053,15 +10571,15 @@ function registerAnalysis(program3) {
|
|
|
11053
10571
|
);
|
|
11054
10572
|
ok(res, () => {
|
|
11055
10573
|
if (res?.stdout) line(res.stdout.replace(/\n$/, ""));
|
|
11056
|
-
if (res?.stderr) line(
|
|
11057
|
-
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)"));
|
|
11058
10576
|
const took = `${Math.round((res?.durationMs ?? 0) / 100) / 10}s`;
|
|
11059
10577
|
line(
|
|
11060
|
-
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}`)
|
|
11061
10579
|
);
|
|
11062
10580
|
if (res && !res.sandboxed) {
|
|
11063
10581
|
line(
|
|
11064
|
-
|
|
10582
|
+
import_picocolors36.default.dim(
|
|
11065
10583
|
"This platform has no OS sandbox, so the script ran with your own file access."
|
|
11066
10584
|
)
|
|
11067
10585
|
);
|
|
@@ -11089,7 +10607,7 @@ function readCode(file, inline) {
|
|
|
11089
10607
|
}
|
|
11090
10608
|
|
|
11091
10609
|
// src/commands/scan.ts
|
|
11092
|
-
var
|
|
10610
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
11093
10611
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
11094
10612
|
import { existsSync as existsSync3, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync as statSync3 } from "fs";
|
|
11095
10613
|
import { join as join4, relative as relative2, sep as sep2 } from "path";
|
|
@@ -11373,22 +10891,22 @@ function runPermissions(cwd, findings, checked, skipped) {
|
|
|
11373
10891
|
}
|
|
11374
10892
|
function print2(report, summary) {
|
|
11375
10893
|
for (const s of report.skipped) {
|
|
11376
|
-
line(`${
|
|
10894
|
+
line(`${import_picocolors37.default.yellow("not checked")} ${s.check}${import_picocolors37.default.dim(` \u2014 ${s.reason}`)}`);
|
|
11377
10895
|
}
|
|
11378
10896
|
for (const f of report.findings) {
|
|
11379
|
-
const where = f.file ?
|
|
10897
|
+
const where = f.file ? import_picocolors37.default.dim(` ${f.file}${f.line ? `:${f.line}` : ""}`) : "";
|
|
11380
10898
|
line(`${severityTag(f.severity)} ${f.title}${where}`);
|
|
11381
|
-
line(` ${
|
|
10899
|
+
line(` ${import_picocolors37.default.dim(f.fix)}`);
|
|
11382
10900
|
}
|
|
11383
10901
|
if (report.findings.length || report.skipped.length) line("");
|
|
11384
10902
|
if (report.ok && !report.skipped.length) success(summary);
|
|
11385
|
-
else if (report.ok) line(
|
|
11386
|
-
else line(
|
|
10903
|
+
else if (report.ok) line(import_picocolors37.default.yellow(summary));
|
|
10904
|
+
else line(import_picocolors37.default.red(summary));
|
|
11387
10905
|
}
|
|
11388
10906
|
function severityTag(severity) {
|
|
11389
|
-
if (severity === "high") return
|
|
11390
|
-
if (severity === "medium") return
|
|
11391
|
-
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 ");
|
|
11392
10910
|
}
|
|
11393
10911
|
function git(cwd, args) {
|
|
11394
10912
|
try {
|
|
@@ -11449,7 +10967,7 @@ function listRepoFiles2(root, maxDepth = 8) {
|
|
|
11449
10967
|
}
|
|
11450
10968
|
|
|
11451
10969
|
// src/commands/health.ts
|
|
11452
|
-
var
|
|
10970
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
11453
10971
|
function registerHealth(program3) {
|
|
11454
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(
|
|
11455
10973
|
action(async ({ ctx, opts }) => {
|
|
@@ -11463,16 +10981,16 @@ function registerHealth(program3) {
|
|
|
11463
10981
|
}
|
|
11464
10982
|
function print3(res) {
|
|
11465
10983
|
if (!res?.checks?.length) {
|
|
11466
|
-
line(
|
|
10984
|
+
line(import_picocolors38.default.dim(res?.note ?? "Nothing to check."));
|
|
11467
10985
|
return;
|
|
11468
10986
|
}
|
|
11469
10987
|
for (const c of res.checks) {
|
|
11470
|
-
const mark = c.ok ?
|
|
11471
|
-
const timing =
|
|
11472
|
-
const detail = c.ok ? timing :
|
|
11473
|
-
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}`);
|
|
11474
10992
|
if (c.incidentOpened) {
|
|
11475
|
-
line(
|
|
10993
|
+
line(import_picocolors38.default.yellow(` An incident has been opened on the board for this.`));
|
|
11476
10994
|
}
|
|
11477
10995
|
}
|
|
11478
10996
|
const down = res.checks.filter((c) => !c.ok);
|
|
@@ -11485,14 +11003,14 @@ function print3(res) {
|
|
|
11485
11003
|
}
|
|
11486
11004
|
const production = down.filter((c) => c.environment === "production").length;
|
|
11487
11005
|
line(
|
|
11488
|
-
|
|
11006
|
+
import_picocolors38.default.red(
|
|
11489
11007
|
`${down.length} of ${res.checks.length} not answering` + (production ? ` \u2014 ${production} customer-facing.` : " (preview only).")
|
|
11490
11008
|
)
|
|
11491
11009
|
);
|
|
11492
11010
|
}
|
|
11493
11011
|
|
|
11494
11012
|
// src/commands/urls.ts
|
|
11495
|
-
var
|
|
11013
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
11496
11014
|
function registerUrls(program3) {
|
|
11497
11015
|
program3.command("urls").description("The stable preview and production addresses of every app in this project").option("--app <webAppId>", "just one app").action(
|
|
11498
11016
|
action(async ({ ctx, opts }) => {
|
|
@@ -11506,20 +11024,20 @@ function registerUrls(program3) {
|
|
|
11506
11024
|
const summary = urlsSummary(rows);
|
|
11507
11025
|
ok({ rows, summary }, () => {
|
|
11508
11026
|
for (const row of rows) {
|
|
11509
|
-
const label =
|
|
11510
|
-
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");
|
|
11511
11029
|
line(` ${row.appName.padEnd(22)} ${label} ${value}`);
|
|
11512
11030
|
}
|
|
11513
11031
|
line("");
|
|
11514
11032
|
if (rows.some((r) => r.url)) success(summary);
|
|
11515
|
-
else line(
|
|
11033
|
+
else line(import_picocolors39.default.yellow(summary));
|
|
11516
11034
|
});
|
|
11517
11035
|
})
|
|
11518
11036
|
);
|
|
11519
11037
|
}
|
|
11520
11038
|
|
|
11521
11039
|
// src/commands/deployments.ts
|
|
11522
|
-
var
|
|
11040
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
11523
11041
|
function registerDeployments(program3) {
|
|
11524
11042
|
const cmd = program3.command("deployments").description("Deployment history, and putting a build in front of customers");
|
|
11525
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(
|
|
@@ -11537,7 +11055,7 @@ function registerDeployments(program3) {
|
|
|
11537
11055
|
ok(res, () => {
|
|
11538
11056
|
if (!items.length) {
|
|
11539
11057
|
return line(
|
|
11540
|
-
|
|
11058
|
+
import_picocolors40.default.dim(
|
|
11541
11059
|
environment ? `Nothing has been deployed to ${environment} yet.` : "Nothing has been deployed yet. `workser deploy` builds the first one."
|
|
11542
11060
|
)
|
|
11543
11061
|
);
|
|
@@ -11557,13 +11075,13 @@ function registerDeployments(program3) {
|
|
|
11557
11075
|
).catch(() => null) : null;
|
|
11558
11076
|
ok({ ...dep, logs }, () => {
|
|
11559
11077
|
line(formatDeployment(dep));
|
|
11560
|
-
if (dep?.error_message) line(
|
|
11078
|
+
if (dep?.error_message) line(import_picocolors40.default.red(` ${dep.error_message}`));
|
|
11561
11079
|
const events = logs?.events ?? [];
|
|
11562
11080
|
for (const e of events) {
|
|
11563
|
-
line(` ${
|
|
11081
|
+
line(` ${import_picocolors40.default.dim(String(e.type ?? "log"))} ${e.text ?? ""}`);
|
|
11564
11082
|
}
|
|
11565
11083
|
if (opts.logs && !events.length) {
|
|
11566
|
-
line(
|
|
11084
|
+
line(import_picocolors40.default.dim(" That build produced no output."));
|
|
11567
11085
|
}
|
|
11568
11086
|
});
|
|
11569
11087
|
})
|
|
@@ -11607,16 +11125,16 @@ function printPromoted(res, version) {
|
|
|
11607
11125
|
const what = version === null ? "the latest build" : `version ${version}`;
|
|
11608
11126
|
const url = res.url ?? res.vercel_url;
|
|
11609
11127
|
success(`Production is being rebuilt from ${what}.`);
|
|
11610
|
-
if (url) line(
|
|
11611
|
-
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."));
|
|
11612
11130
|
}
|
|
11613
11131
|
function formatDeployment(d) {
|
|
11614
11132
|
if (!d) return "";
|
|
11615
|
-
const version = d.version !== void 0 ?
|
|
11616
|
-
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));
|
|
11617
11135
|
const app = d.webAppName ? `${d.webAppName} ` : "";
|
|
11618
|
-
const when =
|
|
11619
|
-
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) : "";
|
|
11620
11138
|
return `${version} ${env} ${colorStatus(d.status ?? "")} ${app}${when}${url}`;
|
|
11621
11139
|
}
|
|
11622
11140
|
function formatTime2(t) {
|
|
@@ -11626,7 +11144,7 @@ function formatTime2(t) {
|
|
|
11626
11144
|
}
|
|
11627
11145
|
|
|
11628
11146
|
// src/commands/usage.ts
|
|
11629
|
-
var
|
|
11147
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
11630
11148
|
|
|
11631
11149
|
// src/usage.ts
|
|
11632
11150
|
var NEAR_LIMIT_FRACTION = 0.8;
|
|
@@ -11721,7 +11239,7 @@ function registerUsage(program3) {
|
|
|
11721
11239
|
function print4(report) {
|
|
11722
11240
|
const dims = report.dimensions ?? [];
|
|
11723
11241
|
if (!dims.length) {
|
|
11724
|
-
return line(
|
|
11242
|
+
return line(import_picocolors41.default.dim("Nothing to measure for this project yet."));
|
|
11725
11243
|
}
|
|
11726
11244
|
const width = Math.max(...dims.map((d) => d.label.length));
|
|
11727
11245
|
for (const d of dims) {
|
|
@@ -11730,23 +11248,23 @@ function print4(report) {
|
|
|
11730
11248
|
line("");
|
|
11731
11249
|
const summary = usageSummary(report);
|
|
11732
11250
|
const worst = dims.map(usageState);
|
|
11733
|
-
if (worst.includes("over")) line(
|
|
11251
|
+
if (worst.includes("over")) line(import_picocolors41.default.red(summary));
|
|
11734
11252
|
else if (worst.includes("near") || worst.includes("unknown"))
|
|
11735
|
-
line(
|
|
11253
|
+
line(import_picocolors41.default.yellow(summary));
|
|
11736
11254
|
else success(summary);
|
|
11737
11255
|
}
|
|
11738
11256
|
function gauge(d, _labelWidth) {
|
|
11739
11257
|
const drawn = bar(d);
|
|
11740
|
-
return drawn ? ` ${
|
|
11258
|
+
return drawn ? ` ${import_picocolors41.default.dim(drawn)}` : "";
|
|
11741
11259
|
}
|
|
11742
11260
|
function colour(d) {
|
|
11743
11261
|
switch (usageState(d)) {
|
|
11744
11262
|
case "over":
|
|
11745
|
-
return d.kind === "hard" ?
|
|
11263
|
+
return d.kind === "hard" ? import_picocolors41.default.red : import_picocolors41.default.yellow;
|
|
11746
11264
|
case "near":
|
|
11747
|
-
return
|
|
11265
|
+
return import_picocolors41.default.yellow;
|
|
11748
11266
|
case "unknown":
|
|
11749
|
-
return
|
|
11267
|
+
return import_picocolors41.default.dim;
|
|
11750
11268
|
default:
|
|
11751
11269
|
return (s) => s;
|
|
11752
11270
|
}
|
|
@@ -11754,7 +11272,7 @@ function colour(d) {
|
|
|
11754
11272
|
|
|
11755
11273
|
// src/index.ts
|
|
11756
11274
|
var pkg = {
|
|
11757
|
-
version: true ? "0.6.
|
|
11275
|
+
version: true ? "0.6.16" : "0.0.0-dev"
|
|
11758
11276
|
};
|
|
11759
11277
|
var program2 = new Command();
|
|
11760
11278
|
program2.name("workser").description(
|
|
@@ -11787,7 +11305,6 @@ registerDomain(program2);
|
|
|
11787
11305
|
registerOpen(program2);
|
|
11788
11306
|
registerDoctor(program2);
|
|
11789
11307
|
registerAgent(program2);
|
|
11790
|
-
registerAgentCloud(program2);
|
|
11791
11308
|
registerVerify(program2);
|
|
11792
11309
|
registerApi(program2);
|
|
11793
11310
|
registerAnalysis(program2);
|