@workser/cli 0.6.2 → 0.6.4
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 +100 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5386,7 +5386,7 @@ function buildContext(opts) {
|
|
|
5386
5386
|
const endpoint = endpointRaw.replace(/\/+$/, "");
|
|
5387
5387
|
const mode2 = socketPath ? "daemon" : /^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:|\/|$)/i.test(endpoint) ? "daemon" : "cloud";
|
|
5388
5388
|
const folder = readFolderIdentity(cwd);
|
|
5389
|
-
const projectId = opts.project || process.env.WORKSER_PROJECT_ID ||
|
|
5389
|
+
const projectId = opts.project || folder?.projectId || process.env.WORKSER_PROJECT_ID || session.defaultProjectId;
|
|
5390
5390
|
const inThisProject = folder?.projectId === projectId;
|
|
5391
5391
|
const runId = process.env.WORKSER_RUN_ID || void 0;
|
|
5392
5392
|
const conversationId = process.env.WORKSER_CONVERSATION_ID || void 0;
|
|
@@ -5404,6 +5404,15 @@ function buildContext(opts) {
|
|
|
5404
5404
|
mode: mode2,
|
|
5405
5405
|
cwd,
|
|
5406
5406
|
projectId,
|
|
5407
|
+
/**
|
|
5408
|
+
* The ORG the cwd belongs to, from the same marker.
|
|
5409
|
+
*
|
|
5410
|
+
* Read here rather than from `WORKSER_ORGANIZATION_ID` for the same reason
|
|
5411
|
+
* as the project above: a user belongs to several, and the env is a
|
|
5412
|
+
* snapshot of the run that spawned this process, not of the folder the
|
|
5413
|
+
* command is standing in.
|
|
5414
|
+
*/
|
|
5415
|
+
orgId: inThisProject ? folder?.orgId : void 0,
|
|
5407
5416
|
projectRoot: inThisProject ? folder?.projectRoot : void 0,
|
|
5408
5417
|
appId: inThisProject ? folder?.appId : void 0,
|
|
5409
5418
|
appName: inThisProject ? folder?.appName : void 0,
|
|
@@ -5756,13 +5765,61 @@ function registerProject(program3) {
|
|
|
5756
5765
|
if (!merged.localPath) {
|
|
5757
5766
|
line(
|
|
5758
5767
|
import_picocolors4.default.dim(
|
|
5759
|
-
|
|
5768
|
+
` no code on this computer yet \u2014 run \`workser project sync ${merged.id ?? id}\``
|
|
5760
5769
|
)
|
|
5761
5770
|
);
|
|
5762
5771
|
}
|
|
5763
5772
|
});
|
|
5764
5773
|
})
|
|
5765
5774
|
);
|
|
5775
|
+
project.command("sync [id]").description(
|
|
5776
|
+
"Bring an app's code down to this computer \u2014 safe to run again; never overwrites local work"
|
|
5777
|
+
).action(
|
|
5778
|
+
action(async ({ ctx, args }) => {
|
|
5779
|
+
const projectId = requireProject(ctx);
|
|
5780
|
+
const appId = args[0] ?? ctx.appId;
|
|
5781
|
+
if (!appId) {
|
|
5782
|
+
throw new Error(
|
|
5783
|
+
"Which app? Pass its id, or run this from inside the app's folder."
|
|
5784
|
+
);
|
|
5785
|
+
}
|
|
5786
|
+
const prepared = await api(
|
|
5787
|
+
ctx,
|
|
5788
|
+
`/v1/app-folders/prepare`,
|
|
5789
|
+
{
|
|
5790
|
+
method: "POST",
|
|
5791
|
+
body: { projectId, webAppId: appId, requireSource: true }
|
|
5792
|
+
}
|
|
5793
|
+
);
|
|
5794
|
+
const localPath = prepared?.localPath;
|
|
5795
|
+
if (!localPath) {
|
|
5796
|
+
throw new Error(
|
|
5797
|
+
"Couldn't make a folder for this app on this computer."
|
|
5798
|
+
);
|
|
5799
|
+
}
|
|
5800
|
+
const seeded = await api(
|
|
5801
|
+
ctx,
|
|
5802
|
+
`/v1/app-folders/seed`,
|
|
5803
|
+
{
|
|
5804
|
+
method: "POST",
|
|
5805
|
+
body: {
|
|
5806
|
+
projectId,
|
|
5807
|
+
webAppId: appId,
|
|
5808
|
+
localPath,
|
|
5809
|
+
requireSource: true
|
|
5810
|
+
}
|
|
5811
|
+
}
|
|
5812
|
+
);
|
|
5813
|
+
ok({ appId, localPath, ...seeded }, () => {
|
|
5814
|
+
if (seeded?.ok === false) {
|
|
5815
|
+
line(import_picocolors4.default.yellow(seeded.message ?? "The code did not arrive."));
|
|
5816
|
+
line(import_picocolors4.default.dim(` folder ${localPath}`));
|
|
5817
|
+
return;
|
|
5818
|
+
}
|
|
5819
|
+
line(`${import_picocolors4.default.green("synced")} ${localPath}`);
|
|
5820
|
+
});
|
|
5821
|
+
})
|
|
5822
|
+
);
|
|
5766
5823
|
project.command("list").description("List the workspace's projects").action(
|
|
5767
5824
|
action(async ({ ctx }) => {
|
|
5768
5825
|
const items = await api(ctx, `/v1/projects`);
|
|
@@ -8479,12 +8536,22 @@ function registerTask(program3) {
|
|
|
8479
8536
|
`/v1/project-tasks/${encodeURIComponent(id)}/retry`,
|
|
8480
8537
|
{ method: "POST" }
|
|
8481
8538
|
);
|
|
8482
|
-
ok(
|
|
8483
|
-
row
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8539
|
+
ok(row, () => {
|
|
8540
|
+
if (!row?.queued) {
|
|
8541
|
+
line(import_picocolors28.default.yellow("could not resume it \u2014 check the step id"));
|
|
8542
|
+
return;
|
|
8543
|
+
}
|
|
8544
|
+
const started = row.started ?? 0;
|
|
8545
|
+
if (started > 0) {
|
|
8546
|
+
line(
|
|
8547
|
+
`${import_picocolors28.default.green("resumed")} \u2014 ${started} step${started === 1 ? "" : "s"} started`
|
|
8548
|
+
);
|
|
8549
|
+
return;
|
|
8550
|
+
}
|
|
8551
|
+
line(
|
|
8552
|
+
`${import_picocolors28.default.green("resumed")} \u2014 it is queued, but nothing started yet. Check the plan is approved and that no step is blocking the rest.`
|
|
8553
|
+
);
|
|
8554
|
+
});
|
|
8488
8555
|
})
|
|
8489
8556
|
);
|
|
8490
8557
|
subtask.command("send-back <id>").description("Send a finished step back to be done again, with the reason").requiredOption("--note <text>", "what was wrong with it").action(
|
|
@@ -8518,6 +8585,30 @@ function registerTask(program3) {
|
|
|
8518
8585
|
ok(row, () => line(import_picocolors28.default.green("approved \u2014 you may start")));
|
|
8519
8586
|
})
|
|
8520
8587
|
);
|
|
8588
|
+
task.command("start [id]").description(
|
|
8589
|
+
"Start the steps this task is ready to run \u2014 only works once the owner has approved the plan"
|
|
8590
|
+
).action(
|
|
8591
|
+
action(async ({ ctx, args }) => {
|
|
8592
|
+
const id = resolveTaskId(ctx, args[0]);
|
|
8593
|
+
const row = await api(
|
|
8594
|
+
ctx,
|
|
8595
|
+
`/v1/project-tasks/${encodeURIComponent(id)}/start`,
|
|
8596
|
+
{ method: "POST" }
|
|
8597
|
+
);
|
|
8598
|
+
ok(row, () => {
|
|
8599
|
+
const started = row?.started ?? null;
|
|
8600
|
+
if (started && started > 0) {
|
|
8601
|
+
line(
|
|
8602
|
+
import_picocolors28.default.green(
|
|
8603
|
+
`started ${started} step${started === 1 ? "" : "s"} \u2014 they are running now`
|
|
8604
|
+
)
|
|
8605
|
+
);
|
|
8606
|
+
return;
|
|
8607
|
+
}
|
|
8608
|
+
line(import_picocolors28.default.yellow(row?.note ?? "Nothing started."));
|
|
8609
|
+
});
|
|
8610
|
+
})
|
|
8611
|
+
);
|
|
8521
8612
|
task.command("approval").description("Ask the owner to approve the plan, or record their decision").argument("<request|approve|decline>").option("--task <id>", "defaults to the task this run is inside").option("--note <text>", "why").action(
|
|
8522
8613
|
action(async ({ ctx, args, opts }) => {
|
|
8523
8614
|
const id = resolveTaskId(ctx, opts.task);
|
|
@@ -10534,7 +10625,7 @@ function colour(d) {
|
|
|
10534
10625
|
|
|
10535
10626
|
// src/index.ts
|
|
10536
10627
|
var pkg = {
|
|
10537
|
-
version: true ? "0.6.
|
|
10628
|
+
version: true ? "0.6.4" : "0.0.0-dev"
|
|
10538
10629
|
};
|
|
10539
10630
|
var program2 = new Command();
|
|
10540
10631
|
program2.name("workser").description(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workser/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Workser CLI — give your local AI agent native DevOps & infrastructure on Workser. The agent runs `workser …` to provision, deploy, and manage real apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|