@platforma-sdk/block-tools 2.17.6 → 2.17.8

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.
@@ -0,0 +1,4 @@
1
+ /** `requireRoot` is the file to resolve from — it decides WHICH copy of the
2
+ * tool is found (e.g. ts-builder's pinned oxlint vs block-tools' own).
3
+ * Returns undefined when the tool is not installed, so callers can skip. */
4
+ export declare function resolveToolBin(requireRoot: string, packageName: string, binName?: string): string | undefined;
@@ -15,5 +15,11 @@ export type RunStructureResult = {
15
15
  changes: Change[];
16
16
  };
17
17
  export declare function runStructureForPath(input: RunStructureInput): Promise<RunStructureResult>;
18
+ /** Expand glob patterns among the positional block paths. POSIX shells expand
19
+ * them before the CLI sees them, but cmd.exe does not — so on Windows
20
+ * `structure check etc/blocks/*` would otherwise receive the literal pattern
21
+ * and fail with "No workspace packages found". Only directories are kept, and
22
+ * arguments carrying no glob metacharacter pass through untouched. */
23
+ export declare function expandBlockPaths(paths: string[]): string[];
18
24
  /** One-line-per-change summary for CLI output. */
19
25
  export declare function formatChanges(blockPath: string, changes: Change[]): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/block-tools",
3
- "version": "2.17.6",
3
+ "version": "2.17.8",
4
4
  "description": "Utility to manipulate Platforma Blocks and Block Registry",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -26,14 +26,14 @@
26
26
  "@aws-sdk/client-ecr-public": "3.1157.0",
27
27
  "@aws-sdk/client-s3": "3.1157.0",
28
28
  "@inquirer/prompts": "^7.0.1",
29
- "@milaboratories/pl-http": "1.2.5",
30
- "@milaboratories/pl-model-backend": "1.4.43",
31
- "@milaboratories/pl-model-common": "1.55.0",
32
- "@milaboratories/pl-model-middle-layer": "1.35.0",
29
+ "@milaboratories/pl-http": "1.2.6",
30
+ "@milaboratories/pl-model-backend": "1.4.45",
31
+ "@milaboratories/pl-model-common": "1.55.1",
32
+ "@milaboratories/pl-model-middle-layer": "1.36.0",
33
33
  "@milaboratories/resolve-helper": "1.1.3",
34
- "@milaboratories/ts-helpers": "1.9.0",
35
- "@platforma-sdk/blocks-deps-updater": "2.2.1",
36
- "@platforma-sdk/package-builder-lib": "1.4.3",
34
+ "@milaboratories/ts-helpers": "1.9.1",
35
+ "@platforma-sdk/blocks-deps-updater": "2.2.2",
36
+ "@platforma-sdk/package-builder-lib": "1.4.4",
37
37
  "canonicalize": "~2.1.0",
38
38
  "commander": "^15.0.0",
39
39
  "lru-cache": "^11.5.3",
@@ -44,9 +44,9 @@
44
44
  "zod": "~3.25.76"
45
45
  },
