gagen 0.2.2 → 0.2.3

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/README.md CHANGED
@@ -18,7 +18,6 @@ import {
18
18
  conditions,
19
19
  createWorkflow,
20
20
  step,
21
- steps,
22
21
  } from "gagen";
23
22
 
24
23
  const checkout = step({
@@ -34,7 +33,7 @@ const installDeno = step({
34
33
  uses: "denoland/setup-deno@v2",
35
34
  });
36
35
 
37
- const lint = steps(
36
+ const lint = step(
38
37
  {
39
38
  name: "Clippy",
40
39
  run: "cargo clippy",
@@ -19,6 +19,7 @@ export declare class ExpressionValue {
19
19
  notEquals(value: string | number | boolean): Condition;
20
20
  startsWith(prefix: string): Condition;
21
21
  contains(substring: string): Condition;
22
+ not(): Condition;
22
23
  /** wrap in `${{ }}` for use in YAML */
23
24
  toString(): string;
24
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../src/expression.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAIvD,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,eAAe,CAAC;AAEvE;;;GAGG;AACH,qBAAa,eAAe;;IAE1B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;gBAI5C,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAa3D,sDAAsD;IACtD,IAAI,UAAU,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAE9C;IAED,oDAAoD;IACpD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS;IASnD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG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AgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAGtE;AAED,wBAAgB,WAAW,CACzB,GAAG,WAAW,EAAE,CAAC;IAAE,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAAE,GAAG,SAAS,CAAC,EAAE,GAC5D,WAAW,CAAC,gBAAgB,CAAC,CAY/B;AAcD,UAAU,aAAa;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;CACrB;AA+BD;;;GAGG;AACH,qBAAa,WAAW;;gBAKpB,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE,WAAW,CAAC,gBAAgB,CAAC;IAOxC,sCAAsC;IACtC,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa;IAI3C;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe;CAiB3C;AAED;;;GAGG;AACH,qBAAa,aAAa;;gBAMtB,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE,GAAG,CAAC,gBAAgB,CAAC,EAC9B,SAAS,EAAE,SAAS;IAQtB,yCAAyC;IACzC,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW;CAMvC"}
package/esm/expression.js CHANGED
@@ -56,6 +56,9 @@ export class ExpressionValue {
56
56
  contains(substring) {
57
57
  return new FunctionCallCondition("contains", [__classPrivateFieldGet(this, _ExpressionValue_expression, "f"), formatLiteral(substring)], sourcesFrom(this));
58
58
  }
59
+ not() {
60
+ return new RawCondition(`!(${__classPrivateFieldGet(this, _ExpressionValue_expression, "f")})`, sourcesFrom(this));
61
+ }
59
62
  /** wrap in `${{ }}` for use in YAML */
60
63
  toString() {
61
64
  return `\${{ ${__classPrivateFieldGet(this, _ExpressionValue_expression, "f")} }}`;
package/esm/job.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type ExpressionSource, ExpressionValue } from "./expression.js";
2
2
  import type { Permissions } from "./permissions.js";
3
- import { type ConditionLike, type ConfigValue, Step, StepGroup, type StepLike } from "./step.js";
3
+ import { type ConditionLike, type ConfigValue, Step, type StepLike } from "./step.js";
4
4
  interface CommonJobFields {
5
5
  name?: string | ExpressionValue;
6
6
  needs?: Job[];
@@ -51,7 +51,7 @@ export interface ReusableJobConfig extends CommonJobFields {
51
51
  export type JobConfig = StepsJobConfig | ReusableJobConfig;
52
52
  export interface StepsJobDef extends StepsJobConfig {
53
53
  id?: string;
54
- steps: StepLike[] | StepGroup;
54
+ steps: StepLike | StepLike[];
55
55
  outputs?: Record<string, ExpressionValue>;
56
56
  }
57
57
  export interface ReusableJobDef extends ReusableJobConfig {
package/esm/job.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACrB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,WAAW,EAGhB,IAAI,EACJ,SAAS,EACT,KAAK,QAAQ,EAId,MAAM,WAAW,CAAC;AAEnB,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAChC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,EAAE,CAAC,EAAE,aAAa,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC;CACtE;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAA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AC,MAAM,EAAE,eAAe,CAAC,CAAC;KAC3C;IAuBH,IAAI,EAAE,IAAI,MAAM,CAEf;IAkCD,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;IA2B9B,UAAU,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE;IAgDxD,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAqJvE;AA2iBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQhD;AAID,wBAAgB,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAUnD"}
package/esm/job.js CHANGED
@@ -12,81 +12,170 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _Job_instances, _Job_id, _Job_config, _Job_leafItems, _Job_outputDefs, _Job_cachedGraph, _Job_cachedLeafSteps, _Job_buildGraph;
13
13
  import { Condition, ExpressionValue, } from "./expression.js";
14
14
  import { Matrix } from "./matrix.js";
15
- import { serializeConditionLike, serializeConfigValues, Step, StepGroup, StepRef, toCondition, unwrapSteps, } from "./step.js";
15
+ import { serializeConditionLike, serializeConfigValues, Step, StepRef, toCondition, unwrapSteps, } from "./step.js";
16
16
  function ensureEntry(graph, step) {
17
17
  let entry = graph.get(step);
18
18
  if (!entry) {
19
- entry = { deps: new Set(), afterDeps: new Set() };
19
+ entry = { deps: new Set(), afterDeps: new Set(), contexts: [] };
20
20
  graph.set(step, entry);
21
21
  }
22
22
  return entry;
23
23
  }
24
- /** Adds a condition to a graph entry, ANDing with any existing condition. */
25
- function addEntryCondition(entry, condition) {
26
- if (entry.condition != null) {
27
- entry.condition = toCondition(condition).and(toCondition(entry.condition));
24
+ /**
25
+ * Records a context condition for a graph entry. Contexts from multiple
26
+ * encounters are collected and combined later (via combineContexts) to
27
+ * properly factor out shared terms. An undefined context means
28
+ * unconditional and dominates any condition.
29
+ */
30
+ function applyContextCondition(entry, context) {
31
+ if (entry.hasUnconditionalContext)
32
+ return;
33
+ if (context == null) {
34
+ entry.contexts = [];
35
+ entry.hasUnconditionalContext = true;
36
+ return;
37
+ }
38
+ entry.contexts.push(context);
39
+ }
40
+ /**
41
+ * Combines the collected context conditions for a graph entry into a single
42
+ * condition. Factors out common AND-terms so that shared conditions (like
43
+ * `!(matrix.skip)`) appear once rather than being duplicated in each OR branch.
44
+ */
45
+ function combineContexts(entry) {
46
+ if (entry.hasUnconditionalContext || entry.contexts.length === 0) {
47
+ return undefined;
28
48
  }
29
- else {
30
- entry.condition = condition;
49
+ if (entry.contexts.length === 1) {
50
+ return toCondition(entry.contexts[0]);
51
+ }
52
+ const conditions = entry.contexts.map((c) => toCondition(c));
53
+ return simplifyOrConditions(conditions) ?? undefined;
54
+ }
55
+ /** ANDs two optional conditions together (for nesting StepRef conditions). */
56
+ function combineAndConditions(a, b) {
57
+ if (a != null && b != null)
58
+ return toCondition(a).and(toCondition(b));
59
+ return a ?? b;
60
+ }
61
+ /**
62
+ * Returns a step's config.if as a ConditionLike suitable for passing down
63
+ * to dependencies, or undefined if it references step outputs (which would
64
+ * create circular condition dependencies).
65
+ */
66
+ function propagatableConfigIf(step) {
67
+ const configIf = step.config.if;
68
+ if (configIf == null)
69
+ return undefined;
70
+ if (configIf instanceof Condition) {
71
+ for (const source of configIf.sources) {
72
+ if (source instanceof Step)
73
+ return undefined;
74
+ }
75
+ }
76
+ if (configIf instanceof ExpressionValue) {
77
+ for (const source of configIf.allSources) {
78
+ if (source instanceof Step)
79
+ return undefined;
80
+ }
31
81
  }
82
+ return configIf;
32
83
  }
33
84
  /**
34
85
  * Recursively flattens a StepLike tree into a flat graph of Steps with
35
86
  * per-job dependencies and conditions. Returns the leaf-level Steps that
36
- * were contributed, so parent StepGroups can apply their modifiers.
87
+ * were contributed, so parent composite steps can apply their modifiers.
88
+ *
89
+ * Context conditions are accumulated top-down via AND (nesting) and applied
90
+ * at leaf steps via OR (multiple encounters from different paths).
37
91
  *
38
92
  * afterDependencies (comesAfter) are NOT flattened into the graph — they are
39
93
  * collected in `deferredAfterDeps` and resolved later, so that comesAfter
40
94
  * only adds ordering edges for steps already present in the graph.
41
95
  */
42
- function flattenStepLike(item, graph, isLeaf, leafSteps, deferredAfterDeps) {
43
- if (item instanceof Step) {
44
- ensureEntry(graph, item);
45
- if (isLeaf)
46
- leafSteps.push(item);
47
- return [item];
48
- }
49
- else if (item instanceof StepRef) {
96
+ function flattenStepLike(item, graph, isLeaf, leafSteps, deferredAfterDeps, contextCondition) {
97
+ if (item instanceof StepRef) {
50
98
  const step = item.step;
99
+ // AND this StepRef's condition with the parent context
100
+ const newContext = combineAndConditions(contextCondition, item.condition);
101
+ if (step.children.length > 0) {
102
+ // StepRef wrapping composite step: recurse with combined context
103
+ const contributed = [];
104
+ for (const child of step.children) {
105
+ contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, newContext));
106
+ }
107
+ // compute aggregate dep context: newContext AND (OR of children's
108
+ // config.ifs). If any child is unconditional, or the OR is a tautology,
109
+ // just use newContext.
110
+ let compositeDepsCtx = newContext;
111
+ if (item.dependencies.length > 0) {
112
+ const childIfs = [];
113
+ let allConditional = true;
114
+ for (const s of contributed) {
115
+ const cif = propagatableConfigIf(s);
116
+ if (cif == null) {
117
+ allConditional = false;
118
+ break;
119
+ }
120
+ childIfs.push(cif);
121
+ }
122
+ if (allConditional && childIfs.length > 0) {
123
+ const orCond = simplifyOrConditions(childIfs.map((c) => toCondition(c)));
124
+ if (orCond != null) {
125
+ compositeDepsCtx = combineAndConditions(newContext, orCond);
126
+ }
127
+ }
128
+ }
129
+ // apply deps once with aggregate context, add to all children's dep sets
130
+ for (const dep of item.dependencies) {
131
+ const depSteps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, compositeDepsCtx);
132
+ for (const s of contributed) {
133
+ const entry = graph.get(s);
134
+ for (const ds of depSteps)
135
+ entry.deps.add(ds);
136
+ }
137
+ }
138
+ for (const s of contributed) {
139
+ for (const dep of item.afterDependencies) {
140
+ deferredAfterDeps.push({ step: s, target: dep });
141
+ }
142
+ }
143
+ return contributed;
144
+ }
145
+ // StepRef wrapping leaf step
51
146
  const entry = ensureEntry(graph, step);
52
147
  if (isLeaf)
53
148
  leafSteps.push(step);
54
- if (item.condition != null) {
55
- addEntryCondition(entry, item.condition);
56
- }
149
+ applyContextCondition(entry, newContext);
150
+ // include step's config.if in the dep context
151
+ const depContext = combineAndConditions(newContext, propagatableConfigIf(step));
57
152
  for (const dep of item.dependencies) {
58
- flattenDep(dep, entry.deps, graph, deferredAfterDeps);
153
+ flattenDep(dep, entry.deps, graph, deferredAfterDeps, depContext);
59
154
  }
60
155
  for (const dep of item.afterDependencies) {
61
156
  deferredAfterDeps.push({ step, target: dep });
62
157
  }
63
158
  return [step];
64
159
  }
65
- else {
66
- // StepGroup: recursively flatten children, then apply group modifiers
160
+ // Step (leaf or composite)
161
+ if (item.children.length > 0) {
162
+ // composite step: recurse into children with same context
67
163
  const contributed = [];
68
- for (const s of item.all) {
69
- contributed.push(...flattenStepLike(s, graph, isLeaf, leafSteps, deferredAfterDeps));
70
- }
71
- // apply group-level modifiers to all contributed steps
72
- for (const step of contributed) {
73
- const entry = graph.get(step);
74
- if (item.condition != null) {
75
- addEntryCondition(entry, item.condition);
76
- }
77
- for (const dep of item.dependencies) {
78
- flattenDep(dep, entry.deps, graph, deferredAfterDeps);
79
- }
80
- for (const dep of item.afterDependencies) {
81
- deferredAfterDeps.push({ step, target: dep });
82
- }
164
+ for (const child of item.children) {
165
+ contributed.push(...flattenStepLike(child, graph, isLeaf, leafSteps, deferredAfterDeps, contextCondition));
83
166
  }
84
167
  return contributed;
85
168
  }
169
+ // leaf step
170
+ const entry = ensureEntry(graph, item);
171
+ if (isLeaf)
172
+ leafSteps.push(item);
173
+ applyContextCondition(entry, contextCondition);
174
+ return [item];
86
175
  }
87
176
  /** Flattens a dependency target into the graph and adds it to a dep set. */
88
- function flattenDep(dep, targetSet, graph, deferredAfterDeps) {
89
- const steps = flattenStepLike(dep, graph, false, [], deferredAfterDeps);
177
+ function flattenDep(dep, targetSet, graph, deferredAfterDeps, contextCondition) {
178
+ const steps = flattenStepLike(dep, graph, false, [], deferredAfterDeps, contextCondition);
90
179
  for (const s of steps) {
91
180
  targetSet.add(s);
92
181
  }
@@ -101,7 +190,7 @@ function addConditionSourceDeps(graph) {
101
190
  while (changed) {
102
191
  changed = false;
103
192
  for (const [step, entry] of [...graph]) {
104
- for (const cond of [step.config.if, entry.condition]) {
193
+ for (const cond of [step.config.if, ...entry.contexts]) {
105
194
  if (!(cond instanceof Condition))
106
195
  continue;
107
196
  for (const source of cond.sources) {
@@ -338,9 +427,9 @@ export class Job {
338
427
  result.outputs = outputs;
339
428
  }
340
429
  // steps
341
- const { graph, leafSteps } = __classPrivateFieldGet(this, _Job_instances, "m", _Job_buildGraph).call(this);
430
+ const { graph } = __classPrivateFieldGet(this, _Job_instances, "m", _Job_buildGraph).call(this);
342
431
  const resolvedSteps = this.resolveSteps();
343
- const effectiveConditions = computeEffectiveConditions(resolvedSteps, leafSteps, graph);
432
+ const effectiveConditions = computeEffectiveConditions(resolvedSteps, graph);
344
433
  result.steps = resolvedSteps.map((s) => {
345
434
  return s.toYaml(effectiveConditions.get(s));
346
435
  });
@@ -371,106 +460,31 @@ _Job_id = new WeakMap(), _Job_config = new WeakMap(), _Job_leafItems = new WeakM
371
460
  __classPrivateFieldSet(this, _Job_cachedLeafSteps, leafSteps, "f");
372
461
  return { graph, leafSteps };
373
462
  };
374
- // --- condition propagation ---
375
- function computeEffectiveConditions(sortedSteps, leafSteps, graph) {
376
- const posMap = new Map();
377
- for (let i = 0; i < sortedSteps.length; i++) {
378
- posMap.set(sortedSteps[i], i);
379
- }
380
- // build dependents map: for each step, which steps depend on it
381
- const dependents = new Map();
382
- const addDependent = (dep, s) => {
383
- let set = dependents.get(dep);
384
- if (!set) {
385
- set = new Set();
386
- dependents.set(dep, set);
387
- }
388
- set.add(s);
389
- };
390
- for (const s of sortedSteps) {
391
- const entry = graph.get(s);
392
- for (const dep of entry.deps) {
393
- if (posMap.has(dep)) {
394
- addDependent(dep, s);
395
- }
396
- }
397
- }
398
- // steps explicitly passed as leaves should not receive propagated
399
- // conditions — the user declared them directly, so they keep their own if
400
- const leafSet = new Set(leafSteps);
401
- // compute effective conditions in reverse topo order
463
+ // --- effective conditions ---
464
+ /**
465
+ * Computes effective conditions for all steps. Each step's effective condition
466
+ * is the combination of its collected context conditions (OR'd together,
467
+ * simplified) AND'd with its intrinsic config.if.
468
+ *
469
+ * Context conditions are collected during the tree walk they flow DOWN
470
+ * from parent groups and StepRef conditions through dependencies, so shared
471
+ * top-level conditions like `!(matrix.skip)` naturally stay factored out.
472
+ */
473
+ function computeEffectiveConditions(steps, graph) {
402
474
  const effective = new Map();
403
- for (let i = sortedSteps.length - 1; i >= 0; i--) {
404
- const s = sortedSteps[i];
475
+ for (const s of steps) {
405
476
  const entry = graph.get(s);
406
- const ownIf = getOwnCondition(s.config.if, entry.condition);
407
- if (leafSet.has(s)) {
408
- // explicitly added by user no propagation
409
- effective.set(s, ownIf);
410
- continue;
411
- }
412
- const deps = dependents.get(s);
413
- if (!deps || deps.size === 0) {
414
- effective.set(s, ownIf);
415
- continue;
416
- }
417
- // collect propagatable conditions from dependents
418
- const depConditions = [];
419
- let mustAlwaysRun = false;
420
- for (const d of deps) {
421
- const dEffective = effective.get(d);
422
- if (dEffective == null) {
423
- // dependent has no effective condition — step must always run
424
- mustAlwaysRun = true;
425
- break;
426
- }
427
- // check if the condition can propagate to this position
428
- if (!canPropagateTo(dEffective, i, posMap)) {
429
- // condition references steps at or after this position
430
- mustAlwaysRun = true;
431
- break;
432
- }
433
- depConditions.push(dEffective);
434
- }
435
- const propagated = mustAlwaysRun
436
- ? undefined
437
- : simplifyOrConditions(depConditions);
438
- if (mustAlwaysRun) {
439
- effective.set(s, ownIf);
440
- }
441
- else if (propagated != null && ownIf != null) {
442
- effective.set(s, deduplicateAndTerms(propagated.and(ownIf)));
477
+ const ctx = combineContexts(entry);
478
+ const configIf = s.config.if != null ? toCondition(s.config.if) : undefined;
479
+ if (ctx != null && configIf != null) {
480
+ effective.set(s, deduplicateAndTerms(ctx.and(configIf)));
443
481
  }
444
482
  else {
445
- effective.set(s, propagated ?? ownIf);
483
+ effective.set(s, ctx ?? configIf);
446
484
  }
447
485
  }
448
486
  return effective;
449
487
  }
450
- /** Combines config.if (intrinsic) with context condition (per-job). */
451
- function getOwnCondition(configIf, contextCondition) {
452
- const configCond = configIf != null ? toCondition(configIf) : undefined;
453
- const ctxCond = contextCondition != null
454
- ? toCondition(contextCondition)
455
- : undefined;
456
- if (configCond != null && ctxCond != null) {
457
- return ctxCond.and(configCond);
458
- }
459
- return ctxCond ?? configCond;
460
- }
461
- // a condition can propagate backward to a step at targetPos only if none of
462
- // the condition's Step sources are at or after that position
463
- function canPropagateTo(condition, targetPos, posMap) {
464
- for (const source of condition.sources) {
465
- if (source instanceof Step) {
466
- const pos = posMap.get(source);
467
- if (pos !== undefined && pos >= targetPos) {
468
- return false;
469
- }
470
- }
471
- }
472
- return true;
473
- }
474
488
  // --- condition simplification ---
475
489
  /**
476
490
  * Simplifies an array of conditions that will be OR'd together:
@@ -893,7 +907,9 @@ function collectJobSources(value, out) {
893
907
  function collectJobSourcesFromGraph(graph, out, stepOwners) {
894
908
  for (const [step, entry] of graph) {
895
909
  collectJobSources(step.config.if, out);
896
- collectJobSources(entry.condition, out);
910
+ for (const ctx of entry.contexts) {
911
+ collectJobSources(ctx, out);
912
+ }
897
913
  if (step.config.with)
898
914
  collectJobSources(step.config.with, out);
899
915
  if (step.config.env)
@@ -968,7 +984,7 @@ export function job(id, config) {
968
984
  }
969
985
  const { id: _id, steps, outputs, ...jobConfig } = config;
970
986
  return new Job(id, jobConfig, {
971
- steps: steps instanceof StepGroup ? [steps] : steps,
987
+ steps: Array.isArray(steps) ? steps : [steps],
972
988
  outputs,
973
989
  });
974
990
  }
package/esm/mod.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./_dnt.polyfills.js";
2
- export { Step, step, StepGroup, StepRef, steps } from "./step.js";
2
+ export { Step, step, StepRef } from "./step.js";
3
3
  export type { ConditionLike, ConfigValue, StepConfig, StepLike, } from "./step.js";
4
4
  export { Job, job } from "./job.js";
5
5
  export type { JobConfig, JobDef, ReusableJobConfig, ReusableJobDef, ServiceContainer, StepsJobConfig, StepsJobDef, } from "./job.js";
package/esm/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClE,YAAY,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EACV,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,UAAU,EACV,aAAa,EACb,IAAI,EACJ,eAAe,EACf,WAAW,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AW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,eAAe,CAAC"}
package/esm/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./_dnt.polyfills.js";
2
- export { Step, step, StepGroup, StepRef, steps } from "./step.js";
2
+ export { Step, step, StepRef } from "./step.js";
3
3
  export { Job, job } from "./job.js";
4
4
  export { createWorkflow, isLinting, Workflow } from "./workflow.js";
5
5
  export { Condition, conditions, ElseIfBuilder, expr, ExpressionValue, ThenBuilder, } from "./expression.js";
package/esm/step.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface StepConfig<O extends string = never> {
16
16
  readonly outputs?: readonly O[];
17
17
  }
18
18
  export declare function resetStepCounter(): void;
19
- export type StepLike = Step<string> | StepRef<string> | StepGroup;
19
+ export type StepLike = Step<string> | StepRef<string>;
20
20
  export declare class Step<O extends string = never> implements ExpressionSource {
21
21
  #private;
22
22
  readonly config: StepConfig<O>;
@@ -24,7 +24,9 @@ export declare class Step<O extends string = never> implements ExpressionSource
24
24
  [K in O]: ExpressionValue;
25
25
  };
26
26
  readonly _crossJobDeps: readonly Step<string>[];
27
+ readonly children: readonly StepLike[];
27
28
  constructor(config: StepConfig<O>, crossJobDeps?: Step<string>[]);
29
+ constructor(children: readonly StepLike[]);
28
30
  get id(): string;
29
31
  dependsOn(...deps: StepLike[]): StepRef<O>;
30
32
  comesAfter(...deps: StepLike[]): StepRef<O>;
@@ -32,6 +34,7 @@ export declare class Step<O extends string = never> implements ExpressionSource
32
34
  toYaml(effectiveIf?: Condition): Record<string, unknown>;
33
35
  }
34
36
  export declare function step<const O extends string = never>(config: StepConfig<O>): Step<O>;
37
+ export declare function step(first: Step<string> | StepRef<string> | StepConfig, second: Step<string> | StepRef<string> | StepConfig, ...rest: (Step<string> | StepRef<string> | StepConfig)[]): Step<never>;
35
38
  export declare class StepRef<O extends string = never> {
36
39
  readonly step: Step<O>;
37
40
  readonly condition?: ConditionLike;
@@ -56,21 +59,6 @@ export declare function toCondition(c: ConditionLike): Condition;
56
59
  export declare function serializeConfigValues(record: Record<string, ConfigValue>): Record<string, string | number | boolean>;
57
60
  /** Extracts the underlying Step from a StepLike (Step or StepRef). */
58
61
  export declare function unwrapStep(item: Step<string> | StepRef<string>): Step<string>;
59
- /** Extracts all underlying Steps from a StepLike (recursively for groups). */
62
+ /** Extracts all underlying leaf Steps from a StepLike (recursively for composites). */
60
63
  export declare function unwrapSteps(item: StepLike): Step<string>[];
61
- export declare class StepGroup {
62
- readonly all: readonly StepLike[];
63
- readonly condition?: ConditionLike;
64
- readonly dependencies: readonly StepLike[];
65
- readonly afterDependencies: readonly StepLike[];
66
- constructor(items: readonly StepLike[], init?: {
67
- condition?: ConditionLike;
68
- dependencies?: readonly StepLike[];
69
- afterDependencies?: readonly StepLike[];
70
- });
71
- if(condition: ConditionLike): StepGroup;
72
- dependsOn(...deps: StepLike[]): StepGroup;
73
- comesAfter(...deps: StepLike[]): StepGroup;
74
- }
75
- export declare function steps(...items: (Step<string> | StepRef<string> | StepGroup | StepConfig)[]): StepGroup;
76
64
  //# sourceMappingURL=step.d.ts.map
package/esm/step.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../src/step.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,eAAe,GAAG,MAAM,CAAC;AACjE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,eAAe,CAAC;AAEtE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK;IAClD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;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AID,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAQ/D;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,aAAa,GAAG,SAAS,CAMvD;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAClC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAM3C;AAID,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAE7E;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAM1D"}
package/esm/step.js CHANGED
@@ -17,7 +17,7 @@ export function resetStepCounter() {
17
17
  stepCounter = 0;
18
18
  }
19
19
  export class Step {
20
- constructor(config, crossJobDeps) {
20
+ constructor(configOrChildren, crossJobDeps) {
21
21
  _Step_id.set(this, void 0);
22
22
  Object.defineProperty(this, "config", {
23
23
  enumerable: true,
@@ -38,6 +38,25 @@ export class Step {
38
38
  writable: true,
39
39
  value: void 0
40
40
  });
41
+ Object.defineProperty(this, "children", {
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true,
45
+ value: void 0
46
+ });
47
+ if (Array.isArray(configOrChildren)) {
48
+ // composite step (group of children)
49
+ if (configOrChildren.length === 0) {
50
+ throw new Error("step() requires at least one step");
51
+ }
52
+ __classPrivateFieldSet(this, _Step_id, `_step_${stepCounter++}`, "f");
53
+ this.config = {};
54
+ this._crossJobDeps = Object.freeze([]);
55
+ this.outputs = {};
56
+ this.children = Object.freeze([...configOrChildren]);
57
+ return;
58
+ }
59
+ const config = configOrChildren;
41
60
  if (config.outputs?.length && !config.id) {
42
61
  throw new Error("Step with outputs must have an explicit id");
43
62
  }
@@ -53,6 +72,7 @@ export class Step {
53
72
  }
54
73
  }
55
74
  this.outputs = outputs;
75
+ this.children = Object.freeze([]);
56
76
  }
57
77
  get id() {
58
78
  return __classPrivateFieldGet(this, _Step_id, "f");
@@ -109,8 +129,20 @@ export class Step {
109
129
  }
110
130
  }
111
131
  _Step_id = new WeakMap();
112
- export function step(config) {
113
- return new Step(config);
132
+ export function step(...args) {
133
+ if (args.length === 1) {
134
+ return new Step(args[0]);
135
+ }
136
+ const children = [];
137
+ for (const item of args) {
138
+ if (item instanceof Step || item instanceof StepRef) {
139
+ children.push(item);
140
+ }
141
+ else {
142
+ children.push(new Step(item));
143
+ }
144
+ }
145
+ return new Step(children);
114
146
  }
115
147
  // --- StepRef: immutable wrapper for per-usage deps/conditions ---
116
148
  export class StepRef {
@@ -210,83 +242,11 @@ export function serializeConfigValues(record) {
210
242
  export function unwrapStep(item) {
211
243
  return item instanceof StepRef ? item.step : item;
212
244
  }
213
- /** Extracts all underlying Steps from a StepLike (recursively for groups). */
245
+ /** Extracts all underlying leaf Steps from a StepLike (recursively for composites). */
214
246
  export function unwrapSteps(item) {
215
- if (item instanceof StepGroup) {
216
- return item.all.flatMap(unwrapSteps);
217
- }
218
- return [unwrapStep(item)];
219
- }
220
- // --- step group ---
221
- export class StepGroup {
222
- constructor(items, init) {
223
- Object.defineProperty(this, "all", {
224
- enumerable: true,
225
- configurable: true,
226
- writable: true,
227
- value: void 0
228
- });
229
- Object.defineProperty(this, "condition", {
230
- enumerable: true,
231
- configurable: true,
232
- writable: true,
233
- value: void 0
234
- });
235
- Object.defineProperty(this, "dependencies", {
236
- enumerable: true,
237
- configurable: true,
238
- writable: true,
239
- value: void 0
240
- });
241
- Object.defineProperty(this, "afterDependencies", {
242
- enumerable: true,
243
- configurable: true,
244
- writable: true,
245
- value: void 0
246
- });
247
- this.all = items;
248
- this.condition = init?.condition;
249
- this.dependencies = init?.dependencies ?? [];
250
- this.afterDependencies = init?.afterDependencies ?? [];
251
- }
252
- if(condition) {
253
- const newCond = this.condition != null
254
- ? toCondition(condition).and(toCondition(this.condition))
255
- : condition;
256
- return new StepGroup(this.all, {
257
- condition: newCond,
258
- dependencies: this.dependencies,
259
- afterDependencies: this.afterDependencies,
260
- });
261
- }
262
- dependsOn(...deps) {
263
- return new StepGroup(this.all, {
264
- condition: this.condition,
265
- dependencies: [...this.dependencies, ...deps],
266
- afterDependencies: this.afterDependencies,
267
- });
268
- }
269
- comesAfter(...deps) {
270
- return new StepGroup(this.all, {
271
- condition: this.condition,
272
- dependencies: this.dependencies,
273
- afterDependencies: [...this.afterDependencies, ...deps],
274
- });
275
- }
276
- }
277
- export function steps(...items) {
278
- if (items.length === 0) {
279
- throw new Error("steps() requires at least one step");
280
- }
281
- const created = [];
282
- for (const item of items) {
283
- if (item instanceof Step || item instanceof StepRef ||
284
- item instanceof StepGroup) {
285
- created.push(item);
286
- }
287
- else {
288
- created.push(new Step(item));
289
- }
247
+ const s = unwrapStep(item);
248
+ if (s.children.length > 0) {
249
+ return s.children.flatMap(unwrapSteps);
290
250
  }
291
- return new StepGroup(created);
251
+ return [s];
292
252
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gagen",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Generate complex GitHub Actions YAML files using a declarative API.",
5
5
  "repository": {
6
6
  "type": "git",