@fern-api/replay 0.16.0 → 0.16.2

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
@@ -214,8 +214,19 @@ declare class LockfileNotFoundError extends Error {
214
214
  declare class LockfileManager {
215
215
  private outputDir;
216
216
  private lock;
217
+ private fernignorePatterns;
217
218
  readonly warnings: string[];
218
219
  constructor(outputDir: string);
220
+ /**
221
+ * Inform the lockfile of the customer's `.fernignore` patterns so that
222
+ * `save()` can suppress its "Patch X removed from lockfile" warning when
223
+ * every file in the stripped patch is already `.fernignore`-protected.
224
+ * The strip itself still happens (credentials never persist); only the
225
+ * customer-visible warning is suppressed in that case, because the
226
+ * protected files survive the generator wipe regardless of whether the
227
+ * lockfile tracks them, so there's nothing for the customer to action.
228
+ */
229
+ setFernignorePatterns(patterns: string[]): void;
219
230
  get lockfilePath(): string;
220
231
  get customizationsPath(): string;
221
232
  exists(): boolean;
@@ -255,8 +266,9 @@ declare class ReplayDetector {
255
266
  private git;
256
267
  private lockManager;
257
268
  private sdkOutputDir;
269
+ private fernignorePatterns;
258
270
  readonly warnings: string[];
259
- constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string);
271
+ constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string, fernignorePatterns?: readonly string[]);
260
272
  /**
261
273
  * Derive the previous-generation SHA from git history instead of trusting
262
274
  * `lock.current_generation`.
@@ -726,6 +738,19 @@ declare class ReplayService {
726
738
  * `applyPreparedReplay` (e.g., `[fern-autoversion]`).
727
739
  */
728
740
  prepareReplay(options?: ReplayOptions): Promise<ReplayPreparation>;
741
+ /**
742
+ * ADR 0002 migration step. Strips `.fernignore`-matched entries from
743
+ * `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
744
+ * in `patch.patch_content` for every patch in the lockfile. Patches that
745
+ * end up with no surviving files are removed entirely.
746
+ *
747
+ * Idempotent: a second run is a no-op because the first run already
748
+ * matches the contract. Per-patch try/catch ensures one bad patch does
749
+ * not block the rest. Each affected patch emits a warning naming the
750
+ * stripped paths. `patch_content` is left untouched if no parseable
751
+ * `diff --git` headers are found (fail-safe for exotic legacy formats).
752
+ */
753
+ private cleanseLegacyFernignoreEntries;
729
754
  /**
730
755
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
731
756
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -874,7 +899,8 @@ declare class ReplayService {
874
899
  */
875
900
  /** @internal Used by Flow implementations in `src/flows/`. */
876
901
  cleanupStaleConflictMarkers(): Promise<void>;
877
- private readFernignorePatterns;
902
+ /** @internal Used by Flow implementations in `src/flows/`. */
903
+ readFernignorePatterns(): string[];
878
904
  /** @internal Used by Flow implementations in `src/flows/`. */
879
905
  buildReport(flow: "first-generation" | "no-patches" | "normal-regeneration" | "skip-application", patches: StoredPatch[], results: ReplayResult[], options?: ReplayOptions, warnings?: string[], rebaseCounts?: {
880
906
  absorbed: number;
package/dist/index.d.ts CHANGED
@@ -214,8 +214,19 @@ declare class LockfileNotFoundError extends Error {
214
214
  declare class LockfileManager {
215
215
  private outputDir;
216
216
  private lock;
217
+ private fernignorePatterns;
217
218
  readonly warnings: string[];
218
219
  constructor(outputDir: string);
220
+ /**
221
+ * Inform the lockfile of the customer's `.fernignore` patterns so that
222
+ * `save()` can suppress its "Patch X removed from lockfile" warning when
223
+ * every file in the stripped patch is already `.fernignore`-protected.
224
+ * The strip itself still happens (credentials never persist); only the
225
+ * customer-visible warning is suppressed in that case, because the
226
+ * protected files survive the generator wipe regardless of whether the
227
+ * lockfile tracks them, so there's nothing for the customer to action.
228
+ */
229
+ setFernignorePatterns(patterns: string[]): void;
219
230
  get lockfilePath(): string;
220
231
  get customizationsPath(): string;
221
232
  exists(): boolean;
@@ -255,8 +266,9 @@ declare class ReplayDetector {
255
266
  private git;
256
267
  private lockManager;
257
268
  private sdkOutputDir;
269
+ private fernignorePatterns;
258
270
  readonly warnings: string[];
259
- constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string);
271
+ constructor(git: GitClient, lockManager: LockfileManager, sdkOutputDir: string, fernignorePatterns?: readonly string[]);
260
272
  /**
261
273
  * Derive the previous-generation SHA from git history instead of trusting
262
274
  * `lock.current_generation`.
@@ -726,6 +738,19 @@ declare class ReplayService {
726
738
  * `applyPreparedReplay` (e.g., `[fern-autoversion]`).
727
739
  */
728
740
  prepareReplay(options?: ReplayOptions): Promise<ReplayPreparation>;
741
+ /**
742
+ * ADR 0002 migration step. Strips `.fernignore`-matched entries from
743
+ * `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
744
+ * in `patch.patch_content` for every patch in the lockfile. Patches that
745
+ * end up with no surviving files are removed entirely.
746
+ *
747
+ * Idempotent: a second run is a no-op because the first run already
748
+ * matches the contract. Per-patch try/catch ensures one bad patch does
749
+ * not block the rest. Each affected patch emits a warning naming the
750
+ * stripped paths. `patch_content` is left untouched if no parseable
751
+ * `diff --git` headers are found (fail-safe for exotic legacy formats).
752
+ */
753
+ private cleanseLegacyFernignoreEntries;
729
754
  /**
730
755
  * Phase 2 of the two-phase replay flow. Applies patches, rebases them against
731
756
  * the generation, saves the lockfile, and commits `[fern-replay]` (or stages
@@ -874,7 +899,8 @@ declare class ReplayService {
874
899
  */
875
900
  /** @internal Used by Flow implementations in `src/flows/`. */
876
901
  cleanupStaleConflictMarkers(): Promise<void>;
877
- private readFernignorePatterns;
902
+ /** @internal Used by Flow implementations in `src/flows/`. */
903
+ readFernignorePatterns(): string[];
878
904
  /** @internal Used by Flow implementations in `src/flows/`. */
879
905
  buildReport(flow: "first-generation" | "no-patches" | "normal-regeneration" | "skip-application", patches: StoredPatch[], results: ReplayResult[], options?: ReplayOptions, warnings?: string[], rebaseCounts?: {
880
906
  absorbed: number;