@intentius/chant-lexicon-gitlab 0.0.3 → 0.0.6
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 +9 -46
- package/dist/integrity.json +5 -5
- package/dist/manifest.json +1 -1
- package/dist/meta.json +5 -0
- package/dist/types/index.d.ts +13 -0
- package/package.json +2 -2
- package/src/codegen/docs.ts +30 -438
- package/src/codegen/generate-lexicon.ts +1 -1
- package/src/codegen/parse.test.ts +5 -4
- package/src/codegen/parse.ts +8 -10
- package/src/codegen/snapshot.test.ts +3 -3
- package/src/generated/index.d.ts +13 -0
- package/src/generated/index.ts +1 -0
- package/src/generated/lexicon-gitlab.json +5 -0
- package/src/plugin.test.ts +1 -2
- package/src/plugin.ts +13 -40
- package/src/testdata/ci-schema-fixture.json +105 -229
- package/src/validate.test.ts +13 -22
- package/src/validate.ts +17 -108
package/README.md
CHANGED
|
@@ -1,58 +1,21 @@
|
|
|
1
1
|
# @intentius/chant-lexicon-gitlab
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
GitLab CI lexicon for [chant](https://intentius.io/chant/) — declare CI/CD pipelines as typed TypeScript that serializes to `.gitlab-ci.yml`.
|
|
4
4
|
|
|
5
|
-
GitLab CI
|
|
5
|
+
This package provides typed constructors for all GitLab CI keywords (Jobs, Workflows, Defaults, and property types like Artifacts, Cache, Image, Rule, Environment, and Trigger), the `CI` pseudo-parameter object for predefined variables, the `reference()` intrinsic for YAML `!reference` tags, and GitLab-specific lint rules. It also includes LSP and MCP server support for editor completions and hover.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
This package provides:
|
|
10
|
-
|
|
11
|
-
- **GitLab CI serializer** — converts chant declarables to GitLab CI YAML
|
|
12
|
-
- **Resource types** — typed constructors for `Job`, `Default`, `Workflow`, and all GitLab CI keywords
|
|
13
|
-
- **Property types** — `Artifacts`, `Cache`, `Image`, `Rule`, `Retry`, `Environment`, `Trigger`, and more
|
|
14
|
-
- **Lint rules** — GitLab-specific validation (e.g. missing script, deprecated only/except)
|
|
15
|
-
- **Code generation** — generates TypeScript types from the GitLab CI JSON schema
|
|
16
|
-
- **LSP/MCP support** — completions and hover for GitLab CI keywords
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import { Job, Artifacts, Image } from "@intentius/chant-lexicon-gitlab";
|
|
22
|
-
|
|
23
|
-
export const testJob = new Job({
|
|
24
|
-
stage: "test",
|
|
25
|
-
image: new Image({ name: "node:20" }),
|
|
26
|
-
script: ["npm ci", "npm test"],
|
|
27
|
-
artifacts: new Artifacts({
|
|
28
|
-
paths: ["coverage/"],
|
|
29
|
-
expireIn: "1 week",
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @intentius/chant @intentius/chant-lexicon-gitlab
|
|
32
9
|
```
|
|
33
10
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| Rule | Description |
|
|
37
|
-
|------|-------------|
|
|
38
|
-
| `missing-script` | Job must have a `script` keyword |
|
|
39
|
-
| `missing-stage` | Job should declare a `stage` |
|
|
40
|
-
| `deprecated-only-except` | Flags use of deprecated `only`/`except` keywords |
|
|
41
|
-
| `artifact-no-expiry` | Artifacts should have `expire_in` set |
|
|
42
|
-
|
|
43
|
-
## Code Generation
|
|
44
|
-
|
|
45
|
-
The GitLab lexicon generates types from the [GitLab CI JSON schema](https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json):
|
|
46
|
-
|
|
47
|
-
- `codegen/generate.ts` — calls core `generatePipeline<GitLabParseResult>` with GitLab callbacks
|
|
48
|
-
- `codegen/naming.ts` — extends core `NamingStrategy` for GitLab CI keywords
|
|
49
|
-
- `codegen/package.ts` — calls core `packagePipeline` with GitLab manifest
|
|
50
|
-
- `codegen/parse.ts` — parses the GitLab CI JSON schema into typed entities
|
|
11
|
+
**[Documentation →](https://intentius.io/chant/lexicons/gitlab/)**
|
|
51
12
|
|
|
52
13
|
## Related Packages
|
|
53
14
|
|
|
54
|
-
|
|
55
|
-
|
|
15
|
+
| Package | Role |
|
|
16
|
+
|---------|------|
|
|
17
|
+
| [@intentius/chant](https://www.npmjs.com/package/@intentius/chant) | Core type system, CLI, build pipeline |
|
|
18
|
+
| [@intentius/chant-lexicon-aws](https://www.npmjs.com/package/@intentius/chant-lexicon-aws) | AWS CloudFormation lexicon |
|
|
56
19
|
|
|
57
20
|
## License
|
|
58
21
|
|
package/dist/integrity.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "xxhash64",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
5
|
-
"meta.json": "
|
|
6
|
-
"types/index.d.ts": "
|
|
4
|
+
"manifest.json": "c72b64b58dec21e0",
|
|
5
|
+
"meta.json": "9ee0d2f2d1679f09",
|
|
6
|
+
"types/index.d.ts": "4e56a7de40d655c0",
|
|
7
7
|
"rules/missing-stage.ts": "6d5379e74209a735",
|
|
8
8
|
"rules/missing-script.ts": "923dde9acb46cc28",
|
|
9
9
|
"rules/deprecated-only-except.ts": "1f5a8c785777fb03",
|
|
10
10
|
"rules/artifact-no-expiry.ts": "26874cb6adfbca26",
|
|
11
11
|
"rules/wgl011.ts": "b6b97e5104d91267",
|
|
12
|
-
"rules/wgl010.ts": "1548cad287cdf286",
|
|
13
12
|
"rules/yaml-helpers.ts": "a66cc193b4ef4f0a",
|
|
13
|
+
"rules/wgl010.ts": "1548cad287cdf286",
|
|
14
14
|
"skills/gitlab-ci.md": "f860e40c2643c327"
|
|
15
15
|
},
|
|
16
|
-
"composite": "
|
|
16
|
+
"composite": "95b9f28f579d5862"
|
|
17
17
|
}
|
package/dist/manifest.json
CHANGED
package/dist/meta.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -203,6 +203,19 @@ export declare class Rule {
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
export declare class Service {
|
|
207
|
+
constructor(props: {
|
|
208
|
+
/** Full name of the image that should be used. It should contain the Registry part if needed. */
|
|
209
|
+
name: string;
|
|
210
|
+
alias?: string;
|
|
211
|
+
command?: string[];
|
|
212
|
+
docker?: Record<string, unknown>;
|
|
213
|
+
entrypoint?: string[];
|
|
214
|
+
pull_policy?: "always" | "never" | "if-not-present" | "always" | "never" | "if-not-present"[];
|
|
215
|
+
variables?: Record<string, unknown>;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
206
219
|
export declare class Trigger {
|
|
207
220
|
constructor(props: {
|
|
208
221
|
/** Path to the project, e.g. `group/project`, or `group/sub-group/project`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-gitlab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": ["src/", "dist/"],
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"prepack": "bun run bundle && bun run validate"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@intentius/chant": "0.0.
|
|
24
|
+
"@intentius/chant": "0.0.5"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"typescript": "^5.9.3"
|