@intentius/chant-lexicon-gitlab 0.19.1 → 0.21.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.
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiFH;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA41B9E"}
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiFH;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAw2B9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/codegen/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,kCAAkC,CAAC;AAG1C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAI9C;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAqCtF"}
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/codegen/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,kCAAkC,CAAC;AAG1C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAI9C;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAkCtF"}
@@ -1,22 +1,22 @@
1
1
  export declare const Default: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, string>;
2
2
  export declare const Job: new (props: Record<string, unknown>, attributes?: Record<string, unknown>) => import("packages/core/src").Declarable & Record<string, string>;
3
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>) => Record<string, unknown>;
5
- export declare const Artifacts: new (props: Record<string, unknown>) => Record<string, unknown>;
6
- export declare const AutoCancel: new (props: Record<string, unknown>) => Record<string, unknown>;
7
- export declare const Cache: new (props: Record<string, unknown>) => Record<string, unknown>;
8
- export declare const Environment: new (props: Record<string, unknown>) => Record<string, unknown>;
9
- export declare const Image: new (props: Record<string, unknown>) => Record<string, unknown>;
10
- export declare const Include: new (props: Record<string, unknown>) => Record<string, unknown>;
11
- export declare const Inherit: new (props: Record<string, unknown>) => Record<string, unknown>;
12
- export declare const Need: new (props: Record<string, unknown>) => Record<string, unknown>;
13
- export declare const Parallel: new (props: Record<string, unknown>) => Record<string, unknown>;
14
- export declare const Release: new (props: Record<string, unknown>) => Record<string, unknown>;
15
- export declare const Retry: new (props: Record<string, unknown>) => Record<string, unknown>;
16
- export declare const Rule: new (props: Record<string, unknown>) => Record<string, unknown>;
17
- export declare const Service: new (props: Record<string, unknown>) => Record<string, unknown>;
18
- export declare const Trigger: new (props: Record<string, unknown>) => Record<string, unknown>;
19
- export declare const WorkflowRule: new (props: Record<string, unknown>) => Record<string, unknown>;
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>;
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,iEAAuD,CAAC;AACjF,eAAO,MAAM,SAAS,iEAAoD,CAAC;AAC3E,eAAO,MAAM,UAAU,iEAAqD,CAAC;AAC7E,eAAO,MAAM,KAAK,iEAAgD,CAAC;AACnE,eAAO,MAAM,WAAW,iEAAsD,CAAC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O,MAAM,OAAO,0GAAkD,CAAC;AACvE,eAAO,MAAM,OAAO,0GAAkD,CAAC;AACvE,eAAO,MAAM,YAAY,0GAAuD,CAAC;AAGjF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "cf4c631d450e76b04223d13f7614578125d8b92d973523be77404b0377ce73d5",
4
+ "manifest.json": "89e556afc19a0b88869af7f5691376181399d6ba9a1a8154cd288bd41ab3075a",
5
5
  "meta.json": "931fc3246a55645b1493080bbeb160e5d205e42349e8bdca96ca243adb5f0da3",
6
6
  "types/index.d.ts": "5cd2e99f135a929b72bdd822d00d780d39b1cd407ba0cfb3d511c7ac9d667b58",
7
7
  "rules/artifact-no-expiry.ts": "3f3cabf9792cbf8207e53a25f506715466b19ec25e9c3b4d0d77fed6b2eb4542",
@@ -52,5 +52,5 @@
52
52
  "skills/chant-gitlab-migrate.md": "4853d04980560b379e5b0f7267dcb0a1e5d5879cb9e9931681ce76b2a5fe69d8",
53
53
  "skills/chant-gitlab-patterns.md": "6d9a44e9e8de4c3820be9d65381b0d2ede4cb3626aaaf0011e21838a9fbf556e"
54
54
  },
55
- "composite": "6d2bb6e726004a6d6e4dec7213ccd100df28fe9a7730de4e17643e3bf10e2a93"
55
+ "composite": "2998b4d0b1a747b421f961155f006f2b84b30a950d1b63cfcb13477a582aefda"
56
56
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitlab",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "GitLab",
6
6
  "intrinsics": [
@@ -8,7 +8,7 @@
8
8
  "name": "reference",
9
9
  "description": "!reference tag — reference another job's properties",
10
10
  "outputKey": "!reference",
11
- "isTag": true
11
+ "isTag": false
12
12
  }
13
13
  ],
