@kitsy/coop-core 0.0.1
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/LICENSE +22 -0
- package/README.md +7 -0
- package/dist/index.cjs +2097 -0
- package/dist/index.d.cts +670 -0
- package/dist/index.d.ts +670 -0
- package/dist/index.js +1998 -0
- package/package.json +56 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
declare const ITEM_TYPES: readonly ["epic", "story", "task", "bug", "spike"];
|
|
2
|
+
type ItemType = (typeof ITEM_TYPES)[number];
|
|
3
|
+
declare const ITEM_STATUSES: readonly ["todo", "in_progress", "blocked", "done"];
|
|
4
|
+
type ItemStatus = (typeof ITEM_STATUSES)[number];
|
|
5
|
+
interface ItemLinks {
|
|
6
|
+
github_issue?: string;
|
|
7
|
+
github_pr?: string;
|
|
8
|
+
}
|
|
9
|
+
interface AgentSpec {
|
|
10
|
+
goal?: string;
|
|
11
|
+
context_paths?: string[];
|
|
12
|
+
commands?: {
|
|
13
|
+
build?: string;
|
|
14
|
+
test?: string;
|
|
15
|
+
lint?: string;
|
|
16
|
+
[key: string]: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
constraints?: string[];
|
|
19
|
+
risks?: string[];
|
|
20
|
+
prompt_hints?: string[];
|
|
21
|
+
}
|
|
22
|
+
interface BacklogItemData {
|
|
23
|
+
id: string;
|
|
24
|
+
type: ItemType;
|
|
25
|
+
title: string;
|
|
26
|
+
status: ItemStatus;
|
|
27
|
+
created: string;
|
|
28
|
+
updated: string;
|
|
29
|
+
priority?: string;
|
|
30
|
+
points?: number;
|
|
31
|
+
owner?: string;
|
|
32
|
+
labels?: string[];
|
|
33
|
+
links?: ItemLinks;
|
|
34
|
+
depends_on?: string[];
|
|
35
|
+
acceptance?: string[];
|
|
36
|
+
agent?: AgentSpec;
|
|
37
|
+
parent_id?: string;
|
|
38
|
+
}
|
|
39
|
+
interface BacklogItem extends BacklogItemData {
|
|
40
|
+
body: string;
|
|
41
|
+
filePath: string;
|
|
42
|
+
}
|
|
43
|
+
interface RepoConfig {
|
|
44
|
+
spec_version: number;
|
|
45
|
+
id_prefix: string;
|
|
46
|
+
id_strategy?: "text" | "counter";
|
|
47
|
+
next_id?: number;
|
|
48
|
+
}
|
|
49
|
+
interface RepoState {
|
|
50
|
+
rootDir: string;
|
|
51
|
+
workspaceDir: ".coop";
|
|
52
|
+
config: RepoConfig;
|
|
53
|
+
items: BacklogItem[];
|
|
54
|
+
itemsById: Map<string, BacklogItem>;
|
|
55
|
+
}
|
|
56
|
+
interface CreateItemParams {
|
|
57
|
+
id?: string;
|
|
58
|
+
type: ItemType;
|
|
59
|
+
title: string;
|
|
60
|
+
status?: ItemStatus;
|
|
61
|
+
priority?: string;
|
|
62
|
+
points?: number;
|
|
63
|
+
owner?: string;
|
|
64
|
+
labels?: string[];
|
|
65
|
+
links?: ItemLinks;
|
|
66
|
+
depends_on?: string[];
|
|
67
|
+
acceptance?: string[];
|
|
68
|
+
agent?: AgentSpec;
|
|
69
|
+
parent_id?: string;
|
|
70
|
+
body?: string;
|
|
71
|
+
}
|
|
72
|
+
interface UpdateItemParams {
|
|
73
|
+
title?: string;
|
|
74
|
+
status?: ItemStatus;
|
|
75
|
+
type?: ItemType;
|
|
76
|
+
priority?: string;
|
|
77
|
+
points?: number;
|
|
78
|
+
owner?: string;
|
|
79
|
+
labels?: string[];
|
|
80
|
+
links?: ItemLinks;
|
|
81
|
+
depends_on?: string[];
|
|
82
|
+
acceptance?: string[];
|
|
83
|
+
agent?: AgentSpec;
|
|
84
|
+
body?: string;
|
|
85
|
+
}
|
|
86
|
+
interface FilterSpec {
|
|
87
|
+
status?: string;
|
|
88
|
+
owner?: string;
|
|
89
|
+
label?: string;
|
|
90
|
+
type?: ItemType | ItemType[] | string;
|
|
91
|
+
search?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type ValueOf<T> = T[keyof T];
|
|
95
|
+
declare const TaskType: {
|
|
96
|
+
readonly feature: "feature";
|
|
97
|
+
readonly bug: "bug";
|
|
98
|
+
readonly chore: "chore";
|
|
99
|
+
readonly spike: "spike";
|
|
100
|
+
readonly epic: "epic";
|
|
101
|
+
};
|
|
102
|
+
type TaskType = ValueOf<typeof TaskType>;
|
|
103
|
+
declare const TaskStatus: {
|
|
104
|
+
readonly todo: "todo";
|
|
105
|
+
readonly blocked: "blocked";
|
|
106
|
+
readonly in_progress: "in_progress";
|
|
107
|
+
readonly in_review: "in_review";
|
|
108
|
+
readonly done: "done";
|
|
109
|
+
readonly canceled: "canceled";
|
|
110
|
+
};
|
|
111
|
+
type TaskStatus = ValueOf<typeof TaskStatus>;
|
|
112
|
+
declare const TaskPriority: {
|
|
113
|
+
readonly p0: "p0";
|
|
114
|
+
readonly p1: "p1";
|
|
115
|
+
readonly p2: "p2";
|
|
116
|
+
readonly p3: "p3";
|
|
117
|
+
};
|
|
118
|
+
type TaskPriority = ValueOf<typeof TaskPriority>;
|
|
119
|
+
declare const TaskComplexity: {
|
|
120
|
+
readonly trivial: "trivial";
|
|
121
|
+
readonly small: "small";
|
|
122
|
+
readonly medium: "medium";
|
|
123
|
+
readonly large: "large";
|
|
124
|
+
readonly unknown: "unknown";
|
|
125
|
+
};
|
|
126
|
+
type TaskComplexity = ValueOf<typeof TaskComplexity>;
|
|
127
|
+
declare const TaskDeterminism: {
|
|
128
|
+
readonly high: "high";
|
|
129
|
+
readonly medium: "medium";
|
|
130
|
+
readonly low: "low";
|
|
131
|
+
readonly experimental: "experimental";
|
|
132
|
+
};
|
|
133
|
+
type TaskDeterminism = ValueOf<typeof TaskDeterminism>;
|
|
134
|
+
declare const IdeaStatus: {
|
|
135
|
+
readonly captured: "captured";
|
|
136
|
+
readonly exploring: "exploring";
|
|
137
|
+
readonly promoted: "promoted";
|
|
138
|
+
readonly parked: "parked";
|
|
139
|
+
readonly rejected: "rejected";
|
|
140
|
+
};
|
|
141
|
+
type IdeaStatus = ValueOf<typeof IdeaStatus>;
|
|
142
|
+
declare const DeliveryStatus: {
|
|
143
|
+
readonly planning: "planning";
|
|
144
|
+
readonly committed: "committed";
|
|
145
|
+
readonly in_progress: "in_progress";
|
|
146
|
+
readonly delivered: "delivered";
|
|
147
|
+
readonly canceled: "canceled";
|
|
148
|
+
};
|
|
149
|
+
type DeliveryStatus = ValueOf<typeof DeliveryStatus>;
|
|
150
|
+
declare const ExecutorType: {
|
|
151
|
+
readonly human: "human";
|
|
152
|
+
readonly ai: "ai";
|
|
153
|
+
readonly ci: "ci";
|
|
154
|
+
readonly hybrid: "hybrid";
|
|
155
|
+
};
|
|
156
|
+
type ExecutorType = ValueOf<typeof ExecutorType>;
|
|
157
|
+
declare const RunbookAction: {
|
|
158
|
+
readonly generate: "generate";
|
|
159
|
+
readonly run: "run";
|
|
160
|
+
readonly review: "review";
|
|
161
|
+
readonly test: "test";
|
|
162
|
+
readonly deploy: "deploy";
|
|
163
|
+
};
|
|
164
|
+
type RunbookAction = ValueOf<typeof RunbookAction>;
|
|
165
|
+
declare const ArtifactType: {
|
|
166
|
+
readonly pr: "pr";
|
|
167
|
+
readonly migration: "migration";
|
|
168
|
+
readonly deployment: "deployment";
|
|
169
|
+
readonly document: "document";
|
|
170
|
+
readonly config: "config";
|
|
171
|
+
};
|
|
172
|
+
type ArtifactType = ValueOf<typeof ArtifactType>;
|
|
173
|
+
declare const RiskLevel: {
|
|
174
|
+
readonly low: "low";
|
|
175
|
+
readonly medium: "medium";
|
|
176
|
+
readonly high: "high";
|
|
177
|
+
readonly critical: "critical";
|
|
178
|
+
};
|
|
179
|
+
type RiskLevel = ValueOf<typeof RiskLevel>;
|
|
180
|
+
|
|
181
|
+
interface DeliveryBudget {
|
|
182
|
+
engineering_hours?: number;
|
|
183
|
+
cost_usd?: number;
|
|
184
|
+
}
|
|
185
|
+
interface DeliveryScope {
|
|
186
|
+
include: string[];
|
|
187
|
+
exclude: string[];
|
|
188
|
+
}
|
|
189
|
+
interface DeliveryRisk {
|
|
190
|
+
id: string;
|
|
191
|
+
description: string;
|
|
192
|
+
probability: RiskLevel;
|
|
193
|
+
impact: RiskLevel;
|
|
194
|
+
mitigation?: string;
|
|
195
|
+
}
|
|
196
|
+
interface DeliveryGovernance {
|
|
197
|
+
owner?: string;
|
|
198
|
+
stakeholders?: string[];
|
|
199
|
+
review_cadence?: string;
|
|
200
|
+
}
|
|
201
|
+
interface Delivery {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
status: DeliveryStatus;
|
|
205
|
+
target_date: string | null;
|
|
206
|
+
started_date: string | null;
|
|
207
|
+
delivered_date: string | null;
|
|
208
|
+
budget: DeliveryBudget;
|
|
209
|
+
capacity_profiles: string[];
|
|
210
|
+
scope: DeliveryScope;
|
|
211
|
+
risks?: DeliveryRisk[];
|
|
212
|
+
governance?: DeliveryGovernance;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface AvailabilityWindow {
|
|
216
|
+
from: string;
|
|
217
|
+
to: string;
|
|
218
|
+
hours_per_day: number;
|
|
219
|
+
}
|
|
220
|
+
interface EffectiveCapacity {
|
|
221
|
+
method: "computed" | "manual";
|
|
222
|
+
hours_per_week?: number;
|
|
223
|
+
tokens_per_day?: number;
|
|
224
|
+
compute_hours_per_week?: number;
|
|
225
|
+
}
|
|
226
|
+
interface HumanMember {
|
|
227
|
+
id: string;
|
|
228
|
+
role?: string;
|
|
229
|
+
hours_per_week?: number;
|
|
230
|
+
skills?: string[];
|
|
231
|
+
availability?: AvailabilityWindow[];
|
|
232
|
+
}
|
|
233
|
+
interface HumanResource {
|
|
234
|
+
id: string;
|
|
235
|
+
type: "human";
|
|
236
|
+
members: HumanMember[];
|
|
237
|
+
defaults?: {
|
|
238
|
+
hours_per_week?: number;
|
|
239
|
+
};
|
|
240
|
+
overhead?: {
|
|
241
|
+
meetings_percent?: number;
|
|
242
|
+
context_switch_percent?: number;
|
|
243
|
+
};
|
|
244
|
+
effective_capacity?: EffectiveCapacity;
|
|
245
|
+
}
|
|
246
|
+
interface AIAgent {
|
|
247
|
+
id: string;
|
|
248
|
+
provider?: string;
|
|
249
|
+
model?: string;
|
|
250
|
+
token_limit_per_day?: number;
|
|
251
|
+
concurrency?: number;
|
|
252
|
+
capabilities?: string[];
|
|
253
|
+
}
|
|
254
|
+
interface AIResource {
|
|
255
|
+
id: string;
|
|
256
|
+
type: "ai";
|
|
257
|
+
agents: AIAgent[];
|
|
258
|
+
routing?: {
|
|
259
|
+
default?: string;
|
|
260
|
+
complexity_large?: string;
|
|
261
|
+
spike?: string;
|
|
262
|
+
};
|
|
263
|
+
effective_capacity?: EffectiveCapacity;
|
|
264
|
+
}
|
|
265
|
+
interface ComputeNode {
|
|
266
|
+
id: string;
|
|
267
|
+
provider?: string;
|
|
268
|
+
gpu_hours_per_week?: number;
|
|
269
|
+
cpu_hours_per_week?: number;
|
|
270
|
+
availability_percent?: number;
|
|
271
|
+
}
|
|
272
|
+
interface ComputeResource {
|
|
273
|
+
id: string;
|
|
274
|
+
type: "compute";
|
|
275
|
+
nodes: ComputeNode[];
|
|
276
|
+
effective_capacity?: EffectiveCapacity;
|
|
277
|
+
}
|
|
278
|
+
type ResourceProfile = HumanResource | AIResource | ComputeResource;
|
|
279
|
+
|
|
280
|
+
interface TaskCore {
|
|
281
|
+
id: string;
|
|
282
|
+
title: string;
|
|
283
|
+
type: TaskType;
|
|
284
|
+
status: TaskStatus;
|
|
285
|
+
created: string;
|
|
286
|
+
updated: string;
|
|
287
|
+
}
|
|
288
|
+
interface TaskPlanning {
|
|
289
|
+
priority?: TaskPriority;
|
|
290
|
+
track?: string;
|
|
291
|
+
assignee?: string | null;
|
|
292
|
+
depends_on?: string[];
|
|
293
|
+
tags?: string[];
|
|
294
|
+
delivery?: string | null;
|
|
295
|
+
}
|
|
296
|
+
interface TaskEstimate {
|
|
297
|
+
optimistic_hours: number;
|
|
298
|
+
expected_hours: number;
|
|
299
|
+
pessimistic_hours: number;
|
|
300
|
+
}
|
|
301
|
+
interface TaskResources {
|
|
302
|
+
human_hours?: number;
|
|
303
|
+
ai_tokens?: number;
|
|
304
|
+
compute_gpu_hours?: number;
|
|
305
|
+
cost_usd?: number;
|
|
306
|
+
}
|
|
307
|
+
interface TaskEstimation {
|
|
308
|
+
complexity?: TaskComplexity;
|
|
309
|
+
determinism?: TaskDeterminism;
|
|
310
|
+
estimate?: TaskEstimate;
|
|
311
|
+
resources?: TaskResources;
|
|
312
|
+
}
|
|
313
|
+
interface RunbookStep {
|
|
314
|
+
step: string;
|
|
315
|
+
action: RunbookAction;
|
|
316
|
+
command?: string;
|
|
317
|
+
description?: string;
|
|
318
|
+
output?: string;
|
|
319
|
+
success_criteria?: string;
|
|
320
|
+
reviewer?: string;
|
|
321
|
+
}
|
|
322
|
+
interface ExecutionPermissions {
|
|
323
|
+
read_paths?: string[];
|
|
324
|
+
write_paths?: string[];
|
|
325
|
+
allowed_commands?: string[];
|
|
326
|
+
forbidden_commands?: string[];
|
|
327
|
+
}
|
|
328
|
+
interface ExecutionConstraints {
|
|
329
|
+
max_tokens?: number;
|
|
330
|
+
max_duration_minutes?: number;
|
|
331
|
+
max_file_changes?: number;
|
|
332
|
+
require_tests?: boolean;
|
|
333
|
+
}
|
|
334
|
+
interface TaskExecution {
|
|
335
|
+
execution?: {
|
|
336
|
+
executor: ExecutorType;
|
|
337
|
+
agent?: string;
|
|
338
|
+
context?: {
|
|
339
|
+
paths?: string[];
|
|
340
|
+
files?: string[];
|
|
341
|
+
tasks?: string[];
|
|
342
|
+
};
|
|
343
|
+
runbook?: RunbookStep[];
|
|
344
|
+
permissions?: ExecutionPermissions;
|
|
345
|
+
constraints?: ExecutionConstraints;
|
|
346
|
+
};
|
|
347
|
+
artifacts?: {
|
|
348
|
+
produces?: Array<{
|
|
349
|
+
type: ArtifactType;
|
|
350
|
+
target?: string;
|
|
351
|
+
path?: string;
|
|
352
|
+
}>;
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
interface TaskGovernance {
|
|
356
|
+
governance?: {
|
|
357
|
+
owner?: string;
|
|
358
|
+
reviewer?: string;
|
|
359
|
+
approval_required?: boolean;
|
|
360
|
+
compliance_tags?: string[];
|
|
361
|
+
};
|
|
362
|
+
risk?: {
|
|
363
|
+
level?: RiskLevel;
|
|
364
|
+
probability?: number;
|
|
365
|
+
impact_hours?: number;
|
|
366
|
+
mitigation?: string;
|
|
367
|
+
contingency?: string;
|
|
368
|
+
};
|
|
369
|
+
metrics?: {
|
|
370
|
+
target_cycle_time_days?: number;
|
|
371
|
+
};
|
|
372
|
+
enterprise?: Record<string, unknown>;
|
|
373
|
+
}
|
|
374
|
+
type Task = TaskCore & TaskPlanning & TaskEstimation & TaskExecution & TaskGovernance;
|
|
375
|
+
interface TaskComputed {
|
|
376
|
+
blocks: string[];
|
|
377
|
+
pert_hours: number | null;
|
|
378
|
+
pert_stddev: number | null;
|
|
379
|
+
readiness: "ready" | "blocked" | "waiting_review" | "done";
|
|
380
|
+
scheduling_score: number;
|
|
381
|
+
critical_path_member: boolean;
|
|
382
|
+
slack_hours: number;
|
|
383
|
+
depth: number;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface Track {
|
|
387
|
+
id: string;
|
|
388
|
+
name: string;
|
|
389
|
+
capacity_profiles: string[];
|
|
390
|
+
constraints?: {
|
|
391
|
+
max_concurrent_tasks?: number;
|
|
392
|
+
allowed_types?: TaskType[];
|
|
393
|
+
};
|
|
394
|
+
dependencies?: {
|
|
395
|
+
upstream?: string[];
|
|
396
|
+
downstream?: string[];
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface TaskGraph {
|
|
401
|
+
nodes: Map<string, Task>;
|
|
402
|
+
forward: Map<string, Set<string>>;
|
|
403
|
+
reverse: Map<string, Set<string>>;
|
|
404
|
+
topological_order: string[];
|
|
405
|
+
tracks: Map<string, Track>;
|
|
406
|
+
resources: Map<string, ResourceProfile>;
|
|
407
|
+
deliveries: Map<string, Delivery>;
|
|
408
|
+
}
|
|
409
|
+
interface GraphValidationResult {
|
|
410
|
+
level: "error" | "warning";
|
|
411
|
+
invariant: "acyclicity" | "referential_integrity" | "terminal_convergence" | "status_consistency";
|
|
412
|
+
message: string;
|
|
413
|
+
task_ids?: string[];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
interface BuildGraphContext {
|
|
417
|
+
tracks?: Map<string, Track>;
|
|
418
|
+
resources?: Map<string, ResourceProfile>;
|
|
419
|
+
deliveries?: Map<string, Delivery>;
|
|
420
|
+
}
|
|
421
|
+
declare function detect_cycle(graph: TaskGraph): string[] | null;
|
|
422
|
+
declare function topological_sort(graph: TaskGraph): string[];
|
|
423
|
+
declare function transitive_dependencies(graph: TaskGraph, taskId: string): Set<string>;
|
|
424
|
+
declare function transitive_dependents(graph: TaskGraph, taskId: string): Set<string>;
|
|
425
|
+
declare function build_graph(tasks: Task[], context?: BuildGraphContext): TaskGraph;
|
|
426
|
+
|
|
427
|
+
declare function load_graph(coopDir: string): TaskGraph;
|
|
428
|
+
|
|
429
|
+
declare function extract_subgraph(graph: TaskGraph, taskIds: string[]): TaskGraph;
|
|
430
|
+
declare function find_external_dependencies(subgraph: TaskGraph, fullGraph: TaskGraph): string[];
|
|
431
|
+
|
|
432
|
+
declare function validate_graph(graph: TaskGraph): GraphValidationResult[];
|
|
433
|
+
|
|
434
|
+
interface CoopConfig {
|
|
435
|
+
version: number;
|
|
436
|
+
project: {
|
|
437
|
+
name: string;
|
|
438
|
+
id: string;
|
|
439
|
+
};
|
|
440
|
+
id_prefixes?: {
|
|
441
|
+
idea?: string;
|
|
442
|
+
task?: string;
|
|
443
|
+
delivery?: string;
|
|
444
|
+
run?: string;
|
|
445
|
+
};
|
|
446
|
+
defaults?: {
|
|
447
|
+
task?: {
|
|
448
|
+
type?: TaskType;
|
|
449
|
+
priority?: TaskPriority;
|
|
450
|
+
complexity?: TaskComplexity;
|
|
451
|
+
determinism?: TaskDeterminism;
|
|
452
|
+
};
|
|
453
|
+
track?: string;
|
|
454
|
+
};
|
|
455
|
+
scheduling?: {
|
|
456
|
+
algorithm?: "critical-path" | "priority-first" | "manual";
|
|
457
|
+
velocity_window_weeks?: number;
|
|
458
|
+
overhead_factor?: number;
|
|
459
|
+
weights?: Record<string, number>;
|
|
460
|
+
};
|
|
461
|
+
ai?: {
|
|
462
|
+
default_executor?: string;
|
|
463
|
+
sandbox?: boolean;
|
|
464
|
+
max_concurrent_agents?: number;
|
|
465
|
+
token_budget_per_task?: number;
|
|
466
|
+
};
|
|
467
|
+
plugins?: {
|
|
468
|
+
enabled?: string[];
|
|
469
|
+
};
|
|
470
|
+
hooks?: {
|
|
471
|
+
on_task_transition?: string;
|
|
472
|
+
on_delivery_complete?: string;
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
interface Idea {
|
|
477
|
+
id: string;
|
|
478
|
+
title: string;
|
|
479
|
+
created: string;
|
|
480
|
+
author: string;
|
|
481
|
+
status: IdeaStatus;
|
|
482
|
+
tags: string[];
|
|
483
|
+
source: string;
|
|
484
|
+
linked_tasks: string[];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
interface ParsedDelivery {
|
|
488
|
+
delivery: Delivery;
|
|
489
|
+
body: string;
|
|
490
|
+
raw: Record<string, unknown>;
|
|
491
|
+
}
|
|
492
|
+
declare function parseDeliveryContent(content: string, source?: string): ParsedDelivery;
|
|
493
|
+
declare function parseDeliveryFile(filePath: string): ParsedDelivery;
|
|
494
|
+
|
|
495
|
+
interface FrontmatterParseResult {
|
|
496
|
+
frontmatter: Record<string, unknown>;
|
|
497
|
+
body: string;
|
|
498
|
+
}
|
|
499
|
+
declare function parseFrontmatterContent(content: string, source?: string): FrontmatterParseResult;
|
|
500
|
+
declare function parseFrontmatterFile(filePath: string): FrontmatterParseResult;
|
|
501
|
+
declare function stringifyFrontmatter(frontmatter: Record<string, unknown>, body?: string): string;
|
|
502
|
+
|
|
503
|
+
interface ParsedIdea {
|
|
504
|
+
idea: Idea;
|
|
505
|
+
body: string;
|
|
506
|
+
raw: Record<string, unknown>;
|
|
507
|
+
}
|
|
508
|
+
declare function parseIdeaContent(content: string, source?: string): ParsedIdea;
|
|
509
|
+
declare function parseIdeaFile(filePath: string): ParsedIdea;
|
|
510
|
+
|
|
511
|
+
interface ParsedTask {
|
|
512
|
+
task: Task;
|
|
513
|
+
body: string;
|
|
514
|
+
raw: Record<string, unknown>;
|
|
515
|
+
}
|
|
516
|
+
declare function parseTaskContent(content: string, source?: string): ParsedTask;
|
|
517
|
+
declare function parseTaskFile(filePath: string): ParsedTask;
|
|
518
|
+
|
|
519
|
+
interface WriteTaskOptions {
|
|
520
|
+
body?: string;
|
|
521
|
+
raw?: Record<string, unknown>;
|
|
522
|
+
filePath?: string;
|
|
523
|
+
}
|
|
524
|
+
declare function writeTask(task: Task, options?: WriteTaskOptions): string;
|
|
525
|
+
|
|
526
|
+
declare function parseYamlContent<T extends object = Record<string, unknown>>(content: string, source?: string): T;
|
|
527
|
+
declare function parseYamlFile<T extends object = Record<string, unknown>>(filePath: string): T;
|
|
528
|
+
|
|
529
|
+
type ReadinessState = "ready" | "blocked" | "in_progress" | "waiting_review" | "done";
|
|
530
|
+
interface ReadinessPartitions {
|
|
531
|
+
ready: Task[];
|
|
532
|
+
blocked: Task[];
|
|
533
|
+
in_progress: Task[];
|
|
534
|
+
waiting_review: Task[];
|
|
535
|
+
done: Task[];
|
|
536
|
+
}
|
|
537
|
+
interface ReadinessTransitionEvent {
|
|
538
|
+
type: "task.transitioned";
|
|
539
|
+
task_id: string;
|
|
540
|
+
from: "blocked";
|
|
541
|
+
to: "todo";
|
|
542
|
+
reason: string;
|
|
543
|
+
}
|
|
544
|
+
interface ReadinessWarning {
|
|
545
|
+
code: "todo_with_unresolved_dependencies";
|
|
546
|
+
task_id: string;
|
|
547
|
+
message: string;
|
|
548
|
+
}
|
|
549
|
+
interface ReadinessComputation {
|
|
550
|
+
readiness: Map<string, ReadinessState>;
|
|
551
|
+
partitions: ReadinessPartitions;
|
|
552
|
+
corrections: ReadinessTransitionEvent[];
|
|
553
|
+
warnings: ReadinessWarning[];
|
|
554
|
+
}
|
|
555
|
+
declare function compute_readiness(task: Task, graph: TaskGraph): ReadinessState;
|
|
556
|
+
declare function compute_all_readiness(graph: TaskGraph): Map<string, ReadinessState>;
|
|
557
|
+
declare function partition_by_readiness(graph: TaskGraph): ReadinessPartitions;
|
|
558
|
+
declare function compute_readiness_with_corrections(graph: TaskGraph): ReadinessComputation;
|
|
559
|
+
|
|
560
|
+
declare const CURRENT_SCHEMA_VERSION = 2;
|
|
561
|
+
declare function read_schema_version(coopDir: string): number;
|
|
562
|
+
declare function write_schema_version(coopDir: string, version: number): void;
|
|
563
|
+
|
|
564
|
+
type TaskTransitionedEvent = {
|
|
565
|
+
type: "task.transitioned";
|
|
566
|
+
automated: true;
|
|
567
|
+
task_id: string;
|
|
568
|
+
from: TaskStatus;
|
|
569
|
+
to: TaskStatus;
|
|
570
|
+
reason: string;
|
|
571
|
+
};
|
|
572
|
+
type AutoTransitionResult = {
|
|
573
|
+
should_transition: boolean;
|
|
574
|
+
target_status?: TaskStatus;
|
|
575
|
+
event?: TaskTransitionedEvent;
|
|
576
|
+
};
|
|
577
|
+
type DependencyStatuses = Map<string, TaskStatus> | Record<string, TaskStatus>;
|
|
578
|
+
declare function check_blocked(task: Task, dependencyStatuses?: DependencyStatuses): AutoTransitionResult;
|
|
579
|
+
declare function check_unblocked(task: Task, dependencyStatuses?: DependencyStatuses): AutoTransitionResult;
|
|
580
|
+
|
|
581
|
+
type TransitionContext = {
|
|
582
|
+
actor?: string;
|
|
583
|
+
dependencyStatuses?: Map<string, TaskStatus> | Record<string, TaskStatus>;
|
|
584
|
+
now?: string | Date;
|
|
585
|
+
};
|
|
586
|
+
type TransitionResult = {
|
|
587
|
+
success: boolean;
|
|
588
|
+
task: Task;
|
|
589
|
+
error?: string;
|
|
590
|
+
};
|
|
591
|
+
declare const VALID_TASK_TRANSITIONS: Map<TaskStatus, Set<TaskStatus>>;
|
|
592
|
+
declare function transition(task: Task, targetStatus: TaskStatus, context?: TransitionContext): TransitionResult;
|
|
593
|
+
|
|
594
|
+
type ValidationLevel = "error" | "warning";
|
|
595
|
+
interface ValidationError {
|
|
596
|
+
level: ValidationLevel;
|
|
597
|
+
field: string;
|
|
598
|
+
message: string;
|
|
599
|
+
rule: string;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
interface ReferentialValidationContext {
|
|
603
|
+
existingIds?: Set<string>;
|
|
604
|
+
currentTaskId?: string;
|
|
605
|
+
dependencyMap?: Map<string, string[]> | Record<string, string[]>;
|
|
606
|
+
tracks?: Set<string>;
|
|
607
|
+
deliveries?: Set<string>;
|
|
608
|
+
assignees?: Set<string>;
|
|
609
|
+
agents?: Set<string>;
|
|
610
|
+
}
|
|
611
|
+
declare function validateReferential(task: Task, context?: ReferentialValidationContext): ValidationError[];
|
|
612
|
+
|
|
613
|
+
interface TrackWip {
|
|
614
|
+
inProgress: number;
|
|
615
|
+
limit: number;
|
|
616
|
+
}
|
|
617
|
+
interface SemanticValidationContext {
|
|
618
|
+
taskStatuses?: Map<string, Task["status"]> | Record<string, Task["status"]>;
|
|
619
|
+
trackWip?: Map<string, TrackWip> | Record<string, TrackWip>;
|
|
620
|
+
deliveryByTaskId?: Map<string, string> | Record<string, string>;
|
|
621
|
+
linkedSpikeTaskIds?: Set<string>;
|
|
622
|
+
}
|
|
623
|
+
declare function validateSemantic(task: Task, context?: SemanticValidationContext): ValidationError[];
|
|
624
|
+
|
|
625
|
+
interface StructuralValidationContext {
|
|
626
|
+
filePath?: string;
|
|
627
|
+
}
|
|
628
|
+
declare function validateStructural(task: Task, context?: StructuralValidationContext): ValidationError[];
|
|
629
|
+
|
|
630
|
+
declare const VALID_TRANSITIONS: Map<TaskStatus, Set<TaskStatus>>;
|
|
631
|
+
interface TransitionValidationContext {
|
|
632
|
+
actor?: string;
|
|
633
|
+
dependencyStatuses?: Map<string, TaskStatus> | Record<string, TaskStatus>;
|
|
634
|
+
}
|
|
635
|
+
declare function validate_transition(fromStatus: TaskStatus, toStatus: TaskStatus): boolean;
|
|
636
|
+
declare function validateTransition(task: Task, toStatus: TaskStatus, context?: TransitionValidationContext): ValidationError[];
|
|
637
|
+
|
|
638
|
+
interface ValidationContext extends StructuralValidationContext, ReferentialValidationContext, SemanticValidationContext {
|
|
639
|
+
}
|
|
640
|
+
interface ValidationResult {
|
|
641
|
+
valid: boolean;
|
|
642
|
+
errors: ValidationError[];
|
|
643
|
+
warnings: ValidationError[];
|
|
644
|
+
issues: ValidationError[];
|
|
645
|
+
}
|
|
646
|
+
declare function validate(task: Task, context?: ValidationContext): ValidationResult;
|
|
647
|
+
|
|
648
|
+
declare function findRepoRoot(cwd?: string): string | null;
|
|
649
|
+
interface CompletionResult {
|
|
650
|
+
item: BacklogItem;
|
|
651
|
+
previousStatus: ItemStatus;
|
|
652
|
+
releaseFile?: string;
|
|
653
|
+
alreadyComplete: boolean;
|
|
654
|
+
}
|
|
655
|
+
declare function completeItem(rootDir: string, id: string): CompletionResult;
|
|
656
|
+
declare function ensureCoopLayout(rootDir: string): void;
|
|
657
|
+
declare function loadState(rootDir: string): RepoState;
|
|
658
|
+
declare function queryItems(state: RepoState, filter: FilterSpec): BacklogItem[];
|
|
659
|
+
declare function getItemById(state: RepoState, id: string): BacklogItem | null;
|
|
660
|
+
declare function createItem(rootDir: string, params: CreateItemParams): BacklogItem;
|
|
661
|
+
declare function updateItem(rootDir: string, id: string, patch: UpdateItemParams): BacklogItem;
|
|
662
|
+
declare function deleteItem(rootDir: string, id: string): BacklogItem;
|
|
663
|
+
declare function renderAgentPrompt(item: BacklogItem): string;
|
|
664
|
+
declare function validateRepo(rootDir: string): {
|
|
665
|
+
valid: boolean;
|
|
666
|
+
errors: string[];
|
|
667
|
+
warnings: string[];
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
export { type AIAgent, type AIResource, type AgentSpec, ArtifactType, type AutoTransitionResult, type AvailabilityWindow, type BacklogItem, type BacklogItemData, CURRENT_SCHEMA_VERSION, type ComputeNode, type ComputeResource, type CoopConfig, type CreateItemParams, type Delivery, type DeliveryBudget, type DeliveryGovernance, type DeliveryRisk, type DeliveryScope, DeliveryStatus, type EffectiveCapacity, type ExecutionConstraints, type ExecutionPermissions, ExecutorType, type FilterSpec, type FrontmatterParseResult, type GraphValidationResult, type HumanMember, type HumanResource, ITEM_STATUSES, ITEM_TYPES, type Idea, IdeaStatus, type ItemLinks, type ItemStatus, type ItemType, type ParsedDelivery, type ParsedIdea, type ParsedTask, type ReadinessComputation, type ReadinessPartitions, type ReadinessState, type ReadinessTransitionEvent, type ReadinessWarning, type ReferentialValidationContext, type RepoConfig, type RepoState, type ResourceProfile, RiskLevel, RunbookAction, type RunbookStep, type SemanticValidationContext, type StructuralValidationContext, type Task, TaskComplexity, type TaskComputed, type TaskCore, TaskDeterminism, type TaskEstimate, type TaskEstimation, type TaskExecution, type TaskGovernance, type TaskGraph, type TaskPlanning, TaskPriority, type TaskResources, TaskStatus, type TaskTransitionedEvent, TaskType, type Track, type TrackWip, type TransitionContext, type TransitionResult, type TransitionValidationContext, type UpdateItemParams, VALID_TASK_TRANSITIONS, VALID_TRANSITIONS, type ValidationContext, type ValidationError, type ValidationLevel, type ValidationResult, type WriteTaskOptions, build_graph, check_blocked, check_unblocked, completeItem, compute_all_readiness, compute_readiness, compute_readiness_with_corrections, createItem, deleteItem, detect_cycle, ensureCoopLayout, extract_subgraph, findRepoRoot, find_external_dependencies, getItemById, loadState, load_graph, parseDeliveryContent, parseDeliveryFile, parseFrontmatterContent, parseFrontmatterFile, parseIdeaContent, parseIdeaFile, parseTaskContent, parseTaskFile, parseYamlContent, parseYamlFile, partition_by_readiness, queryItems, read_schema_version, renderAgentPrompt, stringifyFrontmatter, topological_sort, transition, transitive_dependencies, transitive_dependents, updateItem, validate, validateReferential, validateRepo, validateSemantic, validateStructural, validateTransition, validate_graph, validate_transition, writeTask, write_schema_version };
|