Skip to content

Commit dcbaabf

Browse files
ericyangpanclaude
andcommitted
refactor: migrate validation scripts to Vitest test suite
Migrated validation scripts from standalone ESM modules to Vitest test framework for better maintainability and integration. This aligns validation checks with modern testing practices and enables running validations as part of the standard test pipeline. Changes: - Migrated all validation scripts to Vitest test suite under tests/validate/ - Updated npm scripts: validate:manifests → test:validate, validate:urls → test:urls - Added vitest.config.ts with Node environment configuration - Updated CI workflows to use new test commands and Node.js 22 - Updated pre-commit hook to run test:validate - Updated documentation to reflect new test-based approach - Removed legacy scripts/validate/ directory - Updated @types/node from v20 to v22 for compatibility - Added vitest as dev dependency This change improves code organization, enables better test reporting, and unifies validation with the project's testing infrastructure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent aa02e11 commit dcbaabf

26 files changed

+3403
-3508
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node.js
2222
uses: actions/setup-node@v6
2323
with:
24-
node-version: '20'
24+
node-version: '22'
2525
cache: 'npm'
2626

2727
- name: Install dependencies
@@ -40,7 +40,7 @@ jobs:
4040
- name: Setup Node.js
4141
uses: actions/setup-node@v6
4242
with:
43-
node-version: '20'
43+
node-version: '22'
4444
cache: 'npm'
4545

4646
- name: Install dependencies
@@ -49,8 +49,8 @@ jobs:
4949
- name: Run TypeScript type check
5050
run: npx tsc --noEmit
5151

52-
validate-manifests:
53-
name: Validate Manifests
52+
tests-validate:
53+
name: Tests (Validate)
5454
runs-on: ubuntu-latest
5555
steps:
5656
- name: Checkout code
@@ -59,17 +59,17 @@ jobs:
5959
- name: Setup Node.js
6060
uses: actions/setup-node@v6
6161
with:
62-
node-version: '20'
62+
node-version: '22'
6363
cache: 'npm'
6464

6565
- name: Install dependencies
6666
run: npm ci
6767

68-
- name: Validate manifest schemas
69-
run: npm run validate:manifests
68+
- name: Run validation tests
69+
run: npm run test:validate
7070

71-
validate-urls:
72-
name: Validate URLs
71+
tests-urls:
72+
name: Tests (URLs)
7373
runs-on: ubuntu-latest
7474
steps:
7575
- name: Checkout code
@@ -78,14 +78,14 @@ jobs:
7878
- name: Setup Node.js
7979
uses: actions/setup-node@v6
8080
with:
81-
node-version: '20'
81+
node-version: '22'
8282
cache: 'npm'
8383

8484
- name: Install dependencies
8585
run: npm ci
8686

8787
- name: Validate URLs in manifests
88-
run: npm run validate:urls
88+
run: npm run test:urls
8989
continue-on-error: true # URLs may be temporarily unavailable
9090

9191
spell-check:
@@ -98,7 +98,7 @@ jobs:
9898
- name: Setup Node.js
9999
uses: actions/setup-node@v6
100100
with:
101-
node-version: '20'
101+
node-version: '22'
102102
cache: 'npm'
103103

104104
- name: Install dependencies
@@ -117,7 +117,7 @@ jobs:
117117
- name: Setup Node.js
118118
uses: actions/setup-node@v6
119119
with:
120-
node-version: '20'
120+
node-version: '22'
121121
cache: 'npm'
122122

123123
- name: Install dependencies
@@ -140,7 +140,7 @@ jobs:
140140
ci-success:
141141
name: CI Success
142142
runs-on: ubuntu-latest
143-
needs: [lint, type-check, validate-manifests, validate-urls, spell-check, build]
143+
needs: [lint, type-check, tests-validate, tests-urls, spell-check, build]
144144
if: always()
145145
steps:
146146
- name: Check all jobs

.github/workflows/deploy-preview.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
- name: Setup Node.js
2323
uses: actions/setup-node@v6
2424
with:
25-
node-version: '20'
25+
node-version: '22'
2626
cache: 'npm'
2727

2828
- name: Install dependencies
2929
run: npm ci
3030

