Commit b36a673
chore: unify vitest workspace and replace husky with prek (#673)
* chore(test): convert tests to ESM and unify vitest 4 workspace
Convert all 21 root test files from CJS to ESM:
- require() → import (static for top-level, createRequire bridge for
registry.test.js where HOME must be set before module load)
- __dirname → import.meta.dirname
- Add test/package.json with "type": "module"
- Add explicit `import { describe, it, expect } from "vitest"`
- Normalize all built-in imports to use node: prefix
Unify both test suites under a single vitest 4 config:
- Upgrade root vitest from ^3.1.1 to ^4.1.0, add @vitest/coverage-v8
- Remove vitest and coverage-v8 from nemoclaw/package.json
- Replace vitest.config.ts + nemoclaw/vitest.config.ts with a single
root vitest.config.ts using test.projects (vitest 4 API)
- One `npx vitest run --coverage` runs both cli and plugin tests
- Coverage scoped to nemoclaw/src/**/*.ts (plugin code only)
Update CI and hooks:
- pr.yaml: merge two vitest steps into one
- pre-commit: run plugin tests from root (--project plugin)
- Coverage ratchet: read from coverage/ instead of nemoclaw/coverage/
Cleanup from code review:
- Remove dead afterEach in runtime-shell.test.js
- Remove unnecessary createRequire in onboard-readiness.test.js and
runner.test.js (replaced with static ESM imports)
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: add shellcheck shell directive to husky-env.sh
husky-env.sh is sourced (not executed directly), so it doesn't have a
shebang. Add a shellcheck shell=sh directive so shellcheck knows the
target shell.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: keep vitest in nemoclaw/ devDeps for type resolution
The eslint strict-type-checked rules in nemoclaw/ need vitest's type
definitions to resolve describe/it/expect in test files. Without vitest
in nemoclaw/node_modules, tsc and eslint report 473 no-unsafe-call
errors.
Test execution still happens from the root workspace — this dep is only
needed for type checking and linting.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: bump Node engine to >=22 and fix stale coverage message
- Bump engines.node from >=20.0.0 to >=22.0.0 in both package.json
files. import.meta.dirname (used in all ESM test files) requires
Node 20.11+, and CI already runs Node 22.
- Fix stale error message in coverage ratchet script that referenced
the old nemoclaw/ coverage path.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* chore: replace husky with prek for all git hooks
Husky managed git hooks via `.husky/` shell scripts that invoked
lint-staged, vitest, commitlint, tsc, and pyright. prek can do all of
this from `.pre-commit-config.yaml`, giving us a single source of truth.
- Add `@j178/prek` as a devDependency (npm package)
- Move lint-staged, vitest, commitlint, tsc, pyright into
`.pre-commit-config.yaml` as local hooks with proper stages
- Remove lint-staged + shellcheck devDeps (redundant with prek-native
hooks that already run the same tools at priorities 5-10)
- Delete `.husky/`, `scripts/husky-env.sh`, and husky devDep
- `prepare` script now runs `prek install` (only inside a git repo)
Existing contributors with husky's `core.hooksPath=.husky/_` in their
local git config will need to run:
git config --unset-all --local core.hooksPath
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(test): convert credential-exposure test to ESM for vitest
The test landed on main as CJS (require/__dirname/bare describe) which
breaks under our vitest 4 ESM config. Convert to ESM imports with
explicit vitest globals.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix: mark runner.py executable to match its shebang
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* fix(hooks): run vitest-plugin hook from repo root
The pre-commit hook was cd-ing into nemoclaw/ before running vitest,
causing the root vitest.config.ts project paths to resolve incorrectly
(nemoclaw/nemoclaw/src/...) and find zero test files. prek already runs
hooks from the repo root, so the cd is unnecessary.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
* chore: add pre-commit banned-files hook and expand .gitignore
Add a pre-commit hook that rejects force-added files matching
.gitignore patterns (catches `git add -f` bypasses). The hook uses
`git ls-files --ignored --cached` so .gitignore stays the single
source of truth — no duplicate pattern list.
Also expand .gitignore with additional sensitive file patterns
(key.json, token.json, secrets.json/yaml, .envrc, .direnv/, .pypirc,
*.tfvars) and reorganize into labeled sections.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>1 parent ffa1283 commit b36a673
File tree
38 files changed
+1868
-1894
lines changed- .github/workflows
- .husky
- nemoclaw-blueprint/orchestrator
- nemoclaw
- scripts
- test
38 files changed
+1868
-1894
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 71 | + | |
76 | 72 | | |
77 | 73 | | |
78 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 5 | | |
9 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
| 18 | + | |
11 | 19 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
16 | 25 | | |
| 26 | + | |
17 | 27 | | |
| 28 | + | |
18 | 29 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
22 | 35 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 36 | + | |
| 37 | + | |
26 | 38 | | |
27 | | - | |
28 | | - | |
29 | 39 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
12 | 10 | | |
13 | 11 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 12 | + | |
19 | 13 | | |
20 | | - | |
| 14 | + | |
21 | 15 | | |
22 | 16 | | |
23 | 17 | | |
24 | 18 | | |
| 19 | + | |
25 | 20 | | |
26 | 21 | | |
27 | 22 | | |
| |||
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| |||
128 | 136 | | |
129 | 137 | | |
130 | 138 | | |
131 | | - | |
| 139 | + | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
| |||
139 | 147 | | |
140 | 148 | | |
141 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
142 | 190 | | |
143 | 191 | | |
144 | 192 | | |
145 | 193 | | |
146 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 72 | + | |
76 | 73 | | |
77 | | - | |
| 74 | + | |
78 | 75 | | |
79 | 76 | | |
80 | 77 | | |
| |||
File mode changed.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | | - | |
| 40 | + | |
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
| |||
This file was deleted.
0 commit comments