BMAD-METHOD/test/fixtures/module-schema/valid/variables
cx-noam-brendel 6dc292c850 fix(bmb): add module.yaml schema validation and fix #1288
- 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
2026-01-26 15:41:22 +02:00
..
with-inherit.module.yaml fix(bmb): add module.yaml schema validation and fix #1288 2026-01-26 15:41:22 +02:00
with-prompt.module.yaml fix(bmb): add module.yaml schema validation and fix #1288 2026-01-26 15:41:22 +02:00
with-select.module.yaml fix(bmb): add module.yaml schema validation and fix #1288 2026-01-26 15:41:22 +02:00