Decompose architecture into 28 atomic implementation tasks

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.
This commit is contained in:
2026-04-27 08:30:05 +00:00
parent e592caed57
commit 131e3e929b
28 changed files with 1306 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
---
id: analysis/bottlenecks
name: Implement bottlenecks analysis function
status: pending
depends_on:
- graph/construction
- graph/queries
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
Implement `bottlenecks(graph: TaskGraph): Array<{ taskId: string; score: number }>` using `graphology-metrics` betweenness centrality. Bottleneck tasks are those on the most shortest paths between other nodes.
## Acceptance Criteria
- [ ] `bottlenecks` returns array of `{ taskId, score }` objects sorted by score descending
- [ ] Uses `graphology-metrics` betweenness centrality computation
- [ ] Normalized scores (0.01.0 range)
- [ ] Tasks with score 0 are still included (they're not bottlenecks)
- [ ] Works on disconnected graphs (betweenness is 0 for disconnected components)
- [ ] Unit tests: linear chain (middle node has highest betweenness), star graph (center has highest), independent nodes (all zero)
## References
- docs/architecture/api-surface.md — bottlenecks signature
- docs/architecture/build-distribution.md — graphology-metrics dependency
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion

View File

@@ -0,0 +1,40 @@
---
id: analysis/critical-path
name: Implement criticalPath and weightedCriticalPath functions
status: pending
depends_on:
- graph/construction
- graph/queries
scope: moderate
risk: medium
impact: component
level: implementation
---
## Description
Implement `criticalPath` and `weightedCriticalPath` as standalone functions. `criticalPath` finds the longest path from sources to sinks using default edge weighting. `weightedCriticalPath` accepts a custom weight function for per-node weighting.
`criticalPath` can be implemented via topological order + dynamic programming (longest path in DAG). For unweighted, each edge has weight 1; for weighted, each node contributes a weight.
## Acceptance Criteria
- [ ] `criticalPath(graph: TaskGraph): string[]` — returns the longest path as an ordered array of task IDs
- [ ] `weightedCriticalPath(graph: TaskGraph, weightFn: (taskId: string, attrs: TaskGraphNodeAttributes) => number): string[]` — returns the path with the highest cumulative weight
- [ ] Both functions throw `CircularDependencyError` if graph is cyclic
- [ ] When multiple paths tie, returns any one of them (deterministic order preferred)
- [ ] Empty graph returns `[]`; single-node graph returns `[nodeId]`
- [ ] Unit tests: linear chain (the chain itself is critical path), diamond graph (tests path selection), weighted variant with diverse scope values
## References
- docs/architecture/api-surface.md — criticalPath, weightedCriticalPath signatures
- docs/architecture/graph-model.md — edge direction (prerequisite→dependent determines source→sink)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion

View File

@@ -0,0 +1,38 @@
---
id: analysis/parallel-groups
name: Implement parallelGroups analysis function
status: pending
depends_on:
- graph/construction
- graph/queries
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
Implement `parallelGroups(graph: TaskGraph): string[][]` in `src/analysis/index.ts` or a dedicated module. This returns groups of tasks that can be executed concurrently — tasks at the same topological depth. Uses `graphology-dag.topologicalGenerations`.
## Acceptance Criteria
- [ ] `parallelGroups` returns `string[][]` where each inner array is a generation of tasks at the same depth from sources
- [ ] Uses `graphology-dag.topologicalGenerations()` for the generation computation
- [ ] Tasks with zero prerequisites are in the first group
- [ ] Throws `CircularDependencyError` if the graph is cyclic (delegated to `topologicalGenerations` behavior)
- [ ] Works on disconnected graphs (each connected component sorted independently, then merged by depth)
- [ ] Unit tests: linear chain (each group size 1), diamond graph, disconnected components
## References
- docs/architecture/api-surface.md — parallelGroups signature
- docs/architecture/graph-model.md — parallel groups definition
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion