@task-mcp/shared 1.0.6 → 1.0.7

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.
@@ -1,32 +1,32 @@
1
- import { type } from "arktype";
1
+ import { z } from "zod";
2
2
 
3
3
  // Inbox item status
4
- export const InboxStatus = type("'pending' | 'promoted' | 'discarded'");
5
- export type InboxStatus = typeof InboxStatus.infer;
4
+ export const InboxStatus = z.enum(["pending", "promoted", "discarded"]);
5
+ export type InboxStatus = z.infer<typeof InboxStatus>;
6
6
 
7
7
  // Inbox item schema - lightweight idea/memo capture
8
- export const InboxItem = type({
9
- id: "string",
10
- content: "string", // The memo/idea content
11
- capturedAt: "string", // ISO timestamp
12
- "source?": "string", // Origin: 'cli', 'mcp', 'api', etc.
13
- "tags?": "string[]", // Simple tags for organization
14
- "promotedToTaskId?": "string", // Task ID if promoted
8
+ export const InboxItem = z.object({
9
+ id: z.string(),
10
+ content: z.string(), // The memo/idea content
11
+ capturedAt: z.string(), // ISO timestamp
12
+ source: z.string().optional(), // Origin: 'cli', 'mcp', 'api', etc.
13
+ tags: z.array(z.string()).optional(), // Simple tags for organization
14
+ promotedToTaskId: z.string().optional(), // Task ID if promoted
15
15
  status: InboxStatus,
16
16
  });
17
- export type InboxItem = typeof InboxItem.infer;
17
+ export type InboxItem = z.infer<typeof InboxItem>;
18
18
 
19
19
  // Inbox item creation input (minimal)
20
- export const InboxCreateInput = type({
21
- content: "string",
22
- "source?": "string",
23
- "tags?": "string[]",
20
+ export const InboxCreateInput = z.object({
21
+ content: z.string(),
22
+ source: z.string().optional(),
23
+ tags: z.array(z.string()).optional(),
24
24
  });
25
- export type InboxCreateInput = typeof InboxCreateInput.infer;
25
+ export type InboxCreateInput = z.infer<typeof InboxCreateInput>;
26
26
 
27
27
  // Inbox item update input
28
- export const InboxUpdateInput = type({
29
- "content?": "string",
30
- "tags?": "string[]",
28
+ export const InboxUpdateInput = z.object({
29
+ content: z.string().optional(),
30
+ tags: z.array(z.string()).optional(),
31
31
  });
32
- export type InboxUpdateInput = typeof InboxUpdateInput.infer;
32
+ export type InboxUpdateInput = z.infer<typeof InboxUpdateInput>;
@@ -1,62 +1,65 @@
1
- import { type } from "arktype";
1
+ import { z } from "zod";
2
2
  import { Priority } from "./task.js";
3
3
 
4
4
  // Project status
5
- export const ProjectStatus = type(
6
- "'active' | 'on_hold' | 'completed' | 'archived'"
7
- );
8
- export type ProjectStatus = typeof ProjectStatus.infer;
5
+ export const ProjectStatus = z.enum([
6
+ "active",
7
+ "on_hold",
8
+ "completed",
9
+ "archived",
10
+ ]);
11
+ export type ProjectStatus = z.infer<typeof ProjectStatus>;
9
12
 
10
13
  // Context definition
11
- export const Context = type({
12
- name: "string",
13
- "color?": "string", // hex color
14
- "description?": "string",
14
+ export const Context = z.object({
15
+ name: z.string(),
16
+ color: z.string().optional(), // hex color
17
+ description: z.string().optional(),
15
18
  });
16
- export type Context = typeof Context.infer;
19
+ export type Context = z.infer<typeof Context>;
17
20
 
18
21
  // Project schema
19
- export const Project = type({
20
- id: "string",
21
- name: "string",
22
- "description?": "string",
22
+ export const Project = z.object({
23
+ id: z.string(),
24
+ name: z.string(),
25
+ description: z.string().optional(),
23
26
  status: ProjectStatus,
24
27
 
25
28
  // Project-level settings
26
- "defaultPriority?": Priority,
27
- "contexts?": Context.array(),
29
+ defaultPriority: Priority.optional(),
30
+ contexts: z.array(Context).optional(),
28
31
 
29
32
  // Metadata
30
- createdAt: "string",
31
- updatedAt: "string",
32
- "targetDate?": "string",
33
+ createdAt: z.string(),
34
+ updatedAt: z.string(),
35
+ targetDate: z.string().optional(),
33
36
 
34
37
  // Computed stats
35
- "completionPercentage?": "number",
36
- "criticalPathLength?": "number", // Total minutes on critical path
37
- "blockedTaskCount?": "number",
38
- "totalTasks?": "number",
39
- "completedTasks?": "number",
38
+ completionPercentage: z.number().optional(),
39
+ criticalPathLength: z.number().optional(), // Total minutes on critical path
40
+ blockedTaskCount: z.number().optional(),
41
+ totalTasks: z.number().optional(),
42
+ completedTasks: z.number().optional(),
40
43
  });
41
- export type Project = typeof Project.infer;
44
+ export type Project = z.infer<typeof Project>;
42
45
 
43
46
  // Project creation input
44
- export const ProjectCreateInput = type({
45
- name: "string",
46
- "description?": "string",
47
- "defaultPriority?": Priority,
48
- "contexts?": Context.array(),
49
- "targetDate?": "string",
47
+ export const ProjectCreateInput = z.object({
48
+ name: z.string(),
49
+ description: z.string().optional(),
50
+ defaultPriority: Priority.optional(),
51
+ contexts: z.array(Context).optional(),
52
+ targetDate: z.string().optional(),
50
53
  });
51
- export type ProjectCreateInput = typeof ProjectCreateInput.infer;
54
+ export type ProjectCreateInput = z.infer<typeof ProjectCreateInput>;
52
55
 
53
56
  // Project update input
54
- export const ProjectUpdateInput = type({
55
- "name?": "string",
56
- "description?": "string",
57
- "status?": ProjectStatus,
58
- "defaultPriority?": Priority,
59
- "contexts?": Context.array(),
60
- "targetDate?": "string",
57
+ export const ProjectUpdateInput = z.object({
58
+ name: z.string().optional(),
59
+ description: z.string().optional(),
60
+ status: ProjectStatus.optional(),
61
+ defaultPriority: Priority.optional(),
62
+ contexts: z.array(Context).optional(),
63
+ targetDate: z.string().optional(),
61
64
  });
62
- export type ProjectUpdateInput = typeof ProjectUpdateInput.infer;
65
+ export type ProjectUpdateInput = z.infer<typeof ProjectUpdateInput>;
@@ -1,4 +1,4 @@
1
- import { type } from "arktype";
1
+ import { z } from "zod";
2
2
 
3
3
  /**
4
4
  * Response Format Schema
@@ -12,8 +12,8 @@ import { type } from "arktype";
12
12
  */
13
13
 
14
14
  // Response format options
15
- export const ResponseFormat = type("'concise' | 'standard' | 'detailed'");
16
- export type ResponseFormat = typeof ResponseFormat.infer;
15
+ export const ResponseFormat = z.enum(["concise", "standard", "detailed"]);
16
+ export type ResponseFormat = z.infer<typeof ResponseFormat>;
17
17
 
18
18
  // Default limits for pagination
19
19
  export const DEFAULT_LIMIT = 20;
@@ -1,166 +1,184 @@
1
- import { type } from "arktype";
1
+ import { z } from "zod";
2
2
 
3
3
  // Priority levels
4
- export const Priority = type("'critical' | 'high' | 'medium' | 'low'");
5
- export type Priority = typeof Priority.infer;
4
+ export const Priority = z.enum(["critical", "high", "medium", "low"]);
5
+ export type Priority = z.infer<typeof Priority>;
6
6
 
7
7
  // Task status with clear state machine
8
- export const TaskStatus = type(
9
- "'pending' | 'in_progress' | 'blocked' | 'completed' | 'cancelled'"
10
- );
11
- export type TaskStatus = typeof TaskStatus.infer;
8
+ export const TaskStatus = z.enum([
9
+ "pending",
10
+ "in_progress",
11
+ "blocked",
12
+ "completed",
13
+ "cancelled",
14
+ ]);
15
+ export type TaskStatus = z.infer<typeof TaskStatus>;
12
16
 
13
17
  // Dependency relationship types
14
- export const DependencyType = type(
15
- "'blocks' | 'blocked_by' | 'related'"
16
- );
17
- export type DependencyType = typeof DependencyType.infer;
18
+ export const DependencyType = z.enum(["blocks", "blocked_by", "related"]);
19
+ export type DependencyType = z.infer<typeof DependencyType>;
18
20
 
19
21
  // A single dependency link
20
- export const Dependency = type({
21
- taskId: "string",
22
+ export const Dependency = z.object({
23
+ taskId: z.string(),
22
24
  type: DependencyType,
23
- "reason?": "string",
25
+ reason: z.string().optional(),
24
26
  });
25
- export type Dependency = typeof Dependency.infer;
27
+ export type Dependency = z.infer<typeof Dependency>;
26
28
 
27
29
  // Time estimation
28
- export const TimeEstimate = type({
29
- "optimistic?": "number", // minutes
30
- "expected?": "number", // minutes
31
- "pessimistic?": "number", // minutes
32
- "confidence?": "'low' | 'medium' | 'high'",
30
+ export const TimeEstimate = z.object({
31
+ optimistic: z.number().optional(), // minutes
32
+ expected: z.number().optional(), // minutes
33
+ pessimistic: z.number().optional(), // minutes
34
+ confidence: z.enum(["low", "medium", "high"]).optional(),
33
35
  });
34
- export type TimeEstimate = typeof TimeEstimate.infer;
36
+ export type TimeEstimate = z.infer<typeof TimeEstimate>;
35
37
 
36
38
  // Recurrence pattern
37
- export const Recurrence = type({
38
- pattern: "'daily' | 'weekly' | 'monthly' | 'after_completion'",
39
- "interval?": "number", // every N days/weeks/months
40
- "daysOfWeek?": "number[]", // 0-6 for weekly
41
- "endDate?": "string",
39
+ export const Recurrence = z.object({
40
+ pattern: z.enum(["daily", "weekly", "monthly", "after_completion"]),
41
+ interval: z.number().optional(), // every N days/weeks/months
42
+ daysOfWeek: z.array(z.number()).optional(), // 0-6 for weekly
43
+ endDate: z.string().optional(),
42
44
  });
43
- export type Recurrence = typeof Recurrence.infer;
45
+ export type Recurrence = z.infer<typeof Recurrence>;
44
46
 
45
47
  // Complexity factors that contribute to task difficulty
46
- export const ComplexityFactor = type(
47
- "'cross_cutting' | 'state_management' | 'error_handling' | 'performance' | 'security' | 'external_dependency' | 'data_migration' | 'breaking_change' | 'unclear_requirements' | 'coordination'"
48
- );
49
- export type ComplexityFactor = typeof ComplexityFactor.infer;
48
+ export const ComplexityFactor = z.enum([
49
+ "cross_cutting",
50
+ "state_management",
51
+ "error_handling",
52
+ "performance",
53
+ "security",
54
+ "external_dependency",
55
+ "data_migration",
56
+ "breaking_change",
57
+ "unclear_requirements",
58
+ "coordination",
59
+ ]);
60
+ export type ComplexityFactor = z.infer<typeof ComplexityFactor>;
50
61
 
51
62
  // Complexity analysis result (populated by Claude)
52
- export const ComplexityAnalysis = type({
53
- "score?": "number", // 1-10 complexity score
54
- "factors?": ComplexityFactor.array(),
55
- "suggestedSubtasks?": "number", // 0-10 recommended subtask count
56
- "rationale?": "string",
57
- "analyzedAt?": "string",
63
+ export const ComplexityAnalysis = z.object({
64
+ score: z.number().optional(), // 1-10 complexity score
65
+ factors: z.array(ComplexityFactor).optional(),
66
+ suggestedSubtasks: z.number().optional(), // 0-10 recommended subtask count
67
+ rationale: z.string().optional(),
68
+ analyzedAt: z.string().optional(),
58
69
  });
59
- export type ComplexityAnalysis = typeof ComplexityAnalysis.infer;
70
+ export type ComplexityAnalysis = z.infer<typeof ComplexityAnalysis>;
60
71
 
61
72
  // Tech area categories for ordering
62
- export const TechArea = type(
63
- "'schema' | 'backend' | 'frontend' | 'infra' | 'devops' | 'test' | 'docs' | 'refactor'"
64
- );
65
- export type TechArea = typeof TechArea.infer;
73
+ export const TechArea = z.enum([
74
+ "schema",
75
+ "backend",
76
+ "frontend",
77
+ "infra",
78
+ "devops",
79
+ "test",
80
+ "docs",
81
+ "refactor",
82
+ ]);
83
+ export type TechArea = z.infer<typeof TechArea>;
66
84
 
67
85
  // Risk level for changes
68
- export const RiskLevel = type("'low' | 'medium' | 'high' | 'critical'");
69
- export type RiskLevel = typeof RiskLevel.infer;
86
+ export const RiskLevel = z.enum(["low", "medium", "high", "critical"]);
87
+ export type RiskLevel = z.infer<typeof RiskLevel>;
70
88
 
71
89
  // Tech stack analysis result (populated by Claude)
72
- export const TechStackAnalysis = type({
73
- "areas?": TechArea.array(),
74
- "hasBreakingChange?": "boolean",
75
- "riskLevel?": RiskLevel,
76
- "affectedComponents?": "string[]",
77
- "rationale?": "string",
78
- "analyzedAt?": "string",
90
+ export const TechStackAnalysis = z.object({
91
+ areas: z.array(TechArea).optional(),
92
+ hasBreakingChange: z.boolean().optional(),
93
+ riskLevel: RiskLevel.optional(),
94
+ affectedComponents: z.array(z.string()).optional(),
95
+ rationale: z.string().optional(),
96
+ analyzedAt: z.string().optional(),
79
97
  });
80
- export type TechStackAnalysis = typeof TechStackAnalysis.infer;
98
+ export type TechStackAnalysis = z.infer<typeof TechStackAnalysis>;
81
99
 
82
100
  // Core Task schema
83
- export const Task = type({
84
- id: "string",
85
- title: "string",
86
- "description?": "string",
101
+ export const Task = z.object({
102
+ id: z.string(),
103
+ title: z.string(),
104
+ description: z.string().optional(),
87
105
  status: TaskStatus,
88
106
  priority: Priority,
89
- projectId: "string",
107
+ projectId: z.string(),
90
108
 
91
109
  // Hierarchy (subtask support)
92
- "parentId?": "string", // Parent task ID for subtasks
93
- "level?": "number", // Hierarchy depth (0=root, 1=subtask, 2=sub-subtask, max 3)
110
+ parentId: z.string().nullable().optional(), // Parent task ID for subtasks (null to unlink)
111
+ level: z.number().optional(), // Hierarchy depth (0=root, 1=subtask, 2=sub-subtask, max 3)
94
112
 
95
113
  // Dependencies
96
- "dependencies?": Dependency.array(),
114
+ dependencies: z.array(Dependency).optional(),
97
115
 
98
116
  // Time tracking
99
- "estimate?": TimeEstimate,
100
- "actualMinutes?": "number",
101
- "dueDate?": "string", // ISO date string
102
- "startDate?": "string", // When task can start
103
- "startedAt?": "string",
104
- "completedAt?": "string",
117
+ estimate: TimeEstimate.optional(),
118
+ actualMinutes: z.number().optional(),
119
+ dueDate: z.string().optional(), // ISO date string
120
+ startDate: z.string().optional(), // When task can start
121
+ startedAt: z.string().optional(),
122
+ completedAt: z.string().optional(),
105
123
 
106
124
  // Organization
107
- "contexts?": "string[]", // e.g., ["focus", "review"]
108
- "tags?": "string[]",
125
+ contexts: z.array(z.string()).optional(), // e.g., ["focus", "review"]
126
+ tags: z.array(z.string()).optional(),
109
127
 
110
128
  // Recurrence
111
- "recurrence?": Recurrence,
129
+ recurrence: Recurrence.optional(),
112
130
 
113
131
  // Metadata
114
- createdAt: "string",
115
- updatedAt: "string",
132
+ createdAt: z.string(),
133
+ updatedAt: z.string(),
116
134
 
117
135
  // Computed fields (populated at runtime)
118
- "criticalPath?": "boolean",
119
- "slack?": "number", // Minutes of slack time
120
- "earliestStart?": "number", // Minutes from project start
121
- "latestStart?": "number",
136
+ criticalPath: z.boolean().optional(),
137
+ slack: z.number().optional(), // Minutes of slack time
138
+ earliestStart: z.number().optional(), // Minutes from project start
139
+ latestStart: z.number().optional(),
122
140
 
123
141
  // Analysis fields (populated by Claude)
124
- "complexity?": ComplexityAnalysis,
125
- "techStack?": TechStackAnalysis,
142
+ complexity: ComplexityAnalysis.optional(),
143
+ techStack: TechStackAnalysis.optional(),
126
144
  });
127
- export type Task = typeof Task.infer;
145
+ export type Task = z.infer<typeof Task>;
128
146
 
129
147
  // Task creation input (minimal required fields)
130
- export const TaskCreateInput = type({
131
- title: "string",
132
- "description?": "string",
133
- "projectId?": "string",
134
- "priority?": Priority,
135
- "parentId?": "string", // Parent task ID for creating subtasks
136
- "dependencies?": Dependency.array(),
137
- "estimate?": TimeEstimate,
138
- "dueDate?": "string",
139
- "startDate?": "string",
140
- "contexts?": "string[]",
141
- "tags?": "string[]",
142
- "recurrence?": Recurrence,
148
+ export const TaskCreateInput = z.object({
149
+ title: z.string(),
150
+ description: z.string().optional(),
151
+ projectId: z.string().optional(),
152
+ priority: Priority.optional(),
153
+ parentId: z.string().nullable().optional(), // Parent task ID for creating subtasks (null to unlink)
154
+ dependencies: z.array(Dependency).optional(),
155
+ estimate: TimeEstimate.optional(),
156
+ dueDate: z.string().optional(),
157
+ startDate: z.string().optional(),
158
+ contexts: z.array(z.string()).optional(),
159
+ tags: z.array(z.string()).optional(),
160
+ recurrence: Recurrence.optional(),
143
161
  });
144
- export type TaskCreateInput = typeof TaskCreateInput.infer;
162
+ export type TaskCreateInput = z.infer<typeof TaskCreateInput>;
145
163
 
146
164
  // Task update input
147
- export const TaskUpdateInput = type({
148
- "title?": "string",
149
- "description?": "string",
150
- "status?": TaskStatus,
151
- "priority?": Priority,
152
- "projectId?": "string",
153
- "parentId?": "string", // Parent task ID for moving task in hierarchy
154
- "dependencies?": Dependency.array(),
155
- "estimate?": TimeEstimate,
156
- "actualMinutes?": "number",
157
- "dueDate?": "string",
158
- "startDate?": "string",
159
- "contexts?": "string[]",
160
- "tags?": "string[]",
161
- "recurrence?": Recurrence,
165
+ export const TaskUpdateInput = z.object({
166
+ title: z.string().optional(),
167
+ description: z.string().optional(),
168
+ status: TaskStatus.optional(),
169
+ priority: Priority.optional(),
170
+ projectId: z.string().optional(),
171
+ parentId: z.string().nullable().optional(), // Parent task ID for moving task in hierarchy (null to unlink)
172
+ dependencies: z.array(Dependency).optional(),
173
+ estimate: TimeEstimate.optional(),
174
+ actualMinutes: z.number().optional(),
175
+ dueDate: z.string().optional(),
176
+ startDate: z.string().optional(),
177
+ contexts: z.array(z.string()).optional(),
178
+ tags: z.array(z.string()).optional(),
179
+ recurrence: Recurrence.optional(),
162
180
  // Analysis fields
163
- "complexity?": ComplexityAnalysis,
164
- "techStack?": TechStackAnalysis,
181
+ complexity: ComplexityAnalysis.optional(),
182
+ techStack: TechStackAnalysis.optional(),
165
183
  });
166
- export type TaskUpdateInput = typeof TaskUpdateInput.infer;
184
+ export type TaskUpdateInput = z.infer<typeof TaskUpdateInput>;
@@ -1,46 +1,56 @@
1
- import { type } from "arktype";
1
+ import { z } from "zod";
2
2
  import { Priority, TaskStatus } from "./task.js";
3
3
 
4
4
  // Smart View filter
5
- export const SmartViewFilter = type({
6
- "statuses?": TaskStatus.array(),
7
- "priorities?": Priority.array(),
8
- "contexts?": "string[]",
9
- "tags?": "string[]",
10
- "projectIds?": "string[]",
11
- "dueBefore?": "string",
12
- "dueAfter?": "string",
13
- "isBlocked?": "boolean",
14
- "isCriticalPath?": "boolean",
15
- "hasNoDependencies?": "boolean",
16
- "search?": "string", // Search in title/description
5
+ export const SmartViewFilter = z.object({
6
+ statuses: z.array(TaskStatus).optional(),
7
+ priorities: z.array(Priority).optional(),
8
+ contexts: z.array(z.string()).optional(),
9
+ tags: z.array(z.string()).optional(),
10
+ projectIds: z.array(z.string()).optional(),
11
+ dueBefore: z.string().optional(),
12
+ dueAfter: z.string().optional(),
13
+ isBlocked: z.boolean().optional(),
14
+ isCriticalPath: z.boolean().optional(),
15
+ hasNoDependencies: z.boolean().optional(),
16
+ search: z.string().optional(), // Search in title/description
17
17
  });
18
- export type SmartViewFilter = typeof SmartViewFilter.infer;
18
+ export type SmartViewFilter = z.infer<typeof SmartViewFilter>;
19
19
 
20
20
  // Sort options
21
- export const SortField = type(
22
- "'priority' | 'dueDate' | 'createdAt' | 'criticalPath' | 'slack' | 'title'"
23
- );
24
- export type SortField = typeof SortField.infer;
21
+ export const SortField = z.enum([
22
+ "priority",
23
+ "dueDate",
24
+ "createdAt",
25
+ "criticalPath",
26
+ "slack",
27
+ "title",
28
+ ]);
29
+ export type SortField = z.infer<typeof SortField>;
25
30
 
26
- export const SortOrder = type("'asc' | 'desc'");
27
- export type SortOrder = typeof SortOrder.infer;
31
+ export const SortOrder = z.enum(["asc", "desc"]);
32
+ export type SortOrder = z.infer<typeof SortOrder>;
28
33
 
29
34
  // Smart View definition
30
- export const SmartView = type({
31
- id: "string",
32
- name: "string",
33
- "description?": "string",
35
+ export const SmartView = z.object({
36
+ id: z.string(),
37
+ name: z.string(),
38
+ description: z.string().optional(),
34
39
  filter: SmartViewFilter,
35
- "sortBy?": SortField,
36
- "sortOrder?": SortOrder,
37
- createdAt: "string",
38
- updatedAt: "string",
40
+ sortBy: SortField.optional(),
41
+ sortOrder: SortOrder.optional(),
42
+ createdAt: z.string(),
43
+ updatedAt: z.string(),
39
44
  });
40
- export type SmartView = typeof SmartView.infer;
45
+ export type SmartView = z.infer<typeof SmartView>;
41
46
 
42
47
  // Built-in view names
43
- export const BuiltInView = type(
44
- "'today' | 'this_week' | 'blocked' | 'critical_path' | 'quick_wins' | 'all'"
45
- );
46
- export type BuiltInView = typeof BuiltInView.infer;
48
+ export const BuiltInView = z.enum([
49
+ "today",
50
+ "this_week",
51
+ "blocked",
52
+ "critical_path",
53
+ "quick_wins",
54
+ "all",
55
+ ]);
56
+ export type BuiltInView = z.infer<typeof BuiltInView>;