@intentius/chant-lexicon-github 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.
- package/dist/action-pins.js +53 -0
- package/dist/codegen/docs-cli.js +2 -0
- package/dist/codegen/docs.js +142 -0
- package/dist/codegen/generate-cli.js +26 -0
- package/dist/codegen/generate-lexicon.js +36 -0
- package/dist/codegen/generate-typescript.js +108 -0
- package/dist/codegen/generate.js +111 -0
- package/dist/codegen/naming.js +49 -0
- package/dist/codegen/package.js +40 -0
- package/dist/codegen/parse.js +595 -0
- package/dist/codegen/patches.js +36 -0
- package/dist/components/ci-jobs.js +84 -0
- package/dist/components/generate-op-pipeline.js +440 -0
- package/dist/components/generate-op-waves-pipeline.js +158 -0
- package/dist/components/generate-pipeline.d.ts.map +1 -1
- package/dist/components/generate-pipeline.js +476 -0
- package/dist/composites/cache.js +17 -0
- package/dist/composites/catalog.js +859 -0
- package/dist/composites/checkout.js +25 -0
- package/dist/composites/dependabot.js +43 -0
- package/dist/composites/deploy-environment.js +38 -0
- package/dist/composites/docker-build.js +70 -0
- package/dist/composites/download-artifact.js +18 -0
- package/dist/composites/go-ci.js +62 -0
- package/dist/composites/index.js +15 -0
- package/dist/composites/node-ci.js +44 -0
- package/dist/composites/node-pipeline.js +96 -0
- package/dist/composites/pr-plan-report.js +129 -0
- package/dist/composites/python-ci.js +60 -0
- package/dist/composites/setup-go.js +18 -0
- package/dist/composites/setup-node.js +21 -0
- package/dist/composites/setup-python.js +18 -0
- package/dist/composites/upload-artifact.js +19 -0
- package/dist/coverage.js +32 -0
- package/dist/expression.js +177 -0
- package/dist/generated/index.js +26 -0
- package/dist/generated/runtime.js +4 -0
- package/dist/graph-edges.js +174 -0
- package/dist/import/generator.js +108 -0
- package/dist/import/parser.js +69 -0
- package/dist/index.js +22 -0
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.js +69 -0
- package/dist/lint/audit-lineage.js +168 -0
- package/dist/lint/post-synth/gha006.js +50 -0
- package/dist/lint/post-synth/gha009.js +35 -0
- package/dist/lint/post-synth/gha011.js +34 -0
- package/dist/lint/post-synth/gha013.js +40 -0
- package/dist/lint/post-synth/gha017.js +25 -0
- package/dist/lint/post-synth/gha018.js +33 -0
- package/dist/lint/post-synth/gha019.js +58 -0
- package/dist/lint/post-synth/gha021.js +42 -0
- package/dist/lint/post-synth/gha022.js +44 -0
- package/dist/lint/post-synth/gha023.js +37 -0
- package/dist/lint/post-synth/gha024.js +32 -0
- package/dist/lint/post-synth/gha025.js +33 -0
- package/dist/lint/post-synth/gha026.js +32 -0
- package/dist/lint/post-synth/gha027.js +46 -0
- package/dist/lint/post-synth/gha028.js +28 -0
- package/dist/lint/post-synth/gha029.js +56 -0
- package/dist/lint/post-synth/gha030.js +35 -0
- package/dist/lint/post-synth/gha031.js +75 -0
- package/dist/lint/post-synth/gha032.js +35 -0
- package/dist/lint/post-synth/gha033.js +39 -0
- package/dist/lint/post-synth/gha034.js +35 -0
- package/dist/lint/post-synth/gha035.js +50 -0
- package/dist/lint/post-synth/gha036.js +37 -0
- package/dist/lint/post-synth/gha037.js +41 -0
- package/dist/lint/post-synth/gha038.js +35 -0
- package/dist/lint/post-synth/gha039.js +34 -0
- package/dist/lint/post-synth/gha040.js +36 -0
- package/dist/lint/post-synth/gha041.js +32 -0
- package/dist/lint/post-synth/gha042.js +33 -0
- package/dist/lint/post-synth/gha043.js +35 -0
- package/dist/lint/post-synth/gha044.js +36 -0
- package/dist/lint/post-synth/gha045.js +33 -0
- package/dist/lint/post-synth/gha046.js +55 -0
- package/dist/lint/post-synth/gha047.js +44 -0
- package/dist/lint/post-synth/gha048.js +34 -0
- package/dist/lint/post-synth/gha049.js +36 -0
- package/dist/lint/post-synth/gha050.js +37 -0
- package/dist/lint/post-synth/gha051.js +38 -0
- package/dist/lint/post-synth/gha052.js +35 -0
- package/dist/lint/post-synth/gha053.js +34 -0
- package/dist/lint/post-synth/gha054.js +35 -0
- package/dist/lint/post-synth/gha055.js +44 -0
- package/dist/lint/post-synth/gha056.js +32 -0
- package/dist/lint/post-synth/gha057.js +35 -0
- package/dist/lint/post-synth/gha058.js +42 -0
- package/dist/lint/post-synth/gha059.js +119 -0
- package/dist/lint/post-synth/gha060.js +129 -0
- package/dist/lint/post-synth/gha061.js +78 -0
- package/dist/lint/post-synth/gha062.js +65 -0
- package/dist/lint/post-synth/gha063.js +56 -0
- package/dist/lint/post-synth/gha064.js +47 -0
- package/dist/lint/post-synth/gha065.js +125 -0
- package/dist/lint/post-synth/gha066.js +40 -0
- package/dist/lint/post-synth/gha067.js +75 -0
- package/dist/lint/post-synth/gha068.js +47 -0
- package/dist/lint/post-synth/gha069.js +99 -0
- package/dist/lint/post-synth/index.js +114 -0
- package/dist/lint/post-synth/yaml-helpers.js +465 -0
- package/dist/lint/rules/data/action-usage-policy.js +16 -0
- package/dist/lint/rules/data/advisory-feed.js +15 -0
- package/dist/lint/rules/data/deprecated-versions.js +14 -0
- package/dist/lint/rules/data/flagged-actions.js +18 -0
- package/dist/lint/rules/data/known-action-slugs.js +38 -0
- package/dist/lint/rules/data/known-actions.js +12 -0
- package/dist/lint/rules/data/preinstalled-tools.js +36 -0
- package/dist/lint/rules/data/recommended-inputs.js +9 -0
- package/dist/lint/rules/data/risky-features.js +22 -0
- package/dist/lint/rules/data/secret-patterns.js +30 -0
- package/dist/lint/rules/data/trusted-action-owners.js +12 -0
- package/dist/lint/rules/data/untrusted-contexts.js +44 -0
- package/dist/lint/rules/deprecated-action-version.js +44 -0
- package/dist/lint/rules/detect-secrets.js +45 -0
- package/dist/lint/rules/extract-inline-structs.js +55 -0
- package/dist/lint/rules/file-job-limit.js +43 -0
- package/dist/lint/rules/index.js +16 -0
- package/dist/lint/rules/job-timeout.js +53 -0
- package/dist/lint/rules/missing-recommended-inputs.js +51 -0
- package/dist/lint/rules/no-hardcoded-secrets.js +39 -0
- package/dist/lint/rules/no-raw-expressions.js +44 -0
- package/dist/lint/rules/suggest-cache.js +60 -0
- package/dist/lint/rules/use-condition-builders.js +37 -0
- package/dist/lint/rules/use-matrix-builder.js +36 -0
- package/dist/lint/rules/use-typed-actions.js +41 -0
- package/dist/lint/rules/validate-concurrency.js +59 -0
- package/dist/lsp/completions.d.ts.map +1 -1
- package/dist/lsp/completions.js +18 -0
- package/dist/lsp/hover.d.ts.map +1 -1
- package/dist/lsp/hover.js +33 -0
- package/dist/manifest.json +1 -1
- package/dist/mcp/context-tools.js +152 -0
- package/dist/package-cli.js +20 -0
- package/dist/plugin.js +344 -0
- package/dist/serializer.js +572 -0
- package/dist/spec/fetch.js +46 -0
- package/dist/validate-cli.js +16 -0
- package/dist/validate.js +38 -0
- package/dist/variables.js +41 -0
- package/package.json +6 -6
- package/src/codegen/package.ts +2 -2
- package/src/components/__fixtures__/pr-loop-build.github.golden.yml +6 -2
- package/src/components/__fixtures__/pr-loop-waves.github.golden.yml +178 -0
- package/src/components/__fixtures__/pr-loop.github.golden.yml +6 -2
- package/src/components/generate-pipeline.ts +66 -29
- package/src/components/generate-pr-pipeline.test.ts +44 -20
- package/src/components/generate-pr-waves-pipeline.test.ts +117 -0
- package/src/lsp/completions.ts +2 -1
- package/src/lsp/hover.ts +2 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GitHub pull-request workflow with a gate per wave on merge (#4003):
|
|
3
|
+
* `--pr-loop --wave-gate <gate>` keeps the plan job on the pull request and
|
|
4
|
+
* writes one apply job per wave of the component graph, each running
|
|
5
|
+
* `pr-apply --wave-gate <gate> --wave <k>` after the one before it. The whole
|
|
6
|
+
* file has a golden, and actionlint checks it when it is installed.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { execFileSync } from "node:child_process";
|
|
10
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { tmpdir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { describe, expect, test } from "vitest";
|
|
14
|
+
import { parseYAML } from "@intentius/chant/yaml";
|
|
15
|
+
import type { DriverComponent } from "@intentius/chant/components/driver";
|
|
16
|
+
import { generateGithubPipeline } from "./generate-pipeline";
|
|
17
|
+
|
|
18
|
+
const root = (name: string, dependsOn: string[] = []): DriverComponent => ({
|
|
19
|
+
name,
|
|
20
|
+
dependsOn,
|
|
21
|
+
deploy: [{ phase: "Apply", steps: [{ kind: "terraform-apply", root: name }] }],
|
|
22
|
+
});
|
|
23
|
+
/** Three waves: net, then app, then web. */
|
|
24
|
+
const ESTATE: DriverComponent[] = [root("net"), root("app", ["net"]), root("web", ["app"])];
|
|
25
|
+
|
|
26
|
+
const GOLDEN = join(import.meta.dirname, "__fixtures__", "pr-loop-waves.github.golden.yml");
|
|
27
|
+
|
|
28
|
+
interface Step {
|
|
29
|
+
name?: string;
|
|
30
|
+
if?: string;
|
|
31
|
+
uses?: string;
|
|
32
|
+
run?: string;
|
|
33
|
+
env?: Record<string, string>;
|
|
34
|
+
with?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
interface Job {
|
|
37
|
+
if: string;
|
|
38
|
+
needs?: string[];
|
|
39
|
+
concurrency?: Record<string, unknown>;
|
|
40
|
+
permissions: Record<string, string>;
|
|
41
|
+
steps: Step[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function hasActionlint(): boolean {
|
|
45
|
+
try {
|
|
46
|
+
execFileSync("actionlint", ["-version"], { stdio: "ignore" });
|
|
47
|
+
return true;
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe("the GitHub pull-request workflow with a gate per wave (#4003)", () => {
|
|
54
|
+
const result = generateGithubPipeline(ESTATE, { env: "prod", prLoop: {}, gatedWaves: { gate: "release" } });
|
|
55
|
+
const doc = parseYAML(result.yaml) as { jobs: Record<string, Job> };
|
|
56
|
+
|
|
57
|
+
test("matches its golden", () => {
|
|
58
|
+
if (process.env.UPDATE_GOLDEN) writeFileSync(GOLDEN, result.yaml);
|
|
59
|
+
expect(result.yaml).toBe(readFileSync(GOLDEN, "utf-8"));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("keeps the plan job, and writes one apply job per wave, each needing the one before", () => {
|
|
63
|
+
expect(Object.keys(doc.jobs)).toEqual(["plan", "apply-wave-1", "apply-wave-2", "apply-wave-3"]);
|
|
64
|
+
expect(result.jobs.map((j) => [j.jobName, j.needs])).toEqual([
|
|
65
|
+
["plan", []],
|
|
66
|
+
["apply-wave-1", []],
|
|
67
|
+
["apply-wave-2", ["apply-wave-1"]],
|
|
68
|
+
["apply-wave-3", ["apply-wave-2"]],
|
|
69
|
+
]);
|
|
70
|
+
expect(doc.jobs["apply-wave-2"]!.needs).toEqual(["apply-wave-1"]);
|
|
71
|
+
const plan = doc.jobs.plan!.steps.find((s) => s.run?.includes("ci run plan"))!;
|
|
72
|
+
// The plan passes the wave gate for its note (#4003), and runs no wave.
|
|
73
|
+
expect(plan.run).toContain("--forge github --wave-gate release");
|
|
74
|
+
expect(plan.run).not.toContain("--wave ");
|
|
75
|
+
for (const k of [1, 2, 3]) {
|
|
76
|
+
const job = doc.jobs[`apply-wave-${k}`]!;
|
|
77
|
+
expect(job.if).toBe("github.event_name == 'push'");
|
|
78
|
+
expect(job.concurrency).toEqual({ group: "chant-apply-prod", "cancel-in-progress": false });
|
|
79
|
+
expect(job.permissions.contents).toBe("write");
|
|
80
|
+
const run = job.steps.find((s) => s.run?.includes("ci run apply"))!.run!;
|
|
81
|
+
// #4156: through chant ci run, which runs pr-apply --require-review --wave-gate release --resume ... --wave <k>.
|
|
82
|
+
expect(run).toContain(`chant ci run apply --in-place --base "$BASE_SHA" --env prod --gate pr-apply --forge github --wave-gate release --wave ${k}`);
|
|
83
|
+
expect(job.steps.find((s) => s.run?.includes("ci run apply"))!.env?.CHANT_RUNNER_KEY).toBe("${{ secrets.CHANT_RUNNER_KEY }}");
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("each wave restores the commit's newest record and saves its own, so wave k reads what wave k-1 left", () => {
|
|
88
|
+
for (const k of [1, 2, 3]) {
|
|
89
|
+
const steps = doc.jobs[`apply-wave-${k}`]!.steps;
|
|
90
|
+
const restore = steps.find((s) => s.uses === "actions/cache/restore@v4")!;
|
|
91
|
+
const save = steps.find((s) => s.uses === "actions/cache/save@v4")!;
|
|
92
|
+
const key = `chant-apply-prod-\${{ github.sha }}-\${{ github.run_id }}-\${{ github.run_attempt }}-wave-${k}`;
|
|
93
|
+
expect(restore.with).toEqual({ path: ".chant/pr-resume/pr-apply.json", key, "restore-keys": "chant-apply-prod-${{ github.sha }}-" });
|
|
94
|
+
expect(save).toMatchObject({ if: "always()", with: { path: ".chant/pr-resume/pr-apply.json", key } });
|
|
95
|
+
const keep = steps.find((s) => s.uses?.startsWith("actions/upload-artifact"))!;
|
|
96
|
+
expect(keep.with?.name).toBe(`chant-pr-apply-wave-${k}`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("without --wave-gate the workflow is the one apply job it was", () => {
|
|
101
|
+
const plain = generateGithubPipeline(ESTATE, { env: "prod", prLoop: {} });
|
|
102
|
+
expect(plain.jobs.map((j) => j.jobName)).toEqual(["plan", "apply"]);
|
|
103
|
+
expect(plain.yaml).not.toContain("--wave");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test.skipIf(!hasActionlint())("actionlint passes it", () => {
|
|
107
|
+
const tmp = mkdtempSync(join(tmpdir(), "pr-waves-actionlint-"));
|
|
108
|
+
try {
|
|
109
|
+
mkdirSync(join(tmp, ".github", "workflows"), { recursive: true });
|
|
110
|
+
const file = join(tmp, ".github", "workflows", "chant-pr.yml");
|
|
111
|
+
writeFileSync(file, result.yaml);
|
|
112
|
+
execFileSync("actionlint", [file], { cwd: tmp, stdio: "pipe" });
|
|
113
|
+
} finally {
|
|
114
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
package/src/lsp/completions.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
+
import { moduleSourceUrl } from "@intentius/chant/module-source";
|
|
2
3
|
import type { CompletionContext, CompletionItem } from "@intentius/chant/lsp/types";
|
|
3
4
|
import { LexiconIndex, lexiconCompletions, type LexiconEntry } from "@intentius/chant/lsp/lexicon-providers";
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
+
const require = createRequire(moduleSourceUrl(import.meta.url));
|
|
5
6
|
|
|
6
7
|
let cachedIndex: LexiconIndex | null = null;
|
|
7
8
|
|
package/src/lsp/hover.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire } from "module";
|
|
2
|
+
import { moduleSourceUrl } from "@intentius/chant/module-source";
|
|
2
3
|
import type { HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
|
|
3
4
|
import { LexiconIndex, lexiconHover, type LexiconEntry } from "@intentius/chant/lsp/lexicon-providers";
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
5
|
+
const require = createRequire(moduleSourceUrl(import.meta.url));
|
|
5
6
|
|
|
6
7
|
let cachedIndex: LexiconIndex | null = null;
|
|
7
8
|
|