Merge schema/enums: 6 TypeBox enum schemas with type aliases, 21 tests

This commit is contained in:
2026-04-27 10:10:44 +00:00
3 changed files with 266 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
---
id: schema/enums
name: Define TypeBox categorical enum schemas and type aliases
status: pending
status: completed
depends_on:
- setup/project-init
scope: narrow
@@ -18,17 +18,17 @@ The six enums: `TaskScopeEnum`, `TaskRiskEnum`, `TaskImpactEnum`, `TaskLevelEnum
## Acceptance Criteria
- [ ] `src/schema/enums.ts` exports all six enum schemas and their type aliases
- [ ] Each enum uses `Type.Union([Type.Literal("value"), ...])` pattern per [typebox-patterns.md](../../../docs/research/typebox-patterns.md)
- [ ] `TaskScopeEnum`: `"single" | "narrow" | "moderate" | "broad" | "system"`
- [ ] `TaskRiskEnum`: `"trivial" | "low" | "medium" | "high" | "critical"`
- [ ] `TaskImpactEnum`: `"isolated" | "component" | "phase" | "project"`
- [ ] `TaskLevelEnum`: `"planning" | "decomposition" | "implementation" | "review" | "research"`
- [ ] `TaskPriorityEnum`: `"low" | "medium" | "high" | "critical"`
- [ ] `TaskStatusEnum`: `"pending" | "in-progress" | "completed" | "failed" | "blocked"`
- [ ] Type aliases derived via `Static<typeof>`: `TaskScope`, `TaskRisk`, `TaskImpact`, `TaskLevel`, `TaskPriority`, `TaskStatus`
- [ ] Naming convention matches spec: `Enum` suffix on schema constants only, never on type aliases
- [ ] `src/schema/index.ts` re-exports all schemas and types
- [x] `src/schema/enums.ts` exports all six enum schemas and their type aliases
- [x] Each enum uses `Type.Union([Type.Literal("value"), ...])` pattern per [typebox-patterns.md](../../../docs/research/typebox-patterns.md)
- [x] `TaskScopeEnum`: `"single" | "narrow" | "moderate" | "broad" | "system"`
- [x] `TaskRiskEnum`: `"trivial" | "low" | "medium" | "high" | "critical"`
- [x] `TaskImpactEnum`: `"isolated" | "component" | "phase" | "project"`
- [x] `TaskLevelEnum`: `"planning" | "decomposition" | "implementation" | "review" | "research"`
- [x] `TaskPriorityEnum`: `"low" | "medium" | "high" | "critical"`
- [x] `TaskStatusEnum`: `"pending" | "in-progress" | "completed" | "failed" | "blocked"`
- [x] Type aliases derived via `Static<typeof>`: `TaskScope`, `TaskRisk`, `TaskImpact`, `TaskLevel`, `TaskPriority`, `TaskStatus`
- [x] Naming convention matches spec: `Enum` suffix on schema constants only, never on type aliases
- [x] `src/schema/index.ts` re-exports all schemas and types
## References
@@ -37,8 +37,11 @@ The six enums: `TaskScopeEnum`, `TaskRiskEnum`, `TaskImpactEnum`, `TaskLevelEnum
## Notes
> To be filled by implementation agent
Also exported the `Nullable` helper generic (used by downstream schemas) and added JSDoc comments on each type alias.
## Summary
> To be filled on completion
Implemented all six categorical enum schemas using `Type.Union([Type.Literal(...)])` pattern with `Static<typeof>` type aliases.
- Created: `src/schema/enums.ts` (6 enum schemas + 6 type aliases + Nullable helper)
- Modified: `test/schema.test.ts` (21 enum-specific tests: Value.Check validation, Nullable helper, compile-time type alias verification)
- Tests: 21 enum tests + 4 placeholders, all passing; `tsc --noEmit` clean