@intentius/chant-lexicon-gitlab 0.124.31 → 0.124.32

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 (133) hide show
  1. package/dist/codegen/docs-cli.js +2 -0
  2. package/dist/codegen/docs.js +157 -0
  3. package/dist/codegen/fetch.js +93 -0
  4. package/dist/codegen/generate-cli.js +30 -0
  5. package/dist/codegen/generate-lexicon.js +36 -0
  6. package/dist/codegen/generate-typescript.js +105 -0
  7. package/dist/codegen/generate.js +125 -0
  8. package/dist/codegen/naming.js +48 -0
  9. package/dist/codegen/package.js +41 -0
  10. package/dist/codegen/parse.js +539 -0
  11. package/dist/codegen/patches.js +84 -0
  12. package/dist/codegen/typecheck.js +4 -0
  13. package/dist/components/ci-jobs.js +16 -0
  14. package/dist/components/generate-op-pipeline.js +288 -0
  15. package/dist/components/generate-op-waves-pipeline.js +125 -0
  16. package/dist/components/generate-pipeline.d.ts.map +1 -1
  17. package/dist/components/generate-pipeline.js +369 -0
  18. package/dist/composites/catalog.js +418 -0
  19. package/dist/composites/docker-build.js +38 -0
  20. package/dist/composites/index.js +5 -0
  21. package/dist/composites/mr-plan-report.js +42 -0
  22. package/dist/composites/node-pipeline.js +67 -0
  23. package/dist/composites/python-pipeline.js +45 -0
  24. package/dist/composites/review-app.js +32 -0
  25. package/dist/coverage.js +35 -0
  26. package/dist/generated/index.js +25 -0
  27. package/dist/generated/runtime.js +4 -0
  28. package/dist/graph-edges.js +202 -0
  29. package/dist/import/generator.js +196 -0
  30. package/dist/import/parser.js +111 -0
  31. package/dist/index.js +26 -0
  32. package/dist/integrity.json +3 -3
  33. package/dist/intrinsics.js +33 -0
  34. package/dist/lint/audit-catalog.js +53 -0
  35. package/dist/lint/audit-lineage.js +64 -0
  36. package/dist/lint/post-synth/index.js +84 -0
  37. package/dist/lint/post-synth/wgl010.js +34 -0
  38. package/dist/lint/post-synth/wgl011.js +48 -0
  39. package/dist/lint/post-synth/wgl012.d.ts.map +1 -1
  40. package/dist/lint/post-synth/wgl012.js +68 -0
  41. package/dist/lint/post-synth/wgl013.js +57 -0
  42. package/dist/lint/post-synth/wgl014.js +43 -0
  43. package/dist/lint/post-synth/wgl015.js +70 -0
  44. package/dist/lint/post-synth/wgl016.js +70 -0
  45. package/dist/lint/post-synth/wgl017.js +38 -0
  46. package/dist/lint/post-synth/wgl018.js +34 -0
  47. package/dist/lint/post-synth/wgl019.js +43 -0
  48. package/dist/lint/post-synth/wgl020.js +47 -0
  49. package/dist/lint/post-synth/wgl021.js +52 -0
  50. package/dist/lint/post-synth/wgl022.js +38 -0
  51. package/dist/lint/post-synth/wgl023.js +44 -0
  52. package/dist/lint/post-synth/wgl024.js +41 -0
  53. package/dist/lint/post-synth/wgl025.js +42 -0
  54. package/dist/lint/post-synth/wgl026.js +58 -0
  55. package/dist/lint/post-synth/wgl027.js +49 -0
  56. package/dist/lint/post-synth/wgl028.js +58 -0
  57. package/dist/lint/post-synth/wgl029.js +55 -0
  58. package/dist/lint/post-synth/wgl030.js +43 -0
  59. package/dist/lint/post-synth/wgl031.js +33 -0
  60. package/dist/lint/post-synth/wgl032.js +64 -0
  61. package/dist/lint/post-synth/wgl033.js +32 -0
  62. package/dist/lint/post-synth/wgl034.js +37 -0
  63. package/dist/lint/post-synth/wgl035.js +40 -0
  64. package/dist/lint/post-synth/wgl036.js +38 -0
  65. package/dist/lint/post-synth/wgl037.js +41 -0
  66. package/dist/lint/post-synth/wgl038.js +43 -0
  67. package/dist/lint/post-synth/wgl039.js +34 -0
  68. package/dist/lint/post-synth/wgl040.js +35 -0
  69. package/dist/lint/post-synth/wgl041.js +53 -0
  70. package/dist/lint/post-synth/wgl042.js +41 -0
  71. package/dist/lint/post-synth/wgl043.js +39 -0
  72. package/dist/lint/post-synth/wgl044.js +35 -0
  73. package/dist/lint/post-synth/wgl045.js +54 -0
  74. package/dist/lint/post-synth/wgl046.js +40 -0
  75. package/dist/lint/post-synth/wgl047.js +34 -0
  76. package/dist/lint/post-synth/wgl048.js +32 -0
  77. package/dist/lint/post-synth/wgl049.js +53 -0
  78. package/dist/lint/post-synth/wgl050.js +42 -0
  79. package/dist/lint/post-synth/yaml-helpers.js +432 -0
  80. package/dist/lint/rules/artifact-no-expiry.js +53 -0
  81. package/dist/lint/rules/data/known-include-sources.js +44 -0
  82. package/dist/lint/rules/data/untrusted-variables.js +30 -0
  83. package/dist/lint/rules/deprecated-only-except.js +46 -0
  84. package/dist/lint/rules/import-source.js +61 -0
  85. package/dist/lint/rules/index.js +7 -0
  86. package/dist/lint/rules/missing-script.js +67 -0
  87. package/dist/lint/rules/missing-stage.js +60 -0
  88. package/dist/lsp/completions.d.ts.map +1 -1
  89. package/dist/lsp/completions.js +18 -0
  90. package/dist/lsp/hover.d.ts.map +1 -1
  91. package/dist/lsp/hover.js +33 -0
  92. package/dist/manifest.json +1 -1
  93. package/dist/mcp/context-tools.js +262 -0
  94. package/dist/migrate/from-github/actions/index.js +17 -0
  95. package/dist/migrate/from-github/actions/registry.js +61 -0
  96. package/dist/migrate/from-github/actions/tier-1.js +298 -0
  97. package/dist/migrate/from-github/actions/tier-2.js +241 -0
  98. package/dist/migrate/from-github/actions/tier-3.js +96 -0
  99. package/dist/migrate/from-github/composites/patterns.js +151 -0
  100. package/dist/migrate/from-github/composites/rewriter.js +22 -0
  101. package/dist/migrate/from-github/diagnostics.js +53 -0
  102. package/dist/migrate/from-github/emit-yaml.js +121 -0
  103. package/dist/migrate/from-github/expressions.js +275 -0
  104. package/dist/migrate/from-github/index.js +96 -0
  105. package/dist/migrate/from-github/provenance.js +35 -0
  106. package/dist/migrate/from-github/rules.js +74 -0
  107. package/dist/migrate/from-github/security.js +189 -0
  108. package/dist/migrate/from-github/stages.js +156 -0
  109. package/dist/migrate/from-github/transformer.js +633 -0
  110. package/dist/op/activities/gitlab.js +38 -0
  111. package/dist/op/activities/index.js +10 -0
  112. package/dist/op/builders.js +26 -0
  113. package/dist/package-cli.js +21 -0
  114. package/dist/plugin.js +536 -0
  115. package/dist/rules/wgl012.ts +2 -2
  116. package/dist/serializer.js +197 -0
  117. package/dist/testdata/create-fixture.js +40 -0
  118. package/dist/testdata/load-fixtures.js +20 -0
  119. package/dist/validate-cli.js +16 -0
  120. package/dist/validate.js +29 -0
  121. package/dist/variables.js +30 -0
  122. package/package.json +8 -8
  123. package/src/codegen/fetch.ts +2 -2
  124. package/src/codegen/package.ts +2 -2
  125. package/src/components/__fixtures__/pr-loop-build.gitlab.golden.yml +3 -3
  126. package/src/components/__fixtures__/pr-loop-waves.gitlab.golden.yml +101 -0
  127. package/src/components/__fixtures__/pr-loop.gitlab.golden.yml +3 -3
  128. package/src/components/generate-pipeline.ts +60 -27
  129. package/src/components/generate-pr-pipeline.test.ts +14 -9
  130. package/src/components/generate-pr-waves-pipeline.test.ts +88 -0
  131. package/src/lint/post-synth/wgl012.ts +2 -2
  132. package/src/lsp/completions.ts +2 -1
  133. package/src/lsp/hover.ts +2 -1
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Stage inference for GitHub jobs → GitLab stages.
3
+ *
4
+ * GitHub Actions has no `stages:` concept; jobs only declare optional
5
+ * `needs:` edges. GitLab CI requires every job to belong to a stage.
6
+ *
7
+ * Approach (Kahn topological sort on the `needs:` DAG):
8
+ * 1. Build adjacency from `needs:` (jobs without `needs:` are depth 0).
9
+ * 2. Peel zero-indegree nodes; assign stage by depth + name heuristic.
10
+ * 3. Map depths to stage names:
11
+ * depth 0 → "lint" / "build" (by name heuristic, default "build")
12
+ * depth 1 → "test"
13
+ * depth 2 → "deploy"
14
+ * depth N>2 → `post-${N-2}`
15
+ * 4. If a cycle is detected, place each remaining job in its own stage
16
+ * and append a needs-review record so the user notices.
17
+ */
18
+ const NAME_HEURISTIC_PATTERNS = [
19
+ { pattern: /^(lint|check|fmt|format|style|typecheck|tsc)/i, stage: "lint" },
20
+ { pattern: /^(build|compile|bundle|pack)/i, stage: "build" },
21
+ { pattern: /^(test|spec|e2e|integration|unit)/i, stage: "test" },
22
+ { pattern: /^(deploy|publish|release|push)/i, stage: "deploy" },
23
+ ];
24
+ function heuristicStage(name, fallback) {
25
+ for (const { pattern, stage } of NAME_HEURISTIC_PATTERNS) {
26
+ if (pattern.test(name))
27
+ return stage;
28
+ }
29
+ return fallback;
30
+ }
31
+ function defaultStageForDepth(depth) {
32
+ if (depth === 0)
33
+ return "build";
34
+ if (depth === 1)
35
+ return "test";
36
+ if (depth === 2)
37
+ return "deploy";
38
+ return `post-${depth - 2}`;
39
+ }
40
+ export function inferStages(jobs) {
41
+ const provenance = [];
42
+ const stageByJob = new Map();
43
+ const jobsById = new Map(jobs.map((j) => [j.logicalId, j]));
44
+ // Compute indegree based on needs that resolve to known jobs
45
+ const indegree = new Map();
46
+ for (const job of jobs) {
47
+ indegree.set(job.logicalId, 0);
48
+ }
49
+ for (const job of jobs) {
50
+ for (const dep of job.needs) {
51
+ if (jobsById.has(dep)) {
52
+ indegree.set(job.logicalId, (indegree.get(job.logicalId) ?? 0) + 1);
53
+ }
54
+ }
55
+ }
56
+ // Kahn's algorithm, recording depth per node
57
+ const depth = new Map();
58
+ const queue = [];
59
+ for (const job of jobs) {
60
+ if ((indegree.get(job.logicalId) ?? 0) === 0) {
61
+ queue.push(job.logicalId);
62
+ depth.set(job.logicalId, 0);
63
+ }
64
+ }
65
+ const processed = new Set();
66
+ while (queue.length > 0) {
67
+ const current = queue.shift();
68
+ processed.add(current);
69
+ const currentDepth = depth.get(current) ?? 0;
70
+ for (const next of jobs) {
71
+ if (next.needs.includes(current)) {
72
+ const remaining = (indegree.get(next.logicalId) ?? 0) - 1;
73
+ indegree.set(next.logicalId, remaining);
74
+ const proposed = currentDepth + 1;
75
+ const existing = depth.get(next.logicalId);
76
+ if (existing === undefined || proposed > existing) {
77
+ depth.set(next.logicalId, proposed);
78
+ }
79
+ if (remaining === 0) {
80
+ queue.push(next.logicalId);
81
+ }
82
+ }
83
+ }
84
+ }
85
+ // Detect cycles — any job not processed is on a cycle
86
+ const cycleJobs = jobs.filter((j) => !processed.has(j.logicalId));
87
+ for (const job of cycleJobs) {
88
+ provenance.push({
89
+ gitlabPath: `jobs.${job.logicalId}.stage`,
90
+ gitlabLogicalId: job.logicalId,
91
+ sourceKey: `jobs.${job.originalName}.needs`,
92
+ category: "needs-review",
93
+ rule: "MIG-NEEDS-CYCLE-001",
94
+ note: `Job "${job.originalName}" is part of a needs: cycle; assigned its own stage`,
95
+ });
96
+ }
97
+ // Assign stages
98
+ for (const job of jobs) {
99
+ if (cycleJobs.includes(job)) {
100
+ stageByJob.set(job.logicalId, `cycle-${job.logicalId}`);
101
+ continue;
102
+ }
103
+ const d = depth.get(job.logicalId) ?? 0;
104
+ const defaultStage = defaultStageForDepth(d);
105
+ const stage = d === 0
106
+ ? heuristicStage(job.originalName, defaultStage)
107
+ : d === 1
108
+ ? heuristicStage(job.originalName, defaultStage)
109
+ : defaultStage;
110
+ stageByJob.set(job.logicalId, stage);
111
+ if (stage !== defaultStage) {
112
+ provenance.push({
113
+ gitlabPath: `jobs.${job.logicalId}.stage`,
114
+ gitlabLogicalId: job.logicalId,
115
+ sourceKey: `jobs.${job.originalName}`,
116
+ category: "synthesis",
117
+ rule: "MIG-STAGE-HEURISTIC",
118
+ note: `Stage "${stage}" inferred from job name "${job.originalName}"`,
119
+ });
120
+ }
121
+ else {
122
+ provenance.push({
123
+ gitlabPath: `jobs.${job.logicalId}.stage`,
124
+ gitlabLogicalId: job.logicalId,
125
+ sourceKey: `jobs.${job.originalName}`,
126
+ category: "synthesis",
127
+ rule: "MIG-STAGE-TOPO",
128
+ note: `Stage "${stage}" assigned from needs: depth ${d}`,
129
+ });
130
+ }
131
+ }
132
+ // Collect distinct stages, ordered by appearance
133
+ const stagesSet = new Set();
134
+ const stagesOrdered = [];
135
+ for (const job of jobs) {
136
+ const s = stageByJob.get(job.logicalId);
137
+ if (s && !stagesSet.has(s)) {
138
+ stagesSet.add(s);
139
+ stagesOrdered.push(s);
140
+ }
141
+ }
142
+ // Sort by canonical depth order: lint, build, test, deploy, post-N, cycle-*
143
+ const canonicalOrder = ["lint", "build", "test", "deploy"];
144
+ stagesOrdered.sort((a, b) => {
145
+ const ai = canonicalOrder.indexOf(a);
146
+ const bi = canonicalOrder.indexOf(b);
147
+ if (ai !== -1 && bi !== -1)
148
+ return ai - bi;
149
+ if (ai !== -1)
150
+ return -1;
151
+ if (bi !== -1)
152
+ return 1;
153
+ return a.localeCompare(b);
154
+ });
155
+ return { stageByJob, stages: stagesOrdered, provenance };
156
+ }