14
14
  "pseudoParameters": {}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,0BAA0B,CAAC;AAmB7F,eAAO,MAAM,YAAY,EAAE,aAsgB1B,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAiC,MAAM,0BAA0B,CAAC;AAmB7F,eAAO,MAAM,YAAY,EAAE,aA4gB1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-gitlab",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "description": "GitLab CI lexicon for chant — declarative IaC in TypeScript",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -67,8 +67,8 @@
67
67
  "typescript": "^5.9.3"
68
68
  },
69
69
  "peerDependencies": {
70
- "@intentius/chant": "^0.19.1",
71
- "@intentius/chant-lexicon-github": "^0.19.1",
70
+ "@intentius/chant": "^0.21.0",
71
+ "@intentius/chant-lexicon-github": "^0.21.0",
72
72
  "typescript": "^5.9.3"
73
73
  },
74
74
  "peerDependenciesMeta": {
@@ -98,7 +98,15 @@ export async function generateDocs(opts?: { verbose?: boolean }): Promise<void>
98
98
  overview,
99
99
  outputFormat,
100
100
  serviceFromType,
101
- suppressPages: ["intrinsics", "rules"],
101
+ // "intrinsics" is no longer suppressed (chant #1067) — the reference
102
+ // table at that slug is now generated from the plugin's own
103
+ // `intrinsics()` registration (docsPipeline's generateIntrinsics, same
104
+ // mechanism azure/helm already use), so its "Folds?" column can never
105
+ // drift from the registration the way #1062's foldability matrix
106
+ // depends on. The hand-written `reference()` usage guide moves to a
107
+ // separate "intrinsics-guide" page below — content unchanged, just no
108
+ // longer sharing a slug with generated data.
109
+ suppressPages: ["rules"],
102
110
  examplesDir: join(pkgDir, "examples"),
103
111
  extraPages: [
104
112
  {
@@ -299,10 +307,14 @@ Jobs can override any default property individually.
299
307
  `,
300
308
  },
301
309
  {
302
- slug: "intrinsics",
303
- title: "Intrinsic Functions",
304
- description: "GitLab CI/CD intrinsic functions and their chant syntax",
305
- content: `The GitLab lexicon provides one intrinsic function: \`reference()\`, which maps to GitLab's \`!reference\` YAML tag.
310
+ slug: "intrinsics-guide",
311
+ title: "Intrinsics Guide",
312
+ description: "Worked examples for the GitLab reference() intrinsic and its chant syntax",
313
+ content: `See [Intrinsic Functions](../intrinsics/) for the generated reference table (name, description, output key, whether it's a tagged template, whether \`chant build --fold\` can fold it). This page is the worked-example companion.
314
+
315
+ The GitLab lexicon provides one intrinsic function: \`reference()\`, which maps to GitLab's \`!reference\` YAML tag.
316
+
317
+ \`reference()\` is a plain function call, not a TypeScript tagged template — like any function call used as a value, it's outside the subset [\`chant build --fold\`](/chant/concepts/typescript-as-data/#folded-vs-run) can reduce. A file that calls \`reference()\` anywhere in a resource's properties falls back to the normal run path under \`--fold\`.
306
318
 
307
319
  ## \`reference()\` — reuse job properties
308
320
 
@@ -31,14 +31,11 @@ export async function packageLexicon(opts: PackageOptions = {}): Promise<Package
31
31
  generate: (genOpts) => generate({ verbose: genOpts.verbose, force: genOpts.force }),
32
32
 
33
33
  buildManifest: (_genResult) => {
34
- const intrinsics: IntrinsicDef[] = [
35
- {
36
- name: "reference",
37
- description: "!reference tag reference another job's properties",
38
- outputKey: "!reference",
39
- isTag: true,
40
- },
41
- ];
34
+ // Derived from the plugin's own registration (chant #1067) — this
35
+ // used to be a hand-maintained array independent of ../plugin.ts
36
+ // (despite the comment claiming otherwise), free to drift from the
37
+ // real registration without anything noticing.
38
+ const intrinsics: IntrinsicDef[] = gitlabPlugin.intrinsics?.() ?? [];
42
39
 
43
40
  return {
44
41
  name: "gitlab",
@@ -26,7 +26,11 @@ describe("gitlabPlugin", () => {
26
26
  expect(intrinsics).toHaveLength(1);
27
27
  expect(intrinsics[0].name).toBe("reference");
28
28
  expect(intrinsics[0].outputKey).toBe("!reference");
29
- expect(intrinsics[0].isTag).toBe(true);
29
+ // #1039: `reference(...)` is authored as a plain call, not a JS tagged
30
+ // template — `isTag` must be false so the static folder doesn't mistake
31
+ // `reference`...`` for a registered tag. The `!reference` YAML tag still
32
+ // renders fine (via `ReferenceIntrinsic.toYAML()`, unrelated to `isTag`).
33
+ expect(intrinsics[0].isTag).toBe(false);
30
34
  });
31
35
 
32
36
  // -----------------------------------------------------------------------
package/src/plugin.ts CHANGED
@@ -51,9 +51,15 @@ export const gitlabPlugin: LexiconPlugin = {
51
51
  return [
52
52
  {
53
53
  name: "reference",
54
+ // Authored as a plain call — `reference("job", "script")` — not a JS
55
+ // tagged template, so `isTag` (chant #1039: "authored as a tagged
56
+ // template", consumed by the static folder to recognize `Tag`...``)
57
+ // must be false. The `!reference` YAML tag it produces is rendered
58
+ // via `ReferenceIntrinsic.toYAML()` (see ../serializer.ts's generic
59
+ // `toYAML` duck-typing) — independent of this flag.
54
60
  description: "!reference tag — reference another job's properties",
55
61
  outputKey: "!reference",
56
- isTag: true,
62
+ isTag: false,
57
63
  },
58
64
  ];
59
65
  },
package/src/serializer.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import type { Declarable } from "@intentius/chant/declarable";
11
- import { isPropertyDeclarable } from "@intentius/chant/declarable";
11
+ import { isPropertyDeclarable, isResourceDeclarable } from "@intentius/chant/declarable";
12
12
  import type { Serializer } from "@intentius/chant/serializer";
13
13
  import type { LexiconOutput } from "@intentius/chant/lexicon-output";
14
14
  import { walkValue, type SerializerVisitor } from "@intentius/chant/serializer-walker";
@@ -23,7 +23,7 @@ function gitlabVisitor(entityNames: Map<Declarable, string>): SerializerVisitor
23
23
  attrRef: (name, _attr) => name,
24
24
  resourceRef: (name) => name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(),
25
25
  propertyDeclarable: (entity, walk) => {
26
- if (!("props" in entity) || typeof entity.props !== "object" || entity.props === null) {
26
+ if (!isResourceDeclarable(entity) || typeof entity.props !== "object" || entity.props === null) {
27
27
  return undefined;
28
28
  }
29
29
  const props = entity.props as Record<string, unknown>;
@@ -123,7 +123,7 @@ export const gitlabSerializer: Serializer = {
123
123
  // Emit stages (collect from jobs)
124
124
  const stages = new Set<string>();
125
125
  for (const [, entity] of jobs) {
126
- const props = (entity as unknown as Record<string, unknown>).props as Record<string, unknown> | undefined;
126
+ const props = isResourceDeclarable(entity) ? (entity.props as Record<string, unknown> | undefined) : undefined;
127
127
  if (props?.stage && typeof props.stage === "string") {
128
128
  stages.add(props.stage);
129
129
  }
@@ -135,7 +135,7 @@ export const gitlabSerializer: Serializer = {
135
135
  // Emit defaults
136
136
  for (const [, entity] of defaults) {
137
137
  const converted = toYAMLValue(
138
- (entity as unknown as Record<string, unknown>).props,
138
+ (isResourceDeclarable(entity) ? entity.props : undefined),
139
139
  entityNames,
140
140
  ) as Record<string, unknown> | undefined;
141
141
  if (converted) {
@@ -146,7 +146,7 @@ export const gitlabSerializer: Serializer = {
146
146
  // Emit workflow
147
147
  for (const [, entity] of workflows) {
148
148
  const converted = toYAMLValue(
149
- (entity as unknown as Record<string, unknown>).props,
149
+ (isResourceDeclarable(entity) ? entity.props : undefined),
150
150
  entityNames,
151
151
  ) as Record<string, unknown> | undefined;
152
152
  if (converted) {
@@ -157,7 +157,7 @@ export const gitlabSerializer: Serializer = {
157
157
  // Emit jobs
158
158
  for (const [name, entity] of jobs) {
159
159
  const converted = toYAMLValue(
160
- (entity as unknown as Record<string, unknown>).props,
160
+ (isResourceDeclarable(entity) ? entity.props : undefined),
161
161
  entityNames,
162
162
  ) as Record<string, unknown> | undefined;
163
163
  if (converted) {