@fern-api/fern-api-dev 5.9.0 → 5.10.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.
Files changed (2) hide show
  1. package/cli.cjs +293 -40
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -58001,7 +58001,9 @@ function newRepositoryReference({ remote, owner, repo }) {
58001
58001
  repoUrl,
58002
58002
  cloneUrl,
58003
58003
  getAuthedCloneUrl: (installationToken) => {
58004
- return cloneUrl.replace("https://", `https://x-access-token:${installationToken}@`);
58004
+ const isInstallationToken = installationToken.startsWith("ghs_") || installationToken.startsWith("ghu_");
58005
+ const userPrefix = isInstallationToken ? "x-access-token:" : "";
58006
+ return cloneUrl.replace("https://", `https://${userPrefix}${installationToken}@`);
58005
58007
  }
58006
58008
  };
58007
58009
  }
@@ -291713,7 +291715,7 @@ var require_websocket = __commonJS({
291713
291715
  var http13 = require("http");
291714
291716
  var net4 = require("net");
291715
291717
  var tls2 = require("tls");
291716
- var { randomBytes: randomBytes2, createHash: createHash5 } = require("crypto");
291718
+ var { randomBytes: randomBytes2, createHash: createHash6 } = require("crypto");
291717
291719
  var { Duplex, Readable: Readable8 } = require("stream");
291718
291720
  var { URL: URL4 } = require("url");
291719
291721
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -292373,7 +292375,7 @@ var require_websocket = __commonJS({
292373
292375
  abortHandshake(websocket, socket, "Invalid Upgrade header");
292374
292376
  return;
292375
292377
  }
292376
- const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
292378
+ const digest = createHash6("sha1").update(key2 + GUID).digest("base64");
292377
292379
  if (res.headers["sec-websocket-accept"] !== digest) {
292378
292380
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
292379
292381
  return;
@@ -292740,7 +292742,7 @@ var require_websocket_server = __commonJS({
292740
292742
  var EventEmitter9 = require("events");
292741
292743
  var http13 = require("http");
292742
292744
  var { Duplex } = require("stream");
292743
- var { createHash: createHash5 } = require("crypto");
292745
+ var { createHash: createHash6 } = require("crypto");
292744
292746
  var extension4 = require_extension();
292745
292747
  var PerMessageDeflate2 = require_permessage_deflate();
292746
292748
  var subprotocol2 = require_subprotocol();
@@ -293041,7 +293043,7 @@ var require_websocket_server = __commonJS({
293041
293043
  );
293042
293044
  }
293043
293045
  if (this._state > RUNNING) return abortHandshake(socket, 503);
293044
- const digest = createHash5("sha1").update(key2 + GUID).digest("base64");
293046
+ const digest = createHash6("sha1").update(key2 + GUID).digest("base64");
293045
293047
  const headers2 = [
293046
293048
  "HTTP/1.1 101 Switching Protocols",
293047
293049
  "Upgrade: websocket",
@@ -345532,6 +345534,7 @@ var require_replay_run = __commonJS({
345532
345534
  "../../generator-cli/lib/replay/replay-run.js"(exports2) {
345533
345535
  "use strict";
345534
345536
  Object.defineProperty(exports2, "__esModule", { value: true });
345537
+ exports2.ReplayPrepareError = void 0;
345535
345538
  exports2.replayPrepare = replayPrepare;
345536
345539
  exports2.replayApply = replayApply;
345537
345540
  exports2.replayRun = replayRun;
@@ -345577,12 +345580,17 @@ var require_replay_run = __commonJS({
345577
345580
  if (!isTagMergedIntoHead(outputDir, tagSha)) {
345578
345581
  logger4?.warn(`fern-generation-base tag ${tagSha} is not reachable from HEAD \u2014 skipping divergent-merge sync. The tag likely points at an unmerged generation (PR closed without merge).`);
345579
345582
  } else {
345580
- const syncService = new replay_1.ReplayService(outputDir, { enabled: true });
345581
- await syncService.syncFromDivergentMerge(tagSha, {
345582
- cliVersion,
345583
- generatorVersions,
345584
- baseBranchHead: baseBranchHead ?? void 0
345585
- });
345583
+ try {
345584
+ const syncService = new replay_1.ReplayService(outputDir, { enabled: true });
345585
+ await syncService.syncFromDivergentMerge(tagSha, {
345586
+ cliVersion,
345587
+ generatorVersions,
345588
+ baseBranchHead: baseBranchHead ?? void 0
345589
+ });
345590
+ } catch (error50) {
345591
+ logger4?.warn("Replay divergent-merge sync failed, continuing without sync: " + String(error50));
345592
+ throw new ReplayPrepareError(String(error50), error50);
345593
+ }
345586
345594
  try {
345587
345595
  const freshLockManager = new replay_1.LockfileManager(outputDir);
345588
345596
  if (freshLockManager.exists()) {
@@ -345604,8 +345612,8 @@ var require_replay_run = __commonJS({
345604
345612
  baseBranchHead: baseBranchHead ?? void 0
345605
345613
  });
345606
345614
  } catch (error50) {
345607
- logger4?.warn("Replay failed, continuing without replay: " + String(error50));
345608
- return null;
345615
+ logger4?.warn("Replay prepare failed, continuing without replay: " + String(error50));
345616
+ throw new ReplayPrepareError(String(error50), error50);
345609
345617
  }
345610
345618
  return {
345611
345619
  _service: service,
@@ -345623,13 +345631,14 @@ var require_replay_run = __commonJS({
345623
345631
  try {
345624
345632
  report = await prepared._service.applyPreparedReplay(prepared._preparation, { stageOnly });
345625
345633
  } catch (error50) {
345626
- logger4?.warn("Replay failed, continuing without replay: " + String(error50));
345634
+ logger4?.warn("Replay apply failed, continuing without replay: " + String(error50));
345627
345635
  return {
345628
345636
  report: null,
345629
345637
  fernignoreUpdated: false,
345630
345638
  previousGenerationSha: prepared.previousGenerationSha,
345631
345639
  currentGenerationSha: prepared.currentGenerationSha,
345632
- baseBranchHead: prepared.baseBranchHead
345640
+ baseBranchHead: prepared.baseBranchHead,
345641
+ failureReason: String(error50)
345633
345642
  };
345634
345643
  }
345635
345644
  let resolvedBaseBranchHead = prepared.baseBranchHead;
@@ -345655,7 +345664,19 @@ var require_replay_run = __commonJS({
345655
345664
  };
345656
345665
  }
345657
345666
  async function replayRun(params2) {
345658
- const prepared = await replayPrepare(params2);
345667
+ let prepared;
345668
+ try {
345669
+ prepared = await replayPrepare(params2);
345670
+ } catch (error50) {
345671
+ return {
345672
+ report: null,
345673
+ fernignoreUpdated: false,
345674
+ previousGenerationSha: null,
345675
+ currentGenerationSha: null,
345676
+ baseBranchHead: null,
345677
+ failureReason: error50 instanceof ReplayPrepareError ? error50.reason : String(error50)
345678
+ };
345679
+ }
345659
345680
  if (prepared == null) {
345660
345681
  return {
345661
345682
  report: null,
@@ -345667,6 +345688,19 @@ var require_replay_run = __commonJS({
345667
345688
  }
345668
345689
  return replayApply(prepared, { stageOnly: params2.stageOnly, logger: params2.logger });
345669
345690
  }
345691
+ var ReplayPrepareError = class extends Error {
345692
+ reason;
345693
+ constructor(reason, cause) {
345694
+ super(`Replay prepare failed: ${reason}`, { cause });
345695
+ Object.setPrototypeOf(this, new.target.prototype);
345696
+ if (Error.captureStackTrace) {
345697
+ Error.captureStackTrace(this, this.constructor);
345698
+ }
345699
+ this.name = this.constructor.name;
345700
+ this.reason = reason;
345701
+ }
345702
+ };
345703
+ exports2.ReplayPrepareError = ReplayPrepareError;
345670
345704
  function isTagMergedIntoHead(cwd2, tagSha) {
345671
345705
  try {
345672
345706
  (0, child_process_1.execFileSync)("git", ["merge-base", "--is-ancestor", tagSha, "HEAD"], {
@@ -358208,6 +358242,7 @@ var require_GenerationCommitStep = __commonJS({
358208
358242
  "use strict";
358209
358243
  Object.defineProperty(exports2, "__esModule", { value: true });
358210
358244
  exports2.GenerationCommitStep = void 0;
358245
+ var child_process_1 = require("child_process");
358211
358246
  var replay_run_1 = require_replay_run();
358212
358247
  var BaseStep_1 = require_BaseStep();
358213
358248
  var GenerationCommitStep = class extends BaseStep_1.BaseStep {
@@ -358224,14 +358259,35 @@ var require_GenerationCommitStep = __commonJS({
358224
358259
  this.generatorName = generatorName;
358225
358260
  }
358226
358261
  async execute(_context) {
358227
- const prepared = await (0, replay_run_1.replayPrepare)({
358228
- outputDir: this.outputDir,
358229
- cliVersion: this.cliVersion,
358230
- generatorVersions: this.generatorVersions,
358231
- generatorName: this.generatorName,
358232
- skipApplication: this.config.skipApplication,
358233
- logger: this.logger
358234
- });
358262
+ const headBeforePrepare = tryRevParse(this.outputDir, "HEAD");
358263
+ let prepared;
358264
+ try {
358265
+ prepared = await (0, replay_run_1.replayPrepare)({
358266
+ outputDir: this.outputDir,
358267
+ cliVersion: this.cliVersion,
358268
+ generatorVersions: this.generatorVersions,
358269
+ generatorName: this.generatorName,
358270
+ skipApplication: this.config.skipApplication,
358271
+ logger: this.logger
358272
+ });
358273
+ } catch (error50) {
358274
+ const reason = error50 instanceof replay_run_1.ReplayPrepareError ? error50.reason : String(error50);
358275
+ if (headBeforePrepare != null) {
358276
+ try {
358277
+ (0, child_process_1.execFileSync)("git", ["reset", "--hard", headBeforePrepare], {
358278
+ cwd: this.outputDir,
358279
+ stdio: "pipe"
358280
+ });
358281
+ } catch {
358282
+ }
358283
+ }
358284
+ return {
358285
+ executed: true,
358286
+ success: true,
358287
+ errorMessage: reason,
358288
+ preparedReplay: null
358289
+ };
358290
+ }
358235
358291
  if (prepared == null) {
358236
358292
  return {
358237
358293
  executed: true,
@@ -358251,6 +358307,17 @@ var require_GenerationCommitStep = __commonJS({
358251
358307
  }
358252
358308
  };
358253
358309
  exports2.GenerationCommitStep = GenerationCommitStep;
358310
+ function tryRevParse(cwd2, rev) {
358311
+ try {
358312
+ return (0, child_process_1.execFileSync)("git", ["rev-parse", "--verify", rev], {
358313
+ cwd: cwd2,
358314
+ encoding: "utf-8",
358315
+ stdio: "pipe"
358316
+ }).trim();
358317
+ } catch {
358318
+ return null;
358319
+ }
358320
+ }
358254
358321
  }
358255
358322
  });
358256
358323
 
@@ -358548,8 +358615,10 @@ var require_replay_summary = __commonJS({
358548
358615
  const applied = result.patchesApplied ?? 0;
358549
358616
  const absorbed = result.patchesAbsorbed ?? 0;
358550
358617
  const unresolvedCount = result.unresolvedPatches?.length ?? 0;
358618
+ const unresolvedFiles = (result.unresolvedPatches ?? []).reduce((sum, patch5) => sum + patch5.conflictDetails.length, 0);
358551
358619
  const preserved = applied - absorbed;
358552
- logger4.debug(`Replay: flow=${result.flow}, detected=${result.patchesDetected ?? 0}, applied=${applied}, absorbed=${absorbed}, unresolved=${unresolvedCount}`);
358620
+ const replayLogicSucceeded = result.replayCrashed !== true;
358621
+ logger4.info(`[replay] flow=${result.flow ?? "unknown"} detected=${result.patchesDetected ?? 0} applied=${applied} conflicts=${result.patchesWithConflicts ?? 0} absorbed=${absorbed} repointed=${result.patchesRepointed ?? 0} content_rebased=${result.patchesContentRebased ?? 0} kept_as_user_owned=${result.patchesKeptAsUserOwned ?? 0} unresolved=${unresolvedCount} unresolved_files=${unresolvedFiles} warnings=${result.warnings?.length ?? 0} success=${replayLogicSucceeded}`);
358553
358622
  if (preserved > 0) {
358554
358623
  const absorbedNote = absorbed > 0 ? ` (some customizations now part of generated code)` : "";
358555
358624
  logger4.info(`Replay: customizations preserved${absorbedNote}`);
@@ -358557,8 +358626,29 @@ var require_replay_summary = __commonJS({
358557
358626
  logger4.info(`Replay: customizations now part of generated code`);
358558
358627
  }
358559
358628
  if (unresolvedCount > 0) {
358560
- const totalFiles = (result.unresolvedPatches ?? []).reduce((sum, patch5) => sum + patch5.conflictDetails.length, 0);
358561
- logger4.warn(`Replay: ${plural(totalFiles, "file")} ${totalFiles === 1 ? "has" : "have"} unresolved conflicts \u2014 resolve via \`fern replay resolve\``);
358629
+ const buckets = { sameLineEdit: 0, newFileBoth: 0, baseGenerationMismatch: 0, patchApplyFailed: 0, other: 0 };
358630
+ for (const patch5 of result.unresolvedPatches ?? []) {
358631
+ for (const file4 of patch5.conflictDetails) {
358632
+ switch (file4.conflictReason) {
358633
+ case "same-line-edit":
358634
+ buckets.sameLineEdit += 1;
358635
+ break;
358636
+ case "new-file-both":
358637
+ buckets.newFileBoth += 1;
358638
+ break;
358639
+ case "base-generation-mismatch":
358640
+ buckets.baseGenerationMismatch += 1;
358641
+ break;
358642
+ case "patch-apply-failed":
358643
+ buckets.patchApplyFailed += 1;
358644
+ break;
358645
+ default:
358646
+ buckets.other += 1;
358647
+ }
358648
+ }
358649
+ }
358650
+ logger4.debug(`[replay] conflict_buckets same_line_edit=${buckets.sameLineEdit} new_file_both=${buckets.newFileBoth} base_generation_mismatch=${buckets.baseGenerationMismatch} patch_apply_failed=${buckets.patchApplyFailed} other=${buckets.other}`);
358651
+ logger4.warn(`Replay: ${plural(unresolvedFiles, "file")} ${unresolvedFiles === 1 ? "has" : "have"} unresolved conflicts \u2014 resolve via \`fern replay resolve\``);
358562
358652
  for (const patch5 of result.unresolvedPatches ?? []) {
358563
358653
  logger4.warn(` "${patchDescription(patch5)}":`);
358564
358654
  for (const file4 of patch5.conflictDetails) {
@@ -358566,6 +358656,9 @@ var require_replay_summary = __commonJS({
358566
358656
  }
358567
358657
  }
358568
358658
  }
358659
+ if (result.replayCrashed === true && result.errorMessage != null) {
358660
+ logger4.warn(`Replay: ${result.errorMessage}`);
358661
+ }
358569
358662
  for (const warning of result.warnings ?? []) {
358570
358663
  logger4.warn(`Replay: ${warning}`);
358571
358664
  }
@@ -359006,6 +359099,18 @@ var require_ReplayStep = __commonJS({
359006
359099
  async execute(context3) {
359007
359100
  const generationCommit = context3.previousStepResults.generationCommit;
359008
359101
  const prepared = generationCommit?.preparedReplay;
359102
+ if (generationCommit != null && generationCommit.errorMessage != null && prepared == null) {
359103
+ return {
359104
+ executed: true,
359105
+ success: true,
359106
+ replayCrashed: true,
359107
+ errorMessage: generationCommit.errorMessage,
359108
+ flow: "normal-regeneration",
359109
+ patchesDetected: 0,
359110
+ patchesApplied: 0,
359111
+ patchesWithConflicts: 0
359112
+ };
359113
+ }
359009
359114
  if (generationCommit != null && prepared == null) {
359010
359115
  return {
359011
359116
  executed: true,
@@ -359028,6 +359133,21 @@ var require_ReplayStep = __commonJS({
359028
359133
  skipApplication: this.config.skipApplication,
359029
359134
  logger: this.logger
359030
359135
  });
359136
+ if (result.failureReason != null) {
359137
+ return {
359138
+ executed: true,
359139
+ success: true,
359140
+ replayCrashed: true,
359141
+ errorMessage: result.failureReason,
359142
+ previousGenerationSha: result.previousGenerationSha ?? void 0,
359143
+ currentGenerationSha: result.currentGenerationSha ?? void 0,
359144
+ baseBranchHead: result.baseBranchHead ?? void 0,
359145
+ flow: "normal-regeneration",
359146
+ patchesDetected: 0,
359147
+ patchesApplied: 0,
359148
+ patchesWithConflicts: 0
359149
+ };
359150
+ }
359031
359151
  if (result.report == null) {
359032
359152
  return {
359033
359153
  executed: true,
@@ -622638,7 +622758,7 @@ var AccessTokenPosthogManager = class {
622638
622758
  properties: {
622639
622759
  ...event,
622640
622760
  ...event.properties,
622641
- version: "5.9.0",
622761
+ version: "5.10.0",
622642
622762
  usingAccessToken: true
622643
622763
  }
622644
622764
  });
@@ -622692,7 +622812,7 @@ var UserPosthogManager = class {
622692
622812
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
622693
622813
  event: "CLI",
622694
622814
  properties: {
622695
- version: "5.9.0",
622815
+ version: "5.10.0",
622696
622816
  ...event,
622697
622817
  ...event.properties,
622698
622818
  usingAccessToken: false,
@@ -628384,7 +628504,24 @@ var TaskContextAdapter = class {
628384
628504
  return false;
628385
628505
  }
628386
628506
  }
628387
- instrumentPostHogEvent(_event) {
628507
+ instrumentPostHogEvent(event) {
628508
+ try {
628509
+ if (event.command == null || event.command.length === 0) {
628510
+ return;
628511
+ }
628512
+ const eventName = event.command;
628513
+ const tags = {};
628514
+ if (event.orgId != null) {
628515
+ tags.org = event.orgId;
628516
+ }
628517
+ for (const [key2, value2] of Object.entries(event.properties ?? {})) {
628518
+ if (typeof value2 === "string" || typeof value2 === "number" || typeof value2 === "boolean" || value2 === null) {
628519
+ tags[String(key2)] = value2;
628520
+ }
628521
+ }
628522
+ this.context.telemetry.sendEvent(eventName, tags);
628523
+ } catch {
628524
+ }
628388
628525
  }
628389
628526
  formatError(error50) {
628390
628527
  if (error50 == null) {
@@ -847594,7 +847731,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
847594
847731
  var LOGS_FOLDER_NAME = "logs";
847595
847732
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
847596
847733
  function getCliSource() {
847597
- const version7 = "5.9.0";
847734
+ const version7 = "5.10.0";
847598
847735
  return `cli@${version7}`;
847599
847736
  }
847600
847737
  var DebugLogger = class {
@@ -860247,7 +860384,7 @@ var LegacyDocsPublisher = class {
860247
860384
  previewId,
860248
860385
  disableTemplates: void 0,
860249
860386
  skipUpload,
860250
- cliVersion: "5.9.0",
860387
+ cliVersion: "5.10.0",
860251
860388
  loginCommand: "fern auth login"
860252
860389
  });
860253
860390
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -912760,6 +912897,88 @@ var import_os13 = __toESM(require("os"), 1);
912760
912897
  var import_path80 = __toESM(require("path"), 1);
912761
912898
  var import_tmp_promise15 = __toESM(require_tmp_promise(), 1);
912762
912899
 
912900
+ // ../generation/local-generation/local-workspace-runner/lib/buildReplayTelemetryProps.js
912901
+ var import_crypto9 = require("crypto");
912902
+ var KNOWN_CONFLICT_REASONS = [
912903
+ "same-line-edit",
912904
+ "new-file-both",
912905
+ "base-generation-mismatch",
912906
+ "patch-apply-failed"
912907
+ ];
912908
+ function isKnownConflictReason(reason) {
912909
+ return reason != null && KNOWN_CONFLICT_REASONS.includes(reason);
912910
+ }
912911
+ function buildReplayTelemetryProps(input3) {
912912
+ const { pipelineResult, generatorName, generatorVersion, cliVersion, repoUri, automationMode, autoMerge, skipIfNoDiff, hasBreakingChanges, versionArg, versionBump, replayConfigEnabled, noReplayFlag, githubMode, previewMode, durationMs } = input3;
912913
+ const replay = pipelineResult.steps.replay;
912914
+ const github = pipelineResult.steps.github;
912915
+ const unresolvedPatches = replay?.unresolvedPatches ?? [];
912916
+ const unresolvedConflictFilesCount = unresolvedPatches.reduce((sum, patch5) => sum + patch5.conflictDetails.length, 0);
912917
+ const conflictBuckets = {
912918
+ "same-line-edit": 0,
912919
+ "new-file-both": 0,
912920
+ "base-generation-mismatch": 0,
912921
+ "patch-apply-failed": 0,
912922
+ other: 0
912923
+ };
912924
+ for (const patch5 of unresolvedPatches) {
912925
+ for (const detail of patch5.conflictDetails) {
912926
+ if (isKnownConflictReason(detail.conflictReason)) {
912927
+ conflictBuckets[detail.conflictReason] += 1;
912928
+ } else {
912929
+ conflictBuckets.other += 1;
912930
+ }
912931
+ }
912932
+ }
912933
+ const replayLogicSucceeded = replay != null && replay.executed && replay.replayCrashed !== true;
912934
+ return {
912935
+ action: "pipeline_run",
912936
+ success: replayLogicSucceeded,
912937
+ executed: replay?.executed ?? false,
912938
+ flow: replay?.flow ?? null,
912939
+ replay_crashed: replay?.replayCrashed === true,
912940
+ pipeline_success: pipelineResult.success,
912941
+ pipeline_warnings_count: pipelineResult.warnings?.length ?? 0,
912942
+ replay_warnings_count: replay?.warnings?.length ?? 0,
912943
+ generator_name: generatorName,
912944
+ generator_version: generatorVersion,
912945
+ cli_version: cliVersion ?? null,
912946
+ repo_uri_hash: hashRepoUri(repoUri),
912947
+ automation_mode: automationMode,
912948
+ auto_merge_requested: autoMerge,
912949
+ auto_merge_enabled: github?.autoMergeEnabled === true,
912950
+ skip_if_no_diff: skipIfNoDiff,
912951
+ no_diff_skipped: github?.skippedNoDiff === true,
912952
+ version_arg: versionArg,
912953
+ version_bump: versionBump ?? null,
912954
+ has_breaking_changes: hasBreakingChanges,
912955
+ replay_config_enabled: replayConfigEnabled,
912956
+ no_replay_flag: noReplayFlag,
912957
+ github_mode: githubMode,
912958
+ preview_mode: previewMode,
912959
+ pr_created: github?.prNumber != null,
912960
+ pr_updated_existing: github?.updatedExistingPr === true,
912961
+ duration_ms: durationMs,
912962
+ patches_detected: replay?.patchesDetected ?? 0,
912963
+ patches_applied: replay?.patchesApplied ?? 0,
912964
+ patches_with_conflicts: replay?.patchesWithConflicts ?? 0,
912965
+ patches_absorbed: replay?.patchesAbsorbed ?? 0,
912966
+ patches_repointed: replay?.patchesRepointed ?? 0,
912967
+ patches_content_rebased: replay?.patchesContentRebased ?? 0,
912968
+ patches_kept_as_user_owned: replay?.patchesKeptAsUserOwned ?? 0,
912969
+ unresolved_patches_count: unresolvedPatches.length,
912970
+ unresolved_conflict_files_count: unresolvedConflictFilesCount,
912971
+ conflicts_same_line_edit: conflictBuckets["same-line-edit"],
912972
+ conflicts_new_file_both: conflictBuckets["new-file-both"],
912973
+ conflicts_base_generation_mismatch: conflictBuckets["base-generation-mismatch"],
912974
+ conflicts_patch_apply_failed: conflictBuckets["patch-apply-failed"],
912975
+ conflicts_other: conflictBuckets.other
912976
+ };
912977
+ }
912978
+ function hashRepoUri(uri) {
912979
+ return (0, import_crypto9.createHash)("sha256").update(uri).digest("hex").slice(0, 16);
912980
+ }
912981
+
912763
912982
  // ../generation/local-generation/local-workspace-runner/lib/getGeneratorOutputSubfolder.js
912764
912983
  function getGeneratorOutputSubfolder(generatorName) {
912765
912984
  const baseName = generatorName.split("/").pop() || "sdk";
@@ -913011,14 +913230,48 @@ generators:
913011
913230
  },
913012
913231
  generatorName: generatorInvocation.name
913013
913232
  }, pipelineLogger);
913233
+ const pipelineStart = Date.now();
913014
913234
  const pipelineResult = await pipeline6.run();
913235
+ const pipelineDurationMs = Date.now() - pipelineStart;
913015
913236
  if (pipelineResult.steps.replay != null) {
913016
913237
  (0, import_pipeline.logReplaySummary)(pipelineResult.steps.replay, {
913017
913238
  debug: (msg) => interactiveTaskContext.logger.debug(msg),
913018
- info: (msg) => interactiveTaskContext.logger.info(source_default.cyan(msg)),
913239
+ info: (msg) => {
913240
+ const isStructured = msg.startsWith("[replay] ") || msg.startsWith("[telemetry] ");
913241
+ interactiveTaskContext.logger.info(isStructured ? msg : source_default.cyan(msg));
913242
+ },
913019
913243
  warn: (msg) => interactiveTaskContext.logger.warn(source_default.yellow(msg)),
913020
913244
  error: (msg) => interactiveTaskContext.logger.error(source_default.red(msg))
913021
913245
  });
913246
+ if (!disableTelemetry) {
913247
+ try {
913248
+ const replayTelemetryProps = buildReplayTelemetryProps({
913249
+ pipelineResult,
913250
+ generatorName: generatorInvocation.name,
913251
+ generatorVersion: generatorInvocation.version,
913252
+ cliVersion: workspace.cliVersion,
913253
+ repoUri: selfhostedGithubConfig.uri,
913254
+ automationMode: automationMode === true,
913255
+ autoMerge: autoMerge === true,
913256
+ skipIfNoDiff: skipIfNoDiff === true,
913257
+ hasBreakingChanges,
913258
+ versionArg: version7 == null ? "none" : (0, import_autoversion3.isAutoVersion)(version7) ? "auto" : "explicit",
913259
+ versionBump: autoVersioningVersionBump,
913260
+ replayConfigEnabled: replay?.enabled === true,
913261
+ noReplayFlag: noReplay === true,
913262
+ githubMode: selfhostedGithubConfig.mode ?? "push",
913263
+ previewMode: selfhostedGithubConfig.previewMode === true,
913264
+ durationMs: pipelineDurationMs
913265
+ });
913266
+ interactiveTaskContext.instrumentPostHogEvent({
913267
+ command: "replay",
913268
+ properties: replayTelemetryProps
913269
+ });
913270
+ interactiveTaskContext.logger.debug(`[telemetry] replay event sent: ${JSON.stringify(replayTelemetryProps)}`);
913271
+ } catch (error50) {
913272
+ interactiveTaskContext.logger.debug(`[telemetry] failed to send replay event: ${String(error50)}`);
913273
+ }
913274
+ }
913022
913275
  }
913023
913276
  if (pipelineResult.steps.github?.skippedNoDiff) {
913024
913277
  interactiveTaskContext.logger.info(source_default.green("No changes detected \u2014 skipping PR creation"));
@@ -934690,7 +934943,7 @@ var CliContext = class _CliContext {
934690
934943
  if (false) {
934691
934944
  this.logger.error("CLI_VERSION is not defined");
934692
934945
  }
934693
- return "5.9.0";
934946
+ return "5.10.0";
934694
934947
  }
934695
934948
  getCliName() {
934696
934949
  if (false) {
@@ -947960,7 +948213,7 @@ var import_path94 = __toESM(require("path"), 1);
947960
948213
  // src/commands/docs-theme/ThemeConfigProcessor.ts
947961
948214
  init_lib6();
947962
948215
  var import_child_process12 = require("child_process");
947963
- var import_crypto9 = require("crypto");
948216
+ var import_crypto10 = require("crypto");
947964
948217
  var import_promises178 = require("fs/promises");
947965
948218
  var import_mime_types2 = __toESM(require_mime_types(), 1);
947966
948219
  var import_path93 = __toESM(require("path"), 1);
@@ -948176,7 +948429,7 @@ ${errors4.map((e8) => ` - ${e8}`).join("\n")}`,
948176
948429
  return this.uploadToCas(content5, contentType, bindPath, import_path93.default.basename(absolutePath));
948177
948430
  }
948178
948431
  async uploadToCas(content5, contentType, bindPath, label) {
948179
- const hash5 = (0, import_crypto9.createHash)("sha256").update(content5).digest("hex");
948432
+ const hash5 = (0, import_crypto10.createHash)("sha256").update(content5).digest("hex");
948180
948433
  const casUrl = `${FDR_ORIGIN}/v2/registry/content/${hash5}?orgId=${encodeURIComponent(this.orgId)}`;
948181
948434
  this.context.logger.debug(` CAS check: PUT ${casUrl} (${contentType}, ${content5.byteLength} bytes)`);
948182
948435
  let checkRes;
@@ -952048,7 +952301,7 @@ function computePreviewVersion({ previewId }) {
952048
952301
 
952049
952302
  // src/commands/sdk-preview/getPreviewId.ts
952050
952303
  var import_child_process14 = require("child_process");
952051
- var import_crypto10 = require("crypto");
952304
+ var import_crypto11 = require("crypto");
952052
952305
  var import_util71 = require("util");
952053
952306
  var execAsync2 = (0, import_util71.promisify)(import_child_process14.exec);
952054
952307
  var MAX_PREVIEW_ID_LENGTH = 40;
@@ -952072,7 +952325,7 @@ function sanitizeBranchName(branch) {
952072
952325
  return branch.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, MAX_PREVIEW_ID_LENGTH).replace(/-$/, "");
952073
952326
  }
952074
952327
  function generateRandomId() {
952075
- return (0, import_crypto10.randomBytes)(4).toString("hex");
952328
+ return (0, import_crypto11.randomBytes)(4).toString("hex");
952076
952329
  }
952077
952330
 
952078
952331
  // src/commands/sdk-preview/toPreviewPackageName.ts
@@ -954384,12 +954637,12 @@ async function collectFiles(baseDirectory, relativeBase) {
954384
954637
  }
954385
954638
 
954386
954639
  // src/commands/write-translation/hash-utils.ts
954387
- var import_crypto11 = require("crypto");
954640
+ var import_crypto12 = require("crypto");
954388
954641
  var import_fs42 = require("fs");
954389
954642
  var import_promises195 = require("fs/promises");
954390
954643
  var import_path105 = __toESM(require("path"), 1);
954391
954644
  function calculateContentHash(content5) {
954392
- return (0, import_crypto11.createHash)("sha256").update(content5, "utf-8").digest("hex");
954645
+ return (0, import_crypto12.createHash)("sha256").update(content5, "utf-8").digest("hex");
954393
954646
  }
954394
954647
  async function loadHashMappings(translationsDirectory) {
954395
954648
  const hashesFilePath = import_path105.default.join(translationsDirectory, "hashes");
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.9.0",
2
+ "version": "5.10.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",