@fern-api/fern-api-dev 4.81.0-12-gda1eb9c3fad → 4.81.0-14-gacd656850ac

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 +151 -52
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -469477,6 +469477,7 @@ var CliError = class _CliError extends Error {
469477
469477
  NetworkError: "NETWORK_ERROR",
469478
469478
  AuthError: "AUTH_ERROR",
469479
469479
  ConfigError: "CONFIG_ERROR",
469480
+ UserError: "USER_ERROR",
469480
469481
  Unclassified: "UNCLASSIFIED"
469481
469482
  };
469482
469483
  })(CliError || (CliError = {}));
@@ -469493,6 +469494,7 @@ var SENTRY_REPORTABLE = {
469493
469494
  [CliError.Code.NetworkError]: false,
469494
469495
  [CliError.Code.AuthError]: false,
469495
469496
  [CliError.Code.ConfigError]: false,
469497
+ [CliError.Code.UserError]: false,
469496
469498
  [CliError.Code.Unclassified]: false
469497
469499
  };
469498
469500
  function shouldReportToSentry(code5) {
@@ -614666,7 +614668,7 @@ var AccessTokenPosthogManager = class {
614666
614668
  properties: {
614667
614669
  ...event,
614668
614670
  ...event.properties,
614669
- version: "4.81.0-12-gda1eb9c3fad",
614671
+ version: "4.81.0-14-gacd656850ac",
614670
614672
  usingAccessToken: true
614671
614673
  }
614672
614674
  });
@@ -614720,7 +614722,7 @@ var UserPosthogManager = class {
614720
614722
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
614721
614723
  event: "CLI",
614722
614724
  properties: {
614723
- version: "4.81.0-12-gda1eb9c3fad",
614725
+ version: "4.81.0-14-gacd656850ac",
614724
614726
  ...event,
614725
614727
  ...event.properties,
614726
614728
  usingAccessToken: false,
@@ -788548,7 +788550,10 @@ var LambdaExampleEnhancer = class {
788548
788550
  this.context = context3;
788549
788551
  const lambdaOrigin = "https://ykq45y6fvnszd35iv5yuuatkze0rpwuz.lambda-url.us-east-1.on.aws";
788550
788552
  if (!lambdaOrigin) {
788551
- throw new Error("DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.");
788553
+ throw new CliError({
788554
+ message: "DEFAULT_FDR_LAMBDA_DOCS_ORIGIN environment variable is not set. AI example enhancement requires this to be configured.",
788555
+ code: CliError.Code.EnvironmentError
788556
+ });
788552
788557
  }
788553
788558
  this.lambdaOrigin = lambdaOrigin;
788554
788559
  this.venusOrigin = "https://venus-dev2.buildwithfern.com";
@@ -788617,7 +788622,10 @@ var LambdaExampleEnhancer = class {
788617
788622
  });
788618
788623
  if (!response.ok) {
788619
788624
  const errorText = await response.text();
788620
- throw new Error(`Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`);
788625
+ throw new CliError({
788626
+ message: `Failed to fetch JWT from Venus: ${response.status} ${errorText || response.statusText}`,
788627
+ code: CliError.Code.NetworkError
788628
+ });
788621
788629
  }
788622
788630
  const result = await response.json();
788623
788631
  this.context.logger.debug(`Successfully obtained JWT from Venus (expires at ${result.expiresAt})`);
@@ -788679,7 +788687,10 @@ var LambdaExampleEnhancer = class {
788679
788687
  });
788680
788688
  if (!response.ok) {
788681
788689
  const errorText = await response.text();
788682
- throw new Error(`Lambda returned ${response.status}: ${errorText || response.statusText}`);
788690
+ throw new CliError({
788691
+ message: `Lambda returned ${response.status}: ${errorText || response.statusText}`,
788692
+ code: CliError.Code.NetworkError
788693
+ });
788683
788694
  }
788684
788695
  const result = await response.json();
788685
788696
  return {
@@ -790192,7 +790203,10 @@ function convertTypeShape(irType) {
790192
790203
  extraProperties: void 0
790193
790204
  }),
790194
790205
  _other: () => {
790195
- throw new Error("Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType);
790206
+ throw new CliError({
790207
+ message: "Unknown SingleUnionTypeProperties: " + variant.shape.propertiesType,
790208
+ code: CliError.Code.InternalError
790209
+ });
790196
790210
  }
790197
790211
  })
