@intentius/chant-lexicon-gitlab 0.101.0 → 0.104.0

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.
Files changed (59) hide show
  1. package/dist/codegen/naming.d.ts.map +1 -1
  2. package/dist/components/generate-pipeline.d.ts.map +1 -1
  3. package/dist/composites/node-pipeline.d.ts +16 -16
  4. package/dist/composites/node-pipeline.d.ts.map +1 -1
  5. package/dist/generated/index.d.ts +19 -19
  6. package/dist/generated/index.d.ts.map +1 -1
  7. package/dist/import/generator.d.ts.map +1 -1
  8. package/dist/import/parser.d.ts.map +1 -1
  9. package/dist/integrity.json +10 -10
  10. package/dist/intrinsics.d.ts.map +1 -1
  11. package/dist/lint/post-synth/wgl013.d.ts +3 -1
  12. package/dist/lint/post-synth/wgl013.d.ts.map +1 -1
  13. package/dist/lint/post-synth/wgl017.d.ts.map +1 -1
  14. package/dist/lint/post-synth/wgl020.d.ts.map +1 -1
  15. package/dist/lint/post-synth/wgl021.d.ts.map +1 -1
  16. package/dist/lint/post-synth/wgl050.d.ts.map +1 -1
  17. package/dist/lint/post-synth/yaml-helpers.d.ts +57 -8
  18. package/dist/lint/post-synth/yaml-helpers.d.ts.map +1 -1
  19. package/dist/manifest.json +1 -1
  20. package/dist/migrate/from-github/provenance.d.ts.map +1 -1
  21. package/dist/op/builders.d.ts.map +1 -1
  22. package/dist/rules/wgl013.ts +4 -2
  23. package/dist/rules/wgl017.ts +3 -11
  24. package/dist/rules/wgl020.ts +4 -5
  25. package/dist/rules/wgl021.ts +4 -5
  26. package/dist/rules/wgl048.ts +2 -2
  27. package/dist/rules/wgl049.ts +4 -4
  28. package/dist/rules/wgl050.ts +5 -8
  29. package/dist/rules/yaml-helpers.ts +176 -113
  30. package/dist/variables.d.ts.map +1 -1
  31. package/package.json +4 -4
  32. package/src/components/__fixtures__/pr-loop.gitlab.golden.yml +43 -0
  33. package/src/components/generate-op-pipeline.ts +4 -4
  34. package/src/components/generate-pipeline.test.ts +33 -0
  35. package/src/components/generate-pipeline.ts +117 -11
  36. package/src/components/generate-pr-pipeline.test.ts +70 -0
  37. package/src/lint/post-synth/post-synth.test.ts +29 -0
  38. package/src/lint/post-synth/wgl013.test.ts +53 -0
  39. package/src/lint/post-synth/wgl013.ts +4 -2
  40. package/src/lint/post-synth/wgl014.test.ts +23 -0
  41. package/src/lint/post-synth/wgl015.test.ts +35 -0
  42. package/src/lint/post-synth/wgl017.test.ts +14 -0
  43. package/src/lint/post-synth/wgl017.ts +3 -11
  44. package/src/lint/post-synth/wgl020.test.ts +26 -0
  45. package/src/lint/post-synth/wgl020.ts +4 -5
  46. package/src/lint/post-synth/wgl021.test.ts +29 -0
  47. package/src/lint/post-synth/wgl021.ts +4 -5
  48. package/src/lint/post-synth/wgl028.test.ts +27 -0
  49. package/src/lint/post-synth/wgl042.test.ts +14 -0
  50. package/src/lint/post-synth/wgl048.test.ts +14 -0
  51. package/src/lint/post-synth/wgl048.ts +2 -2
  52. package/src/lint/post-synth/wgl049.test.ts +25 -0
  53. package/src/lint/post-synth/wgl049.ts +4 -4
  54. package/src/lint/post-synth/wgl050.test.ts +16 -0
  55. package/src/lint/post-synth/wgl050.ts +5 -8
  56. package/src/lint/post-synth/yaml-helpers.test.ts +249 -0
  57. package/src/lint/post-synth/yaml-helpers.ts +176 -113
  58. package/src/migrate/from-github/fixtures/syntax-mapping/03-matrix/expected.gitlab-ci.yml +3 -1
  59. package/src/serializer.ts +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/codegen/naming.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,IAAI,kBAAkB,EAGrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAsC,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA8BnF;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;gBACxC,OAAO,EAAE,iBAAiB,EAAE;CAOzC"}
