@riotprompt/riotplan 0.0.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,119 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * Acceptance criterion from a step file
5
+ */
6
+ export declare interface AcceptanceCriterion {
7
+ text: string;
8
+ checked: boolean;
9
+ stepNumber: number;
10
+ }
11
+
12
+ /**
13
+ * Add a relationship to a plan
14
+ *
15
+ * @param plan - The source plan
16
+ * @param options - Relationship options
17
+ * @returns Result with the created relationship
18
+ */
19
+ export declare function addRelationship(plan: Plan, options: AddRelationshipOptions): Promise<AddRelationshipResult>;
20
+
21
+ /**
22
+ * Options for adding a relationship
23
+ */
24
+ export declare interface AddRelationshipOptions {
25
+ /** Type of relationship */
26
+ type: RelationshipType;
27
+ /** Path to the related plan (absolute or relative to current plan) */
28
+ targetPath: string;
29
+ /** Specific steps involved in the relationship */
30
+ steps?: number[];
31
+ /** Reason/description for the relationship */
32
+ reason?: string;
33
+ }
34
+
35
+ /**
36
+ * Result of adding a relationship
37
+ */
38
+ export declare interface AddRelationshipResult {
39
+ /** The created relationship */
40
+ relationship: PlanRelationship;
41
+ /** Whether the target plan was found and valid */
42
+ targetValid: boolean;
43
+ /** Target plan metadata if found */
44
+ targetPlan?: {
45
+ code: string;
46
+ name: string;
47
+ path: string;
48
+ };
49
+ }
50
+
51
+ export declare interface Analysis {
52
+ /** Path to analysis directory */
53
+ path: string;
54
+ /** Requirements document content */
55
+ requirements: string;
56
+ /** Philosophy/approach document (optional) */
57
+ philosophy?: string;
58
+ /** All elaboration prompts */
59
+ elaborations: ElaborationRecord[];
60
+ /** Analysis metadata */
61
+ metadata: AnalysisMetadata;
62
+ }
63
+
64
+ export declare interface AnalysisMetadata {
65
+ createdAt: Date;
66
+ updatedAt: Date;
67
+ elaborationCount: number;
68
+ status: "draft" | "ready" | "converted";
69
+ }
70
+
71
+ /**
72
+ * Apply a template to create a new plan
73
+ */
74
+ export declare function applyTemplate(options: ApplyTemplateOptions): Promise<ApplyTemplateResult>;
75
+
76
+ /**
77
+ * Options for applying a template
78
+ */
79
+ export declare interface ApplyTemplateOptions {
80
+ /** Template ID to apply */
81
+ templateId: string;
82
+ /** Plan code (directory name) */
83
+ code: string;
84
+ /** Plan display name */
85
+ name: string;
86
+ /** Base path to create the plan in */
87
+ basePath: string;
88
+ /** Custom description (overrides template) */
89
+ description?: string;
90
+ /** Variable substitutions for template content */
91
+ variables?: Record<string, string>;
92
+ /** Additional tags to add */
93
+ tags?: string[];
94
+ }
95
+
96
+ /**
97
+ * Result of applying a template
98
+ */
99
+ export declare interface ApplyTemplateResult {
100
+ /** Whether application succeeded */
101
+ success: boolean;
102
+ /** Path to created plan */
103
+ path?: string;
104
+ /** Template that was applied */
105
+ template?: PlanTemplate;
106
+ /** Error message if failed */
107
+ error?: string;
108
+ }
109
+
110
+ /**
111
+ * Create the archive command
112
+ */
113
+ export declare function archiveCommand(): Command;
114
+
115
+ export declare const BasicTemplate: PlanTemplate;
116
+
1
117
  /**
2
118
  * Blocker preventing progress
3
119
  */
@@ -18,38 +134,467 @@ export declare interface Blocker {
18
134
  resolution?: string;
19
135
  }
20
136
 
137
+ /**
138
+ * Block a step with a reason
139
+ */
140
+ export declare function blockStep(plan: Plan, stepNumber: number, reason: string): PlanStep;
141
+
142
+ /**
143
+ * Build a dependency graph from a plan
144
+ *
145
+ * @param plan - The plan to analyze
146
+ * @returns Dependency graph
147
+ */
148
+ export declare function buildDependencyGraph(plan: Plan): Promise<DependencyGraph>;
149
+
150
+ /**
151
+ * Build a dependency graph from a pre-parsed dependency map
152
+ *
153
+ * @param plan - The plan
154
+ * @param rawDeps - Map of step number to dependencies
155
+ * @returns Dependency graph
156
+ */
157
+ export declare function buildDependencyGraphFromMap(plan: Plan, rawDeps: Map<number, number[]>): DependencyGraph;
158
+
159
+ /**
160
+ * Check completion of plan execution
161
+ */
162
+ export declare function checkCompletion(planPath: string): Promise<CompletionReport>;
163
+
164
+ /**
165
+ * Check coverage of analysis criteria in plan steps
166
+ */
167
+ export declare function checkCoverage(planPath: string, options?: CoverageOptions): Promise<CoverageReport>;
168
+
169
+ /**
170
+ * Error Handling Utilities
171
+ */
172
+ /**
173
+ * CLI-specific error with code and exit code
174
+ */
175
+ export declare class CliError extends Error {
176
+ code: string;
177
+ exitCode: number;
178
+ constructor(message: string, code: string, exitCode?: number);
179
+ }
180
+
181
+ /**
182
+ * Compare two revisions
183
+ */
184
+ export declare function compareRevisions(history: PlanHistory, fromVersion: string, toVersion: string): RevisionComparison | undefined;
185
+
186
+ /**
187
+ * Complete a step
188
+ */
189
+ export declare function completeStep(plan: Plan, stepNumber: number, notes?: string): PlanStep;
190
+
191
+ /**
192
+ * Completion report for plan → execution verification
193
+ */
194
+ export declare interface CompletionReport {
195
+ /** Total steps */
196
+ totalSteps: number;
197
+ /** Steps by completion status */
198
+ complete: StepCompletionResult[];
199
+ partial: StepCompletionResult[];
200
+ incomplete: StepCompletionResult[];
201
+ pending: StepCompletionResult[];
202
+ /** Overall completion percentage */
203
+ completionScore: number;
204
+ /** Outstanding items */
205
+ outstandingItems: string[];
206
+ }
207
+
208
+ /**
209
+ * Compute execution order that respects dependencies
210
+ *
211
+ * Returns both a linear order and parallel execution levels.
212
+ *
213
+ * @param plan - The plan to analyze
214
+ * @param graph - Optional pre-built dependency graph
215
+ * @returns Execution order information
216
+ */
217
+ export declare function computeExecutionOrder(plan: Plan, graph?: DependencyGraph): Promise<ExecutionOrder>;
218
+
219
+ /**
220
+ * Context identifier (e.g., "work", "personal", "work/kjerneverk")
221
+ */
222
+ export declare type ContextId = string;
223
+
224
+ export declare interface CoverageOptions {
225
+ /** Minimum keyword match score to consider "covered" */
226
+ coverageThreshold?: number;
227
+ /** Minimum keyword match score to consider "partial" */
228
+ partialThreshold?: number;
229
+ }
230
+
231
+ /**
232
+ * Coverage report for analysis → plan verification
233
+ */
234
+ export declare interface CoverageReport {
235
+ /** Total criteria checked */
236
+ totalCriteria: number;
237
+ /** Fully covered criteria */
238
+ covered: CriterionResult[];
239
+ /** Partially covered criteria */
240
+ partial: CriterionResult[];
241
+ /** Missing criteria */
242
+ missing: CriterionResult[];
243
+ /** Coverage by priority */
244
+ byPriority: {
245
+ must: {
246
+ total: number;
247
+ covered: number;
248
+ partial: number;
249
+ missing: number;
250
+ };
251
+ should: {
252
+ total: number;
253
+ covered: number;
254
+ partial: number;
255
+ missing: number;
256
+ };
257
+ could: {
258
+ total: number;
259
+ covered: number;
260
+ partial: number;
261
+ missing: number;
262
+ };
263
+ };
264
+ /** Overall coverage percentage (weighted by priority) */
265
+ coverageScore: number;
266
+ /** Generated verification questions */
267
+ questions: string[];
268
+ }
269
+
270
+ /**
271
+ * Create the analysis directory structure
272
+ */
273
+ export declare function createAnalysisDirectory(options: CreateAnalysisOptions): Promise<string>;
274
+
275
+ export declare interface CreateAnalysisOptions {
276
+ planPath: string;
277
+ planName: string;
278
+ initialPrompt: string;
279
+ }
280
+
281
+ /**
282
+ * Create a bidirectional relationship between two plans
283
+ *
284
+ * @param sourcePlan - The source plan
285
+ * @param targetPlan - The target plan
286
+ * @param type - Relationship type from source's perspective
287
+ * @param reason - Optional reason
288
+ */
289
+ export declare function createBidirectionalRelationship(sourcePlan: Plan, targetPlan: Plan, type: RelationshipType, reason?: string): void;
290
+
291
+ /**
292
+ * Create a step executor for the given provider
293
+ *
294
+ * Note: This currently only supports mock execution.
295
+ * Full provider integration requires importing @riotprompt/execution-* packages.
296
+ */
297
+ export declare function createExecutor(config: ProviderConfig): StepExecutor;
298
+
299
+ /**
300
+ * Create a new feedback record
301
+ *
302
+ * @param planPath - Path to the plan directory
303
+ * @param options - Feedback options
304
+ * @returns The created feedback record and file path
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const result = await createFeedback('./prompts/my-plan', {
309
+ * title: 'Initial Review',
310
+ * feedback: 'Consider adding more error handling',
311
+ * participants: [
312
+ * { name: 'Tim', type: 'human' },
313
+ * { name: 'Claude', type: 'ai', model: 'claude-sonnet-4' }
314
+ * ],
315
+ * platform: 'cursor'
316
+ * });
317
+ * console.log(result.record.id); // '001'
318
+ * ```
319
+ */
320
+ export declare function createFeedback(planPath: string, options: CreateFeedbackOptions): Promise<CreateFeedbackResult>;
321
+
322
+ /**
323
+ * Options for creating feedback
324
+ */
325
+ export declare interface CreateFeedbackOptions {
326
+ /** Feedback title */
327
+ title: string;
328
+ /** The feedback content */
329
+ feedback: string;
330
+ /** Participants */
331
+ participants?: FeedbackParticipant[];
332
+ /** Platform where feedback occurred */
333
+ platform?: FeedbackPlatform;
334
+ /** What was proposed before feedback */
335
+ proposed?: string;
336
+ /** Discussion/debate content */
337
+ discussion?: string;
338
+ /** Resolution/outcome */
339
+ resolution?: string;
340
+ /** Changes made as a result */
341
+ changes?: string[];
342
+ /** Open questions remaining */
343
+ openQuestions?: string[];
344
+ /** Context references (file:lines) */
345
+ context?: FeedbackContext[];
346
+ /** Plan version this relates to */
347
+ planVersion?: string;
348
+ }
349
+
350
+ /**
351
+ * Result of creating feedback
352
+ */
353
+ export declare interface CreateFeedbackResult {
354
+ /** Created feedback record */
355
+ record: FeedbackRecord;
356
+ /** Path to created file */
357
+ path: string;
358
+ }
359
+
360
+ /**
361
+ * Create a new milestone
362
+ */
363
+ export declare function createMilestone(history: PlanHistory, name: string, description?: string): PlanMilestone;
364
+
21
365
  /**
22
366
  * Create a new plan
23
367
  *
24
368
  * @param config - Plan configuration
25
- * @returns The created plan
369
+ * @returns The created plan and files
26
370
  *
27
371
  * @example
28
372
  * ```typescript
29
- * const plan = await createPlan({
373
+ * const result = await createPlan({
30
374
  * code: 'my-feature',
31
375
  * name: 'My Feature Implementation',
32
- * path: './prompts/my-feature',
376
+ * basePath: './prompts',
377
+ * description: 'Implementing the new feature',
33
378
  * steps: [
34
379
  * { title: 'Setup', description: 'Initial setup' },
35
380
  * { title: 'Implementation', description: 'Core work' },
36
381
  * { title: 'Testing', description: 'Verify it works' },
37
382
  * ]
38
383
  * });
384
+ * console.log(result.path); // './prompts/my-feature'
39
385
  * ```
40
- *
41
- * @stub Not yet implemented
42
386
  */
