@fern-api/fern-api-dev 4.62.3-9-g975ac7af925 → 4.62.4

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.
Files changed (2) hide show
  1. package/cli.cjs +495 -66
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -363452,9 +363452,9 @@ var require_diff3 = __commonJS({
363452
363452
  }
363453
363453
  });
363454
363454
 
363455
- // ../../../node_modules/.pnpm/@fern-api+replay@0.8.0/node_modules/@fern-api/replay/dist/index.cjs
363455
+ // ../../../node_modules/.pnpm/@fern-api+replay@0.9.0/node_modules/@fern-api/replay/dist/index.cjs
363456
363456
  var require_dist11 = __commonJS({
363457
- "../../../node_modules/.pnpm/@fern-api+replay@0.8.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
363457
+ "../../../node_modules/.pnpm/@fern-api+replay@0.9.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
363458
363458
  "use strict";
363459
363459
  var __defProp4 = Object.defineProperty;
363460
363460
  var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
@@ -363631,7 +363631,7 @@ var require_dist11 = __commonJS({
363631
363631
  return commit.message.startsWith("[fern-replay]");
363632
363632
  }
363633
363633
  function isRevertCommit(message) {
363634
- return message.startsWith('Revert "');
363634
+ return /^Revert ".+"$/.test(message);
363635
363635
  }
363636
363636
  function parseRevertedSha(fullBody) {
363637
363637
  const match3 = fullBody.match(/This reverts commit ([0-9a-f]{40})\./);
@@ -363730,6 +363730,15 @@ var require_dist11 = __commonJS({
363730
363730
  this.ensureLoaded();
363731
363731
  this.lock.patches = [];
363732
363732
  }
363733
+ addForgottenHash(hash5) {
363734
+ this.ensureLoaded();
363735
+ if (!this.lock.forgotten_hashes) {
363736
+ this.lock.forgotten_hashes = [];
363737
+ }
363738
+ if (!this.lock.forgotten_hashes.includes(hash5)) {
363739
+ this.lock.forgotten_hashes.push(hash5);
363740
+ }
363741
+ }
363733
363742
  getUnresolvedPatches() {
363734
363743
  this.ensureLoaded();
363735
363744
  return this.lock.patches.filter((p10) => p10.status === "unresolved");
@@ -363824,6 +363833,7 @@ var require_dist11 = __commonJS({
363824
363833
  }
363825
363834
  const commits = this.parseGitLog(log4);
363826
363835
  const newPatches = [];
363836
+ const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
363827
363837
  for (const commit of commits) {
363828
363838
  if (isGenerationCommit(commit)) {
363829
363839
  continue;
@@ -363837,7 +363847,7 @@ var require_dist11 = __commonJS({
363837
363847
  }
363838
363848
  const patchContent = await this.git.formatPatch(commit.sha);
363839
363849
  const contentHash = this.computeContentHash(patchContent);
363840
- if (lock.patches.find((p10) => p10.content_hash === contentHash)) {
363850
+ if (lock.patches.find((p10) => p10.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
363841
363851
  continue;
363842
363852
  }
363843
363853
  const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
@@ -363907,6 +363917,9 @@ var require_dist11 = __commonJS({
363907
363917
  revertIndicesToRemove.add(idx);
363908
363918
  }
363909
363919
  }
363920
+ if (!matchedExisting && !matchedNew) {
363921
+ revertIndicesToRemove.add(i11);
363922
+ }
363910
363923
  }
363911
363924
  const filteredPatches = newPatches.filter((_16, i11) => !revertIndicesToRemove.has(i11));
363912
363925
  return { patches: filteredPatches, revertedPatchIds: [...revertedPatchIdSet] };
@@ -363933,7 +363946,7 @@ var require_dist11 = __commonJS({
363933
363946
  if (!diff2.trim()) return { patches: [], revertedPatchIds: [] };
363934
363947
  const contentHash = this.computeContentHash(diff2);
363935
363948
  const lock = this.lockManager.read();
363936
- if (lock.patches.some((p10) => p10.content_hash === contentHash)) {
363949
+ if (lock.patches.some((p10) => p10.content_hash === contentHash) || (lock.forgotten_hashes ?? []).includes(contentHash)) {
363937
363950
  return { patches: [], revertedPatchIds: [] };
363938
363951
  }
363939
363952
  const headSha = (await this.git.exec(["rev-parse", "HEAD"])).trim();
@@ -363999,6 +364012,32 @@ var require_dist11 = __commonJS({
363999
364012
  var import_node_os15 = require("os");
364000
364013
  var import_node_path210 = require("path");
364001
364014
  var import_minimatch8 = require_commonjs3();
364015
+ function stripConflictMarkers(content5) {
364016
+ const lines = content5.split("\n");
364017
+ const result = [];
364018
+ let inConflict = false;
364019
+ let inOurs = false;
364020
+ for (const line of lines) {
364021
+ if (line.startsWith("<<<<<<< ")) {
364022
+ inConflict = true;
364023
+ inOurs = true;
364024
+ continue;
364025
+ }
364026
+ if (inConflict && line === "=======") {
364027
+ inOurs = false;
364028
+ continue;
364029
+ }
364030
+ if (inConflict && line.startsWith(">>>>>>> ")) {
364031
+ inConflict = false;
364032
+ inOurs = false;
364033
+ continue;
364034
+ }
364035
+ if (!inConflict || inOurs) {
364036
+ result.push(line);
364037
+ }
364038
+ }
364039
+ return result.join("\n");
364040
+ }
364002
364041
  var BINARY_EXTENSIONS2 = /* @__PURE__ */ new Set([
364003
364042
  ".png",
364004
364043
  ".jpg",
@@ -364070,7 +364109,8 @@ var require_dist11 = __commonJS({
364070
364109
  async applyPatches(patches) {
364071
364110
  this.resetAccumulator();
364072
364111
  const results = [];
364073
- for (const patch5 of patches) {
364112
+ for (let i11 = 0; i11 < patches.length; i11++) {
364113
+ const patch5 = patches[i11];
364074
364114
  if (this.isExcluded(patch5)) {
364075
364115
  results.push({
364076
364116
  patch: patch5,
@@ -364081,6 +364121,33 @@ var require_dist11 = __commonJS({
364081
364121
  }
364082
364122
  const result = await this.applyPatchWithFallback(patch5);
364083
364123
  results.push(result);
364124
+ if (result.status === "conflict" && result.fileResults) {
364125
+ const laterFiles = /* @__PURE__ */ new Set();
364126
+ for (let j16 = i11 + 1; j16 < patches.length; j16++) {
364127
+ for (const f10 of patches[j16].files) {
364128
+ laterFiles.add(f10);
364129
+ }
364130
+ }
364131
+ const resolvedToOriginal = /* @__PURE__ */ new Map();
364132
+ if (result.resolvedFiles) {
364133
+ for (const [orig, resolved] of Object.entries(result.resolvedFiles)) {
364134
+ resolvedToOriginal.set(resolved, orig);
364135
+ }
364136
+ }
364137
+ for (const fileResult of result.fileResults) {
364138
+ if (fileResult.status !== "conflict") continue;
364139
+ const originalPath = resolvedToOriginal.get(fileResult.file) ?? fileResult.file;
364140
+ if (laterFiles.has(fileResult.file) || laterFiles.has(originalPath)) {
364141
+ const filePath = (0, import_node_path210.join)(this.outputDir, fileResult.file);
364142
+ try {
364143
+ const content5 = await (0, import_promises181.readFile)(filePath, "utf-8");
364144
+ const stripped = stripConflictMarkers(content5);
364145
+ await (0, import_promises181.writeFile)(filePath, stripped);
364146
+ } catch {
364147
+ }
364148
+ }
364149
+ }
364150
+ }
364084
364151
  }
364085
364152
  return results;
364086
364153
  }
@@ -364099,7 +364166,7 @@ var require_dist11 = __commonJS({
364099
364166
  const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
364100
364167
  const base4 = await this.git.showFile(baseGen.tree_hash, filePath);
364101
364168
  const theirs = await this.applyPatchToContent(base4, patch5.patch_content, filePath, tempGit, tempDir2);
364102
- if (theirs && base4) {
364169
+ if (theirs) {
364103
364170
  this.fileTheirsAccumulator.set(resolvedPath, {
364104
364171
  content: theirs,
364105
364172
  baseGeneration: patch5.base_generation
@@ -364231,7 +364298,7 @@ var require_dist11 = __commonJS({
364231
364298
  );
364232
364299
  let useAccumulatorAsMergeBase = false;
364233
364300
  const accumulatorEntry = this.fileTheirsAccumulator.get(resolvedPath);
364234
- if (!theirs && base4 && accumulatorEntry) {
364301
+ if (!theirs && accumulatorEntry) {
364235
364302
  theirs = await this.applyPatchToContent(
364236
364303
  accumulatorEntry.content,
364237
364304
  patch5.patch_content,
@@ -364290,7 +364357,7 @@ var require_dist11 = __commonJS({
364290
364357
  reason: "missing-content"
364291
364358
  };
364292
364359
  }
364293
- if (!base4 || !ours) {
364360
+ if (!base4 && !useAccumulatorAsMergeBase || !ours) {
364294
364361
  return {
364295
364362
  file: resolvedPath,
364296
364363
  status: "skipped",
@@ -364298,11 +364365,18 @@ var require_dist11 = __commonJS({
364298
364365
  };
364299
364366
  }
364300
364367
  const mergeBase = useAccumulatorAsMergeBase && accumulatorEntry ? accumulatorEntry.content : base4;
364368
+ if (mergeBase == null) {
364369
+ return {
364370
+ file: resolvedPath,
364371
+ status: "skipped",
364372
+ reason: "missing-content"
364373
+ };
364374
+ }
364301
364375
  const merged = threeWayMerge(mergeBase, ours, effective_theirs);
364302
364376
  const outDir = (0, import_node_path210.dirname)(oursPath);
364303
364377
  await (0, import_promises181.mkdir)(outDir, { recursive: true });
364304
364378
  await (0, import_promises181.writeFile)(oursPath, merged.content);
364305
- if (effective_theirs && base4) {
364379
+ if (effective_theirs) {
364306
364380
  this.fileTheirsAccumulator.set(resolvedPath, {
364307
364381
  content: effective_theirs,
364308
364382
  baseGeneration: patch5.base_generation
@@ -364541,32 +364615,6 @@ CLI Version: ${options2.cliVersion}`;
364541
364615
  var import_node_path310 = require("path");
364542
364616
  var import_minimatch22 = require_commonjs3();
364543
364617
  init_GitClient();
364544
- function stripConflictMarkers(content5) {
364545
- const lines = content5.split("\n");
364546
- const result = [];
364547
- let inConflict = false;
364548
- let inOurs = false;
364549
- for (const line of lines) {
364550
- if (line.startsWith("<<<<<<< ")) {
364551
- inConflict = true;
364552
- inOurs = true;
364553
- continue;
364554
- }
364555
- if (inConflict && line === "=======") {
364556
- inOurs = false;
364557
- continue;
364558
- }
364559
- if (inConflict && line.startsWith(">>>>>>> ")) {
364560
- inConflict = false;
364561
- inOurs = false;
364562
- continue;
364563
- }
364564
- if (!inConflict || inOurs) {
364565
- result.push(line);
364566
- }
364567
- }
364568
- return result.join("\n");
364569
- }
364570
364618
  var ReplayService = class {
364571
364619
  git;
364572
364620
  detector;
@@ -365528,30 +365576,145 @@ CLI Version: ${options2.cliVersion}`;
365528
365576
  return `sha256:${(0, import_node_crypto32.createHash)("sha256").update(normalized).digest("hex")}`;
365529
365577
  }
365530
365578
  var import_minimatch42 = require_commonjs3();
365531
- function forget(outputDir, filePattern, options2) {
365579
+ function parseDiffStat(patchContent) {
365580
+ let additions = 0;
365581
+ let deletions = 0;
365582
+ let inDiffHunk = false;
365583
+ for (const line of patchContent.split("\n")) {
365584
+ if (line.startsWith("diff --git ")) {
365585
+ inDiffHunk = true;
365586
+ continue;
365587
+ }
365588
+ if (!inDiffHunk) continue;
365589
+ if (line.startsWith("+") && !line.startsWith("+++")) {
365590
+ additions++;
365591
+ } else if (line.startsWith("-") && !line.startsWith("---")) {
365592
+ deletions++;
365593
+ }
365594
+ }
365595
+ return { additions, deletions };
365596
+ }
365597
+ function toMatchedPatch(patch5) {
365598
+ return {
365599
+ id: patch5.id,
365600
+ message: patch5.original_message,
365601
+ files: patch5.files,
365602
+ diffstat: parseDiffStat(patch5.patch_content),
365603
+ ...patch5.status ? { status: patch5.status } : {}
365604
+ };
365605
+ }
365606
+ function matchesPatch(patch5, pattern) {
365607
+ const fileMatch = patch5.files.some(
365608
+ (file4) => file4 === pattern || (0, import_minimatch42.minimatch)(file4, pattern)
365609
+ );
365610
+ if (fileMatch) return true;
365611
+ return patch5.original_message.toLowerCase().includes(pattern.toLowerCase());
365612
+ }
365613
+ function buildWarnings(patches) {
365614
+ const warnings = [];
365615
+ for (const patch5 of patches) {
365616
+ if (patch5.status === "resolving") {
365617
+ warnings.push(
365618
+ `patch ${patch5.id} has conflict markers in these files: ${patch5.files.join(", ")}. Run \`git checkout -- <files>\` to restore the generated versions.`
365619
+ );
365620
+ } else if (patch5.status === "unresolved") {
365621
+ warnings.push(
365622
+ `patch ${patch5.id} had unresolved conflicts (files: ${patch5.files.join(", ")}).`
365623
+ );
365624
+ }
365625
+ }
365626
+ return warnings;
365627
+ }
365628
+ var EMPTY_RESULT = {
365629
+ initialized: false,
365630
+ removed: [],
365631
+ remaining: 0,
365632
+ notFound: false,
365633
+ alreadyForgotten: [],
365634
+ totalPatches: 0,
365635
+ warnings: []
365636
+ };
365637
+ function forget(outputDir, options2) {
365532
365638
  const lockManager = new LockfileManager(outputDir);
365533
365639
  if (!lockManager.exists()) {
365534
- return { removed: [], notFound: true };
365640
+ return { ...EMPTY_RESULT };
365535
365641
  }
365536
365642
  const lock = lockManager.read();
365537
- const matchingPatches = lock.patches.filter(
365538
- (patch5) => patch5.files.some((file4) => file4 === filePattern || (0, import_minimatch42.minimatch)(file4, filePattern))
365539
- );
365540
- if (matchingPatches.length === 0) {
365541
- return { removed: [], notFound: true };
365643
+ const totalPatches = lock.patches.length;
365644
+ if (options2?.all) {
365645
+ const removed = lock.patches.map(toMatchedPatch);
365646
+ const warnings = buildWarnings(lock.patches);
365647
+ if (!options2.dryRun) {
365648
+ for (const patch5 of lock.patches) {
365649
+ lockManager.addForgottenHash(patch5.content_hash);
365650
+ }
365651
+ lockManager.clearPatches();
365652
+ lockManager.save();
365653
+ }
365654
+ return {
365655
+ initialized: true,
365656
+ removed,
365657
+ remaining: 0,
365658
+ notFound: false,
365659
+ alreadyForgotten: [],
365660
+ totalPatches,
365661
+ warnings
365662
+ };
365542
365663
  }
365543
- const removed = matchingPatches.map((p10) => ({
365544
- id: p10.id,
365545
- message: p10.original_message,
365546
- files: p10.files
365547
- }));
365548
- if (!options2?.dryRun) {
365549
- for (const patch5 of matchingPatches) {
365550
- lockManager.removePatch(patch5.id);
365664
+ if (options2?.patchIds && options2.patchIds.length > 0) {
365665
+ const removed = [];
365666
+ const alreadyForgotten = [];
365667
+ const patchesToRemove = [];
365668
+ for (const id2 of options2.patchIds) {
365669
+ const patch5 = lock.patches.find((p10) => p10.id === id2);
365670
+ if (patch5) {
365671
+ removed.push(toMatchedPatch(patch5));
365672
+ patchesToRemove.push(patch5);
365673
+ } else {
365674
+ alreadyForgotten.push(id2);
365675
+ }
365551
365676
  }
365552
- lockManager.save();
365677
+ const warnings = buildWarnings(patchesToRemove);
365678
+ if (!options2.dryRun) {
365679
+ for (const patch5 of patchesToRemove) {
365680
+ lockManager.addForgottenHash(patch5.content_hash);
365681
+ lockManager.removePatch(patch5.id);
365682
+ }
365683
+ lockManager.save();
365684
+ }
365685
+ return {
365686
+ initialized: true,
365687
+ removed,
365688
+ remaining: totalPatches - removed.length,
365689
+ notFound: removed.length === 0 && alreadyForgotten.length > 0,
365690
+ alreadyForgotten,
365691
+ totalPatches,
365692
+ warnings
365693
+ };
365553
365694
  }
365554
- return { removed, notFound: false };
365695
+ if (options2?.pattern) {
365696
+ const matched = lock.patches.filter((p10) => matchesPatch(p10, options2.pattern)).map(toMatchedPatch);
365697
+ return {
365698
+ initialized: true,
365699
+ removed: [],
365700
+ remaining: totalPatches,
365701
+ notFound: matched.length === 0,
365702
+ alreadyForgotten: [],
365703
+ totalPatches,
365704
+ warnings: [],
365705
+ matched
365706
+ };
365707
+ }
365708
+ return {
365709
+ initialized: true,
365710
+ removed: [],
365711
+ remaining: totalPatches,
365712
+ notFound: totalPatches === 0,
365713
+ alreadyForgotten: [],
365714
+ totalPatches,
365715
+ warnings: [],
365716
+ matched: lock.patches.map(toMatchedPatch)
365717
+ };
365555
365718
  }
365556
365719
  var import_node_fs52 = require("fs");
365557
365720
  function reset2(outputDir, options2) {
@@ -365667,24 +365830,49 @@ CLI Version: ${options2.cliVersion}`;
365667
365830
  function status(outputDir) {
365668
365831
  const lockManager = new LockfileManager(outputDir);
365669
365832
  if (!lockManager.exists()) {
365670
- return { initialized: false, patches: [], lastGeneration: void 0 };
365833
+ return {
365834
+ initialized: false,
365835
+ generationCount: 0,
365836
+ lastGeneration: void 0,
365837
+ patches: [],
365838
+ unresolvedCount: 0,
365839
+ excludePatterns: []
365840
+ };
365671
365841
  }
365672
365842
  const lock = lockManager.read();
365673
365843
  const patches = lock.patches.map((patch5) => ({
365674
- sha: patch5.original_commit.slice(0, 7),
365675
- author: patch5.original_author.split("<")[0]?.trim() ?? "unknown",
365844
+ id: patch5.id,
365845
+ type: patch5.patch_content.includes("new file mode") ? "added" : "modified",
365676
365846
  message: patch5.original_message,
365677
- files: patch5.files
365847
+ author: patch5.original_author.split("<")[0]?.trim() || "unknown",
365848
+ sha: patch5.original_commit.slice(0, 7),
365849
+ files: patch5.files,
365850
+ fileCount: patch5.files.length,
365851
+ ...patch5.status ? { status: patch5.status } : {}
365678
365852
  }));
365853
+ const unresolvedCount = lock.patches.filter(
365854
+ (p10) => p10.status === "unresolved" || p10.status === "resolving"
365855
+ ).length;
365679
365856
  let lastGeneration;
365680
365857
  const lastGen = lock.generations.find((g19) => g19.commit_sha === lock.current_generation);
365681
365858
  if (lastGen) {
365682
365859
  lastGeneration = {
365683
- sha: lastGen.commit_sha,
365684
- timestamp: lastGen.timestamp
365860
+ sha: lastGen.commit_sha.slice(0, 7),
365861
+ timestamp: lastGen.timestamp,
365862
+ cliVersion: lastGen.cli_version,
365863
+ generatorVersions: lastGen.generator_versions
365685
365864
  };
365686
365865
  }
365687
- return { initialized: true, patches, lastGeneration };
365866
+ const config5 = lockManager.getCustomizationsConfig();
365867
+ const excludePatterns = config5.exclude ?? [];
365868
+ return {
365869
+ initialized: true,
365870
+ generationCount: lock.generations.length,
365871
+ lastGeneration,
365872
+ patches,
365873
+ unresolvedCount,
365874
+ excludePatterns
365875
+ };
365688
365876
  }
365689
365877
  }
365690
365878
  });
@@ -366044,6 +366232,19 @@ var require_pipeline2 = __commonJS({
366044
366232
  }
366045
366233
  });
366046
366234
 
366235
+ // ../../generator-cli/lib/replay/replay-forget.js
366236
+ var require_replay_forget = __commonJS({
366237
+ "../../generator-cli/lib/replay/replay-forget.js"(exports2) {
366238
+ "use strict";
366239
+ Object.defineProperty(exports2, "__esModule", { value: true });
366240
+ exports2.replayForget = replayForget2;
366241
+ var replay_1 = require_dist11();
366242
+ function replayForget2(params2) {
366243
+ return (0, replay_1.forget)(params2.outputDir, params2.options);
366244
+ }
366245
+ }
366246
+ });
366247
+
366047
366248
  // ../../generator-cli/lib/replay/replay-init.js
366048
366249
  var require_replay_init = __commonJS({
366049
366250
  "../../generator-cli/lib/replay/replay-init.js"(exports2) {
@@ -366208,12 +366409,25 @@ var require_replay_resolve = __commonJS({
366208
366409
  }
366209
366410
  });
366210
366411
 
366412
+ // ../../generator-cli/lib/replay/replay-status.js
366413
+ var require_replay_status = __commonJS({
366414
+ "../../generator-cli/lib/replay/replay-status.js"(exports2) {
366415
+ "use strict";
366416
+ Object.defineProperty(exports2, "__esModule", { value: true });
366417
+ exports2.replayStatus = replayStatus2;
366418
+ var replay_1 = require_dist11();
366419
+ function replayStatus2(params2) {
366420
+ return (0, replay_1.status)(params2.outputDir);
366421
+ }
366422
+ }
366423
+ });
366424
+
366211
366425
  // ../../generator-cli/lib/api.js
366212
366426
  var require_api5 = __commonJS({
366213
366427
  "../../generator-cli/lib/api.js"(exports2) {
366214
366428
  "use strict";
366215
366429
  Object.defineProperty(exports2, "__esModule", { value: true });
366216
- exports2.replayRun = exports2.replayResolve = exports2.replayInit = exports2.formatBootstrapSummary = exports2.PostGenerationPipeline = exports2.logReplaySummary = exports2.formatReplayPrBody = exports2.consolePipelineLogger = exports2.githubRelease = exports2.githubPush = exports2.githubPr = exports2.generateReferenceToStream = exports2.generateReference = exports2.generateReadmeToStream = exports2.generateReadme = void 0;
366430
+ exports2.replayStatus = exports2.replayRun = exports2.replayResolve = exports2.replayInit = exports2.formatBootstrapSummary = exports2.replayForget = exports2.PostGenerationPipeline = exports2.logReplaySummary = exports2.formatReplayPrBody = exports2.consolePipelineLogger = exports2.githubRelease = exports2.githubPush = exports2.githubPr = exports2.generateReferenceToStream = exports2.generateReference = exports2.generateReadmeToStream = exports2.generateReadme = void 0;
366217
366431
  var generate_readme_js_1 = require_generate_readme();
366218
366432
  Object.defineProperty(exports2, "generateReadme", { enumerable: true, get: function() {
366219
366433
  return generate_readme_js_1.generateReadme;
@@ -366253,6 +366467,10 @@ var require_api5 = __commonJS({
366253
366467
  Object.defineProperty(exports2, "PostGenerationPipeline", { enumerable: true, get: function() {
366254
366468
  return index_js_1.PostGenerationPipeline;
366255
366469
  } });
366470
+ var replay_forget_js_1 = require_replay_forget();
366471
+ Object.defineProperty(exports2, "replayForget", { enumerable: true, get: function() {
366472
+ return replay_forget_js_1.replayForget;
366473
+ } });
366256
366474
  var replay_init_js_1 = require_replay_init();
366257
366475
  Object.defineProperty(exports2, "formatBootstrapSummary", { enumerable: true, get: function() {
366258
366476
  return replay_init_js_1.formatBootstrapSummary;
@@ -366268,6 +366486,10 @@ var require_api5 = __commonJS({
366268
366486
  Object.defineProperty(exports2, "replayRun", { enumerable: true, get: function() {
366269
366487
  return replay_run_js_1.replayRun;
366270
366488
  } });
366489
+ var replay_status_js_1 = require_replay_status();
366490
+ Object.defineProperty(exports2, "replayStatus", { enumerable: true, get: function() {
366491
+ return replay_status_js_1.replayStatus;
366492
+ } });
366271
366493
  }
366272
366494
  });
366273
366495
 
@@ -602916,7 +603138,7 @@ var AccessTokenPosthogManager = class {
602916
603138
  properties: {
602917
603139
  ...event,
602918
603140
  ...event.properties,
602919
- version: "4.62.3-9-g975ac7af925",
603141
+ version: "4.62.4",
602920
603142
  usingAccessToken: true
602921
603143
  }
602922
603144
  });
@@ -602967,7 +603189,7 @@ var UserPosthogManager = class {
602967
603189
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
602968
603190
  event: "CLI",
602969
603191
  properties: {
602970
- version: "4.62.3-9-g975ac7af925",
603192
+ version: "4.62.4",
602971
603193
  ...event,
602972
603194
  ...event.properties,
602973
603195
  usingAccessToken: false,
@@ -840263,7 +840485,7 @@ var import_path54 = __toESM(require("path"), 1);
840263
840485
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
840264
840486
  var LOGS_FOLDER_NAME = "logs";
840265
840487
  function getCliSource() {
840266
- const version7 = "4.62.3-9-g975ac7af925";
840488
+ const version7 = "4.62.4";
840267
840489
  return `cli@${version7}`;
840268
840490
  }
840269
840491
  var DebugLogger = class {
@@ -851371,7 +851593,7 @@ var LegacyDocsPublisher = class {
851371
851593
  previewId,
851372
851594
  disableTemplates: void 0,
851373
851595
  skipUpload,
851374
- cliVersion: "4.62.3-9-g975ac7af925"
851596
+ cliVersion: "4.62.4"
851375
851597
  });
851376
851598
  if (taskContext.getResult() === TaskResult.Failure) {
851377
851599
  return { success: false };
@@ -924671,7 +924893,7 @@ var CliContext = class {
924671
924893
  if (false) {
924672
924894
  this.logger.error("CLI_VERSION is not defined");
924673
924895
  }
924674
- return "4.62.3-9-g975ac7af925";
924896
+ return "4.62.4";
924675
924897
  }
924676
924898
  getCliName() {
924677
924899
  if (false) {
@@ -944479,6 +944701,8 @@ function addReplayCommand(cli, cliContext) {
944479
944701
  builder: (yargs) => {
944480
944702
  addReplayInitCommand(yargs, cliContext);
944481
944703
  addReplayResolveCommand(yargs, cliContext);
944704
+ addReplayStatusCommand(yargs, cliContext);
944705
+ addReplayForgetCommand(yargs, cliContext);
944482
944706
  return yargs;
944483
944707
  },
944484
944708
  handler: () => {
@@ -944669,6 +944893,211 @@ Resolve the conflicts in your editor, then run \`fern replay resolve\` again to
944669
944893
  }
944670
944894
  );
944671
944895
  }
944896
+ function addReplayStatusCommand(cli, cliContext) {
944897
+ cli.command(
944898
+ "status [directory]",
944899
+ false,
944900
+ // hidden from --help
944901
+ (yargs) => yargs.positional("directory", {
944902
+ type: "string",
944903
+ default: ".",
944904
+ description: "SDK directory containing .fern/replay.lock"
944905
+ }).option("verbose", {
944906
+ type: "boolean",
944907
+ alias: "v",
944908
+ default: false,
944909
+ description: "Show all patches with full details"
944910
+ }),
944911
+ async (argv) => {
944912
+ await cliContext.instrumentPostHogEvent({
944913
+ command: "fern replay status"
944914
+ });
944915
+ const outputDir = resolve5(cwd(), argv.directory ?? ".");
944916
+ try {
944917
+ const result = (0, import_generator_cli2.replayStatus)({ outputDir });
944918
+ if (!result.initialized) {
944919
+ cliContext.logger.info("Replay is not initialized. Run `fern replay init` to get started.");
944920
+ return;
944921
+ }
944922
+ cliContext.logger.info(
944923
+ `Replay: ${result.patches.length} customization(s) tracked, ${result.generationCount} generation(s)`
944924
+ );
944925
+ if (result.lastGeneration) {
944926
+ cliContext.logger.info(
944927
+ `Last generation: ${result.lastGeneration.sha} (${result.lastGeneration.timestamp})`
944928
+ );
944929
+ }
944930
+ if (result.patches.length === 0) {
944931
+ cliContext.logger.info("No customizations tracked.");
944932
+ return;
944933
+ }
944934
+ const patchesToShow = argv.verbose ? result.patches : result.patches.slice(0, 10);
944935
+ for (const patch5 of patchesToShow) {
944936
+ const statusTag = patch5.status ? ` [${patch5.status}]` : "";
944937
+ if (argv.verbose) {
944938
+ cliContext.logger.info(
944939
+ `
944940
+ ${patch5.id} (${patch5.type})${statusTag}
944941
+ ${patch5.message}
944942
+ Author: ${patch5.author} (${patch5.sha})
944943
+ Files (${patch5.fileCount}): ${patch5.files.join(", ")}`
944944
+ );
944945
+ } else {
944946
+ cliContext.logger.info(
944947
+ ` ${patch5.id}: ${patch5.message} (${patch5.fileCount} file(s))${statusTag}`
944948
+ );
944949
+ }
944950
+ }
944951
+ if (!argv.verbose && result.patches.length > 10) {
944952
+ cliContext.logger.info(` ... and ${result.patches.length - 10} more (use --verbose to see all)`);
944953
+ }
944954
+ if (result.unresolvedCount > 0) {
944955
+ cliContext.logger.warn(
944956
+ `
944957
+ ${result.unresolvedCount} patch(es) have unresolved conflicts. Run \`fern replay resolve\` to fix.`
944958
+ );
944959
+ }
944960
+ if (result.excludePatterns.length > 0) {
944961
+ cliContext.logger.info(`
944962
+ Exclude patterns: ${result.excludePatterns.join(", ")}`);
944963
+ }
944964
+ } catch (error50) {
944965
+ cliContext.failAndThrow(`Failed to get Replay status: ${extractErrorMessage(error50)}`);
944966
+ }
944967
+ }
944968
+ );
944969
+ }
944970
+ function addReplayForgetCommand(cli, cliContext) {
944971
+ cli.command(
944972
+ "forget [args..]",
944973
+ false,
944974
+ // hidden from --help
944975
+ (yargs) => yargs.positional("args", {
944976
+ type: "string",
944977
+ array: true,
944978
+ description: "Patch IDs (e.g. patch-abc12345) or a search pattern"
944979
+ }).option("dry-run", {
944980
+ type: "boolean",
944981
+ default: false,
944982
+ description: "Show what would be removed without actually removing"
944983
+ }).option("yes", {
944984
+ type: "boolean",
944985
+ alias: "y",
944986
+ default: false,
944987
+ description: "Skip confirmation prompts"
944988
+ }).option("all", {
944989
+ type: "boolean",
944990
+ default: false,
944991
+ description: "Remove all tracked patches"
944992
+ }),
944993
+ async (argv) => {
944994
+ await cliContext.instrumentPostHogEvent({
944995
+ command: "fern replay forget"
944996
+ });
944997
+ const outputDir = resolve5(cwd(), ".");
944998
+ const args = argv.args ?? [];
944999
+ const dryRun = argv.dryRun;
945000
+ try {
945001
+ if (argv.all) {
945002
+ const result2 = (0, import_generator_cli2.replayForget)({ outputDir, options: { all: true, dryRun } });
945003
+ if (!result2.initialized) {
945004
+ cliContext.logger.info("Replay is not initialized. Nothing to forget.");
945005
+ return;
945006
+ }
945007
+ if (result2.removed.length === 0) {
945008
+ cliContext.logger.info("No patches to remove.");
945009
+ return;
945010
+ }
945011
+ if (dryRun) {
945012
+ cliContext.logger.info(`Would remove ${result2.removed.length} patch(es):`);
945013
+ } else {
945014
+ cliContext.logger.info(`Removed ${result2.removed.length} patch(es):`);
945015
+ }
945016
+ for (const patch5 of result2.removed) {
945017
+ cliContext.logger.info(` ${patch5.id}: ${patch5.message}`);
945018
+ }
945019
+ for (const warning of result2.warnings) {
945020
+ cliContext.logger.warn(warning);
945021
+ }
945022
+ return;
945023
+ }
945024
+ if (args.length > 0 && args.every((a10) => a10.startsWith("patch-"))) {
945025
+ const result2 = (0, import_generator_cli2.replayForget)({ outputDir, options: { patchIds: args, dryRun } });
945026
+ if (!result2.initialized) {
945027
+ cliContext.logger.info("Replay is not initialized. Nothing to forget.");
945028
+ return;
945029
+ }
945030
+ if (result2.removed.length > 0) {
945031
+ const verb = dryRun ? "Would remove" : "Removed";
945032
+ for (const patch5 of result2.removed) {
945033
+ cliContext.logger.info(`${verb}: ${patch5.id} \u2014 ${patch5.message}`);
945034
+ }
945035
+ }
945036
+ for (const id2 of result2.alreadyForgotten) {
945037
+ cliContext.logger.info(`Already forgotten: ${id2}`);
945038
+ }
945039
+ for (const warning of result2.warnings) {
945040
+ cliContext.logger.warn(warning);
945041
+ }
945042
+ return;
945043
+ }
945044
+ const pattern = args.length === 1 ? args[0] : void 0;
945045
+ const result = (0, import_generator_cli2.replayForget)({ outputDir, options: { pattern } });
945046
+ if (!result.initialized) {
945047
+ cliContext.logger.info("Replay is not initialized. Nothing to forget.");
945048
+ return;
945049
+ }
945050
+ const matched = result.matched ?? [];
945051
+ if (matched.length === 0) {
945052
+ if (pattern) {
945053
+ cliContext.logger.info(`No patches matching "${pattern}".`);
945054
+ } else {
945055
+ cliContext.logger.info("No patches tracked.");
945056
+ }
945057
+ return;
945058
+ }
945059
+ cliContext.logger.info(`${matched.length} patch(es) matched:`);
945060
+ for (const patch5 of matched) {
945061
+ const stat6 = `+${patch5.diffstat.additions}/-${patch5.diffstat.deletions}`;
945062
+ cliContext.logger.info(` ${patch5.id}: ${patch5.message} (${stat6})`);
945063
+ }
945064
+ if (dryRun) {
945065
+ cliContext.logger.info("\nDry run \u2014 no patches removed.");
945066
+ return;
945067
+ }
945068
+ if (!argv.yes) {
945069
+ if (!process.stdout.isTTY) {
945070
+ cliContext.failAndThrow(
945071
+ "Confirmation required. Use --yes to skip confirmation in non-interactive mode."
945072
+ );
945073
+ return;
945074
+ }
945075
+ const readline7 = await import("readline");
945076
+ const rl3 = readline7.createInterface({ input: process.stdin, output: process.stderr });
945077
+ const answer = await new Promise((resolvePrompt) => {
945078
+ rl3.question(`
945079
+ Remove ${matched.length} patch(es)? [y/N] `, resolvePrompt);
945080
+ });
945081
+ rl3.close();
945082
+ if (answer.toLowerCase() !== "y") {
945083
+ cliContext.logger.info("Cancelled.");
945084
+ return;
945085
+ }
945086
+ }
945087
+ const patchIds = matched.map((p10) => p10.id);
945088
+ const removeResult = (0, import_generator_cli2.replayForget)({ outputDir, options: { patchIds, dryRun: false } });
945089
+ cliContext.logger.info(
945090
+ `Removed ${removeResult.removed.length} patch(es). ${removeResult.remaining} remaining.`
945091
+ );
945092
+ for (const warning of removeResult.warnings) {
945093
+ cliContext.logger.warn(warning);
945094
+ }
945095
+ } catch (error50) {
945096
+ cliContext.failAndThrow(`Failed to forget patches: ${extractErrorMessage(error50)}`);
945097
+ }
945098
+ }
945099
+ );
945100
+ }
944672
945101
  function parseOwnerRepo(githubRepo) {
944673
945102
  const cleaned = githubRepo.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/^github\.com\//, "");
944674
945103
  const parts = cleaned.split("/");
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.62.3-9-g975ac7af925",
2
+ "version": "4.62.4",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",