31-
- name: Validate manifests
32-
run: npm run validate:manifests
31+
- name: Run validation tests
32+
run: npm run test:validate
3333

3434
- name: Generate manifests and metadata
3535
run: |

.github/workflows/deploy-production.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
- name: Setup Node.js
2323
uses: actions/setup-node@v6
2424
with:
25-
node-version: '20'
25+
node-version: '22'
2626
cache: 'npm'
2727

2828
- name: Install dependencies
2929
run: npm ci
3030

31-
- name: Validate manifests
32-
run: npm run validate:manifests
31+
- name: Run validation tests
32+
run: npm run test:validate
3333

3434
- name: Generate manifests and metadata
3535
run: |

.github/workflows/scheduled-checks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525
- name: Setup Node.js
2626
uses: actions/setup-node@v6
2727
with:
28-
node-version: '20'
28+
node-version: '22'
2929
cache: 'npm'
3030

3131
- name: Install dependencies
3232
run: npm ci
3333

3434
- name: Validate URLs
3535
id: validate
36-
run: npm run validate:urls
36+
run: npm run test:urls
3737
continue-on-error: true
3838

3939
- name: Create issue if URLs are broken
@@ -88,7 +88,7 @@ jobs:
8888
- name: Setup Node.js
8989
uses: actions/setup-node@v6
9090
with:
91-
node-version: '20'
91+
node-version: '22'
9292
cache: 'npm'
9393

9494
- name: Install dependencies

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
npx lint-staged
22
npm run check
3+
npm run test:validate

CONTRIBUTING.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ cd aicodingstack.io
8787
# Install dependencies
8888
npm install
8989

90-
# Validate existing manifests
91-
npm run validate:manifests
90+
# Run validation tests
91+
npm run test:validate
9292

9393
# Generate manifests and metadata
9494
npm run generate:manifests
@@ -104,8 +104,8 @@ Visit `http://localhost:3000` to see the site.
104104

105105
- `npm run dev` - Start development server
106106
- `npm run build` - Build for production
107-
- `npm run validate:manifests` - Validate all manifest JSON files
108-
- `npm run validate:urls` - Check URL accessibility
107+
- `npm run test:validate` - Run repository validation tests (schemas, translations, alignment, etc.)
108+
- `npm run test:urls` - Check URL accessibility (networked; CI-oriented)
109109
- `npm run lint` - Run ESLint
110110
- `npm run spell` - Run spell checker
111111
- `npm test` - Run tests (if available)
@@ -188,11 +188,11 @@ Create a file in `manifests/models/your-model.json`:
188188
Before submitting, validate your manifest:
189189

190190
```bash
191-
# Validate all manifests
192-
npm run validate:manifests
191+
# Run validation tests
192+
npm run test:validate
193193

194-
# Validate URLs
195-
npm run validate:urls
194+
# Validate URLs (networked)
195+
npm run test:urls
196196
```
197197

198198
### Best Practices
@@ -256,9 +256,8 @@ chore(deps): update Next.js to 15.1.0
256256
2.**Make your changes** following the guidelines
257257
3.**Validate locally**:
258258
```bash
259-
npm run validate:manifests
260-
npm run validate:urls
261-
npm run lint
259+
npm run test:validate
260+
npm run test:urls
262261
npm run spell
263262
npm run build
264263
```

docs/SCHEMA-ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,6 @@ All schemas use JSON Schema Draft 2020-12 with strict mode:
368368
- Format and pattern validation for URLs
369369
- Enum validation for controlled vocabularies
370370

371-
**Validation Command**: `npm run validate:manifests`
371+
**Validation Command**: `npm run test:validate`
372372

373373
**Current Status**: ✅ All 9 manifest files validated successfully

docs/SCHEMA-REFACTORING-SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,5 @@ All manifest files now pass validation:
155155
1. **Consistent Naming**: Always use descriptive field names that reflect the specific use case
156156
2. **Schema Composition**: Prefer composition over duplication - create reusable schema fragments
157157
3. **Documentation**: Keep this summary updated when making future schema changes
158-
4. **Validation**: Always run `npm run validate:manifests` before committing schema changes
158+
4. **Validation**: Always run `npm run test:validate` before committing schema changes
159159

0 commit comments

Comments
 (0)