@anthropologies/claudestory 0.1.36 → 0.1.37

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.
@@ -0,0 +1,1857 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const TicketSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ title: z.ZodString;
6
+ description: z.ZodString;
7
+ type: z.ZodEnum<["task", "feature", "chore"]>;
8
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
9
+ phase: z.ZodNullable<z.ZodString>;
10
+ order: z.ZodNumber;
11
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
12
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
13
+ blockedBy: z.ZodArray<z.ZodString, "many">;
14
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
20
+ id: z.ZodString;
21
+ title: z.ZodString;
22
+ description: z.ZodString;
23
+ type: z.ZodEnum<["task", "feature", "chore"]>;
24
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
25
+ phase: z.ZodNullable<z.ZodString>;
26
+ order: z.ZodNumber;
27
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
28
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
29
+ blockedBy: z.ZodArray<z.ZodString, "many">;
30
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
36
+ id: z.ZodString;
37
+ title: z.ZodString;
38
+ description: z.ZodString;
39
+ type: z.ZodEnum<["task", "feature", "chore"]>;
40
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
41
+ phase: z.ZodNullable<z.ZodString>;
42
+ order: z.ZodNumber;
43
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
44
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
45
+ blockedBy: z.ZodArray<z.ZodString, "many">;
46
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ }, z.ZodTypeAny, "passthrough">>;
52
+ type Ticket = z.infer<typeof TicketSchema>;
53
+
54
+ declare const IssueSchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ title: z.ZodString;
57
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
58
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
59
+ components: z.ZodArray<z.ZodString, "many">;
60
+ impact: z.ZodString;
61
+ resolution: z.ZodNullable<z.ZodString>;
62
+ location: z.ZodArray<z.ZodString, "many">;
63
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
64
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
65
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
66
+ order: z.ZodOptional<z.ZodNumber>;
67
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
72
+ id: z.ZodString;
73
+ title: z.ZodString;
74
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
75
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
76
+ components: z.ZodArray<z.ZodString, "many">;
77
+ impact: z.ZodString;
78
+ resolution: z.ZodNullable<z.ZodString>;
79
+ location: z.ZodArray<z.ZodString, "many">;
80
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
81
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
82
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
83
+ order: z.ZodOptional<z.ZodNumber>;
84
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
89
+ id: z.ZodString;
90
+ title: z.ZodString;
91
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
92
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
93
+ components: z.ZodArray<z.ZodString, "many">;
94
+ impact: z.ZodString;
95
+ resolution: z.ZodNullable<z.ZodString>;
96
+ location: z.ZodArray<z.ZodString, "many">;
97
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
98
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
99
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
100
+ order: z.ZodOptional<z.ZodNumber>;
101
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
104
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
105
+ }, z.ZodTypeAny, "passthrough">>;
106
+ type Issue = z.infer<typeof IssueSchema>;
107
+
108
+ declare const NoteSchema: z.ZodObject<{
109
+ id: z.ZodString;
110
+ title: z.ZodNullable<z.ZodString>;
111
+ content: z.ZodEffects<z.ZodString, string, string>;
112
+ tags: z.ZodArray<z.ZodString, "many">;
113
+ status: z.ZodEnum<["active", "archived"]>;
114
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
115
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
116
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
117
+ id: z.ZodString;
118
+ title: z.ZodNullable<z.ZodString>;
119
+ content: z.ZodEffects<z.ZodString, string, string>;
120
+ tags: z.ZodArray<z.ZodString, "many">;
121
+ status: z.ZodEnum<["active", "archived"]>;
122
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
123
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
124
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
125
+ id: z.ZodString;
126
+ title: z.ZodNullable<z.ZodString>;
127
+ content: z.ZodEffects<z.ZodString, string, string>;
128
+ tags: z.ZodArray<z.ZodString, "many">;
129
+ status: z.ZodEnum<["active", "archived"]>;
130
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
131
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
132
+ }, z.ZodTypeAny, "passthrough">>;
133
+ type Note = z.infer<typeof NoteSchema>;
134
+
135
+ declare const BlockerSchema: z.ZodObject<{
136
+ name: z.ZodString;
137
+ cleared: z.ZodOptional<z.ZodBoolean>;
138
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
139
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
140
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
142
+ name: z.ZodString;
143
+ cleared: z.ZodOptional<z.ZodBoolean>;
144
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
145
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
146
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
148
+ name: z.ZodString;
149
+ cleared: z.ZodOptional<z.ZodBoolean>;
150
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
151
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
152
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
153
+ }, z.ZodTypeAny, "passthrough">>;
154
+ type Blocker = z.infer<typeof BlockerSchema>;
155
+ declare const PhaseSchema: z.ZodObject<{
156
+ id: z.ZodString;
157
+ label: z.ZodString;
158
+ name: z.ZodString;
159
+ description: z.ZodString;
160
+ summary: z.ZodOptional<z.ZodString>;
161
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
162
+ id: z.ZodString;
163
+ label: z.ZodString;
164
+ name: z.ZodString;
165
+ description: z.ZodString;
166
+ summary: z.ZodOptional<z.ZodString>;
167
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
168
+ id: z.ZodString;
169
+ label: z.ZodString;
170
+ name: z.ZodString;
171
+ description: z.ZodString;
172
+ summary: z.ZodOptional<z.ZodString>;
173
+ }, z.ZodTypeAny, "passthrough">>;
174
+ type Phase = z.infer<typeof PhaseSchema>;
175
+ declare const RoadmapSchema: z.ZodObject<{
176
+ title: z.ZodString;
177
+ date: z.ZodEffects<z.ZodString, string, string>;
178
+ phases: z.ZodArray<z.ZodObject<{
179
+ id: z.ZodString;
180
+ label: z.ZodString;
181
+ name: z.ZodString;
182
+ description: z.ZodString;
183
+ summary: z.ZodOptional<z.ZodString>;
184
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
185
+ id: z.ZodString;
186
+ label: z.ZodString;
187
+ name: z.ZodString;
188
+ description: z.ZodString;
189
+ summary: z.ZodOptional<z.ZodString>;
190
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
191
+ id: z.ZodString;
192
+ label: z.ZodString;
193
+ name: z.ZodString;
194
+ description: z.ZodString;
195
+ summary: z.ZodOptional<z.ZodString>;
196
+ }, z.ZodTypeAny, "passthrough">>, "many">;
197
+ blockers: z.ZodArray<z.ZodObject<{
198
+ name: z.ZodString;
199
+ cleared: z.ZodOptional<z.ZodBoolean>;
200
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
201
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
202
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
203
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
204
+ name: z.ZodString;
205
+ cleared: z.ZodOptional<z.ZodBoolean>;
206
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
207
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
208
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
209
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
210
+ name: z.ZodString;
211
+ cleared: z.ZodOptional<z.ZodBoolean>;
212
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
213
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
214
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
+ }, z.ZodTypeAny, "passthrough">>, "many">;
216
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
217
+ title: z.ZodString;
218
+ date: z.ZodEffects<z.ZodString, string, string>;
219
+ phases: z.ZodArray<z.ZodObject<{
220
+ id: z.ZodString;
221
+ label: z.ZodString;
222
+ name: z.ZodString;
223
+ description: z.ZodString;
224
+ summary: z.ZodOptional<z.ZodString>;
225
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
226
+ id: z.ZodString;
227
+ label: z.ZodString;
228
+ name: z.ZodString;
229
+ description: z.ZodString;
230
+ summary: z.ZodOptional<z.ZodString>;
231
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
232
+ id: z.ZodString;
233
+ label: z.ZodString;
234
+ name: z.ZodString;
235
+ description: z.ZodString;
236
+ summary: z.ZodOptional<z.ZodString>;
237
+ }, z.ZodTypeAny, "passthrough">>, "many">;
238
+ blockers: z.ZodArray<z.ZodObject<{
239
+ name: z.ZodString;
240
+ cleared: z.ZodOptional<z.ZodBoolean>;
241
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
242
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
243
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
245
+ name: z.ZodString;
246
+ cleared: z.ZodOptional<z.ZodBoolean>;
247
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
248
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
249
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
250
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
251
+ name: z.ZodString;
252
+ cleared: z.ZodOptional<z.ZodBoolean>;
253
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
254
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
255
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
256
+ }, z.ZodTypeAny, "passthrough">>, "many">;
257
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
258
+ title: z.ZodString;
259
+ date: z.ZodEffects<z.ZodString, string, string>;
260
+ phases: z.ZodArray<z.ZodObject<{
261
+ id: z.ZodString;
262
+ label: z.ZodString;
263
+ name: z.ZodString;
264
+ description: z.ZodString;
265
+ summary: z.ZodOptional<z.ZodString>;
266
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
267
+ id: z.ZodString;
268
+ label: z.ZodString;
269
+ name: z.ZodString;
270
+ description: z.ZodString;
271
+ summary: z.ZodOptional<z.ZodString>;
272
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
273
+ id: z.ZodString;
274
+ label: z.ZodString;
275
+ name: z.ZodString;
276
+ description: z.ZodString;
277
+ summary: z.ZodOptional<z.ZodString>;
278
+ }, z.ZodTypeAny, "passthrough">>, "many">;
279
+ blockers: z.ZodArray<z.ZodObject<{
280
+ name: z.ZodString;
281
+ cleared: z.ZodOptional<z.ZodBoolean>;
282
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
283
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
284
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
285
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
286
+ name: z.ZodString;
287
+ cleared: z.ZodOptional<z.ZodBoolean>;
288
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
289
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
290
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
291
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
292
+ name: z.ZodString;
293
+ cleared: z.ZodOptional<z.ZodBoolean>;
294
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
295
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
296
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ }, z.ZodTypeAny, "passthrough">>, "many">;
298
+ }, z.ZodTypeAny, "passthrough">>;
299
+ type Roadmap = z.infer<typeof RoadmapSchema>;
300
+
301
+ declare const FeaturesSchema: z.ZodObject<{
302
+ tickets: z.ZodBoolean;
303
+ issues: z.ZodBoolean;
304
+ handovers: z.ZodBoolean;
305
+ roadmap: z.ZodBoolean;
306
+ reviews: z.ZodBoolean;
307
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
308
+ tickets: z.ZodBoolean;
309
+ issues: z.ZodBoolean;
310
+ handovers: z.ZodBoolean;
311
+ roadmap: z.ZodBoolean;
312
+ reviews: z.ZodBoolean;
313
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
314
+ tickets: z.ZodBoolean;
315
+ issues: z.ZodBoolean;
316
+ handovers: z.ZodBoolean;
317
+ roadmap: z.ZodBoolean;
318
+ reviews: z.ZodBoolean;
319
+ }, z.ZodTypeAny, "passthrough">>;
320
+ type Features = z.infer<typeof FeaturesSchema>;
321
+ declare const ConfigSchema: z.ZodObject<{
322
+ version: z.ZodNumber;
323
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
324
+ project: z.ZodString;
325
+ type: z.ZodString;
326
+ language: z.ZodString;
327
+ features: z.ZodObject<{
328
+ tickets: z.ZodBoolean;
329
+ issues: z.ZodBoolean;
330
+ handovers: z.ZodBoolean;
331
+ roadmap: z.ZodBoolean;
332
+ reviews: z.ZodBoolean;
333
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
334
+ tickets: z.ZodBoolean;
335
+ issues: z.ZodBoolean;
336
+ handovers: z.ZodBoolean;
337
+ roadmap: z.ZodBoolean;
338
+ reviews: z.ZodBoolean;
339
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
340
+ tickets: z.ZodBoolean;
341
+ issues: z.ZodBoolean;
342
+ handovers: z.ZodBoolean;
343
+ roadmap: z.ZodBoolean;
344
+ reviews: z.ZodBoolean;
345
+ }, z.ZodTypeAny, "passthrough">>;
346
+ recipe: z.ZodOptional<z.ZodString>;
347
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
348
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
349
+ compactThreshold: z.ZodOptional<z.ZodString>;
350
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
351
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
352
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
353
+ }, "strip", z.ZodTypeAny, {
354
+ maxTicketsPerSession?: number | undefined;
355
+ compactThreshold?: string | undefined;
356
+ reviewBackends?: string[] | undefined;
357
+ handoverInterval?: number | undefined;
358
+ stages?: Record<string, Record<string, unknown>> | undefined;
359
+ }, {
360
+ maxTicketsPerSession?: number | undefined;
361
+ compactThreshold?: string | undefined;
362
+ reviewBackends?: string[] | undefined;
363
+ handoverInterval?: number | undefined;
364
+ stages?: Record<string, Record<string, unknown>> | undefined;
365
+ }>>;
366
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
367
+ version: z.ZodNumber;
368
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
369
+ project: z.ZodString;
370
+ type: z.ZodString;
371
+ language: z.ZodString;
372
+ features: z.ZodObject<{
373
+ tickets: z.ZodBoolean;
374
+ issues: z.ZodBoolean;
375
+ handovers: z.ZodBoolean;
376
+ roadmap: z.ZodBoolean;
377
+ reviews: z.ZodBoolean;
378
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
379
+ tickets: z.ZodBoolean;
380
+ issues: z.ZodBoolean;
381
+ handovers: z.ZodBoolean;
382
+ roadmap: z.ZodBoolean;
383
+ reviews: z.ZodBoolean;
384
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
385
+ tickets: z.ZodBoolean;
386
+ issues: z.ZodBoolean;
387
+ handovers: z.ZodBoolean;
388
+ roadmap: z.ZodBoolean;
389
+ reviews: z.ZodBoolean;
390
+ }, z.ZodTypeAny, "passthrough">>;
391
+ recipe: z.ZodOptional<z.ZodString>;
392
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
393
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
394
+ compactThreshold: z.ZodOptional<z.ZodString>;
395
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
396
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
397
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ maxTicketsPerSession?: number | undefined;
400
+ compactThreshold?: string | undefined;
401
+ reviewBackends?: string[] | undefined;
402
+ handoverInterval?: number | undefined;
403
+ stages?: Record<string, Record<string, unknown>> | undefined;
404
+ }, {
405
+ maxTicketsPerSession?: number | undefined;
406
+ compactThreshold?: string | undefined;
407
+ reviewBackends?: string[] | undefined;
408
+ handoverInterval?: number | undefined;
409
+ stages?: Record<string, Record<string, unknown>> | undefined;
410
+ }>>;
411
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
412
+ version: z.ZodNumber;
413
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
414
+ project: z.ZodString;
415
+ type: z.ZodString;
416
+ language: z.ZodString;
417
+ features: z.ZodObject<{
418
+ tickets: z.ZodBoolean;
419
+ issues: z.ZodBoolean;
420
+ handovers: z.ZodBoolean;
421
+ roadmap: z.ZodBoolean;
422
+ reviews: z.ZodBoolean;
423
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
424
+ tickets: z.ZodBoolean;
425
+ issues: z.ZodBoolean;
426
+ handovers: z.ZodBoolean;
427
+ roadmap: z.ZodBoolean;
428
+ reviews: z.ZodBoolean;
429
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
430
+ tickets: z.ZodBoolean;
431
+ issues: z.ZodBoolean;
432
+ handovers: z.ZodBoolean;
433
+ roadmap: z.ZodBoolean;
434
+ reviews: z.ZodBoolean;
435
+ }, z.ZodTypeAny, "passthrough">>;
436
+ recipe: z.ZodOptional<z.ZodString>;
437
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
438
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
439
+ compactThreshold: z.ZodOptional<z.ZodString>;
440
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
441
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
442
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
443
+ }, "strip", z.ZodTypeAny, {
444
+ maxTicketsPerSession?: number | undefined;
445
+ compactThreshold?: string | undefined;
446
+ reviewBackends?: string[] | undefined;
447
+ handoverInterval?: number | undefined;
448
+ stages?: Record<string, Record<string, unknown>> | undefined;
449
+ }, {
450
+ maxTicketsPerSession?: number | undefined;
451
+ compactThreshold?: string | undefined;
452
+ reviewBackends?: string[] | undefined;
453
+ handoverInterval?: number | undefined;
454
+ stages?: Record<string, Record<string, unknown>> | undefined;
455
+ }>>;
456
+ }, z.ZodTypeAny, "passthrough">>;
457
+ type Config = z.infer<typeof ConfigSchema>;
458
+
459
+ /** Matches T-001, T-077a, T-079b */
460
+ declare const TICKET_ID_REGEX: RegExp;
461
+ /** Matches ISS-001, ISS-009 */
462
+ declare const ISSUE_ID_REGEX: RegExp;
463
+ declare const TICKET_STATUSES: readonly ["open", "inprogress", "complete"];
464
+ type TicketStatus = (typeof TICKET_STATUSES)[number];
465
+ declare const TICKET_TYPES: readonly ["task", "feature", "chore"];
466
+ type TicketType = (typeof TICKET_TYPES)[number];
467
+ declare const ISSUE_STATUSES: readonly ["open", "inprogress", "resolved"];
468
+ type IssueStatus = (typeof ISSUE_STATUSES)[number];
469
+ declare const ISSUE_SEVERITIES: readonly ["critical", "high", "medium", "low"];
470
+ type IssueSeverity = (typeof ISSUE_SEVERITIES)[number];
471
+ declare const NOTE_STATUSES: readonly ["active", "archived"];
472
+ type NoteStatus = (typeof NOTE_STATUSES)[number];
473
+ declare const NOTE_ID_REGEX: RegExp;
474
+ declare const NoteIdSchema: z.ZodString;
475
+ declare const OUTPUT_FORMATS: readonly ["json", "md"];
476
+ type OutputFormat = (typeof OUTPUT_FORMATS)[number];
477
+ declare const ERROR_CODES: readonly ["not_found", "validation_failed", "io_error", "project_corrupt", "invalid_input", "conflict", "version_mismatch"];
478
+ type ErrorCode = (typeof ERROR_CODES)[number];
479
+ declare const DATE_REGEX: RegExp;
480
+ declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
481
+ declare const TicketIdSchema: z.ZodString;
482
+ declare const IssueIdSchema: z.ZodString;
483
+
484
+ declare const LessonSchema: z.ZodObject<{
485
+ id: z.ZodString;
486
+ title: z.ZodString;
487
+ content: z.ZodEffects<z.ZodString, string, string>;
488
+ context: z.ZodString;
489
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
490
+ tags: z.ZodArray<z.ZodString, "many">;
491
+ reinforcements: z.ZodNumber;
492
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
493
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
494
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
495
+ supersedes: z.ZodNullable<z.ZodString>;
496
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
497
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
498
+ id: z.ZodString;
499
+ title: z.ZodString;
500
+ content: z.ZodEffects<z.ZodString, string, string>;
501
+ context: z.ZodString;
502
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
503
+ tags: z.ZodArray<z.ZodString, "many">;
504
+ reinforcements: z.ZodNumber;
505
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
506
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
507
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
508
+ supersedes: z.ZodNullable<z.ZodString>;
509
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
510
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
511
+ id: z.ZodString;
512
+ title: z.ZodString;
513
+ content: z.ZodEffects<z.ZodString, string, string>;
514
+ context: z.ZodString;
515
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
516
+ tags: z.ZodArray<z.ZodString, "many">;
517
+ reinforcements: z.ZodNumber;
518
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
519
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
520
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
521
+ supersedes: z.ZodNullable<z.ZodString>;
522
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
523
+ }, z.ZodTypeAny, "passthrough">>;
524
+ type Lesson = z.infer<typeof LessonSchema>;
525
+
526
+ type PhaseStatus = "notstarted" | "inprogress" | "complete";
527
+ /**
528
+ * Pure derived-data container. All derivation happens eagerly in the constructor.
529
+ * Direct port of Swift `ProjectState` — same 7-step pipeline, same query semantics.
530
+ */
531
+ declare class ProjectState {
532
+ readonly tickets: readonly Ticket[];
533
+ readonly issues: readonly Issue[];
534
+ readonly notes: readonly Note[];
535
+ readonly lessons: readonly Lesson[];
536
+ readonly roadmap: Readonly<Roadmap>;
537
+ readonly config: Readonly<Config>;
538
+ readonly handoverFilenames: readonly string[];
539
+ readonly umbrellaIDs: ReadonlySet<string>;
540
+ readonly leafTickets: readonly Ticket[];
541
+ readonly leafTicketCount: number;
542
+ readonly completeLeafTicketCount: number;
543
+ private readonly leafTicketsByPhase;
544
+ private readonly childrenByParent;
545
+ private readonly reverseBlocksMap;
546
+ private readonly ticketsByID;
547
+ private readonly issuesByID;
548
+ private readonly notesByID;
549
+ private readonly lessonsByID;
550
+ readonly totalTicketCount: number;
551
+ readonly openTicketCount: number;
552
+ readonly completeTicketCount: number;
553
+ readonly openIssueCount: number;
554
+ readonly issuesBySeverity: ReadonlyMap<IssueSeverity, number>;
555
+ readonly activeNoteCount: number;
556
+ readonly archivedNoteCount: number;
557
+ readonly activeLessonCount: number;
558
+ readonly deprecatedLessonCount: number;
559
+ constructor(input: {
560
+ tickets: Ticket[];
561
+ issues: Issue[];
562
+ notes: Note[];
563
+ lessons?: Lesson[];
564
+ roadmap: Roadmap;
565
+ config: Config;
566
+ handoverFilenames: string[];
567
+ });
568
+ isUmbrella(ticket: Ticket): boolean;
569
+ phaseTickets(phaseId: string | null): readonly Ticket[];
570
+ /** Phase status derived from leaf tickets only. Umbrella stored status is ignored. */
571
+ phaseStatus(phaseId: string | null): PhaseStatus;
572
+ umbrellaChildren(ticketId: string): readonly Ticket[];
573
+ /** Umbrella status derived from descendant leaf tickets (recursive traversal). */
574
+ umbrellaStatus(ticketId: string): PhaseStatus;
575
+ reverseBlocks(ticketId: string): readonly Ticket[];
576
+ /**
577
+ * A ticket is blocked if any blockedBy reference points to a non-complete ticket.
578
+ * Unknown blocker IDs treated as blocked (conservative — unknown dependency = assume not cleared).
579
+ */
580
+ isBlocked(ticket: Ticket): boolean;
581
+ get blockedCount(): number;
582
+ /** True when the project has been initialized but not yet populated with tickets/issues/handovers. */
583
+ get isEmptyScaffold(): boolean;
584
+ private get isDefaultScaffoldPhases();
585
+ ticketByID(id: string): Ticket | undefined;
586
+ issueByID(id: string): Issue | undefined;
587
+ noteByID(id: string): Note | undefined;
588
+ lessonByID(id: string): Lesson | undefined;
589
+ /** IDs of tickets that list `ticketId` in their blockedBy. */
590
+ ticketsBlocking(ticketId: string): string[];
591
+ /** IDs of tickets that have `ticketId` as their parentTicket. */
592
+ childrenOf(ticketId: string): string[];
593
+ /** IDs of issues that reference `ticketId` in relatedTickets. */
594
+ issuesReferencing(ticketId: string): string[];
595
+ /**
596
+ * Recursively collects all descendant leaf tickets of an umbrella.
597
+ * Uses a visited set to guard against cycles in malformed data.
598
+ */
599
+ private descendantLeaves;
600
+ /**
601
+ * Shared aggregation logic for phase and umbrella status.
602
+ * - all complete → complete
603
+ * - any inprogress OR any complete (but not all) → inprogress
604
+ * - else → notstarted (nothing started)
605
+ */
606
+ private static aggregateStatus;
607
+ }
608
+
609
+ /** Schema version this loader understands. Config.schemaVersion > this → version_mismatch. */
610
+ declare const CURRENT_SCHEMA_VERSION = 1;
611
+ declare class ProjectLoaderError extends Error {
612
+ readonly code: ErrorCode;
613
+ readonly cause?: unknown | undefined;
614
+ readonly name = "ProjectLoaderError";
615
+ constructor(code: ErrorCode, message: string, cause?: unknown | undefined);
616
+ }
617
+ type LoadWarningType = "parse_error" | "schema_error" | "duplicate_id" | "naming_convention";
618
+ /** Integrity warnings fail strict mode. Cosmetic warnings are collected but never block. */
619
+ declare const INTEGRITY_WARNING_TYPES: readonly LoadWarningType[];
620
+ interface LoadWarning {
621
+ readonly file: string;
622
+ readonly message: string;
623
+ readonly type: LoadWarningType;
624
+ }
625
+
626
+ interface LoadOptions {
627
+ /** In strict mode, integrity warnings become thrown errors. Default: false */
628
+ strict?: boolean;
629
+ /** Maximum schemaVersion this loader supports. Default: CURRENT_SCHEMA_VERSION */
630
+ maxSchemaVersion?: number;
631
+ }
632
+ interface LoadResult {
633
+ readonly state: ProjectState;
634
+ readonly warnings: readonly LoadWarning[];
635
+ }
636
+ /**
637
+ * Loads all .story/ data and assembles a ProjectState.
638
+ * Critical files (config, roadmap) throw on failure.
639
+ * Best-effort files (tickets, issues) skip corrupt entries with warnings.
640
+ */
641
+ declare function loadProject(root: string, options?: LoadOptions): Promise<LoadResult>;
642
+ /**
643
+ * Writes a ticket file WITHOUT acquiring the project lock.
644
+ * Use inside withProjectLock when the lock is already held.
645
+ * Performs Zod parse + guardPath + atomicWrite.
646
+ */
647
+ declare function writeTicketUnlocked(ticket: Ticket, root: string): Promise<void>;
648
+ declare function writeTicket(ticket: Ticket, root: string): Promise<void>;
649
+ /**
650
+ * Writes an issue file WITHOUT acquiring the project lock.
651
+ * Use inside withProjectLock when the lock is already held.
652
+ */
653
+ declare function writeIssueUnlocked(issue: Issue, root: string): Promise<void>;
654
+ declare function writeIssue(issue: Issue, root: string): Promise<void>;
655
+ /**
656
+ * Writes a roadmap file WITHOUT acquiring the project lock.
657
+ * Use inside withProjectLock when the lock is already held.
658
+ * Performs Zod parse + guardPath + atomicWrite.
659
+ */
660
+ declare function writeRoadmapUnlocked(roadmap: Roadmap, root: string): Promise<void>;
661
+ declare function writeRoadmap(roadmap: Roadmap, root: string): Promise<void>;
662
+ declare function writeConfig(config: Config, root: string): Promise<void>;
663
+ /**
664
+ * Deletes a ticket file with referential integrity checks.
665
+ * Acquires lock, reloads fresh state from disk, checks all references.
666
+ * With force: true, skips integrity checks and state reload.
667
+ */
668
+ declare function deleteTicket(id: string, root: string, options?: {
669
+ force?: boolean;
670
+ }): Promise<void>;
671
+ declare function deleteIssue(id: string, root: string): Promise<void>;
672
+ /**
673
+ * Writes a note file WITHOUT acquiring the project lock.
674
+ * Use inside withProjectLock when the lock is already held.
675
+ */
676
+ declare function writeNoteUnlocked(note: Note, root: string): Promise<void>;
677
+ declare function writeNote(note: Note, root: string): Promise<void>;
678
+ declare function deleteNote(id: string, root: string): Promise<void>;
679
+ interface WithProjectLockOptions {
680
+ strict?: boolean;
681
+ }
682
+ /**
683
+ * Acquires the project lock, loads fresh state, optionally enforces strict mode,
684
+ * then calls the handler. Released in finally.
685
+ * Use for create/update operations that need atomic load→validate→write.
686
+ */
687
+ declare function withProjectLock(root: string, options: WithProjectLockOptions, handler: (result: LoadResult) => Promise<void>): Promise<void>;
688
+ /**
689
+ * Executes multiple file operations atomically with a transaction journal.
690
+ * Forward-only recovery: if any rename succeeds, complete remaining.
691
+ * Does NOT acquire the lock — caller must hold it.
692
+ *
693
+ * The journal persists a `commitStarted` flag so recovery can distinguish
694
+ * "prepared" (safe to roll back) from "committing" (must complete forward).
695
+ */
696
+ declare function runTransactionUnlocked(root: string, operations: Array<{
697
+ op: "write";
698
+ target: string;
699
+ content: string;
700
+ } | {
701
+ op: "delete";
702
+ target: string;
703
+ }>): Promise<void>;
704
+ /**
705
+ * Executes multiple file operations atomically with a transaction journal.
706
+ * Acquires the project lock, then delegates to runTransactionUnlocked.
707
+ */
708
+ declare function runTransaction(root: string, operations: Array<{
709
+ op: "write";
710
+ target: string;
711
+ content: string;
712
+ } | {
713
+ op: "delete";
714
+ target: string;
715
+ }>): Promise<void>;
716
+ /** Deep-sorts object keys recursively for deterministic JSON output. */
717
+ declare function sortKeysDeep(value: unknown): unknown;
718
+ /** Serializes to pretty-printed JSON with deep-sorted keys. */
719
+ declare function serializeJSON(obj: unknown): string;
720
+ /** Atomic write: write to temp file, then rename. */
721
+ declare function atomicWrite(targetPath: string, content: string): Promise<void>;
722
+ /**
723
+ * Symlink protection: resolve both root and target parent via realpath,
724
+ * verify target is under root. On existing targets, lstat to reject symlinks.
725
+ */
726
+ declare function guardPath(target: string, root: string): Promise<void>;
727
+
728
+ /**
729
+ * Discovers the project root by walking up from `startDir` (default: cwd)
730
+ * looking for `.story/config.json`.
731
+ *
732
+ * CLAUDESTORY_PROJECT_ROOT env var overrides walk-up discovery.
733
+ * Returns the canonical absolute path, or null if not found.
734
+ * Throws ProjectLoaderError if .story/ exists but is unreadable.
735
+ */
736
+ declare function discoverProjectRoot(startDir?: string): string | null;
737
+
738
+ /**
739
+ * Lists handover markdown files, sorted by date (newest first).
740
+ * Non-conforming filenames (no YYYY-MM-DD prefix) are appended at end
741
+ * and flagged as naming_convention warnings.
742
+ */
743
+ declare function listHandovers(handoversDir: string, root: string, warnings: LoadWarning[]): Promise<string[]>;
744
+ /** Reads the content of a handover markdown file. */
745
+ declare function readHandover(handoversDir: string, filename: string): Promise<string>;
746
+ /**
747
+ * Extracts the YYYY-MM-DD date prefix from a handover filename.
748
+ * Returns the date string or null if the filename does not conform.
749
+ */
750
+ declare function extractHandoverDate(filename: string): string | null;
751
+
752
+ interface UmbrellaProgress {
753
+ readonly total: number;
754
+ readonly complete: number;
755
+ readonly status: PhaseStatus;
756
+ }
757
+ interface UnblockImpact {
758
+ readonly ticketId: string;
759
+ readonly wouldUnblock: readonly Ticket[];
760
+ }
761
+ interface NextTicketResult {
762
+ readonly kind: "found";
763
+ readonly ticket: Ticket;
764
+ readonly unblockImpact: UnblockImpact;
765
+ readonly umbrellaProgress: UmbrellaProgress | null;
766
+ }
767
+ interface NextTicketAllComplete {
768
+ readonly kind: "all_complete";
769
+ }
770
+ interface NextTicketAllBlocked {
771
+ readonly kind: "all_blocked";
772
+ readonly phaseId: string;
773
+ readonly blockedCount: number;
774
+ }
775
+ interface NextTicketEmpty {
776
+ readonly kind: "empty_project";
777
+ }
778
+ type NextTicketOutcome = NextTicketResult | NextTicketAllComplete | NextTicketAllBlocked | NextTicketEmpty;
779
+ interface NextTicketCandidate {
780
+ readonly ticket: Ticket;
781
+ readonly unblockImpact: UnblockImpact;
782
+ readonly umbrellaProgress: UmbrellaProgress | null;
783
+ }
784
+ interface SkippedBlockedPhase {
785
+ readonly phaseId: string;
786
+ readonly blockedCount: number;
787
+ }
788
+ interface NextTicketsResult {
789
+ readonly kind: "found";
790
+ readonly candidates: readonly NextTicketCandidate[];
791
+ readonly skippedBlockedPhases: readonly SkippedBlockedPhase[];
792
+ }
793
+ interface NextTicketsAllBlocked {
794
+ readonly kind: "all_blocked";
795
+ readonly phases: readonly SkippedBlockedPhase[];
796
+ }
797
+ type NextTicketsOutcome = NextTicketsResult | NextTicketsAllBlocked | NextTicketAllComplete | NextTicketEmpty;
798
+ interface PhaseWithStatus {
799
+ readonly phase: Phase;
800
+ readonly status: PhaseStatus;
801
+ readonly leafCount: number;
802
+ }
803
+ /**
804
+ * First non-complete, unblocked leaf ticket in the first non-complete phase
805
+ * (roadmap order). Skips phases with zero leaf tickets.
806
+ * Returns discriminated outcome for exhaustive handling.
807
+ */
808
+ declare function nextTicket(state: ProjectState): NextTicketOutcome;
809
+ /**
810
+ * Up to `count` unblocked leaf tickets across all non-complete phases
811
+ * (roadmap order). Unlike nextTicket, continues past fully-blocked phases
812
+ * and collects multiple candidates within the same phase.
813
+ */
814
+ declare function nextTickets(state: ProjectState, count: number): NextTicketsOutcome;
815
+ /**
816
+ * All currently blocked incomplete leaf tickets.
817
+ */
818
+ declare function blockedTickets(state: ProjectState): readonly Ticket[];
819
+ /**
820
+ * Tickets that would become unblocked if ticketId were completed.
821
+ * Direct unblocking only — no transitive chains.
822
+ */
823
+ declare function ticketsUnblockedBy(ticketId: string, state: ProjectState): readonly Ticket[];
824
+ /**
825
+ * Progress of an umbrella's descendant leaves.
826
+ * Returns null if ticketId is not an umbrella.
827
+ */
828
+ declare function umbrellaProgress(ticketId: string, state: ProjectState): UmbrellaProgress | null;
829
+ /**
830
+ * First phase in roadmap order that is not complete and has leaf tickets.
831
+ */
832
+ declare function currentPhase(state: ProjectState): Phase | null;
833
+ /**
834
+ * All roadmap phases with their derived status and leaf count.
835
+ */
836
+ declare function phasesWithStatus(state: ProjectState): readonly PhaseWithStatus[];
837
+ /**
838
+ * Normalizes blocker cleared state across legacy and new formats.
839
+ * Legacy: cleared boolean. New: clearedDate non-null.
840
+ */
841
+ declare function isBlockerCleared(blocker: Blocker): boolean;
842
+ /**
843
+ * All descendant leaf tickets of an umbrella (recursive).
844
+ * Public wrapper around the private cycle-safe helper.
845
+ */
846
+ declare function descendantLeaves(ticketId: string, state: ProjectState): Ticket[];
847
+
848
+ /**
849
+ * Context-aware work recommendation engine.
850
+ *
851
+ * Unlike nextTicket (queue-based, phase order), recommend considers the full
852
+ * project state and suggests a ranked list mixing tickets and issues, each
853
+ * with a human-readable rationale.
854
+ */
855
+
856
+ type RecommendCategory = "validation_errors" | "critical_issue" | "inprogress_ticket" | "high_impact_unblock" | "near_complete_umbrella" | "phase_momentum" | "quick_win" | "open_issue" | "handover_context" | "debt_trend";
857
+ /** Optional inputs for handover context (ISS-018) and debt trend (ISS-019). */
858
+ interface RecommendOptions {
859
+ /** Content of the most recent handover file. */
860
+ readonly latestHandoverContent?: string;
861
+ /** Number of open issues in the previous snapshot. */
862
+ readonly previousOpenIssueCount?: number;
863
+ }
864
+ type RecommendItemKind = "ticket" | "issue" | "action";
865
+ interface Recommendation {
866
+ readonly id: string;
867
+ readonly kind: RecommendItemKind;
868
+ readonly title: string;
869
+ readonly category: RecommendCategory;
870
+ readonly reason: string;
871
+ readonly score: number;
872
+ }
873
+ interface RecommendResult {
874
+ readonly recommendations: readonly Recommendation[];
875
+ readonly totalCandidates: number;
876
+ }
877
+ declare function recommend(state: ProjectState, count: number, options?: RecommendOptions): RecommendResult;
878
+
879
+ /**
880
+ * Next ticket ID: scan existing IDs, find max numeric part, return T-(max+1).
881
+ * Zero-padded to 3 digits minimum. Handles suffixed IDs (T-077a → numeric 77).
882
+ * Malformed IDs (not matching TICKET_ID_REGEX) are silently skipped.
883
+ */
884
+ declare function nextTicketID(tickets: readonly Ticket[]): string;
885
+ /**
886
+ * Next issue ID: scan existing IDs, find max numeric part, return ISS-(max+1).
887
+ * Zero-padded to 3 digits minimum.
888
+ */
889
+ declare function nextIssueID(issues: readonly Issue[]): string;
890
+ /**
891
+ * Next note ID: scan existing IDs, find max numeric part, return N-(max+1).
892
+ * Zero-padded to 3 digits minimum.
893
+ */
894
+ declare function nextNoteID(notes: readonly Note[]): string;
895
+ /**
896
+ * Next order value for a phase: max leaf ticket order + 10, or 10 if empty.
897
+ */
898
+ declare function nextOrder(phaseId: string | null, state: ProjectState): number;
899
+
900
+ type ValidationLevel = "error" | "warning" | "info";
901
+ interface ValidationFinding {
902
+ readonly level: ValidationLevel;
903
+ readonly code: string;
904
+ readonly message: string;
905
+ readonly entity: string | null;
906
+ }
907
+ interface ValidationResult {
908
+ readonly valid: boolean;
909
+ readonly errorCount: number;
910
+ readonly warningCount: number;
911
+ readonly infoCount: number;
912
+ readonly findings: readonly ValidationFinding[];
913
+ }
914
+ /**
915
+ * Validates a fully loaded ProjectState for reference integrity.
916
+ * Pure function — no I/O. Returns structured findings, never throws.
917
+ */
918
+ declare function validateProject(state: ProjectState): ValidationResult;
919
+ /**
920
+ * Merges LoadResult.warnings into a ValidationResult.
921
+ * parse_error/schema_error → error level. naming_convention → info level.
922
+ */
923
+ declare function mergeValidation(result: ValidationResult, loaderWarnings: readonly LoadWarning[]): ValidationResult;
924
+
925
+ interface InitOptions {
926
+ name: string;
927
+ force?: boolean;
928
+ type?: string;
929
+ language?: string;
930
+ phases?: Phase[];
931
+ }
932
+ interface InitResult {
933
+ readonly root: string;
934
+ readonly created: readonly string[];
935
+ readonly warnings: readonly string[];
936
+ }
937
+ /**
938
+ * Scaffolds a new .story/ directory structure.
939
+ * Refuses if .story/ already exists unless force is true.
940
+ * Force mode overwrites config.json + roadmap.json only — preserves existing data files.
941
+ */
942
+ declare function initProject(root: string, options: InitOptions): Promise<InitResult>;
943
+
944
+ declare const SnapshotV1Schema: z.ZodObject<{
945
+ version: z.ZodLiteral<1>;
946
+ createdAt: z.ZodString;
947
+ project: z.ZodString;
948
+ config: z.ZodObject<{
949
+ version: z.ZodNumber;
950
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
951
+ project: z.ZodString;
952
+ type: z.ZodString;
953
+ language: z.ZodString;
954
+ features: z.ZodObject<{
955
+ tickets: z.ZodBoolean;
956
+ issues: z.ZodBoolean;
957
+ handovers: z.ZodBoolean;
958
+ roadmap: z.ZodBoolean;
959
+ reviews: z.ZodBoolean;
960
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
961
+ tickets: z.ZodBoolean;
962
+ issues: z.ZodBoolean;
963
+ handovers: z.ZodBoolean;
964
+ roadmap: z.ZodBoolean;
965
+ reviews: z.ZodBoolean;
966
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
967
+ tickets: z.ZodBoolean;
968
+ issues: z.ZodBoolean;
969
+ handovers: z.ZodBoolean;
970
+ roadmap: z.ZodBoolean;
971
+ reviews: z.ZodBoolean;
972
+ }, z.ZodTypeAny, "passthrough">>;
973
+ recipe: z.ZodOptional<z.ZodString>;
974
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
975
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
976
+ compactThreshold: z.ZodOptional<z.ZodString>;
977
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
978
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
979
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
980
+ }, "strip", z.ZodTypeAny, {
981
+ maxTicketsPerSession?: number | undefined;
982
+ compactThreshold?: string | undefined;
983
+ reviewBackends?: string[] | undefined;
984
+ handoverInterval?: number | undefined;
985
+ stages?: Record<string, Record<string, unknown>> | undefined;
986
+ }, {
987
+ maxTicketsPerSession?: number | undefined;
988
+ compactThreshold?: string | undefined;
989
+ reviewBackends?: string[] | undefined;
990
+ handoverInterval?: number | undefined;
991
+ stages?: Record<string, Record<string, unknown>> | undefined;
992
+ }>>;
993
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
994
+ version: z.ZodNumber;
995
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
996
+ project: z.ZodString;
997
+ type: z.ZodString;
998
+ language: z.ZodString;
999
+ features: z.ZodObject<{
1000
+ tickets: z.ZodBoolean;
1001
+ issues: z.ZodBoolean;
1002
+ handovers: z.ZodBoolean;
1003
+ roadmap: z.ZodBoolean;
1004
+ reviews: z.ZodBoolean;
1005
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1006
+ tickets: z.ZodBoolean;
1007
+ issues: z.ZodBoolean;
1008
+ handovers: z.ZodBoolean;
1009
+ roadmap: z.ZodBoolean;
1010
+ reviews: z.ZodBoolean;
1011
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1012
+ tickets: z.ZodBoolean;
1013
+ issues: z.ZodBoolean;
1014
+ handovers: z.ZodBoolean;
1015
+ roadmap: z.ZodBoolean;
1016
+ reviews: z.ZodBoolean;
1017
+ }, z.ZodTypeAny, "passthrough">>;
1018
+ recipe: z.ZodOptional<z.ZodString>;
1019
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
1020
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
1021
+ compactThreshold: z.ZodOptional<z.ZodString>;
1022
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1023
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
1024
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1025
+ }, "strip", z.ZodTypeAny, {
1026
+ maxTicketsPerSession?: number | undefined;
1027
+ compactThreshold?: string | undefined;
1028
+ reviewBackends?: string[] | undefined;
1029
+ handoverInterval?: number | undefined;
1030
+ stages?: Record<string, Record<string, unknown>> | undefined;
1031
+ }, {
1032
+ maxTicketsPerSession?: number | undefined;
1033
+ compactThreshold?: string | undefined;
1034
+ reviewBackends?: string[] | undefined;
1035
+ handoverInterval?: number | undefined;
1036
+ stages?: Record<string, Record<string, unknown>> | undefined;
1037
+ }>>;
1038
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1039
+ version: z.ZodNumber;
1040
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
1041
+ project: z.ZodString;
1042
+ type: z.ZodString;
1043
+ language: z.ZodString;
1044
+ features: z.ZodObject<{
1045
+ tickets: z.ZodBoolean;
1046
+ issues: z.ZodBoolean;
1047
+ handovers: z.ZodBoolean;
1048
+ roadmap: z.ZodBoolean;
1049
+ reviews: z.ZodBoolean;
1050
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1051
+ tickets: z.ZodBoolean;
1052
+ issues: z.ZodBoolean;
1053
+ handovers: z.ZodBoolean;
1054
+ roadmap: z.ZodBoolean;
1055
+ reviews: z.ZodBoolean;
1056
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1057
+ tickets: z.ZodBoolean;
1058
+ issues: z.ZodBoolean;
1059
+ handovers: z.ZodBoolean;
1060
+ roadmap: z.ZodBoolean;
1061
+ reviews: z.ZodBoolean;
1062
+ }, z.ZodTypeAny, "passthrough">>;
1063
+ recipe: z.ZodOptional<z.ZodString>;
1064
+ recipeOverrides: z.ZodOptional<z.ZodObject<{
1065
+ maxTicketsPerSession: z.ZodOptional<z.ZodNumber>;
1066
+ compactThreshold: z.ZodOptional<z.ZodString>;
1067
+ reviewBackends: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1068
+ handoverInterval: z.ZodOptional<z.ZodNumber>;
1069
+ stages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
1070
+ }, "strip", z.ZodTypeAny, {
1071
+ maxTicketsPerSession?: number | undefined;
1072
+ compactThreshold?: string | undefined;
1073
+ reviewBackends?: string[] | undefined;
1074
+ handoverInterval?: number | undefined;
1075
+ stages?: Record<string, Record<string, unknown>> | undefined;
1076
+ }, {
1077
+ maxTicketsPerSession?: number | undefined;
1078
+ compactThreshold?: string | undefined;
1079
+ reviewBackends?: string[] | undefined;
1080
+ handoverInterval?: number | undefined;
1081
+ stages?: Record<string, Record<string, unknown>> | undefined;
1082
+ }>>;
1083
+ }, z.ZodTypeAny, "passthrough">>;
1084
+ roadmap: z.ZodObject<{
1085
+ title: z.ZodString;
1086
+ date: z.ZodEffects<z.ZodString, string, string>;
1087
+ phases: z.ZodArray<z.ZodObject<{
1088
+ id: z.ZodString;
1089
+ label: z.ZodString;
1090
+ name: z.ZodString;
1091
+ description: z.ZodString;
1092
+ summary: z.ZodOptional<z.ZodString>;
1093
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1094
+ id: z.ZodString;
1095
+ label: z.ZodString;
1096
+ name: z.ZodString;
1097
+ description: z.ZodString;
1098
+ summary: z.ZodOptional<z.ZodString>;
1099
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1100
+ id: z.ZodString;
1101
+ label: z.ZodString;
1102
+ name: z.ZodString;
1103
+ description: z.ZodString;
1104
+ summary: z.ZodOptional<z.ZodString>;
1105
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1106
+ blockers: z.ZodArray<z.ZodObject<{
1107
+ name: z.ZodString;
1108
+ cleared: z.ZodOptional<z.ZodBoolean>;
1109
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1110
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1111
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1112
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1113
+ name: z.ZodString;
1114
+ cleared: z.ZodOptional<z.ZodBoolean>;
1115
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1116
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1117
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1118
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1119
+ name: z.ZodString;
1120
+ cleared: z.ZodOptional<z.ZodBoolean>;
1121
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1122
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1123
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1124
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1125
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1126
+ title: z.ZodString;
1127
+ date: z.ZodEffects<z.ZodString, string, string>;
1128
+ phases: z.ZodArray<z.ZodObject<{
1129
+ id: z.ZodString;
1130
+ label: z.ZodString;
1131
+ name: z.ZodString;
1132
+ description: z.ZodString;
1133
+ summary: z.ZodOptional<z.ZodString>;
1134
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1135
+ id: z.ZodString;
1136
+ label: z.ZodString;
1137
+ name: z.ZodString;
1138
+ description: z.ZodString;
1139
+ summary: z.ZodOptional<z.ZodString>;
1140
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1141
+ id: z.ZodString;
1142
+ label: z.ZodString;
1143
+ name: z.ZodString;
1144
+ description: z.ZodString;
1145
+ summary: z.ZodOptional<z.ZodString>;
1146
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1147
+ blockers: z.ZodArray<z.ZodObject<{
1148
+ name: z.ZodString;
1149
+ cleared: z.ZodOptional<z.ZodBoolean>;
1150
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1151
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1152
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1153
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1154
+ name: z.ZodString;
1155
+ cleared: z.ZodOptional<z.ZodBoolean>;
1156
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1157
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1158
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1159
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1160
+ name: z.ZodString;
1161
+ cleared: z.ZodOptional<z.ZodBoolean>;
1162
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1163
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1164
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1165
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1166
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1167
+ title: z.ZodString;
1168
+ date: z.ZodEffects<z.ZodString, string, string>;
1169
+ phases: z.ZodArray<z.ZodObject<{
1170
+ id: z.ZodString;
1171
+ label: z.ZodString;
1172
+ name: z.ZodString;
1173
+ description: z.ZodString;
1174
+ summary: z.ZodOptional<z.ZodString>;
1175
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1176
+ id: z.ZodString;
1177
+ label: z.ZodString;
1178
+ name: z.ZodString;
1179
+ description: z.ZodString;
1180
+ summary: z.ZodOptional<z.ZodString>;
1181
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1182
+ id: z.ZodString;
1183
+ label: z.ZodString;
1184
+ name: z.ZodString;
1185
+ description: z.ZodString;
1186
+ summary: z.ZodOptional<z.ZodString>;
1187
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1188
+ blockers: z.ZodArray<z.ZodObject<{
1189
+ name: z.ZodString;
1190
+ cleared: z.ZodOptional<z.ZodBoolean>;
1191
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1192
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1193
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1194
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1195
+ name: z.ZodString;
1196
+ cleared: z.ZodOptional<z.ZodBoolean>;
1197
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1198
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1199
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1200
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1201
+ name: z.ZodString;
1202
+ cleared: z.ZodOptional<z.ZodBoolean>;
1203
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1204
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1205
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1206
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1207
+ }, z.ZodTypeAny, "passthrough">>;
1208
+ tickets: z.ZodArray<z.ZodObject<{
1209
+ id: z.ZodString;
1210
+ title: z.ZodString;
1211
+ description: z.ZodString;
1212
+ type: z.ZodEnum<["task", "feature", "chore"]>;
1213
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
1214
+ phase: z.ZodNullable<z.ZodString>;
1215
+ order: z.ZodNumber;
1216
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1217
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1218
+ blockedBy: z.ZodArray<z.ZodString, "many">;
1219
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1220
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1221
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1222
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1223
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1224
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1225
+ id: z.ZodString;
1226
+ title: z.ZodString;
1227
+ description: z.ZodString;
1228
+ type: z.ZodEnum<["task", "feature", "chore"]>;
1229
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
1230
+ phase: z.ZodNullable<z.ZodString>;
1231
+ order: z.ZodNumber;
1232
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1233
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1234
+ blockedBy: z.ZodArray<z.ZodString, "many">;
1235
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1236
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1237
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1238
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1239
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1240
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1241
+ id: z.ZodString;
1242
+ title: z.ZodString;
1243
+ description: z.ZodString;
1244
+ type: z.ZodEnum<["task", "feature", "chore"]>;
1245
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
1246
+ phase: z.ZodNullable<z.ZodString>;
1247
+ order: z.ZodNumber;
1248
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1249
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1250
+ blockedBy: z.ZodArray<z.ZodString, "many">;
1251
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1252
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1253
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1254
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1255
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1256
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1257
+ issues: z.ZodArray<z.ZodObject<{
1258
+ id: z.ZodString;
1259
+ title: z.ZodString;
1260
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
1261
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
1262
+ components: z.ZodArray<z.ZodString, "many">;
1263
+ impact: z.ZodString;
1264
+ resolution: z.ZodNullable<z.ZodString>;
1265
+ location: z.ZodArray<z.ZodString, "many">;
1266
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
1267
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1268
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
1269
+ order: z.ZodOptional<z.ZodNumber>;
1270
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1271
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1272
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1273
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1274
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1275
+ id: z.ZodString;
1276
+ title: z.ZodString;
1277
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
1278
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
1279
+ components: z.ZodArray<z.ZodString, "many">;
1280
+ impact: z.ZodString;
1281
+ resolution: z.ZodNullable<z.ZodString>;
1282
+ location: z.ZodArray<z.ZodString, "many">;
1283
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
1284
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1285
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
1286
+ order: z.ZodOptional<z.ZodNumber>;
1287
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1288
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1289
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1290
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1291
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1292
+ id: z.ZodString;
1293
+ title: z.ZodString;
1294
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
1295
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
1296
+ components: z.ZodArray<z.ZodString, "many">;
1297
+ impact: z.ZodString;
1298
+ resolution: z.ZodNullable<z.ZodString>;
1299
+ location: z.ZodArray<z.ZodString, "many">;
1300
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
1301
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1302
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
1303
+ order: z.ZodOptional<z.ZodNumber>;
1304
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1305
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1306
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1307
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1308
+ }, z.ZodTypeAny, "passthrough">>, "many">;
1309
+ notes: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
1310
+ id: z.ZodString;
1311
+ title: z.ZodNullable<z.ZodString>;
1312
+ content: z.ZodEffects<z.ZodString, string, string>;
1313
+ tags: z.ZodArray<z.ZodString, "many">;
1314
+ status: z.ZodEnum<["active", "archived"]>;
1315
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1316
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1317
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1318
+ id: z.ZodString;
1319
+ title: z.ZodNullable<z.ZodString>;
1320
+ content: z.ZodEffects<z.ZodString, string, string>;
1321
+ tags: z.ZodArray<z.ZodString, "many">;
1322
+ status: z.ZodEnum<["active", "archived"]>;
1323
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1324
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1325
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1326
+ id: z.ZodString;
1327
+ title: z.ZodNullable<z.ZodString>;
1328
+ content: z.ZodEffects<z.ZodString, string, string>;
1329
+ tags: z.ZodArray<z.ZodString, "many">;
1330
+ status: z.ZodEnum<["active", "archived"]>;
1331
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1332
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1333
+ }, z.ZodTypeAny, "passthrough">>, "many">>>;
1334
+ lessons: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
1335
+ id: z.ZodString;
1336
+ title: z.ZodString;
1337
+ content: z.ZodEffects<z.ZodString, string, string>;
1338
+ context: z.ZodString;
1339
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
1340
+ tags: z.ZodArray<z.ZodString, "many">;
1341
+ reinforcements: z.ZodNumber;
1342
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
1343
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1344
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1345
+ supersedes: z.ZodNullable<z.ZodString>;
1346
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
1347
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1348
+ id: z.ZodString;
1349
+ title: z.ZodString;
1350
+ content: z.ZodEffects<z.ZodString, string, string>;
1351
+ context: z.ZodString;
1352
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
1353
+ tags: z.ZodArray<z.ZodString, "many">;
1354
+ reinforcements: z.ZodNumber;
1355
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
1356
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1357
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1358
+ supersedes: z.ZodNullable<z.ZodString>;
1359
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
1360
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1361
+ id: z.ZodString;
1362
+ title: z.ZodString;
1363
+ content: z.ZodEffects<z.ZodString, string, string>;
1364
+ context: z.ZodString;
1365
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
1366
+ tags: z.ZodArray<z.ZodString, "many">;
1367
+ reinforcements: z.ZodNumber;
1368
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
1369
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1370
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1371
+ supersedes: z.ZodNullable<z.ZodString>;
1372
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
1373
+ }, z.ZodTypeAny, "passthrough">>, "many">>>;
1374
+ handoverFilenames: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
1375
+ warnings: z.ZodOptional<z.ZodArray<z.ZodObject<{
1376
+ type: z.ZodString;
1377
+ file: z.ZodString;
1378
+ message: z.ZodString;
1379
+ }, "strip", z.ZodTypeAny, {
1380
+ message: string;
1381
+ type: string;
1382
+ file: string;
1383
+ }, {
1384
+ message: string;
1385
+ type: string;
1386
+ file: string;
1387
+ }>, "many">>;
1388
+ }, "strip", z.ZodTypeAny, {
1389
+ issues: z.objectOutputType<{
1390
+ id: z.ZodString;
1391
+ title: z.ZodString;
1392
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
1393
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
1394
+ components: z.ZodArray<z.ZodString, "many">;
1395
+ impact: z.ZodString;
1396
+ resolution: z.ZodNullable<z.ZodString>;
1397
+ location: z.ZodArray<z.ZodString, "many">;
1398
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
1399
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1400
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
1401
+ order: z.ZodOptional<z.ZodNumber>;
1402
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1403
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1404
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1405
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1406
+ }, z.ZodTypeAny, "passthrough">[];
1407
+ tickets: z.objectOutputType<{
1408
+ id: z.ZodString;
1409
+ title: z.ZodString;
1410
+ description: z.ZodString;
1411
+ type: z.ZodEnum<["task", "feature", "chore"]>;
1412
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
1413
+ phase: z.ZodNullable<z.ZodString>;
1414
+ order: z.ZodNumber;
1415
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1416
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1417
+ blockedBy: z.ZodArray<z.ZodString, "many">;
1418
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1419
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1420
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1421
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1422
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1423
+ }, z.ZodTypeAny, "passthrough">[];
1424
+ roadmap: {
1425
+ title: string;
1426
+ date: string;
1427
+ phases: z.objectOutputType<{
1428
+ id: z.ZodString;
1429
+ label: z.ZodString;
1430
+ name: z.ZodString;
1431
+ description: z.ZodString;
1432
+ summary: z.ZodOptional<z.ZodString>;
1433
+ }, z.ZodTypeAny, "passthrough">[];
1434
+ blockers: z.objectOutputType<{
1435
+ name: z.ZodString;
1436
+ cleared: z.ZodOptional<z.ZodBoolean>;
1437
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1438
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1439
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1440
+ }, z.ZodTypeAny, "passthrough">[];
1441
+ } & {
1442
+ [k: string]: unknown;
1443
+ };
1444
+ version: 1;
1445
+ project: string;
1446
+ notes: z.objectOutputType<{
1447
+ id: z.ZodString;
1448
+ title: z.ZodNullable<z.ZodString>;
1449
+ content: z.ZodEffects<z.ZodString, string, string>;
1450
+ tags: z.ZodArray<z.ZodString, "many">;
1451
+ status: z.ZodEnum<["active", "archived"]>;
1452
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1453
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1454
+ }, z.ZodTypeAny, "passthrough">[];
1455
+ lessons: z.objectOutputType<{
1456
+ id: z.ZodString;
1457
+ title: z.ZodString;
1458
+ content: z.ZodEffects<z.ZodString, string, string>;
1459
+ context: z.ZodString;
1460
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
1461
+ tags: z.ZodArray<z.ZodString, "many">;
1462
+ reinforcements: z.ZodNumber;
1463
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
1464
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1465
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1466
+ supersedes: z.ZodNullable<z.ZodString>;
1467
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
1468
+ }, z.ZodTypeAny, "passthrough">[];
1469
+ createdAt: string;
1470
+ config: {
1471
+ type: string;
1472
+ version: number;
1473
+ project: string;
1474
+ language: string;
1475
+ features: {
1476
+ issues: boolean;
1477
+ tickets: boolean;
1478
+ handovers: boolean;
1479
+ roadmap: boolean;
1480
+ reviews: boolean;
1481
+ } & {
1482
+ [k: string]: unknown;
1483
+ };
1484
+ schemaVersion?: number | undefined;
1485
+ recipe?: string | undefined;
1486
+ recipeOverrides?: {
1487
+ maxTicketsPerSession?: number | undefined;
1488
+ compactThreshold?: string | undefined;
1489
+ reviewBackends?: string[] | undefined;
1490
+ handoverInterval?: number | undefined;
1491
+ stages?: Record<string, Record<string, unknown>> | undefined;
1492
+ } | undefined;
1493
+ } & {
1494
+ [k: string]: unknown;
1495
+ };
1496
+ handoverFilenames: string[];
1497
+ warnings?: {
1498
+ message: string;
1499
+ type: string;
1500
+ file: string;
1501
+ }[] | undefined;
1502
+ }, {
1503
+ issues: z.objectInputType<{
1504
+ id: z.ZodString;
1505
+ title: z.ZodString;
1506
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
1507
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
1508
+ components: z.ZodArray<z.ZodString, "many">;
1509
+ impact: z.ZodString;
1510
+ resolution: z.ZodNullable<z.ZodString>;
1511
+ location: z.ZodArray<z.ZodString, "many">;
1512
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
1513
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1514
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
1515
+ order: z.ZodOptional<z.ZodNumber>;
1516
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1517
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1518
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1519
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1520
+ }, z.ZodTypeAny, "passthrough">[];
1521
+ tickets: z.objectInputType<{
1522
+ id: z.ZodString;
1523
+ title: z.ZodString;
1524
+ description: z.ZodString;
1525
+ type: z.ZodEnum<["task", "feature", "chore"]>;
1526
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
1527
+ phase: z.ZodNullable<z.ZodString>;
1528
+ order: z.ZodNumber;
1529
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1530
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
1531
+ blockedBy: z.ZodArray<z.ZodString, "many">;
1532
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1533
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1534
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1535
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1536
+ claimedBySession: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1537
+ }, z.ZodTypeAny, "passthrough">[];
1538
+ roadmap: {
1539
+ title: string;
1540
+ date: string;
1541
+ phases: z.objectInputType<{
1542
+ id: z.ZodString;
1543
+ label: z.ZodString;
1544
+ name: z.ZodString;
1545
+ description: z.ZodString;
1546
+ summary: z.ZodOptional<z.ZodString>;
1547
+ }, z.ZodTypeAny, "passthrough">[];
1548
+ blockers: z.objectInputType<{
1549
+ name: z.ZodString;
1550
+ cleared: z.ZodOptional<z.ZodBoolean>;
1551
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
1552
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
1553
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1554
+ }, z.ZodTypeAny, "passthrough">[];
1555
+ } & {
1556
+ [k: string]: unknown;
1557
+ };
1558
+ version: 1;
1559
+ project: string;
1560
+ createdAt: string;
1561
+ config: {
1562
+ type: string;
1563
+ version: number;
1564
+ project: string;
1565
+ language: string;
1566
+ features: {
1567
+ issues: boolean;
1568
+ tickets: boolean;
1569
+ handovers: boolean;
1570
+ roadmap: boolean;
1571
+ reviews: boolean;
1572
+ } & {
1573
+ [k: string]: unknown;
1574
+ };
1575
+ schemaVersion?: number | undefined;
1576
+ recipe?: string | undefined;
1577
+ recipeOverrides?: {
1578
+ maxTicketsPerSession?: number | undefined;
1579
+ compactThreshold?: string | undefined;
1580
+ reviewBackends?: string[] | undefined;
1581
+ handoverInterval?: number | undefined;
1582
+ stages?: Record<string, Record<string, unknown>> | undefined;
1583
+ } | undefined;
1584
+ } & {
1585
+ [k: string]: unknown;
1586
+ };
1587
+ notes?: z.objectInputType<{
1588
+ id: z.ZodString;
1589
+ title: z.ZodNullable<z.ZodString>;
1590
+ content: z.ZodEffects<z.ZodString, string, string>;
1591
+ tags: z.ZodArray<z.ZodString, "many">;
1592
+ status: z.ZodEnum<["active", "archived"]>;
1593
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1594
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1595
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1596
+ lessons?: z.objectInputType<{
1597
+ id: z.ZodString;
1598
+ title: z.ZodString;
1599
+ content: z.ZodEffects<z.ZodString, string, string>;
1600
+ context: z.ZodString;
1601
+ source: z.ZodEnum<["review", "correction", "postmortem", "manual"]>;
1602
+ tags: z.ZodArray<z.ZodString, "many">;
1603
+ reinforcements: z.ZodNumber;
1604
+ lastValidated: z.ZodEffects<z.ZodString, string, string>;
1605
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
1606
+ updatedDate: z.ZodEffects<z.ZodString, string, string>;
1607
+ supersedes: z.ZodNullable<z.ZodString>;
1608
+ status: z.ZodEnum<["active", "deprecated", "superseded"]>;
1609
+ }, z.ZodTypeAny, "passthrough">[] | undefined;
1610
+ warnings?: {
1611
+ message: string;
1612
+ type: string;
1613
+ file: string;
1614
+ }[] | undefined;
1615
+ handoverFilenames?: string[] | undefined;
1616
+ }>;
1617
+ type SnapshotV1 = z.infer<typeof SnapshotV1Schema>;
1618
+ /**
1619
+ * Creates a snapshot from the current project state.
1620
+ * Call inside withProjectLock for atomicity.
1621
+ * Returns the filename and prune count.
1622
+ */
1623
+ declare function saveSnapshot(root: string, loadResult: LoadResult): Promise<{
1624
+ filename: string;
1625
+ retained: number;
1626
+ pruned: number;
1627
+ }>;
1628
+ /**
1629
+ * Loads the latest valid snapshot from .story/snapshots/.
1630
+ * Scans in descending filename order, returns first valid file.
1631
+ * Returns null if no valid snapshots found.
1632
+ */
1633
+ declare function loadLatestSnapshot(root: string): Promise<{
1634
+ snapshot: SnapshotV1;
1635
+ filename: string;
1636
+ } | null>;
1637
+ interface TicketChange {
1638
+ id: string;
1639
+ title: string;
1640
+ from: string;
1641
+ to: string;
1642
+ }
1643
+ interface IssueChange {
1644
+ id: string;
1645
+ title: string;
1646
+ from: string;
1647
+ to: string;
1648
+ }
1649
+ interface PhaseChange {
1650
+ id: string;
1651
+ name: string;
1652
+ from: string;
1653
+ to: string;
1654
+ }
1655
+ interface ContentChange {
1656
+ id: string;
1657
+ title: string;
1658
+ }
1659
+ interface NoteChange {
1660
+ id: string;
1661
+ title: string | null;
1662
+ changedFields: string[];
1663
+ }
1664
+ interface LessonChange {
1665
+ id: string;
1666
+ title: string;
1667
+ changedFields: string[];
1668
+ }
1669
+ interface SnapshotDiff {
1670
+ tickets: {
1671
+ added: Array<{
1672
+ id: string;
1673
+ title: string;
1674
+ }>;
1675
+ removed: Array<{
1676
+ id: string;
1677
+ title: string;
1678
+ }>;
1679
+ statusChanged: TicketChange[];
1680
+ descriptionChanged: ContentChange[];
1681
+ };
1682
+ issues: {
1683
+ added: Array<{
1684
+ id: string;
1685
+ title: string;
1686
+ }>;
1687
+ resolved: Array<{
1688
+ id: string;
1689
+ title: string;
1690
+ }>;
1691
+ statusChanged: IssueChange[];
1692
+ impactChanged: ContentChange[];
1693
+ };
1694
+ blockers: {
1695
+ added: string[];
1696
+ cleared: string[];
1697
+ };
1698
+ phases: {
1699
+ added: Array<{
1700
+ id: string;
1701
+ name: string;
1702
+ }>;
1703
+ removed: Array<{
1704
+ id: string;
1705
+ name: string;
1706
+ }>;
1707
+ statusChanged: PhaseChange[];
1708
+ };
1709
+ notes: {
1710
+ added: Array<{
1711
+ id: string;
1712
+ title: string | null;
1713
+ }>;
1714
+ removed: Array<{
1715
+ id: string;
1716
+ title: string | null;
1717
+ }>;
1718
+ updated: NoteChange[];
1719
+ };
1720
+ lessons: {
1721
+ added: Array<{
1722
+ id: string;
1723
+ title: string;
1724
+ }>;
1725
+ removed: Array<{
1726
+ id: string;
1727
+ title: string;
1728
+ }>;
1729
+ updated: LessonChange[];
1730
+ reinforced: Array<{
1731
+ id: string;
1732
+ title: string;
1733
+ from: number;
1734
+ to: number;
1735
+ }>;
1736
+ };
1737
+ handovers: {
1738
+ added: string[];
1739
+ removed: string[];
1740
+ };
1741
+ }
1742
+ interface RecapResult {
1743
+ snapshot: {
1744
+ filename: string;
1745
+ createdAt: string;
1746
+ } | null;
1747
+ changes: SnapshotDiff | null;
1748
+ suggestedActions: {
1749
+ nextTicket: {
1750
+ id: string;
1751
+ title: string;
1752
+ phase: string | null;
1753
+ } | null;
1754
+ highSeverityIssues: Array<{
1755
+ id: string;
1756
+ title: string;
1757
+ severity: string;
1758
+ }>;
1759
+ recentlyClearedBlockers: string[];
1760
+ };
1761
+ partial: boolean;
1762
+ }
1763
+ /**
1764
+ * Computes the diff between a snapshot state and the current state.
1765
+ */
1766
+ declare function diffStates(snapshotState: ProjectState, currentState: ProjectState): SnapshotDiff;
1767
+ /**
1768
+ * Builds a full RecapResult: diff + suggested actions.
1769
+ */
1770
+ declare function buildRecap(currentState: ProjectState, snapshotInfo: {
1771
+ snapshot: SnapshotV1;
1772
+ filename: string;
1773
+ } | null): RecapResult;
1774
+
1775
+ interface ActiveSessionSummary {
1776
+ readonly sessionId: string;
1777
+ readonly state: string;
1778
+ readonly mode: string;
1779
+ readonly ticketId: string | null;
1780
+ readonly ticketTitle: string | null;
1781
+ }
1782
+
1783
+ /** SKILL PROTOCOL: SKILL.md Step 2b matches this literal string. Do not change without updating SKILL.md. */
1784
+ declare const EMPTY_SCAFFOLD_HEADING = "## Getting Started";
1785
+ declare const ExitCode: {
1786
+ readonly OK: 0;
1787
+ readonly USER_ERROR: 1;
1788
+ readonly VALIDATION_ERROR: 2;
1789
+ readonly PARTIAL: 3;
1790
+ };
1791
+ type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode];
1792
+ interface SuccessEnvelope<T> {
1793
+ readonly version: 1;
1794
+ readonly data: T;
1795
+ }
1796
+ interface ErrorEnvelope {
1797
+ readonly version: 1;
1798
+ readonly error: {
1799
+ readonly code: ErrorCode;
1800
+ readonly message: string;
1801
+ };
1802
+ }
1803
+ interface PartialEnvelope<T> {
1804
+ readonly version: 1;
1805
+ readonly data: T;
1806
+ readonly warnings: readonly {
1807
+ type: string;
1808
+ file: string;
1809
+ message: string;
1810
+ }[];
1811
+ readonly partial: true;
1812
+ }
1813
+ declare function successEnvelope<T>(data: T): SuccessEnvelope<T>;
1814
+ declare function errorEnvelope(code: ErrorCode, message: string): ErrorEnvelope;
1815
+ declare function partialEnvelope<T>(data: T, warnings: readonly LoadWarning[]): PartialEnvelope<T>;
1816
+ /**
1817
+ * Escapes characters that would create Markdown structure in inline text.
1818
+ * Handles heading, list, blockquote, ordered list at line start.
1819
+ * Handles inline structural characters.
1820
+ */
1821
+ declare function escapeMarkdownInline(text: string): string;
1822
+ /**
1823
+ * Wraps multi-line content in a fenced code block.
1824
+ * Uses a fence length longer than any backtick sequence in the content.
1825
+ */
1826
+ declare function fencedBlock(content: string, lang?: string): string;
1827
+ declare function formatStatus(state: ProjectState, format: OutputFormat, activeSessions?: readonly ActiveSessionSummary[]): string;
1828
+ declare function formatPhaseList(state: ProjectState, format: OutputFormat): string;
1829
+ declare function formatPhaseTickets(phaseId: string, state: ProjectState, format: OutputFormat): string;
1830
+ declare function formatTicket(ticket: Ticket, state: ProjectState, format: OutputFormat): string;
1831
+ declare function formatNextTicketOutcome(outcome: NextTicketOutcome, state: ProjectState, format: OutputFormat): string;
1832
+ declare function formatTicketList(tickets: readonly Ticket[], format: OutputFormat): string;
1833
+ declare function formatIssue(issue: Issue, format: OutputFormat): string;
1834
+ declare function formatIssueList(issues: readonly Issue[], format: OutputFormat): string;
1835
+ declare function formatBlockedTickets(tickets: readonly Ticket[], state: ProjectState, format: OutputFormat): string;
1836
+ declare function formatValidation(result: ValidationResult, format: OutputFormat): string;
1837
+ declare function formatBlockerList(roadmap: Roadmap, format: OutputFormat): string;
1838
+ declare function formatError(code: ErrorCode, message: string, format: OutputFormat): string;
1839
+ declare function formatInitResult(result: {
1840
+ root: string;
1841
+ created: readonly string[];
1842
+ warnings: readonly string[];
1843
+ }, format: OutputFormat): string;
1844
+ declare function formatHandoverList(filenames: readonly string[], format: OutputFormat): string;
1845
+ declare function formatHandoverContent(filename: string, content: string, format: OutputFormat): string;
1846
+ declare function formatHandoverCreateResult(filename: string, format: OutputFormat): string;
1847
+
1848
+ declare function formatSnapshotResult(result: {
1849
+ filename: string;
1850
+ retained: number;
1851
+ pruned: number;
1852
+ }, format: OutputFormat): string;
1853
+ declare function formatRecap(recap: RecapResult, state: ProjectState, format: OutputFormat): string;
1854
+ declare function formatExport(state: ProjectState, mode: "all" | "phase", phaseId: string | null, format: OutputFormat): string;
1855
+ declare function formatRecommendations(result: RecommendResult, state: ProjectState, format: OutputFormat): string;
1856
+
1857
+ export { type Blocker, BlockerSchema, CURRENT_SCHEMA_VERSION, type Config, ConfigSchema, DATE_REGEX, DateSchema, EMPTY_SCAFFOLD_HEADING, ERROR_CODES, type ErrorCode, type ErrorEnvelope, ExitCode, type ExitCodeValue, type Features, FeaturesSchema, INTEGRITY_WARNING_TYPES, ISSUE_ID_REGEX, ISSUE_SEVERITIES, ISSUE_STATUSES, type InitOptions, type InitResult, type Issue, IssueIdSchema, IssueSchema, type IssueSeverity, type IssueStatus, type LoadOptions, type LoadResult, type LoadWarning, type LoadWarningType, NOTE_ID_REGEX, NOTE_STATUSES, type NextTicketAllBlocked, type NextTicketAllComplete, type NextTicketEmpty, type NextTicketOutcome, type NextTicketResult, type Note, NoteIdSchema, NoteSchema, type NoteStatus, OUTPUT_FORMATS, type OutputFormat, type PartialEnvelope, type Phase, PhaseSchema, type PhaseStatus, type PhaseWithStatus, ProjectLoaderError, ProjectState, type RecapResult, type RecommendCategory, type RecommendItemKind, type RecommendResult, type Recommendation, type Roadmap, RoadmapSchema, type SnapshotDiff, type SnapshotV1, SnapshotV1Schema, type SuccessEnvelope, TICKET_ID_REGEX, TICKET_STATUSES, TICKET_TYPES, type Ticket, TicketIdSchema, TicketSchema, type TicketStatus, type TicketType, type UmbrellaProgress, type UnblockImpact, type ValidationFinding, type ValidationLevel, type ValidationResult, type WithProjectLockOptions, atomicWrite, blockedTickets, buildRecap, currentPhase, deleteIssue, deleteNote, deleteTicket, descendantLeaves, diffStates, discoverProjectRoot, errorEnvelope, escapeMarkdownInline, extractHandoverDate, fencedBlock, formatBlockedTickets, formatBlockerList, formatError, formatExport, formatHandoverContent, formatHandoverCreateResult, formatHandoverList, formatInitResult, formatIssue, formatIssueList, formatNextTicketOutcome, formatPhaseList, formatPhaseTickets, formatRecap, formatRecommendations, formatSnapshotResult, formatStatus, formatTicket, formatTicketList, formatValidation, guardPath, initProject, isBlockerCleared, listHandovers, loadLatestSnapshot, loadProject, mergeValidation, nextIssueID, nextNoteID, nextOrder, nextTicket, nextTicketID, nextTickets, partialEnvelope, phasesWithStatus, readHandover, recommend, runTransaction, runTransactionUnlocked, saveSnapshot, serializeJSON, sortKeysDeep, successEnvelope, ticketsUnblockedBy, umbrellaProgress, validateProject, withProjectLock, writeConfig, writeIssue, writeIssueUnlocked, writeNote, writeNoteUnlocked, writeRoadmap, writeRoadmapUnlocked, writeTicket, writeTicketUnlocked };