@workser/cli 0.3.0 → 0.3.1
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 +81 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7305,6 +7305,81 @@ function statusTag2(status) {
|
|
|
7305
7305
|
}
|
|
7306
7306
|
}
|
|
7307
7307
|
|
|
7308
|
+
// src/role-guard.ts
|
|
7309
|
+
var READS = [
|
|
7310
|
+
"task",
|
|
7311
|
+
"board",
|
|
7312
|
+
"doc",
|
|
7313
|
+
"decision",
|
|
7314
|
+
"memory",
|
|
7315
|
+
"search",
|
|
7316
|
+
"verify",
|
|
7317
|
+
"logs",
|
|
7318
|
+
"status",
|
|
7319
|
+
"help",
|
|
7320
|
+
"whoami",
|
|
7321
|
+
"login",
|
|
7322
|
+
"auth",
|
|
7323
|
+
"project",
|
|
7324
|
+
"open",
|
|
7325
|
+
"doctor"
|
|
7326
|
+
];
|
|
7327
|
+
var BUILDS = [
|
|
7328
|
+
...READS,
|
|
7329
|
+
"app",
|
|
7330
|
+
"env",
|
|
7331
|
+
"db",
|
|
7332
|
+
"storage",
|
|
7333
|
+
"checkpoint",
|
|
7334
|
+
"artifact",
|
|
7335
|
+
"image",
|
|
7336
|
+
"design",
|
|
7337
|
+
"ask",
|
|
7338
|
+
"sync",
|
|
7339
|
+
"tool",
|
|
7340
|
+
"workflow",
|
|
7341
|
+
"neon",
|
|
7342
|
+
"business"
|
|
7343
|
+
];
|
|
7344
|
+
var ROLE_VERBS = {
|
|
7345
|
+
pm: [...READS, "ask", "app"],
|
|
7346
|
+
architect: [...BUILDS, "versions"],
|
|
7347
|
+
web: BUILDS,
|
|
7348
|
+
api: BUILDS,
|
|
7349
|
+
mobile: BUILDS,
|
|
7350
|
+
python: BUILDS,
|
|
7351
|
+
automation: BUILDS,
|
|
7352
|
+
designer: BUILDS,
|
|
7353
|
+
qa: READS,
|
|
7354
|
+
security: READS,
|
|
7355
|
+
analyst: READS,
|
|
7356
|
+
sre: [...READS, "deploy", "domain", "versions"],
|
|
7357
|
+
devops: [...BUILDS, "deploy", "domain", "versions"]
|
|
7358
|
+
};
|
|
7359
|
+
var NEVER = {
|
|
7360
|
+
// Approving is the owner's, full stop. An agent that can approve the plan it
|
|
7361
|
+
// proposed has removed the only gate this product has.
|
|
7362
|
+
"task approval": "Only the owner can approve a plan."
|
|
7363
|
+
};
|
|
7364
|
+
function assertRoleMayRun(argv) {
|
|
7365
|
+
const role = (process.env.WORKSER_ROLE ?? "").trim();
|
|
7366
|
+
if (!role) return;
|
|
7367
|
+
const verb = argv[0];
|
|
7368
|
+
if (!verb) return;
|
|
7369
|
+
const pair = `${argv[0]} ${argv[1] ?? ""}`.trim();
|
|
7370
|
+
if (NEVER[pair] && !(pair === "task approval" && (argv[2] === "request" || !argv[2]))) {
|
|
7371
|
+
throw new WorkserError(NEVER[pair], { code: "role_forbidden" });
|
|
7372
|
+
}
|
|
7373
|
+
const allowed = ROLE_VERBS[role];
|
|
7374
|
+
const list = allowed ?? READS;
|
|
7375
|
+
if (!list.includes(verb)) {
|
|
7376
|
+
throw new WorkserError(
|
|
7377
|
+
`The ${role} role can't run \`workser ${verb}\`. Report what you found instead, and the step that owns this will do it.`,
|
|
7378
|
+
{ code: "role_forbidden" }
|
|
7379
|
+
);
|
|
7380
|
+
}
|
|
7381
|
+
}
|
|
7382
|
+
|
|
7308
7383
|
// src/commands/decision.ts
|
|
7309
7384
|
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
7310
7385
|
function registerDecision(program3) {
|
|
@@ -7667,7 +7742,7 @@ function unwrap(group) {
|
|
|
7667
7742
|
|
|
7668
7743
|
// src/index.ts
|
|
7669
7744
|
var pkg = {
|
|
7670
|
-
version: true ? "0.3.
|
|
7745
|
+
version: true ? "0.3.1" : "0.0.0-dev"
|
|
7671
7746
|
};
|
|
7672
7747
|
var program2 = new Command();
|
|
7673
7748
|
program2.name("workser").description(
|
|
@@ -7716,4 +7791,9 @@ registerTask(program2);
|
|
|
7716
7791
|
registerDecision(program2);
|
|
7717
7792
|
registerDoc(program2);
|
|
7718
7793
|
registerDesign(program2);
|
|
7794
|
+
try {
|
|
7795
|
+
assertRoleMayRun(process.argv.slice(2));
|
|
7796
|
+
} catch (e) {
|
|
7797
|
+
fail(e);
|
|
7798
|
+
}
|
|
7719
7799
|
program2.parseAsync(process.argv).catch((e) => fail(e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workser/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
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",
|