790198
790212
  };
@@ -790217,7 +790231,7 @@ function convertTypeShape(irType) {
790217
790231
  };
790218
790232
  },
790219
790233
  _other: () => {
790220
- throw new Error("Unknown Type shape: " + irType.type);
790234
+ throw new CliError({ message: "Unknown Type shape: " + irType.type, code: CliError.Code.InternalError });
790221
790235
  }
790222
790236
  });
790223
790237
  }
@@ -790284,12 +790298,18 @@ function convertTypeReference3(irTypeReference) {
790284
790298
  };
790285
790299
  },
790286
790300
  _other: () => {
790287
- throw new Error("Unknown literal type: " + literal3.type);
790301
+ throw new CliError({
790302
+ message: "Unknown literal type: " + literal3.type,
790303
+ code: CliError.Code.InternalError
790304
+ });
790288
790305
  }
790289
790306
  });
790290
790307
  },
790291
790308
  _other: () => {
790292
- throw new Error("Unknown container reference: " + container.type);
790309
+ throw new CliError({
790310
+ message: "Unknown container reference: " + container.type,
790311
+ code: CliError.Code.InternalError
790312
+ });
790293
790313
  }
790294
790314
  });
790295
790315
  },
@@ -790369,7 +790389,10 @@ function convertTypeReference3(irTypeReference) {
790369
790389
  };
790370
790390
  },
790371
790391
  _other: () => {
790372
- throw new Error("Unknown primitive: " + primitive.v1);
790392
+ throw new CliError({
790393
+ message: "Unknown primitive: " + primitive.v1,
790394
+ code: CliError.Code.InternalError
790395
+ });
790373
790396
  }
790374
790397
  })
790375
790398
  };
@@ -790380,7 +790403,10 @@ function convertTypeReference3(irTypeReference) {
790380
790403
  };
790381
790404
  },
790382
790405
  _other: () => {
790383
- throw new Error("Unknown Type reference: " + irTypeReference.type);
790406
+ throw new CliError({
790407
+ message: "Unknown Type reference: " + irTypeReference.type,
790408
+ code: CliError.Code.InternalError
790409
+ });
790384
790410
  }
790385
790411
  });
790386
790412
  }
@@ -790844,7 +790870,10 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
790844
790870
  return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
790845
790871
  const endpointBaseUrl = singleBaseUrlEnvironment.urls[baseUrlId];
790846
790872
  if (endpointBaseUrl == null) {
790847
- throw new Error(`Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`);
790873
+ throw new CliError({
790874
+ message: `Encountered undefined server name "${baseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${baseUrlId}`,
790875
+ code: CliError.Code.IrConversionError
790876
+ });
790848
790877
  }
