diff --git a/src/index.ts b/src/index.ts index d9e7d13..093df55 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,109 @@ // @alkdev/taskgraph — Public API surface -// Re-exports from all submodules +// +// This is the main entry point for consumers. Everything they need should be +// importable from `@alkdev/taskgraph`. Internal implementation details (types +// and functions that operate on the raw graphology instance) are intentionally +// NOT re-exported here to maintain a clean public API boundary. -export * from './schema/index.js'; -export * from './graph/index.js'; -export * from './analysis/index.js'; -export * from './frontmatter/index.js'; -export * from './error/index.js'; \ No newline at end of file +// --------------------------------------------------------------------------- +// TaskGraph class (the primary data structure) +// --------------------------------------------------------------------------- + +export { TaskGraph } from './graph/construction.js'; + +// --------------------------------------------------------------------------- +// Analysis functions (standalone, composable) +// --------------------------------------------------------------------------- + +// Graph analysis +export { parallelGroups } from './analysis/parallel-groups.js'; +export { criticalPath, weightedCriticalPath } from './analysis/critical-path.js'; +export { bottlenecks } from './analysis/bottleneck.js'; +export type { BottleneckResult } from './analysis/bottleneck.js'; + +// Cost-benefit analysis +export { riskPath, riskDistribution } from './analysis/risk.js'; +export { calculateTaskEv, workflowCost } from './analysis/cost-benefit.js'; +export { shouldDecomposeTask } from './analysis/decompose.js'; + +// Categorical numeric methods +export { + scopeCostEstimate, + scopeTokenEstimate, + riskSuccessProbability, + riskWeight, + impactWeight, + resolveDefaults, +} from './analysis/defaults.js'; + +// --------------------------------------------------------------------------- +// Frontmatter functions +// --------------------------------------------------------------------------- + +export { parseFrontmatter } from './frontmatter/parse.js'; +export { serializeFrontmatter } from './frontmatter/serialize.js'; +export { parseTaskFile, parseTaskDirectory } from './frontmatter/file-io.js'; + +// --------------------------------------------------------------------------- +// Schemas and types +// --------------------------------------------------------------------------- + +// Enum schemas + types (const+type pairs with same name: export by value, TS includes type) +export { + TaskScopeEnum, + TaskRiskEnum, + TaskImpactEnum, + TaskLevelEnum, + TaskPriorityEnum, + TaskStatusEnum, +} from './schema/enums.js'; + +export type { + TaskScope, + TaskRisk, + TaskImpact, + TaskLevel, + TaskPriority, + TaskStatus, +} from './schema/enums.js'; + +// Input schemas + types +export { TaskInput, DependencyEdge } from './schema/task.js'; + +// Graph schemas + types (exclude SerializedGraph generic factory and TaskGraphNodeAttributesUpdate) +export { + TaskGraphNodeAttributes, + TaskGraphEdgeAttributes, + TaskGraphSerialized, +} from './schema/graph.js'; + +// Result schemas + types +export { + RiskPathResult, + DecomposeResult, + WorkflowCostOptions, + WorkflowCostResult, + EvConfig, + EvResult, + RiskDistributionResult, + ResolvedTaskAttributes, +} from './schema/results.js'; + +// --------------------------------------------------------------------------- +// Error classes + validation error types +// --------------------------------------------------------------------------- + +export { + TaskgraphError, + TaskNotFoundError, + CircularDependencyError, + InvalidInputError, + DuplicateNodeError, + DuplicateEdgeError, +} from './error/index.js'; + +export type { + ValidationError, + GraphValidationError, + AnyValidationError, +} from './error/index.js'; \ No newline at end of file diff --git a/src/schema/index.ts b/src/schema/index.ts index c7e3b86..9f6def9 100644 --- a/src/schema/index.ts +++ b/src/schema/index.ts @@ -1,4 +1,7 @@ -// Schema submodule — re-exports +// Schema submodule — public re-exports +// +// Excludes: Nullable (internal TypeBox helper), SerializedGraph (generic factory), +// TaskGraphNodeAttributesUpdate (internal use for update operations) export * from './enums.js'; export * from './task.js'; diff --git a/src/schema/task.ts b/src/schema/task.ts index bcc5860..5ab7ef8 100644 --- a/src/schema/task.ts +++ b/src/schema/task.ts @@ -9,9 +9,6 @@ import { TaskPriorityEnum, } from "./enums.js"; -// Re-export Nullable for convenience (originally defined in enums.ts) -export { Nullable } from "./enums.js"; - // --- Input Schemas --- /** diff --git a/test/schema.test.ts b/test/schema.test.ts index 1410f87..3abfb40 100644 --- a/test/schema.test.ts +++ b/test/schema.test.ts @@ -369,14 +369,8 @@ describe('Type alias correctness — TaskInput and DependencyEdge (compile-time) }); }); -// Re-export Nullable from task.ts to verify the re-export works -import { Nullable as NullableFromTask } from '../src/schema/task.js'; - -describe('Nullable re-export from task.ts', () => { - it('is the same function as from enums.ts', () => { - expect(NullableFromTask).toBe(Nullable); - }); -}); +// Nullable is no longer re-exported from task.ts — it's an internal helper +// and excluded from the public API surface per src/index.ts // Intentionally import type aliases to verify they exist at compile time type TaskScope = import('../src/schema/enums.js').TaskScope;