Skip to content

Commit 4474285

Browse files
committed
fix(audit): scope to GitHub-only and bundle CLI with esbuild
Narrow the posture audit to GitHub posture only. warden governs GitHub, so multi-domain IaC auditing (aws/azure/k8s/docker/gcp/helm/gitlab/forgejo) belongs to the separate blacklight app. The engine now wires only the github CI lexicon (path-detected .github/workflows/*, github postSynthChecks). Drop the 8 non-github lexicon dependencies; keep @intentius/chant and @intentius/chant-lexicon-github. Bundle the CLI with esbuild so chant's .ts source is transpiled and inlined at build time. This fixes ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING when running dist/cli.js under plain Node. chant packages export .ts by default, which only worked under vitest's transpiler. Convert the engine's dynamic chant imports to static top-level imports so esbuild inlines them.
1 parent 3f731cc commit 4474285

4 files changed

Lines changed: 34 additions & 277 deletions

File tree

‎package-lock.json‎

Lines changed: 2 additions & 141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,15 @@
1010
"scripts": {
1111
"tsc": "tsc --noEmit",
1212
"test": "vitest run",
13-
"build": "tsc -p tsconfig.build.json && chmod +x dist/cli.js"
13+
"build": "esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.js && chmod +x dist/cli.js"
1414
},
1515
"dependencies": {
1616
"@intentius/chant": "^0.8.2",
17-
"@intentius/chant-lexicon-aws": "^0.8.2",
18-
"@intentius/chant-lexicon-azure": "^0.8.2",
19-
"@intentius/chant-lexicon-docker": "^0.8.2",
20-
"@intentius/chant-lexicon-forgejo": "^0.8.2",
21-
"@intentius/chant-lexicon-gcp": "^0.8.2",
22-
"@intentius/chant-lexicon-github": "^0.8.2",
23-
"@intentius/chant-lexicon-gitlab": "^0.8.2",
24-
"@intentius/chant-lexicon-helm": "^0.8.2",
25-
"@intentius/chant-lexicon-k8s": "^0.8.2"
17+
"@intentius/chant-lexicon-github": "^0.8.2"
2618
},
2719
"devDependencies": {
2820
"@types/node": "^22.0.0",
21+
"esbuild": "^0.28.0",
2922
"typescript": "^5.9.3",
3023
"vitest": "^4.1.9"
3124
}

‎src/audit/engine.test.ts‎

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* Tests for the posture-audit engine and CLI subcommand.
33
*
44
* All tests are offline: a `fixtureFetch` intercepts GitHub API calls and
5-
* serves an in-memory file set that exercises multiple lexicons.
5+
* serves an in-memory file set that exercises the github lexicon (warden audits
6+
* GitHub posture only).
67
*/
78

89
import { describe, it, expect } from "vitest";
@@ -26,20 +27,6 @@ const FIXTURE_FILES: Record<string, string> = {
2627
" - uses: actions/checkout@v4",
2728
" - run: echo ${{ github.event.issue.title }}",
2829
].join("\n") + "\n",
29-
"k8s/deploy.yaml": [
30-
"apiVersion: apps/v1",
31-
"kind: Deployment",
32-
"metadata:",
33-
" name: web",
34-
"spec:",
35-
" template:",
36-
" spec:",
37-
" containers:",
38-
" - name: c",
39-
" image: nginx:latest",
40-
" securityContext:",
41-
" privileged: true",
42-
].join("\n") + "\n",
4330
};
4431

4532
/** Produce a GitHub-shaped mock fetch serving the given file set. */

0 commit comments

Comments
 (0)