45 Commits

Author SHA1 Message Date
039a6ccfe1 fix: address review findings — CJS build (tsup), workflowCost signature, bottlenecks empty-graph test
- C1(critical): Replace tsc build with tsup for dual ESM + CJS output
- W2(warning): Change workflowCost to accept TaskGraph instead of TaskGraphInner
- S1(suggestion): Add test for bottlenecks empty-graph early return
- S2(suggestion): Document dangling-reference detection is unreachable via public API
2026-04-27 19:56:43 +00:00
55600ac95a review(complete-library): changes requested — 1 critical (CJS build missing), 3 warnings, 4 suggestions 2026-04-27 18:43:49 +00:00
ff7b19bc2c Merge cost-benefit/risk-analysis: riskPath, riskDistribution, shouldDecomposeTask, 29 tests 2026-04-27 13:48:07 +00:00
9d2d1811ca feat(cost-benefit/risk-analysis): implement riskPath, riskDistribution, shouldDecomposeTask 2026-04-27 13:39:31 +00:00
28b38e9890 review(graph-complete): approved with changes, 0 critical issues 2026-04-27 13:28:09 +00:00
b231fa9da0 feat(cost-benefit/workflow-cost): fix includeCompleted default to false per api-surface.md spec
The workflowCost function had includeCompleted defaulting to true, but
the api-surface.md specifies the default should be false. Fixed the
default and updated test suite to verify the correct default behavior
and add explicit test for includeCompleted: true opt-in case.

All 562 tests passing across 12 test files.
2026-04-27 13:21:04 +00:00
1344ddf437 Merge cost-benefit/dag-propagation: computeEffectiveP and workflowCost, 63 tests
# Conflicts:
#	src/analysis/cost-benefit.ts
2026-04-27 12:56:15 +00:00
7bfcfecc7a feat(cost-benefit/dag-propagation): implement DAG-propagation effective probability computation
Implement computeEffectiveP internal helper and workflowCost public function
that captures the structural reality that upstream failures multiply downstream
damage, per ADR-004 and the Python research model.

- computeEffectiveP: computes pEffective from intrinsic probability + upstream
  propagation using inherited quality factors (parentP + (1-parentP) × qualityRetention)
- workflowCost: processes tasks in topological order, computes per-task EV with
  degraded effective probability, includes pIntrinsic/pEffective split
- Supports independent and dag-propagate modes
- Completed tasks excluded from results but propagate p=1.0 when includeCompleted: false
- Per-edge qualityRetention overrides defaultQualityRetention option
- Throws CircularDependencyError for cyclic graphs via topologicalOrder
- 30+ new tests covering chain compounding, diamond graph, mode comparison,
  completed task semantics, cycle detection, per-edge qualityRetention
2026-04-27 12:52:47 +00:00
ef8451bb19 Merge graph/subgraph-and-validation: subgraph and validation methods, 43 tests 2026-04-27 12:47:07 +00:00
c3649256cc feat(graph/subgraph-and-validation): implement subgraph and validation methods
- Add subgraph() method using graphology-operators.subgraph (ADR-007: internal-only edges)
- Add validateSchema() using TypeBox Value.Check/Value.Errors
- Add validateGraph() detecting cycles and dangling references
- Add validate() combining both validations
- Define ValidationError, GraphValidationError, AnyValidationError types in error module
- Add standalone validation functions in src/graph/validation.ts
- Export validation module from src/graph/index.ts
- Add 43 unit tests for subgraph filtering and validation
2026-04-27 12:41:51 +00:00
e074275bcf docs(analysis/bottlenecks): mark task as completed 2026-04-27 12:36:14 +00:00
37179bc1de feat(analysis/parallel-groups): implement parallelGroups function with tests 2026-04-27 12:31:43 +00:00
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
52a951cb6c Merge graph/export: export() and toJSON() methods on TaskGraph 2026-04-27 11:52:33 +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
f8cd38f02d review(schemas-and-errors): approved, 0 critical issues, all tests passing 2026-04-27 11:51:27 +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
8725a26b43 Merge setup/test-infrastructure: vitest config, shared fixtures, 30 tests passing 2026-04-27 10:49:01 +00:00
167dde68f4 feat(setup/test-infrastructure): configure Vitest with shared test fixtures and helpers
- Add test:coverage script and @vitest/coverage-v8 dev dependency
- Update vitest.config.ts with @/ path alias and v8 coverage config
- Create test/fixtures/graphs.ts with 5 fixture graphs (linearChain,
  diamond, mixedCategory, cyclic, largeGraph) and createTaskGraph helper
- Expand graph.test.ts with 26 fixture validation tests
- 30 tests passing, CI-compatible output (vitest run)
2026-04-27 10:48:35 +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
131e3e929b 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.
2026-04-27 08:30:05 +00:00
e592caed57 Add architecture review findings and address documentation issues
Review of all ADR documents (001-007) and peripheral architecture docs
identified 3 critical, 10 warning, and 7 suggestion issues.

Addressed in this commit:
- W-1: Add draft qualifier to ADR-002 reference to incremental exploration
- W-2: Add Alternatives Considered section to ADR-001
- W-3: Add Document Lifecycle section to README.md (draft/stable/deprecated)
- W-4: Clarify includeCompleted semantics (only 'completed' status triggers exclusion)
- W-5: Document file I/O runtime constraints in frontmatter.md
- W-6: Add ADR reference to architecture.md redirect
- W-7: Verify CVE-2025-64718 (confirmed real, improved description)
- W-9: Convert workspace-absolute paths to relative/monorepo references
- S-7: Add future ADR-008 note to incremental-update-exploration.md

Critical issues (C-1, C-2, C-3) and remaining warnings (W-8, W-10, S-4, S-5)
were addressed by a parallel agent in a prior commit.

All 16 review tasks created and resolved.
2026-04-26 09:41:05 +00:00