@orkestrel/scaffold 0.0.129 → 0.0.131

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/bin/main.js CHANGED
@@ -10,7 +10,7 @@ import { readdirSync } from "node:fs";
10
10
  import { parseArgs } from "node:util";
11
11
  var package_default = {
12
12
  name: "@orkestrel/scaffold",
13
- version: "0.0.129",
13
+ version: "0.0.131",
14
14
  description: "Scaffold workspaces with commands: new, audit, surface, repair, catalog, and overwrite.",
15
15
  keywords: [
16
16
  "audit",
@@ -188,6 +188,8 @@ var USAGE_CODE = "USAGE";
188
188
  var FAILED_CODE = "FAILED";
189
189
  /** Holds what the failure envelope says when the raised value carried no message. */
190
190
  var FAILED_MESSAGE = "The command failed for an unrecognized reason";
191
+ /** Names the gate chains a writing verb lands over a generated predecessor. */
192
+ var CHAIN_SCRIPTS = Object.freeze(["test", "build:app"]);
191
193
  /**
192
194
  * Names the workspace argument the creation verb takes, as usage writes it.
193
195
  *
@@ -815,18 +817,20 @@ function sheetTestToQuestion(artifact, present) {
815
817
  *
816
818
  * @param manifest - The target manifest text.
817
819
  * @param blueprint - The workspace shape that supplies the planned scripts.
818
- * @returns The blueprint's writable scripts, followed by the planned `test` chain when the
819
- * declared chain is a generated predecessor of it.
820
+ * @returns The blueprint's writable scripts, followed by the planned `test` and `build:app` chains
821
+ * where each declared chain is a generated predecessor of its planned chain.
820
822
  *
821
823
  * @remarks
822
- * A publishing manifest's byte-exact former generated chain also joins the writable region: the
823
- * planned chain with its generated application and journey invocations after `test:src`. A chain
824
- * that differs in spacing, order, or another step does not match that predecessor.
825
- *
826
- * A declared `test` chain is a generated predecessor when it runs fewer `&&` steps than the
827
- * planned chain and every step it runs is a planned step, in the planned order. That is the chain
828
- * a birth or an earlier write left before a structural fact planned another step, such as a root
829
- * `tests/setupBrowser.test.ts` proof planning `npm run test:setup:browser`, so the write lands the
824
+ * A publishing manifest's byte-exact former generated `test` chain also joins the writable
825
+ * region: the planned chain with its generated application and journey invocations after
826
+ * `test:src`. A chain that differs in spacing, order, or another step does not match that
827
+ * predecessor.
828
+ *
829
+ * A declared `test` or `build:app` chain is a generated predecessor when it runs fewer `&&` steps
830
+ * than the planned chain and every step it runs is a planned step, in the planned order. That is
831
+ * the chain a birth or an earlier write left before a structural fact planned another step, such as
832
+ * a root `tests/setupBrowser.test.ts` proof planning `npm run test:setup:browser`, or studies
833
+ * beside the server application planning `npm run build:app:barrel`, so the write lands the
830
834
  * planned chain in its place. A chain running a step the plan does not generate, or running the
831
835
  * planned steps in another order, is one the package owns, and no entry names it.
832
836
  *
@@ -838,36 +842,35 @@ function sheetTestToQuestion(artifact, present) {
838
842
  function manifestToWritableScripts(manifest, blueprint) {
839
843
  const writable = blueprintToWritableScripts(blueprint);
840
844
  const generated = blueprintToScripts(blueprint);
841
- const planned = generated.test;
842
845
  const parsed = parseJSON(manifest);
843
846
  const scripts = isRecord(parsed) && isRecord(parsed.scripts) ? parsed.scripts : {};
844
- const declared = scripts.test;
845
- if (planned === void 0 || !isString(declared)) return writable;
846
- if (generated.prepublishOnly !== void 0 && isRecord(parsed) && parsed.private !== true) {
847
- const helpers = Object.keys(generated).filter((name) => name === "test:app" || /^test:journey(:|$)/u.test(name));
848
- const former = planned.replace("npm run test:src", ["npm run test:src", ...helpers.map((name) => `npm run ${name}`)].join(" && "));
849
- if (helpers.length > 0 && declared === former) return [...writable, {
850
- name: "test",
847
+ const supplied = new Set(writable.map(({ name }) => name));
848
+ const chains = CHAIN_SCRIPTS.flatMap((chain) => {
849
+ const planned = generated[chain];
850
+ const declared = scripts[chain];
851
+ if (planned === void 0 || !isString(declared)) return [];
852
+ const landed = [{
853
+ name: chain,
851
854
  command: planned,
852
855
  accepted: [declared]
853
856
  }];
854
- }
855
- const steps = declared.split("&&").map((step) => step.trim());
856
- const expected = planned.split("&&").map((step) => step.trim());
857
- if (steps.length >= expected.length) return writable;
858
- const resumed = expected.values();
859
- if (!steps.every((step) => resumed.some((entry) => entry === step))) return writable;
860
- const supplied = new Set(writable.map(({ name }) => name));
861
- for (const step of expected) {
862
- if (steps.includes(step)) continue;
863
- const name = /^npm run (\S+)$/.exec(step)?.[1];
864
- if (name === void 0 || !supplied.has(name) && !isString(scripts[name])) return writable;
865
- }
866
- return [...writable, {
867
- name: "test",
868
- command: planned,
869
- accepted: [declared]
870
- }];
857
+ if (chain === "test" && generated.prepublishOnly !== void 0 && isRecord(parsed) && parsed.private !== true) {
858
+ const helpers = Object.keys(generated).filter((name) => name === "test:app" || /^test:journey(:|$)/u.test(name));
859
+ const former = planned.replace("npm run test:src", ["npm run test:src", ...helpers.map((name) => `npm run ${name}`)].join(" && "));
860
+ if (helpers.length > 0 && declared === former) return landed;
861
+ }
862
+ const steps = declared.split("&&").map((step) => step.trim());
863
+ const expected = planned.split("&&").map((step) => step.trim());
864
+ if (steps.length >= expected.length) return [];
865
+ const resumed = expected.values();
866
+ if (!steps.every((step) => resumed.some((entry) => entry === step))) return [];
867
+ return expected.every((step) => {
868
+ if (steps.includes(step)) return true;
869
+ const name = /^npm run (\S+)$/.exec(step)?.[1];
870
+ return name !== void 0 && (supplied.has(name) || isString(scripts[name]));
871
+ }) ? landed : [];
872
+ });
873
+ return [...writable, ...chains];
871
874
  }
872
875
  /**
873
876
  * Keeps only dependencies published by the Orkestrel fleet.