43
- export declare function createPlan(_config: {
387
+ export declare function createPlan(config: CreatePlanConfig): Promise<CreatePlanResult>;
388
+
389
+ /**
390
+ * Configuration for creating a new plan
391
+ */
392
+ export declare interface CreatePlanConfig {
393
+ /** Plan code/slug (directory name) - lowercase letters, numbers, hyphens only */
44
394
  code: string;
395
+ /** Human-readable name */
45
396
  name: string;
46
- path: string;
397
+ /** Base path for plan (plan created as subdirectory) */
398
+ basePath: string;
399
+ /** Plan description */
47
400
  description?: string;
401
+ /** Initial steps */
48
402
  steps?: Array<{
49
403
  title: string;
50
404
  description?: string;
51
405
  }>;
52
- }): Promise<never>;
406
+ /** Context assignment */
407
+ context?: string;
408
+ /** Author name */
409
+ author?: string;
410
+ /** Create feedback directory (default: true) */
411
+ createFeedbackDir?: boolean;
412
+ /** Create evidence directory (default: true) */
413
+ createEvidenceDir?: boolean;
414
+ /** Template to use (basic support) */
415
+ template?: "blank" | "default";
416
+ }
417
+
418
+ /**
419
+ * Result of plan creation
420
+ */
421
+ export declare interface CreatePlanResult {
422
+ /** Created plan */
423
+ plan: Plan;
424
+ /** Path where plan was created */
425
+ path: string;
426
+ /** Files that were created */
427
+ filesCreated: string[];
428
+ }
429
+
430
+ /**
431
+ * Create the CLI program with all commands
432
+ */
433
+ export declare function createProgram(): Command;
434
+
435
+ /**
436
+ * Create a new empty registry
437
+ */
438
+ export declare function createRegistry(searchPaths?: string[]): PlanRegistry;
439
+
440
+ /**
441
+ * Create and save a RETROSPECTIVE.md file
442
+ */
443
+ export declare function createRetrospective(plan: Plan, options?: GenerateRetrospectiveOptions): Promise<string>;
444
+
445
+ /**
446
+ * Create a new revision
447
+ */
448
+ export declare function createRevision(history: PlanHistory, message: string, options?: {
449
+ author?: string;
450
+ feedbackId?: string;
451
+ }): PlanRevision;
452
+
453
+ /**
454
+ * Patterns for detecting criteria in markdown
455
+ */
456
+ export declare const CRITERIA_PATTERNS: {
457
+ /** Checkbox item: - [ ] or - [x] */
458
+ readonly checkbox: RegExp;
459
+ /** Section headers for criteria */
460
+ readonly mustHaveHeader: RegExp;
461
+ readonly shouldHaveHeader: RegExp;
462
+ readonly couldHaveHeader: RegExp;
463
+ /** Verification criteria section */
464
+ readonly verificationSection: RegExp;
465
+ };
466
+
467
+ /**
468
+ * Priority level for verification criteria
469
+ */
470
+ export declare type CriteriaPriority = "must" | "should" | "could";
471
+
472
+ /**
473
+ * Status of a verification criterion
474
+ */
475
+ export declare type CriteriaStatus = "covered" | "partial" | "missing" | "unknown";
476
+
477
+ /**
478
+ * Result of checking a single criterion
479
+ */
480
+ export declare interface CriterionResult {
481
+ criterion: VerificationCriterion;
482
+ status: CriteriaStatus;
483
+ matchedSteps: number[];
484
+ notes?: string;
485
+ }
486
+
487
+ /**
488
+ * Critical path analysis result
489
+ */
490
+ export declare interface CriticalPath {
491
+ /** Steps in the critical path (in order) */
492
+ path: number[];
493
+ /** Total length of the critical path */
494
+ length: number;
495
+ /** Estimated duration (if steps have duration estimates) */
496
+ estimatedDuration?: number;
497
+ }
498
+
499
+ /**
500
+ * A dependency error
501
+ */
502
+ export declare interface DependencyError {
503
+ /** Error type */
504
+ type: "circular" | "missing" | "self-reference" | "invalid-step" | "duplicate";
505
+ /** Affected step */
506
+ stepNumber: number;
507
+ /** Related steps */
508
+ relatedSteps?: number[];
509
+ /** Error message */
510
+ message: string;
511
+ }
512
+
513
+ /**
514
+ * A dependency graph for the entire plan
515
+ */
516
+ export declare interface DependencyGraph {
517
+ /** Map of step number to its dependencies */
518
+ dependencies: Map<number, StepDependency>;
519
+ /** Steps with no dependencies (can start immediately) */
520
+ roots: number[];
521
+ /** Steps with no dependents (end points) */
522
+ leaves: number[];
523
+ /** Whether the graph has circular dependencies */
524
+ hasCircular: boolean;
525
+ /** Circular dependency chains if any */
526
+ circularChains: number[][];
527
+ }
528
+
529
+ /**
530
+ * Result of dependency validation
531
+ */
532
+ export declare interface DependencyValidation {
533
+ /** Whether all dependencies are valid */
534
+ valid: boolean;
535
+ /** Errors found */
536
+ errors: DependencyError[];
537
+ /** Warnings found */
538
+ warnings: DependencyWarning[];
539
+ }
540
+
541
+ /**
542
+ * A dependency warning
543
+ */
544
+ export declare interface DependencyWarning {
545
+ /** Warning type */
546
+ type: "long-chain" | "bottleneck" | "orphan";
547
+ /** Affected step */
548
+ stepNumber: number;
549
+ /** Warning message */
550
+ message: string;
551
+ }
552
+
553
+ export declare interface ElaborationRecord {
554
+ id: string;
555
+ timestamp: Date;
556
+ content: string;
557
+ }
558
+
559
+ /**
560
+ * Evidence record for inception phase materials
561
+ *
562
+ * Tracks documentation gathered during plan inception to support
563
+ * decisions and provide context for future reference.
564
+ */
565
+ export declare interface EvidenceRecord {
566
+ /** Unique identifier */
567
+ id: string;
568
+ /** Evidence type */
569
+ type: EvidenceType;
570
+ /** Title/description */
571
+ title: string;
572
+ /** When gathered */
573
+ createdAt: Date;
574
+ /** Source of evidence */
575
+ source?: string;
576
+ /** Filename */
577
+ filename: string;
578
+ /** Summary of key findings */
579
+ summary?: string;
580
+ /** Tags for categorization */
581
+ tags?: string[];
582
+ }
583
+
584
+ /**
585
+ * Type of evidence gathered during inception phase
586
+ */
587
+ export declare type EvidenceType = "case-study" | "research" | "analysis" | "example" | "external-review" | "reference";
588
+
589
+ /**
590
+ * Execute all pending steps in a plan
591
+ */
592
+ export declare function executePendingSteps(executor: StepExecutor, plan: Plan, options?: {
593
+ provider?: ProviderConfig;
594
+ stopOnError?: boolean;
595
+ onProgress?: (step: number, message: string) => void;
596
+ onStepComplete?: (step: number, result: StepResult) => void;
597
+ }): Promise<StepResult[]>;
53
598
 
54
599
  /**
55
600
  * Execute a plan step
@@ -63,6 +608,47 @@ export declare function createPlan(_config: {
63
608
  */
64
609
  export declare function executeStep(_plan: unknown, _stepNumber: number, _context?: unknown): Promise<never>;
65
610
 
611
+ /**
612
+ * Execute a step with the given executor
613
+ */
614
+ export declare function executeStepWithExecutor(executor: StepExecutor, plan: Plan, stepNumber: number, options?: {
615
+ provider?: ProviderConfig;
616
+ workingDirectory?: string;
617
+ env?: Record<string, string>;
618
+ onProgress?: (message: string) => void;
619
+ onComplete?: (result: StepResult) => void;
620
+ }): Promise<StepResult>;
621
+
622
+ /**
623
+ * Execution context passed to step execution
624
+ */
625
+ export declare interface ExecutionContext {
626
+ /** The plan being executed */
627
+ plan: Plan;
628
+ /** Current step being executed */
629
+ step: PlanStep;
630
+ /** Provider configuration */
631
+ provider: ProviderConfig;
632
+ /** Environment variables */
633
+ env?: Record<string, string>;
634
+ /** Working directory */
635
+ workingDirectory?: string;
636
+ /** Callback for progress updates */
637
+ onProgress?: (message: string) => void;
638
+ /** Callback for step completion */
639
+ onComplete?: (result: StepResult) => void;
640
+ }
641
+
642
+ /**
643
+ * Execution order for steps
644
+ */
645
+ export declare interface ExecutionOrder {
646
+ /** Steps in execution order (respects dependencies) */
647
+ order: number[];
648
+ /** Steps grouped by parallel execution level */
649
+ levels: number[][];
650
+ }
651
+
66
652
  /**
67
653
  * EXECUTION_PLAN.md schema
68
654
  */
@@ -84,276 +670,1554 @@ export declare interface ExecutionPlanDocument {
84
670
  }
85
671
 
86
672
  /**
87
- * Generate a STATUS.md file
88
- *
89
- * @param plan - The plan to generate status for
90
- * @returns STATUS.md content
673
+ * Available execution providers
674
+ */
675
+ export declare type ExecutionProviderType = "anthropic" | "openai" | "gemini" | "mock";
676
+
677
+ /**
678
+ * Provider-specific executor factory type
91
679
  *
92
- * @stub Not yet implemented
680
+ * External provider packages should export functions matching this signature.
93
681
  */
94
- export declare function generateStatus(_plan: unknown): never;
682
+ export declare type ExecutorFactory = (config: ProviderConfig) => StepExecutor;
95
683
 
96
684
  /**
97
- * Issue encountered during execution
685
+ * Fail a step
98
686
  */
