@intentius/plywood 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/plywood.mjs CHANGED
@@ -260,13 +260,16 @@ function approvalOf(doc) {
260
260
  function gateOf(doc) {
261
261
  return typeof doc.gate === "string" && GATES.includes(doc.gate) ? doc.gate : DEFAULT_GATE;
262
262
  }
263
+ function previewOf(doc) {
264
+ return doc.preview === true;
265
+ }
263
266
  function quorumOf(rules) {
264
267
  return Object.entries(rules).map(([glob, r]) => {
265
268
  const roles = [...r.role !== void 0 ? [r.role] : [], ...r.roles ?? []];
266
269
  return { targets: [glob], count: r.quorum ?? 1, ...roles.length ? { roles } : {}, notAuthor: true };
267
270
  });
268
271
  }
269
- var GATES, DEFAULT_GATE, APPROVALS, DEFAULT_APPROVAL, APPROVAL_RULE_KEYS, approval;
272
+ var GATES, DEFAULT_GATE, APPROVALS, DEFAULT_APPROVAL, DEFAULT_PREVIEW, APPROVAL_RULE_KEYS, approval;
270
273
  var init_approval = __esm({
271
274
  "src/config/approval.ts"() {
272
275
  "use strict";
@@ -275,13 +278,19 @@ var init_approval = __esm({
275
278
  DEFAULT_GATE = "on-destructive";
276
279
  APPROVALS = ["ledger", "sealed", "pr-review"];
277
280
  DEFAULT_APPROVAL = "ledger";
281
+ DEFAULT_PREVIEW = false;
278
282
  APPROVAL_RULE_KEYS = ["role", "roles", "quorum"];
279
283
  approval = {
280
284
  name: "approval",
281
- keys: ["gate", "approval", "approval_rules"],
285
+ keys: ["gate", "approval", "approval_rules", "preview"],
282
286
  schema: {
283
287
  gate: { type: "string", enum: [...GATES], default: DEFAULT_GATE, description: "always, on-destructive or never." },
284
288
  approval: { type: "string", enum: [...APPROVALS], default: DEFAULT_APPROVAL, description: "ledger, sealed or pr-review." },
289
+ preview: {
290
+ type: "boolean",
291
+ default: DEFAULT_PREVIEW,
292
+ description: "true: plywood init sets approvals.preview in the waves spec, so a merged wave applies only the plans its pull request previewed, or exits 4. Known limits: plywood#55 (the second of two disjoint merges is refused) and plywood#56 (a pull request that creates an autonamed resource is refused)."
293
+ },
285
294
  approval_rules: {
286
295
  type: "object",
287
296
  description: "Role and quorum per stack glob. Read at base.",
@@ -298,6 +307,7 @@ var init_approval = __esm({
298
307
  },
299
308
  check(doc) {
300
309
  const out = [...oneOf(doc.gate, GATES, "gate"), ...oneOf(doc.approval, APPROVALS, "approval")];
310
+ if (doc.preview !== void 0 && typeof doc.preview !== "boolean") out.push(error("preview", "must be true or false"));
301
311
  const rules = doc.approval_rules;
302
312
  if (rules === void 0) return out;
303
313
  if (!isObject(rules)) return [...out, error("approval_rules", "must map a stack glob to { role, quorum }")];
@@ -587,7 +597,7 @@ var init_control = __esm({
587
597
  var version, dependencies;
588
598
  var init_package = __esm({
589
599
  "package.json"() {
590
- version = "0.3.0";
600
+ version = "0.3.1";
591
601
  dependencies = {
592
602
  "@intentius/chant": "0.124.59",
593
603
  "@intentius/chant-lexicon-forgejo": "0.124.59",
@@ -603,8 +613,8 @@ var image_digests_default;
603
613
  var init_image_digests = __esm({
604
614
  "src/image-digests.json"() {
605
615
  image_digests_default = {
606
- "ghcr.io/intentius/plywood-pulumi:0.3.0-pulumi3.272.0": "sha256:39fc85f67be6a281aa5f01b02239aa1f02c492f40f1fb0d145c848cc608aaecd",
607
- "ghcr.io/intentius/plywood-plunge:0.3.0-plunge0.2.0": "sha256:6647f67defb1719395b29d1a6c9d977b6900e228547c4569563962e4234847e3"
616
+ "ghcr.io/intentius/plywood-pulumi:0.3.1-pulumi3.272.0": "sha256:acdadb5000ade3afea20ab2f555946312281066e1df288b1007bff096514ebfd",
617
+ "ghcr.io/intentius/plywood-plunge:0.3.1-plunge0.2.0": "sha256:adc42bc97564ecb2074b3ee4d97f84ddb986e0f30f6a26f35b8721106c177456"
608
618
  };
609
619
  }
610
620
  });
@@ -5729,7 +5739,7 @@ async function runInit(opts, table, io) {
5729
5739
  if (opts.bucketCheck) notes.push(...await bucketStep(detected2, doc, io.env, buckets));
5730
5740
  adopt.push(...await adoptStep(root, detected2, doc, io.env, declaration.doc, opts.dryRun, files, notes, todo));
5731
5741
  todo.push(...todoLines(detected2, doc, forge.kind, io.env));
5732
- if (forge.kind === "gitlab" && chant && stacks2.length > 0 && await hasChantWavePreview()) {
5742
+ if (forge.kind === "gitlab" && chant && stacks2.length > 0 && previewOf(doc) && await hasChantWavePreview()) {
5733
5743
  todo.push(`Add a ${GITLAB_READ_TOKEN} CI/CD variable (a project access token with the read_api scope, masked and protected) so a wave can read the merge request it applies; without it the wave refuses`);
5734
5744
  }
5735
5745
  const failed = files.find((f) => f.status === "failed");
@@ -5809,7 +5819,7 @@ async function wavesSpecStep(chant, stacks2, doc, settings, branch, ordered, for
5809
5819
  ...settings.pipeline.notify ? { notify: { ...notifyForChant(settings.pipeline.notify, chant) } } : {}
5810
5820
  });
5811
5821
  const named = chant.productWavesSpec ? chant.productWavesSpec(base, PRODUCT_WORDS) : base;
5812
- return await hasChantWavePreview() ? withWavePreview(named, forge) : named;
5822
+ return previewOf(doc) && await hasChantWavePreview() ? withWavePreview(named, forge) : named;
5813
5823
  }
5814
5824
  async function workflowStep(chant, root, doc, settings, forge, opts, spec, table, io) {
5815
5825
  const output = WORKFLOW_FILE[forge];
@@ -7918,7 +7928,7 @@ var execChild = (bin, args, opts) => new Promise((done) => {
7918
7928
 
7919
7929
  // src/cli.ts
7920
7930
  init_words();
7921
- var VERSION3 = true ? "0.3.0" : "0.0.0-dev";
7931
+ var VERSION3 = true ? "0.3.1" : "0.0.0-dev";
7922
7932
  var stdio = {
7923
7933
  out: (s) => process.stdout.write(s + "\n"),
7924
7934
  err: (s) => process.stderr.write(s + "\n")