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.5 KiB
2.5 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | ||
|---|---|---|---|---|---|---|---|---|---|
| frontmatter/file-io-and-serialize | Implement parseTaskFile, parseTaskDirectory, and serializeFrontmatter | pending |
|
moderate | low | component | implementation |
Description
Implement the file I/O frontmatter functions and the serializer. These are convenience wrappers for common use cases and the reverse operation (TaskInput → markdown).
Per frontmatter.md:
parseTaskFile/parseTaskDirectorydepend onnode:fs/promises(Node.js only)parseFrontmatteris runtime-agnosticserializeFrontmatterusesyaml.stringify()for the data portion
Acceptance Criteria
parseTaskFile(filePath: string): Promise<TaskInput>:- Reads file using
node:fs/promises.readFile - Delegates to
parseFrontmatterfor parsing and validation - Throws underlying Node.js error for I/O failures (ENOENT, EACCES, etc.)
- Reads file using
parseTaskDirectory(dirPath: string): Promise<TaskInput[]>:- Recursive directory scanning via
node:fs/promises.readdirwith{ recursive: true }or manual recursion - Filters for
.mdfiles only - Silently skips files without valid
----delimited frontmatter (no error thrown, just omitted from results) - Throws underlying Node.js error for I/O failures
- Uses
parseTaskFileper file
- Recursive directory scanning via
serializeFrontmatter(task: TaskInput, body?: string): string:- Constructs
----delimited markdown output - Uses
yaml.stringify()for theTaskInputdata (excludesidfrom frontmatter? No — per Rust CLI convention,idcomes from the filename, but in the schema it's part ofTaskInput. Follow schema: include allTaskInputfields in the YAML.) - Appends body content (default: empty string) after closing
--- - Handles nullable fields correctly:
risk: null→risk: nullin YAML (explicit null), absent fields → omitted from YAML
- Constructs
- File I/O functions documented as Node.js-only in JSDoc comments
- Unit tests: parseTaskFile with temp file, parseTaskDirectory with temp dir (including non-.md files, missing frontmatter files), serializeFrontmatter round-trip parseFrontmatter(serializeFrontmatter(task)) ≈ task
References
- docs/architecture/frontmatter.md — file I/O functions, splitter, serializer
- docs/architecture/schemas.md — TaskInput definition for serialization
Notes
To be filled by implementation agent
Summary
To be filled on completion