Skip to content

task-graph

English | 日本語

Task dependency types, cycle detection, topological sorting, critical-path and blocker analysis, delay simulation and an in-memory adapter. Zero runtime dependencies, MIT, canonical public monorepo package. No React, AI, DB, storage or data-engine dependency.

Terminal window
npm install @alneas/task-graph
import { calculateCriticalPath, simulateDelayImpact } from '@alneas/task-graph';
import type { TaskNode, TaskEdge } from '@alneas/task-graph/types';
const tasks: TaskNode[] = [
{ id: 'design', title: 'Design', status: 'TODO', durationHours: 2 },
{ id: 'build', title: 'Build', status: 'TODO', durationHours: 3 },
];
const edges: TaskEdge[] = [{ predecessorId: 'design', successorId: 'build', lagHours: 1 }];
const result = calculateCriticalPath(tasks, edges); // totalDurationHours: 6
const delayed = simulateDelayImpact(tasks, edges, 'design', 2); // projectDelayHours: 2

Root exports calculation and planning APIs. /types, /cpm, /in-memory-adapter and /planning are explicit subpaths; advanced planning helpers have separate entries. Node >=24, browser/edge Web-compatible hosts, ESM/CJS and strict NodeNext consumers are verified. There is no persistence, HTTP service or AI execution here. The separate /planning API supports explicit working calendars and deterministic resource leveling. Engine’s existing graph APIs re-export these implementations; database/HTTP graph adapters and dispatch remain there. Read Usage and calculation constraints. Source JSDoc is the API reference. See CONTRIBUTING.md, RELEASING.md, and ALNEAS Docs.

Working calendars and resource planning: planning.

Consumer AI guidance ships in dist/ai/SKILL.md and package-context.json. Preview the package-scoped additions to your project instructions with the following command. Add --write after reviewing the preview; existing instructions are preserved.

Terminal window
node node_modules/@alneas/task-graph/dist/ai/setup.mjs --project .