@orkestrel/scaffold 0.0.52 → 0.0.53

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.
@@ -2828,9 +2828,12 @@ export declare class Compiler implements CompilerInterface {
2828
2828
  * other string is a chain the workspace author customized, so it stays
2829
2829
  * byte-identical while the other named scripts are written independently. A
2830
2830
  * named script the manifest does not declare is appended after the last
2831
- * declared script, copying that section's indentation. A region declaring
2832
- * nothing takes every named script as its first entries, indented from the line
2833
- * its own opening brace sits on.
2831
+ * declared script of its own key family, copying that section's indentation:
2832
+ * `test:setup` follows the last declared `test:` key. A name carrying no colon
2833
+ * has no family, and so does a family the section declares no member of, and
2834
+ * each of those is appended after the last declared script instead. A region
2835
+ * declaring nothing takes every named script as its first entries, indented
2836
+ * from the line its own opening brace sits on.
2834
2837
  *
2835
2838
  * @example
2836
2839
  * ```ts
@@ -2828,9 +2828,12 @@ export declare class Compiler implements CompilerInterface {
2828
2828
  * other string is a chain the workspace author customized, so it stays
2829
2829
  * byte-identical while the other named scripts are written independently. A
2830
2830
  * named script the manifest does not declare is appended after the last
2831
- * declared script, copying that section's indentation. A region declaring
2832
- * nothing takes every named script as its first entries, indented from the line
2833
- * its own opening brace sits on.
2831
+ * declared script of its own key family, copying that section's indentation:
2832
+ * `test:setup` follows the last declared `test:` key. A name carrying no colon
2833
+ * has no family, and so does a family the section declares no member of, and
2834
+ * each of those is appended after the last declared script instead. A region
2835
+ * declaring nothing takes every named script as its first entries, indented
2836
+ * from the line its own opening brace sits on.
2834
2837
  *
2835
2838
  * @example
2836
2839
  * ```ts
@@ -3,7 +3,7 @@ import { fillTemplate } from "@orkestrel/template";
3
3
  import { Emitter } from "@orkestrel/emitter";
4
4
  var package_default = {
5
5
  name: "@orkestrel/scaffold",
6
- version: "0.0.52",
6
+ version: "0.0.53",
7
7
  description: "Scaffold workspaces with five commands: new, audit, repair, catalog, and overwrite.",
8
8
  keywords: [
9
9
  "audit",
@@ -91,15 +91,15 @@ var package_default = {
91
91
  "@orkestrel/console": "^0.0.10",
92
92
  "@orkestrel/contract": "^0.0.13",
93
93
  "@orkestrel/emitter": "^0.0.8",
94
- "@orkestrel/markdown": "^0.0.10",
94
+ "@orkestrel/markdown": "^0.0.11",
95
95
  "@orkestrel/process": "^0.0.6",
96
96
  "@orkestrel/template": "^0.0.5"
97
97
  },
98
98
  devDependencies: {
99
99
  "@microsoft/api-extractor": "^7.59.0",
100
100
  "@orkestrel/guide": "^0.0.13",
101
- "@orkestrel/html": "^0.0.5",
102
- "@orkestrel/probe": "^0.0.4",
101
+ "@orkestrel/html": "^0.0.6",
102
+ "@orkestrel/probe": "^0.0.6",
103
103
  "@orkestrel/test": "^0.0.11",
104
104
  "@types/node": "^26.2.0",
105
105
  "@vitest/browser-playwright": "^4.1.11",
@@ -5444,9 +5444,12 @@ function replaceManifestRanges(manifest, pins) {
5444
5444
  * other string is a chain the workspace author customized, so it stays
5445
5445
  * byte-identical while the other named scripts are written independently. A
5446
5446
  * named script the manifest does not declare is appended after the last
5447
- * declared script, copying that section's indentation. A region declaring
5448
- * nothing takes every named script as its first entries, indented from the line
5449
- * its own opening brace sits on.
5447
+ * declared script of its own key family, copying that section's indentation:
5448
+ * `test:setup` follows the last declared `test:` key. A name carrying no colon
5449
+ * has no family, and so does a family the section declares no member of, and
5450
+ * each of those is appended after the last declared script instead. A region
5451
+ * declaring nothing takes every named script as its first entries, indented
5452
+ * from the line its own opening brace sits on.
5450
5453
  *
5451
5454
  * @example
5452
5455
  * ```ts
@@ -5540,6 +5543,7 @@ function replaceManifestScripts(manifest, scripts) {
5540
5543
  if (start < 0 || end < 0) return void 0;
5541
5544
  const edits = [];
5542
5545
  const written = /* @__PURE__ */ new Set();
5546
+ const anchors = [];
5543
5547
  let first = -1;
5544
5548
  let nested = 0;
5545
5549
  let scan = start;
@@ -5592,6 +5596,10 @@ function replaceManifestScripts(manifest, scripts) {
5592
5596
  if (valueEnd >= end) return void 0;
5593
5597
  scan = valueEnd + 1;
5594
5598
  const key = parseJSON(manifest.slice(keyStart, keyEnd));
5599
+ if (isString(key)) anchors.push({
5600
+ name: key,
5601
+ end: valueEnd + 1
5602
+ });
5595
5603
  const script = scripts.find((entry) => entry.name === key);
5596
5604
  if (script === void 0) continue;
5597
5605
  written.add(script.name);
@@ -5619,15 +5627,25 @@ function replaceManifestScripts(manifest, scripts) {
5619
5627
  text: `${entries.join(",")}${closing}`
5620
5628
  });
5621
5629
  } else {
5622
- let anchor = end - 1;
5623
- while (anchor > start && /\s/u.test(manifest.charAt(anchor - 1))) anchor -= 1;
5630
+ let tail = end - 1;
5631
+ while (tail > start && /\s/u.test(manifest.charAt(tail - 1))) tail -= 1;
5624
5632
  const newline = manifest.lastIndexOf("\n", first);
5625
5633
  const indent = newline < 0 ? "" : manifest.slice(newline + 1, first);
5626
5634
  const separator = newline < 0 || /\S/u.test(indent) ? "" : `\n${indent}`;
5627
- edits.push({
5635
+ const placed = /* @__PURE__ */ new Map();
5636
+ for (const script of missing) {
5637
+ const colon = script.name.indexOf(":");
5638
+ const family = colon < 0 ? void 0 : script.name.slice(0, colon + 1);
5639
+ const anchor = (family === void 0 ? void 0 : anchors.findLast((entry) => entry.name.startsWith(family)))?.end ?? tail;
5640
+ const text = `,${separator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`;
5641
+ const queued = placed.get(anchor);
5642
+ if (queued === void 0) placed.set(anchor, [text]);
5643
+ else queued.push(text);
5644
+ }
5645
+ for (const [anchor, queued] of placed) edits.push({
5628
5646
  start: anchor,
5629
5647
  end: anchor,
5630
- text: missing.map((script) => `,${separator}${JSON.stringify(script.name)}: ${JSON.stringify(script.command)}`).join("")
5648
+ text: queued.join("")
5631
5649
  });
5632
5650
  }
5633
5651
  }