@theholocron/cli 5.0.0-alpha.63 → 5.0.0-alpha.65

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/cli.mjs CHANGED
@@ -3819,10 +3819,13 @@ async function runSecretsSync(input) {
3819
3819
  const rows = [];
3820
3820
  if (loader.has("secrets")) {
3821
3821
  const secrets = loader.get("secrets");
3822
- print(style.step("secrets (repo scope)"));
3822
+ const scope = input.githubSecretScope ?? { kind: "repo" };
3823
+ const allowedKeys = input.githubSecretKeys ? new Set(input.githubSecretKeys) : void 0;
3824
+ print(style.step("secrets"));
3823
3825
  for (const key of keys) {
3824
- rows.push(await runRow(`secrets:${secrets.providerName}`, "scope=repo", key, dryRun, async () => {
3825
- await secrets.setSecret({ kind: "repo" }, key, envVars[key]);
3826
+ if (allowedKeys && !allowedKeys.has(key)) continue;
3827
+ rows.push(await runRow(`secrets:${secrets.providerName}`, scopeLabel(scope), key, dryRun, async () => {
3828
+ await secrets.setSecret(scope, key, envVars[key]);
3826
3829
  }));
3827
3830
  print(formatRow(rows[rows.length - 1]));
3828
3831
  }
@@ -3914,6 +3917,11 @@ function formatRow(row) {
3914
3917
  if (row.status === "dry-run") return ` ${style.dim(`… ${label}`)}`;
3915
3918
  return ` ${style.dim(`· ${label}`)}`;
3916
3919
  }
3920
+ function scopeLabel(scope) {
3921
+ if (scope.kind === "repo") return "scope=repo";
3922
+ if (scope.kind === "organization") return `scope=organization,org=${scope.name}`;
3923
+ return `scope=environment,env=${scope.name}`;
3924
+ }
3917
3925
  function vaultProviderName(loader) {
3918
3926
  if (!loader.has("vault")) return "<missing>";
3919
3927
  return loader.get("vault").providerName;
@@ -8509,9 +8517,17 @@ try {
8509
8517
  type: "array",
8510
8518
  default: ["production", "preview"],
8511
8519
  describe: "Deployment targets to sync to. Defaults to production + preview."
8520
+ }).option("github-secret", {
8521
+ type: "array",
8522
+ describe: "Vault key(s) to push to GH Actions secrets (repeatable). Omit to push every key."
8523
+ }).option("github-secret-scope", {
8524
+ type: "string",
8525
+ default: "repo",
8526
+ describe: "Scope applied to every --github-secret key: \"repo\" (default), \"env=<name>\", or \"org=<name>\"."
8512
8527
  }), async (argv) => {
8513
8528
  const tokens = tokenContext(argv.token);
8514
8529
  if (!tokens) return;
8530
+ const githubSecretScope = parseScope(argv.githubSecretScope);
8515
8531
  const [environmentId] = await promptForPositionals(getEntry("secrets sync"), argv);
8516
8532
  const loaded = await loadConfig(argv.cwd);
8517
8533
  applyResolvedConfig(argv, loaded.resolved);
@@ -8525,6 +8541,8 @@ try {
8525
8541
  },
8526
8542
  environmentId,
8527
8543
  ...argv.projectId ? { projectId: argv.projectId } : {},
8544
+ ...argv.githubSecret?.length ? { githubSecretKeys: argv.githubSecret } : {},
8545
+ githubSecretScope,
8528
8546
  targets: argv.target
8529
8547
  })).summary.fail > 0) process.exitCode = 1;
8530
8548
  }).command("deploy [branch]", "Trigger a deployment via the configured `deployment` capability", (y) => y.positional("branch", {