790849
790878
  return {
790850
790879
  id: FdrAPI_exports.EnvironmentId(baseUrlId),
@@ -790856,12 +790885,18 @@ function convertIrEnvironments({ environmentsConfig, endpoint: endpoint3 }) {
790856
790885
  return environments2.filter((environment2, index3, self2) => index3 === self2.findIndex((t3) => t3.id === environment2.id && t3.baseUrl === environment2.baseUrl));
790857
790886
  }
790858
790887
  if (endpointBaseUrlId == null) {
790859
- throw new Error(`Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`);
790888
+ throw new CliError({
790889
+ message: `Expected endpoint ${getOriginalName(endpoint3.name)} to have base url.`,
790890
+ code: CliError.Code.IrConversionError
790891
+ });
790860
790892
  }
790861
790893
  return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
790862
790894
  const endpointBaseUrl = singleBaseUrlEnvironment.urls[endpointBaseUrlId];
790863
790895
  if (endpointBaseUrl == null) {
790864
- throw new Error(`Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`);
790896
+ throw new CliError({
790897
+ message: `Encountered undefined server name "${endpointBaseUrlId}" at endpoint ${endpoint3.method.toUpperCase()} ${endpoint3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${endpointBaseUrlId}`,
790898
+ code: CliError.Code.IrConversionError
790899
+ });
790865
790900
  }
790866
790901
  return {
790867
790902
  id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
@@ -790887,12 +790922,18 @@ function convertIrWebSocketEnvironments({ environmentsConfig, channel: channel3
790887
790922
  });
790888
790923
  case "multipleBaseUrls":
790889
790924
  if (channelBaseUrlId == null) {
790890
- throw new Error(`Expected channel ${getOriginalName(channel3.name)} to have base url.`);
790925
+ throw new CliError({
790926
+ message: `Expected channel ${getOriginalName(channel3.name)} to have base url.`,
790927
+ code: CliError.Code.IrConversionError
790928
+ });
790891
790929
  }
790892
790930
  return environmentsConfigValue.environments.map((singleBaseUrlEnvironment) => {
790893
790931
  const channelBaseUrl = singleBaseUrlEnvironment.urls[channelBaseUrlId];
790894
790932
  if (channelBaseUrl == null) {
790895
- throw new Error(`Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`);
790933
+ throw new CliError({
790934
+ message: `Encountered undefined server name ${channelBaseUrl} at channel ${getOriginalName(channel3.name)} ${channel3.path.head}. Expected environment ${singleBaseUrlEnvironment.id} to contain url for ${channelBaseUrlId}`,
790935
+ code: CliError.Code.IrConversionError
790936
+ });
790896
790937
  }
790897
790938
  return {
790898
790939
  id: FdrAPI_exports.EnvironmentId(singleBaseUrlEnvironment.id),
@@ -790916,7 +790957,7 @@ function convertHttpMethod2(method8) {
790916
790957
  delete: () => FdrAPI_exports.HttpMethod.Delete,
790917
790958
  head: () => FdrAPI_exports.HttpMethod.Head,
790918
790959
  _other: () => {
790919
- throw new Error("Unknown http method: " + method8);
790960
+ throw new CliError({ message: "Unknown http method: " + method8, code: CliError.Code.InternalError });
790920
790961
  }
790921
790962
  });
790922
790963
  }
@@ -791032,7 +791073,10 @@ function convertRequestBody3(irRequest) {
791032
791073
  contentType: bytes.contentType
791033
791074
  }),
791034
791075
  _other: () => {
791035
- throw new Error("Unknown HttpRequestBody: " + irRequest.type);
791076
+ throw new CliError({
791077
+ message: "Unknown HttpRequestBody: " + irRequest.type,
791078
+ code: CliError.Code.InternalError
791079
+ });
791036
791080
  }
791037
791081
  });
791038
791082
  return requestBodyShape != null ? { type: requestBodyShape, description: irRequest.docs } : void 0;
@@ -791086,7 +791130,10 @@ function convertResponse2(irResponse) {
791086
791130
  return void 0;
791087
791131
  },
791088
791132
  _other: () => {
791089
- throw new Error("Unknown HttpResponse: " + irResponse.body);
791133
+ throw new CliError({
791134
+ message: "Unknown HttpResponse: " + irResponse.body,
791135
+ code: CliError.Code.InternalError
791136
+ });
791090
791137
  }
791091
791138
  });
791092
791139
  }
@@ -791326,7 +791373,10 @@ function convertV2HttpEndpointExample({ shouldUseExampleName, exampleName, examp
791326
791373
  return void 0;
791327
791374
  },
791328
791375
  _other: () => {
791329
- throw new Error("Unknown ExampleResponseBody: " + example.response?.body?.type);
791376
+ throw new CliError({
791377
+ message: "Unknown ExampleResponseBody: " + example.response?.body?.type,
791378
+ code: CliError.Code.InternalError
791379
+ });
791330
791380
  }
791331
791381
  }) : void 0,
