@anthropologies/claudestory 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,769 @@
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
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
19
+ id: z.ZodString;
20
+ title: z.ZodString;
21
+ description: z.ZodString;
22
+ type: z.ZodEnum<["task", "feature", "chore"]>;
23
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
24
+ phase: z.ZodNullable<z.ZodString>;
25
+ order: z.ZodNumber;
26
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
27
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
28
+ blockedBy: z.ZodArray<z.ZodString, "many">;
29
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
34
+ id: z.ZodString;
35
+ title: z.ZodString;
36
+ description: z.ZodString;
37
+ type: z.ZodEnum<["task", "feature", "chore"]>;
38
+ status: z.ZodEnum<["open", "inprogress", "complete"]>;
39
+ phase: z.ZodNullable<z.ZodString>;
40
+ order: z.ZodNumber;
41
+ createdDate: z.ZodEffects<z.ZodString, string, string>;
42
+ completedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
43
+ blockedBy: z.ZodArray<z.ZodString, "many">;
44
+ parentTicket: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ }, z.ZodTypeAny, "passthrough">>;
49
+ type Ticket = z.infer<typeof TicketSchema>;
50
+
51
+ declare const IssueSchema: z.ZodObject<{
52
+ id: z.ZodString;
53
+ title: z.ZodString;
54
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
55
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
56
+ components: z.ZodArray<z.ZodString, "many">;
57
+ impact: z.ZodString;
58
+ resolution: z.ZodNullable<z.ZodString>;
59
+ location: z.ZodArray<z.ZodString, "many">;
60
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
61
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
62
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
63
+ order: z.ZodOptional<z.ZodNumber>;
64
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
69
+ id: z.ZodString;
70
+ title: z.ZodString;
71
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
72
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
73
+ components: z.ZodArray<z.ZodString, "many">;
74
+ impact: z.ZodString;
75
+ resolution: z.ZodNullable<z.ZodString>;
76
+ location: z.ZodArray<z.ZodString, "many">;
77
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
78
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
79
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
80
+ order: z.ZodOptional<z.ZodNumber>;
81
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
86
+ id: z.ZodString;
87
+ title: z.ZodString;
88
+ status: z.ZodEnum<["open", "inprogress", "resolved"]>;
89
+ severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
90
+ components: z.ZodArray<z.ZodString, "many">;
91
+ impact: z.ZodString;
92
+ resolution: z.ZodNullable<z.ZodString>;
93
+ location: z.ZodArray<z.ZodString, "many">;
94
+ discoveredDate: z.ZodEffects<z.ZodString, string, string>;
95
+ resolvedDate: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
96
+ relatedTickets: z.ZodArray<z.ZodString, "many">;
97
+ order: z.ZodOptional<z.ZodNumber>;
98
+ phase: z.ZodOptional<z.ZodNullable<z.ZodString>>;
99
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ assignedTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
+ lastModifiedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
+ }, z.ZodTypeAny, "passthrough">>;
103
+ type Issue = z.infer<typeof IssueSchema>;
104
+
105
+ declare const BlockerSchema: z.ZodObject<{
106
+ name: z.ZodString;
107
+ cleared: z.ZodOptional<z.ZodBoolean>;
108
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
109
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
110
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
111
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
112
+ name: z.ZodString;
113
+ cleared: z.ZodOptional<z.ZodBoolean>;
114
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
115
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
116
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
118
+ name: z.ZodString;
119
+ cleared: z.ZodOptional<z.ZodBoolean>;
120
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
121
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
122
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
+ }, z.ZodTypeAny, "passthrough">>;
124
+ type Blocker = z.infer<typeof BlockerSchema>;
125
+ declare const PhaseSchema: z.ZodObject<{
126
+ id: z.ZodString;
127
+ label: z.ZodString;
128
+ name: z.ZodString;
129
+ description: z.ZodString;
130
+ summary: z.ZodOptional<z.ZodString>;
131
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
132
+ id: z.ZodString;
133
+ label: z.ZodString;
134
+ name: z.ZodString;
135
+ description: z.ZodString;
136
+ summary: z.ZodOptional<z.ZodString>;
137
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
138
+ id: z.ZodString;
139
+ label: z.ZodString;
140
+ name: z.ZodString;
141
+ description: z.ZodString;
142
+ summary: z.ZodOptional<z.ZodString>;
143
+ }, z.ZodTypeAny, "passthrough">>;
144
+ type Phase = z.infer<typeof PhaseSchema>;
145
+ declare const RoadmapSchema: z.ZodObject<{
146
+ title: z.ZodString;
147
+ date: z.ZodEffects<z.ZodString, string, string>;
148
+ phases: z.ZodArray<z.ZodObject<{
149
+ id: z.ZodString;
150
+ label: z.ZodString;
151
+ name: z.ZodString;
152
+ description: z.ZodString;
153
+ summary: z.ZodOptional<z.ZodString>;
154
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
155
+ id: z.ZodString;
156
+ label: z.ZodString;
157
+ name: z.ZodString;
158
+ description: z.ZodString;
159
+ summary: z.ZodOptional<z.ZodString>;
160
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
161
+ id: z.ZodString;
162
+ label: z.ZodString;
163
+ name: z.ZodString;
164
+ description: z.ZodString;
165
+ summary: z.ZodOptional<z.ZodString>;
166
+ }, z.ZodTypeAny, "passthrough">>, "many">;
167
+ blockers: z.ZodArray<z.ZodObject<{
168
+ name: z.ZodString;
169
+ cleared: z.ZodOptional<z.ZodBoolean>;
170
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
171
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
172
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
174
+ name: z.ZodString;
175
+ cleared: z.ZodOptional<z.ZodBoolean>;
176
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
177
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
178
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
180
+ name: z.ZodString;
181
+ cleared: z.ZodOptional<z.ZodBoolean>;
182
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
183
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
184
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ }, z.ZodTypeAny, "passthrough">>, "many">;
186
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
187
+ title: z.ZodString;
188
+ date: z.ZodEffects<z.ZodString, string, string>;
189
+ phases: z.ZodArray<z.ZodObject<{
190
+ id: z.ZodString;
191
+ label: z.ZodString;
192
+ name: z.ZodString;
193
+ description: z.ZodString;
194
+ summary: z.ZodOptional<z.ZodString>;
195
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
196
+ id: z.ZodString;
197
+ label: z.ZodString;
198
+ name: z.ZodString;
199
+ description: z.ZodString;
200
+ summary: z.ZodOptional<z.ZodString>;
201
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
202
+ id: z.ZodString;
203
+ label: z.ZodString;
204
+ name: z.ZodString;
205
+ description: z.ZodString;
206
+ summary: z.ZodOptional<z.ZodString>;
207
+ }, z.ZodTypeAny, "passthrough">>, "many">;
208
+ blockers: z.ZodArray<z.ZodObject<{
209
+ name: z.ZodString;
210
+ cleared: z.ZodOptional<z.ZodBoolean>;
211
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
212
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
213
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
215
+ name: z.ZodString;
216
+ cleared: z.ZodOptional<z.ZodBoolean>;
217
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
218
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
219
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
220
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
221
+ name: z.ZodString;
222
+ cleared: z.ZodOptional<z.ZodBoolean>;
223
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
224
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
225
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
226
+ }, z.ZodTypeAny, "passthrough">>, "many">;
227
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
228
+ title: z.ZodString;
229
+ date: z.ZodEffects<z.ZodString, string, string>;
230
+ phases: z.ZodArray<z.ZodObject<{
231
+ id: z.ZodString;
232
+ label: z.ZodString;
233
+ name: z.ZodString;
234
+ description: z.ZodString;
235
+ summary: z.ZodOptional<z.ZodString>;
236
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
237
+ id: z.ZodString;
238
+ label: z.ZodString;
239
+ name: z.ZodString;
240
+ description: z.ZodString;
241
+ summary: z.ZodOptional<z.ZodString>;
242
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
243
+ id: z.ZodString;
244
+ label: z.ZodString;
245
+ name: z.ZodString;
246
+ description: z.ZodString;
247
+ summary: z.ZodOptional<z.ZodString>;
248
+ }, z.ZodTypeAny, "passthrough">>, "many">;
249
+ blockers: z.ZodArray<z.ZodObject<{
250
+ name: z.ZodString;
251
+ cleared: z.ZodOptional<z.ZodBoolean>;
252
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
253
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
254
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
255
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
256
+ name: z.ZodString;
257
+ cleared: z.ZodOptional<z.ZodBoolean>;
258
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
259
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
260
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
261
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
262
+ name: z.ZodString;
263
+ cleared: z.ZodOptional<z.ZodBoolean>;
264
+ createdDate: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
265
+ clearedDate: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
266
+ note: z.ZodOptional<z.ZodNullable<z.ZodString>>;
267
+ }, z.ZodTypeAny, "passthrough">>, "many">;
268
+ }, z.ZodTypeAny, "passthrough">>;
269
+ type Roadmap = z.infer<typeof RoadmapSchema>;
270
+
271
+ declare const FeaturesSchema: z.ZodObject<{
272
+ tickets: z.ZodBoolean;
273
+ issues: z.ZodBoolean;
274
+ handovers: z.ZodBoolean;
275
+ roadmap: z.ZodBoolean;
276
+ reviews: z.ZodBoolean;
277
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
278
+ tickets: z.ZodBoolean;
279
+ issues: z.ZodBoolean;
280
+ handovers: z.ZodBoolean;
281
+ roadmap: z.ZodBoolean;
282
+ reviews: z.ZodBoolean;
283
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
284
+ tickets: z.ZodBoolean;
285
+ issues: z.ZodBoolean;
286
+ handovers: z.ZodBoolean;
287
+ roadmap: z.ZodBoolean;
288
+ reviews: z.ZodBoolean;
289
+ }, z.ZodTypeAny, "passthrough">>;
290
+ type Features = z.infer<typeof FeaturesSchema>;
291
+ declare const ConfigSchema: z.ZodObject<{
292
+ version: z.ZodNumber;
293
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
294
+ project: z.ZodString;
295
+ type: z.ZodString;
296
+ language: z.ZodString;
297
+ features: z.ZodObject<{
298
+ tickets: z.ZodBoolean;
299
+ issues: z.ZodBoolean;
300
+ handovers: z.ZodBoolean;
301
+ roadmap: z.ZodBoolean;
302
+ reviews: z.ZodBoolean;
303
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
304
+ tickets: z.ZodBoolean;
305
+ issues: z.ZodBoolean;
306
+ handovers: z.ZodBoolean;
307
+ roadmap: z.ZodBoolean;
308
+ reviews: z.ZodBoolean;
309
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
310
+ tickets: z.ZodBoolean;
311
+ issues: z.ZodBoolean;
312
+ handovers: z.ZodBoolean;
313
+ roadmap: z.ZodBoolean;
314
+ reviews: z.ZodBoolean;
315
+ }, z.ZodTypeAny, "passthrough">>;
316
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
317
+ version: z.ZodNumber;
318
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
319
+ project: z.ZodString;
320
+ type: z.ZodString;
321
+ language: z.ZodString;
322
+ features: z.ZodObject<{
323
+ tickets: z.ZodBoolean;
324
+ issues: z.ZodBoolean;
325
+ handovers: z.ZodBoolean;
326
+ roadmap: z.ZodBoolean;
327
+ reviews: z.ZodBoolean;
328
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
329
+ tickets: z.ZodBoolean;
330
+ issues: z.ZodBoolean;
331
+ handovers: z.ZodBoolean;
332
+ roadmap: z.ZodBoolean;
333
+ reviews: z.ZodBoolean;
334
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
335
+ tickets: z.ZodBoolean;
336
+ issues: z.ZodBoolean;
337
+ handovers: z.ZodBoolean;
338
+ roadmap: z.ZodBoolean;
339
+ reviews: z.ZodBoolean;
340
+ }, z.ZodTypeAny, "passthrough">>;
341
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
342
+ version: z.ZodNumber;
343
+ schemaVersion: z.ZodOptional<z.ZodNumber>;
344
+ project: z.ZodString;
345
+ type: z.ZodString;
346
+ language: z.ZodString;
347
+ features: z.ZodObject<{
348
+ tickets: z.ZodBoolean;
349
+ issues: z.ZodBoolean;
350
+ handovers: z.ZodBoolean;
351
+ roadmap: z.ZodBoolean;
352
+ reviews: z.ZodBoolean;
353
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
354
+ tickets: z.ZodBoolean;
355
+ issues: z.ZodBoolean;
356
+ handovers: z.ZodBoolean;
357
+ roadmap: z.ZodBoolean;
358
+ reviews: z.ZodBoolean;
359
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
360
+ tickets: z.ZodBoolean;
361
+ issues: z.ZodBoolean;
362
+ handovers: z.ZodBoolean;
363
+ roadmap: z.ZodBoolean;
364
+ reviews: z.ZodBoolean;
365
+ }, z.ZodTypeAny, "passthrough">>;
366
+ }, z.ZodTypeAny, "passthrough">>;
367
+ type Config = z.infer<typeof ConfigSchema>;
368
+
369
+ /** Matches T-001, T-077a, T-079b */
370
+ declare const TICKET_ID_REGEX: RegExp;
371
+ /** Matches ISS-001, ISS-009 */
372
+ declare const ISSUE_ID_REGEX: RegExp;
373
+ declare const TICKET_STATUSES: readonly ["open", "inprogress", "complete"];
374
+ type TicketStatus = (typeof TICKET_STATUSES)[number];
375
+ declare const TICKET_TYPES: readonly ["task", "feature", "chore"];
376
+ type TicketType = (typeof TICKET_TYPES)[number];
377
+ declare const ISSUE_STATUSES: readonly ["open", "inprogress", "resolved"];
378
+ type IssueStatus = (typeof ISSUE_STATUSES)[number];
379
+ declare const ISSUE_SEVERITIES: readonly ["critical", "high", "medium", "low"];
380
+ type IssueSeverity = (typeof ISSUE_SEVERITIES)[number];
381
+ declare const OUTPUT_FORMATS: readonly ["json", "md"];
382
+ type OutputFormat = (typeof OUTPUT_FORMATS)[number];
383
+ declare const ERROR_CODES: readonly ["not_found", "validation_failed", "io_error", "project_corrupt", "invalid_input", "conflict", "version_mismatch"];
384
+ type ErrorCode = (typeof ERROR_CODES)[number];
385
+ declare const DATE_REGEX: RegExp;
386
+ declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
387
+ declare const TicketIdSchema: z.ZodString;
388
+ declare const IssueIdSchema: z.ZodString;
389
+
390
+ type PhaseStatus = "notstarted" | "inprogress" | "complete";
391
+ /**
392
+ * Pure derived-data container. All derivation happens eagerly in the constructor.
393
+ * Direct port of Swift `ProjectState` — same 7-step pipeline, same query semantics.
394
+ */
395
+ declare class ProjectState {
396
+ readonly tickets: readonly Ticket[];
397
+ readonly issues: readonly Issue[];
398
+ readonly roadmap: Readonly<Roadmap>;
399
+ readonly config: Readonly<Config>;
400
+ readonly handoverFilenames: readonly string[];
401
+ readonly umbrellaIDs: ReadonlySet<string>;
402
+ readonly leafTickets: readonly Ticket[];
403
+ private readonly leafTicketsByPhase;
404
+ private readonly childrenByParent;
405
+ private readonly reverseBlocksMap;
406
+ private readonly ticketsByID;
407
+ private readonly issuesByID;
408
+ readonly totalTicketCount: number;
409
+ readonly openTicketCount: number;
410
+ readonly completeTicketCount: number;
411
+ readonly openIssueCount: number;
412
+ readonly issuesBySeverity: ReadonlyMap<IssueSeverity, number>;
413
+ constructor(input: {
414
+ tickets: Ticket[];
415
+ issues: Issue[];
416
+ roadmap: Roadmap;
417
+ config: Config;
418
+ handoverFilenames: string[];
419
+ });
420
+ isUmbrella(ticket: Ticket): boolean;
421
+ phaseTickets(phaseId: string | null): readonly Ticket[];
422
+ /** Phase status derived from leaf tickets only. Umbrella stored status is ignored. */
423
+ phaseStatus(phaseId: string | null): PhaseStatus;
424
+ umbrellaChildren(ticketId: string): readonly Ticket[];
425
+ /** Umbrella status derived from descendant leaf tickets (recursive traversal). */
426
+ umbrellaStatus(ticketId: string): PhaseStatus;
427
+ reverseBlocks(ticketId: string): readonly Ticket[];
428
+ /**
429
+ * A ticket is blocked if any blockedBy reference points to a non-complete ticket.
430
+ * Unknown blocker IDs treated as blocked (conservative — unknown dependency = assume not cleared).
431
+ */
432
+ isBlocked(ticket: Ticket): boolean;
433
+ get blockedCount(): number;
434
+ ticketByID(id: string): Ticket | undefined;
435
+ issueByID(id: string): Issue | undefined;
436
+ /** IDs of tickets that list `ticketId` in their blockedBy. */
437
+ ticketsBlocking(ticketId: string): string[];
438
+ /** IDs of tickets that have `ticketId` as their parentTicket. */
439
+ childrenOf(ticketId: string): string[];
440
+ /** IDs of issues that reference `ticketId` in relatedTickets. */
441
+ issuesReferencing(ticketId: string): string[];
442
+ /**
443
+ * Recursively collects all descendant leaf tickets of an umbrella.
444
+ * Uses a visited set to guard against cycles in malformed data.
445
+ */
446
+ private descendantLeaves;
447
+ /**
448
+ * Shared aggregation logic for phase and umbrella status.
449
+ * - all complete → complete
450
+ * - any inprogress OR any complete (but not all) → inprogress
451
+ * - else → notstarted (nothing started)
452
+ */
453
+ private static aggregateStatus;
454
+ }
455
+
456
+ /** Schema version this loader understands. Config.schemaVersion > this → version_mismatch. */
457
+ declare const CURRENT_SCHEMA_VERSION = 1;
458
+ declare class ProjectLoaderError extends Error {
459
+ readonly code: ErrorCode;
460
+ readonly cause?: unknown | undefined;
461
+ readonly name = "ProjectLoaderError";
462
+ constructor(code: ErrorCode, message: string, cause?: unknown | undefined);
463
+ }
464
+ type LoadWarningType = "parse_error" | "schema_error" | "duplicate_id" | "naming_convention";
465
+ /** Integrity warnings fail strict mode. Cosmetic warnings are collected but never block. */
466
+ declare const INTEGRITY_WARNING_TYPES: readonly LoadWarningType[];
467
+ interface LoadWarning {
468
+ readonly file: string;
469
+ readonly message: string;
470
+ readonly type: LoadWarningType;
471
+ }
472
+
473
+ interface LoadOptions {
474
+ /** In strict mode, integrity warnings become thrown errors. Default: false */
475
+ strict?: boolean;
476
+ /** Maximum schemaVersion this loader supports. Default: CURRENT_SCHEMA_VERSION */
477
+ maxSchemaVersion?: number;
478
+ }
479
+ interface LoadResult {
480
+ readonly state: ProjectState;
481
+ readonly warnings: readonly LoadWarning[];
482
+ }
483
+ /**
484
+ * Loads all .story/ data and assembles a ProjectState.
485
+ * Critical files (config, roadmap) throw on failure.
486
+ * Best-effort files (tickets, issues) skip corrupt entries with warnings.
487
+ */
488
+ declare function loadProject(root: string, options?: LoadOptions): Promise<LoadResult>;
489
+ /**
490
+ * Writes a ticket file WITHOUT acquiring the project lock.
491
+ * Use inside withProjectLock when the lock is already held.
492
+ * Performs Zod parse + guardPath + atomicWrite.
493
+ */
494
+ declare function writeTicketUnlocked(ticket: Ticket, root: string): Promise<void>;
495
+ declare function writeTicket(ticket: Ticket, root: string): Promise<void>;
496
+ /**
497
+ * Writes an issue file WITHOUT acquiring the project lock.
498
+ * Use inside withProjectLock when the lock is already held.
499
+ */
500
+ declare function writeIssueUnlocked(issue: Issue, root: string): Promise<void>;
501
+ declare function writeIssue(issue: Issue, root: string): Promise<void>;
502
+ /**
503
+ * Writes a roadmap file WITHOUT acquiring the project lock.
504
+ * Use inside withProjectLock when the lock is already held.
505
+ * Performs Zod parse + guardPath + atomicWrite.
506
+ */
507
+ declare function writeRoadmapUnlocked(roadmap: Roadmap, root: string): Promise<void>;
508
+ declare function writeRoadmap(roadmap: Roadmap, root: string): Promise<void>;
509
+ declare function writeConfig(config: Config, root: string): Promise<void>;
510
+ /**
511
+ * Deletes a ticket file with referential integrity checks.
512
+ * Acquires lock, reloads fresh state from disk, checks all references.
513
+ * With force: true, skips integrity checks and state reload.
514
+ */
515
+ declare function deleteTicket(id: string, root: string, options?: {
516
+ force?: boolean;
517
+ }): Promise<void>;
518
+ declare function deleteIssue(id: string, root: string): Promise<void>;
519
+ interface WithProjectLockOptions {
520
+ strict?: boolean;
521
+ }
522
+ /**
523
+ * Acquires the project lock, loads fresh state, optionally enforces strict mode,
524
+ * then calls the handler. Released in finally.
525
+ * Use for create/update operations that need atomic load→validate→write.
526
+ */
527
+ declare function withProjectLock(root: string, options: WithProjectLockOptions, handler: (result: LoadResult) => Promise<void>): Promise<void>;
528
+ /**
529
+ * Executes multiple file operations atomically with a transaction journal.
530
+ * Forward-only recovery: if any rename succeeds, complete remaining.
531
+ * Does NOT acquire the lock — caller must hold it.
532
+ *
533
+ * The journal persists a `commitStarted` flag so recovery can distinguish
534
+ * "prepared" (safe to roll back) from "committing" (must complete forward).
535
+ */
536
+ declare function runTransactionUnlocked(root: string, operations: Array<{
537
+ op: "write";
538
+ target: string;
539
+ content: string;
540
+ } | {
541
+ op: "delete";
542
+ target: string;
543
+ }>): Promise<void>;
544
+ /**
545
+ * Executes multiple file operations atomically with a transaction journal.
546
+ * Acquires the project lock, then delegates to runTransactionUnlocked.
547
+ */
548
+ declare function runTransaction(root: string, operations: Array<{
549
+ op: "write";
550
+ target: string;
551
+ content: string;
552
+ } | {
553
+ op: "delete";
554
+ target: string;
555
+ }>): Promise<void>;
556
+ /** Deep-sorts object keys recursively for deterministic JSON output. */
557
+ declare function sortKeysDeep(value: unknown): unknown;
558
+ /** Serializes to pretty-printed JSON with deep-sorted keys. */
559
+ declare function serializeJSON(obj: unknown): string;
560
+
561
+ /**
562
+ * Discovers the project root by walking up from `startDir` (default: cwd)
563
+ * looking for `.story/config.json`.
564
+ *
565
+ * CLAUDESTORY_PROJECT_ROOT env var overrides walk-up discovery.
566
+ * Returns the canonical absolute path, or null if not found.
567
+ */
568
+ declare function discoverProjectRoot(startDir?: string): string | null;
569
+
570
+ /**
571
+ * Lists handover markdown files, sorted by date (newest first).
572
+ * Non-conforming filenames (no YYYY-MM-DD prefix) are appended at end
573
+ * and flagged as naming_convention warnings.
574
+ */
575
+ declare function listHandovers(handoversDir: string, root: string, warnings: LoadWarning[]): Promise<string[]>;
576
+ /** Reads the content of a handover markdown file. */
577
+ declare function readHandover(handoversDir: string, filename: string): Promise<string>;
578
+ /**
579
+ * Extracts the YYYY-MM-DD date prefix from a handover filename.
580
+ * Returns the date string or null if the filename does not conform.
581
+ */
582
+ declare function extractHandoverDate(filename: string): string | null;
583
+
584
+ interface UmbrellaProgress {
585
+ readonly total: number;
586
+ readonly complete: number;
587
+ readonly status: PhaseStatus;
588
+ }
589
+ interface UnblockImpact {
590
+ readonly ticketId: string;
591
+ readonly wouldUnblock: readonly Ticket[];
592
+ }
593
+ interface NextTicketResult {
594
+ readonly kind: "found";
595
+ readonly ticket: Ticket;
596
+ readonly unblockImpact: UnblockImpact;
597
+ readonly umbrellaProgress: UmbrellaProgress | null;
598
+ }
599
+ interface NextTicketAllComplete {
600
+ readonly kind: "all_complete";
601
+ }
602
+ interface NextTicketAllBlocked {
603
+ readonly kind: "all_blocked";
604
+ readonly phaseId: string;
605
+ readonly blockedCount: number;
606
+ }
607
+ interface NextTicketEmpty {
608
+ readonly kind: "empty_project";
609
+ }
610
+ type NextTicketOutcome = NextTicketResult | NextTicketAllComplete | NextTicketAllBlocked | NextTicketEmpty;
611
+ interface PhaseWithStatus {
612
+ readonly phase: Phase;
613
+ readonly status: PhaseStatus;
614
+ readonly leafCount: number;
615
+ }
616
+ /**
617
+ * First non-complete, unblocked leaf ticket in the first non-complete phase
618
+ * (roadmap order). Skips phases with zero leaf tickets.
619
+ * Returns discriminated outcome for exhaustive handling.
620
+ */
621
+ declare function nextTicket(state: ProjectState): NextTicketOutcome;
622
+ /**
623
+ * All currently blocked incomplete leaf tickets.
624
+ */
625
+ declare function blockedTickets(state: ProjectState): readonly Ticket[];
626
+ /**
627
+ * Tickets that would become unblocked if ticketId were completed.
628
+ * Direct unblocking only — no transitive chains.
629
+ */
630
+ declare function ticketsUnblockedBy(ticketId: string, state: ProjectState): readonly Ticket[];
631
+ /**
632
+ * Progress of an umbrella's descendant leaves.
633
+ * Returns null if ticketId is not an umbrella.
634
+ */
635
+ declare function umbrellaProgress(ticketId: string, state: ProjectState): UmbrellaProgress | null;
636
+ /**
637
+ * First phase in roadmap order that is not complete and has leaf tickets.
638
+ */
639
+ declare function currentPhase(state: ProjectState): Phase | null;
640
+ /**
641
+ * All roadmap phases with their derived status and leaf count.
642
+ */
643
+ declare function phasesWithStatus(state: ProjectState): readonly PhaseWithStatus[];
644
+ /**
645
+ * Normalizes blocker cleared state across legacy and new formats.
646
+ * Legacy: cleared boolean. New: clearedDate non-null.
647
+ */
648
+ declare function isBlockerCleared(blocker: Blocker): boolean;
649
+
650
+ /**
651
+ * Next ticket ID: scan existing IDs, find max numeric part, return T-(max+1).
652
+ * Zero-padded to 3 digits minimum. Handles suffixed IDs (T-077a → numeric 77).
653
+ * Malformed IDs (not matching TICKET_ID_REGEX) are silently skipped.
654
+ */
655
+ declare function nextTicketID(tickets: readonly Ticket[]): string;
656
+ /**
657
+ * Next issue ID: scan existing IDs, find max numeric part, return ISS-(max+1).
658
+ * Zero-padded to 3 digits minimum.
659
+ */
660
+ declare function nextIssueID(issues: readonly Issue[]): string;
661
+ /**
662
+ * Next order value for a phase: max leaf ticket order + 10, or 10 if empty.
663
+ */
664
+ declare function nextOrder(phaseId: string | null, state: ProjectState): number;
665
+
666
+ type ValidationLevel = "error" | "warning" | "info";
667
+ interface ValidationFinding {
668
+ readonly level: ValidationLevel;
669
+ readonly code: string;
670
+ readonly message: string;
671
+ readonly entity: string | null;
672
+ }
673
+ interface ValidationResult {
674
+ readonly valid: boolean;
675
+ readonly errorCount: number;
676
+ readonly warningCount: number;
677
+ readonly infoCount: number;
678
+ readonly findings: readonly ValidationFinding[];
679
+ }
680
+ /**
681
+ * Validates a fully loaded ProjectState for reference integrity.
682
+ * Pure function — no I/O. Returns structured findings, never throws.
683
+ */
684
+ declare function validateProject(state: ProjectState): ValidationResult;
685
+ /**
686
+ * Merges LoadResult.warnings into a ValidationResult.
687
+ * parse_error/schema_error → error level. naming_convention → info level.
688
+ */
689
+ declare function mergeValidation(result: ValidationResult, loaderWarnings: readonly LoadWarning[]): ValidationResult;
690
+
691
+ interface InitOptions {
692
+ name: string;
693
+ force?: boolean;
694
+ type?: string;
695
+ language?: string;
696
+ }
697
+ interface InitResult {
698
+ readonly root: string;
699
+ readonly created: readonly string[];
700
+ }
701
+ /**
702
+ * Scaffolds a new .story/ directory structure.
703
+ * Refuses if .story/ already exists unless force is true.
704
+ * Force mode overwrites config.json + roadmap.json only — preserves existing data files.
705
+ */
706
+ declare function initProject(root: string, options: InitOptions): Promise<InitResult>;
707
+
708
+ declare const ExitCode: {
709
+ readonly OK: 0;
710
+ readonly USER_ERROR: 1;
711
+ readonly VALIDATION_ERROR: 2;
712
+ readonly PARTIAL: 3;
713
+ };
714
+ type ExitCodeValue = (typeof ExitCode)[keyof typeof ExitCode];
715
+ interface SuccessEnvelope<T> {
716
+ readonly version: 1;
717
+ readonly data: T;
718
+ }
719
+ interface ErrorEnvelope {
720
+ readonly version: 1;
721
+ readonly error: {
722
+ readonly code: ErrorCode;
723
+ readonly message: string;
724
+ };
725
+ }
726
+ interface PartialEnvelope<T> {
727
+ readonly version: 1;
728
+ readonly data: T;
729
+ readonly warnings: readonly {
730
+ type: string;
731
+ file: string;
732
+ message: string;
733
+ }[];
734
+ readonly partial: true;
735
+ }
736
+ declare function successEnvelope<T>(data: T): SuccessEnvelope<T>;
737
+ declare function errorEnvelope(code: ErrorCode, message: string): ErrorEnvelope;
738
+ declare function partialEnvelope<T>(data: T, warnings: readonly LoadWarning[]): PartialEnvelope<T>;
739
+ /**
740
+ * Escapes characters that would create Markdown structure in inline text.
741
+ * Handles heading, list, blockquote, ordered list at line start.
742
+ * Handles inline structural characters.
743
+ */
744
+ declare function escapeMarkdownInline(text: string): string;
745
+ /**
746
+ * Wraps multi-line content in a fenced code block.
747
+ * Uses a fence length longer than any backtick sequence in the content.
748
+ */
749
+ declare function fencedBlock(content: string, lang?: string): string;
750
+ declare function formatStatus(state: ProjectState, format: OutputFormat): string;
751
+ declare function formatPhaseList(state: ProjectState, format: OutputFormat): string;
752
+ declare function formatPhaseTickets(phaseId: string, state: ProjectState, format: OutputFormat): string;
753
+ declare function formatTicket(ticket: Ticket, state: ProjectState, format: OutputFormat): string;
754
+ declare function formatNextTicketOutcome(outcome: NextTicketOutcome, state: ProjectState, format: OutputFormat): string;
755
+ declare function formatTicketList(tickets: readonly Ticket[], format: OutputFormat): string;
756
+ declare function formatIssue(issue: Issue, format: OutputFormat): string;
757
+ declare function formatIssueList(issues: readonly Issue[], format: OutputFormat): string;
758
+ declare function formatBlockedTickets(tickets: readonly Ticket[], state: ProjectState, format: OutputFormat): string;
759
+ declare function formatValidation(result: ValidationResult, format: OutputFormat): string;
760
+ declare function formatBlockerList(roadmap: Roadmap, format: OutputFormat): string;
761
+ declare function formatError(code: ErrorCode, message: string, format: OutputFormat): string;
762
+ declare function formatInitResult(result: {
763
+ root: string;
764
+ created: readonly string[];
765
+ }, format: OutputFormat): string;
766
+ declare function formatHandoverList(filenames: readonly string[], format: OutputFormat): string;
767
+ declare function formatHandoverContent(filename: string, content: string, format: OutputFormat): string;
768
+
769
+ export { type Blocker, BlockerSchema, CURRENT_SCHEMA_VERSION, type Config, ConfigSchema, DATE_REGEX, DateSchema, 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, type NextTicketAllBlocked, type NextTicketAllComplete, type NextTicketEmpty, type NextTicketOutcome, type NextTicketResult, OUTPUT_FORMATS, type OutputFormat, type PartialEnvelope, type Phase, PhaseSchema, type PhaseStatus, type PhaseWithStatus, ProjectLoaderError, ProjectState, type Roadmap, RoadmapSchema, 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, blockedTickets, currentPhase, deleteIssue, deleteTicket, discoverProjectRoot, errorEnvelope, escapeMarkdownInline, extractHandoverDate, fencedBlock, formatBlockedTickets, formatBlockerList, formatError, formatHandoverContent, formatHandoverList, formatInitResult, formatIssue, formatIssueList, formatNextTicketOutcome, formatPhaseList, formatPhaseTickets, formatStatus, formatTicket, formatTicketList, formatValidation, initProject, isBlockerCleared, listHandovers, loadProject, mergeValidation, nextIssueID, nextOrder, nextTicket, nextTicketID, partialEnvelope, phasesWithStatus, readHandover, runTransaction, runTransactionUnlocked, serializeJSON, sortKeysDeep, successEnvelope, ticketsUnblockedBy, umbrellaProgress, validateProject, withProjectLock, writeConfig, writeIssue, writeIssueUnlocked, writeRoadmap, writeRoadmapUnlocked, writeTicket, writeTicketUnlocked };