@ai-ecoverse/slicc-shared-web 2.0.1 → 2.0.2
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 +18 -1
- package/lefthook.yml +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Configuration shared by SLICC's web repos ([slicc-bios](https://github.com/ai-ec
|
|
|
8
8
|
| `.github/workflows/pipeline.yml` | The one reusable workflow, described [below](#pipeline): lint on every event; on pull requests and in the merge queue a staging deploy (if any) and sharded integration tests; on pull requests a Claude and a Codex review; on `main` a release | `jobs: { ci: { uses: ai-ecoverse/slicc-shared-web/.github/workflows/pipeline.yml@vX.Y.Z, secrets: inherit } }` |
|
|
9
9
|
| `biome.json` | Formatter settings and slicc's strict linter: cognitive complexity ≤ 25, functions ≤ 150 lines, no unused variables or imports, no floating or misused promises, naming conventions, `import type`/`export type`. Test files under `test/` get slicc's test exemptions | `biome.json`: `{ "extends": ["@ai-ecoverse/slicc-shared-web/biome"] }` |
|
|
10
10
|
| `tsconfig.json` | TypeScript base for Node's type stripping | `tsconfig.json`: `{ "extends": "@ai-ecoverse/slicc-shared-web/tsconfig.json", "include": ["src/**/*.ts"] }` |
|
|
11
|
-
| `lefthook.yml` | Pre-commit hooks: Biome, typecheck, no comments, no unit tests in git, AGENTS.md, and diff coverage over [only the unit tests the change reaches](#which-unit-tests-a-commit-runs) | `lefthook.yml`:
|
|
11
|
+
| `lefthook.yml` | Pre-commit hooks: Biome, typecheck, no comments, no unit tests in git, AGENTS.md, and diff coverage over [only the unit tests the change reaches](#which-unit-tests-a-commit-runs) | `lefthook.yml`: the [fail-closed snippet below](#hooks-that-fail-closed) |
|
|
12
12
|
| `mcr.config.mjs` | Unit-test coverage for JS and TS sources in `src/` (TS types are stripped first), written to `coverage/unit/lcov.info`. Every source file is in it, tested or not, and paths are matched relative to the repo root, so a checkout under a dot-directory such as `~/.bb/` still reports untested files to diff coverage. With `SLICC_UNIT_TESTS` set, `node --test` runs only those files ([below](#which-unit-tests-a-commit-runs)) | `test:unit`: `mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --test 'test/unit/**/*.test.mjs'` |
|
|
13
13
|
| `bin/` | `slicc-lint` runs every check below plus Biome and, if the repo has one, `typecheck`. Every step prints its own `<step>: PASS …` line, and slicc-lint checks for it: a step that exits 0 without one fails the run with exit 70 (`slicc-lint: FAIL <step> (no PASS line from it)`), so a check that silently stops early can't pass. The last line, `slicc-lint: PASS`, comes only after every step has printed its PASS, and a gate can require it. `slicc-lint-comments` runs the [slicc no-comment checker](https://github.com/ai-ecoverse/slicc/tree/main/packages/dev-tools/no-comment) at a pinned commit, allowing AGENTS.md and [`# renovate:` annotations](#versions-pinned-in-workflow-files) in workflow and action files. `slicc-agents-md`, `slicc-no-unit-tests` and `slicc-diff-cover` complete the set, and `slicc-unit-cover` is the diff-coverage hook. `slicc-minidump <file.dmp>...` prints a crash dump's stack, described [below](#crash-dumps). `slicc-memory-peak` prints the job's [memory peak](#memory-peak) | `lint`: `slicc-lint`, and the hooks above |
|
|
14
14
|
| `pnpmfile.mjs` | pnpm's counterpart to the Renovate preset: an `updateConfig` hook that adds `@ai-ecoverse/*` to `minimumReleaseAgeExclude`, so pnpm 12 doesn't hold back our own fresh releases (`ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION`) while third-party packages keep its age check | in a repo with a pnpm lockfile, as a [config dependency](https://pnpm.io/config-dependencies) in `pnpm-workspace.yaml`: `configDependencies: { '@ai-ecoverse/slicc-shared-web': X.Y.Z }` plus `pnpmfile: node_modules/.pnpm-config/@ai-ecoverse/slicc-shared-web/pnpmfile.mjs` |
|
|
@@ -187,6 +187,23 @@ A workflow gets the line from the composite action, as its last step:
|
|
|
187
187
|
if: always()
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
## Hooks that fail closed
|
|
191
|
+
|
|
192
|
+
Git hooks live in the repo's `.git/hooks/`, which every worktree shares, so a commit can run in a worktree where `npm install` never ran. A repo's `lefthook.yml` makes that commit fail instead of skip the hooks:
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
assert_lefthook_installed: true
|
|
196
|
+
extends:
|
|
197
|
+
- node_modules/@ai-ecoverse/slicc-shared-web/lefthook.yml
|
|
198
|
+
pre-commit:
|
|
199
|
+
jobs:
|
|
200
|
+
- name: shared hooks
|
|
201
|
+
run: test -f node_modules/@ai-ecoverse/slicc-shared-web/lefthook.yml || { echo 'slicc-shared-web hooks missing, run npm install'; exit 1; }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- **No lefthook anywhere:** with `assert_lefthook_installed` (the shared config sets it too) the git hook exits 1 with lefthook's "Can't find lefthook in PATH … Operation is aborted", where it used to print the first line and exit 0.
|
|
205
|
+
- **Lefthook found, no `node_modules` here:** the generated hook calls the lefthook of the checkout that installed it, by absolute path, so it still runs; but lefthook skips an `extends` file that doesn't exist, which would leave no jobs and pass the commit. The `shared hooks` job lives in the repo's own config, so it runs and fails with `run npm install`.
|
|
206
|
+
|
|
190
207
|
## Which unit tests a commit runs
|
|
191
208
|
|
|
192
209
|
The diff-coverage hook, `slicc-unit-cover`, runs only the unit tests that cover the staged change, then `slicc-diff-cover` on their `coverage/unit/lcov.info`, so every staged line in `src/` still has to run:
|
package/lefthook.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-shared-web",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Shared Renovate, Biome, TypeScript, lefthook and GitHub Actions configuration, plus the CDP integration-test harness, for SLICC's web repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@ai-ecoverse/slicc-browsers": "1.12.0",
|
|
66
66
|
"@ai-ecoverse/slicc-cdp": "1.30.18",
|
|
67
67
|
"@biomejs/biome": "2.5.15",
|
|
68
|
+
"lefthook": "2.2.2",
|
|
68
69
|
"monocart-coverage-reports": "2.13.2",
|
|
69
70
|
"pnpm": "12.13.0",
|
|
70
71
|
"semantic-release": "25.0.9"
|