99
- export declare interface Issue {
100
- /** Unique identifier */
101
- id: string;
102
- /** Issue title */
103
- title: string;
104
- /** Description */
105
- description: string;
106
- /** Severity */
107
- severity: Priority;
108
- /** Related step */
109
- step?: number;
110
- /** When encountered */
111
- createdAt: Date;
112
- /** When resolved */
113
- resolvedAt?: Date;
114
- /** How it was resolved */
687
+ export declare function failStep(plan: Plan, stepNumber: number, reason?: string): PlanStep;
688
+
689
+ export declare const FeatureTemplate: PlanTemplate;
690
+
691
+ /**
692
+ * Context reference for feedback (file:lines)
693
+ */
694
+ export declare interface FeedbackContext {
695
+ /** File path */
696
+ file: string;
697
+ /** Start line number */
698
+ startLine?: number;
699
+ /** End line number */
700
+ endLine?: number;
701
+ /** Content excerpt */
702
+ content?: string;
703
+ }
704
+
705
+ /**
706
+ * Participant in a feedback discussion
707
+ */
708
+ export declare interface FeedbackParticipant {
709
+ /** Participant name */
710
+ name: string;
711
+ /** Type of participant */
712
+ type: "human" | "ai";
713
+ /** Model identifier for AI participants */
714
+ model?: string;
715
+ }
716
+
717
+ /**
718
+ * Platform where feedback occurred
719
+ */
720
+ export declare type FeedbackPlatform = "cursor" | "chatgpt" | "slack" | "email" | "meeting" | "voice" | "document" | "other";
721
+
722
+ /**
723
+ * Feedback record for deliberation capture
724
+ *
725
+ * Captures discussions, decisions, and changes made during plan development.
726
+ * Each feedback record represents a deliberation session that influenced the plan.
727
+ */
728
+ export declare interface FeedbackRecord {
729
+ /** Unique identifier (e.g., "001", "002") */
730
+ id: string;
731
+ /** Title/subject of the feedback */
732
+ title: string;
733
+ /** When created */
734
+ createdAt: Date;
735
+ /** Participants in the discussion */
736
+ participants: FeedbackParticipant[];
737
+ /** Platform where feedback occurred */
738
+ platform: FeedbackPlatform;
739
+ /** Plan version this feedback relates to */
740
+ planVersion?: string;
741
+ /** Related file references (file:lines) */
742
+ context?: FeedbackContext[];
743
+ /** What was proposed before feedback */
744
+ proposed?: string;
745
+ /** The feedback given */
746
+ feedback: string;
747
+ /** Discussion/debate content */
748
+ discussion?: string;
749
+ /** Resolution/outcome */
115
750
  resolution?: string;
751
+ /** Changes made as a result */
752
+ changes?: string[];
753
+ /** Open questions remaining */
754
+ openQuestions?: string[];
755
+ /** Filename (e.g., "001-initial-review.md") */
756
+ filename: string;
116
757
  }
117
758
 
118
759
  /**
119
- * Load a plan from a directory
760
+ * Find the critical path through the plan
120
761
  *
121
- * @param path - Path to the plan directory
122
- * @returns The loaded plan
762
+ * The critical path is the longest sequence of dependent steps
763
+ * that determines the minimum time to complete the plan.
123
764
  *
124
- * @example
125
- * ```typescript
126
- * const plan = await loadPlan('./prompts/big-splitup');
127
- * console.log(plan.metadata.code); // 'big-splitup'
128
- * console.log(plan.steps.length); // 11
129
- * ```
765
+ * @param plan - The plan to analyze
766
+ * @param graph - Optional pre-built dependency graph
767
+ * @returns Critical path information
768
+ */
769
+ export declare function findCriticalPath(plan: Plan, graph?: DependencyGraph): Promise<CriticalPath>;
770
+
771
+ export declare interface FixableIssue {
772
+ code: string;
773
+ description: string;
774
+ fix: () => Promise<void>;
775
+ }
776
+
777
+ /**
778
+ * Format status with color
779
+ */
780
+ export declare function formatStatus(status: TaskStatus): string;
781
+
782
+ /**
783
+ * Generate markdown for a plan's relationships section
130
784
  *
131
- * @stub Not yet implemented
785
+ * @param plan - The plan with relationships
786
+ * @returns Markdown string for ## Related Plans section
787
+ */
788
+ export declare function generateRelationshipsMarkdown(plan: Plan): string;
789
+
790
+ /**
791
+ * Generate retrospective data from a plan
792
+ */
793
+ export declare function generateRetrospective(plan: Plan, options?: GenerateRetrospectiveOptions): Retrospective;
794
+
795
+ /**
796
+ * Generate RETROSPECTIVE.md content
132
797
  */
133
- export declare function loadPlan(_path: string): Promise<never>;
798
+ export declare function generateRetrospectiveMarkdown(retro: Retrospective): string;
134
799
 
135
800
  /**
136
- * Parse a STATUS.md file
801
+ * Options for generating a retrospective
802
+ */
803
+ export declare interface GenerateRetrospectiveOptions {
804
+ /** Custom "what went well" entries */
805
+ whatWentWell?: string[];
806
+ /** Custom "what could improve" entries */
807
+ whatCouldImprove?: string[];
808
+ /** Custom key learnings */
809
+ keyLearnings?: string[];
810
+ /** Custom action items */
811
+ actionItems?: string[];
812
+ /** Author */
813
+ author?: string;
814
+ }
815
+
816
+ /**
817
+ * Generate a complete STATUS.md document from a plan
818
+ */
819
+ export declare function generateStatus(plan: Plan, options?: GenerateStatusOptions): string;
820
+
821
+ export declare interface GenerateStatusOptions {
822
+ /** Preserve existing notes section */
823
+ preserveNotes?: boolean;
824
+ /** Existing STATUS.md content (for preservation) */
825
+ existingContent?: string;
826
+ /** Include phase progress if phases defined */
827
+ includePhases?: boolean;
828
+ /** Date format for timestamps */
829
+ dateFormat?: "iso" | "short" | "long";
830
+ }
831
+
832
+ /**
833
+ * Find all plans that this plan blocks
137
834
  *
138
- * @param content - The STATUS.md content
139
- * @returns Parsed status document
835
+ * @param plan - The plan to check
836
+ * @returns Paths to blocked plans
837
+ */
838
+ export declare function getBlockedPlans(plan: Plan): string[];
839
+
840
+ /**
841
+ * Get steps that are blocked by a specific step
140
842
  *
141
- * @stub Not yet implemented
843
+ * @param plan - The plan
844
+ * @param stepNumber - The blocking step
845
+ * @param graph - Optional pre-built dependency graph
846
+ * @returns Steps blocked by this step
142
847
  */
143
- export declare function parseStatus(_content: string): never;
848
+ export declare function getBlockedSteps(plan: Plan, stepNumber: number, graph?: DependencyGraph): Promise<PlanStep[]>;
144
849
 
145
850
  /**
146
- * Complete plan definition
851
+ * Find all plans that block this plan
852
+ *
853
+ * @param plan - The plan to check
854
+ * @returns Paths to blocking plans
147
855
  */
148
- export declare interface Plan {
149
- /** Plan metadata */
150
- metadata: PlanMetadata;
151
- /** Plan files */
152
- files: PlanFiles;
153
- /** Plan steps */
154
- steps: PlanStep[];
155
- /** Plan phases (optional grouping) */
156
- phases?: PlanPhase[];
157
- /** Current state */
158
- state: PlanState;
159
- }
856
+ export declare function getBlockingPlans(plan: Plan): string[];
160
857
 
161
858
  /**
162
- * File naming conventions
859
+ * Find all child plans (plans spawned from this one)
860
+ *
861
+ * @param plan - The plan to check
862
+ * @returns Paths to child plans
163
863
  */
164
- export declare const PLAN_CONVENTIONS: {
165
- /** Meta-prompt file patterns */
166
- readonly metaPromptPatterns: readonly ["{code}-prompt.md", "prompt-of-prompts.md", "{code}.md"];
167
- /** Step file pattern */
168
- readonly stepPattern: RegExp;
169
- /** Standard files */
170
- readonly standardFiles: {
171
- readonly summary: "SUMMARY.md";
172
- readonly status: "STATUS.md";
173
- readonly executionPlan: "EXECUTION_PLAN.md";
174
- readonly readme: "README.md";
864
+ export declare function getChildPlans(plan: Plan): string[];
865
+
866
+ /**
867
+ * Get criteria summary statistics
868
+ */
869
+ export declare function getCriteriaSummary(criteria: VerificationCriterion[]): {
870
+ total: number;
871
+ must: number;
872
+ should: number;
873
+ could: number;
874
+ };
875
+
876
+ /**
877
+ * Get the default registry path
878
+ */
879
+ export declare function getDefaultRegistryPath(): string;
880
+
881
+ /**
882
+ * Get the dependency chain for a step (all transitive dependencies)
883
+ *
884
+ * @param plan - The plan
885
+ * @param stepNumber - The step to analyze
886
+ * @param graph - Optional pre-built dependency graph
887
+ * @returns All steps that must be completed before this step
888
+ */
889
+ export declare function getDependencyChain(plan: Plan, stepNumber: number, graph?: DependencyGraph): Promise<number[]>;
890
+
891
+ /**
892
+ * Get a specific feedback record by ID
893
+ *
894
+ * @param planPath - Path to the plan directory
895
+ * @param id - Feedback ID (e.g., '001' or '1')
896
+ * @returns The feedback record or null if not found
897
+ */
898
+ export declare function getFeedback(planPath: string, id: string): Promise<FeedbackRecord | null>;
899
+
900
+ /**
901
+ * Get the inverse relationship type
902
+ */
903
+ export declare function getInverseRelationType(type: RelationshipType): RelationshipType;
904
+
905
+ /**
906
+ * Get the latest milestone
907
+ */
908
+ export declare function getLatestMilestone(history: PlanHistory): MilestoneInfo | undefined;
909
+
910
+ /**
911
+ * Get the latest revision
912
+ */
913
+ export declare function getLatestRevision(history: PlanHistory): RevisionInfo | undefined;
914
+
915
+ /**
916
+ * Get a milestone by name
917
+ */
918
+ export declare function getMilestone(history: PlanHistory, name: string): MilestoneInfo | undefined;
919
+
920
+ /**
921
+ * Find the parent plan (if this plan was spawned from another)
922
+ *
923
+ * @param plan - The plan to check
924
+ * @returns Path to parent plan or null
925
+ */
926
+ export declare function getParentPlan(plan: Plan): string | null;
927
+
928
+ /**
929
+ * Get a plan by code
930
+ */
931
+ export declare function getPlanByCode(registry: PlanRegistry, code: string): RegisteredPlan | null;
932
+
933
+ /**
934
+ * Get a plan by path
935
+ */
936
+ export declare function getPlanByPath(registry: PlanRegistry, path: string): RegisteredPlan | null;
937
+
938
+ /**
939
+ * Get all plans with a specific status
940
+ */
941
+ export declare function getPlansByStatus(registry: PlanRegistry, status: TaskStatus): RegisteredPlan[];
942
+
943
+ /**
944
+ * Get steps that can be started now (all dependencies completed)
945
+ *
946
+ * @param plan - The plan
947
+ * @param graph - Optional pre-built dependency graph
948
+ * @returns Steps ready to start
949
+ */
950
+ export declare function getReadySteps(plan: Plan, graph?: DependencyGraph): Promise<PlanStep[]>;
951
+
952
+ /**
953
+ * Get statistics about the registry
954
+ */
955
+ export declare function getRegistryStats(registry: PlanRegistry): RegistryStats;
956
+
957
+ /**
958
+ * Find all related plans (general relationships)
959
+ *
960
+ * @param plan - The plan to check
961
+ * @returns Paths to related plans
962
+ */
963
+ export declare function getRelatedPlans(plan: Plan): string[];
964
+
965
+ /**
966
+ * Get all relationships of a specific type
967
+ *
968
+ * @param plan - The plan to query
969
+ * @param type - Relationship type to filter by
970
+ * @returns Matching relationships
971
+ */
972
+ export declare function getRelationshipsByType(plan: Plan, type: RelationshipType): PlanRelationship[];
973
+
974
+ /**
975
+ * Get a specific revision by version
976
+ */
977
+ export declare function getRevision(history: PlanHistory, version: string): RevisionInfo | undefined;
978
+
979
+ /**
980
+ * Get emoji icon for status
981
+ */
982
+ export declare function getStatusIcon(status: TaskStatus): string;
983
+
984
+ /**
985
+ * Get a template by ID
986
+ */
987
+ export declare function getTemplate(id: string): PlanTemplate | undefined;
988
+
989
+ /**
990
+ * Handle errors and exit appropriately
991
+ */
992
+ export declare function handleError(error: unknown): never;
993
+
994
+ /**
995
+ * Check if a plan has an analysis
996
+ */
997
+ export declare function hasAnalysis(planPath: string): Promise<boolean>;
998
+
999
+ /**
1000
+ * Minimum scores for "healthy" status
1001
+ */
1002
+ export declare const HEALTH_THRESHOLDS: {
1003
+ readonly coverage: {
1004
+ readonly good: 80;
1005
+ readonly warning: 60;
1006
+ readonly critical: 40;
175
1007
  };
176
- /** Standard directories */
177
- readonly standardDirs: {
178
- readonly plan: "plan";
179
- readonly analysis: "analysis";
180
- readonly architecture: "architecture";
181
- readonly implementation: "implementation";
182
- readonly testing: "testing";
1008
+ readonly completion: {
1009
+ readonly good: 90;
1010
+ readonly warning: 70;
1011
+ readonly critical: 50;
183
1012
  };
184
- /** Status emoji mapping */
185
- readonly statusEmoji: Record<TaskStatus, string>;
186
1013
  };
187
1014
 
188
1015
  /**
189
- * Context for plan execution
1016
+ * History manager interface
190
1017
  */
191
- export declare interface PlanContext {
192
- /** Working directory */
193
- workingDirectory: string;
194
- /** The plan being executed */
195
- plan: Plan;
196
- /** Logger instance */
197
- logger?: any;
198
- /** Storage for artifacts */
199
- storage?: any;
200
- /** Environment variables */
201
- env?: Record<string, string>;
1018
+ export declare interface HistoryManager {
1019
+ /** History data */
1020
+ history: PlanHistory;
1021
+ /** Path to history file */
1022
+ path: string;
1023
+ /** Save history to disk */
1024
+ save(): Promise<void>;
1025
+ /** Reload history from disk */
1026
+ reload(): Promise<void>;
202
1027
  }
203
1028
 
204
1029
  /**
205
- * Standard plan files
1030
+ * Options for HTML rendering
206
1031
  */
207
- export declare interface PlanFiles {
208
- /** Meta-prompt file (e.g., "big-splitup-prompt.md" or "prompt-of-prompts.md") */
209
- metaPrompt?: string;
210
- /** Summary file */
211
- summary?: string;
212
- /** Status file */
213
- status?: string;
214
- /** Execution plan file */
215
- executionPlan?: string;
216
- /** README file */
217
- readme?: string;
218
- /** Step files in order */
219
- steps: string[];
220
- /** Analysis directory */
221
- analysisDir?: string;
222
- /** Other directories (architecture/, implementation/, testing/) */
223
- subdirectories: string[];
1032
+ export declare interface HtmlRenderOptions {
1033
+ /** Include full HTML document (with head/body) */
1034
+ fullDocument?: boolean;
1035
+ /** Document title (defaults to plan name) */
1036
+ title?: string;
1037
+ /** Include inline CSS styles */
1038
+ includeStyles?: boolean;
1039
+ /** CSS theme: light or dark */
1040
+ theme?: "light" | "dark";
1041
+ /** Include step details */
1042
+ includeStepDetails?: boolean;
1043
+ /** Include feedback records */
1044
+ includeFeedback?: boolean;
1045
+ /** Include evidence records */
1046
+ includeEvidence?: boolean;
1047
+ }
1048
+
1049
+ /**
1050
+ * Create the init command
1051
+ */
1052
+ export declare function initCommand(): Command;
1053
+
1054
+ /**
1055
+ * Initialize a new history for a plan
1056
+ */
1057
+ export declare function initHistory(initialVersion?: string): PlanHistory;
1058
+
1059
+ /**
1060
+ * Insert a new step into a plan
1061
+ */
1062
+ export declare function insertStep(plan: Plan, options: InsertStepOptions): Promise<InsertStepResult>;
1063
+
1064
+ export declare interface InsertStepOptions {
1065
+ /** Step title */
1066
+ title: string;
1067
+ /** Step description */
1068
+ description?: string;
1069
+ /** Position to insert (1-based). If omitted, appends. */
1070
+ position?: number;
1071
+ /** Insert after this step number */
1072
+ after?: number;
1073
+ /** Initial status */
1074
+ status?: TaskStatus;
1075
+ }
1076
+
1077
+ export declare interface InsertStepResult {
1078
+ /** Inserted step */
1079
+ step: PlanStep;
1080
+ /** Files that were renamed */
1081
+ renamedFiles: Array<{
1082
+ from: string;
1083
+ to: string;
1084
+ }>;
1085
+ /** Created file path */
1086
+ createdFile: string;
1087
+ }
1088
+
1089
+ /**
1090
+ * An invalid relationship
1091
+ */
1092
+ export declare interface InvalidRelationship {
1093
+ relationship: PlanRelationship;
1094
+ reason: string;
1095
+ }
1096
+
1097
+ /**
1098
+ * Issue encountered during execution
1099
+ */
1100
+ export declare interface Issue {
1101
+ /** Unique identifier */
1102
+ id: string;
1103
+ /** Issue title */
1104
+ title: string;
1105
+ /** Description */
1106
+ description: string;
1107
+ /** Severity */
1108
+ severity: Priority;
1109
+ /** Related step */
1110
+ step?: number;
1111
+ /** When encountered */
1112
+ createdAt: Date;
1113
+ /** When resolved */
1114
+ resolvedAt?: Date;
1115
+ /** How it was resolved */
1116
+ resolution?: string;
1117
+ }
1118
+
1119
+ /**
1120
+ * Options for JSON rendering
1121
+ */
1122
+ export declare interface JsonRenderOptions {
1123
+ /** Pretty print with indentation */
1124
+ pretty?: boolean;
1125
+ /** Indentation (spaces or tab) */
1126
+ indent?: number | string;
1127
+ /** Include full step content */
1128
+ includeStepContent?: boolean;
1129
+ /** Include feedback records */
1130
+ includeFeedback?: boolean;
1131
+ /** Include evidence records */
1132
+ includeEvidence?: boolean;
1133
+ /** Only include specific fields */
1134
+ fields?: string[];
1135
+ }
1136
+
1137
+ /**
1138
+ * List all feedback records for a plan
1139
+ *
1140
+ * @param planPath - Path to the plan directory
1141
+ * @returns Array of feedback records sorted by ID
1142
+ */
1143
+ export declare function listFeedback(planPath: string): Promise<FeedbackRecord[]>;
1144
+
1145
+ /**
1146
+ * List all milestones
1147
+ */
1148
+ export declare function listMilestones(history: PlanHistory): MilestoneInfo[];
1149
+
1150
+ /**
1151
+ * List all revisions
1152
+ */
1153
+ export declare function listRevisions(history: PlanHistory): RevisionInfo[];
1154
+
1155
+ /**
1156
+ * List all available templates
1157
+ */
1158
+ export declare function listTemplates(): PlanTemplate[];
1159
+
1160
+ /**
1161
+ * List templates by category
1162
+ */
1163
+ export declare function listTemplatesByCategory(category: PlanTemplate["category"]): PlanTemplate[];
1164
+
1165
+ /**
1166
+ * Load all amendment prompts for a plan
1167
+ */
1168
+ export declare function loadAmendmentPrompts(planPath: string): Promise<SavedPrompt[]>;
1169
+
1170
+ /**
1171
+ * Load an analysis from disk
1172
+ */
1173
+ export declare function loadAnalysis(planPath: string): Promise<Analysis | null>;
1174
+
1175
+ /**
1176
+ * Load all elaboration prompts for a plan
1177
+ */
1178
+ export declare function loadElaborationPrompts(planPath: string): Promise<SavedPrompt[]>;
1179
+
1180
+ /**
1181
+ * Load history from disk
1182
+ */
1183
+ export declare function loadHistory(planPath: string): Promise<HistoryManager>;
1184
+
1185
+ /**
1186
+ * Load a plan from a directory
1187
+ *
1188
+ * @param path - Path to the plan directory
1189
+ * @param options - Loading options
1190
+ * @returns The loaded plan
1191
+ *
1192
+ * @example
1193
+ * ```typescript
1194
+ * const plan = await loadPlan('./prompts/big-splitup');
1195
+ * console.log(plan.metadata.code); // 'big-splitup'
1196
+ * console.log(plan.steps.length); // 11
1197
+ * ```
1198
+ */
1199
+ export declare function loadPlan(path: string, options?: LoadPlanOptions): Promise<Plan>;
1200
+
1201
+ /**
1202
+ * Options for loading a plan
1203
+ */
1204
+ export declare interface LoadPlanOptions {
1205
+ /** Include feedback records (default: true) */
1206
+ includeFeedback?: boolean;
1207
+ /** Include evidence files (default: true) */
1208
+ includeEvidence?: boolean;
1209
+ /** Parse STATUS.md for state (default: true) */
1210
+ parseStatus?: boolean;
1211
+ }
1212
+
1213
+ /**
1214
+ * Load registry from file
1215
+ *
1216
+ * @param path - Path to registry file (defaults to home directory)
1217
+ */
1218
+ export declare function loadRegistry(path?: string): Promise<PlanRegistry | null>;
1219
+
1220
+ /**
1221
+ * Options for Markdown rendering
1222
+ */
1223
+ export declare interface MarkdownRenderOptions {
1224
+ /** Include metadata section */
1225
+ includeMetadata?: boolean;
1226
+ /** Include step details */
1227
+ includeStepDetails?: boolean;
1228
+ /** Include feedback records */
1229
+ includeFeedback?: boolean;
1230
+ /** Include evidence records */
1231
+ includeEvidence?: boolean;
1232
+ /** Use task list format for steps */
1233
+ useTaskList?: boolean;
1234
+ /** Table of contents */
1235
+ includeToc?: boolean;
1236
+ }
1237
+
1238
+ export declare const MigrationTemplate: PlanTemplate;
1239
+
1240
+ /**
1241
+ * Extended milestone info
1242
+ */
1243
+ export declare interface MilestoneInfo extends PlanMilestone {
1244
+ /** Milestone index */
1245
+ index: number;
1246
+ }
1247
+
1248
+ /**
1249
+ * Mock step executor for testing
1250
+ */
1251
+ export declare class MockStepExecutor implements StepExecutor {
1252
+ private delay;
1253
+ private shouldFail;
1254
+ constructor(options?: {
1255
+ delay?: number;
1256
+ shouldFail?: boolean;
1257
+ });
1258
+ execute(context: ExecutionContext): Promise<StepResult>;
1259
+ }
1260
+
1261
+ /**
1262
+ * Move a step to a new position
1263
+ */
1264
+ export declare function moveStep(plan: Plan, fromNumber: number, toNumber: number): Promise<MoveStepResult>;
1265
+
1266
+ export declare interface MoveStepResult {
1267
+ /** Moved step */
1268
+ step: PlanStep;
1269
+ /** New position */
1270
+ newPosition: number;
1271
+ /** Files that were renamed */
1272
+ renamedFiles: Array<{
1273
+ from: string;
1274
+ to: string;
1275
+ }>;
1276
+ }
1277
+
1278
+ /**
1279
+ * Generate a new version number
1280
+ */
1281
+ export declare function nextVersion(currentVersion: string): string;
1282
+
1283
+ /**
1284
+ * Show "not implemented" message for future features
1285
+ */
1286
+ export declare function notImplemented(feature: string): never;
1287
+
1288
+ /**
1289
+ * Output an error message
1290
+ */
1291
+ export declare function outputError(message: string): void;
1292
+
1293
+ /**
1294
+ * Output an info message
1295
+ */
1296
+ export declare function outputInfo(message: string): void;
1297
+
1298
+ /**
1299
+ * Output data as JSON
1300
+ */
1301
+ export declare function outputJson(data: unknown): void;
1302
+
1303
+ /**
1304
+ * Output a plan summary
1305
+ */
1306
+ export declare function outputPlanSummary(plan: Plan): void;
1307
+
1308
+ /**
1309
+ * Output a list of steps
1310
+ */
1311
+ export declare function outputStepList(steps: PlanStep[]): void;
1312
+
1313
+ /**
1314
+ * Output a success message
1315
+ */
1316
+ export declare function outputSuccess(message: string): void;
1317
+
1318
+ /**
1319
+ * Output a warning message
1320
+ */
1321
+ export declare function outputWarning(message: string): void;
1322
+
1323
+ /**
1324
+ * Parse all dependencies from a plan
1325
+ *
1326
+ * @param plan - The plan to analyze
1327
+ * @returns Map of step number to its dependencies
1328
+ */
1329
+ export declare function parseAllDependencies(plan: Plan): Promise<Map<number, number[]>>;
1330
+
1331
+ /**
1332
+ * Parse verification criteria from a plan's analysis
1333
+ */
1334
+ export declare function parseCriteria(planPath: string): Promise<ParsedCriteria>;
1335
+
1336
+ /**
1337
+ * Parse criteria from markdown content
1338
+ */
1339
+ export declare function parseCriteriaFromContent(content: string, source: string): ParsedCriteria;
1340
+
1341
+ export declare interface ParsedCriteria {
1342
+ criteria: VerificationCriterion[];
1343
+ source: string;
1344
+ parseErrors: string[];
1345
+ }
1346
+
1347
+ /**
1348
+ * Parse dependencies from step content
1349
+ *
1350
+ * Looks for dependency declarations in the markdown:
1351
+ * - `## Dependencies` section with bullet points
1352
+ * - `depends-on: 1, 2, 3` in frontmatter
1353
+ * - Inline references like `(depends on Step 01)`
1354
+ *
1355
+ * @param content - Step file content
1356
+ * @returns Array of step numbers this step depends on
1357
+ */
1358
+ export declare function parseDependenciesFromContent(content: string): number[];
1359
+
1360
+ /**
1361
+ * Parse dependencies from a step file
1362
+ *
1363
+ * @param filePath - Path to step file
1364
+ * @returns Array of step numbers this step depends on
1365
+ */
1366
+ export declare function parseDependenciesFromFile(filePath: string): Promise<number[]>;
1367
+
1368
+ /**
1369
+ * Parsed relationship from file content
1370
+ */
1371
+ export declare interface ParsedRelationship {
1372
+ type: RelationshipType;
1373
+ targetPath: string;
1374
+ steps?: number[];
1375
+ reason?: string;
1376
+ }
1377
+
1378
+ /**
1379
+ * Parse relationships from plan content
1380
+ *
1381
+ * Looks for relationship declarations in markdown:
1382
+ * - `## Related Plans` section with formatted links
1383
+ * - `spawned-from: path/to/plan` in frontmatter
1384
+ * - `blocks: path/to/plan` in frontmatter
1385
+ *
1386
+ * Supported formats in ## Related Plans:
1387
+ * - `- **spawned-from**: path/to/plan - reason`
1388
+ * - `- [plan-name](path/to/plan) - blocks Step 3`
1389
+ * - `- path/to/plan (related)`
1390
+ *
1391
+ * @param content - Plan file content (typically SUMMARY.md or meta-prompt)
1392
+ * @returns Array of parsed relationships
1393
+ */
1394
+ export declare function parseRelationshipsFromContent(content: string): ParsedRelationship[];
1395
+
1396
+ /**
1397
+ * Parse relationships from a plan's SUMMARY.md or meta-prompt
1398
+ *
1399
+ * @param planPath - Path to the plan directory
1400
+ * @returns Array of parsed relationships
1401
+ */
1402
+ export declare function parseRelationshipsFromPlan(planPath: string): Promise<ParsedRelationship[]>;
1403
+
1404
+ /**
1405
+ * Parse STATUS.md content into structured data
1406
+ *
1407
+ * @param content - The STATUS.md file content
1408
+ * @param options - Parsing options
1409
+ * @returns Parsed document, state, and any warnings
1410
+ *
1411
+ * @example
1412
+ * ```typescript
1413
+ * const content = await readFile('STATUS.md', 'utf-8');
1414
+ * const result = parseStatus(content);
1415
+ * console.log(result.state.progress); // 40
1416
+ * console.log(result.document.stepProgress.length); // 5
1417
+ * ```
1418
+ */
1419
+ export declare function parseStatus(content: string, options?: ParseStatusOptions): ParseStatusResult;
1420
+
1421
+ /**
1422
+ * Options for parsing STATUS.md
1423
+ */
1424
+ export declare interface ParseStatusOptions {
1425
+ /** Steps to cross-reference for status updates */
1426
+ steps?: PlanStep[];
1427
+ }
1428
+
1429
+ /**
1430
+ * Result of parsing STATUS.md
1431
+ */
1432
+ export declare interface ParseStatusResult {
1433
+ /** Parsed status document */
1434
+ document: StatusDocument;
1435
+ /** Derived plan state */
1436
+ state: PlanState;
1437
+ /** Parsing warnings */
1438
+ warnings: string[];
1439
+ }
1440
+
1441
+ /**
1442
+ * Complete plan definition
1443
+ */
1444
+ export declare interface Plan {
1445
+ /** Plan metadata */
1446
+ metadata: PlanMetadata;
1447
+ /** Plan files */
1448
+ files: PlanFiles;
1449
+ /** Plan steps */
1450
+ steps: PlanStep[];
1451
+ /** Plan phases (optional grouping) */
1452
+ phases?: PlanPhase[];
1453
+ /** Current state */
1454
+ state: PlanState;
1455
+ /** Feedback records */
1456
+ feedback?: FeedbackRecord[];
1457
+ /** Evidence files */
1458
+ evidence?: EvidenceRecord[];
1459
+ /** Revision history */
1460
+ history?: PlanHistory;
1461
+ /** Context assignment */
1462
+ context?: ContextId;
1463
+ /** Relationships to other plans */
1464
+ relationships?: PlanRelationship[];
1465
+ }
1466
+
1467
+ /**
1468
+ * File naming conventions
1469
+ */
1470
+ export declare const PLAN_CONVENTIONS: {
1471
+ /** Meta-prompt file patterns */
1472
+ readonly metaPromptPatterns: readonly ["{code}-prompt.md", "prompt-of-prompts.md", "{code}.md"];
1473
+ /** Step file pattern (e.g., "01-step-name.md") */
1474
+ readonly stepPattern: RegExp;
1475
+ /** Feedback file pattern (e.g., "001-initial-review.md") */
1476
+ readonly feedbackPattern: RegExp;
1477
+ /** Evidence file patterns */
1478
+ readonly evidencePatterns: readonly [RegExp, RegExp, RegExp, RegExp];
1479
+ /** Standard files */
1480
+ readonly standardFiles: {
1481
+ readonly summary: "SUMMARY.md";
1482
+ readonly status: "STATUS.md";
1483
+ readonly executionPlan: "EXECUTION_PLAN.md";
1484
+ readonly readme: "README.md";
1485
+ readonly changelog: "CHANGELOG.md";
1486
+ };
1487
+ /** Standard directories */
1488
+ readonly standardDirs: {
1489
+ readonly plan: "plan";
1490
+ readonly analysis: "analysis";
1491
+ readonly architecture: "architecture";
1492
+ readonly implementation: "implementation";
1493
+ readonly testing: "testing";
1494
+ readonly feedback: "feedback";
1495
+ readonly evidence: "evidence";
1496
+ readonly history: ".history";
1497
+ };
1498
+ /** Status emoji mapping */
1499
+ readonly statusEmoji: Record<TaskStatus, string>;
1500
+ /** Emoji to status mapping (reverse lookup) */
1501
+ readonly emojiToStatus: Record<string, TaskStatus>;
1502
+ };
1503
+
1504
+ /**
1505
+ * Context for plan execution
1506
+ */
1507
+ export declare interface PlanContext {
1508
+ /** Working directory */
1509
+ workingDirectory: string;
1510
+ /** The plan being executed */
1511
+ plan: Plan;
1512
+ /** Logger instance */
1513
+ logger?: any;
1514
+ /** Storage for artifacts */
1515
+ storage?: any;
1516
+ /** Environment variables */
1517
+ env?: Record<string, string>;
1518
+ }
1519
+
1520
+ /**
1521
+ * Plan context definition
1522
+ *
1523
+ * Contexts allow organizing plans by domain (work, personal, etc.)
1524
+ * with optional hierarchy support.
1525
+ */
1526
+ export declare interface PlanContextDefinition {
1527
+ /** Context identifier */
1528
+ id: ContextId;
1529
+ /** Display name */
1530
+ name: string;
1531
+ /** Parent context (for hierarchy) */
1532
+ parent?: ContextId;
1533
+ /** Default for this directory? */
1534
+ isDefault?: boolean;
1535
+ }
1536
+
1537
+ /**
1538
+ * Standard plan files
1539
+ */
1540
+ export declare interface PlanFiles {
1541
+ /** Meta-prompt file (e.g., "big-splitup-prompt.md" or "prompt-of-prompts.md") */
1542
+ metaPrompt?: string;
1543
+ /** Summary file */
1544
+ summary?: string;
1545
+ /** Status file */
1546
+ status?: string;
1547
+ /** Execution plan file */
1548
+ executionPlan?: string;
1549
+ /** README file */
1550
+ readme?: string;
1551
+ /** Step files in order */
1552
+ steps: string[];
1553
+ /** Analysis directory */
1554
+ analysisDir?: string;
1555
+ /** Other directories (architecture/, implementation/, testing/) */
1556
+ subdirectories: string[];
1557
+ /** Feedback directory */
1558
+ feedbackDir?: string;
1559
+ /** Feedback files */
1560
+ feedbackFiles?: string[];
1561
+ /** Evidence directory */
1562
+ evidenceDir?: string;
1563
+ /** Evidence files */
1564
+ evidenceFiles?: string[];
1565
+ /** History directory */
1566
+ historyDir?: string;
1567
+ /** CHANGELOG.md */
1568
+ changelog?: string;
1569
+ }
1570
+
1571
+ /**
1572
+ * Plan version history
1573
+ *
1574
+ * Embedded version tracking without Git dependency.
1575
+ * Supports milestones for explicit cleanup points.
1576
+ */
1577
+ export declare interface PlanHistory {
1578
+ /** All revisions in order */
1579
+ revisions: PlanRevision[];
1580
+ /** Current version */
1581
+ currentVersion: string;
1582
+ /** Milestones (explicit cleanup points) */
1583
+ milestones?: PlanMilestone[];
1584
+ }
1585
+
1586
+ /**
1587
+ * Plan metadata from the directory and files
1588
+ */
1589
+ export declare interface PlanMetadata {
1590
+ /** Plan code (directory name, e.g., "big-splitup") */
1591
+ code: string;
1592
+ /** Human-readable name */
1593
+ name: string;
1594
+ /** Description from SUMMARY.md or meta-prompt */
1595
+ description?: string;
1596
+ /** Version (for tracking changes to the plan itself) */
1597
+ version?: string;
1598
+ /** Author */
1599
+ author?: string;
1600
+ /** Tags for categorization */
1601
+ tags?: string[];
1602
+ /** When the plan was created */
1603
+ createdAt?: Date;
1604
+ /** Path to the plan directory */
1605
+ path: string;
1606
+ }
1607
+
1608
+ /**
1609
+ * A milestone in plan history (explicit cleanup point)
1610
+ */
1611
+ export declare interface PlanMilestone {
1612
+ /** Milestone name */
1613
+ name: string;
1614
+ /** Version at this milestone */
1615
+ version: string;
1616
+ /** When created */
1617
+ createdAt: Date;
1618
+ /** Description */
1619
+ description?: string;
1620
+ }
1621
+
1622
+ /**
1623
+ * A phase grouping multiple steps
1624
+ */
1625
+ export declare interface PlanPhase {
1626
+ /** Phase number */
1627
+ number: number;
1628
+ /** Phase name */
1629
+ name: string;
1630
+ /** Description */
1631
+ description?: string;
1632
+ /** Steps in this phase */
1633
+ steps: number[];
1634
+ /** Phase status (derived from step statuses) */
1635
+ status: TaskStatus;
1636
+ /** Estimated duration */
1637
+ estimatedDuration?: string;
1638
+ /** Actual duration */
1639
+ actualDuration?: string;
1640
+ }
1641
+
1642
+ /**
1643
+ * Plan registry containing all discovered plans
1644
+ */
1645
+ export declare interface PlanRegistry {
1646
+ /** Version of the registry format */
1647
+ version: string;
1648
+ /** When last updated */
1649
+ lastUpdatedAt: Date;
1650
+ /** Search paths for plan discovery */
1651
+ searchPaths: string[];
1652
+ /** All registered plans indexed by path */
1653
+ plans: Map<string, RegisteredPlan>;
1654
+ /** Index by code for quick lookup */
1655
+ byCode: Map<string, string[]>;
1656
+ /** Index by status */
1657
+ byStatus: Map<TaskStatus, string[]>;
1658
+ }
1659
+
1660
+ /**
1661
+ * Relationship between plans
1662
+ *
1663
+ * Tracks dependencies, spawning, and other relationships
1664
+ * between plans for cross-plan coordination.
1665
+ */
1666
+ export declare interface PlanRelationship {
1667
+ /** Type of relationship */
1668
+ type: RelationshipType;
1669
+ /** Related plan path */
1670
+ planPath: string;
1671
+ /** Specific step(s) involved */
1672
+ steps?: number[];
1673
+ /** Reason for relationship */
1674
+ reason?: string;
1675
+ /** When established */
1676
+ createdAt: Date;
1677
+ }
1678
+
1679
+ /**
1680
+ * Result of executing a plan
1681
+ */
1682
+ export declare interface PlanResult {
1683
+ /** Whether the plan completed successfully */
1684
+ success: boolean;
1685
+ /** Steps that were executed */
1686
+ executedSteps: number[];
1687
+ /** Steps that succeeded */
1688
+ completedSteps: number[];
1689
+ /** Steps that failed */
1690
+ failedSteps: number[];
1691
+ /** Steps that were skipped */
1692
+ skippedSteps: number[];
1693
+ /** Total duration */
1694
+ duration: number;
1695
+ /** Final plan state */
1696
+ finalState: PlanState;
1697
+ }
1698
+
1699
+ /**
1700
+ * A single revision in plan history
1701
+ */
1702
+ export declare interface PlanRevision {
1703
+ /** Version string (e.g., "0.1", "0.2") */
1704
+ version: string;
1705
+ /** When this revision was created */
1706
+ createdAt: Date;
1707
+ /** Commit message/description */
1708
+ message?: string;
1709
+ /** Author */
1710
+ author?: string;
1711
+ /** Feedback record that triggered this revision */
1712
+ feedbackId?: string;
1713
+ }
1714
+
1715
+ /**
1716
+ * Current state of plan execution
1717
+ */
1718
+ export declare interface PlanState {
1719
+ /** Overall plan status */
1720
+ status: TaskStatus;
1721
+ /** Current step being executed */
1722
+ currentStep?: number;
1723
+ /** Last completed step */
1724
+ lastCompletedStep?: number;
1725
+ /** When execution started */
1726
+ startedAt?: Date;
1727
+ /** When last updated */
1728
+ lastUpdatedAt: Date;
1729
+ /** When completed */
1730
+ completedAt?: Date;
1731
+ /** Active blockers */
1732
+ blockers: Blocker[];
1733
+ /** Issues encountered */
1734
+ issues: Issue[];
1735
+ /** Progress percentage (0-100) */
1736
+ progress: number;
1737
+ }
1738
+
1739
+ /**
1740
+ * A single step in a plan (corresponds to a numbered file like 01-STEP.md)
1741
+ */
1742
+ export declare interface PlanStep {
1743
+ /** Step number (1, 2, 3...) */
1744
+ number: number;
1745
+ /** Step code/slug (extracted from filename, e.g., "execution-interfaces") */
1746
+ code: string;
1747
+ /** Full filename (e.g., "01-execution-interfaces.md") */
1748
+ filename: string;
1749
+ /** Human-readable title */
1750
+ title: string;
1751
+ /** Step description */
1752
+ description?: string;
1753
+ /** Current status */
1754
+ status: TaskStatus;
1755
+ /** Dependencies on other steps (by number) */
1756
+ dependencies?: number[];
1757
+ /** When this step was started */
1758
+ startedAt?: Date;
1759
+ /** When this step was completed */
1760
+ completedAt?: Date;
1761
+ /** Duration in milliseconds */
1762
+ duration?: number;
1763
+ /** Notes or issues encountered */
1764
+ notes?: string;
1765
+ /** Path to the step file */
1766
+ filePath: string;
1767
+ }
1768
+
1769
+ /**
1770
+ * A plan template definition
1771
+ */
1772
+ export declare interface PlanTemplate {
1773
+ /** Unique template ID */
1774
+ id: string;
1775
+ /** Display name */
1776
+ name: string;
1777
+ /** Description of the template */
1778
+ description: string;
1779
+ /** Category */
1780
+ category: "general" | "development" | "operations" | "documentation";
1781
+ /** Tags for searchability */
1782
+ tags: string[];
1783
+ /** Default steps for this template */
1784
+ steps: TemplateStep[];
1785
+ /** Default phases (optional grouping) */
1786
+ phases?: Array<{
1787
+ name: string;
1788
+ description: string;
1789
+ steps: number[];
1790
+ }>;
1791
+ /** Custom SUMMARY.md content template */
1792
+ summaryTemplate?: string;
1793
+ /** Custom EXECUTION_PLAN.md content template */
1794
+ executionPlanTemplate?: string;
1795
+ /** Additional files to create */
1796
+ additionalFiles?: Array<{
1797
+ path: string;
1798
+ content: string;
1799
+ }>;
1800
+ }
1801
+
1802
+ /**
1803
+ * Priority level
1804
+ */
1805
+ export declare type Priority = "high" | "medium" | "low";
1806
+
1807
+ /**
1808
+ * Weight multipliers for coverage scoring by priority
1809
+ */
1810
+ export declare const PRIORITY_WEIGHTS: {
1811
+ readonly must: 1;
1812
+ readonly should: 0.7;
1813
+ readonly could: 0.3;
1814
+ };
1815
+
1816
+ /**
1817
+ * Configuration for an execution provider
1818
+ */
1819
+ export declare interface ProviderConfig {
1820
+ /** Provider type */
1821
+ type: ExecutionProviderType;
1822
+ /** API key (if required) */
1823
+ apiKey?: string;
1824
+ /** Model to use */
1825
+ model?: string;
1826
+ /** Maximum tokens */
1827
+ maxTokens?: number;
1828
+ /** Temperature */
1829
+ temperature?: number;
1830
+ }
1831
+
1832
+ export declare const RefactoringTemplate: PlanTemplate;
1833
+
1834
+ /**
1835
+ * Refresh all plans in the registry
1836
+ */
1837
+ export declare function refreshAllPlans(registry: PlanRegistry): Promise<{
1838
+ updated: number;
1839
+ removed: number;
1840
+ }>;
1841
+
1842
+ /**
1843
+ * Refresh a single plan's entry
1844
+ *
1845
+ * @param registry - The registry
1846
+ * @param path - Path to the plan
1847
+ * @returns Updated entry or null if plan no longer exists
1848
+ */
1849
+ export declare function refreshPlan(registry: PlanRegistry, path: string): Promise<RegisteredPlan | null>;
1850
+
1851
+ /**
1852
+ * A registered plan entry
1853
+ */
1854
+ export declare interface RegisteredPlan {
1855
+ /** Plan code (directory name) */
1856
+ code: string;
1857
+ /** Human-readable name */
1858
+ name: string;
1859
+ /** Absolute path to plan directory */
1860
+ path: string;
1861
+ /** Overall status */
1862
+ status: TaskStatus;
1863
+ /** Progress percentage */
1864
+ progress: number;
1865
+ /** Number of steps */
1866
+ stepCount: number;
1867
+ /** Number of completed steps */
1868
+ completedSteps: number;
1869
+ /** When discovered/registered */
1870
+ registeredAt: Date;
1871
+ /** When last scanned */
1872
+ lastScannedAt: Date;
1873
+ /** Tags (if any) */
1874
+ tags?: string[];
1875
+ /** Description snippet */
1876
+ description?: string;
1877
+ /** Parent plan path (if spawned from another) */
1878
+ parentPlan?: string;
1879
+ }
1880
+
1881
+ /**
1882
+ * Register a plan in the registry
1883
+ */
1884
+ export declare function registerPlan(registry: PlanRegistry, entry: RegisteredPlan): void;
1885
+
1886
+ /**
1887
+ * Register all plan commands on a Commander program
1888
+ */
1889
+ export declare function registerPlanCommands(program: Command): void;
1890
+
1891
+ /**
1892
+ * Register all render commands on a Commander program
1893
+ */
1894
+ export declare function registerRenderCommands(program: Command): void;
1895
+
1896
+ /**
1897
+ * Register a template
1898
+ */
1899
+ export declare function registerTemplate(template: PlanTemplate): void;
1900
+
1901
+ /**
1902
+ * Options for creating/loading a registry
1903
+ */
1904
+ export declare interface RegistryOptions {
1905
+ /** Search paths to scan for plans */
1906
+ searchPaths?: string[];
1907
+ /** Maximum depth to scan (default: 3) */
1908
+ maxDepth?: number;
1909
+ /** Include hidden directories (default: false) */
1910
+ includeHidden?: boolean;
1911
+ /** Directories to skip */
1912
+ excludeDirs?: string[];
1913
+ }
1914
+
1915
+ /**
1916
+ * Get registry statistics
1917
+ */
1918
+ export declare interface RegistryStats {
1919
+ totalPlans: number;
1920
+ byStatus: Record<TaskStatus, number>;
1921
+ averageProgress: number;
1922
+ oldestPlan?: RegisteredPlan;
1923
+ newestPlan?: RegisteredPlan;
1924
+ searchPathCount: number;
1925
+ }
1926
+
1927
+ /**
1928
+ * Type of relationship between plans
1929
+ */
1930
+ export declare type RelationshipType = "spawned-from" | "spawned" | "blocks" | "blocked-by" | "related";
1931
+
1932
+ /**
1933
+ * Relationship validation result
1934
+ */
1935
+ export declare interface RelationshipValidation {
1936
+ /** All relationships valid */
1937
+ valid: boolean;
1938
+ /** Invalid relationships */
1939
+ invalid: InvalidRelationship[];
1940
+ /** Valid relationships */
1941
+ validRelationships: PlanRelationship[];
1942
+ }
1943
+
1944
+ /**
1945
+ * Remove a relationship from a plan
1946
+ *
1947
+ * @param plan - The source plan
1948
+ * @param targetPath - Path to the related plan to remove
1949
+ * @param type - Optional type to match (removes all types if not specified)
1950
+ * @returns Removed relationships
1951
+ */
1952
+ export declare function removeRelationship(plan: Plan, targetPath: string, type?: RelationshipType): PlanRelationship[];
1953
+
1954
+ /**
1955
+ * Remove a step from a plan
1956
+ */
1957
+ export declare function removeStep(plan: Plan, stepNumber: number): Promise<RemoveStepResult>;
1958
+
1959
+ export declare interface RemoveStepResult {
1960
+ /** Removed step */
1961
+ removedStep: PlanStep;
1962
+ /** Files that were renamed */
1963
+ renamedFiles: Array<{
1964
+ from: string;
1965
+ to: string;
1966
+ }>;
1967
+ /** Deleted file path */
1968
+ deletedFile: string;
1969
+ }
1970
+
1971
+ /**
1972
+ * Create the render command
1973
+ */
1974
+ export declare function renderCommand(): Command;
1975
+
1976
+ /**
1977
+ * Supported render formats
1978
+ */
1979
+ export declare type RenderFormat = "markdown" | "json" | "html";
1980
+
1981
+ /**
1982
+ * Render options (union of all format-specific options)
1983
+ */
1984
+ export declare type RenderOptions = {
1985
+ /** Output format */
1986
+ format: RenderFormat;
1987
+ } & Partial<MarkdownRenderOptions & JsonRenderOptions & HtmlRenderOptions>;
1988
+
1989
+ /**
1990
+ * Render a plan to the specified format
1991
+ */
1992
+ export declare function renderPlan(plan: Plan, options: RenderOptions): RenderResult;
1993
+
1994
+ /**
1995
+ * Result of rendering a plan
1996
+ */
1997
+ export declare interface RenderResult {
1998
+ /** Whether rendering succeeded */
1999
+ success: boolean;
2000
+ /** Rendered output content */
2001
+ content?: string;
2002
+ /** Output format */
2003
+ format?: RenderFormat;
2004
+ /** Error message if failed */
2005
+ error?: string;
2006
+ }
2007
+
2008
+ /**
2009
+ * Render a plan to HTML
2010
+ */
2011
+ export declare function renderToHtml(plan: Plan, options?: Partial<HtmlRenderOptions>): string;
2012
+
2013
+ /**
2014
+ * Render a plan to JSON
2015
+ */
2016
+ export declare function renderToJson(plan: Plan, options?: Partial<JsonRenderOptions>): string;
2017
+
2018
+ /**
2019
+ * Render a plan to Markdown
2020
+ */
2021
+ export declare function renderToMarkdown(plan: Plan, options?: Partial<MarkdownRenderOptions>): string;
2022
+
2023
+ /**
2024
+ * Resume a plan from its current state
2025
+ *
2026
+ * @param plan - The plan to resume
2027
+ * @param context - Execution context
2028
+ * @returns Plan result
2029
+ *
2030
+ * @stub Not yet implemented
2031
+ */
2032
+ export declare function resumePlan(_plan: unknown, _context?: unknown): Promise<never>;
2033
+
2034
+ /**
2035
+ * Retrospective data structure
2036
+ */
2037
+ export declare interface Retrospective {
2038
+ /** Plan name */
2039
+ planName: string;
2040
+ /** Plan code */
2041
+ planCode: string;
2042
+ /** When the plan started */
2043
+ startedAt?: Date;
2044
+ /** When the plan completed */
2045
+ completedAt?: Date;
2046
+ /** Total duration in milliseconds */
2047
+ duration?: number;
2048
+ /** Total steps */
2049
+ totalSteps: number;
2050
+ /** Completed steps */
2051
+ completedSteps: number;
2052
+ /** Skipped steps */
2053
+ skippedSteps: number;
2054
+ /** What went well */
2055
+ whatWentWell: string[];
2056
+ /** What could improve */
2057
+ whatCouldImprove: string[];
2058
+ /** Key learnings */
2059
+ keyLearnings: string[];
2060
+ /** Action items for future */
2061
+ actionItems: string[];
2062
+ /** Steps summary */
2063
+ stepsSummary: Array<{
2064
+ number: number;
2065
+ title: string;
2066
+ status: string;
2067
+ duration?: number;
2068
+ notes?: string;
2069
+ }>;
224
2070
  }
225
2071
 
226
2072
  /**
227
- * Plan metadata from the directory and files
2073
+ * Comparison result between revisions
228
2074
  */
229
- export declare interface PlanMetadata {
230
- /** Plan code (directory name, e.g., "big-splitup") */
231
- code: string;
232
- /** Human-readable name */
233
- name: string;
234
- /** Description from SUMMARY.md or meta-prompt */
235
- description?: string;
236
- /** Version (for tracking changes to the plan itself) */
237
- version?: string;
238
- /** Author */
239
- author?: string;
240
- /** Tags for categorization */
241
- tags?: string[];
242
- /** When the plan was created */
243
- createdAt?: Date;
244
- /** Path to the plan directory */
245
- path: string;
2075
+ export declare interface RevisionComparison {
2076
+ /** Earlier revision */
2077
+ from: RevisionInfo;
2078
+ /** Later revision */
2079
+ to: RevisionInfo;
2080
+ /** Time difference in milliseconds */
2081
+ timeDiff: number;
2082
+ /** Number of revisions between */
2083
+ revisionCount: number;
246
2084
  }
247
2085
 
248
2086
  /**
249
- * A phase grouping multiple steps
2087
+ * Extended revision info with computed fields
250
2088
  */
251
- export declare interface PlanPhase {
252
- /** Phase number */
253
- number: number;
254
- /** Phase name */
255
- name: string;
256
- /** Description */
257
- description?: string;
258
- /** Steps in this phase */
259
- steps: number[];
260
- /** Phase status (derived from step statuses) */
261
- status: TaskStatus;
262
- /** Estimated duration */
263
- estimatedDuration?: string;
264
- /** Actual duration */
265
- actualDuration?: string;
2089
+ export declare interface RevisionInfo extends PlanRevision {
2090
+ /** Revision index in history */
2091
+ index: number;
2092
+ /** Whether this is the current revision */
2093
+ isCurrent: boolean;
266
2094
  }
267
2095
 
268
2096
  /**
269
- * Result of executing a plan
2097
+ * Rollback result
270
2098
  */
271
- export declare interface PlanResult {
272
- /** Whether the plan completed successfully */
2099
+ export declare interface RollbackResult {
2100
+ /** Whether rollback succeeded */
273
2101
  success: boolean;
274
- /** Steps that were executed */
275
- executedSteps: number[];
276
- /** Steps that succeeded */
277
- completedSteps: number[];
278
- /** Steps that failed */
279
- failedSteps: number[];
280
- /** Steps that were skipped */
281
- skippedSteps: number[];
282
- /** Total duration */
283
- duration: number;
284
- /** Final plan state */
285
- finalState: PlanState;
2102
+ /** Target milestone */
2103
+ milestone?: MilestoneInfo;
2104
+ /** New current version */
2105
+ newVersion?: string;
2106
+ /** Revisions rolled back */
2107
+ revisionsRolledBack?: number;
2108
+ /** Error message if failed */
2109
+ error?: string;
286
2110
  }
287
2111
 
288
2112
  /**
289
- * Current state of plan execution
2113
+ * Rollback to a milestone
2114
+ *
2115
+ * This resets the current version to the milestone's version.
2116
+ * Revisions after the milestone are kept but no longer current.
290
2117
  */
291
- export declare interface PlanState {
292
- /** Overall plan status */
293
- status: TaskStatus;
294
- /** Current step being executed */
295
- currentStep?: number;
296
- /** Last completed step */
297
- lastCompletedStep?: number;
298
- /** When execution started */
299
- startedAt?: Date;
300
- /** When last updated */
301
- lastUpdatedAt: Date;
302
- /** When completed */
303
- completedAt?: Date;
304
- /** Active blockers */
305
- blockers: Blocker[];
306
- /** Issues encountered */
307
- issues: Issue[];
308
- /** Progress percentage (0-100) */
309
- progress: number;
310
- }
2118
+ export declare function rollbackToMilestone(history: PlanHistory, milestoneName: string): RollbackResult;
311
2119
 
312
2120
  /**
313
- * A single step in a plan (corresponds to a numbered file like 01-STEP.md)
2121
+ * Save an amendment prompt to amendments/
314
2122
  */
315
- export declare interface PlanStep {
316
- /** Step number (1, 2, 3...) */
317
- number: number;
318
- /** Step code/slug (extracted from filename, e.g., "execution-interfaces") */
319
- code: string;
320
- /** Full filename (e.g., "01-execution-interfaces.md") */
321
- filename: string;
322
- /** Human-readable title */
323
- title: string;
324
- /** Step description */
325
- description?: string;
326
- /** Current status */
327
- status: TaskStatus;
328
- /** Dependencies on other steps (by number) */
329
- dependencies?: number[];
330
- /** When this step was started */
331
- startedAt?: Date;
332
- /** When this step was completed */
333
- completedAt?: Date;
334
- /** Duration in milliseconds */
335
- duration?: number;
336
- /** Notes or issues encountered */
337
- notes?: string;
338
- /** Path to the step file */
339
- filePath: string;
2123
+ export declare function saveAmendmentPrompt(planPath: string, content: string, metadata?: Record<string, unknown>): Promise<string>;
2124
+
2125
+ export declare interface SavedPrompt {
2126
+ id: string;
2127
+ timestamp: Date;
2128
+ type: "initial" | "elaborate" | "amend";
2129
+ content: string;
2130
+ metadata?: Record<string, unknown>;
340
2131
  }
341
2132
 
342
2133
  /**
343
- * Priority level
2134
+ * Save an elaboration prompt to analysis/prompts/
344
2135
  */
345
- export declare type Priority = "high" | "medium" | "low";
2136
+ export declare function saveElaborationPrompt(planPath: string, content: string, metadata?: Record<string, unknown>): Promise<string>;
346
2137
 
347
2138
  /**
348
- * Resume a plan from its current state
2139
+ * Save history to disk
2140
+ */
2141
+ export declare function saveHistory(history: PlanHistory, planPath: string): Promise<void>;
2142
+
2143
+ /**
2144
+ * Save the initial plan prompt
2145
+ */
2146
+ export declare function saveInitialPrompt(planPath: string, planName: string, content: string): Promise<string>;
2147
+
2148
+ /**
2149
+ * Save registry to file
349
2150
  *
350
- * @param plan - The plan to resume
351
- * @param context - Execution context
352
- * @returns Plan result
2151
+ * @param registry - The registry to save
2152
+ * @param path - Path to save to (defaults to home directory)
2153
+ */
2154
+ export declare function saveRegistry(registry: PlanRegistry, path?: string): Promise<void>;
2155
+
2156
+ /**
2157
+ * Scan directories for plans and add them to registry
353
2158
  *
354
- * @stub Not yet implemented
2159
+ * @param registry - The registry to update
2160
+ * @param options - Scan options
355
2161
  */
356
- export declare function resumePlan(_plan: unknown, _context?: unknown): Promise<never>;
2162
+ export declare function scanForPlans(registry: PlanRegistry, options?: RegistryOptions): Promise<number>;
2163
+
2164
+ /**
2165
+ * Options for searching plans
2166
+ */
2167
+ export declare interface SearchOptions {
2168
+ /** Filter by status */
2169
+ status?: TaskStatus | TaskStatus[];
2170
+ /** Filter by code pattern (glob or regex) */
2171
+ codePattern?: string;
2172
+ /** Filter by name pattern */
2173
+ namePattern?: string;
2174
+ /** Filter by tag */
2175
+ tags?: string[];
2176
+ /** Minimum progress */
2177
+ minProgress?: number;
2178
+ /** Maximum progress */
2179
+ maxProgress?: number;
2180
+ /** Sort by field */
2181
+ sortBy?: "name" | "code" | "progress" | "status" | "registeredAt";
2182
+ /** Sort direction */
2183
+ sortDir?: "asc" | "desc";
2184
+ /** Limit results */
2185
+ limit?: number;
2186
+ /** Offset for pagination */
2187
+ offset?: number;
2188
+ }
2189
+
2190
+ /**
2191
+ * Search for plans in the registry
2192
+ */
2193
+ export declare function searchPlans(registry: PlanRegistry, options?: SearchOptions): SearchResult;
2194
+
2195
+ /**
2196
+ * Result of a plan search
2197
+ */
2198
+ export declare interface SearchResult {
2199
+ /** Matching plans */
2200
+ plans: RegisteredPlan[];
2201
+ /** Total matches */
2202
+ total: number;
2203
+ }
2204
+
2205
+ /**
2206
+ * Search templates by tag
2207
+ */
2208
+ export declare function searchTemplatesByTag(tag: string): PlanTemplate[];
2209
+
2210
+ /**
2211
+ * Skip a step
2212
+ */
2213
+ export declare function skipStep(plan: Plan, stepNumber: number, reason?: string): PlanStep;
2214
+
2215
+ export declare const SprintTemplate: PlanTemplate;
2216
+
2217
+ /**
2218
+ * Start a step
2219
+ */
2220
+ export declare function startStep(plan: Plan, stepNumber: number): PlanStep;
357
2221
 
358
2222
  /**
359
2223
  * STATUS.md schema for parsing/generating
@@ -386,6 +2250,43 @@ export declare interface StatusDocument {
386
2250
  notes?: string;
387
2251
  }
388
2252
 
2253
+ /**
2254
+ * Result of checking step completion
2255
+ */
2256
+ export declare interface StepCompletionResult {
2257
+ stepNumber: number;
2258
+ stepTitle: string;
2259
+ status: StepCompletionStatus;
2260
+ acceptanceCriteria: AcceptanceCriterion[];
2261
+ markedStatus: string;
2262
+ notes?: string;
2263
+ }
2264
+
2265
+ /**
2266
+ * Step completion status
2267
+ */
2268
+ export declare type StepCompletionStatus = "complete" | "partial" | "incomplete" | "pending" | "skipped";
2269
+
2270
+ /**
2271
+ * Dependency information for a step
2272
+ */
2273
+ export declare interface StepDependency {
2274
+ /** The step that has dependencies */
2275
+ stepNumber: number;
2276
+ /** Steps this step depends on (must be completed before this step) */
2277
+ dependsOn: number[];
2278
+ /** Steps that depend on this step (blocked until this completes) */
2279
+ blockedBy: number[];
2280
+ }
2281
+
2282
+ /**
2283
+ * Step executor interface
2284
+ */
2285
+ export declare interface StepExecutor {
2286
+ /** Execute a single step */
2287
+ execute(context: ExecutionContext): Promise<StepResult>;
2288
+ }
2289
+
389
2290
  /**
390
2291
  * Result of executing a step
391
2292
  */
@@ -405,23 +2306,65 @@ export declare interface StepResult {
405
2306
  }
406
2307
 
407
2308
  /**
408
- * RiotPlan Type Definitions
409
- *
410
- * Types for long-lived, stateful AI workflows (plans).
2309
+ * Status of a task, phase, or step
2310
+ */
2311
+ export declare type TaskStatus = "pending" | "in_progress" | "completed" | "failed" | "blocked" | "skipped";
2312
+
2313
+ /**
2314
+ * Create the template command group
2315
+ */
2316
+ export declare function templateCommand(): Command;
2317
+
2318
+ /**
2319
+ * Create the template list command
2320
+ */
2321
+ export declare function templateListCommand(): Command;
2322
+
2323
+ /**
2324
+ * Create the template show command
2325
+ */
2326
+ export declare function templateShowCommand(): Command;
2327
+
2328
+ /**
2329
+ * Template Registry
411
2330
  *
412
- * A plan consists of:
413
- * - A directory (the plan code/name)
414
- * - A meta-prompt (prompt-of-prompts)
415
- * - Numbered step files (01-STEP.md, 02-STEP.md, etc.)
416
- * - Status tracking (STATUS.md)
417
- * - Execution strategy (EXECUTION_PLAN.md)
418
- * - Summary (SUMMARY.md)
419
- * - Optional analysis directory
2331
+ * Central registry for all available plan templates.
420
2332
  */
421
2333
  /**
422
- * Status of a task, phase, or step
2334
+ * A step definition for a template
423
2335
  */
424
- export declare type TaskStatus = "pending" | "in_progress" | "completed" | "failed" | "blocked" | "skipped";
2336
+ export declare interface TemplateStep {
2337
+ /** Step title */
2338
+ title: string;
2339
+ /** Step description */
2340
+ description: string;
2341
+ /** Tasks in this step */
2342
+ tasks?: string[];
2343
+ /** Acceptance criteria */
2344
+ criteria?: string[];
2345
+ }
2346
+
2347
+ /**
2348
+ * Create the template use command
2349
+ */
2350
+ export declare function templateUseCommand(): Command;
2351
+
2352
+ /**
2353
+ * Unblock a step
2354
+ */
2355
+ export declare function unblockStep(plan: Plan, stepNumber: number): PlanStep;
2356
+
2357
+ /**
2358
+ * Unregister a plan from the registry
2359
+ */
2360
+ export declare function unregisterPlan(registry: PlanRegistry, path: string): boolean;
2361
+
2362
+ /**
2363
+ * Update a plan's SUMMARY.md with relationships
2364
+ *
2365
+ * @param plan - The plan to update
2366
+ */
2367
+ export declare function updatePlanRelationships(plan: Plan): Promise<void>;
425
2368
 
426
2369
  /**
427
2370
  * Update plan state after step completion
@@ -435,6 +2378,144 @@ export declare type TaskStatus = "pending" | "in_progress" | "completed" | "fail
435
2378
  */
436
2379
  export declare function updatePlanState(_plan: unknown, _stepNumber: number, _result: unknown): never;
437
2380
 
2381
+ /**
2382
+ * Update a plan's state based on status changes
2383
+ */
2384
+ export declare function updateStatus(plan: Plan, updates: UpdateStatusOptions): Plan;
2385
+
2386
+ export declare interface UpdateStatusOptions {
2387
+ /** Step that was completed/updated */
2388
+ step?: number;
2389
+ /** New status for step */
2390
+ stepStatus?: TaskStatus;
2391
+ /** Add blocker */
2392
+ addBlocker?: string;
2393
+ /** Remove blocker by description match */
2394
+ removeBlocker?: string;
2395
+ /** Add issue */
2396
+ addIssue?: {
2397
+ title: string;
2398
+ description: string;
2399
+ };
2400
+ /** Add note */
2401
+ addNote?: string;
2402
+ }
2403
+
2404
+ /**
2405
+ * Update step dependencies in memory
2406
+ *
2407
+ * @param step - The step to update
2408
+ * @param dependencies - New dependency list
2409
+ * @returns Updated step
2410
+ */
2411
+ export declare function updateStepDependencies(step: PlanStep, dependencies: number[]): PlanStep;
2412
+
2413
+ /**
2414
+ * Create the validate command
2415
+ */
2416
+ export declare function validateCommand(): Command;
2417
+
2418
+ /**
2419
+ * Validate dependencies in a plan
2420
+ *
2421
+ * @param plan - The plan to validate
2422
+ * @param graph - Optional pre-built dependency graph
2423
+ * @param rawDeps - Optional raw dependencies map (before filtering)
2424
+ * @returns Validation result
2425
+ */
2426
+ export declare function validateDependencies(plan: Plan, graph?: DependencyGraph, rawDeps?: Map<number, number[]>): Promise<DependencyValidation>;
2427
+
2428
+ export declare interface ValidateOptions {
2429
+ /** Check step content */
2430
+ validateContent?: boolean;
2431
+ /** Check dependencies */
2432
+ validateDependencies?: boolean;
2433
+ /** Check STATUS.md consistency */
2434
+ validateStatus?: boolean;
2435
+ /** Strict mode (warnings become errors) */
2436
+ strict?: boolean;
2437
+ }
2438
+
2439
+ /**
2440
+ * Validate a plan
2441
+ */
2442
+ export declare function validatePlan(planPath: string, options?: ValidateOptions): Promise<ValidationResult>;
2443
+
2444
+ /**
2445
+ * Validate all relationships in a plan
2446
+ *
2447
+ * @param plan - The plan to validate
2448
+ * @returns Validation result
2449
+ */
2450
+ export declare function validateRelationships(plan: Plan): Promise<RelationshipValidation>;
2451
+
2452
+ export declare interface ValidationError {
2453
+ code: string;
2454
+ message: string;
2455
+ path?: string;
2456
+ step?: number;
2457
+ }
2458
+
2459
+ export declare interface ValidationInfo {
2460
+ code: string;
2461
+ message: string;
2462
+ }
2463
+
2464
+ /**
2465
+ * Plan Validation
2466
+ *
2467
+ * Validates plan structure, step numbering, dependencies, and content.
2468
+ * Provides actionable error messages and identifies fixable issues.
2469
+ */
2470
+ export declare interface ValidationResult {
2471
+ /** Is the plan valid? */
2472
+ valid: boolean;
2473
+ /** Errors (must fix) */
2474
+ errors: ValidationError[];
2475
+ /** Warnings (should fix) */
2476
+ warnings: ValidationWarning[];
2477
+ /** Info (observations) */
2478
+ info: ValidationInfo[];
2479
+ /** Auto-fixable issues */
2480
+ fixable: FixableIssue[];
2481
+ }
2482
+
2483
+ export declare interface ValidationWarning {
2484
+ code: string;
2485
+ message: string;
2486
+ path?: string;
2487
+ step?: number;
2488
+ }
2489
+
2490
+ /**
2491
+ * A single verification criterion extracted from analysis
2492
+ */
2493
+ export declare interface VerificationCriterion {
2494
+ id: string;
2495
+ text: string;
2496
+ priority: CriteriaPriority;
2497
+ source: string;
2498
+ lineNumber?: number;
2499
+ }
2500
+
2501
+ /**
2502
+ * Full verification report
2503
+ */
2504
+ export declare interface VerificationReport {
2505
+ planPath: string;
2506
+ timestamp: Date;
2507
+ /** Analysis → Plan coverage (if analysis exists) */
2508
+ coverage?: CoverageReport;
2509
+ /** Plan → Execution completion */
2510
+ completion?: CompletionReport;
2511
+ /** Overall health score (0-100) */
2512
+ healthScore: number;
2513
+ /** Summary messages */
2514
+ summary: string[];
2515
+ /** Recommendations */
2516
+ recommendations: string[];
2517
+ }
2518
+
438
2519
  export declare const VERSION = "0.0.1";
439
2520
 
440
2521
  export { }