@intentius/chant-lexicon-github 0.1.7 → 0.1.8
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 +21 -0
- package/dist/integrity.json +37 -37
- package/dist/manifest.json +1 -1
- package/dist/types/index.d.ts +13 -22
- package/package.json +7 -7
- package/src/codegen/docs.test.ts +4 -4
- package/src/codegen/docs.ts +2 -2
- package/src/codegen/generate-cli.ts +1 -1
- package/src/codegen/generate.test.ts +1 -1
- package/src/codegen/package.test.ts +1 -1
- package/src/codegen/package.ts +2 -5
- package/src/composites/composites.test.ts +1 -1
- package/src/coverage.test.ts +1 -1
- package/src/expression.test.ts +1 -1
- package/src/generated/index.d.ts +13 -22
- package/src/import/generator.test.ts +1 -1
- package/src/import/parser.test.ts +1 -1
- package/src/import/roundtrip.test.ts +1 -1
- package/src/lint/post-synth/gha006.test.ts +1 -1
- package/src/lint/post-synth/gha009.test.ts +1 -1
- package/src/lint/post-synth/gha011.test.ts +1 -1
- package/src/lint/post-synth/gha017.test.ts +1 -1
- package/src/lint/post-synth/gha018.test.ts +1 -1
- package/src/lint/post-synth/gha019.test.ts +1 -1
- package/src/lint/post-synth/gha020.test.ts +1 -1
- package/src/lint/post-synth/gha021.test.ts +1 -1
- package/src/lint/post-synth/gha022.test.ts +1 -1
- package/src/lint/post-synth/gha023.test.ts +1 -1
- package/src/lint/post-synth/gha024.test.ts +1 -1
- package/src/lint/post-synth/gha025.test.ts +1 -1
- package/src/lint/post-synth/gha026.test.ts +1 -1
- package/src/lint/post-synth/gha027.test.ts +1 -1
- package/src/lint/post-synth/gha028.test.ts +1 -1
- package/src/lint/post-synth/post-synth.test.ts +1 -1
- package/src/lint/rules/deprecated-action-version.test.ts +1 -1
- package/src/lint/rules/detect-secrets.test.ts +1 -1
- package/src/lint/rules/extract-inline-structs.test.ts +1 -1
- package/src/lint/rules/file-job-limit.test.ts +1 -1
- package/src/lint/rules/job-timeout.test.ts +1 -1
- package/src/lint/rules/missing-recommended-inputs.test.ts +1 -1
- package/src/lint/rules/no-hardcoded-secrets.test.ts +1 -1
- package/src/lint/rules/no-raw-expressions.test.ts +1 -1
- package/src/lint/rules/rules.test.ts +1 -1
- package/src/lint/rules/suggest-cache.test.ts +1 -1
- package/src/lint/rules/use-condition-builders.test.ts +1 -1
- package/src/lint/rules/use-matrix-builder.test.ts +1 -1
- package/src/lint/rules/use-typed-actions.test.ts +1 -1
- package/src/lint/rules/validate-concurrency.test.ts +1 -1
- package/src/lsp/completions.test.ts +1 -1
- package/src/lsp/hover.test.ts +1 -1
- package/src/package-cli.ts +2 -2
- package/src/plugin.test.ts +3 -3
- package/src/plugin.ts +19 -21
- package/src/serializer.test.ts +1 -1
- package/src/validate-cli.ts +2 -2
- package/src/validate.test.ts +2 -2
- package/src/variables.test.ts +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @intentius/chant-lexicon-github
|
|
2
|
+
|
|
3
|
+
GitHub Actions lexicon for [chant](https://intentius.io/chant/) — declare workflow definitions as typed TypeScript that serializes to `.github/workflows/*.yml`.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install --save-dev @intentius/chant @intentius/chant-lexicon-github
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Runtime observation: N/A
|
|
10
|
+
|
|
11
|
+
`chant state snapshot` and `chant state diff --live` operate by querying a runtime equivalent of each declared resource. The GitHub lexicon doesn't fit that model:
|
|
12
|
+
|
|
13
|
+
- The lexicon's chant entities describe **GitHub Actions workflow definitions**, which are git-tracked. Drift in the definition itself is just `git diff` — no observation surface needed.
|
|
14
|
+
- Workflow **runs** are events (per-execution), not declared state. They're observable via the GitHub API but the abstraction is `listRecentRuns()`, not `describeResources()` or `listArtifacts()`. That's a separate plugin contract if/when it's needed.
|
|
15
|
+
- "Is this workflow enabled in the GitHub UI?" is theoretically observable but a marginal use case.
|
|
16
|
+
|
|
17
|
+
If a concrete observation use case surfaces, file a focused issue rather than retrofitting `listArtifacts()` to fit.
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
See the main project LICENSE file.
|
package/dist/integrity.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
{
|
|
2
|
-
"algorithm": "
|
|
2
|
+
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
5
|
-
"meta.json": "
|
|
6
|
-
"types/index.d.ts": "
|
|
7
|
-
"rules/deprecated-action-version.ts": "
|
|
8
|
-
"rules/
|
|
9
|
-
"rules/
|
|
10
|
-
"rules/
|
|
11
|
-
"rules/
|
|
12
|
-
"rules/
|
|
13
|
-
"rules/
|
|
14
|
-
"rules/
|
|
15
|
-
"rules/
|
|
16
|
-
"rules/use-
|
|
17
|
-
"rules/
|
|
18
|
-
"rules/use-
|
|
19
|
-
"rules/
|
|
20
|
-
"rules/
|
|
21
|
-
"rules/
|
|
22
|
-
"rules/
|
|
23
|
-
"rules/
|
|
24
|
-
"rules/
|
|
25
|
-
"rules/
|
|
26
|
-
"rules/
|
|
27
|
-
"rules/
|
|
28
|
-
"rules/
|
|
29
|
-
"rules/
|
|
30
|
-
"rules/
|
|
31
|
-
"rules/
|
|
32
|
-
"rules/
|
|
33
|
-
"rules/
|
|
34
|
-
"rules/
|
|
35
|
-
"rules/
|
|
36
|
-
"skills/chant-github.md": "
|
|
37
|
-
"skills/chant-github-patterns.md": "
|
|
38
|
-
"skills/chant-github-security.md": "
|
|
4
|
+
"manifest.json": "f42e4cc15759ed70403dc2920df4640045088727844c58adde6d4b51708ebecc",
|
|
5
|
+
"meta.json": "18d445d9df6b533016ab023bd606a2598034412003d2f110f1ce017738e1a76f",
|
|
6
|
+
"types/index.d.ts": "64e1dcb5c0e1995b576300ca1be3ec014f7d32600113858bf096861763e090ee",
|
|
7
|
+
"rules/deprecated-action-version.ts": "d41e6e532ab7f623af1bee4ac5279fcb2baada7defa1c5d022a5bc71983e8797",
|
|
8
|
+
"rules/detect-secrets.ts": "5829832eb7b43993424971041ed386b196850183bffd34bddd6439f99061e4ae",
|
|
9
|
+
"rules/extract-inline-structs.ts": "8f8147c200de8ffd0620dfdcca2e2cea76a520303ce431479ebecad6aa26aab5",
|
|
10
|
+
"rules/file-job-limit.ts": "80f494c9e2eedd70b1df0c672215968faad18be139a430197e452a72ad38a7d6",
|
|
11
|
+
"rules/job-timeout.ts": "312b249ee3fd9d3d0b11f95ab6567c586ec366af9dd4f19d43b280de892838ad",
|
|
12
|
+
"rules/missing-recommended-inputs.ts": "547faca227a7e43fa137e3d79fb77b79193a3a59c9455a152711b7d079c3b3df",
|
|
13
|
+
"rules/no-hardcoded-secrets.ts": "b9e73a7233d64d4037a48857faba43d14fa5f9c22e22d3525bb0917fa64db474",
|
|
14
|
+
"rules/no-raw-expressions.ts": "a266fceae6522a31df509210153d3f1f88dbba323f443e0f9263961884583179",
|
|
15
|
+
"rules/suggest-cache.ts": "cf8e59ea29031fc0c26229260708a00784691a51e67ac5d65521fb1c25481f9e",
|
|
16
|
+
"rules/use-condition-builders.ts": "75aa7dc377f14068676614d9bfa85646a04aeed14738a002ad19117efb915169",
|
|
17
|
+
"rules/use-matrix-builder.ts": "cbabb3e91222243627c558c2106ee91a34a59e41c003ee507e37da29926e2e55",
|
|
18
|
+
"rules/use-typed-actions.ts": "ad0775b64b268365d450eaa4c08e7ff17f02074392e04d7a746708bf214afd27",
|
|
19
|
+
"rules/validate-concurrency.ts": "848a6cedc6aeb7f0bc3715368436e40d96f8074e6c6987f1ea010f7e53ce9541",
|
|
20
|
+
"rules/gha006.ts": "7e2977d34851ce2ed9f91c4dd78ecda8d4de099ceaac1cd9ab74960a193133a3",
|
|
21
|
+
"rules/gha009.ts": "0f9a261e886309679494da32b72a0d9ea20017e5da75a9d59a04846a0e4d78db",
|
|
22
|
+
"rules/gha011.ts": "53b7ca79b5bf56e5793a9b7a44ae0ac766eb5acf0669005e7810cb7762bab79c",
|
|
23
|
+
"rules/gha017.ts": "ec62dac7f9d69f36978cb461c4ba391a7e445d410bbfa497cddcb1b12cfd5904",
|
|
24
|
+
"rules/gha018.ts": "2c71c5accb96bccfa01075e7f8f4ad66e6d9a68a81b86f89a68cabb9c144e140",
|
|
25
|
+
"rules/gha019.ts": "d0b33d63812c9cba2ebf9f2d85d8cf22068ea96460cd2143bdfb4d2a4d58fe2e",
|
|
26
|
+
"rules/gha020.ts": "72dc68a1eae98e0e4611dfe62eecda6900c22f286825bc3c5133f1f5e2e62d43",
|
|
27
|
+
"rules/gha021.ts": "01463240871326c2798abb3a3cdccba95b44efa1e0083e54a81824e8875dcc37",
|
|
28
|
+
"rules/gha022.ts": "7bfb5e280ace280f06b8b64645863210320cd38380a2fc7b95a3455753a50f9c",
|
|
29
|
+
"rules/gha023.ts": "708468e098e434739bd62573d8559318c08a2830aa8ac39d2bf465e7da012b38",
|
|
30
|
+
"rules/gha024.ts": "4500e91debb6e9ca23f247d6a8c3f0f7c74785ff852db130143590328353ab4d",
|
|
31
|
+
"rules/gha025.ts": "e2a8f0f67d07fd0f83a40d0fce443b8d0f1dd8f4cd3e3ed045937f3cc3305afc",
|
|
32
|
+
"rules/gha026.ts": "1c0278cb453dad28f417fd11fd30d83402a64ccb809f366a5b46ffceb3466da6",
|
|
33
|
+
"rules/gha027.ts": "5a266987c65dc92ca77c1d4c9b8fa29d6435275d399819dec5027be3f2d96239",
|
|
34
|
+
"rules/gha028.ts": "5d1f06b635354b67557f0dbdc2f11ca4c5b8e8541b85b1c135b6f02ef147d9a0",
|
|
35
|
+
"rules/yaml-helpers.ts": "4729afd9ff287dbef38b84298b130f5ab8822a351d9d37111a7ed4cb589ced58",
|
|
36
|
+
"skills/chant-github.md": "f3707f09634be4bbb45a6be279f17bb27f275b98e6d3337cc8872c1623ba050f",
|
|
37
|
+
"skills/chant-github-patterns.md": "bb3abef289a8fdfcf07d6bb2d7289dcb2f38bc0cb0321ea320b78b45a6f548c0",
|
|
38
|
+
"skills/chant-github-security.md": "aab111cb0871cad30281ce48d7da23663689619351029219e2be019a1a61e394"
|
|
39
39
|
},
|
|
40
|
-
"composite": "
|
|
40
|
+
"composite": "27c66c06d924b07c0a8654138ea83b38e334c6f4f87442b5bf05067f7026c76b"
|
|
41
41
|
}
|
package/dist/manifest.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -13,19 +13,17 @@ export declare class Concurrency {
|
|
|
13
13
|
|
|
14
14
|
export declare class Container {
|
|
15
15
|
constructor(props: {
|
|
16
|
-
/**
|
|
16
|
+
/** Docker image */
|
|
17
17
|
image: string;
|
|
18
|
-
/**
|
|
19
|
-
credentials?: Record<string,
|
|
20
|
-
/**
|
|
21
|
-
env?:
|
|
22
|
-
/**
|
|
18
|
+
/** Registry credentials */
|
|
19
|
+
credentials?: Record<string, string>;
|
|
20
|
+
/** Environment variables */
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
/** Docker options */
|
|
23
23
|
options?: string;
|
|
24
|
-
/**
|
|
25
|
-
ports?:
|
|
26
|
-
/**
|
|
27
|
-
To specify a volume, you specify the source and destination path: <source>:<destinationPath>
|
|
28
|
-
The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
|
|
24
|
+
/** Exposed ports */
|
|
25
|
+
ports?: number[];
|
|
26
|
+
/** Volume mounts */
|
|
29
27
|
volumes?: string[];
|
|
30
28
|
});
|
|
31
29
|
}
|
|
@@ -183,19 +181,12 @@ export declare class ScheduleTrigger {
|
|
|
183
181
|
|
|
184
182
|
export declare class Service {
|
|
185
183
|
constructor(props: {
|
|
186
|
-
/**
|
|
184
|
+
/** Docker image */
|
|
187
185
|
image: string;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/** Sets an array of environment variables in the container. */
|
|
191
|
-
env?: any;
|
|
192
|
-
/** Additional Docker container resource options. For a list of options, see https://docs.docker.com/engine/reference/commandline/create/#options. */
|
|
186
|
+
credentials?: Record<string, string>;
|
|
187
|
+
env?: Record<string, string>;
|
|
193
188
|
options?: string;
|
|
194
|
-
|
|
195
|
-
ports?: (number | string)[];
|
|
196
|
-
/** Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
|
|
197
|
-
To specify a volume, you specify the source and destination path: <source>:<destinationPath>
|
|
198
|
-
The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
|
|
189
|
+
ports?: number[];
|
|
199
190
|
volumes?: string[];
|
|
200
191
|
});
|
|
201
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-github",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "GitHub Actions lexicon for chant — declarative IaC in TypeScript",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"./types": "./dist/types/index.d.ts"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
|
-
"generate": "
|
|
40
|
-
"bundle": "
|
|
41
|
-
"validate": "
|
|
42
|
-
"docs": "
|
|
43
|
-
"prepack": "
|
|
39
|
+
"generate": "tsx src/codegen/generate-cli.ts",
|
|
40
|
+
"bundle": "tsx src/package-cli.ts",
|
|
41
|
+
"validate": "tsx src/validate-cli.ts",
|
|
42
|
+
"docs": "tsx src/codegen/docs-cli.ts",
|
|
43
|
+
"prepack": "npm run generate && npm run bundle && npm run validate"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@intentius/chant": "
|
|
46
|
+
"@intentius/chant": "*",
|
|
47
47
|
"typescript": "^5.9.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
package/src/codegen/docs.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
2
|
-
import { existsSync } from "fs";
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
3
|
import { join, dirname } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ describe("docs pipeline", () => {
|
|
|
13
13
|
test("docs.ts exports generateDocs function", () => {
|
|
14
14
|
// docs.ts has template literal parse issues in Bun due to ${{ }} expressions
|
|
15
15
|
// in inline strings. Verify the file exists and contains the export.
|
|
16
|
-
const content =
|
|
17
|
-
expect(content).
|
|
16
|
+
const content = readFileSync(join(thisDir, "docs.ts"), "utf8");
|
|
17
|
+
expect(content).toContain("export async function generateDocs");
|
|
18
18
|
});
|
|
19
19
|
});
|
package/src/codegen/docs.ts
CHANGED
|
@@ -1001,10 +1001,10 @@ export default {
|
|
|
1001
1001
|
|
|
1002
1002
|
\`\`\`bash
|
|
1003
1003
|
cd examples/getting-started
|
|
1004
|
-
|
|
1004
|
+
npm install
|
|
1005
1005
|
chant build # produces .github/workflows/ci.yml
|
|
1006
1006
|
chant lint # runs lint rules
|
|
1007
|
-
|
|
1007
|
+
npx vitest run # run the tests
|
|
1008
1008
|
\`\`\`
|
|
1009
1009
|
|
|
1010
1010
|
## Getting Started
|
package/src/codegen/package.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* GitHub Actions lexicon packaging — delegates to core packagePipeline.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { createRequire } from "module";
|
|
6
5
|
import { readFileSync } from "fs";
|
|
7
|
-
|
|
6
|
+
import { githubPlugin } from "../plugin";
|
|
8
7
|
import { join, dirname } from "path";
|
|
9
8
|
import { fileURLToPath } from "url";
|
|
10
9
|
import type { IntrinsicDef } from "@intentius/chant/lexicon";
|
|
@@ -52,9 +51,7 @@ export async function packageLexicon(opts: PackageOptions = {}): Promise<Package
|
|
|
52
51
|
|
|
53
52
|
srcDir: pkgDir,
|
|
54
53
|
|
|
55
|
-
collectSkills: () => {
|
|
56
|
-
const { githubPlugin } = require("../plugin");
|
|
57
|
-
const skillDefs = githubPlugin.skills?.() ?? [];
|
|
54
|
+
collectSkills: () => { const skillDefs = githubPlugin.skills?.() ?? [];
|
|
58
55
|
return collectSkills(skillDefs);
|
|
59
56
|
},
|
|
60
57
|
|
package/src/coverage.test.ts
CHANGED
package/src/expression.test.ts
CHANGED
package/src/generated/index.d.ts
CHANGED
|
@@ -13,19 +13,17 @@ export declare class Concurrency {
|
|
|
13
13
|
|
|
14
14
|
export declare class Container {
|
|
15
15
|
constructor(props: {
|
|
16
|
-
/**
|
|
16
|
+
/** Docker image */
|
|
17
17
|
image: string;
|
|
18
|
-
/**
|
|
19
|
-
credentials?: Record<string,
|
|
20
|
-
/**
|
|
21
|
-
env?:
|
|
22
|
-
/**
|
|
18
|
+
/** Registry credentials */
|
|
19
|
+
credentials?: Record<string, string>;
|
|
20
|
+
/** Environment variables */
|
|
21
|
+
env?: Record<string, string>;
|
|
22
|
+
/** Docker options */
|
|
23
23
|
options?: string;
|
|
24
|
-
/**
|
|
25
|
-
ports?:
|
|
26
|
-
/**
|
|
27
|
-
To specify a volume, you specify the source and destination path: <source>:<destinationPath>
|
|
28
|
-
The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
|
|
24
|
+
/** Exposed ports */
|
|
25
|
+
ports?: number[];
|
|
26
|
+
/** Volume mounts */
|
|
29
27
|
volumes?: string[];
|
|
30
28
|
});
|
|
31
29
|
}
|
|
@@ -183,19 +181,12 @@ export declare class ScheduleTrigger {
|
|
|
183
181
|
|
|
184
182
|
export declare class Service {
|
|
185
183
|
constructor(props: {
|
|
186
|
-
/**
|
|
184
|
+
/** Docker image */
|
|
187
185
|
image: string;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/** Sets an array of environment variables in the container. */
|
|
191
|
-
env?: any;
|
|
192
|
-
/** Additional Docker container resource options. For a list of options, see https://docs.docker.com/engine/reference/commandline/create/#options. */
|
|
186
|
+
credentials?: Record<string, string>;
|
|
187
|
+
env?: Record<string, string>;
|
|
193
188
|
options?: string;
|
|
194
|
-
|
|
195
|
-
ports?: (number | string)[];
|
|
196
|
-
/** Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host.
|
|
197
|
-
To specify a volume, you specify the source and destination path: <source>:<destinationPath>
|
|
198
|
-
The <source> is a volume name or an absolute path on the host machine, and <destinationPath> is an absolute path in the container. */
|
|
189
|
+
ports?: number[];
|
|
199
190
|
volumes?: string[];
|
|
200
191
|
});
|
|
201
192
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import type { PostSynthContext } from "@intentius/chant/lint/post-synth";
|
|
3
3
|
import type { SerializerResult } from "@intentius/chant/serializer";
|
|
4
4
|
import { gha006 } from "./gha006";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import * as ts from "typescript";
|
|
3
3
|
import type { LintContext } from "@intentius/chant/lint/rule";
|
|
4
4
|
import { deprecatedActionVersionRule } from "./deprecated-action-version";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import * as ts from "typescript";
|
|
3
3
|
import type { LintContext } from "@intentius/chant/lint/rule";
|
|
4
4
|
import { extractInlineStructsRule } from "./extract-inline-structs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import * as ts from "typescript";
|
|
3
3
|
import type { LintContext } from "@intentius/chant/lint/rule";
|
|
4
4
|
import { missingRecommendedInputsRule } from "./missing-recommended-inputs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import * as ts from "typescript";
|
|
3
3
|
import type { LintContext } from "@intentius/chant/lint/rule";
|
|
4
4
|
import { useConditionBuildersRule } from "./use-condition-builders";
|
package/src/lsp/hover.test.ts
CHANGED
package/src/package-cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
2
|
/**
|
|
3
|
-
* Thin entry point for `
|
|
3
|
+
* Thin entry point for `npm run bundle` in lexicon-github.
|
|
4
4
|
*/
|
|
5
5
|
import { generate, writeGeneratedFiles } from "./codegen/generate";
|
|
6
6
|
import { packageLexicon } from "./codegen/package";
|
package/src/plugin.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import { githubPlugin } from "./plugin";
|
|
3
3
|
|
|
4
4
|
describe("githubPlugin", () => {
|
|
@@ -80,13 +80,13 @@ describe("githubPlugin", () => {
|
|
|
80
80
|
test("provides MCP tools", () => {
|
|
81
81
|
const tools = githubPlugin.mcpTools!();
|
|
82
82
|
expect(tools.length).toBe(1);
|
|
83
|
-
expect(tools[0].name).toBe("diff");
|
|
83
|
+
expect(tools[0].name).toBe("github:diff");
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
test("provides MCP resources", () => {
|
|
87
87
|
const resources = githubPlugin.mcpResources!();
|
|
88
88
|
expect(resources.length).toBe(2);
|
|
89
|
-
expect(resources[0].uri).toBe("resource-catalog");
|
|
89
|
+
expect(resources[0].uri).toBe("github:resource-catalog");
|
|
90
90
|
expect(resources[1].uri).toBe("examples/basic-ci");
|
|
91
91
|
});
|
|
92
92
|
|
package/src/plugin.ts
CHANGED
|
@@ -5,34 +5,36 @@
|
|
|
5
5
|
* for GitHub Actions workflows.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { createRequire } from "module";
|
|
9
8
|
import type { LexiconPlugin, IntrinsicDef, InitTemplateSet } from "@intentius/chant/lexicon";
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
9
|
import type { LintRule } from "@intentius/chant/lint/rule";
|
|
12
10
|
import { discoverPostSynthChecks } from "@intentius/chant/lint/discover";
|
|
13
11
|
import { createSkillsLoader, createDiffTool, createCatalogResource } from "@intentius/chant/lexicon-plugin-helpers";
|
|
14
12
|
import { join, dirname } from "path";
|
|
15
13
|
import { fileURLToPath } from "url";
|
|
16
14
|
import { githubSerializer } from "./serializer";
|
|
15
|
+
import { useTypedActionsRule } from "./lint/rules/use-typed-actions";
|
|
16
|
+
import { useConditionBuildersRule } from "./lint/rules/use-condition-builders";
|
|
17
|
+
import { noHardcodedSecretsRule } from "./lint/rules/no-hardcoded-secrets";
|
|
18
|
+
import { useMatrixBuilderRule } from "./lint/rules/use-matrix-builder";
|
|
19
|
+
import { extractInlineStructsRule } from "./lint/rules/extract-inline-structs";
|
|
20
|
+
import { fileJobLimitRule } from "./lint/rules/file-job-limit";
|
|
21
|
+
import { noRawExpressionsRule } from "./lint/rules/no-raw-expressions";
|
|
22
|
+
import { missingRecommendedInputsRule } from "./lint/rules/missing-recommended-inputs";
|
|
23
|
+
import { deprecatedActionVersionRule } from "./lint/rules/deprecated-action-version";
|
|
24
|
+
import { jobTimeoutRule } from "./lint/rules/job-timeout";
|
|
25
|
+
import { suggestCacheRule } from "./lint/rules/suggest-cache";
|
|
26
|
+
import { validateConcurrencyRule } from "./lint/rules/validate-concurrency";
|
|
27
|
+
import { detectSecretsRule } from "./lint/rules/detect-secrets";
|
|
28
|
+
import { githubCompletions } from "./lsp/completions";
|
|
29
|
+
import { githubHover } from "./lsp/hover";
|
|
30
|
+
import { GitHubActionsParser } from "./import/parser";
|
|
31
|
+
import { GitHubActionsGenerator } from "./import/generator";
|
|
17
32
|
|
|
18
33
|
export const githubPlugin: LexiconPlugin = {
|
|
19
34
|
name: "github",
|
|
20
35
|
serializer: githubSerializer,
|
|
21
36
|
|
|
22
37
|
lintRules(): LintRule[] {
|
|
23
|
-
const { useTypedActionsRule } = require("./lint/rules/use-typed-actions");
|
|
24
|
-
const { useConditionBuildersRule } = require("./lint/rules/use-condition-builders");
|
|
25
|
-
const { noHardcodedSecretsRule } = require("./lint/rules/no-hardcoded-secrets");
|
|
26
|
-
const { useMatrixBuilderRule } = require("./lint/rules/use-matrix-builder");
|
|
27
|
-
const { extractInlineStructsRule } = require("./lint/rules/extract-inline-structs");
|
|
28
|
-
const { fileJobLimitRule } = require("./lint/rules/file-job-limit");
|
|
29
|
-
const { noRawExpressionsRule } = require("./lint/rules/no-raw-expressions");
|
|
30
|
-
const { missingRecommendedInputsRule } = require("./lint/rules/missing-recommended-inputs");
|
|
31
|
-
const { deprecatedActionVersionRule } = require("./lint/rules/deprecated-action-version");
|
|
32
|
-
const { jobTimeoutRule } = require("./lint/rules/job-timeout");
|
|
33
|
-
const { suggestCacheRule } = require("./lint/rules/suggest-cache");
|
|
34
|
-
const { validateConcurrencyRule } = require("./lint/rules/validate-concurrency");
|
|
35
|
-
const { detectSecretsRule } = require("./lint/rules/detect-secrets");
|
|
36
38
|
return [
|
|
37
39
|
useTypedActionsRule,
|
|
38
40
|
useConditionBuildersRule,
|
|
@@ -159,22 +161,18 @@ export const build = new Job({
|
|
|
159
161
|
},
|
|
160
162
|
|
|
161
163
|
completionProvider(ctx: import("@intentius/chant/lsp/types").CompletionContext) {
|
|
162
|
-
const { githubCompletions } = require("./lsp/completions");
|
|
163
164
|
return githubCompletions(ctx);
|
|
164
165
|
},
|
|
165
166
|
|
|
166
167
|
hoverProvider(ctx: import("@intentius/chant/lsp/types").HoverContext) {
|
|
167
|
-
const { githubHover } = require("./lsp/hover");
|
|
168
168
|
return githubHover(ctx);
|
|
169
169
|
},
|
|
170
170
|
|
|
171
171
|
templateParser() {
|
|
172
|
-
const { GitHubActionsParser } = require("./import/parser");
|
|
173
172
|
return new GitHubActionsParser();
|
|
174
173
|
},
|
|
175
174
|
|
|
176
175
|
templateGenerator() {
|
|
177
|
-
const { GitHubActionsGenerator } = require("./import/generator");
|
|
178
176
|
return new GitHubActionsGenerator();
|
|
179
177
|
},
|
|
180
178
|
|
|
@@ -226,12 +224,12 @@ export const build = new Job({
|
|
|
226
224
|
},
|
|
227
225
|
|
|
228
226
|
mcpTools() {
|
|
229
|
-
return [createDiffTool(githubSerializer, "Compare current build output against previous output for GitHub Actions")];
|
|
227
|
+
return [createDiffTool(githubSerializer, "Compare current build output against previous output for GitHub Actions", "github")];
|
|
230
228
|
},
|
|
231
229
|
|
|
232
230
|
mcpResources() {
|
|
233
231
|
return [
|
|
234
|
-
createCatalogResource(import.meta.url, "GitHub Actions Entity Catalog", "JSON list of all supported GitHub Actions entity types", "lexicon-github.json"),
|
|
232
|
+
createCatalogResource(import.meta.url, "GitHub Actions Entity Catalog", "JSON list of all supported GitHub Actions entity types", "lexicon-github.json", "github"),
|
|
235
233
|
{
|
|
236
234
|
uri: "examples/basic-ci",
|
|
237
235
|
name: "Basic CI Example",
|
package/src/serializer.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import { githubSerializer } from "./serializer";
|
|
3
3
|
import { DECLARABLE_MARKER, type Declarable } from "@intentius/chant/declarable";
|
|
4
4
|
import { INTRINSIC_MARKER } from "@intentius/chant/intrinsic";
|
package/src/validate-cli.ts
CHANGED
package/src/validate.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, test, expect } from "
|
|
1
|
+
import { describe, test, expect } from "vitest";
|
|
2
2
|
import { validate } from "./validate";
|
|
3
3
|
|
|
4
4
|
describe("validate", () => {
|
|
@@ -8,5 +8,5 @@ describe("validate", () => {
|
|
|
8
8
|
|
|
9
9
|
// Note: Full validation requires generated artifacts to exist.
|
|
10
10
|
// This test verifies the validate module loads correctly.
|
|
11
|
-
// Run `
|
|
11
|
+
// Run `npm run generate` first for full validation tests.
|
|
12
12
|
});
|
package/src/variables.test.ts
CHANGED