1
+ {"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/codegen/naming.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,cAAc,IAAI,kBAAkB,EAGrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAsC,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA8BnF;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;IACpD,YAAY,OAAO,EAAE,iBAAiB,EAAE,EAMvC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGjG,OAAO,KAAK,EACV,oBAAoB,IAAI,YAAY,EACpC,wBAAwB,IAAI,qBAAqB,EACjD,uBAAuB,IAAI,oBAAoB,EAEhD,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;AAS1E;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA8ItB"}
1
+ {"version":3,"file":"generate-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/generate-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAKjG,OAAO,KAAK,EACV,oBAAoB,IAAI,YAAY,EACpC,wBAAwB,IAAI,qBAAqB,EACjD,uBAAuB,IAAI,oBAAoB,EAEhD,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;AAS1E;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAsJtB"}
@@ -28,18 +28,18 @@ export declare const NodePipeline: import("@intentius/chant").CompositeDefinitio
28
28
  }>;
29
29
  /** NodePipeline preset for Bun projects. */
30
30
  export declare const BunPipeline: import("@intentius/chant").CompositeDefinition<{
31
+ nodeVersion?: string;
32
+ packageManager?: "npm" | "pnpm" | "bun";
33
+ buildScript?: string;
34
+ testScript?: string;
35
+ buildArtifactPaths?: string[];
36
+ artifactExpiry?: string;
37
+ installCommand?: string;
31
38
  defaults?: {
32
39
  defaults?: Partial<ConstructorParameters<typeof Default>[0]>;
33
40
  build?: Partial<ConstructorParameters<typeof Job>[0]>;
34
41
  test?: Partial<ConstructorParameters<typeof Job>[0]>;
35
- } | undefined;
36
- nodeVersion?: string | undefined;
37
- installCommand?: string | undefined;
38
- buildScript?: string | undefined;
39
- buildArtifactPaths?: string[] | undefined;
40
- artifactExpiry?: string | undefined;
41
- testScript?: string | undefined;
42
- packageManager?: "npm" | "pnpm" | "bun" | undefined;
42
+ };
43
43
  }, {
44
44
  defaults: import("@intentius/chant").Declarable & Record<string, string>;
45
45
  build: import("@intentius/chant").Declarable & Record<string, string>;
@@ -47,18 +47,18 @@ export declare const BunPipeline: import("@intentius/chant").CompositeDefinition
47
47
  }>;
48
48
  /** NodePipeline preset for pnpm projects. */
