2.5 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| graph/taskgraph-class | Implement TaskGraph class skeleton with graphology DirectedGraph | completed |
|
moderate | medium | phase | implementation |
Description
Create the TaskGraph class in src/graph/index.ts that wraps graphology.DirectedGraph. This is the data class that holds the graph instance and provides the foundation for construction, mutation, and query methods. At this stage, implement the constructor, raw getter, and the overall class structure. Actual construction and analysis methods come in dependent tasks.
Acceptance Criteria
src/graph/index.tsexportsTaskGraphclass- Constructor creates an internal
graphology.DirectedGraphwith options{ type: 'directed', multi: false, allowSelfLoops: false } get raw(): Graphreturns the underlying graphology instance- Constructor accepts optional
TaskGraphSerializedfor initializing from serialized data (delegates tofromJSONpattern) - Class stores edge key format:
${source}->${target}(per ADR-006) - No parallel edges constraint enforced by
multi: falsegraph option - No self-loops constraint enforced by
allowSelfLoops: falsegraph option - Internal
_edgeKey(source, target): stringmethod producing deterministic keys - Re-exported from
src/index.ts
References
- docs/architecture/api-surface.md — TaskGraph class API
- docs/architecture/graph-model.md — construction paths, edge direction, constraints
- docs/architecture/decisions/006-deterministic-edge-keys.md — edge key format
Notes
Implementation placed in src/graph/construction.ts (as per existing module structure). The class is re-exported via src/graph/index.ts and src/index.ts. Static methods fromTasks and fromRecords are stubs (throw) pending dependent task implementation. fromJSON is fully implemented since the constructor needs it for deserialization.
Summary
Implemented TaskGraph class skeleton wrapping graphology DirectedGraph.
- Modified:
src/graph/construction.ts(full class with constructor, raw getter, _edgeKey, fromJSON, stubs for fromTasks/fromRecords) - Modified:
src/graph/index.ts(added TaskGraphInner type export) - Modified:
test/graph.test.ts(added 20 new tests for class skeleton, preserved 22 existing fixture tests) - Tests: 42 in graph.test.ts (all passing), 204 total across suite (all passing)