@devpad/cli 2.6.2 → 2.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -0
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -20360,6 +20360,29 @@ var action_grants_deny = (client_factory) => async (grant_id, options) => {
20360
20360
  }
20361
20361
  spinner.succeed(`denied grant ${grant_id}`);
20362
20362
  };
20363
+ var action_grants_request = () => async (options) => {
20364
+ const spinner = make_spinner("Requesting grant...").start();
20365
+ if (options.stage !== "staging" && options.stage !== "production")
20366
+ return fail_with(spinner, '--stage must be "staging" or "production"');
20367
+ const http = resolve_orchestrator_http(options);
20368
+ if (!http.ok)
20369
+ return fail_with(spinner, `grant request ${http.error}`);
20370
+ const posted = await post_envelope({
20371
+ url: `${http.value.pipelines_url.replace(/\/$/, "")}/grants`,
20372
+ headers: { authorization: `Bearer ${http.value.pipelines_token}`, "content-type": "application/json" },
20373
+ body: JSON.stringify({ package_id: options.package, stage_name: options.stage, scope: options.scope })
20374
+ });
20375
+ if (!posted.ok)
20376
+ return fail_with(spinner, `grant request failed: ${format_http_error(posted.error)}`);
20377
+ const grant = posted.value;
20378
+ const state = grant.granted_at === null ? source_default2.yellow("pending") : source_default2.green("granted");
20379
+ if (options.json === true)
20380
+ console.log(JSON.stringify(grant));
20381
+ else {
20382
+ spinner.succeed(`grant ${grant.id} (${state})`);
20383
+ console.log(` ${source_default2.bold(grant.id)} ${grant.stage_name} ${source_default2.cyan(grant.scope)} ${state}`);
20384
+ }
20385
+ };
20363
20386
  var resolve_mode = (options) => {
20364
20387
  const explicit = options.mode === "memory" || options.mode === "cloudflare-http" ? options.mode : undefined;
20365
20388
  const url = options.orchestratorUrl ?? process.env.DEVPAD_PIPELINES_URL;
@@ -21297,6 +21320,7 @@ External CI should call POST /runs/:id/events directly with an OIDC session JWT,
21297
21320
  grants.command("list").description("List vault grants for a package").requiredOption("--package <id>", "Package ID to list grants for").action(action_grants_list(client_factory));
21298
21321
  grants.command("approve <grant-id>").description("Approve a pending vault grant. HUMAN ONLY — signed-in session in the devpad web UI; the CLI/API-key channel gets 403 human_approval_required.").action(action_grants_approve(client_factory));
21299
21322
  grants.command("deny <grant-id>").description("Deny a pending vault grant. HUMAN ONLY — signed-in session in the devpad web UI; the CLI/API-key channel gets 403 human_approval_required.").option("--reason <text>", "Optional denial reason").action(action_grants_deny(client_factory));
21323
+ grants.command("request").description("Request a new vault grant (admin-only, direct orchestrator via $DEVPAD_PIPELINES_URL/$DEVPAD_PIPELINES_TOKEN). Creates a PENDING grant a human approves in the devpad web UI; re-requesting the same (package, stage, scope) returns the existing grant.").requiredOption("--package <id>", "Package ID to request the grant for").requiredOption("--stage <name>", 'Stage the grant applies to ("staging" | "production")').requiredOption("--scope <scope>", 'Grant scope, e.g. "github:dispatch:owner/repo/deploy.yml"').option("--json", "Machine-readable JSON output instead of the human line").option("--orchestrator-url <url>", "Orchestrator base URL (default: $DEVPAD_PIPELINES_URL)").option("--token <token>", "Bearer token (default: $DEVPAD_PIPELINES_TOKEN)").action(action_grants_request);
21300
21324
  const packages = pipelines.command("packages").description("Manage pipeline packages.\nTypical flow: `packages create` to register a pipeline-managed package, then in your repo add\ninfra.ts, pipeline.ts, grants.ts, and a CI workflow that calls `pipelines artifacts upload`.");
21301
21325
  packages.command("list").description("List pipeline packages").option("--project <id-or-slug>", "Filter by linked devpad project (accepts project_id or internal id)").action(action_packages_list(client_factory));
21302
21326
  packages.command("get <id>").description("Get a pipeline package by id").action(action_packages_get(client_factory));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devpad/cli",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "Command line interface for devpad project management",
5
5
  "keywords": [
6
6
  "cli",
@@ -50,11 +50,11 @@
50
50
  "mime": "^3.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@devpad/api": "^2.6.2",
54
- "@devpad/core": "^2.6.2",
55
- "@devpad/pipeline-fakes": "^2.6.2",
56
- "@devpad/pipeline-templates": "^2.6.2",
57
- "@devpad/schema": "^2.6.2",
53
+ "@devpad/api": "^2.6.4",
54
+ "@devpad/core": "^2.6.4",
55
+ "@devpad/pipeline-fakes": "^2.6.4",
56
+ "@devpad/pipeline-templates": "^2.6.4",
57
+ "@devpad/schema": "^2.6.4",
58
58
  "@types/node": "^20.11.24",
59
59
  "bun-types": "latest",
60
60
  "chalk": "^5.3.0",