@task-mcp/shared 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -108
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @task-mcp/shared
|
|
2
2
|
|
|
3
|
-
Core algorithms
|
|
3
|
+
Core algorithms and schemas for task-mcp. Zero MCP dependency, can be used standalone.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,114 +8,11 @@ Core algorithms, schemas, and utilities for task-mcp. Zero MCP dependency - can
|
|
|
8
8
|
npm install @task-mcp/shared
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| Module | Description |
|
|
18
|
-
|--------|-------------|
|
|
19
|
-
| `critical-path` | CPM (Critical Path Method) - finds longest path, parallel tasks, bottlenecks |
|
|
20
|
-
| `topological-sort` | Kahn's algorithm for dependency ordering with cycle detection |
|
|
21
|
-
| `dependency-integrity` | Validates dependency graph integrity (cycles, orphans, self-refs) |
|
|
22
|
-
| `tech-analysis` | Analyzes tasks for technology stack patterns |
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import {
|
|
26
|
-
findCriticalPath,
|
|
27
|
-
findParallelTasks,
|
|
28
|
-
detectBottlenecks,
|
|
29
|
-
topologicalSort,
|
|
30
|
-
validateDependencies
|
|
31
|
-
} from "@task-mcp/shared";
|
|
32
|
-
|
|
33
|
-
// Find critical path through task graph
|
|
34
|
-
const { criticalPath, totalDuration } = findCriticalPath(tasks);
|
|
35
|
-
|
|
36
|
-
// Find tasks that can run in parallel
|
|
37
|
-
const parallelGroups = findParallelTasks(tasks);
|
|
38
|
-
|
|
39
|
-
// Topological sort with cycle detection
|
|
40
|
-
const { sorted, hasCycle } = topologicalSort(tasks);
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Schemas
|
|
44
|
-
|
|
45
|
-
Zod schemas for validation and type inference.
|
|
46
|
-
|
|
47
|
-
| Schema | Description |
|
|
48
|
-
|--------|-------------|
|
|
49
|
-
| `Task` | Task with status, priority, dependencies, hierarchy |
|
|
50
|
-
| `InboxItem` | Quick capture items pending triage |
|
|
51
|
-
| `ResponseFormat` | `concise` / `standard` / `detailed` output modes |
|
|
52
|
-
| `View` | Filtered task views (today, blocked, quick-wins) |
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { TaskSchema, Task, Priority, Status } from "@task-mcp/shared";
|
|
56
|
-
|
|
57
|
-
// Validate and parse
|
|
58
|
-
const task = TaskSchema.parse(rawData);
|
|
59
|
-
|
|
60
|
-
// Type inference
|
|
61
|
-
type Task = z.infer<typeof TaskSchema>;
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Utilities
|
|
65
|
-
|
|
66
|
-
| Utility | Description |
|
|
67
|
-
|---------|-------------|
|
|
68
|
-
| `natural-language` | Parse "task !high @context #tag due:tomorrow" syntax |
|
|
69
|
-
| `workspace` | Auto-detect workspace from git repository name |
|
|
70
|
-
| `projection` | Format tasks to concise/standard/detailed (70-88% token savings) |
|
|
71
|
-
| `hierarchy` | Build parent-child tree, find descendants/ancestors |
|
|
72
|
-
| `date` | Parse relative dates ("tomorrow", "next week", "in 3 days") |
|
|
73
|
-
| `id` | Generate collision-resistant IDs (`task_xxxx`, `inbox_xxxx`) |
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import {
|
|
77
|
-
parseNaturalLanguage,
|
|
78
|
-
detectWorkspace,
|
|
79
|
-
formatTask,
|
|
80
|
-
buildHierarchy
|
|
81
|
-
} from "@task-mcp/shared";
|
|
82
|
-
|
|
83
|
-
// Parse natural language input
|
|
84
|
-
const parsed = parseNaturalLanguage("Review PR !high @work #urgent due:tomorrow");
|
|
85
|
-
// { title: "Review PR", priority: "high", contexts: ["work"], tags: ["urgent"], dueDate: "2024-01-02" }
|
|
86
|
-
|
|
87
|
-
// Detect workspace from git
|
|
88
|
-
const workspace = await detectWorkspace(); // "task-mcp"
|
|
89
|
-
|
|
90
|
-
// Format for token efficiency
|
|
91
|
-
const concise = formatTask(task, "concise");
|
|
92
|
-
// { id, title, status, priority } - minimal fields
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Architecture
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
shared/
|
|
99
|
-
├── algorithms/ # Graph algorithms (no external deps)
|
|
100
|
-
│ ├── critical-path.ts
|
|
101
|
-
│ ├── topological-sort.ts
|
|
102
|
-
│ └── dependency-integrity.ts
|
|
103
|
-
├── schemas/ # Zod schemas + type exports
|
|
104
|
-
│ ├── task.ts
|
|
105
|
-
│ ├── inbox.ts
|
|
106
|
-
│ └── response-format.ts
|
|
107
|
-
└── utils/ # Pure utility functions
|
|
108
|
-
├── natural-language.ts
|
|
109
|
-
├── workspace.ts
|
|
110
|
-
└── projection.ts
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Design Principles
|
|
114
|
-
|
|
115
|
-
1. **Zero MCP dependency** - Can be used in any TypeScript project
|
|
116
|
-
2. **Zod-first validation** - Runtime safety with static types
|
|
117
|
-
3. **Algorithm efficiency** - O(n+e) graph operations
|
|
118
|
-
4. **Token optimization** - Projection system reduces LLM token usage by 70-88%
|
|
13
|
+
- **Algorithms** - Critical path, topological sort, bottleneck detection
|
|
14
|
+
- **Schemas** - Zod schemas for Task, Inbox, View
|
|
15
|
+
- **Utilities** - Natural language parsing, workspace detection
|
|
119
16
|
|
|
120
17
|
## License
|
|
121
18
|
|