@allpepper/task-orchestrator-tui 1.2.1 → 2.0.0

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.
@@ -3,15 +3,18 @@
3
3
  *
4
4
  * Defines how the UI layer accesses data from the domain layer.
5
5
  * Implementations can be in-memory, HTTP-based, or other transport mechanisms.
6
+ *
7
+ * v2 changes:
8
+ * - Projects are stateless (no status field)
9
+ * - Status transitions via advance/revert/terminate instead of setStatus
10
+ * - Blocking is field-based (blockedBy/blockedReason), not a status
11
+ * - Dependencies are JSON fields on entities, not a separate table
6
12
  */
7
13
 
8
14
  import type {
9
15
  Task,
10
16
  Feature,
11
17
  Project,
12
- TaskStatus,
13
- ProjectStatus,
14
- FeatureStatus,
15
18
  Section,
16
19
  EntityType,
17
20
  Priority,
@@ -36,7 +39,7 @@ export type Result<T> =
36
39
  */
37
40
  export interface SearchParams {
38
41
  query?: string;
39
- status?: TaskStatus;
42
+ status?: string;
40
43
  tags?: string[];
41
44
  limit?: number;
42
45
  offset?: number;
@@ -57,6 +60,33 @@ export interface TaskSearchParams extends FeatureSearchParams {
57
60
  featureId?: string;
58
61
  }
59
62
 
63
+ /**
64
+ * Workflow state for a task or feature
65
+ */
66
+ export interface WorkflowState {
67
+ containerType: string;
68
+ id: string;
69
+ currentStatus: string;
70
+ nextStatus: string | null;
71
+ prevStatus: string | null;
72
+ isTerminal: boolean;
73
+ isBlocked: boolean;
74
+ blockedBy: string[];
75
+ blockedReason: string | null;
76
+ pipelinePosition: string | null;
77
+ relatedEntities: string[];
78
+ }
79
+
80
+ /**
81
+ * Result from advance/revert operations
82
+ */
83
+ export interface TransitionResult {
84
+ entity: Task | Feature;
85
+ oldStatus: string;
86
+ newStatus: string;
87
+ pipelinePosition: string | null;
88
+ }
89
+
60
90
  /**
61
91
  * Data Adapter Interface
62
92
  *
@@ -64,29 +94,17 @@ export interface TaskSearchParams extends FeatureSearchParams {
64
94
  */
65
95
  export interface DataAdapter {
66
96
  // ============================================================================
67
- // Projects
97
+ // Projects (stateless in v2 - no status field)
68
98
  // ============================================================================
69
99
 
70
- /**
71
- * Get all projects matching the search parameters
72
- */
73
100
  getProjects(params?: SearchParams): Promise<Result<Project[]>>;
74
-
75
- /**
76
- * Get a single project by ID
77
- */
78
101
  getProject(id: string): Promise<Result<Project>>;
79
-
80
- /**
81
- * Get project overview with aggregated statistics
82
- */
83
102
  getProjectOverview(id: string): Promise<Result<ProjectOverview>>;
84
103
 
85
104
  createProject(params: {
86
105
  name: string;
87
106
  summary: string;
88
107
  description?: string;
89
- status?: ProjectStatus;
90
108
  tags?: string[];
91
109
  }): Promise<Result<Project>>;
92
110
 
@@ -96,7 +114,6 @@ export interface DataAdapter {
96
114
  name?: string;
97
115
  summary?: string;
98
116
  description?: string;
99
- status?: ProjectStatus;
100
117
  tags?: string[];
101
118
  version: number;
102
119
  }
@@ -108,19 +125,8 @@ export interface DataAdapter {
108
125
  // Features
109
126
  // ============================================================================
110
127
 
111
- /**
112
- * Get all features matching the search parameters
113
- */
114
128
  getFeatures(params?: FeatureSearchParams): Promise<Result<Feature[]>>;
115
-
116
- /**
117
- * Get a single feature by ID
118
- */
119
129
  getFeature(id: string): Promise<Result<Feature>>;
120
-
121
- /**
122
- * Get feature overview with aggregated statistics
123
- */
124
130
  getFeatureOverview(id: string): Promise<Result<FeatureOverview>>;
125
131
 
126
132
  createFeature(params: {
@@ -128,7 +134,6 @@ export interface DataAdapter {
128
134
  name: string;
129
135
  summary: string;
130
136
  description?: string;
131
- status?: FeatureStatus;
132
137
  priority: Priority;
133
138
  tags?: string[];
134
139
  }): Promise<Result<Feature>>;
@@ -139,7 +144,6 @@ export interface DataAdapter {
139
144
  name?: string;
140
145
  summary?: string;
141
146
  description?: string;
142
- status?: FeatureStatus;
143
147
  priority?: Priority;
144
148
  projectId?: string;
145
149
  tags?: string[];
@@ -153,14 +157,7 @@ export interface DataAdapter {
153
157
  // Tasks
154
158
  // ============================================================================
155
159
 
156
- /**
157
- * Get all tasks matching the search parameters
158
- */
159
160
  getTasks(params?: TaskSearchParams): Promise<Result<Task[]>>;
160
-
161
- /**
162
- * Get a single task by ID
163
- */
164
161
  getTask(id: string): Promise<Result<Task>>;
165
162
 
166
163
  createTask(params: {
@@ -168,7 +165,6 @@ export interface DataAdapter {
168
165
  title: string;
169
166
  summary: string;
170
167
  description?: string;
171
- status?: TaskStatus;
172
168
  priority: Priority;
173
169
  complexity: number;
174
170
  tags?: string[];
@@ -180,7 +176,6 @@ export interface DataAdapter {
180
176
  title?: string;
181
177
  summary?: string;
182
178
  description?: string;
183
- status?: TaskStatus;
184
179
  priority?: Priority;
185
180
  complexity?: number;
186
181
  projectId?: string;
@@ -193,76 +188,84 @@ export interface DataAdapter {
193
188
 
194
189
  deleteTask(id: string): Promise<Result<boolean>>;
195
190
 
191
+ // ============================================================================
192
+ // Pipeline Operations (v2 - replaces setStatus)
193
+ // ============================================================================
194
+
196
195
  /**
197
- * Update a task's status with optimistic concurrency control
196
+ * Advance a task or feature one step forward in its pipeline
198
197
  */
199
- setTaskStatus(
198
+ advance(
199
+ containerType: 'task' | 'feature',
200
200
  id: string,
201
- status: TaskStatus,
202
201
  version: number
203
- ): Promise<Result<Task>>;
202
+ ): Promise<Result<TransitionResult>>;
204
203
 
205
- setProjectStatus(
204
+ /**
205
+ * Revert a task or feature one step backward in its pipeline
206
+ */
207
+ revert(
208
+ containerType: 'task' | 'feature',
206
209
  id: string,
207
- status: ProjectStatus,
208
210
  version: number
209
- ): Promise<Result<Project>>;
211
+ ): Promise<Result<TransitionResult>>;
210
212
 
211
- setFeatureStatus(
213
+ /**
214
+ * Terminate a task or feature (set to WILL_NOT_IMPLEMENT)
215
+ */
216
+ terminate(
217
+ containerType: 'task' | 'feature',
212
218
  id: string,
213
- status: FeatureStatus,
214
219
  version: number
215
- ): Promise<Result<Feature>>;
220
+ ): Promise<Result<TransitionResult>>;
221
+
222
+ /**
223
+ * Get workflow state for a task or feature
224
+ */
225
+ getWorkflowState(
226
+ containerType: 'task' | 'feature',
227
+ id: string
228
+ ): Promise<Result<WorkflowState>>;
229
+
230
+ /**
231
+ * Get allowed status transitions for a given container type and current status
232
+ */
233
+ getAllowedTransitions(
234
+ containerType: string,
235
+ status: string
236
+ ): Promise<Result<string[]>>;
216
237
 
217
238
  // ============================================================================
218
239
  // Sections
219
240
  // ============================================================================
220
241
 
221
- /**
222
- * Get all sections for a given entity (project, feature, or task)
223
- */
224
242
  getSections(
225
243
  entityType: EntityType,
226
244
  entityId: string
227
245
  ): Promise<Result<Section[]>>;
228
246
 
229
247
  // ============================================================================
230
- // Dependencies
248
+ // Dependencies (field-based in v2)
231
249
  // ============================================================================
232
250
 
233
251
  /**
234
- * Get dependency information for a task (blockers and blocked tasks)
252
+ * Get dependency information for a task (from blockedBy/relatedTo fields)
235
253
  */
236
254
  getDependencies(taskId: string): Promise<Result<DependencyInfo>>;
237
255
 
238
256
  /**
239
- * Get all blocked tasks, optionally filtered by project
257
+ * Get all blocked tasks (tasks with non-empty blockedBy)
240
258
  */
241
259
  getBlockedTasks(params?: { projectId?: string }): Promise<Result<Task[]>>;
242
260
 
243
261
  /**
244
- * Get the next actionable task (no blockers, not completed)
262
+ * Get the next actionable task (NEW, not blocked)
245
263
  */
246
264
  getNextTask(params?: { projectId?: string }): Promise<Result<Task | null>>;
247
265
 
248
- // ============================================================================
249
- // Workflow
250
- // ============================================================================
251
-
252
- /**
253
- * Get allowed status transitions for a given container type and current status
254
- */
255
- getAllowedTransitions(
256
- containerType: string,
257
- status: string
258
- ): Promise<Result<string[]>>;
259
-
260
266
  // ============================================================================
261
267
  // Search
262
268
  // ============================================================================
263
269
 
264
- /**
265
- * Full-text search across all entities
266
- */
267
270
  search(query: string): Promise<Result<SearchResults>>;
268
271
  }