- Add Zod schema validation for module.yaml files
- Create test suite for module schema with 17 test fixtures
- Fix create-module workflow to make 'code' field requirements clearer
Fixes#1288 - The create-module workflow could produce module.yaml files
without the required 'code' field or with placeholder text like '{module_code}'.
1. Created tools/schema/module.js with Zod validation for:
- Required fields: code, name, header, subheader
- Code format: kebab-case, 2-20 chars, starts with letter
- Variable definitions with prompt/inherit patterns
2. Created tools/validate-module-schema.js CLI validator
3. Added npm scripts:
- validate:modules - validates all module.yaml files
- test:modules - runs module schema test suite
4. Updated BMB workflow instructions with explicit warnings about
required fields in step-03-config.md and step-03-module-yaml.md
5. Added 17 test fixtures covering:
- Missing required fields (code, name, header, subheader)
- Invalid code formats (placeholder, uppercase, underscore, etc.)
- Variable definitions (prompt, inherit, single-select, multi-select)
- npm run test:modules - 17/17 tests pass
- npm run validate:modules - All 5 existing modules pass
- npm test - Full test suite passes