49
49
  export declare const PnpmPipeline: import("@intentius/chant").CompositeDefinition<{
50
+ nodeVersion?: string;
51
+ packageManager?: "npm" | "pnpm" | "bun";
52
+ buildScript?: string;
53
+ testScript?: string;
54
+ buildArtifactPaths?: string[];
55
+ artifactExpiry?: string;
56
+ installCommand?: string;
50
57
  defaults?: {
51
58
  defaults?: Partial<ConstructorParameters<typeof Default>[0]>;
52
59
  build?: Partial<ConstructorParameters<typeof Job>[0]>;
53
60
  test?: Partial<ConstructorParameters<typeof Job>[0]>;
54
- } | undefined;
55
- nodeVersion?: string | undefined;
56
- installCommand?: string | undefined;
57
- buildScript?: string | undefined;
58
- buildArtifactPaths?: string[] | undefined;
59
- artifactExpiry?: string | undefined;
60
- testScript?: string | undefined;
61
- packageManager?: "npm" | "pnpm" | "bun" | undefined;
61
+ };
62
62
  }, {
63
63
  defaults: import("@intentius/chant").Declarable & Record<string, string>;
64
64
  build: import("@intentius/chant").Declarable & Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"node-pipeline.d.ts","sourceRoot":"","sources":["../../src/composites/node-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,OAAO,EAA2B,MAAM,cAAc,CAAC;AAGrE,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IACxC,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,EAAE;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,KAAK,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,EAAE,OAAO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AAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACtD;;;;;EAmFsF,CAAC;AAE1F,6CAA6C;AAC7C,eAAO,MAAM,YAAY;kBAxGT,MAAM;qBAEH,KAAK,GAAG,MAAM,GAAG,KAAK;kBAEzB,MAAM;iBAEP,MAAM;yBAEE,MAAM,EAAE;qBAEZ,MAAM;qBAEN,MAAM;eAEZ;QACT,QAAQ,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,KAAK,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtD,IAAI,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACtD;;;;;EAsFwF,CAAC"}
@@ -1,22 +1,22 @@
1
- export declare const Default: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, string>;
2
- export declare const Job: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, string>;
3
- export declare const Workflow: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, string>;
4
- export declare const AllowFailure: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
5
- export declare const Artifacts: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
6
- export declare const AutoCancel: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
7
- export declare const Cache: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
8
- export declare const Environment: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
9
- export declare const Image: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
10
- export declare const Include: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
11
- export declare const Inherit: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
12
- export declare const Need: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
13
- export declare const Parallel: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
14
- export declare const Release: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
15
- export declare const Retry: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
16
- export declare const Rule: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
17
- export declare const Service: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
18
- export declare const Trigger: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
19
- export declare const WorkflowRule: new (props: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, unknown>;
1
+ export declare const Default: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, string>;
2
+ export declare const Job: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, string>;
3
+ export declare const Workflow: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, string>;
4
+ export declare const AllowFailure: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
5
+ export declare const Artifacts: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
6
+ export declare const AutoCancel: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
7
+ export declare const Cache: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
8
+ export declare const Environment: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
9
+ export declare const Image: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
10
+ export declare const Include: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
11
+ export declare const Inherit: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
12
+ export declare const Need: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
13
+ export declare const Parallel: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
14
+ export declare const Release: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
15
+ export declare const Retry: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
16
+ export declare const Rule: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
17
+ export declare const Service: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
18
+ export declare const Trigger: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
19
+ export declare const WorkflowRule: new (props: Record<string, unknown>) => import("@intentius/chant").Declarable & Record<string, unknown>;
20
20
  export { reference } from "../intrinsics.js";
21
21
  export { CI } from "../variables.js";
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generated/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,+IAAsD,CAAC;AAC3E,eAAO,MAAM,GAAG,+IAAkD,CAAC;AACnE,eAAO,MAAM,QAAQ,+IAAuD,CAAC;AAE7E,eAAO,MAAM,YAAY,0GAAuD,CAAC;AACjF,eAAO,MAAM,SAAS,0GAAoD,CAAC;AAC3E,eAAO,MAAM,UAAU,0GAAqD,CAAC;AAC7E,eAAO,MAAM,KAAK,0GAAgD,CAAC;AACnE,eAAO,MAAM,WAAW,0GAAsD,CAAC;AAC/E,eAAO,MAAM,KAAK,0GAAgD,CAAC;AACnE,eAAO,MAAM,OAAO,0GAAkD,CAAC;AACvE,eAAO,MAAM,OAAO,0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;AAGjF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/import/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AAsC7E;;GAEG;AACH,qBAAa,eAAgB,YAAW,mBAAmB;IACzD,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE;IA4DzC,OAAO,CAAC,yBAAyB;IAYjC,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,SAAS;IA2BjB,OAAO,CAAC,WAAW;CA2BpB"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/import/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AAsC7E;;GAEG;AACH,qBAAa,eAAgB,YAAW,mBAAmB;IACzD,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE,CA0DxC;IAED,OAAO,CAAC,yBAAyB;IAYjC,OAAO,CAAC,SAAS;IAejB,OAAO,CAAC,SAAS;IA2BjB,OAAO,CAAC,WAAW;CA2BpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AA6B7F;;GAEG;AACH,qBAAa,YAAa,YAAW,cAAc;IACjD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;CA6DnC"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAc,MAAM,gCAAgC,CAAC;AA6B7F;;GAEG;AACH,qBAAa,YAAa,YAAW,cAAc;IACjD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CA4DjC;CACF"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "4530312d037a2e9c9a5bd56217ad4f04c96663f8771101488fcabcf0238b718e",
4
+ "manifest.json": "ef6e7a167965f693557802a8211365e1dee13712ef42ac41e276e9b3528dc307",
5
5
  "meta.json": "931fc3246a55645b1493080bbeb160e5d205e42349e8bdca96ca243adb5f0da3",
6
6
  "types/index.d.ts": "5cd2e99f135a929b72bdd822d00d780d39b1cd407ba0cfb3d511c7ac9d667b58",
7
7
  "rules/artifact-no-expiry.ts": "3f3cabf9792cbf8207e53a25f506715466b19ec25e9c3b4d0d77fed6b2eb4542",
@@ -12,15 +12,15 @@
12
12
  "rules/wgl010.ts": "e9a14d5f9e4c49b1524ba5ee3746be739603125ec3c2dc4eb4b7c0bfc32581b0",
13
13
  "rules/wgl011.ts": "2fbb164669204ac8c3662b9c1ae156b59589913e59dd596fb38f289a0f218aaf",
14
14
  "rules/wgl012.ts": "ec4bd3fe93d30824c74223bb4e5929e493a06561a7bd3265b68dc1ba5d734da4",
15
- "rules/wgl013.ts": "f1309b1c048c00684181b9488a633f44068b537fd743ac21b0ae2712478158ba",
15
+ "rules/wgl013.ts": "afde3fb528dc9d8a245ec35f0da2ffb8460224956eb986412bef7e9e3891e378",
16
16
  "rules/wgl014.ts": "acbbeec029ec7f23e74cebcd4965dae12ea991a5a29e754040edd4a0c3fd8f0c",
17
17
  "rules/wgl015.ts": "040da46b2fe8126ba18c8d44957b402a710537eca0dc05d885498022ccec006a",
18
18
  "rules/wgl016.ts": "d8bf9a371b22f37a767f92e3361d5f8e064e6dd6ba879ff1a5fc90b4b09fd304",
19
- "rules/wgl017.ts": "2d212de62eee4f7b086b49c92975b09d988c1ff05c2fb20cffccdc500a14e668",
19
+ "rules/wgl017.ts": "43ca940b5f311659d82b53524ce40cbc8d159ac7bd016eeeb994365b640a6796",
20
20
  "rules/wgl018.ts": "dba1e1357becb1bbea9b435d9ce88b12138a53d8fc934483bc0ec8f22e4b18f5",
21
21
  "rules/wgl019.ts": "01d703b2734385c3a9c6a132e1988f07d24636aa5e8fc22d8e06cc7b4aae5d97",
22
- "rules/wgl020.ts": "81a84b49308f36ab2b01342bd0e262b59b2a8395d233760ac52a679c2a4ae0e6",
23
- "rules/wgl021.ts": "59a75e0b0123779bcd4c7f66eb068c4302860df8333a4bc7b41c68e3983505da",
22
+ "rules/wgl020.ts": "83ac766e35b033ccd7e4c9bb07f73c31612e2b4736090415c66e43cb511c15ce",
23
+ "rules/wgl021.ts": "f97686029857ddba0412dcd9deb5b767512528828e5c68d5224aaaa9bf45ce0f",
24
24
  "rules/wgl022.ts": "96b87f8f410f5ffa6358823f4c8cb08a59166a7575166ede24e8c41b50f3be65",
25
25
  "rules/wgl023.ts": "069ee847f09751319dc6ae6f8ff6eccb30d5c15242e526165ff98b386eb4ac3d",
26
26
  "rules/wgl024.ts": "4665b340defd39ec627d9a12468b1f85e6a90021836baec3729acac195a6441b",
@@ -47,13 +47,13 @@
47
47
  "rules/wgl045.ts": "7eb13fe8d263a3f65e5b80c1dffe74e09eac7155e4c2d21df552a6b169099da0",
48
48
  "rules/wgl046.ts": "bbd8f5075aa390db546f5e787ce542f31a9d5eb031578780480e770cd86f9b5b",
49
49
  "rules/wgl047.ts": "e6dba6a0c6c042e90a200859e52a0da28c56ce52705e147760eca0a0a37c3255",
50
- "rules/wgl048.ts": "810590da4e7eaf70a6332ae247dbd34e000e2af57c89d3bd5a19bb2a923fcbb1",
51
- "rules/wgl049.ts": "875ba2203d66a2a444edf17b43c2ae438a3a23a7f579b81a448efc3d5dd4336e",
52
- "rules/wgl050.ts": "c96ef683ecf6e55699ea62d669ba6359616d723dd1bc24880823da0ff6c86503",
53
- "rules/yaml-helpers.ts": "5835982d5d088eb4788ebad8160b181bfdb6fc94d546eabee90a4c278a913988",
50
+ "rules/wgl048.ts": "5246d26ca825e88e52b025dfb9f095fd70769784b918139af89569956b522226",
51
+ "rules/wgl049.ts": "0a9153988e0c2fee8e887ac074802e0096da3e58786bc15ad4363442973cb01f",
52
+ "rules/wgl050.ts": "0f3bd12917765048794ed03820fd92238b7ef5519a29fdca97e33431b9a014a8",
53
+ "rules/yaml-helpers.ts": "d49ee04adbd11c0d020544005ba880a01c075ac6840b01ac4e50113c59743b01",
54
54
  "skills/chant-gitlab.md": "1e26a0c50ea891423479bd7fec3bc133f9185727c4a3eaadd525d7e7436056b6",
55
55
  "skills/chant-gitlab-migrate.md": "4853d04980560b379e5b0f7267dcb0a1e5d5879cb9e9931681ce76b2a5fe69d8",
56
56
  "skills/chant-gitlab-patterns.md": "6d9a44e9e8de4c3820be9d65381b0d2ede4cb3626aaaf0011e21838a9fbf556e"
57
57
  },
58
- "composite": "d49f3d8ae6e2d04ddb84bb4beff0ffb245c1b3dd6cf118805033cdddff9eb614"
58
+ "composite": "01362067b7c359f45f632c89c2532c2f24ae13c6ee1b01f1fc501524df6383c1"
59
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"intrinsics.d.ts","sourceRoot":"","sources":["../src/intrinsics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE9E;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAClD,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAG,IAAI,CAAU;IAC5C,OAAO,CAAC,IAAI,CAAW;gBAEX,GAAG,IAAI,EAAE,MAAM,EAAE;IAI7B,MAAM,IAAI,MAAM,EAAE;IAIlB;;OAEG;IACH,MAAM,IAAI;QAAE,GAAG,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE;CAGjD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAE/D"}
1
+ {"version":3,"file":"intrinsics.d.ts","sourceRoot":"","sources":["../src/intrinsics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE9E;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAClD,QAAQ,CAAC,CAAC,gBAAgB,CAAC,OAAiB;IAC5C,OAAO,CAAC,IAAI,CAAW;IAEvB,YAAY,GAAG,IAAI,EAAE,MAAM,EAAE,EAE5B;IAED,MAAM,IAAI,MAAM,EAAE,CAEjB;IAED;;OAEG;IACH,MAAM,IAAI;QAAE,GAAG,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,CAE/C;CACF;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,kBAAkB,CAE/D"}
@@ -8,7 +8,9 @@
8
8
  * Both cause GitLab pipeline validation failures.
9
9
  *
10
10
  * Caveat: when `include:` is present, referenced jobs may come from
11
- * included files, so the check is skipped.
11
+ * included files, so the check is skipped. A `- job: x` entry with
12
+ * `optional: true` may name a job that is not in the pipeline (GitLab
13
+ * ignores it), so it is not reported as dangling.
12
14
  */
13
15
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
14
16
  export declare function checkInvalidNeeds(ctx: PostSynthContext): PostSynthDiagnostic[];
@@ -1 +1 @@
1
- {"version":3,"file":"wgl013.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl013.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAoC9E;AAED,eAAO,MAAM,MAAM,EAAE,cAOpB,CAAC"}
1
+ {"version":3,"file":"wgl013.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl013.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAoC9E;AAED,eAAO,MAAM,MAAM,EAAE,cAOpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wgl017.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl017.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAK9G,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA2BzE;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
1
+ {"version":3,"file":"wgl017.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl017.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAK9G,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmBzE;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wgl020.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl020.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA8B1E;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
1
+ {"version":3,"file":"wgl020.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl020.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA6B1E;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wgl021.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl021.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAqCxE;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
1
+ {"version":3,"file":"wgl021.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl021.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAoB,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG9G,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAoCxE;AAED,eAAO,MAAM,MAAM,EAAE,cAYpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wgl050.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl050.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAK9G,eAAO,MAAM,MAAM,EAAE,cAgCpB,CAAC"}
1
+ {"version":3,"file":"wgl050.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/wgl050.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAG9G,eAAO,MAAM,MAAM,EAAE,cA+BpB,CAAC"}
@@ -1,10 +1,11 @@
1
1
  /**
2
2
  * Helpers for parsing serialized GitLab CI YAML in post-synth checks.
3
3
  *
4
- * Since GitLab CI output is YAML (not JSON like CloudFormation), we parse
5
- * the YAML sections structurally using simple regex/string parsing. The
6
- * serializer emits a predictable format so we can extract what we need
7
- * without a full YAML parser dependency.
4
+ * Jobs, stages and global variables are read with the structural parser
5
+ * (`parseYAML`, js-yaml with chant's schema). Checks that pattern-match a
6
+ * job's text get it from {@link extractJobSection}, which cuts the document
7
+ * at top-level keys rather than at blank lines, so it does not depend on the
8
+ * serializer's spacing.
8
9
  */
9
10
  export { getPrimaryOutput } from "@intentius/chant/lint/post-synth";
10
11
  /**
@@ -19,7 +20,15 @@ export interface ParsedJob {
19
20
  name: string;
20
21
  stage?: string;
21
22
  rules?: ParsedRule[];
23
+ /**
24
+ * Same-pipeline jobs this job needs, in every form GitLab accepts: a plain
25
+ * name, `- job: name` (with `artifacts:`, `optional:`, `parallel:`), and
26
+ * `needs: []`. Cross-pipeline needs (`pipeline:` or `project:`) name jobs
27
+ * in another pipeline and are left out.
28
+ */
22
29
  needs?: string[];
30
+ /** The subset of {@link needs} declared `optional: true`. */
31
+ optionalNeeds?: string[];
23
32
  extends?: string[];
24
33
  }
25
34
  export interface ParsedRule {
@@ -27,11 +36,31 @@ export interface ParsedRule {
27
36
  if?: string;
28
37
  }
29
38
  /**
30
- * Extract stages list from serialized YAML.
39
+ * Top-level keys that are global keywords, not jobs. `image`, `services`,
40
+ * `cache`, `before_script` and `after_script` are the deprecated global
41
+ * forms of the `default:` keywords; `spec` is a CI component's header.
42
+ */
43
+ export declare const RESERVED_TOP_LEVEL_KEYS: ReadonlySet<string>;
44
+ /** Parse the pipeline document; `undefined` when the YAML cannot be read. */
45
+ export declare function parsePipeline(yaml: string): Record<string, unknown> | undefined;
46
+ /**
47
+ * Every job in the pipeline as `[id, rawJobObject]`: each top-level key whose
48
+ * value is a mapping, minus the global keywords. Hidden jobs (ids starting
49
+ * with `.`, used as `extends:` templates) are included.
50
+ */
51
+ export declare function jobEntries(yaml: string): Array<[string, Record<string, unknown>]>;
52
+ /**
53
+ * Extract stages list from serialized YAML (block or flow list).
31
54
  */
32
55
  export declare function extractStages(yaml: string): string[];
33
56
  /**
34
- * Extract job names and their stage values from serialized YAML.
57
+ * Extract jobs with their stage, `needs:` and `extends:` from serialized YAML.
58
+ *
59
+ * Built on the structural parser, so every job id is read (capitals, spaces,
60
+ * colons, quoted ids) and every `needs:` entry is read whatever keys follow
61
+ * `job:` in its map. The line-based version this replaced skipped ids that
62
+ * start with a capital and stopped reading a `needs:` list at an
63
+ * `artifacts: true` line (#3256). YAML the parser cannot read gives no jobs.
35
64
  */
36
65
  export declare function extractJobs(yaml: string): Map<string, ParsedJob>;
37
66
  /**
@@ -41,11 +70,31 @@ export declare function extractJobs(yaml: string): Map<string, ParsedJob>;
41
70
  */
42
71
  export declare function hasInclude(yaml: string): boolean;
43
72
  /**
44
- * Extract global variables from serialized YAML.
73
+ * Extract global variables from serialized YAML. A variable in the expanded
74
+ * form (`value:` / `description:` / `options:`) maps to its `value`.
45
75
  */
46
76
  export declare function extractGlobalVariables(yaml: string): Map<string, string>;
47
77
  /**
48
- * Extract the full section text for a given job name.
78
+ * The key of a top-level mapping line (`build:`, `Build_Docs:`,
79
+ * `build:linux:`, `"deploy prod":`), unquoted, or undefined when the line
80
+ * does not start a top-level key.
81
+ */
82
+ export declare function topLevelKey(line: string): string | undefined;
83
+ /** A top-level section of the document: its key and its raw text. */
84
+ export interface TopLevelSection {
85
+ key: string;
86
+ text: string;
87
+ }
88
+ /**
89
+ * Split the document into top-level sections. A section starts at a line
90
+ * holding a top-level key and runs to the next one; blank lines and
91
+ * column-0 comments at its end are dropped. Unlike splitting on blank
92
+ * lines, this does not depend on the serializer's spacing.
93
+ */
94
+ export declare function topLevelSections(yaml: string): TopLevelSection[];
95
+ /**
96
+ * Extract the full section text for a given job name (exact key match, so
97
+ * `build` never returns the `build:linux` section).
49
98
  */
50
99
  export declare function extractJobSection(yaml: string, jobName: string): string | null;
51
100
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"yaml-helpers.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/yaml-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUpD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAkFhE;AAED;;;;G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,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,CA4BzD;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3E,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAmC5D;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKhD;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CA+C3D;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,kFAAkF;AAClF,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CA2BnE"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab",
3
- "version": "0.101.0",
3
+ "version": "0.104.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "GitLab",
6
6
  "intrinsics": [
@@ -1 +1 @@
1
- {"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../../../src/migrate/from-github/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MA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AC/D,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,IAAI,EAAE,YAAY,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,wEAAwE;IACxE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,OAAO,CAA0B;IAEzC,IAAI,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAEnC;IAED,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAEzC;IAED,GAAG,IAAI,gBAAgB,EAAE,CAExB;IAED,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,gBAAgB,EAAE,CAE3D;IAED,gBAAgB,IAAI,MAAM,CAEzB;IAED,kDAAkD;IAClD,eAAe,IAAI,gBAAgB,EAAE,CAEpC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,OAAO,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,KACzG,iBAGF,CAAC"}
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,KACzG,iBAGF,CAAC"}
@@ -8,7 +8,9 @@
8
8
  * Both cause GitLab pipeline validation failures.
9
9
  *
10
10
  * Caveat: when `include:` is present, referenced jobs may come from
11
- * included files, so the check is skipped.
11
+ * included files, so the check is skipped. A `- job: x` entry with
12
+ * `optional: true` may name a job that is not in the pipeline (GitLab
13
+ * ignores it), so it is not reported as dangling.
12
14
  */
13
15
 
14
16
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
@@ -36,7 +38,7 @@ export function checkInvalidNeeds(ctx: PostSynthContext): PostSynthDiagnostic[]
36
38
  entity: jobName,
37
39
  lexicon: "gitlab",
38
40
  });
39
- } else if (!jobNames.has(need)) {
41
+ } else if (!jobNames.has(need) && !job.optionalNeeds?.includes(need)) {
40
42
  diagnostics.push({
41
43
  checkId: "WGL013",
42
44
  severity: "error",
@@ -6,23 +6,15 @@
6
6
  */
7
7
 
8
8
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
9
- import { getPrimaryOutput, extractJobs } from "./yaml-helpers";
9
+ import { getPrimaryOutput, topLevelSections } from "./yaml-helpers";
10
10
 
11
11
  const INSECURE_REGISTRY_PATTERN = /docker\s+(push|pull|tag|login)\s+.*http:\/\/[^\s]+/;
12
12
 
13
13
  export function checkInsecureRegistry(yaml: string): PostSynthDiagnostic[] {
14
14
  const diagnostics: PostSynthDiagnostic[] = [];
15
15
 
16
- const sections = yaml.split("\n\n");
17
- for (const section of sections) {
18
- const lines = section.split("\n");
19
- if (lines.length === 0) continue;
20
-
21
- const topMatch = lines[0].match(/^(\.?[a-z][a-z0-9_.-]*):/);
22
- if (!topMatch) continue;
23
- const jobName = topMatch[1];
24
-
25
- for (const line of lines) {
16
+ for (const { key: jobName, text } of topLevelSections(yaml)) {
17
+ for (const line of text.split("\n")) {
26
18
  if (INSECURE_REGISTRY_PATTERN.test(line)) {
27
19
  diagnostics.push({
28
20
  checkId: "WGL017",
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
10
- import { getPrimaryOutput, extractJobs } from "./yaml-helpers";
10
+ import { getPrimaryOutput, topLevelKey, RESERVED_TOP_LEVEL_KEYS } from "./yaml-helpers";
11
11
 
12
12
  export function checkDuplicateJobNames(yaml: string): PostSynthDiagnostic[] {
13
13
  const diagnostics: PostSynthDiagnostic[] = [];
@@ -18,10 +18,9 @@ export function checkDuplicateJobNames(yaml: string): PostSynthDiagnostic[] {
18
18
  const lines = yaml.split("\n");
19
19
 
20
20
  for (const line of lines) {
21
- const topMatch = line.match(/^(\.?[a-z][a-z0-9_.-]*):/);
22
- if (topMatch) {
23
- const name = topMatch[1];
24
- if (["stages", "default", "workflow", "variables", "include"].includes(name)) continue;
21
+ const name = topLevelKey(line);
22
+ if (name !== undefined) {
23
+ if (RESERVED_TOP_LEVEL_KEYS.has(name)) continue;
25
24
  keyCounts.set(name, (keyCounts.get(name) ?? 0) + 1);
26
25
  }
27
26
  }
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
9
- import { getPrimaryOutput, extractGlobalVariables } from "./yaml-helpers";
9
+ import { getPrimaryOutput, extractGlobalVariables, topLevelSections } from "./yaml-helpers";
10
10
 
11
11
  export function checkUnusedVariables(yaml: string): PostSynthDiagnostic[] {
12
12
  const diagnostics: PostSynthDiagnostic[] = [];
@@ -20,14 +20,13 @@ export function checkUnusedVariables(yaml: string): PostSynthDiagnostic[] {
20
20
  // Check if $VARNAME or ${VARNAME} appears anywhere in the YAML (outside the variables block)
21
21
  const refPattern = new RegExp(`\\$\\{?${varName}\\}?`);
22
22
  // Also check for uses in extends, needs, etc. — search all sections
23
- const sections = yaml.split("\n\n");
24
23
  let found = false;
25
24
 
26
- for (const section of sections) {
25
+ for (const { key, text } of topLevelSections(yaml)) {
27
26
  // Skip the global variables section itself
28
- if (section.trimStart().startsWith("variables:")) continue;
27
+ if (key === "variables") continue;
29
28
 
30
- if (refPattern.test(section)) {
29
+ if (refPattern.test(text)) {
31
30
  found = true;
32
31
  break;
33
32
  }
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
11
- import { getPrimaryOutput } from "./yaml-helpers";
11
+ import { getPrimaryOutput, topLevelSections } from "./yaml-helpers";
12
12
 
13
13
  export const wgl048: PostSynthCheck = {
14
14
  id: "WGL048",
@@ -19,7 +19,7 @@ export const wgl048: PostSynthCheck = {
19
19
 
20
20
  for (const [, output] of ctx.outputs) {
21
21
  const yaml = getPrimaryOutput(output);
22
- const workflowSection = yaml.split("\n\n").find((s) => /^workflow:/.test(s));
22
+ const workflowSection = topLevelSections(yaml).find((s) => s.key === "workflow")?.text;
23
23
  if (!workflowSection) continue;
24
24
  if (!/^\s+name:/m.test(workflowSection)) {
25
25
  diagnostics.push({
@@ -11,14 +11,14 @@
11
11
  */
12
12
 
13
13
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
14
- import { getPrimaryOutput, extractJobs, extractJobSection } from "./yaml-helpers";
14
+ import { getPrimaryOutput, extractJobs, extractJobSection, topLevelSections } from "./yaml-helpers";
15
15
 
16
16
  const DEP_INSTALL_RE = /\b(npm (install|ci)|yarn install|pnpm install|pip install|pip3 install|bundle install|composer install|go mod download|mvn (install|dependency:resolve))\b/i;
17
17
 
18
18
  function hasPipelineWideCache(yaml: string): boolean {
19
- const sections = yaml.split("\n\n");
20
- if (sections.some((s) => /^cache:/.test(s))) return true;
21
- const defaultSection = sections.find((s) => /^default:/.test(s));
19
+ const sections = topLevelSections(yaml);
20
+ if (sections.some((s) => s.key === "cache")) return true;
21
+ const defaultSection = sections.find((s) => s.key === "default")?.text;
22
22
  return !!defaultSection && /\n\s+cache:/.test(defaultSection);
23
23
  }
24
24
 
@@ -10,9 +10,7 @@
10
10
  */
11
11
 
12
12
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
13
- import { getPrimaryOutput, isMergeRequestReachable } from "./yaml-helpers";
14
-
15
- const RESERVED_TOP_LEVEL_KEYS = new Set(["stages", "default", "workflow", "variables", "include", "cache"]);
13
+ import { getPrimaryOutput, isMergeRequestReachable, extractJobs, extractJobSection } from "./yaml-helpers";
16
14
 
17
15
  export const wgl050: PostSynthCheck = {
18
16
  id: "WGL050",
@@ -24,11 +22,10 @@ export const wgl050: PostSynthCheck = {
24
22
  for (const [, output] of ctx.outputs) {
25
23
  const yaml = getPrimaryOutput(output);
26
24
 
27
- for (const section of yaml.split("\n\n")) {
28
- const top = section.split("\n")[0]?.match(/^(\.?[a-z][a-z0-9_.-]*):/i);
29
- if (!top) continue;
30
- const jobName = top[1];
31
- if (jobName.startsWith(".") || RESERVED_TOP_LEVEL_KEYS.has(jobName)) continue;
25
+ for (const [jobName] of extractJobs(yaml)) {
26
+ if (jobName.startsWith(".")) continue;
27
+ const section = extractJobSection(yaml, jobName);
28
+ if (!section) continue;
32
29
  if (/deploy/i.test(jobName)) continue; // cancelling mid-deploy is a hazard, not a win
33
30
 
34
31
  if (!isMergeRequestReachable(section)) continue;