791332
791382
  codeSamples: example.codeSamples?.map((codeSample) => ({
@@ -791452,18 +791502,27 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
791452
791502
  stream: (stream5) => stream5.length > 0 ? 200 : 204,
791453
791503
  sse: (stream5) => stream5.length > 0 ? 200 : 204,
791454
791504
  _other: () => {
791455
- throw new Error("Unknown ExampleResponseBody: " + ok3.type);
791505
+ throw new CliError({
791506
+ message: "Unknown ExampleResponseBody: " + ok3.type,
791507
+ code: CliError.Code.InternalError
791508
+ });
791456
791509
  }
791457
791510
  }),
791458
791511
  error: ({ error: errorName }) => {
791459
791512
  const error50 = ir10.errors[errorName.errorId];
791460
791513
  if (error50 == null) {
791461
- throw new Error("Cannot find error " + errorName.errorId);
791514
+ throw new CliError({
791515
+ message: "Cannot find error " + errorName.errorId,
791516
+ code: CliError.Code.ResolutionError
791517
+ });
791462
791518
  }
791463
791519
  return error50.statusCode;
791464
791520
  },
791465
791521
  _other: () => {
791466
- throw new Error("Unknown ExampleResponse: " + example.response.type);
791522
+ throw new CliError({
791523
+ message: "Unknown ExampleResponse: " + example.response.type,
791524
+ code: CliError.Code.InternalError
791525
+ });
791467
791526
  }
791468
791527
  }),
791469
791528
  responseBody: example.response._visit({
@@ -791485,12 +791544,18 @@ function convertHttpEndpointExample({ userSpecifiedExample, autogeneratedExample
791485
791544
  value: sse.map(({ event, data: data2 }) => ({ event, data: data2.jsonExample }))
791486
791545
  }),
791487
791546
  _other: () => {
791488
- throw new Error("Unknown ExampleResponseBody: " + ok3.type);
791547
+ throw new CliError({
791548
+ message: "Unknown ExampleResponseBody: " + ok3.type,
791549
+ code: CliError.Code.InternalError
791550
+ });
791489
791551
  }
791490
791552
  }),
791491
791553
  error: (error50) => error50.body != null ? { type: "json", value: error50.body.jsonExample } : void 0,
791492
791554
  _other: () => {
791493
- throw new Error("Unknown ExampleResponse: " + example.response.type);
791555
+ throw new CliError({
791556
+ message: "Unknown ExampleResponse: " + example.response.type,
791557
+ code: CliError.Code.InternalError
791558
+ });
791494
791559
  }
791495
791560
  }),
791496
791561
  // irExample.response.body != null ? { type: "json", value: irExample.response.body.jsonExample } : undefined,
@@ -791783,7 +791848,9 @@ async function registerApi({ organization, workspace, context: context3, token,
791783
791848
  context3.logger.debug(`Registered API Definition ${response.apiDefinitionId}`);
791784
791849
  return { id: response.apiDefinitionId, ir: ir10 };
791785
791850
  } catch (error50) {
791786
- return context3.failAndThrow("Failed to register API", error50);
791851
+ return context3.failAndThrow("Failed to register API", error50, {
791852
+ code: CliError.Code.NetworkError
791853
+ });
791787
791854
  }
791788
791855
  }
791789
791856
 
@@ -832071,7 +832138,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832071
832138
  var LOGS_FOLDER_NAME = "logs";
832072
832139
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832073
832140
  function getCliSource() {
832074
- const version7 = "4.81.0-12-gda1eb9c3fad";
832141
+ const version7 = "4.81.0-14-gacd656850ac";
832075
832142
  return `cli@${version7}`;
832076
832143
  }
832077
832144
  var DebugLogger = class {
@@ -843638,7 +843705,7 @@ var LegacyDocsPublisher = class {
843638
843705
  previewId,
843639
843706
  disableTemplates: void 0,
843640
843707
  skipUpload,
843641
- cliVersion: "4.81.0-12-gda1eb9c3fad"
843708
+ cliVersion: "4.81.0-14-gacd656850ac"
843642
843709
  });
843643
843710
  if (taskContext.getResult() === TaskResult.Failure) {
843644
843711
  return { success: false };
@@ -873579,7 +873646,7 @@ var DynamicSnippetsJavaTestGenerator = class {
873579
873646
  }
873580
873647
  }
873581
873648
  } catch (e5) {
873582
- this.context.failAndThrow("Failed to run spotlessApply", e5);
873649
+ this.context.failAndThrow("Failed to run spotlessApply", e5, { code: CliError.Code.InternalError });
873583
873650
  }
