Commit Graph

27 Commits

Author SHA1 Message Date
b0d943f4e6 Merge graph/queries: 7 query methods with 45 tests
# Conflicts:
#	src/graph/construction.ts
2026-04-27 12:13:15 +00:00
95c8146af7 Merge graph/construction: fromTasks, fromRecords, fromJSON, addTask, addDependency
# Conflicts:
#	src/graph/construction.ts
2026-04-27 12:07:41 +00:00
98cc05d266 feat(graph/queries): implement query methods — hasCycles, findCycles, topologicalOrder, dependencies, dependents, taskCount, getTask
- hasCycles(): uses graphology-dag.hasCycle() as fast boolean check
- findCycles(): SCC pre-check + custom 3-color DFS for cycle path extraction
- topologicalOrder(): graphology-dag.topologicalSort + CircularDependencyError on cycle
- dependencies/dependents: inNeighbors/outNeighbors with TaskNotFoundError
- taskCount(): graph.order, getTask(): node attributes or undefined
- 45 unit tests covering all acceptance criteria
2026-04-27 12:00:17 +00:00
8d384a7b3e feat(graph/construction): implement TaskGraph construction methods
- fromTasks: bulk import via serialized blob, orphan nodes for dangling refs,
  DuplicateNodeError for duplicates, edge dedup, null→undefined stripping
- fromRecords: strict validation (TaskNotFoundError for dangling refs,
  DuplicateEdgeError for duplicate edges), per-edge qualityRetention
- fromJSON: TypeBox Value.Check validation, InvalidInputError on schema failure,
  orphan nodes preserved
- addTask: throws DuplicateNodeError if ID exists
- addDependency: throws TaskNotFoundError/DuplicateEdgeError, deterministic
  edge keys per ADR-006, default qualityRetention 0.9
- taskInputToNodeAttrs: strips null→undefined for categorical fields,
  drops non-graph fields (tags, assignee, due, created, modified)
- 47 new unit tests (304 total, all passing)
2026-04-27 11:59:56 +00:00
96e65079c2 Merge cost-benefit/ev-calculation: calculateTaskEv pure function with 30 tests 2026-04-27 11:54:10 +00:00
aabc9e2fb5 Merge graph/mutation: removeTask, removeDependency, updateTask, updateEdgeAttributes 2026-04-27 11:53:42 +00:00
95ef4b023b Merge frontmatter/file-io-and-serialize: parseTaskFile, parseTaskDirectory, serializeFrontmatter 2026-04-27 11:53:13 +00:00
6016e81162 feat(cost-benefit): implement calculateTaskEv pure function
Implement the core EV calculation: EV = p*C_success + (1-p)*C_fail
where C_success = scopeCost*impactWeight, C_fail = scopeCost*impactWeight + fallbackCost + timeLost*expectedRetries.

- expectedRetries = (1-p)/p when p>0, else 0 (geometric series)
- Caps expectedRetries at config.retries when retries > 0
- Multiplies final EV by config.valueRate when non-zero
- 30 unit tests covering formula, edge cases, and Python research model values
2026-04-27 11:51:59 +00:00
5adc712193 feat(graph/mutation): implement removeTask, removeDependency, updateTask, updateEdgeAttributes 2026-04-27 11:51:57 +00:00
6da0cb12ce feat(frontmatter/file-io-and-serialize): implement parseTaskFile, parseTaskDirectory, and serializeFrontmatter 2026-04-27 11:51:34 +00:00
34e227464c feat(graph/export): implement export() and toJSON() methods on TaskGraph 2026-04-27 11:49:11 +00:00
9ad0ec902c Merge graph/taskgraph-class: TaskGraph class skeleton with DirectedGraph, edge keys, fromJSON 2026-04-27 11:30:57 +00:00
e155e1e08a feat(graph/taskgraph-class): implement TaskGraph class skeleton with graphology DirectedGraph 2026-04-27 11:29:59 +00:00
412849501f Merge frontmatter/parsing: parseFrontmatter with YAML 1.2, TypeBox validation, InvalidInputError 2026-04-27 11:28:09 +00:00
7401e4d056 feat(frontmatter/parsing): implement parseFrontmatter with YAML parsing and TypeBox validation 2026-04-27 11:26:55 +00:00
0613a190ce feat(schema/numeric-methods-and-defaults): implement categorical numeric functions and resolveDefaults 2026-04-27 11:25:43 +00:00
30f20a9f26 Merge schema/graph-schemas: node/edge attribute schemas, SerializedGraph generic factory
# Conflicts:
#	test/schema.test.ts
2026-04-27 11:11:07 +00:00
ec30c96671 Merge schema/input-schemas: TaskInput and DependencyEdge schemas with Nullable helper 2026-04-27 11:04:07 +00:00
d2eaa0dd77 feat(schema/graph-schemas): define TaskGraphNodeAttributes, TaskGraphEdgeAttributes, and SerializedGraph generic
Implements graph attribute schemas and the SerializedGraph generic factory
parameterized with <N, E, G> following the graphology JSON format.

