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
This commit is contained in:
44
src/error/index.ts
Normal file
44
src/error/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// Error classes — TaskgraphError, TaskNotFoundError, CircularDependencyError,
|
||||
// InvalidInputError, DuplicateNodeError, DuplicateEdgeError
|
||||
|
||||
export class TaskgraphError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'TaskgraphError';
|
||||
}
|
||||
}
|
||||
|
||||
export class TaskNotFoundError extends TaskgraphError {
|
||||
constructor(taskId: string) {
|
||||
super(`Task not found: ${taskId}`);
|
||||
this.name = 'TaskNotFoundError';
|
||||
}
|
||||
}
|
||||
|
||||
export class CircularDependencyError extends TaskgraphError {
|
||||
constructor(cycle: string[]) {
|
||||
super(`Circular dependency detected: ${cycle.join(' → ')}`);
|
||||
this.name = 'CircularDependencyError';
|
||||
}
|
||||
}
|
||||
|
||||
export class InvalidInputError extends TaskgraphError {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'InvalidInputError';
|
||||
}
|
||||
}
|
||||
|
||||
export class DuplicateNodeError extends TaskgraphError {
|
||||
constructor(nodeId: string) {
|
||||
super(`Duplicate node: ${nodeId}`);
|
||||
this.name = 'DuplicateNodeError';
|
||||
}
|
||||
}
|
||||
|
||||
export class DuplicateEdgeError extends TaskgraphError {
|
||||
constructor(source: string, target: string) {
|
||||
super(`Duplicate edge: ${source} → ${target}`);
|
||||
this.name = 'DuplicateEdgeError';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user