873584
873651
  }
873585
873652
  this.context.logger.debug("Done generating dynamic snippet tests");
@@ -895156,11 +895223,17 @@ var DynamicSnippetsTypeScriptTestGenerator = class {
895156
895223
  buildGeneratorConfig(config5) {
895157
895224
  const outputMode = config5.output.mode;
895158
895225
  if (outputMode.type !== "github") {
895159
- throw new Error("GitHub output mode is required for TypeScript dynamic snippet tests");
895226
+ throw new CliError({
895227
+ message: "GitHub output mode is required for TypeScript dynamic snippet tests",
895228
+ code: CliError.Code.ConfigError
895229
+ });
895160
895230
  }
895161
895231
  const publishInfo = outputMode.publishInfo;
895162
895232
  if (!publishInfo || publishInfo.type !== "npm") {
895163
- throw new Error("NPM publish info is required for TypeScript dynamic snippet tests");
895233
+ throw new CliError({
895234
+ message: "NPM publish info is required for TypeScript dynamic snippet tests",
895235
+ code: CliError.Code.ConfigError
895236
+ });
895164
895237
  }
895165
895238
  return {
895166
895239
  ...config5,
@@ -895214,7 +895287,10 @@ var DynamicSnippetsTestGenerator = class _DynamicSnippetsTestGenerator {
895214
895287
  // ../generation/local-generation/local-workspace-runner/lib/dynamic-snippets/generateDynamicSnippetsTestSuite.js
895215
895288
  async function generateDynamicSnippetsTestSuite({ ir: ir10, config: config5 }) {
895216
895289
  if (ir10.dynamic == null) {
895217
- throw new Error("Internal error; dynamic IR is not available");
895290
+ throw new CliError({
895291
+ message: "Internal error; dynamic IR is not available",
895292
+ code: CliError.Code.InternalError
895293
+ });
895218
895294
  }
895219
895295
  return {
895220
895296
  ir: ir10.dynamic,
@@ -895410,7 +895486,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
895410
895486
  push: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
895411
895487
  pullRequest: (value3) => `https://github.com/${value3.owner}/${value3.repo}`,
895412
895488
  _other: () => {
895413
- throw new Error("Encountered unknown github mode");
895489
+ throw new CliError({
895490
+ message: "Encountered unknown github mode",
895491
+ code: CliError.Code.InternalError
895492
+ });
895414
895493
  }
895415
895494
  });
895416
895495
  const outputConfig = {
@@ -895431,7 +895510,10 @@ function getGeneratorConfig({ generatorInvocation, customConfig, workspaceName,
895431
895510
  return outputConfig;
895432
895511
  },
895433
895512
  _other: () => {
895434
- throw new Error("Output type did not match any of the types supported by Fern");
895513
+ throw new CliError({
895514
+ message: "Output type did not match any of the types supported by Fern",
895515
+ code: CliError.Code.InternalError
895516
+ });
895435
895517
  }
895436
895518
  });
895437
895519
  return {
@@ -896305,7 +896387,10 @@ var LocalTaskHandler = class {
896305
896387
  return null;
896306
896388
  }
896307
896389
  if (!this.version) {
896308
- throw new Error("Version is required for auto versioning");
896390
+ throw new CliError({
896391
+ message: "Version is required for auto versioning",
896392
+ code: CliError.Code.InternalError
896393
+ });
896309
896394
  }
896310
896395
  let previousVersion;
896311
896396
  try {
@@ -896493,7 +896578,10 @@ var LocalTaskHandler = class {
896493
896578
  };
896494
896579
  }
896495
896580
  this.context.logger.error(`Failed to perform automatic versioning: ${error50}`);
896496
- throw new Error(`Automatic versioning failed: ${error50}`);
896581
+ throw new CliError({
896582
+ message: `Automatic versioning failed: ${error50}`,
896583
+ code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError
896584
+ });
896497
896585
  } finally {
896498
896586
  if (diffFile) {
896499
896587
  try {
@@ -896546,7 +896634,7 @@ var LocalTaskHandler = class {
896546
896634
  incrementVersion(version7, versionBump) {
896547
896635
  const cleanVersion = import_semver13.default.clean(version7);
896548
896636
  if (!cleanVersion) {
896549
- throw new Error(`Invalid version format: ${version7}`);
896637
+ throw new CliError({ message: `Invalid version format: ${version7}`, code: CliError.Code.VersionError });
896550
896638
  }
896551
896639
  let releaseType;
896552
896640
  switch (versionBump) {
@@ -896560,11 +896648,17 @@ var LocalTaskHandler = class {
896560
896648
  releaseType = "patch";
896561
896649
  break;
896562
896650
  default:
896563
- throw new Error(`Unsupported version bump: ${versionBump}`);
896651
+ throw new CliError({
896652
+ message: `Unsupported version bump: ${versionBump}`,
896653
+ code: CliError.Code.VersionError
896654
+ });
896564
896655
  }
896565
896656
  const newVersion = import_semver13.default.inc(cleanVersion, releaseType);
896566
896657
  if (!newVersion) {
896567
- throw new Error(`Failed to increment version: ${version7}`);
896658
+ throw new CliError({
896659
+ message: `Failed to increment version: ${version7}`,
896660
+ code: CliError.Code.VersionError
896661
+ });
896568
896662
  }
896569
896663
  return version7.startsWith("v") ? `v${newVersion}` : newVersion;
896570
896664
  }
@@ -896624,7 +896718,10 @@ var LocalTaskHandler = class {
896624
896718
  */
896625
896719
  async getClientRegistry() {
896626
896720
  if (this.ai == null) {
896627
- throw new Error("No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.");
896721
+ throw new CliError({
896722
+ message: "No AI service configuration found in generators.yml. Please add an 'ai' section with provider and model.",
896723
+ code: CliError.Code.ConfigError
896724
+ });
896628
896725
  }
896629
896726
  this.context.logger.debug(`Using AI service: ${this.ai.provider} with model ${this.ai.model}`);
896630
896727
  return configureBamlClient(this.ai);
@@ -897057,7 +897154,9 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
897057
897154
  const substituteEnvVars = (stringOrObject) => replaceEnvVariables(stringOrObject, {
897058
897155
  onError: (e5) => {
897059
897156
  if (!isPreview && (requireEnvVars ?? true)) {
897060
- interactiveTaskContext.failAndThrow(e5);
897157
+ interactiveTaskContext.failAndThrow(e5, void 0, {
897158
+ code: CliError.Code.EnvironmentError
897159
+ });
897061
897160
  }
897062
897161
  }
897063
897162
  }, { substituteAsEmpty: isPreview });
@@ -897110,13 +897209,13 @@ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace,
897110
897209
  if (generatorInvocation.absolutePathToLocalOutput == null) {
897111
897210
  token ??= await getAccessToken();
897112
897211
  if (token == null) {
897113
- interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");
897212
+ interactiveTaskContext.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.", void 0, { code: CliError.Code.AuthError });
897114
897213
  return;
897115
897214
  }
897116
897215
  }
897117
897216
  const organization = await venus.organization.get(projectConfig.organization);
897118
897217
  if (generatorInvocation.absolutePathToLocalOutput == null && !organization.ok) {
897119
- interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`);
897218
+ interactiveTaskContext.failWithoutThrowing(`Failed to load details for organization ${projectConfig.organization}.`, void 0, { code: CliError.Code.NetworkError });
897120
897219
  return;
897121
897220
  }
897122
897221
  if (organization.ok) {
@@ -897152,7 +897251,7 @@ generators:
897152
897251
  uri: your-org/your-sdk-repo
897153
897252
  token: \${GITHUB_TOKEN}
897154
897253
  mode: pull-request
897155
- `);
897254
+ `, void 0, { code: CliError.Code.ConfigError });
897156
897255
  }
897157
897256
  }
897158
897257
  if (selfhostedGithubConfig != null) {
@@ -897186,13 +897285,13 @@ generators:
897186
897285
  const branchExists = await repo.remoteBranchExists(selfhostedGithubConfig.branch);
897187
897286
  if (!branchExists) {
897188
897287
  const parsedRepo = parseRepository(selfhostedGithubConfig.uri);
897189
- interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`);
897288
+ interactiveTaskContext.failAndThrow(`Branch ${selfhostedGithubConfig.branch} does not exist in repository ${parsedRepo.owner}/${parsedRepo.repo}`, void 0, { code: CliError.Code.ConfigError });
897190
897289
  }
897191
897290
  }
897192
897291
  await repo.checkoutRemoteBranch(selfhostedGithubConfig.branch);
897193
897292
  }
897194
897293
  } catch (error50) {
897195
- interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`);
897294
+ interactiveTaskContext.failAndThrow(`Failed to clone GitHub repository ${selfhostedGithubConfig.uri}: ${extractErrorMessage(error50)}`, void 0, { code: CliError.Code.NetworkError });
897196
897295
  }
897197
897296
  }
897198
897297
  let absolutePathToLocalSnippetJSON = void 0;
@@ -897289,13 +897388,13 @@ generators:
897289
897388
  interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
897290
897389
  }
897291
897390
  if (!pipelineResult.success) {
897292
- interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`);
897391
+ interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`, void 0, { code: CliError.Code.UserError });
897293
897392
  }
897294
897393
  }
897295
897394
  });
897296
897395
  }));
897297
897396
  if (results.some((didSucceed) => !didSucceed)) {
897298
- context3.failAndThrow();
897397
+ throw new TaskAbortSignal();
897299
897398
  }
897300
897399
  }
897301
897400
  function resolveAbsolutePathToLocalPreview(absolutePathToPreview, generatorInvocation) {
@@ -897498,7 +897597,7 @@ var GenerationRunner = class {
897498
897597
  const results = await Promise.all(generatorGroup.generators.map(async (generatorInvocation) => {
897499
897598
  return context3.runInteractiveTask({ name: generatorInvocation.name }, async (interactiveTaskContext) => {
897500
897599
  if (generatorInvocation.absolutePathToLocalOutput == null) {
897501
- interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system");
897600
+ interactiveTaskContext.failWithoutThrowing("Cannot generate because output location is not local-file-system", void 0, { code: CliError.Code.ConfigError });
897502
897601
  return;
897503
897602
  }
897504
897603
  try {
@@ -897532,7 +897631,7 @@ var GenerationRunner = class {
897532
897631
  } catch (error50) {
897533
897632
  if (error50 instanceof TaskAbortSignal) {
897534
897633
  } else {
897535
- interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50);
897634
+ interactiveTaskContext.failWithoutThrowing(`Generation failed: ${error50 instanceof Error ? error50.message : "Unknown error"}`, error50, { code: error50 instanceof CliError ? error50.code : CliError.Code.InternalError });
897536
897635
  }
897537
897636
  }
897538
897637
  });
@@ -897541,7 +897640,7 @@ var GenerationRunner = class {
897541
897640
  async executeGenerator({ generatorGroup, generatorInvocation, context: context3, workspace, organization, irVersionOverride, outputVersionOverride, absolutePathToFernConfig, inspect: inspect6, skipFernignore, skipAutogenerationIfManualExamplesExist }) {
897542
897641
  context3.logger.info(`Starting generation for ${generatorInvocation.name}`);
897543
897642
  if (generatorInvocation.absolutePathToLocalOutput == null) {
897544
- throw new Error("Output path is required for generation");
897643
+ throw new CliError({ message: "Output path is required for generation", code: CliError.Code.ConfigError });
897545
897644
  }
897546
897645
  const rawIr = generateIntermediateRepresentation({
897547
897646
  workspace,
@@ -918837,7 +918936,7 @@ var CliContext = class _CliContext {
918837
918936
  if (false) {
918838
918937
  this.logger.error("CLI_VERSION is not defined");
918839
918938
  }
918840
- return "4.81.0-12-gda1eb9c3fad";
918939
+ return "4.81.0-14-gacd656850ac";
918841
918940
  }
918842
918941
  getCliName() {
918843
918942
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.81.0-12-gda1eb9c3fad",
2
+ "version": "4.81.0-14-gacd656850ac",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",