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:
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
|
||||
# Build output
|
||||
dist/
|
||||
|
||||
# Source maps
|
||||
*.js.map
|
||||
|
||||
# Environment
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Coverage
|
||||
coverage/
|
||||
1840
package-lock.json
generated
Normal file
1840
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
56
package.json
Normal file
56
package.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "@alkdev/taskgraph",
|
||||
"version": "0.0.1",
|
||||
"description": "Task graph library — directed acyclic graph analysis, risk scoring, and YAML frontmatter for task management",
|
||||
"type": "module",
|
||||
"main": "./dist/index.cjs",
|
||||
"module": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"lint": "tsc --noEmit",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"keywords": [
|
||||
"taskgraph",
|
||||
"dag",
|
||||
"critical-path",
|
||||
"risk-analysis",
|
||||
"graphology"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"graphology": "^0.26.0",
|
||||
"graphology-dag": "^0.4.1",
|
||||
"graphology-metrics": "^2.4.0",
|
||||
"graphology-components": "^1.5.4",
|
||||
"graphology-operators": "^1.6.1",
|
||||
"@alkdev/typebox": "^0.34.49",
|
||||
"yaml": "^2.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.7.0",
|
||||
"vitest": "^3.1.0",
|
||||
"@types/node": "^22.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
1
src/analysis/bottleneck.ts
Normal file
1
src/analysis/bottleneck.ts
Normal file
@@ -0,0 +1 @@
|
||||
// bottlenecks (graphology betweenness)
|
||||
1
src/analysis/cost-benefit.ts
Normal file
1
src/analysis/cost-benefit.ts
Normal file
@@ -0,0 +1 @@
|
||||
// calculateTaskEv, workflowCost, computeEffectiveP
|
||||
1
src/analysis/critical-path.ts
Normal file
1
src/analysis/critical-path.ts
Normal file
@@ -0,0 +1 @@
|
||||
// criticalPath, weightedCriticalPath
|
||||
1
src/analysis/decompose.ts
Normal file
1
src/analysis/decompose.ts
Normal file
@@ -0,0 +1 @@
|
||||
// shouldDecomposeTask
|
||||
1
src/analysis/defaults.ts
Normal file
1
src/analysis/defaults.ts
Normal file
@@ -0,0 +1 @@
|
||||
// resolveDefaults, enum numeric methods
|
||||
8
src/analysis/index.ts
Normal file
8
src/analysis/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// Analysis submodule — re-exports
|
||||
|
||||
export * from './critical-path.js';
|
||||
export * from './bottleneck.js';
|
||||
export * from './risk.js';
|
||||
export * from './cost-benefit.js';
|
||||
export * from './decompose.js';
|
||||
export * from './defaults.js';
|
||||
1
src/analysis/risk.ts
Normal file
1
src/analysis/risk.ts
Normal file
@@ -0,0 +1 @@
|
||||
// riskPath, riskDistribution
|
||||
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';
|
||||
}
|
||||
}
|
||||
4
src/frontmatter/index.ts
Normal file
4
src/frontmatter/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Frontmatter submodule — parse and serialize
|
||||
|
||||
export { parseFrontmatter, parseTaskFile, parseTaskDirectory } from './parse.js';
|
||||
export { serializeFrontmatter } from './serialize.js';
|
||||
16
src/frontmatter/parse.ts
Normal file
16
src/frontmatter/parse.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// YAML/frontmatter parsing + typebox validation
|
||||
|
||||
export function parseFrontmatter(_input: string): unknown {
|
||||
// Stub — implementation pending
|
||||
return {};
|
||||
}
|
||||
|
||||
export function parseTaskFile(_input: string): unknown {
|
||||
// Stub — implementation pending
|
||||
return {};
|
||||
}
|
||||
|
||||
export function parseTaskDirectory(_dir: string): unknown[] {
|
||||
// Stub — implementation pending
|
||||
return [];
|
||||
}
|
||||
6
src/frontmatter/serialize.ts
Normal file
6
src/frontmatter/serialize.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// TaskInput → markdown with frontmatter
|
||||
|
||||
export function serializeFrontmatter(_input: unknown): string {
|
||||
// Stub — implementation pending
|
||||
return '';
|
||||
}
|
||||
5
src/graph/construction.ts
Normal file
5
src/graph/construction.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// TaskGraph class construction — fromTasks, fromRecords, fromJSON, incremental building
|
||||
|
||||
export class TaskGraph {
|
||||
// Stub — implementation pending
|
||||
}
|
||||
5
src/graph/index.ts
Normal file
5
src/graph/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// Graph submodule — TaskGraph class and operations
|
||||
|
||||
export { TaskGraph } from './construction.js';
|
||||
export * from './queries.js';
|
||||
export * from './mutation.js';
|
||||
1
src/graph/mutation.ts
Normal file
1
src/graph/mutation.ts
Normal file
@@ -0,0 +1 @@
|
||||
// Graph mutations — removeTask, removeDependency, updateTask, updateEdgeAttributes
|
||||
1
src/graph/queries.ts
Normal file
1
src/graph/queries.ts
Normal file
@@ -0,0 +1 @@
|
||||
// Graph queries — hasCycles, findCycles, topologicalOrder, dependencies, dependents
|
||||
8
src/index.ts
Normal file
8
src/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// @alkdev/taskgraph — Public API surface
|
||||
// Re-exports from all submodules
|
||||
|
||||
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';
|
||||
1
src/schema/enums.ts
Normal file
1
src/schema/enums.ts
Normal file
@@ -0,0 +1 @@
|
||||
// Enum definitions: TaskScope, TaskRisk, TaskImpact, TaskLevel, TaskStatus, TaskPriority
|
||||
1
src/schema/graph.ts
Normal file
1
src/schema/graph.ts
Normal file
@@ -0,0 +1 @@
|
||||
// TaskGraphNodeAttributes, TaskGraphEdgeAttributes, SerializedGraph schemas
|
||||
6
src/schema/index.ts
Normal file
6
src/schema/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// Schema submodule — re-exports
|
||||
|
||||
export * from './enums.js';
|
||||
export * from './task.js';
|
||||
export * from './graph.js';
|
||||
export * from './results.js';
|
||||
1
src/schema/results.ts
Normal file
1
src/schema/results.ts
Normal file
@@ -0,0 +1 @@
|
||||
// RiskPathResult, DecomposeResult, WorkflowCostResult, RiskDistributionResult schemas
|
||||
1
src/schema/task.ts
Normal file
1
src/schema/task.ts
Normal file
@@ -0,0 +1 @@
|
||||
// TaskInput, DependencyEdge schemas
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: setup/project-init
|
||||
name: Initialize project with package.json, tsconfig, and build tooling
|
||||
status: pending
|
||||
status: completed
|
||||
depends_on: []
|
||||
scope: moderate
|
||||
risk: low
|
||||
@@ -22,21 +22,21 @@ Per [build-distribution.md](../../../docs/architecture/build-distribution.md):
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] `package.json` exists with name `@alkdev/taskgraph`, ESM primary (`"type": "module"`), CJS compat config
|
||||
- [ ] All production dependencies listed per [build-distribution.md](../../../docs/architecture/build-distribution.md) dependencies table
|
||||
- [ ] Dev dependencies include: `typescript`, `vitest` (or agreed test runner), `@types/node`
|
||||
- [ ] `tsconfig.json` configured for Node 18+ target, ESM module resolution, strict mode, declaration output
|
||||
- [ ] `.gitignore` covers `node_modules/`, `dist/`, `*.js.map`, `.env`
|
||||
- [ ] `src/` directory skeleton created per [build-distribution.md](../../../docs/architecture/build-distribution.md) project structure:
|
||||
- [x] `package.json` exists with name `@alkdev/taskgraph`, ESM primary (`"type": "module"`), CJS compat config
|
||||
- [x] All production dependencies listed per [build-distribution.md](../../../docs/architecture/build-distribution.md) dependencies table
|
||||
- [x] Dev dependencies include: `typescript`, `vitest` (or agreed test runner), `@types/node`
|
||||
- [x] `tsconfig.json` configured for Node 18+ target, ESM module resolution, strict mode, declaration output
|
||||
- [x] `.gitignore` covers `node_modules/`, `dist/`, `*.js.map`, `.env`
|
||||
- [x] `src/` directory skeleton created per [build-distribution.md](../../../docs/architecture/build-distribution.md) project structure:
|
||||
- `src/index.ts`
|
||||
- `src/schema/index.ts`, `src/schema/enums.ts`, `src/schema/task.ts`, `src/schema/graph.ts`, `src/schema/results.ts`
|
||||
- `src/graph/index.ts`, `src/graph/construction.ts`, `src/graph/queries.ts`, `src/graph/mutation.ts`
|
||||
- `src/analysis/index.ts`, `src/analysis/critical-path.ts`, `src/analysis/bottleneck.ts`, `src/analysis/risk.ts`, `src/analysis/cost-benefit.ts`, `src/analysis/decompose.ts`, `src/analysis/defaults.ts`
|
||||
- `src/frontmatter/index.ts`, `src/frontmatter/parse.ts`, `src/frontmatter/serialize.ts`
|
||||
- `src/error/index.ts`
|
||||
- [ ] `test/` directory created with placeholder test files per build-distribution spec
|
||||
- [ ] `npm install` succeeds without errors
|
||||
- [ ] `npx tsc --noEmit` succeeds (empty source files, but config is valid)
|
||||
- [x] `test/` directory created with placeholder test files per build-distribution spec
|
||||
- [x] `npm install` succeeds without errors
|
||||
- [x] `npx tsc --noEmit` succeeds (empty source files, but config is valid)
|
||||
|
||||
## References
|
||||
|
||||
@@ -44,8 +44,20 @@ Per [build-distribution.md](../../../docs/architecture/build-distribution.md):
|
||||
|
||||
## Notes
|
||||
|
||||
> To be filled by implementation agent
|
||||
Dependency version adjustments from architecture spec:
|
||||
- `@alkdev/typebox`: ^0.2.0 → ^0.34.49 (only version available on npm)
|
||||
- `graphology`: ^0.25.4 → ^0.26.0 (latest on npm)
|
||||
- `graphology-dag`: ^0.4.2 → ^0.4.1 (latest on npm)
|
||||
- `graphology-metrics`: ^0.7.0 → ^2.4.0 (latest on npm)
|
||||
- `graphology-components`: ^0.3.1 → ^1.5.4 (latest on npm)
|
||||
- `graphology-operators`: ^0.5.2 → ^1.6.1 (latest on npm)
|
||||
- `yaml`: ^2.6.1 → ^2.8.3 (latest on npm)
|
||||
|
||||
## Summary
|
||||
|
||||
> To be filled on completion
|
||||
Initialized the @alkdev/taskgraph TypeScript ESM project from scratch.
|
||||
- Created: package.json, tsconfig.json, vitest.config.ts, .gitignore
|
||||
- Created: src/ directory skeleton (20 source files across 5 modules: schema, graph, analysis, frontmatter, error)
|
||||
- Created: test/ directory (5 placeholder test files: graph, analysis, schema, frontmatter, cost-benefit)
|
||||
- Modified: tasks/implementation/setup/project-init.md (status → completed)
|
||||
- Tests: 5 passing, npm install ✓, tsc --noEmit ✓
|
||||
7
test/analysis.test.ts
Normal file
7
test/analysis.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Analysis', () => {
|
||||
it('placeholder — critical path and risk analysis', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
7
test/cost-benefit.test.ts
Normal file
7
test/cost-benefit.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Cost-Benefit', () => {
|
||||
it('placeholder — EV and workflow cost calculations', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
7
test/frontmatter.test.ts
Normal file
7
test/frontmatter.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Frontmatter', () => {
|
||||
it('placeholder — parse and serialize', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
7
test/graph.test.ts
Normal file
7
test/graph.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('TaskGraph', () => {
|
||||
it('placeholder — construction and queries', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
7
test/schema.test.ts
Normal file
7
test/schema.test.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Schema', () => {
|
||||
it('placeholder — schema validation', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
});
|
||||
26
tsconfig.json
Normal file
26
tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2022"],
|
||||
"module": "Node16",
|
||||
"moduleResolution": "Node16",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"erasableSyntaxOnly": true
|
||||
},
|
||||
"include": ["src/**/*.ts"],
|
||||
"exclude": ["node_modules", "dist", "test"]
|
||||
}
|
||||
7
vitest.config.ts
Normal file
7
vitest.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user