Break the @alkdev/taskgraph architecture specs into dependency-ordered implementation tasks across 8 component directories: setup, schema, error, graph, analysis, cost-benefit, frontmatter, api, and review. Each task has clear acceptance criteria referencing specific architecture docs. Three review tasks serve as quality gates at critical junction points (schemas-and-errors, graph-complete, complete-library). The dependency graph is validated acyclic with 9 topological levels enabling significant parallelism across independent work streams.
2.2 KiB
2.2 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |||
|---|---|---|---|---|---|---|---|---|---|---|
| frontmatter/parsing | Implement parseFrontmatter with YAML parsing and TypeBox validation | pending |
|
narrow | low | component | implementation |
Description
Implement parseFrontmatter(markdown: string): TaskInput in src/frontmatter/parse.ts. This combines the splitter with yaml.parse() and TypeBox validation. Invalid frontmatter throws InvalidInputError with field-level details.
Per frontmatter.md, the function uses:
- The custom splitter for
---extraction yaml.parse()(fromyamlpackage, zero dependencies) for YAML↔JS conversion- TypeBox
Value.Check()+Value.Errors()for structured field-level validation Value.Clean()to strip unknown properties from untrusted input
Acceptance Criteria
parseFrontmatter(markdown: string): TaskInput:- Calls splitter to extract YAML string
- Throws
InvalidInputErrorif no valid frontmatter found (notnullreturn — the caller expects TaskInput) - Calls
yaml.parse(yamlString)for YAML 1.2 parsing - Runs
Value.Clean(TaskInput, parsed)to strip unknown properties - Runs
Value.Check(TaskInput, cleaned)— if fails, runsValue.Errors()and throwsInvalidInputErrorwith structured field/path/message/value details - Returns validated
TaskInput
InvalidInputErroris populated with field-level details fromValue.Errors()output- YAML 1.2 used exclusively (the
yamlpackage default) — no YAML 1.1 type coercion - Handles YAML
nullvalues (e.g.,risk:with no value) correctly — becomesnullin the TaskInput (distinction from absent field) - Unit tests: valid frontmatter, missing required fields, invalid enum values, unknown fields stripped, null categorical values preserved
References
- docs/architecture/frontmatter.md — parseFrontmatter, yaml package, no gray-matter
- docs/architecture/schemas.md — TaskInput schema, Nullable helper
- docs/architecture/errors-validation.md — InvalidInputError
Notes
To be filled by implementation agent
Summary
To be filled on completion