@theholocron/cli 5.0.0-alpha.220 → 5.0.0-alpha.221

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/README.md CHANGED
@@ -552,6 +552,8 @@ Channels fed by another service are declared with `feeds` on the channel: `{ nam
552
552
 
553
553
  Channels fed by the error tracker add `feeds: { errors: true }` and a layout `relay: { host, zone?, script?, code? }`: `setup` makes a dedicated webhook, points `host` at the Comlink Worker (a proxied DNS record via `dns`), and deploys it via `workers.deployScript` with the webhook URL as `COMLINK_<SOURCE>_WEBHOOK`. The URL never leaves the Worker's secret; other secrets on the script are kept. Needs `errors`, `workers` and `dns`; only one channel may be fed.
554
554
 
555
+ `holocron secrets sync <env> --worker <script>` also sets every key of the vault environment on a deployed Worker as a secret, through the optional `Workers.setSecret(script, name, value)` (write-only; the Cloudflare plugin implements it). The Worker must already exist. Sync only adds and updates: it never removes a binding, because a Worker also holds secrets that are not in the vault (for Comlink, the `COMLINK_<SOURCE>_WEBHOOK` that `notifications setup` sets), so a key deleted from the vault must be deleted from the Worker separately. Keys are written one at a time and each is reported; if one fails, the exit code is 1 and re-running finishes the rest, since every write is idempotent.
556
+
555
557
  Pinned messages are declared under the provider's `layout` as `pinned: [{ channel, content }]` (`channel` is a channel in the layout, `content` up to 2000 characters); the layout is the whole set of messages the bot has pinned in those channels.
556
558
 
557
559
  Config shape added for role sync and sign-in (all under the provider's `layout`):
package/dist/cli.mjs CHANGED
@@ -7829,6 +7829,27 @@ async function runSecretsSync(input) {
7829
7829
  }
7830
7830
  }
7831
7831
  }
7832
+ if (input.workerScript) {
7833
+ const script = input.workerScript;
7834
+ print(style.step(`workers (script=${script})`));
7835
+ const workers = loader.has("workers") ? loader.get("workers") : void 0;
7836
+ if (!workers?.setSecret) {
7837
+ const row = {
7838
+ destination: "workers",
7839
+ scope: `script=${script}`,
7840
+ key: "(all)",
7841
+ status: "fail",
7842
+ message: workers ? `workers provider (${workers.providerName}) cannot set secrets` : "--worker needs a `workers` provider in holocron.config.ts"
7843
+ };
7844
+ rows.push(row);
7845
+ print(formatRow(row));
7846
+ } else for (const key of keys) {
7847
+ rows.push(await runRow(`workers:${workers.providerName}`, `script=${script}`, key, dryRun, async () => {
7848
+ await workers.setSecret(script, key, envVars[key]);
7849
+ }));
7850
+ print(formatRow(rows[rows.length - 1]));
7851
+ }
7852
+ }
7832
7853
  for (const r of rows) logger[r.status === "fail" ? "warn" : "info"]({
7833
7854
  destination: r.destination,
7834
7855
  scope: r.scope,
@@ -13453,6 +13474,9 @@ try {
13453
13474
  type: "array",
13454
13475
  default: ["production", "preview"],
13455
13476
  describe: "Deployment targets to sync to. Defaults to production + preview."
13477
+ }).option("worker", {
13478
+ type: "string",
13479
+ describe: "A deployed Worker (script name) to set every vault key on as a secret, e.g. comlink."
13456
13480
  }).option("github-secret", {
13457
13481
  type: "array",
13458
13482
  describe: "Vault key(s) to push to GH Actions secrets (repeatable). Omit to push every key."
@@ -13477,6 +13501,7 @@ try {
13477
13501
  },
13478
13502
  environmentId,
13479
13503
  ...argv.projectId ? { projectId: argv.projectId } : {},
13504
+ ...argv.worker ? { workerScript: argv.worker } : {},
13480
13505
  ...argv.githubSecret?.length ? { githubSecretKeys: argv.githubSecret } : {},
13481
13506
  githubSecretScope,
13482
13507
  targets: argv.target