46
46
  "devDependencies": {
47
- "@milaboratories/build-configs": "2.0.2",
48
- "@milaboratories/ts-builder": "1.7.3",
49
- "@milaboratories/ts-configs": "1.4.0",
47
+ "@milaboratories/build-configs": "2.0.3",
48
+ "@milaboratories/ts-builder": "1.7.4",
49
+ "@milaboratories/ts-configs": "1.4.1",
50
50
  "@rollup/plugin-node-resolve": "^16.0.1",
51
51
  "@types/mime-types": "^2.1.4",
52
52
  "@types/node": "~24.19.2",
@@ -55,6 +55,7 @@
55
55
  "oxfmt": "0.75.0",
56
56
  "rollup-plugin-node-externals": "^8.0.0",
57
57
  "semver": "^7.7.2",
58
+ "shx": "^0.4.0",
58
59
  "typescript": "7.0.2",
59
60
  "vite": "^8.3.5",
60
61
  "vite-plugin-dts": "^5.1.2",
@@ -68,7 +69,7 @@
68
69
  "scripts": {
69
70
  "build": "vite build",
70
71
  "test": "vitest run --coverage",
71
- "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
72
+ "do-pack": "shx rm -f *.tgz && pnpm pack && shx mv *.tgz package.tgz",
72
73
  "formatter:check": "ts-builder formatter --check",
73
74
  "linter:check": "ts-builder linter --check",
74
75
  "types:check": "ts-builder type-check --target node",
@@ -1,20 +1,25 @@
1
1
  import { Command } from "commander";
2
2
  import path from "node:path";
3
3
  import { ConsoleLoggerAdapter } from "@milaboratories/ts-helpers";
4
- import { runStructureForPath, formatChanges } from "../../structure/cli/run-structure";
4
+ import {
5
+ runStructureForPath,
6
+ formatChanges,
7
+ expandBlockPaths,
8
+ } from "../../structure/cli/run-structure";
5
9
 
6
10
  export function structureCheckCommand(packageRoot: string): Command {
7
11
  const cmd = new Command("check").description(
8
12
  "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.",
9
13
  );
10
14
 
11
- // Variadic positional block paths (shell-expanded globs).
15
+ // Variadic positional block paths; glob patterns are expanded by the CLI so
16
+ // they work on shells that do not expand them (cmd.exe).
12
17
  cmd.argument("[paths...]", "block path(s); defaults to the current directory");
13
18
  cmd.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules");
14
19
 
15
20
  cmd.action(async (argv: string[], flags) => {
16
21
  const logger = new ConsoleLoggerAdapter();
17
- const paths = argv.length > 0 ? argv : ["."];
22
+ const paths = argv.length > 0 ? expandBlockPaths(argv) : ["."];
18
23
  const templatesRoot = path.join(packageRoot, "src", "structure", "templates");
19
24
 
20
25
  let anyChanged = false;
@@ -2,7 +2,11 @@ import { Command } from "commander";
2
2
  import path from "node:path";
3
3
  import type { MiLogger } from "@milaboratories/ts-helpers";
4
4
  import { ConsoleLoggerAdapter } from "@milaboratories/ts-helpers";
5
- import { runStructureForPath, formatChanges } from "../../structure/cli/run-structure";
5
+ import {
6
+ runStructureForPath,
7
+ formatChanges,
8
+ expandBlockPaths,
9
+ } from "../../structure/cli/run-structure";
6
10
 
7
11
  // Shared by `structure refresh` and the deprecated `update-deps` alias.
8
12
  export async function runRefresh(opts: {
@@ -38,7 +42,7 @@ export function structureRefreshCommand(packageRoot: string): Command {
38
42
  );
39
43
 
40
44
  cmd.action(async (argv: string[], flags) => {
41
- const paths = argv.length > 0 ? argv : ["."];
45
+ const paths = argv.length > 0 ? expandBlockPaths(argv) : ["."];
42
46
  const templatesRoot = path.join(packageRoot, "src", "structure", "templates");
43
47
  await runRefresh({
44
48
  paths,
@@ -3,11 +3,12 @@
3
3
 
4
4
  import { describe, test, expect } from "vitest";
5
5
  import { spawnSync } from "node:child_process";
6
- import { existsSync, mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
6
+ import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
7
7
  import { tmpdir } from "node:os";
8
8
  import path from "node:path";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { simulateInit } from "../engine/testing";
11
+ import { resolveToolBin } from "./tool-bin";
11
12
  import type { BlockVars } from "../engine/api";
12
13
 
13
14
  const VARS: BlockVars = {
@@ -22,12 +23,12 @@ function resolveTsBuilderConfig(configFile: string): string {
22
23
  return fileURLToPath(import.meta.resolve(`@milaboratories/ts-builder/configs/${configFile}`));
23
24
  }
24
25
 
25
- /** ts-builder pins its own oxlint, so block-tools' PATH copy is a different
26
- * version. */
26
+ /** ts-builder pins its own oxlint, so block-tools' copy is a different version —
27
+ * resolve from inside ts-builder to get the one its configs were written for.
28
+ * See tool-bin.ts for why this goes through the `bin` field rather than
29
+ * node_modules/.bin. */
27
30
  function resolveOxlintBinary(): string | undefined {
28
- const configsDir = path.dirname(resolveTsBuilderConfig("oxlint-base.json"));
29
- const binary = path.resolve(configsDir, "..", "..", "node_modules", ".bin", "oxlint");
30
- return existsSync(binary) ? binary : undefined;
31
+ return resolveToolBin(resolveTsBuilderConfig("oxlint-base.json"), "oxlint");
31
32
  }
32
33
 
33
34
  /** The scopes whose `fmt` script lints. */
@@ -66,8 +67,8 @@ describe("init output is lint-clean (oxlint --deny-warnings)", () => {
66
67
  }
67
68
 
68
69
  const result = spawnSync(
69
- oxlint!,
70
- ["--config", path.join(root, scope, ".oxlintrc.json"), "--deny-warnings", "src"],
70
+ process.execPath,
71
+ [oxlint!, "--config", path.join(root, scope, ".oxlintrc.json"), "--deny-warnings", "src"],
71
72
  { cwd: path.join(root, scope), encoding: "utf-8" },
72
73
  );
73
74
  expect(
@@ -13,15 +13,16 @@ import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
13
13
  import { tmpdir } from "node:os";
14
14
  import path from "node:path";
15
15
  import { simulateInit } from "../engine/testing";
16
+ import { resolveToolBin } from "./tool-bin";
16
17
  import type { BlockVars } from "../engine/api";
17
18
 
18
- function oxfmtAvailable(): boolean {
19
- const r = spawnSync("oxfmt", ["--help"], { encoding: "utf-8" });
20
- return !r.error;
21
- }
22
-
23
19
  describe("oxfmt-clean init output (model + ui)", () => {
24
- const available = oxfmtAvailable();
20
+ // Resolved from block-tools, which declares oxfmt as a dependency. See
21
+ // tool-bin.ts for why this does not go through PATH or node_modules/.bin —
22
+ // a bare `spawnSync("oxfmt")` probe reports it unavailable on Windows and
23
+ // silently skips this guard.
24
+ const oxfmt = resolveToolBin(import.meta.url, "oxfmt");
25
+ const available = oxfmt !== undefined;
25
26
 
26
27
  // Both files `ts-builder check` runs oxfmt on, per scope: package.json AND
27
28
  // tsconfig.json. tsconfig is the regression that motivated the
@@ -47,7 +48,7 @@ describe("oxfmt-clean init output (model + ui)", () => {
47
48
  for (const fileName of FILES) {
48
49
  const content = fs.read(`${scope}/${fileName}`);
49
50
  writeFileSync(path.join(root, scope, fileName), content);
50
- const r = spawnSync("oxfmt", ["--check", path.join(scope, fileName)], {
51
+ const r = spawnSync(process.execPath, [oxfmt!, "--check", path.join(scope, fileName)], {
51
52
  cwd: root,
52
53
  encoding: "utf-8",
53
54
  });
@@ -74,7 +74,7 @@ describe("rootCatalogBumpRules mode split", () => {
74
74
  expect(fs.exists("MARKER.txt")).toBe(true);
75
75
  });
76
76
 
77
- test("--update-deps-only: SDK catalog bumped, infra floor seeded, default-mode leaf skipped", async () => {
77
+ test("--update-deps-only: SDK catalog bumped, default-mode leaf skipped", async () => {
78
78
  const fs = freshFs();
79
79
  engineRun(STRUCTURE, fs, ctx(true), { registryLookup: mockLookup });
80
80
 
@@ -83,15 +83,12 @@ describe("rootCatalogBumpRules mode split", () => {
83
83
  // Present SDK keys refreshed to latest.
84
84
  expect(cat["@platforma-sdk/model"]).toBe("9.9.9");
85
85
  expect(cat["@milaboratories/ts-builder"]).toBe("9.9.9");
86
- // standard infra-floor keys ABSENT from the on-disk catalog are
87
- // SEEDED add-if-absent (no manual seed step needed).
88
- expect(cat["shx"]).toBe("~0.4.0");
89
- expect(cat["turbo"]).toBe("~2.11.10");
90
- expect(cat["vitest"]).toBe("~4.0.18");
91
86
  // Non-matching dep left alone.
92
87
  expect(cat["lodash"]).toBe("1.0.0");
93
88
  // Default-mode leaf was skipped in update-deps-only mode.
94
89
  expect(fs.exists("MARKER.txt")).toBe(false);
90
+ // The infra floor is NOT this rule's job — it is seeded on every refresh
91
+ // by rootPnpmWorkspaceRules (see root-catalog-floor.test.ts).
95
92
  });
96
93
 
97
94
  test("init: SDK catalog bumped AND default-mode leaf fires", async () => {
@@ -0,0 +1,107 @@
1
+ // The curated infra floor must be seeded on EVERY refresh, not only on init /
2
+ // `--update-deps-only`. The root package.json rules hand out `catalog:`
3
+ // references for these entries (turbo, shx, cross-env, …) on every refresh, so
4
+ // seeding them only in the update-deps frame left a plain `structure refresh`
5
+ // writing a `catalog:` for a key the catalog did not carry — `pnpm install`
6
+ // then failed with ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC.
7
+
8
+ import { describe, test, expect } from "vitest";
9
+ import { parse as parseYaml } from "yaml";
10
+ import { defineStructure, scope, managed, generate } from "../engine/api";
11
+ import {
12
+ rootPnpmWorkspaceInitial,
13
+ rootPnpmWorkspaceRules,
14
+ INFRA_CATALOG_FLOOR,
15
+ } from "../rules/root-pnpm-workspace";
16
+ import { run as engineRun } from "../engine/runner";
17
+ import { MemoryFileSystem } from "../engine/fs/memory";
18
+ import { createRunContext } from "../engine/ctx";
19
+ import type { BlockVars } from "../engine/api";
20
+
21
+ const VARS: BlockVars = {
22
+ facadeName: "@platforma-open/test-org.demo",
23
+ baseName: "test-org.demo",
24
+ npmOrg: "@platforma-open",
25
+ orgScope: "test-org",
26
+ shortName: "demo",
27
+ };
28
+
29
+ const STRUCTURE = defineStructure(() => {
30
+ scope("root", () => {
31
+ managed(
32
+ "pnpm-workspace.yaml",
33
+ generate((ctx) => rootPnpmWorkspaceInitial(ctx)),
34
+ () => {
35
+ rootPnpmWorkspaceRules();
36
+ },
37
+ );
38
+ });
39
+ });
40
+
41
+ // A migrated block: no infra floor keys at all, and one entry already pinned
42
+ // to a version of the author's choosing.
43
+ const WORKSPACE_YAML = [
44
+ "packages:",
45
+ " - .",
46
+ "catalog:",
47
+ " shx: 0.3.0",
48
+ " lodash: 1.0.0",
49
+ "",
50
+ ].join("\n");
51
+
52
+ function run(updateDepsOnly: boolean): Record<string, string> {
53
+ const fs = new MemoryFileSystem({ "pnpm-workspace.yaml": WORKSPACE_YAML });
54
+ engineRun(
55
+ STRUCTURE,
56
+ fs,
57
+ createRunContext({
58
+ blockVars: VARS,
59
+ modules: [{ scope: "root", name: VARS.facadeName, path: "" }],
60
+ isSdkInternal: false,
61
+ updateDepsOnly,
62
+ version: 1,
63
+ dryRun: false,
64
+ }),
65
+ {},
66
+ );
67
+ return (parseYaml(fs.read("pnpm-workspace.yaml")) as { catalog: Record<string, string> }).catalog;
68
+ }
69
+
70
+ describe("infra catalog floor", () => {
71
+ test("a DEFAULT refresh seeds every floor entry the block is missing", () => {
72
+ const cat = run(false);
73
+ for (const [name, version] of Object.entries(INFRA_CATALOG_FLOOR)) {
74
+ if (name === "shx") continue; // already pinned by the author, asserted below
75
+ expect(cat[name], `${name} must be seeded on a default refresh`).toBe(version);
76
+ }
77
+ // Every `catalog:` the root package.json rules emit must resolve.
78
+ expect(cat["cross-env"]).toBe(INFRA_CATALOG_FLOOR["cross-env"]);
79
+ });
80
+
81
+ test("add-if-absent: a version the block already pins is never rewritten", () => {
82
+ expect(run(false)["shx"]).toBe("0.3.0");
83
+ expect(run(true)["shx"]).toBe("0.3.0");
84
+ // An unrelated entry is left alone.
85
+ expect(run(false)["lodash"]).toBe("1.0.0");
86
+ });
87
+
88
+ test("seeding is a fixpoint — a second refresh changes nothing", () => {
89
+ const once = run(false);
90
+ const fs = new MemoryFileSystem({ "pnpm-workspace.yaml": WORKSPACE_YAML });
91
+ const context = () =>
92
+ createRunContext({
93
+ blockVars: VARS,
94
+ modules: [{ scope: "root", name: VARS.facadeName, path: "" }],
95
+ isSdkInternal: false,
96
+ updateDepsOnly: false,
97
+ version: 1,
98
+ dryRun: false,
99
+ });
100
+ engineRun(STRUCTURE, fs, context(), {});
101
+ const second = engineRun(STRUCTURE, fs, context(), {});
102
+ expect(second.changes.length, "second refresh must make no changes").toBe(0);
103
+ expect(
104
+ (parseYaml(fs.read("pnpm-workspace.yaml")) as { catalog: Record<string, string> }).catalog,
105
+ ).toEqual(once);
106
+ });
107
+ });
@@ -0,0 +1,41 @@
1
+ // Resolve a CLI tool's entry script through its package.json `bin` field, for
2
+ // tests that shell out to oxlint / oxfmt.
3
+ //
4
+ // Why not `node_modules/.bin/<tool>`? That shim is the right abstraction for a
5
+ // shell, but it cannot be spawned from Node without `shell: true`: the
6
+ // extensionless shim is an sh script (ENOENT on Windows) and the `.CMD` one is
7
+ // refused outright (EINVAL — Node's CVE-2024-27980 mitigation). Routing through
8
+ // a shell then hands the arguments to cmd.exe, which mangles any path holding a
9
+ // space or a `%`; these tests build paths under tmpdir(), so a machine whose
10
+ // user name contains a space would fail.
11
+ //
12
+ // The `bin` field is the same declarative contract the `.bin` shims are
13
+ // generated from, so reading it leaks no internal layout. It does assume the
14
+ // entry is a Node script — true for oxlint and oxfmt, and the assumption
15
+ // ts-builder's own executable resolver already makes.
16
+
17
+ import { existsSync, readFileSync } from "node:fs";
18
+ import { createRequire } from "node:module";
19
+ import path from "node:path";
20
+
21
+ /** `requireRoot` is the file to resolve from — it decides WHICH copy of the
22
+ * tool is found (e.g. ts-builder's pinned oxlint vs block-tools' own).
23
+ * Returns undefined when the tool is not installed, so callers can skip. */
24
+ export function resolveToolBin(
25
+ requireRoot: string,
26
+ packageName: string,
27
+ binName: string = packageName,
28
+ ): string | undefined {
29
+ try {
30
+ const pkgJsonPath = createRequire(requireRoot).resolve(`${packageName}/package.json`);
31
+ const meta = JSON.parse(readFileSync(pkgJsonPath, "utf8")) as {
32
+ bin?: string | Record<string, string>;
33
+ };
34
+ const rel = typeof meta.bin === "string" ? meta.bin : meta.bin?.[binName];
35
+ if (rel === undefined) return undefined;
36
+ const binary = path.resolve(path.dirname(pkgJsonPath), rel);
37
+ return existsSync(binary) ? binary : undefined;
38
+ } catch {
39
+ return undefined;
40
+ }
41
+ }
@@ -6,6 +6,7 @@
6
6
  // cross-block state).
7
7
 
8
8
  import path from "node:path";
9
+ import { globSync, statSync } from "node:fs";
9
10
  import { NodeFileSystem } from "../engine/fs/node";
10
11
  import { NodeTemplateProvider } from "../engine/templates";
11
12
  import { run as engineRun, type Change } from "../engine/runner";
@@ -89,6 +90,22 @@ export async function runStructureForPath(input: RunStructureInput): Promise<Run
89
90
  return { blockPath: input.blockPath, changes: result.changes };
90
91
  }
91
92
 
93
+ /** Expand glob patterns among the positional block paths. POSIX shells expand
94
+ * them before the CLI sees them, but cmd.exe does not — so on Windows
95
+ * `structure check etc/blocks/*` would otherwise receive the literal pattern
96
+ * and fail with "No workspace packages found". Only directories are kept, and
97
+ * arguments carrying no glob metacharacter pass through untouched. */
98
+ export function expandBlockPaths(paths: string[]): string[] {
99
+ const expanded = paths.flatMap((p) => {
100
+ if (!/[*?[]/.test(p)) return [p];
101
+ return globSync(p)
102
+ .filter((match) => statSync(match, { throwIfNoEntry: false })?.isDirectory() === true)
103
+ .map((match) => match.split(path.sep).join("/"))
104
+ .sort();
105
+ });
106
+ return [...new Set(expanded)];
107
+ }
108
+
92
109
  /** One-line-per-change summary for CLI output. */
93
110
  export function formatChanges(blockPath: string, changes: Change[]): string {
94
111
  if (changes.length === 0) return ` ${blockPath}: up to date (0 changes)`;
@@ -31,7 +31,6 @@ import {
31
31
  import {
32
32
  rootPnpmWorkspaceInitial,
33
33
  SDK_CATALOG_PACKAGES,
34
- INFRA_CATALOG_FLOOR,
35
34
  DERIVED_CATALOG_PINS,
36
35
  RUNENV_PYTHON,
37
36
  RUNENV_PYTHON_VERSION,
@@ -67,12 +66,12 @@ export function rootCatalogBumpRules(): void {
67
66
  for (const pin of DERIVED_CATALOG_PINS) {
68
67
  pinCatalogToDependencyOf(pin.entry, { of: pin.of, ofVersion: pin.ofVersion });
69
68
  }
70
- // Curated infra floor → fixed version, ADD-IF-ABSENT (seeds
71
- // shx/turbo/vitest/changesets when missing; never touches a
72
- // version the block already pins).
73
- for (const [name, version] of Object.entries(INFRA_CATALOG_FLOOR)) {
74
- ensureCatalogVersion(name, version);
75
- }
69
+ // The curated infra floor is seeded by `rootPnpmWorkspaceRules`,
70
+ // which runs on every refresh — the root package.json rules hand
71
+ // out `catalog:` references for those entries on every refresh
72
+ // too, so seeding them only here would leave a plain refresh with
73
+ // an unresolvable reference.
74
+ //
76
75
  // The python runenv pin is relevant only to software-bearing
77
76
  // blocks; seed it add-if-absent when one is present.
78
77
  if (ctx.modules.some((m) => m.scope === "software")) {
@@ -21,24 +21,27 @@ import { NODE_RUNTIME, PACKAGE_MANAGER } from "./shared/toolchain";
21
21
 
22
22
  // `variant=all` builds every variant the software declares — docker-vs-binary is not a per-script
23
23
  // choice. `no-software` builds placeholder software for validators.
24
+ //
25
+ // `cross-env` rather than a bare `VAR=value` prefix or `env`: package scripts run through cmd.exe
26
+ // on Windows, which has neither. Without it every one of these dies with "'env' is not recognized".
24
27
 
25
28
  const BUILD_SCRIPTS: Record<string, string> = {
26
29
  "build:dev-local":
27
- "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
30
+ "cross-env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
28
31
  "build:dev-remote":
29
- "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
30
- "build:dev-no-software": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
32
+ "cross-env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
33
+ "build:dev-no-software": "cross-env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
31
34
  "build:dev-binary-existing":
32
- "env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
35
+ "cross-env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
33
36
  "build:release":
34
- "env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
37
+ "cross-env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
35
38
  };
36
39
 
37
40
  // `test` / `test:dry-run` run the build-then-test DAG in the dev-binary-local target; the live
38
41
  // backend's env reaches the integration tests via the turbo `test` task's passThroughEnv.
39
42
  const TEST_SCRIPTS: Record<string, string> = {
40
- test: `env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1`,
41
- "test:dry-run": `env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json`,
43
+ test: `cross-env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1`,
44
+ "test:dry-run": `cross-env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json`,
42
45
  };
43
46
 
44
47
  export function rootPackageJsonInitial(): Record<string, unknown> {
@@ -70,6 +73,7 @@ export function rootPackageJsonInitial(): Record<string, unknown> {
70
73
  "@changesets/cli": "catalog:",
71
74
  "@milaboratories/ts-builder": "sdk:",
72
75
  "@platforma-sdk/block-tools": "sdk:",
76
+ "cross-env": "catalog:",
73
77
  shx: "catalog:",
74
78
  turbo: "catalog:",
75
79
  },
@@ -135,6 +139,7 @@ export function rootPackageJsonRules(): void {
135
139
  "@changesets/cli": "catalog:",
136
140
  "@milaboratories/ts-builder": "sdk:",
137
141
  "@platforma-sdk/block-tools": "sdk:",
142
+ "cross-env": "catalog:",
138
143
  shx: "catalog:",
139
144
  turbo: "catalog:",
140
145
  });
@@ -22,6 +22,7 @@
22
22
  import {
23
23
  ensureCatalogAbsent,
24
24
  ensureCatalogAtLeast,
25
+ ensureCatalogVersion,
25
26
  ensureWorkspaceListItems,
26
27
  ensureWorkspaceMapEntries,
27
28
  ensureWorkspaceModulePaths,
@@ -77,6 +78,7 @@ for (const name of SDK_CATALOG_PACKAGES) {
77
78
  export const INFRA_CATALOG_FLOOR: Record<string, string> = {
78
79
  turbo: TURBO_VERSION,
79
80
  shx: "~0.4.0",
81
+ "cross-env": "~10.1.0",
80
82
  "@changesets/cli": "~2.29.8",
81
83
  vitest: "~4.0.18",
82
84
  typescript: "~5.9.3",
@@ -137,6 +139,17 @@ export function rootPnpmWorkspaceRules(): void {
137
139
  ensureWorkspaceListItems("minimumReleaseAgeExclude", MINIMUM_RELEASE_AGE_EXCLUDE);
138
140
  ensureWorkspaceMapEntries("allowBuilds", SKIPPED_BUILDS, { keepExisting: true });
139
141
  ensureWorkspaceMapEntries("allowBuilds", REQUIRED_BUILDS);
142
+ // Curated infra floor, ADD-IF-ABSENT. This runs on EVERY refresh, not just
143
+ // init/update-deps, because the package.json rules hand out `catalog:`
144
+ // references for these on every refresh too (root devDeps: turbo, shx,
145
+ // cross-env, …). Seeding only on init/update-deps left a default refresh
146
+ // writing a `catalog:` for a key the catalog did not yet carry, and
147
+ // `pnpm install` then failed with ERR_PNPM_CATALOG_ENTRY_NOT_FOUND_FOR_SPEC.
148
+ // Add-if-absent keeps the refresh contract intact: a version the block
149
+ // already pins is never touched, and a seeded key is a fixpoint.
150
+ for (const [name, version] of Object.entries(INFRA_CATALOG_FLOOR)) {
151
+ ensureCatalogVersion(name, version);
152
+ }
140
153
  ensureCatalogAtLeast("turbo", TURBO_VERSION);
141
154
  // Catalog side of the retired-dep cleanup — the per-package side sheds the
142
155
  // matching `catalog:` references.