- TaskGraphNodeAttributes: name + optional categorical enums (scope, risk,
  impact, level, priority, status) — analysis-relevant metadata only
- TaskGraphNodeAttributesUpdate: Type.Partial(TaskGraphNodeAttributes)
- TaskGraphEdgeAttributes: optional qualityRetention number
- SerializedGraph<N, E, G>: generic factory for graphology JSON format
- TaskGraphSerialized: concrete instantiation with empty graph attributes
- No schema version field per spec

35 new tests covering validation, rejection, and compile-time type safety.
2026-04-27 11:03:07 +00:00
b415d8c86b feat(schema/input-schemas): define TaskInput, DependencyEdge schemas and Nullable re-export
- Add TaskInput schema with all fields per architecture (id, name, dependsOn,
  categorical fields as Optional(Nullable(...)), metadata fields)
- Add DependencyEdge schema with from, to, qualityRetention fields
- Re-export Nullable helper from task.ts for convenience
- Add type aliases: TaskInput, DependencyEdge via Static<typeof>
- Add 49 tests covering validation, nullable fields, edge cases, type correctness
2026-04-27 11:02:40 +00:00
e367215e43 feat(schema/result-types): define analysis result TypeBox schemas 2026-04-27 10:59:57 +00:00
196b044ca4 Merge schema/enums: 6 TypeBox enum schemas with type aliases, 21 tests 2026-04-27 10:10:44 +00:00
6003926807 feat(schema/enums): define TypeBox categorical enum schemas and type aliases 2026-04-27 10:08:28 +00:00
e4b5ac3d54 Merge frontmatter/splitter: splitFrontmatter function with 18 tests 2026-04-27 10:05:19 +00:00
15104ff10c feat(frontmatter/splitter): implement splitFrontmatter function with tests 2026-04-27 10:04:31 +00:00
ce68271f4f feat(error/error-hierarchy): implement typed error class hierarchy
- Add typed fields to all error subclasses (taskId, cycles, field, message, prerequisite, dependent)
- Set Object.setPrototypeOf(this, new.target.prototype) in all constructors
- Add InvalidInputError.fromTypeBoxError() static factory for TypeBox Value.Errors() output
- CircularDependencyError accepts string[][] for cycle paths
- 31 unit tests covering instanceof chain, field access, .name property, and error messages
2026-04-27 10:00:40 +00:00
bd8a7b06d0 feat(setup/project-init): initialize TypeScript ESM project skeleton
- package.json with @alkdev/taskgraph, ESM primary, CJS compat exports
- tsconfig.json targeting Node 18+, strict mode, declaration output
- All production deps: graphology suite, @alkdev/typebox, yaml
- Dev deps: typescript, vitest, @types/node
- src/ skeleton: schema, graph, analysis, frontmatter, error modules
- test/ directory with 5 placeholder test files
- .gitignore and vitest.config.ts
2026-04-27 09:54:01 +00:00