@fern-api/replay 0.8.1 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ interface GenerationLock {
3
3
  generations: GenerationRecord[];
4
4
  current_generation: string;
5
5
  patches: StoredPatch[];
6
+ forgotten_hashes?: string[];
6
7
  replay_skipped_at?: string;
7
8
  }
8
9
  interface GenerationRecord {
@@ -100,6 +101,7 @@ declare class GitClient {
100
101
  }>>;
101
102
  isAncestor(commit: string, descendant: string): Promise<boolean>;
102
103
  commitExists(sha: string): Promise<boolean>;
104
+ treeExists(treeHash: string): Promise<boolean>;
103
105
  getCommitBody(commitSha: string): Promise<string>;
104
106
  getRepoPath(): string;
105
107
  }
@@ -137,6 +139,7 @@ declare class LockfileManager {
137
139
  updatePatch(patchId: string, updates: Partial<Pick<StoredPatch, "base_generation" | "patch_content" | "content_hash" | "files" | "status">>): void;
138
140
  removePatch(patchId: string): void;
139
141
  clearPatches(): void;
142
+ addForgottenHash(hash: string): void;
140
143
  getUnresolvedPatches(): StoredPatch[];
141
144
  getResolvingPatches(): StoredPatch[];
142
145
  markPatchUnresolved(patchId: string): void;
@@ -192,6 +195,7 @@ declare class ReplayApplicator {
192
195
  private lockManager;
193
196
  private outputDir;
194
197
  private renameCache;
198
+ private treeExistsCache;
195
199
  private fileTheirsAccumulator;
196
200
  constructor(git: GitClient, lockManager: LockfileManager, outputDir: string);
197
201
  /** Reset inter-patch accumulator for a new cycle. */
@@ -206,6 +210,7 @@ declare class ReplayApplicator {
206
210
  private applyPatchWithFallback;
207
211
  private applyWithThreeWayMerge;
208
212
  private mergeFile;
213
+ private isTreeReachable;
209
214
  private isExcluded;
210
215
  private resolveFilePath;
211
216
  private applyPatchToContent;
@@ -426,18 +431,43 @@ declare function bootstrap(outputDir: string, options?: BootstrapOptions): Promi
426
431
  interface ForgetOptions {
427
432
  /** Don't actually remove, just show what would be removed */
428
433
  dryRun?: boolean;
434
+ /** Remove all tracked patches (keep lockfile and generation history) */
435
+ all?: boolean;
436
+ /** Specific patch IDs to remove */
437
+ patchIds?: string[];
438
+ /** Search pattern: file path, glob, or commit message substring */
439
+ pattern?: string;
440
+ }
441
+ interface DiffStat {
442
+ additions: number;
443
+ deletions: number;
444
+ }
445
+ interface MatchedPatch {
446
+ id: string;
447
+ message: string;
448
+ files: string[];
449
+ diffstat: DiffStat;
450
+ status?: "unresolved" | "resolving";
429
451
  }
430
452
  interface ForgetResult {
431
- /** Patches that were (or would be) removed */
432
- removed: Array<{
433
- id: string;
434
- message: string;
435
- files: string[];
436
- }>;
437
- /** True if no patches matched the pattern */
453
+ /** Whether replay is initialized (lockfile exists) */
454
+ initialized: boolean;
455
+ /** Patches that were (or would be in dry-run) removed */
456
+ removed: MatchedPatch[];
457
+ /** Number of patches remaining after removal */
458
+ remaining: number;
459
+ /** True if a search/pattern was given but nothing matched */
438
460
  notFound: boolean;
461
+ /** Patch IDs that were specified but don't exist (idempotent mode) */
462
+ alreadyForgotten: string[];
463
+ /** Total patches before removal */
464
+ totalPatches: number;
465
+ /** Warnings (e.g., forgetting patches with conflict markers on disk) */
466
+ warnings: string[];
467
+ /** Matching patches for interactive selection (search/no-arg mode only) */
468
+ matched?: MatchedPatch[];
439
469
  }
440
- declare function forget(outputDir: string, filePattern: string, options?: ForgetOptions): ForgetResult;
470
+ declare function forget(outputDir: string, options?: ForgetOptions): ForgetResult;
441
471
 
442
472
  interface ResetOptions {
443
473
  /** Don't actually delete, just show what would happen */
@@ -480,27 +510,45 @@ declare function resolve(outputDir: string, options?: ResolveOptions): Promise<R
480
510
  interface StatusResult {
481
511
  /** Whether replay is initialized (lockfile exists) */
482
512
  initialized: boolean;
483
- /** Tracked customization patches */
484
- patches: StatusPatch[];
513
+ /** Total number of generations tracked */
514
+ generationCount: number;
485
515
  /** Last generation info, if available */
486
516
  lastGeneration: StatusGeneration | undefined;
517
+ /** Tracked customization patches */
518
+ patches: StatusPatch[];
519
+ /** Count of patches with "unresolved" or "resolving" status */
520
+ unresolvedCount: number;
521
+ /** Exclude patterns from replay.yml */
522
+ excludePatterns: string[];
487
523
  }
488
524
  interface StatusPatch {
489
- /** Short SHA of the original commit */
490
- sha: string;
491
- /** Author name (without email) */
492
- author: string;
525
+ /** Patch ID (e.g. "patch-def45678") */
526
+ id: string;
527
+ /** "added" if patch_content contains "new file mode", otherwise "modified" */
528
+ type: "added" | "modified";
493
529
  /** Original commit message */
494
530
  message: string;
531
+ /** Author name (without email) */
532
+ author: string;
533
+ /** Short SHA of the original commit (7 chars) */
534
+ sha: string;
495
535
  /** Files touched by this patch */
496
536
  files: string[];
537
+ /** Number of files */
538
+ fileCount: number;
539
+ /** Patch resolution status, if any */
540
+ status?: "unresolved" | "resolving";
497
541
  }
498
542
  interface StatusGeneration {
499
- /** Full commit SHA */
543
+ /** Short commit SHA (7 chars) */
500
544
  sha: string;
501
545
  /** Generation timestamp */
502
546
  timestamp: string;
547
+ /** CLI version used for generation */
548
+ cliVersion: string;
549
+ /** Generator versions (e.g. { "fern-java-sdk": "3.35.0" }) */
550
+ generatorVersions: Record<string, string>;
503
551
  }
504
552
  declare function status(outputDir: string): StatusResult;
505
553
 
506
- export { type BootstrapOptions, type BootstrapResult, type CommitInfo, type CommitOptions, type ConflictDetail, type ConflictMetadata, type ConflictReason, type ConflictRegion, type CustomizationsConfig, type DetectionResult, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_BOT_NAME, FernignoreMigrator, type FileResult, type ForgetOptions, type ForgetResult, type GenerationLock, type GenerationRecord, GitClient, LockfileManager, type MergeResult, type MigrationAnalysis, type MigrationResult, type MoveDeclaration, ReplayApplicator, ReplayCommitter, type ReplayConfig, ReplayDetector, type ReplayOptions, type ReplayReport, type ReplayResult, ReplayService, type ResetOptions, type ResetResult, type ResolveOptions, type ResolveResult, type StatusGeneration, type StatusPatch, type StatusResult, type StoredPatch, type UnresolvedPatchInfo, bootstrap, forget, isGenerationCommit, isReplayCommit, isRevertCommit, parseRevertedMessage, parseRevertedSha, reset, resolve, status, threeWayMerge };
554
+ export { type BootstrapOptions, type BootstrapResult, type CommitInfo, type CommitOptions, type ConflictDetail, type ConflictMetadata, type ConflictReason, type ConflictRegion, type CustomizationsConfig, type DetectionResult, type DiffStat, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_BOT_NAME, FernignoreMigrator, type FileResult, type ForgetOptions, type ForgetResult, type GenerationLock, type GenerationRecord, GitClient, LockfileManager, type MatchedPatch, type MergeResult, type MigrationAnalysis, type MigrationResult, type MoveDeclaration, ReplayApplicator, ReplayCommitter, type ReplayConfig, ReplayDetector, type ReplayOptions, type ReplayReport, type ReplayResult, ReplayService, type ResetOptions, type ResetResult, type ResolveOptions, type ResolveResult, type StatusGeneration, type StatusPatch, type StatusResult, type StoredPatch, type UnresolvedPatchInfo, bootstrap, forget, isGenerationCommit, isReplayCommit, isRevertCommit, parseRevertedMessage, parseRevertedSha, reset, resolve, status, threeWayMerge };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ interface GenerationLock {
3
3
  generations: GenerationRecord[];
4
4
  current_generation: string;
5
5
  patches: StoredPatch[];
6
+ forgotten_hashes?: string[];
6
7
  replay_skipped_at?: string;
7
8
  }
8
9
  interface GenerationRecord {
@@ -100,6 +101,7 @@ declare class GitClient {
100
101
  }>>;
101
102
  isAncestor(commit: string, descendant: string): Promise<boolean>;
102
103
  commitExists(sha: string): Promise<boolean>;
104
+ treeExists(treeHash: string): Promise<boolean>;
103
105
  getCommitBody(commitSha: string): Promise<string>;
104
106
  getRepoPath(): string;
105
107
  }
@@ -137,6 +139,7 @@ declare class LockfileManager {
137
139
  updatePatch(patchId: string, updates: Partial<Pick<StoredPatch, "base_generation" | "patch_content" | "content_hash" | "files" | "status">>): void;
138
140
  removePatch(patchId: string): void;
139
141
  clearPatches(): void;
142
+ addForgottenHash(hash: string): void;
140
143
  getUnresolvedPatches(): StoredPatch[];
141
144
  getResolvingPatches(): StoredPatch[];
142
145
  markPatchUnresolved(patchId: string): void;
@@ -192,6 +195,7 @@ declare class ReplayApplicator {
192
195
  private lockManager;
193
196
  private outputDir;
194
197
  private renameCache;
198
+ private treeExistsCache;
195
199
  private fileTheirsAccumulator;
196
200
  constructor(git: GitClient, lockManager: LockfileManager, outputDir: string);
197
201
  /** Reset inter-patch accumulator for a new cycle. */
@@ -206,6 +210,7 @@ declare class ReplayApplicator {
206
210
  private applyPatchWithFallback;
207
211
  private applyWithThreeWayMerge;
208
212
  private mergeFile;
213
+ private isTreeReachable;
209
214
  private isExcluded;
210
215
  private resolveFilePath;
211
216
  private applyPatchToContent;
@@ -426,18 +431,43 @@ declare function bootstrap(outputDir: string, options?: BootstrapOptions): Promi
426
431
  interface ForgetOptions {
427
432
  /** Don't actually remove, just show what would be removed */
428
433
  dryRun?: boolean;
434
+ /** Remove all tracked patches (keep lockfile and generation history) */
435
+ all?: boolean;
436
+ /** Specific patch IDs to remove */
437
+ patchIds?: string[];
438
+ /** Search pattern: file path, glob, or commit message substring */
439
+ pattern?: string;
440
+ }
441
+ interface DiffStat {
442
+ additions: number;
443
+ deletions: number;
444
+ }
445
+ interface MatchedPatch {
446
+ id: string;
447
+ message: string;
448
+ files: string[];
449
+ diffstat: DiffStat;
450
+ status?: "unresolved" | "resolving";
429
451
  }
430
452
  interface ForgetResult {
431
- /** Patches that were (or would be) removed */
432
- removed: Array<{
433
- id: string;
434
- message: string;
435
- files: string[];
436
- }>;
437
- /** True if no patches matched the pattern */
453
+ /** Whether replay is initialized (lockfile exists) */
454
+ initialized: boolean;
455
+ /** Patches that were (or would be in dry-run) removed */
456
+ removed: MatchedPatch[];
457
+ /** Number of patches remaining after removal */
458
+ remaining: number;
459
+ /** True if a search/pattern was given but nothing matched */
438
460
  notFound: boolean;
461
+ /** Patch IDs that were specified but don't exist (idempotent mode) */
462
+ alreadyForgotten: string[];
463
+ /** Total patches before removal */
464
+ totalPatches: number;
465
+ /** Warnings (e.g., forgetting patches with conflict markers on disk) */
466
+ warnings: string[];
467
+ /** Matching patches for interactive selection (search/no-arg mode only) */
468
+ matched?: MatchedPatch[];
439
469
  }
440
- declare function forget(outputDir: string, filePattern: string, options?: ForgetOptions): ForgetResult;
470
+ declare function forget(outputDir: string, options?: ForgetOptions): ForgetResult;
441
471
 
442
472
  interface ResetOptions {
443
473
  /** Don't actually delete, just show what would happen */
@@ -480,27 +510,45 @@ declare function resolve(outputDir: string, options?: ResolveOptions): Promise<R
480
510
  interface StatusResult {
481
511
  /** Whether replay is initialized (lockfile exists) */
482
512
  initialized: boolean;
483
- /** Tracked customization patches */
484
- patches: StatusPatch[];
513
+ /** Total number of generations tracked */
514
+ generationCount: number;
485
515
  /** Last generation info, if available */
486
516
  lastGeneration: StatusGeneration | undefined;
517
+ /** Tracked customization patches */
518
+ patches: StatusPatch[];
519
+ /** Count of patches with "unresolved" or "resolving" status */
520
+ unresolvedCount: number;
521
+ /** Exclude patterns from replay.yml */
522
+ excludePatterns: string[];
487
523
  }
488
524
  interface StatusPatch {
489
- /** Short SHA of the original commit */
490
- sha: string;
491
- /** Author name (without email) */
492
- author: string;
525
+ /** Patch ID (e.g. "patch-def45678") */
526
+ id: string;
527
+ /** "added" if patch_content contains "new file mode", otherwise "modified" */
528
+ type: "added" | "modified";
493
529
  /** Original commit message */
494
530
  message: string;
531
+ /** Author name (without email) */
532
+ author: string;
533
+ /** Short SHA of the original commit (7 chars) */
534
+ sha: string;
495
535
  /** Files touched by this patch */
496
536
  files: string[];
537
+ /** Number of files */
538
+ fileCount: number;
539
+ /** Patch resolution status, if any */
540
+ status?: "unresolved" | "resolving";
497
541
  }
498
542
  interface StatusGeneration {
499
- /** Full commit SHA */
543
+ /** Short commit SHA (7 chars) */
500
544
  sha: string;
501
545
  /** Generation timestamp */
502
546
  timestamp: string;
547
+ /** CLI version used for generation */
548
+ cliVersion: string;
549
+ /** Generator versions (e.g. { "fern-java-sdk": "3.35.0" }) */
550
+ generatorVersions: Record<string, string>;
503
551
  }
504
552
  declare function status(outputDir: string): StatusResult;
505
553
 
506
- export { type BootstrapOptions, type BootstrapResult, type CommitInfo, type CommitOptions, type ConflictDetail, type ConflictMetadata, type ConflictReason, type ConflictRegion, type CustomizationsConfig, type DetectionResult, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_BOT_NAME, FernignoreMigrator, type FileResult, type ForgetOptions, type ForgetResult, type GenerationLock, type GenerationRecord, GitClient, LockfileManager, type MergeResult, type MigrationAnalysis, type MigrationResult, type MoveDeclaration, ReplayApplicator, ReplayCommitter, type ReplayConfig, ReplayDetector, type ReplayOptions, type ReplayReport, type ReplayResult, ReplayService, type ResetOptions, type ResetResult, type ResolveOptions, type ResolveResult, type StatusGeneration, type StatusPatch, type StatusResult, type StoredPatch, type UnresolvedPatchInfo, bootstrap, forget, isGenerationCommit, isReplayCommit, isRevertCommit, parseRevertedMessage, parseRevertedSha, reset, resolve, status, threeWayMerge };
554
+ export { type BootstrapOptions, type BootstrapResult, type CommitInfo, type CommitOptions, type ConflictDetail, type ConflictMetadata, type ConflictReason, type ConflictRegion, type CustomizationsConfig, type DetectionResult, type DiffStat, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_BOT_NAME, FernignoreMigrator, type FileResult, type ForgetOptions, type ForgetResult, type GenerationLock, type GenerationRecord, GitClient, LockfileManager, type MatchedPatch, type MergeResult, type MigrationAnalysis, type MigrationResult, type MoveDeclaration, ReplayApplicator, ReplayCommitter, type ReplayConfig, ReplayDetector, type ReplayOptions, type ReplayReport, type ReplayResult, ReplayService, type ResetOptions, type ResetResult, type ResolveOptions, type ResolveResult, type StatusGeneration, type StatusPatch, type StatusResult, type StoredPatch, type UnresolvedPatchInfo, bootstrap, forget, isGenerationCommit, isReplayCommit, isRevertCommit, parseRevertedMessage, parseRevertedSha, reset, resolve, status, threeWayMerge };