@theholocron/astromech 5.0.0-alpha.77 → 5.0.0-alpha.78

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/index.d.mts CHANGED
@@ -332,10 +332,14 @@ interface Astromech {
332
332
  * (not just an orchestrator) silently vanishes from `turbo run <task>`.
333
333
  * Pass `pnpm-workspace.yaml`'s current content (or `""` if none exists —
334
334
  * a no-op either way, since no `packages:` key means single-package mode
335
- * already) and root `package.json`'s own `scripts` keys. `changed: false`
336
- * means don't write anything — the file is already correct.
335
+ * already) and root `package.json`'s own `scripts` object — values and
336
+ * all, not just keys, so a task-name-matching script that's already the
337
+ * generated `holocron run <task> --` wrapper (predating this call, not
338
+ * written by it) is correctly excluded rather than treated as proof root
339
+ * is directly buildable (#846). `changed: false` means don't write
340
+ * anything — the file is already correct.
337
341
  */
338
- ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: readonly string[]): EnsureRootWorkspaceMemberResult;
342
+ ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: Readonly<Record<string, string>>): EnsureRootWorkspaceMemberResult;
339
343
  /**
340
344
  * `turboConfig()` writes a `turbo.json` but never touches `package.json`
341
345
  * — a repo with no local `turbo` devDependency falls back to whatever
package/dist/index.mjs CHANGED
@@ -1544,6 +1544,17 @@ function turboConfig(config) {
1544
1544
  * (`Packages in scope: docs, root-lib`) without disturbing the sibling
1545
1545
  * package's own caching.
1546
1546
  *
1547
+ * A matching script key alone isn't enough — its *value* has to be a real
1548
+ * command, not the generated `holocron run <task> --` wrapper (#846, the
1549
+ * counterpart `mergePackageJsonScripts()` already had to learn for #747/
1550
+ * #748). A repo whose root predates this tooling can already have that exact
1551
+ * wrapper sitting in a task-name-matching script with nothing ever having
1552
+ * generated it this session; adding `.` there fires #747's recursion
1553
+ * immediately (`turbo run <task>` → root's own `<task>` script → the wrapper
1554
+ * → `holocron run <task>` sees `turbo.json` still defines it → `turbo run
1555
+ * <task>` again, forever). Only a matching script whose value is *not* that
1556
+ * wrapper counts as "root is genuinely a directly-buildable package".
1557
+ *
1547
1558
  * A targeted line-based edit, not a full YAML parse/reserialize — same
1548
1559
  * pattern `codecov.ts`'s `mergeCodecovComponents()` already uses for editing
1549
1560
  * an existing generated file. `pnpm-workspace.yaml` routinely carries a
@@ -1555,7 +1566,10 @@ function turboConfig(config) {
1555
1566
  * every repo checked actually uses.
1556
1567
  */
1557
1568
  function ensureRootWorkspaceMember(workspaceYaml, rootScripts, taskNames) {
1558
- if (!taskNames.some((t) => rootScripts.includes(t))) return {
1569
+ if (!taskNames.some((t) => {
1570
+ const script = rootScripts[t];
1571
+ return script !== void 0 && !isGeneratedRunWrapper(script, t);
1572
+ })) return {
1559
1573
  content: workspaceYaml,
1560
1574
  changed: false
1561
1575
  };
@@ -1589,6 +1603,21 @@ function ensureRootWorkspaceMember(workspaceYaml, rootScripts, taskNames) {
1589
1603
  };
1590
1604
  }
1591
1605
  /**
1606
+ * Matches the exact shape `packageScripts()` generates for `taskName` —
1607
+ * `<bin> run <taskName> --`, `<bin>` normally `holocron` but substitutable
1608
+ * (`holocronScript`, itself allowed to be multi-word, e.g. `"node
1609
+ * packages/cli/dist/cli.mjs"` — see its own test). Checking the *suffix*
1610
+ * rather than the whole string means an old wrapper survives a
1611
+ * `holocronScript` rename intact — it's still recognized as a wrapper (safe
1612
+ * to update to the new one), not mistaken for a real command. Mirrors
1613
+ * `sync.ts`'s private `isGeneratedRunWrapper()` — same predicate, needed on
1614
+ * both sides of #692/#747: whether to *write* the wrapper, and here, whether
1615
+ * an *existing* one should count as "root is directly buildable".
1616
+ */
1617
+ function isGeneratedRunWrapper(command, taskName) {
1618
+ return command.endsWith(` run ${taskName} --`);
1619
+ }
1620
+ /**
1592
1621
  * Fallback pin when a repo's own `pnpm-workspace.yaml` has no `turbo`
1593
1622
  * catalog entry yet — matches this repo's own catalog version (the
1594
1623
  * canonical source-of-truth repo for the whole org's tooling).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.77",
3
+ "version": "5.0.0-alpha.78",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -37,7 +37,7 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@theholocron/datapad": "5.0.0-alpha.77"
40
+ "@theholocron/datapad": "5.0.0-alpha.78"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@theholocron/eslint-config": "^8.4.5",
@@ -53,7 +53,7 @@
53
53
  "tsdown": "^0.22.14",
54
54
  "typescript": "^5.9.3",
55
55
  "vitest": "^4.1.11",
56
- "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.77"
56
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.78"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=22"