@vwala/tooling-config 0.0.1

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 ADDED
@@ -0,0 +1,149 @@
1
+ # @vwala/tooling-config
2
+
3
+ Shared tooling configuration for Vwala repositories: one private repo, one npm package, one place to change a rule.
4
+
5
+ Each tool gets a folder under `src/`:
6
+
7
+ ```text
8
+ src/
9
+ ├── biome/ Biome config + custom GritQL rules (consumed via npm)
10
+ │ ├── biome.config.json
11
+ │ └── plugins/
12
+ └── zizmor/ GitHub Actions security policy (consumed via GitHub Actions)
13
+ ├── action.yml
14
+ └── zizmor.yml
15
+ ```
16
+
17
+ The two tools are consumed differently — npm for anything a local toolchain reads, a GitHub Action for anything only CI runs — but they version together off the same git tag.
18
+
19
+ ---
20
+
21
+ ## Biome
22
+
23
+ ```bash
24
+ pnpm add -D @vwala/tooling-config @biomejs/biome
25
+ ```
26
+
27
+ ```json
28
+ {
29
+ "$schema": "https://biomejs.dev/schemas/2.5.6/schema.json",
30
+ "extends": ["@vwala/tooling-config/biome"]
31
+ }
32
+ ```
33
+
34
+ Anything you add alongside `extends` overrides the shared config for that key.
35
+
36
+ > **Requires Biome >= 2.5.0.** The config scopes plugins with the `{ "path": ..., "includes": [...] }` form, which Biome added in 2.5. On 2.4 and earlier the config fails to parse.
37
+
38
+ > **Install it next to your `biome.json`.** Biome resolves plugin paths relative to the directory of the config doing the extending — *not* relative to this package. The shared config therefore refers to its own plugins as `./node_modules/@vwala/tooling-config/src/biome/plugins/*.grit`, which only resolves if the package is installed at the same level as your `biome.json` (normally the repository root). In a monorepo that means a root `devDependency`, not a nested workspace one.
39
+ >
40
+ > If the paths cannot be resolved, Biome reports `Error(s) during loading of plugins: Cannot read file.` — that is what a misplaced install looks like.
41
+
42
+ ### Rules
43
+
44
+ On top of Biome's `recommended` preset, four GritQL plugins enforce Vwala conventions:
45
+
46
+ | Plugin | Enforces |
47
+ | --- | --- |
48
+ | `no-uuid-type-assertion` | No `as Uuid` / `as unknown as Uuid` — parse with `uuid()`, `newUuid()` or `zUuid` instead of manufacturing the brand. Production code only. |
49
+ | `no-vwala-class-prefix` | No `vwala:` Tailwind prefix in apps — it only resolves inside the design system's precompiled stylesheet. Apps only. |
50
+ | `use-given-when-then-test-names` | Every `test(...)` title reads GIVEN … WHEN … THEN … |
51
+ | `use-tests-folder-location` | Test files live in a `__tests__/` folder, never colocated with the implementation. |
52
+
53
+ Each plugin file carries a header comment explaining the rule and linking to the governing reference in the [`vwala-conventions`](https://github.com/vwala-be/skills) skill. The plugins have tests in `src/biome/plugins/__tests__/` that drive the real Biome binary over fixture workspaces, so a rule that silently stops matching fails CI.
54
+
55
+ ### Test layout boundaries
56
+
57
+ `use-tests-folder-location` can only check syntax — a GritQL plugin cannot see its own file path. The path-level halves of that convention (no `tests/` folder, no non-test files in `__tests__/`, no production code importing test code) live in a script you run yourself:
58
+
59
+ ```jsonc
60
+ {
61
+ "scripts": {
62
+ "check-test-boundaries": "node node_modules/@vwala/tooling-config/src/biome/plugins/_scripts/check-test-layout.mjs"
63
+ }
64
+ }
65
+ ```
66
+
67
+ It reads tracked files from `git ls-files`, so run it from the repository root.
68
+
69
+ ---
70
+
71
+ ## zizmor
72
+
73
+ [zizmor](https://docs.zizmor.sh) audits GitHub Actions workflows. The shared policy lives in `src/zizmor/zizmor.yml` and reaches zizmor through a composite action that bundles it, so consuming repositories get the zizmor version, the config and the standard arguments from one place.
74
+
75
+ Add it as a step in the workflow you already have:
76
+
77
+ ```yaml
78
+ jobs:
79
+ ci:
80
+ runs-on: ubuntu-latest
81
+ permissions:
82
+ contents: read
83
+ actions: read
84
+ steps:
85
+ - uses: actions/checkout@v6
86
+ with:
87
+ persist-credentials: false
88
+
89
+ - uses: vwala-be/tooling-config/src/zizmor@v1.0.0
90
+ ```
91
+
92
+ This needs the repository to be readable by the caller — already set (`Settings → Actions → General → Access → Accessible from repositories in the organization`), which is what lets a private repo share actions with other private repos in the org.
93
+
94
+ ### The policy is not overridable
95
+
96
+ zizmor has no `extends` or import mechanism, and passing `--config` disables local config discovery entirely. That is deliberate here: a repository cannot quietly weaken the org-wide policy with its own `zizmor.yml`. Exceptions go in `src/zizmor/zizmor.yml` via a PR against this repo.
97
+
98
+ Only operational knobs are exposed as action inputs — `inputs` (paths), `persona`, and `advanced-security`.
99
+
100
+ `advanced-security` is **off** by default. Uploading to the security tab needs GitHub Advanced Security, which private repositories only have under a licence; with it off you get inline PR annotations instead, which need no entitlement. The upstream action defaults this to `true` and refuses to run with both it and `annotations` enabled, so the wrapper derives `annotations` from it.
101
+
102
+ <!-- npm-publish:cut -->
103
+ <!--
104
+ Everything below this marker is internal and is stripped from the README that
105
+ ships to npm (see the "Trim internal sections" step in release.yml). npm force-
106
+ includes README.md in every tarball — `files` negation and .npmignore are both
107
+ ignored for it — so the only way to keep a section off the public registry is
108
+ to not have it in the file at pack time. Consumer-facing docs go ABOVE.
109
+ -->
110
+
111
+ ---
112
+
113
+ ## Releasing
114
+
115
+ The npm version is derived from the git tag — `package.json` stays at `0.0.0` and is never bumped by hand.
116
+
117
+ ```bash
118
+ git tag v1.2.3
119
+ git push origin v1.2.3
120
+ ```
121
+
122
+ One tag covers everything: it publishes the npm package **and** is the ref consumers pin the zizmor action to. A zizmor-only change still cuts an npm version; that is the price of one version line, and it is cheaper than per-tool tags.
123
+
124
+ `.github/workflows/release.yml` validates the tag is semver, skips if that version is already on npm, and publishes. Publishing is token-free via [npm trusted publishing](https://docs.npmjs.com/trusted-publishers) (OIDC), so there is no `NPM_TOKEN` secret to rotate. Provenance is not attached because this repository is private — expected, not a misconfiguration.
125
+
126
+ <details>
127
+ <summary>Why <code>0.0.1</code> was published by hand</summary>
128
+
129
+ npm only lets you configure a trusted publisher on a package that already exists, so the first version had to be published manually before OIDC could be set up. The trusted publisher is registered on npmjs.com against org `vwala-be`, repo `tooling-config`, workflow `release.yml`.
130
+
131
+ </details>
132
+
133
+ ---
134
+
135
+ ## Working on this repo
136
+
137
+ ```bash
138
+ pnpm install
139
+ pnpm isEverythingOk # biome ci . && vitest run
140
+ pnpm format # biome check --write .
141
+ ```
142
+
143
+ This repo lints itself with the exact config it ships — there is no second copy to keep in sync. That works because of the `"@vwala/tooling-config": "link:."` devDependency, which makes pnpm symlink `node_modules/@vwala/tooling-config` back to the repo root, so the shipped `./node_modules/...` plugin paths resolve here too. **`pnpm install` is therefore required before linting**, including in CI.
144
+
145
+ The shipped Biome config is named `biome.config.json`, not `biome.json`, on purpose: Biome auto-discovers `biome.json`, and a second one inside the repo makes it fail with *"Found a nested root configuration, but there's already a root configuration."*
146
+
147
+ CI audits its own workflows too, as a step in `ci.yml` that uses the local `./src/zizmor` path — so a policy change is exercised in the same PR that makes it, without waiting for a tag.
148
+
149
+ `.agents/` and `.claude/` are force-ignored in the Biome config (`!!` prefix) so the vendored skills are never scanned, and `skills-lock.json` is exempt from the formatter so Biome does not fight the skills installer.
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@vwala/tooling-config",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Shared tooling configuration for Vwala repositories",
6
+ "license": "UNLICENSED",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/vwala-be/tooling-config.git"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "files": [
15
+ "src",
16
+ "!src/**/__tests__",
17
+ "!src/**/test-support"
18
+ ],
19
+ "exports": {
20
+ "./biome": "./src/biome/biome.config.json"
21
+ },
22
+ "scripts": {
23
+ "lint": "biome check .",
24
+ "format": "biome check --write .",
25
+ "test": "vitest run",
26
+ "isEverythingOk": "biome ci . && vitest run"
27
+ },
28
+ "devDependencies": {
29
+ "@biomejs/biome": "2.5.6",
30
+ "@types/node": "^26.1.2",
31
+ "@vwala/tooling-config": "link:.",
32
+ "vitest": "^4.1.10"
33
+ },
34
+ "peerDependencies": {
35
+ "@biomejs/biome": ">=2.5.0"
36
+ },
37
+ "packageManager": "pnpm@11.15.0"
38
+ }
@@ -0,0 +1,145 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.5.6/schema.json",
3
+ "assist": {
4
+ "actions": {
5
+ "source": {
6
+ "organizeImports": "on",
7
+ "useSortedAttributes": "off",
8
+ "useSortedKeys": "off"
9
+ }
10
+ },
11
+ "enabled": true
12
+ },
13
+ "files": {
14
+ "ignoreUnknown": false,
15
+ "includes": ["**", "!!**/.agents", "!!**/.claude"]
16
+ },
17
+ "css": {
18
+ "parser": {
19
+ "tailwindDirectives": true
20
+ }
21
+ },
22
+ "formatter": {
23
+ "enabled": true,
24
+ "indentStyle": "tab"
25
+ },
26
+ "javascript": {
27
+ "formatter": {
28
+ "quoteStyle": "double"
29
+ }
30
+ },
31
+ "overrides": [
32
+ {
33
+ "includes": ["package.json"],
34
+ "linter": {
35
+ "rules": {
36
+ "suspicious": {
37
+ "useRequiredScripts": {
38
+ "level": "error",
39
+ "options": {
40
+ "requiredScripts": ["isEverythingOk"]
41
+ }
42
+ }
43
+ }
44
+ }
45
+ }
46
+ },
47
+ {
48
+ "includes": ["**/skills-lock.json"],
49
+ "formatter": {
50
+ "enabled": false
51
+ }
52
+ }
53
+ ],
54
+ "plugins": [
55
+ {
56
+ "path": "./node_modules/@vwala/tooling-config/src/biome/plugins/no-vwala-class-prefix.grit",
57
+ "includes": ["**/apps/**", "!**/packages/**"]
58
+ },
59
+ {
60
+ "path": "./node_modules/@vwala/tooling-config/src/biome/plugins/no-uuid-type-assertion.grit",
61
+ "includes": [
62
+ "**",
63
+ "!**/__tests__/**",
64
+ "!**/test-support/**",
65
+ "!**/*.test.ts",
66
+ "!**/*.test.tsx"
67
+ ]
68
+ },
69
+ "./node_modules/@vwala/tooling-config/src/biome/plugins/use-given-when-then-test-names.grit",
70
+ {
71
+ "path": "./node_modules/@vwala/tooling-config/src/biome/plugins/use-tests-folder-location.grit",
72
+ "includes": [
73
+ "**/*.test.ts",
74
+ "**/*.test.tsx",
75
+ "!**/__tests__/**",
76
+ "!**/.agents/**"
77
+ ]
78
+ }
79
+ ],
80
+ "linter": {
81
+ "enabled": true,
82
+ "rules": {
83
+ "a11y": {
84
+ "noNoninteractiveElementInteractions": "warn"
85
+ },
86
+ "complexity": {
87
+ "noBannedTypes": "error",
88
+ "noExcessiveCognitiveComplexity": {
89
+ "level": "error",
90
+ "options": {
91
+ "maxAllowedComplexity": 15
92
+ }
93
+ }
94
+ },
95
+ "nursery": {
96
+ "useConsistentTestIt": {
97
+ "level": "error",
98
+ "options": {
99
+ "function": "test",
100
+ "withinDescribe": "test"
101
+ }
102
+ }
103
+ },
104
+ "correctness": {
105
+ "noUndeclaredVariables": "error",
106
+ "noUnusedFunctionParameters": "error",
107
+ "noUnusedImports": "error",
108
+ "noUnusedPrivateClassMembers": "error",
109
+ "noUnusedVariables": "error"
110
+ },
111
+ "preset": "recommended",
112
+ "style": {
113
+ "noEnum": "error",
114
+ "noNestedTernary": "warn",
115
+ "noNonNullAssertion": "warn",
116
+ "noRestrictedImports": {
117
+ "level": "error",
118
+ "options": {
119
+ "paths": {
120
+ "ajv": "Validate with Zod.",
121
+ "class-validator": "Validate with Zod.",
122
+ "joi": "Validate with Zod.",
123
+ "yup": "Validate with Zod."
124
+ }
125
+ }
126
+ },
127
+ "useBlockStatements": "warn"
128
+ },
129
+ "suspicious": {
130
+ "noArrayIndexKey": "warn",
131
+ "noAssignInExpressions": "error",
132
+ "noConstEnum": "error",
133
+ "noDoubleEquals": "error",
134
+ "noExplicitAny": "error",
135
+ "noFocusedTests": "error",
136
+ "noSkippedTests": "warn"
137
+ }
138
+ }
139
+ },
140
+ "vcs": {
141
+ "clientKind": "git",
142
+ "enabled": true,
143
+ "useIgnoreFile": true
144
+ }
145
+ }
@@ -0,0 +1,110 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Path-level halves of the test-file-location convention.
4
+ *
5
+ * A Biome GritQL plugin reasons about syntax, not paths, so these three rules
6
+ * cannot live in `use-tests-folder-location.grit` alongside the "tests belong in
7
+ * __tests__/" check. They run here instead. Wire this into a repository's own
8
+ * check script; it reads the file list from `git ls-files`, so it only sees
9
+ * tracked files.
10
+ *
11
+ * 1. No folder named `tests` or `test` — test files live in `__tests__/`, test
12
+ * utilities in `test-support/`.
13
+ * 2. No non-test file inside `__tests__/` — utilities belong in `test-support/`.
14
+ * This is the check that catches helpers drifting back in.
15
+ * 3. Production code must not import from `test-support/` or `__tests__/`.
16
+ * Two things are deliberately exempt, because in both the import is the
17
+ * point rather than a leak:
18
+ * - Storybook apps, whose whole job is rendering real fixtures, and whose
19
+ * story helpers are not always named `*.stories.tsx`;
20
+ * - `testSupport.ts` barrels, which re-export a package's own
21
+ * `test-support/` through a published `"./test-support"` export.
22
+ *
23
+ * See: .agents/skills/vwala-conventions/references/test-style.md
24
+ */
25
+ import { execFileSync } from "node:child_process";
26
+
27
+ const IGNORED_PREFIXES = [".agents/"];
28
+ const TEST_FILE = /\.test\.[cm]?[jt]sx?$/;
29
+ // Matches any Storybook app rather than one repository's name for it.
30
+ const STORY_FILE =
31
+ /(\.stories\.[jt]sx?$|\/__stories__\/|^apps\/[^/]*storybook[^/]*\/)/;
32
+ const TEST_SUPPORT_BARREL = /(^|\/)testSupport\.[cm]?ts$/;
33
+
34
+ const files = execFileSync("git", ["ls-files"], {
35
+ encoding: "utf8",
36
+ maxBuffer: 1024 * 1024 * 64,
37
+ })
38
+ .split("\n")
39
+ .filter(Boolean)
40
+ .filter(
41
+ (file) => !IGNORED_PREFIXES.some((prefix) => file.startsWith(prefix)),
42
+ );
43
+
44
+ const violations = [];
45
+
46
+ for (const file of files) {
47
+ if (/(^|\/)tests?\//.test(file)) {
48
+ violations.push(
49
+ `${file}\n Folder named "tests"/"test". Test files go in __tests__/, utilities in test-support/.`,
50
+ );
51
+ }
52
+
53
+ if (
54
+ /\/__tests__\//.test(file) &&
55
+ !TEST_FILE.test(file) &&
56
+ !file.endsWith(".md")
57
+ ) {
58
+ violations.push(
59
+ `${file}\n Non-test file inside __tests__/. Test utilities belong in test-support/.`,
60
+ );
61
+ }
62
+ }
63
+
64
+ const productionSources = files.filter(
65
+ (file) =>
66
+ /\.[cm]?[jt]sx?$/.test(file) &&
67
+ !TEST_FILE.test(file) &&
68
+ !STORY_FILE.test(file) &&
69
+ !TEST_SUPPORT_BARREL.test(file) &&
70
+ !/\/(__tests__|test-support)\//.test(file) &&
71
+ !/\.config\.[cm]?[jt]s$/.test(file),
72
+ );
73
+
74
+ if (productionSources.length > 0) {
75
+ // `git grep` exits 1 when nothing matches, which is the clean case here — so
76
+ // read stdout off the thrown error rather than letting it propagate.
77
+ let matches = "";
78
+ try {
79
+ matches = execFileSync(
80
+ "git",
81
+ [
82
+ "grep",
83
+ "-nE",
84
+ 'from "[^"]*(__tests__|test-support)',
85
+ "--",
86
+ ...productionSources,
87
+ ],
88
+ { encoding: "utf8", maxBuffer: 1024 * 1024 * 64 },
89
+ );
90
+ } catch (error) {
91
+ if (error.status !== 1) {
92
+ throw error;
93
+ }
94
+ matches = error.stdout ?? "";
95
+ }
96
+
97
+ for (const match of matches.trim().split("\n").filter(Boolean)) {
98
+ violations.push(`${match}\n Production code must not import test code.`);
99
+ }
100
+ }
101
+
102
+ if (violations.length > 0) {
103
+ console.error(`\n ✖ ${violations.length} test-layout violation(s):\n`);
104
+ for (const violation of violations) {
105
+ console.error(` ${violation}\n`);
106
+ }
107
+ process.exit(1);
108
+ }
109
+
110
+ console.log(" ✔ test layout clean");
@@ -0,0 +1,23 @@
1
+ // Never assert a value into the Zod-branded `Uuid` type. An assertion
2
+ // manufactures the brand without running the validation it stands for, so an
3
+ // invalid string travels through the domain wearing a type that promises it is
4
+ // valid. Parse, don't check: `uuid(input)` to parse, `newUuid()` to mint, or
5
+ // `zUuid` inside a surrounding schema.
6
+ //
7
+ // Two branches: `as Uuid` and `as unknown as Uuid`. The latter is the more
8
+ // common escape hatch, since `as Uuid` alone often fails to compile from
9
+ // `string`.
10
+ //
11
+ // Scoped to production code in biome.json — tests are excluded on purpose,
12
+ // because negative tests deliberately construct invalid values and parsing
13
+ // those would defeat the test.
14
+ //
15
+ // See: .agents/skills/vwala-conventions/references/prefer-zod.md
16
+ or {
17
+ `$expr as Uuid` as $node where {
18
+ register_diagnostic(span=$node, message="Do not assert `as Uuid` — an assertion manufactures the brand without validating. Parse instead: `uuid(value)`, `newUuid()`, or `zUuid` within a schema.", severity="error")
19
+ },
20
+ `$expr as unknown as Uuid` as $node where {
21
+ register_diagnostic(span=$node, message="Do not assert `as unknown as Uuid` — an assertion manufactures the brand without validating. Parse instead: `uuid(value)`, `newUuid()`, or `zUuid` within a schema.", severity="error")
22
+ }
23
+ }
@@ -0,0 +1,34 @@
1
+ // Never use the `vwala:` Tailwind prefix in an app. The prefix belongs to the
2
+ // design system, which compiles with `@import "tailwindcss" prefix(vwala)` into
3
+ // a precompiled stylesheet. Apps import Tailwind unprefixed, so `vwala:` reads
4
+ // as an unknown variant and the class is dropped — it only ever renders when the
5
+ // design system's own bundle happens to contain the identical utility.
6
+ //
7
+ // Two branches, because a class can reach an element without ever appearing in
8
+ // the attribute: `jsx_attribute` matches the whole node text (so it covers
9
+ // `className={cn("vwala:p-4", x)}` too), and `string` catches a class assembled
10
+ // elsewhere and passed in by variable.
11
+ //
12
+ // `(?s)` is required so the regexes span multi-line className attributes. The
13
+ // string branch requires a lowercase letter, `$`, `[`, `!` or `-` after the
14
+ // colon, which is what keeps it off the `vwala://` deep-link scheme.
15
+ //
16
+ // biome.json scopes this to `["**/apps/**", "!**/packages/**"]`. Plugin globs
17
+ // are matched against the full path, so a bare `apps/**` silently matches
18
+ // nothing; the leading `**/` is required, and the negation then keeps the rule
19
+ // off `apps/` directories nested inside `packages/`.
20
+ //
21
+ // Known gap: a TEMPLATE literal — `` const c = `vwala:${size}` `` — is caught by
22
+ // neither branch. Biome exposes no working GritQL node kind for template
23
+ // literals (`template_string`, `template_literal` both silently match nothing),
24
+ // and `string()` does not cover them.
25
+ or {
26
+ jsx_attribute() as $attr where {
27
+ $attr <: r"(?s)className=.*vwala:.*",
28
+ register_diagnostic(span=$attr, message="Remove the `vwala:` prefix. It only exists inside @vwala/platform-design-system's precompiled stylesheet; this app's Tailwind build is unprefixed, so `vwala:` classes are dropped or render only by coincidence.", severity="error")
29
+ },
30
+ string() as $str where {
31
+ $str <: r"(?s).*vwala:[a-z$\[!-].*",
32
+ register_diagnostic(span=$str, message="Remove the `vwala:` prefix. It only exists inside @vwala/platform-design-system's precompiled stylesheet; this app's Tailwind build is unprefixed, so `vwala:` classes are dropped or render only by coincidence.", severity="error")
33
+ }
34
+ }
@@ -0,0 +1,20 @@
1
+ // Put GIVEN / WHEN / THEN in every `test` description, so a failure names the
2
+ // scenario rather than just the unit.
3
+ //
4
+ // Only string-literal titles are checked. `test.each` uses a different node
5
+ // shape and is not matched, and template-literal titles are skipped because the
6
+ // interpolated text is not visible to the regex.
7
+ //
8
+ // This matches `test(...)` only, not `it(...)` — which is why the
9
+ // `useConsistentTestIt` rule in biome.json has to stay on. Turn that off and a
10
+ // title reverted to `it()` becomes invisible here.
11
+ //
12
+ // Prefer rewording over an escaped `\"` inside a title: an escaped double quote
13
+ // makes Biome reformat the line to single quotes, which fails `biome ci`.
14
+ //
15
+ // See: .agents/skills/vwala-conventions/references/test-style.md
16
+ `test($title, $body)` as $node where {
17
+ $title <: r"(?s)\"[^\"]*\"",
18
+ $title <: not r"(?s).*GIVEN.*WHEN.*THEN.*",
19
+ register_diagnostic(span=$title, message="Name the test GIVEN … WHEN … THEN … so the failure describes the scenario.", severity="error")
20
+ }
@@ -0,0 +1,19 @@
1
+ // Every test file belongs in a `__tests__/` folder — a subfolder of the layer or
2
+ // concept it protects — never colocated with the implementation it covers.
3
+ //
4
+ // A GritQL plugin cannot see its own file path, so the scoping is done by the
5
+ // `includes` globs in biome.json: the plugin is pointed at test files that are
6
+ // NOT under `__tests__/`, and then fires unconditionally on anything it sees.
7
+ // Matching `describe` gives one diagnostic per file rather than one per case.
8
+ //
9
+ // The path-level halves of this convention — no folder named `tests`, no
10
+ // non-test file inside `__tests__/`, and production code not importing test
11
+ // code — are not expressible here for the same reason. They live in
12
+ // `_scripts/check-test-layout.mjs`, which a repository wires up as its own
13
+ // `check-test-boundaries` script.
14
+ //
15
+ // See: .agents/skills/vwala-conventions/references/test-style.md and
16
+ // .agents/skills/vwala-conventions/references/typescript-naming.md
17
+ `describe($name, $body)` as $node where {
18
+ register_diagnostic(span=$node, message="Move this test into a `__tests__/` folder beside the layer or concept it protects. Tests are never colocated with the implementation they cover.", severity="error")
19
+ }
@@ -0,0 +1,60 @@
1
+ name: Vwala zizmor
2
+ description: Audit GitHub Actions workflows with Vwala's shared zizmor policy.
3
+
4
+ # The policy lives in zizmor.yml next to this file, so consuming repositories get
5
+ # the version, the config and the standard arguments from one place. Only
6
+ # operational knobs are exposed as inputs — severity and rule selection stay
7
+ # central on purpose.
8
+ #
9
+ # zizmor-action runs zizmor in Docker with only GITHUB_WORKSPACE mounted (at
10
+ # /workspace, read-only). GITHUB_ACTION_PATH is therefore invisible to zizmor,
11
+ # so the policy has to be copied into the workspace first and passed as a
12
+ # workspace-relative path.
13
+
14
+ inputs:
15
+ inputs:
16
+ description: Whitespace-separated list of paths for zizmor to audit.
17
+ required: false
18
+ default: "."
19
+ persona:
20
+ description: "Auditing persona: regular, pedantic or auditor."
21
+ required: false
22
+ default: regular
23
+ advanced-security:
24
+ description: >-
25
+ Upload findings to the repository's security tab. This needs GitHub
26
+ Advanced Security, which private repositories only have under a licence —
27
+ leaving it false falls back to inline PR annotations, which need no
28
+ entitlement and no security-events permission.
29
+ required: false
30
+ default: "false"
31
+
32
+ runs:
33
+ using: composite
34
+ steps:
35
+ # Dot-prefixed and removed again below, so it never shows up as an untracked
36
+ # file in a later step and is never itself collected as an audit input.
37
+ - name: Stage the shared policy inside the workspace
38
+ shell: bash
39
+ env:
40
+ ACTION_PATH: ${{ github.action_path }}
41
+ run: cp "${ACTION_PATH}/zizmor.yml" "${GITHUB_WORKSPACE}/.vwala-zizmor.yml"
42
+
43
+ - name: Run zizmor with the shared Vwala policy
44
+ uses: zizmorcore/zizmor-action@3dc1ecc9bcb9e94e9b2c709687979e1298497054 # v0.6.2
45
+ with:
46
+ inputs: ${{ inputs.inputs }}
47
+ # Relative to /workspace, the container's working directory.
48
+ config: .vwala-zizmor.yml
49
+ # Pinned rather than `latest` so every repository audits with the same
50
+ # engine. Must be a version the pinned action knows (support/versions).
51
+ version: "1.29.0"
52
+ persona: ${{ inputs.persona }}
53
+ advanced-security: ${{ inputs.advanced-security }}
54
+ # The action rejects advanced-security and annotations both being true.
55
+ annotations: ${{ inputs.advanced-security == 'true' && 'false' || 'true' }}
56
+
57
+ - name: Remove the staged policy
58
+ if: always()
59
+ shell: bash
60
+ run: rm -f "${GITHUB_WORKSPACE}/.vwala-zizmor.yml"
@@ -0,0 +1,28 @@
1
+ # Vwala's shared GitHub Actions security policy.
2
+ #
3
+ # This file is bundled with the composite action next to it and passed to zizmor
4
+ # via --config. zizmor has no `extends`/import mechanism, and --config disables
5
+ # local discovery entirely, so this is the whole policy: a repository cannot
6
+ # quietly weaken it with its own zizmor.yml. Exceptions belong here, in a PR
7
+ # against this repository.
8
+ #
9
+ # Audit reference: https://docs.zizmor.sh/audits/
10
+ rules:
11
+ # zizmor's default since v1.6 already requires hash-pinning for third-party
12
+ # actions while allowing tags for first-party ones. Stated explicitly so the
13
+ # policy is visible here and does not shift under us on a zizmor upgrade.
14
+ unpinned-uses:
15
+ config:
16
+ policies:
17
+ actions/*: ref-pin
18
+ github/*: ref-pin
19
+ dependabot/*: ref-pin
20
+ # Our own org: we control what a tag points at.
21
+ vwala-be/*: ref-pin
22
+ "*": hash-pin
23
+
24
+ # Injecting untrusted `${{ ... }}` into a `run:` block is arbitrary code
25
+ # execution on the runner. Never a warning for us.
26
+ template-injection:
27
+ remap:
28
+ severity: high