@invarn/cibuild 2.6.9 → 2.7.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.
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { getStepExecutor, hasStep, getStepMetadata } from './steps/registry.js';
9
9
  import { EnvResolver } from './env-resolver.js';
10
+ import { shellAssignedNames } from './shell-assignments.js';
10
11
  import { detectPlatformInfo } from './platform-detector.js';
11
12
  import { declaresMultiplatformApp } from './meta-helpers.js';
12
13
  // POSIX env vars the shell always provides — don't flag these as undeclared.
@@ -30,71 +31,6 @@ const POSIX_ENV_ALLOWLIST = new Set([
30
31
  'CIBUILD_SCRATCH',
31
32
  'JAVA_HOME',
32
33
  ]);
33
- /**
34
- * Names a shell snippet assigns to itself, in every form a step script uses.
35
- *
36
- * The auto-discovery below treats every `$UPPERCASE` it finds in a step's
37
- * inputs as a value the pipeline must supply. For a `script` step the inputs
38
- * *are* the shell body, so a variable the script computes reads exactly like
39
- * one it needs handed to it — and the run is refused for a value nothing was
40
- * ever supposed to provide.
41
- *
42
- * That is not hypothetical. A generated multiplatform pipeline whose prepare
43
- * step opens with
44
- *
45
- * INTEGRATION="$KMM_IOS_INTEGRATION"
46
- * IOS_DIR=$(dirname "$IOS_PROJECT_PATH")
47
- * for WORKSPACE in "$IOS_DIR"/*.xcworkspace; do …
48
- *
49
- * was refused before step 1 on "3 required value(s) missing — INTEGRATION,
50
- * IOS_DIR, WORKSPACE", while the two variables it genuinely reads were both
51
- * declared and present. The shell was correct; the reader was not.
52
- *
53
- * Only the assignment *target* is collected, never the right-hand side, so
54
- * `INTEGRATION="$KMM_IOS_INTEGRATION"` still requires `KMM_IOS_INTEGRATION`.
55
- * That is what keeps this from becoming a hole: a script cannot excuse itself
56
- * from a value it reads by mentioning it.
57
- *
58
- * Assignment order is deliberately not modelled. A snippet that reads `$FOO`
59
- * before setting it is a bug in the snippet, and guessing about it here would
60
- * trade a false refusal for a different false refusal; "the script sets this
61
- * somewhere" is the question worth asking, and erring toward letting the build
62
- * run is the right direction for a check that cannot prompt.
63
- */
64
- export function shellAssignedNames(obj) {
65
- const names = new Set();
66
- const collect = (text) => {
67
- // `NAME=…`, `export NAME=…`, `local/readonly/declare/typeset NAME=…`, and
68
- // `NAME+=…`. Anchored to the start of a command — line start, or after a
69
- // separator — so `--flag=X` and `foo BAR=1` inside a longer word are not
70
- // mistaken for assignments.
71
- const assignment = /(?:^|[\n;&|(]|\|\||&&)[ \t]*(?:(?:export|readonly|local|declare|typeset)[ \t]+)?([A-Z_][A-Z_0-9]*)\+?=/g;
72
- // `for NAME in …`, `select NAME in …`
73
- const loop = /(?:^|[\n;&|(])[ \t]*(?:for|select)[ \t]+([A-Z_][A-Z_0-9]*)[ \t]+in\b/g;
74
- // `read NAME`, `read -r NAME OTHER`, `while read -r NAME; do`
75
- const read = /(?:^|[\n;&|(]|\|\||&&)[ \t]*(?:while[ \t]+)?read[ \t]+((?:-\S+[ \t]+)*)([A-Z_][A-Z_0-9]*(?:[ \t]+[A-Z_][A-Z_0-9]*)*)/g;
76
- for (const re of [assignment, loop]) {
77
- let m;
78
- while ((m = re.exec(text)) !== null)
79
- names.add(m[1]);
80
- }
81
- let m;
82
- while ((m = read.exec(text)) !== null) {
83
- for (const n of m[2].trim().split(/[ \t]+/))
84
- names.add(n);
85
- }
86
- };
87
- const walk = (value) => {
88
- if (typeof value === 'string')
89
- collect(value);
90
- else if (Array.isArray(value))
91
- value.forEach(walk);
92
- else if (value && typeof value === 'object')
93
- Object.values(value).forEach(walk);
94
- };
95
- walk(obj);
96
- return names;
97
- }
98
34
  /**
99
35
  * StepValidator orchestrates pre-execution validation for a workflow.
100
36
  * It iterates through all steps, collects validation requirements,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invarn/cibuild",
3
- "version": "2.6.9",
3
+ "version": "2.7.1",
4
4
  "description": "CI Build CLI — local pipeline orchestration and validation",
5
5
  "type": "module",
6
6
  "main": "dist/cli.cjs",