@fern-api/fern-api-dev 4.65.3-5-gd8cee996921 → 4.66.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 +449 -56
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -58630,6 +58630,24 @@ var init_ClonedRepository = __esm({
58630
58630
  const result = await this.git.raw(["rev-parse", `${commitSha}^{tree}`]);
58631
58631
  return result.trim();
58632
58632
  }
58633
+ /**
58634
+ * Returns true if the working tree has uncommitted changes (staged or unstaged).
58635
+ */
58636
+ async hasChanges() {
58637
+ await this.git.cwd(this.clonePath);
58638
+ const status = await this.git.status();
58639
+ return !status.isClean();
58640
+ }
58641
+ /**
58642
+ * Compares the tree hash of HEAD against a ref (e.g. `origin/main`).
58643
+ * Returns true if the trees are identical (no content difference).
58644
+ * Useful for detecting no-diff after committing — if trees match, the commit is a no-op.
58645
+ */
58646
+ async treeHashEquals(ref2) {
58647
+ const headTree = await this.getHeadTreeHash();
58648
+ const refTree = await this.getCommitTreeHash(ref2);
58649
+ return headTree === refTree;
58650
+ }
58633
58651
  // This tag is a moving pointer (fern-generation-base--<generator>) that tracks the latest
58634
58652
  // clean generation SHA. --force is required because: (1) the tag is intentionally overwritten
58635
58653
  // each generation, and (2) --force-with-lease doesn't work for tags since git tag -f overwrites
@@ -357485,6 +357503,9 @@ var require_GithubStep = __commonJS({
357485
357503
  "use strict";
357486
357504
  Object.defineProperty(exports2, "__esModule", { value: true });
357487
357505
  exports2.GithubStep = void 0;
357506
+ exports2.enrichPrBodyForAutomation = enrichPrBodyForAutomation;
357507
+ exports2.shouldEnableAutomerge = shouldEnableAutomerge;
357508
+ exports2.resolveBranchAction = resolveBranchAction;
357488
357509
  var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
357489
357510
  var github_1 = (init_lib7(), __toCommonJS(lib_exports3));
357490
357511
  var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
@@ -357541,26 +357562,39 @@ var require_GithubStep = __commonJS({
357541
357562
  const baseBranch = this.config.branch ?? await repository.getDefaultBranch();
357542
357563
  const octokit = new rest_1.Octokit({ auth: this.config.token });
357543
357564
  const { owner, repo } = (0, github_1.parseRepository)(this.config.uri);
357544
- const existingPR = await (0, findExistingUpdatablePR_1.findExistingUpdatablePR)(octokit, owner, repo, baseBranch, this.logger);
357545
357565
  let prBranch;
357546
357566
  let isUpdatingExistingPR = false;
357547
357567
  let generationBaseSha;
357568
+ let existingPR;
357569
+ if (!this.config.automationMode) {
357570
+ existingPR = await (0, findExistingUpdatablePR_1.findExistingUpdatablePR)(octokit, owner, repo, baseBranch, this.logger);
357571
+ }
357548
357572
  if (existingPR != null) {
357549
357573
  this.logger.info(`Found existing updatable PR #${existingPR.number}, will update branch ${existingPR.headBranch}`);
357550
357574
  prBranch = existingPR.headBranch;
357551
357575
  isUpdatingExistingPR = true;
357552
- if (skipCommit) {
357553
- generationBaseSha = await (0, createReplayBranch_1.createReplayBranch)(repository, prBranch, this.config.commitMessage, replayConflictInfo, this.logger);
357554
- } else {
357555
- await repository.checkoutRemoteBranch(prBranch);
357556
- }
357557
357576
  } else {
357558
- this.logger.debug(`No existing updatable PR found, creating new branch ${newPrBranch}`);
357577
+ this.logger.debug(this.config.automationMode ? `Automation mode: creating new branch ${newPrBranch}` : `No existing updatable PR found, creating new branch ${newPrBranch}`);
357559
357578
  prBranch = newPrBranch;
357560
- if (skipCommit) {
357579
+ }
357580
+ const branchAction = resolveBranchAction({
357581
+ automationMode: this.config.automationMode === true,
357582
+ skipCommit,
357583
+ existingPR
357584
+ });
357585
+ switch (branchAction) {
357586
+ case "replay-branch":
357561
357587
  generationBaseSha = await (0, createReplayBranch_1.createReplayBranch)(repository, prBranch, this.config.commitMessage, replayConflictInfo, this.logger);
357562
- } else {
357563
- await repository.checkout(prBranch);
357588
+ break;
357589
+ case "create-from-head":
357590
+ await repository.createBranchFromHead(prBranch);
357591
+ break;
357592
+ case "checkout-remote":
357593
+ await repository.checkoutRemoteBranch(prBranch);
357594
+ break;
357595
+ default: {
357596
+ const _exhaustive = branchAction;
357597
+ throw new Error(`Unexpected branch action: ${String(_exhaustive)}`);
357564
357598
  }
357565
357599
  }
357566
357600
  if (!skipCommit) {
@@ -357570,6 +357604,13 @@ var require_GithubStep = __commonJS({
357570
357604
  await repository.commitAllChanges(finalCommitMessage2);
357571
357605
  this.logger.debug(`Committed changes to local copy of GitHub repository at ${this.outputDir}`);
357572
357606
  }
357607
+ if (this.config.automationMode) {
357608
+ const noDiff = await repository.treeHashEquals(`origin/${baseBranch}`);
357609
+ if (noDiff) {
357610
+ this.logger.info("No changes detected after generation \u2014 skipping PR creation");
357611
+ return { executed: true, success: true, skippedNoDiff: true };
357612
+ }
357613
+ }
357573
357614
  const result = {
357574
357615
  executed: true,
357575
357616
  success: true,
@@ -357599,7 +357640,8 @@ var require_GithubStep = __commonJS({
357599
357640
  const finalCommitMessage = this.config.commitMessage ?? "SDK Generation";
357600
357641
  const { prTitle, prBody } = (0, parseCommitMessage_1.parseCommitMessageForPR)(finalCommitMessage, this.config.changelogEntry, this.config.prDescription, this.config.versionBumpReason);
357601
357642
  const replaySection = (0, replay_summary_1.formatReplayPrBody)(replayResult, { branchName: prBranch, repoUri: this.config.uri });
357602
- const enrichedBody = replaySection != null ? prBody + "\n\n---\n\n" + replaySection : prBody;
357643
+ let enrichedBody = replaySection != null ? prBody + "\n\n---\n\n" + replaySection : prBody;
357644
+ enrichedBody = enrichPrBodyForAutomation(enrichedBody, this.config);
357603
357645
  if (isUpdatingExistingPR && existingPR != null) {
357604
357646
  this.logger.info(`Updated existing pull request: ${existingPR.htmlUrl}`);
357605
357647
  result.prUrl = existingPR.htmlUrl;
@@ -357630,6 +357672,20 @@ var require_GithubStep = __commonJS({
357630
357672
  this.logger.info(`Created pull request: ${pullRequest.html_url}`);
357631
357673
  result.prUrl = pullRequest.html_url;
357632
357674
  result.prNumber = pullRequest.number;
357675
+ if (shouldEnableAutomerge(this.config) && pullRequest.node_id) {
357676
+ try {
357677
+ await octokit.graphql(`mutation($pullRequestId: ID!) {
357678
+ enablePullRequestAutoMerge(input: {
357679
+ pullRequestId: $pullRequestId,
357680
+ mergeMethod: SQUASH
357681
+ }) { clientMutationId }
357682
+ }`, { pullRequestId: pullRequest.node_id });
357683
+ this.logger.info(`Enabled automerge on PR #${pullRequest.number}`);
357684
+ result.autoMergeEnabled = true;
357685
+ } catch (autoMergeError) {
357686
+ this.logger.warn(`Could not enable automerge: ${(0, core_utils_1.extractErrorMessage)(autoMergeError)}`);
357687
+ }
357688
+ }
357633
357689
  } catch (error50) {
357634
357690
  const message = (0, core_utils_1.extractErrorMessage)(error50);
357635
357691
  if (message.includes("A pull request already exists for")) {
@@ -357642,6 +357698,7 @@ var require_GithubStep = __commonJS({
357642
357698
  return result;
357643
357699
  }
357644
357700
  async executePushMode(repository) {
357701
+ const baseBranch = this.config.branch ?? await repository.getDefaultBranch();
357645
357702
  if (this.config.branch != null) {
357646
357703
  this.logger.debug(`Checking out branch ${this.config.branch}`);
357647
357704
  await repository.checkout(this.config.branch);
@@ -357651,6 +357708,13 @@ var require_GithubStep = __commonJS({
357651
357708
  const finalCommitMessage = this.config.commitMessage ?? "SDK Generation";
357652
357709
  await repository.commitAllChanges(finalCommitMessage);
357653
357710
  this.logger.debug(`Committed changes to local copy of GitHub repository at ${this.outputDir}`);
357711
+ if (this.config.automationMode) {
357712
+ const noDiff = await repository.treeHashEquals(`origin/${baseBranch}`);
357713
+ if (noDiff) {
357714
+ this.logger.info("No changes detected after generation \u2014 skipping push");
357715
+ return { executed: true, success: true, skippedNoDiff: true };
357716
+ }
357717
+ }
357654
357718
  const result = {
357655
357719
  executed: true,
357656
357720
  success: true
@@ -357696,6 +357760,38 @@ var require_GithubStep = __commonJS({
357696
357760
  }
357697
357761
  };
357698
357762
  exports2.GithubStep = GithubStep;
357763
+ function enrichPrBodyForAutomation(body, config5) {
357764
+ if (!config5.automationMode) {
357765
+ return body;
357766
+ }
357767
+ let result = body;
357768
+ if (config5.hasBreakingChanges && config5.breakingChangesSummary) {
357769
+ result += "\n\n---\n\n## \u26A0\uFE0F Breaking Changes\n\nThis release contains breaking changes that require manual review:\n\n" + config5.breakingChangesSummary;
357770
+ }
357771
+ if (config5.runId) {
357772
+ result += `
357773
+
357774
+ ---
357775
+
357776
+ _Fern Run ID: \`${config5.runId}\`_`;
357777
+ }
357778
+ return result;
357779
+ }
357780
+ function shouldEnableAutomerge(config5) {
357781
+ return config5.automationMode === true && config5.autoMerge === true && config5.hasBreakingChanges !== true;
357782
+ }
357783
+ function resolveBranchAction({ automationMode, skipCommit, existingPR }) {
357784
+ if (skipCommit) {
357785
+ return "replay-branch";
357786
+ }
357787
+ if (automationMode) {
357788
+ return "create-from-head";
357789
+ }
357790
+ if (existingPR != null) {
357791
+ return "checkout-remote";
357792
+ }
357793
+ return "create-from-head";
357794
+ }
357699
357795
  }
357700
357796
  });
357701
357797
 
@@ -521452,6 +521548,7 @@ __export(generators_yml_exports, {
521452
521548
  RemoveDiscriminantsFromSchemas: () => RemoveDiscriminantsFromSchemas,
521453
521549
  UnionSettingsSchema: () => UnionSettingsSchema,
521454
521550
  ai: () => ai_exports,
521551
+ automation: () => automation_exports,
521455
521552
  fernDefinition: () => fernDefinition_exports,
521456
521553
  generators: () => generators_exports,
521457
521554
  getPackageName: () => getPackageName,
@@ -521467,6 +521564,7 @@ __export(generators_yml_exports, {
521467
521564
  isRawProtobufAPIDefinitionSchema: () => isRawProtobufAPIDefinitionSchema,
521468
521565
  license: () => license_exports,
521469
521566
  replay: () => replay_exports,
521567
+ resolveAutomationConfig: () => resolveAutomationConfig,
521470
521568
  reviewers: () => reviewers_exports,
521471
521569
  serialization: () => serialization_exports4
521472
521570
  });
@@ -521530,6 +521628,22 @@ function isRawProtobufAPIDefinitionSchema(rawApiConfiguration) {
521530
521628
  return typeof rawApiConfiguration !== "string" && "proto" in rawApiConfiguration;
521531
521629
  }
521532
521630
 
521631
+ // ../configuration/lib/generators-yml/resolveAutomationConfig.js
521632
+ var DEFAULT_AUTOMATION_CONFIG = {
521633
+ generate: true,
521634
+ upgrade: true,
521635
+ preview: true,
521636
+ verify: true
521637
+ };
521638
+ function resolveAutomationConfig({ rootAutomation, groupAutomation, generatorAutomation }) {
521639
+ return {
521640
+ generate: generatorAutomation?.generate ?? groupAutomation?.generate ?? rootAutomation?.generate ?? DEFAULT_AUTOMATION_CONFIG.generate,
521641
+ upgrade: generatorAutomation?.upgrade ?? groupAutomation?.upgrade ?? rootAutomation?.upgrade ?? DEFAULT_AUTOMATION_CONFIG.upgrade,
521642
+ preview: generatorAutomation?.preview ?? groupAutomation?.preview ?? rootAutomation?.preview ?? DEFAULT_AUTOMATION_CONFIG.preview,
521643
+ verify: generatorAutomation?.verify ?? groupAutomation?.verify ?? rootAutomation?.verify ?? DEFAULT_AUTOMATION_CONFIG.verify
521644
+ };
521645
+ }
521646
+
521533
521647
  // ../configuration/lib/generators-yml/schemas/api/resources/ai/index.js
521534
521648
  var ai_exports = {};
521535
521649
  __export(ai_exports, {
@@ -521543,6 +521657,9 @@ var ModelProvider = {
521543
521657
  Bedrock: "bedrock"
521544
521658
  };
521545
521659
 
521660
+ // ../configuration/lib/generators-yml/schemas/api/resources/automation/index.js
521661
+ var automation_exports = {};
521662
+
521546
521663
  // ../configuration/lib/generators-yml/schemas/api/resources/fernDefinition/index.js
521547
521664
  var fernDefinition_exports = {};
521548
521665
  __export(fernDefinition_exports, {
@@ -521726,6 +521843,7 @@ __export(serialization_exports4, {
521726
521843
  ApiDefinitionWithOverridesSchema: () => ApiDefinitionWithOverridesSchema,
521727
521844
  AsyncApiSettingsSchema: () => AsyncApiSettingsSchema,
521728
521845
  AsyncApiSpecSchema: () => AsyncApiSpecSchema,
521846
+ AutomationSchema: () => AutomationSchema,
521729
521847
  BaseApiSettingsSchema: () => BaseApiSettingsSchema,
521730
521848
  BaseGeneratorInvocationSchema: () => BaseGeneratorInvocationSchema,
521731
521849
  CoerceConstsTo: () => CoerceConstsTo2,
@@ -521799,6 +521917,7 @@ __export(serialization_exports4, {
521799
521917
  WhitelabelConfigurationSchema: () => WhitelabelConfigurationSchema,
521800
521918
  WhitelabelGithubConfigurationSchema: () => WhitelabelGithubConfigurationSchema,
521801
521919
  ai: () => ai_exports2,
521920
+ automation: () => automation_exports2,
521802
521921
  fernDefinition: () => fernDefinition_exports2,
521803
521922
  generators: () => generators_exports2,
521804
521923
  group: () => group_exports2,
@@ -523238,6 +523357,20 @@ var AiServicesSchema = schemas_exports8.object({
523238
523357
  model: ModelName
523239
523358
  });
523240
523359
 
523360
+ // ../configuration/lib/generators-yml/schemas/serialization/resources/automation/index.js
523361
+ var automation_exports2 = {};
523362
+ __export(automation_exports2, {
523363
+ AutomationSchema: () => AutomationSchema
523364
+ });
523365
+
523366
+ // ../configuration/lib/generators-yml/schemas/serialization/resources/automation/types/AutomationSchema.js
523367
+ var AutomationSchema = schemas_exports8.object({
523368
+ generate: schemas_exports8.boolean().optional(),
523369
+ upgrade: schemas_exports8.boolean().optional(),
523370
+ preview: schemas_exports8.boolean().optional(),
523371
+ verify: schemas_exports8.boolean().optional()
523372
+ });
523373
+
523241
523374
  // ../configuration/lib/generators-yml/schemas/serialization/resources/fernDefinition/index.js
523242
523375
  var fernDefinition_exports2 = {};
523243
523376
  __export(fernDefinition_exports2, {
@@ -524198,7 +524331,8 @@ var BaseGeneratorInvocationSchema = schemas_exports8.object({
524198
524331
  api: GeneratorApiSettingsSchema.optional(),
524199
524332
  "disable-examples": schemas_exports8.boolean().optional(),
524200
524333
  "publish-metadata": GeneratorPublishMetadataSchema.optional(),
524201
- autorelease: schemas_exports8.boolean().optional()
524334
+ autorelease: schemas_exports8.boolean().optional(),
524335
+ automation: AutomationSchema.optional()
524202
524336
  });
524203
524337
 
524204
524338
  // ../configuration/lib/generators-yml/schemas/serialization/resources/group/types/CustomGeneratorInvocationSchema.js
@@ -524219,7 +524353,8 @@ var GeneratorGroupSchema = schemas_exports8.object({
524219
524353
  audiences: schemas_exports8.list(schemas_exports8.string()).optional(),
524220
524354
  generators: schemas_exports8.list(GeneratorInvocationSchema),
524221
524355
  metadata: OutputMetadataSchema.optional(),
524222
- reviewers: ReviewersSchema.optional()
524356
+ reviewers: ReviewersSchema.optional(),
524357
+ automation: AutomationSchema.optional()
524223
524358
  });
524224
524359
 
524225
524360
  // ../configuration/lib/generators-yml/schemas/serialization/resources/replay/types/ReplayConfigSchema.js
@@ -524298,6 +524433,7 @@ var GeneratorsConfigurationSchema = schemas_exports8.object({
524298
524433
  replay: ReplayConfigSchema.optional(),
524299
524434
  ai: AiServicesSchema.optional(),
524300
524435
  autorelease: schemas_exports8.boolean().optional(),
524436
+ automation: AutomationSchema.optional(),
524301
524437
  openapi: GeneratorsOpenApiSchema.optional(),
524302
524438
  "openapi-overrides": schemas_exports8.string().optional(),
524303
524439
  "spec-origin": schemas_exports8.string().optional(),
@@ -557180,6 +557316,7 @@ async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfigur
557180
557316
  group,
557181
557317
  maybeTopLevelMetadata,
557182
557318
  maybeTopLevelReviewers: rawGeneratorsConfiguration.reviewers,
557319
+ maybeRootAutomation: rawGeneratorsConfiguration.automation,
557183
557320
  readme,
557184
557321
  context: context3
557185
557322
  }))) : [],
@@ -557545,7 +557682,7 @@ async function parseAPIConfiguration(rawGeneratorsConfiguration) {
557545
557682
  definitions: await parseAPIConfigurationToApiLocations(apiConfiguration, rawGeneratorsConfiguration, emptySettings)
557546
557683
  };
557547
557684
  }
557548
- async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName, group, maybeTopLevelMetadata, maybeTopLevelReviewers, readme, context: context3 }) {
557685
+ async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName, group, maybeTopLevelMetadata, maybeTopLevelReviewers, maybeRootAutomation, readme, context: context3 }) {
557549
557686
  const maybeGroupLevelMetadata = getOutputMetadata(group.metadata);
557550
557687
  return {
557551
557688
  groupName,
@@ -557558,6 +557695,8 @@ async function convertGroup({ absolutePathToGeneratorsConfiguration, groupName,
557558
557695
  maybeGroupLevelMetadata,
557559
557696
  maybeTopLevelReviewers,
557560
557697
  maybeGroupLevelReviewers: group.reviewers,
557698
+ maybeRootAutomation,
557699
+ maybeGroupAutomation: group.automation,
557561
557700
  readme,
557562
557701
  context: context3
557563
557702
  })))
@@ -557579,10 +557718,15 @@ function getGeneratorNameAndImage(generator, context3) {
557579
557718
  containerImage: void 0
557580
557719
  };
557581
557720
  }
557582
- async function convertGenerator({ absolutePathToGeneratorsConfiguration, generator, maybeGroupLevelMetadata, maybeTopLevelMetadata, maybeGroupLevelReviewers, maybeTopLevelReviewers, readme, context: context3 }) {
557721
+ async function convertGenerator({ absolutePathToGeneratorsConfiguration, generator, maybeGroupLevelMetadata, maybeTopLevelMetadata, maybeGroupLevelReviewers, maybeTopLevelReviewers, maybeRootAutomation, maybeGroupAutomation, readme, context: context3 }) {
557583
557722
  const { normalizedName, containerImage } = getGeneratorNameAndImage(generator, context3);
557584
557723
  return {
557585
557724
  raw: generator,
557725
+ automation: generators_yml_exports.resolveAutomationConfig({
557726
+ rootAutomation: maybeRootAutomation,
557727
+ groupAutomation: maybeGroupAutomation,
557728
+ generatorAutomation: generator.automation
557729
+ }),
557586
557730
  name: normalizedName,
557587
557731
  containerImage,
557588
557732
  version: generator.version,
@@ -627388,7 +627532,7 @@ var AccessTokenPosthogManager = class {
627388
627532
  properties: {
627389
627533
  ...event,
627390
627534
  ...event.properties,
627391
- version: "4.65.3-5-gd8cee996921",
627535
+ version: "4.66.0",
627392
627536
  usingAccessToken: true
627393
627537
  }
627394
627538
  });
@@ -627439,7 +627583,7 @@ var UserPosthogManager = class {
627439
627583
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
627440
627584
  event: "CLI",
627441
627585
  properties: {
627442
- version: "4.65.3-5-gd8cee996921",
627586
+ version: "4.66.0",
627443
627587
  ...event,
627444
627588
  ...event.properties,
627445
627589
  usingAccessToken: false,
@@ -843668,7 +843812,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
843668
843812
  var LOGS_FOLDER_NAME = "logs";
843669
843813
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
843670
843814
  function getCliSource() {
843671
- const version7 = "4.65.3-5-gd8cee996921";
843815
+ const version7 = "4.66.0";
843672
843816
  return `cli@${version7}`;
843673
843817
  }
843674
843818
  var DebugLogger = class {
@@ -846076,6 +846220,7 @@ async function visitGeneratorsYamlAst(contents, cliVersion, visitor) {
846076
846220
  ai: noop2,
846077
846221
  autorelease: noop2,
846078
846222
  replay: noop2,
846223
+ automation: noop2,
846079
846224
  groups: async (groups2) => {
846080
846225
  await visitGeneratorGroups({ groups: groups2, visitor, nodePath: ["groups"], cliVersion });
846081
846226
  }
@@ -852784,7 +852929,7 @@ async function retryWithRateLimit({ fn: fn5, retryRateLimited, logger: logger4,
852784
852929
 
852785
852930
  // ../generation/remote-generation/remote-workspace-runner/lib/createAndStartJob.js
852786
852931
  var gzipAsync = (0, import_util19.promisify)(import_zlib5.gzip);
852787
- async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version7, context: context3, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, fernignorePath, skipFernignore, retryRateLimited }) {
852932
+ async function createAndStartJob({ projectConfig, workspace, organization, intermediateRepresentation, generatorInvocation, version: version7, context: context3, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, fernignorePath, skipFernignore, retryRateLimited, automationMode, autoMerge }) {
852788
852933
  let fernignoreContents;
852789
852934
  if (skipFernignore) {
852790
852935
  fernignoreContents = "";
@@ -852807,7 +852952,9 @@ async function createAndStartJob({ projectConfig, workspace, organization, inter
852807
852952
  token,
852808
852953
  whitelabel,
852809
852954
  absolutePathToPreview,
852810
- fernignoreContents
852955
+ fernignoreContents,
852956
+ automationMode,
852957
+ autoMerge
852811
852958
  }),
852812
852959
  retryRateLimited,
852813
852960
  logger: context3.logger,
@@ -852839,6 +852986,12 @@ async function createJob({ projectConfig, workspace, organization, generatorInvo
852839
852986
  whitelabel,
852840
852987
  preview: absolutePathToPreview != null,
852841
852988
  fernignoreContents
852989
+ // TODO(FER-9671): Pass automation flags to Fiddle once its API is updated:
852990
+ // automationMode,
852991
+ // autoMerge,
852992
+ // runId: process.env.FERN_RUN_ID
852993
+ // Fiddle will use these for server-side no-diff detection, separate PRs,
852994
+ // automerge, run_id correlation, and breaking change handling.
852842
852995
  });
852843
852996
  if (!createResponse.ok) {
852844
852997
  const rawError = createResponse.error;
@@ -853417,7 +853570,7 @@ var SourceUploader = class {
853417
853570
  };
853418
853571
 
853419
853572
  // ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForGenerator.js
853420
- async function runRemoteGenerationForGenerator({ projectConfig, organization, workspace, interactiveTaskContext, generatorInvocation, version: version7, audiences, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, readme, fernignorePath, skipFernignore, dynamicIrOnly, retryRateLimited, requireEnvVars }) {
853573
+ async function runRemoteGenerationForGenerator({ projectConfig, organization, workspace, interactiveTaskContext, generatorInvocation, version: version7, audiences, shouldLogS3Url, token, whitelabel, irVersionOverride, absolutePathToPreview, readme, fernignorePath, skipFernignore, dynamicIrOnly, retryRateLimited, requireEnvVars, automationMode, autoMerge }) {
853421
853574
  const fdr = createFdrService({ token: token.value });
853422
853575
  const fdrOrigin = "https://registry-dev2.buildwithfern.com";
853423
853576
  const isAirGapped = await detectAirGappedMode(`${fdrOrigin}/health`, interactiveTaskContext.logger);
@@ -853582,7 +853735,9 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
853582
853735
  absolutePathToPreview,
853583
853736
  fernignorePath,
853584
853737
  skipFernignore,
853585
- retryRateLimited
853738
+ retryRateLimited,
853739
+ automationMode,
853740
+ autoMerge
853586
853741
  });
853587
853742
  interactiveTaskContext.logger.debug(`Job ID: ${job.jobId}`);
853588
853743
  const taskId = job.taskIds[0];
@@ -853717,7 +853872,7 @@ async function uploadDynamicIRForSdkGeneration({ fdr, organization, version: ver
853717
853872
  }
853718
853873
 
853719
853874
  // ../generation/remote-generation/remote-workspace-runner/lib/runRemoteGenerationForAPIWorkspace.js
853720
- async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization, workspace, context: context3, generatorGroup, version: version7, shouldLogS3Url, token, whitelabel, absolutePathToPreview, mode, fernignorePath, skipFernignore, dynamicIrOnly, validateWorkspace, retryRateLimited, requireEnvVars }) {
853875
+ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization, workspace, context: context3, generatorGroup, version: version7, shouldLogS3Url, token, whitelabel, absolutePathToPreview, mode, fernignorePath, skipFernignore, dynamicIrOnly, validateWorkspace, retryRateLimited, requireEnvVars, automationMode, autoMerge }) {
853721
853876
  if (generatorGroup.generators.length === 0) {
853722
853877
  context3.logger.warn("No generators specified.");
853723
853878
  return null;
@@ -853777,7 +853932,9 @@ async function runRemoteGenerationForAPIWorkspace({ projectConfig, organization,
853777
853932
  skipFernignore,
853778
853933
  dynamicIrOnly,
853779
853934
  retryRateLimited,
853780
- requireEnvVars
853935
+ requireEnvVars,
853936
+ automationMode,
853937
+ autoMerge
853781
853938
  });
853782
853939
  if (remoteTaskHandlerResponse != null && remoteTaskHandlerResponse.createdSnippets) {
853783
853940
  snippetsProducedBy.push(generatorInvocation);
@@ -854866,7 +855023,7 @@ var LegacyDocsPublisher = class {
854866
855023
  previewId,
854867
855024
  disableTemplates: void 0,
854868
855025
  skipUpload,
854869
- cliVersion: "4.65.3-5-gd8cee996921"
855026
+ cliVersion: "4.66.0"
854870
855027
  });
854871
855028
  if (taskContext.getResult() === TaskResult.Failure) {
854872
855029
  return { success: false };
@@ -875035,6 +875192,9 @@ var DynamicLiteralMapper = class extends WithGeneration {
875035
875192
  });
875036
875193
  }
875037
875194
  convertLiteral({ literal: literal3, value, fallbackToDefault }) {
875195
+ if (this.settings.generateLiterals) {
875196
+ return this.csharp.Literal.nop();
875197
+ }
875038
875198
  switch (literal3.type) {
875039
875199
  case "boolean": {
875040
875200
  const bool2 = this.context.getValueAsBoolean({ value });
@@ -875101,6 +875261,15 @@ var DynamicLiteralMapper = class extends WithGeneration {
875101
875261
  convertNamed({ named, value, as: as8, fallbackToDefault }) {
875102
875262
  switch (named.type) {
875103
875263
  case "alias":
875264
+ if (this.settings.generateLiterals && named.typeReference.type === "literal") {
875265
+ return this.csharp.Literal.reference(this.csharp.instantiateClass({
875266
+ classReference: this.csharp.classReference({
875267
+ origin: named.declaration,
875268
+ namespace: this.context.getNamespace(named.declaration.fernFilepath)
875269
+ }),
875270
+ arguments_: []
875271
+ }));
875272
+ }
875104
875273
  return this.convert({ typeReference: named.typeReference, value, as: as8, fallbackToDefault });
875105
875274
  case "discriminatedUnion":
875106
875275
  if (this.settings.shouldGeneratedDiscriminatedUnions) {
@@ -875609,6 +875778,12 @@ var DynamicTypeMapper = class extends WithGeneration {
875609
875778
  convertNamed({ named }) {
875610
875779
  switch (named.type) {
875611
875780
  case "alias":
875781
+ if (this.settings.generateLiterals && named.typeReference.type === "literal") {
875782
+ return this.csharp.classReference({
875783
+ origin: named.declaration,
875784
+ namespace: this.context.getNamespace(named.declaration.fernFilepath)
875785
+ });
875786
+ }
875612
875787
  return this.convert({ typeReference: named.typeReference });
875613
875788
  case "enum":
875614
875789
  case "object":
@@ -906217,7 +906392,8 @@ var LocalTaskHandler = class {
906217
906392
  autoVersioningCommitMessage: autoVersionResult.commitMessage,
906218
906393
  autoVersioningChangelogEntry: autoVersionResult.changelogEntry,
906219
906394
  autoVersioningPrDescription: autoVersionResult.prDescription,
906220
- autoVersioningVersionBumpReason: autoVersionResult.versionBumpReason
906395
+ autoVersioningVersionBumpReason: autoVersionResult.versionBumpReason,
906396
+ autoVersioningVersionBump: autoVersionResult.versionBump
906221
906397
  };
906222
906398
  }
906223
906399
  return { shouldCommit: true, autoVersioningCommitMessage: void 0 };
@@ -906376,7 +906552,8 @@ var LocalTaskHandler = class {
906376
906552
  commitMessage,
906377
906553
  changelogEntry,
906378
906554
  prDescription,
906379
- versionBumpReason
906555
+ versionBumpReason,
906556
+ versionBump: finalBump
906380
906557
  };
906381
906558
  } catch (error50) {
906382
906559
  if (error50 instanceof AutoVersioningException) {
@@ -906879,7 +907056,7 @@ function getGeneratorOutputSubfolder(generatorName) {
906879
907056
  }
906880
907057
 
906881
907058
  // ../generation/local-generation/local-workspace-runner/lib/runLocalGenerationForWorkspace.js
906882
- async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai7, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride }) {
907059
+ async function runLocalGenerationForWorkspace({ token, projectConfig, workspace, generatorGroup, version: version7, keepDocker, inspect: inspect6, context: context3, absolutePathToPreview, runner, ai: ai7, replay, noReplay, validateWorkspace, requireEnvVars, skipFernignore, publishToRegistry, isPreview: isPreviewOverride, automationMode, autoMerge }) {
906883
907060
  const userProvidedVersion = version7;
906884
907061
  if (userProvidedVersion != null) {
906885
907062
  if (absolutePathToPreview != null) {
@@ -907044,7 +907221,7 @@ generators:
907044
907221
  absolutePathToLocalSnippetJSON = AbsoluteFilePath2.of((await getWorkspaceTempDir()).path + "/snippet.json");
907045
907222
  }
907046
907223
  const workspaceTempDir = await getWorkspaceTempDir();
907047
- const { shouldCommit, autoVersioningCommitMessage, autoVersioningChangelogEntry, autoVersioningPrDescription, autoVersioningVersionBumpReason } = await writeFilesToDiskAndRunGenerator({
907224
+ const { shouldCommit, autoVersioningCommitMessage, autoVersioningChangelogEntry, autoVersioningPrDescription, autoVersioningVersionBumpReason, autoVersioningVersionBump } = await writeFilesToDiskAndRunGenerator({
907048
907225
  organization: projectConfig.organization,
907049
907226
  absolutePathToFernConfig: workspace.generatorsConfiguration?.absolutePathToConfiguration ?? projectConfig._absolutePath,
907050
907227
  workspace: fernWorkspace,
@@ -907083,6 +907260,7 @@ generators:
907083
907260
  warn: (msg) => interactiveTaskContext.logger.warn(msg),
907084
907261
  error: (msg) => interactiveTaskContext.logger.error(msg)
907085
907262
  };
907263
+ const hasBreakingChanges = autoVersioningVersionBump === "MAJOR";
907086
907264
  const pipeline5 = new import_generator_cli.PostGenerationPipeline({
907087
907265
  outputDir: absolutePathToLocalOutput,
907088
907266
  replay: { enabled: replay?.enabled === true, skipApplication: noReplay, stageOnly: false },
@@ -907097,7 +907275,12 @@ generators:
907097
907275
  prDescription: autoVersioningPrDescription,
907098
907276
  versionBumpReason: autoVersioningVersionBumpReason,
907099
907277
  previewMode: selfhostedGithubConfig.previewMode,
907100
- generatorName: generatorInvocation.name
907278
+ generatorName: generatorInvocation.name,
907279
+ automationMode,
907280
+ autoMerge,
907281
+ hasBreakingChanges,
907282
+ breakingChangesSummary: hasBreakingChanges ? autoVersioningPrDescription : void 0,
907283
+ runId: process.env.FERN_RUN_ID
907101
907284
  },
907102
907285
  cliVersion: workspace.cliVersion ?? "unknown",
907103
907286
  generatorVersions: {
@@ -907114,6 +907297,12 @@ generators:
907114
907297
  error: (msg) => interactiveTaskContext.logger.error(source_default.red(msg))
907115
907298
  });
907116
907299
  }
907300
+ if (pipelineResult.steps.github?.skippedNoDiff) {
907301
+ interactiveTaskContext.logger.info(source_default.green("No changes detected \u2014 skipping PR creation"));
907302
+ }
907303
+ if (pipelineResult.steps.github?.autoMergeEnabled) {
907304
+ interactiveTaskContext.logger.info(source_default.green("Automerge enabled on PR"));
907305
+ }
907117
907306
  if (!pipelineResult.success) {
907118
907307
  interactiveTaskContext.failAndThrow(`Post-generation pipeline failed: ${pipelineResult.errors?.join(", ")}`);
907119
907308
  }
@@ -907429,7 +907618,13 @@ var LegacyGeneratorInvocationAdapter = class {
907429
907618
  irVersionOverride: void 0,
907430
907619
  keywords: void 0,
907431
907620
  publishMetadata: void 0,
907432
- settings: void 0
907621
+ settings: void 0,
907622
+ automation: {
907623
+ generate: true,
907624
+ upgrade: true,
907625
+ preview: true,
907626
+ verify: true
907627
+ }
907433
907628
  };
907434
907629
  }
907435
907630
  buildRaw(target) {
@@ -928424,7 +928619,7 @@ var CliContext = class {
928424
928619
  if (false) {
928425
928620
  this.logger.error("CLI_VERSION is not defined");
928426
928621
  }
928427
- return "4.65.3-5-gd8cee996921";
928622
+ return "4.66.0";
928428
928623
  }
928429
928624
  getCliName() {
928430
928625
  if (false) {
@@ -937543,6 +937738,47 @@ async function formatWorkspaces({
937543
937738
  );
937544
937739
  }
937545
937740
 
937741
+ // src/commands/generate/filterGenerators.ts
937742
+ function parseGeneratorArg(generatorArg) {
937743
+ if (generatorArg == null) {
937744
+ return { generatorName: void 0, generatorIndex: void 0 };
937745
+ }
937746
+ const parsed = generatorArg.length > 0 ? Number(generatorArg) : Number.NaN;
937747
+ if (!Number.isNaN(parsed) && Number.isInteger(parsed) && parsed >= 0) {
937748
+ return { generatorName: void 0, generatorIndex: parsed };
937749
+ }
937750
+ return { generatorName: generatorArg, generatorIndex: void 0 };
937751
+ }
937752
+ function filterGenerators({
937753
+ generators,
937754
+ generatorIndex,
937755
+ generatorName,
937756
+ groupName
937757
+ }) {
937758
+ if (generatorIndex != null) {
937759
+ const generator = generators[generatorIndex];
937760
+ if (generator == null) {
937761
+ return {
937762
+ ok: false,
937763
+ error: `Generator index ${generatorIndex} is out of bounds in group '${groupName}' (${generators.length} generators available)`
937764
+ };
937765
+ }
937766
+ return { ok: true, generators: [generator] };
937767
+ }
937768
+ if (generatorName != null) {
937769
+ const filtered = generators.filter((gen) => gen.name === generatorName);
937770
+ if (filtered.length === 0) {
937771
+ const available = generators.map((gen) => gen.name);
937772
+ return {
937773
+ ok: false,
937774
+ error: `Generator '${generatorName}' not found in group '${groupName}'. Available generators: ${available.join(", ")}`
937775
+ };
937776
+ }
937777
+ return { ok: true, generators: filtered };
937778
+ }
937779
+ return { ok: true, generators };
937780
+ }
937781
+
937546
937782
  // src/commands/generate/generateAPIWorkspaces.ts
937547
937783
  init_lib6();
937548
937784
 
@@ -937642,6 +937878,7 @@ async function generateWorkspace({
937642
937878
  context: context3,
937643
937879
  groupName,
937644
937880
  generatorName,
937881
+ generatorIndex,
937645
937882
  version: version7,
937646
937883
  shouldLogS3Url,
937647
937884
  token,
@@ -937657,7 +937894,9 @@ async function generateWorkspace({
937657
937894
  dynamicIrOnly,
937658
937895
  noReplay,
937659
937896
  retryRateLimited,
937660
- requireEnvVars
937897
+ requireEnvVars,
937898
+ automationMode,
937899
+ autoMerge
937661
937900
  }) {
937662
937901
  if (workspace.generatorsConfiguration == null) {
937663
937902
  context3.logger.warn("This workspaces has no generators.yml");
@@ -937702,16 +937941,16 @@ async function generateWorkspace({
937702
937941
  if (group == null) {
937703
937942
  return context3.failAndThrow(`Group '${resolvedGroupName}' does not exist.`);
937704
937943
  }
937705
- if (generatorName != null) {
937706
- const filteredGenerators = group.generators.filter((gen) => gen.name === generatorName);
937707
- if (filteredGenerators.length === 0) {
937708
- const availableGenerators = group.generators.map((gen) => gen.name);
937709
- return context3.failAndThrow(
937710
- `Generator '${generatorName}' not found in group '${resolvedGroupName}'. Available generators: ${availableGenerators.join(", ")}`
937711
- );
937712
- }
937713
- group = { ...group, generators: filteredGenerators };
937944
+ const filterResult = filterGenerators({
937945
+ generators: group.generators,
937946
+ generatorIndex,
937947
+ generatorName,
937948
+ groupName: resolvedGroupName
937949
+ });
937950
+ if (!filterResult.ok) {
937951
+ return context3.failAndThrow(filterResult.error);
937714
937952
  }
937953
+ group = { ...group, generators: filterResult.generators };
937715
937954
  if (lfsOverride != null) {
937716
937955
  group = applyLfsOverride(group, lfsOverride, context3);
937717
937956
  }
@@ -937735,7 +937974,9 @@ async function generateWorkspace({
937735
937974
  noReplay,
937736
937975
  validateWorkspace: true,
937737
937976
  requireEnvVars,
937738
- skipFernignore
937977
+ skipFernignore,
937978
+ automationMode,
937979
+ autoMerge
937739
937980
  });
937740
937981
  } else if (token != null) {
937741
937982
  const customImageGenerators = group.generators.filter((g19) => g19.containerImage != null);
@@ -937762,7 +938003,9 @@ async function generateWorkspace({
937762
938003
  dynamicIrOnly,
937763
938004
  validateWorkspace: true,
937764
938005
  retryRateLimited,
937765
- requireEnvVars
938006
+ requireEnvVars,
938007
+ automationMode,
938008
+ autoMerge
937766
938009
  });
937767
938010
  }
937768
938011
  })
@@ -937864,6 +938107,7 @@ async function generateAPIWorkspaces({
937864
938107
  version: version7,
937865
938108
  groupName,
937866
938109
  generatorName,
938110
+ generatorIndex,
937867
938111
  shouldLogS3Url,
937868
938112
  keepDocker,
937869
938113
  useLocalDocker,
@@ -937879,7 +938123,9 @@ async function generateAPIWorkspaces({
937879
938123
  outputDir,
937880
938124
  noReplay,
937881
938125
  retryRateLimited,
937882
- requireEnvVars
938126
+ requireEnvVars,
938127
+ automationMode,
938128
+ autoMerge
937883
938129
  }) {
937884
938130
  let token = void 0;
937885
938131
  if (!useLocalDocker) {
@@ -937899,14 +938145,27 @@ async function generateAPIWorkspaces({
937899
938145
  }
937900
938146
  for (const workspace of project.apiWorkspaces) {
937901
938147
  const resolvedGroupNames = resolveGroupNamesForWorkspace(groupName, workspace.generatorsConfiguration);
937902
- for (const generator of workspace.generatorsConfiguration?.groups.filter((group) => resolvedGroupNames == null || resolvedGroupNames.includes(group.groupName)).flatMap((group) => group.generators).filter((generator2) => generatorName == null || generator2.name === generatorName) ?? []) {
937903
- const { shouldProceed } = await checkOutputDirectory(
937904
- generator.absolutePathToLocalOutput,
937905
- cliContext,
937906
- force
937907
- );
937908
- if (!shouldProceed) {
937909
- cliContext.failAndThrow("Generation cancelled");
938148
+ for (const group of workspace.generatorsConfiguration?.groups.filter(
938149
+ (group2) => resolvedGroupNames == null || resolvedGroupNames.includes(group2.groupName)
938150
+ ) ?? []) {
938151
+ const filterResult = filterGenerators({
938152
+ generators: group.generators,
938153
+ generatorIndex,
938154
+ generatorName,
938155
+ groupName: group.groupName
938156
+ });
938157
+ if (!filterResult.ok) {
938158
+ continue;
938159
+ }
938160
+ for (const generator of filterResult.generators) {
938161
+ const { shouldProceed } = await checkOutputDirectory(
938162
+ generator.absolutePathToLocalOutput,
938163
+ cliContext,
938164
+ force
938165
+ );
938166
+ if (!shouldProceed) {
938167
+ cliContext.failAndThrow("Generation cancelled");
938168
+ }
937910
938169
  }
937911
938170
  }
937912
938171
  }
@@ -937948,6 +938207,7 @@ async function generateAPIWorkspaces({
937948
938207
  version: version7,
937949
938208
  groupName,
937950
938209
  generatorName,
938210
+ generatorIndex,
937951
938211
  shouldLogS3Url,
937952
938212
  token,
937953
938213
  useLocalDocker,
@@ -937962,7 +938222,9 @@ async function generateAPIWorkspaces({
937962
938222
  dynamicIrOnly,
937963
938223
  noReplay,
937964
938224
  retryRateLimited,
937965
- requireEnvVars
938225
+ requireEnvVars,
938226
+ automationMode,
938227
+ autoMerge
937966
938228
  });
937967
938229
  });
937968
938230
  })
@@ -946539,6 +946801,7 @@ async function tryRunCli(cliContext) {
946539
946801
  addReplayCommand(cli, cliContext);
946540
946802
  addBetaCommand(cli, cliContext);
946541
946803
  addSdkCommand2(cli, cliContext);
946804
+ addAutomationsCommand(cli, cliContext);
946542
946805
  addGetOrganizationCommand(cli, cliContext);
946543
946806
  addGeneratorCommands(cli, cliContext);
946544
946807
  addProtocGenFernCommand(cli, cliContext);
@@ -947011,6 +947274,7 @@ function addGenerateCommand2(cli, cliContext) {
947011
947274
  return cliContext.failWithoutThrowing("The --output flag is not supported for docs generation.");
947012
947275
  }
947013
947276
  const correctedGeneratorFilter = argv.generator != null ? warnAndCorrectIncorrectDockerOrg(argv.generator, cliContext) : void 0;
947277
+ const { generatorName, generatorIndex } = parseGeneratorArg(correctedGeneratorFilter);
947014
947278
  if (argv.api != null) {
947015
947279
  return await generateAPIWorkspaces({
947016
947280
  project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
@@ -947020,7 +947284,8 @@ function addGenerateCommand2(cli, cliContext) {
947020
947284
  cliContext,
947021
947285
  version: argv.version,
947022
947286
  groupName: argv.group,
947023
- generatorName: correctedGeneratorFilter,
947287
+ generatorName,
947288
+ generatorIndex,
947024
947289
  shouldLogS3Url: argv.printZipUrl,
947025
947290
  keepDocker: argv.keepDocker,
947026
947291
  useLocalDocker: argv.local || argv.runner != null,
@@ -947078,7 +947343,8 @@ function addGenerateCommand2(cli, cliContext) {
947078
947343
  cliContext,
947079
947344
  version: argv.version,
947080
947345
  groupName: argv.group,
947081
- generatorName: correctedGeneratorFilter,
947346
+ generatorName,
947347
+ generatorIndex,
947082
947348
  shouldLogS3Url: argv.printZipUrl,
947083
947349
  keepDocker: argv.keepDocker,
947084
947350
  useLocalDocker: argv.local,
@@ -948184,6 +948450,133 @@ function addSdkCommand2(cli, cliContext) {
948184
948450
  return yargs.demandCommand();
948185
948451
  });
948186
948452
  }
948453
+ function addAutomationsCommand(cli, cliContext) {
948454
+ cli.command("automations", false, (yargs) => {
948455
+ addAutomationsListCommand(yargs, cliContext);
948456
+ addAutomationsGenerateCommand(yargs, cliContext);
948457
+ return yargs.demandCommand();
948458
+ });
948459
+ }
948460
+ function addAutomationsListCommand(cli, cliContext) {
948461
+ cli.command("list", false, (yargs) => {
948462
+ addAutomationsListGenerateCommand(yargs, cliContext);
948463
+ return yargs.demandCommand();
948464
+ });
948465
+ }
948466
+ function addAutomationsListGenerateCommand(cli, cliContext) {
948467
+ cli.command(
948468
+ "generate",
948469
+ false,
948470
+ // hidden
948471
+ (yargs) => yargs.option("group", {
948472
+ type: "string",
948473
+ description: "Filter to a specific generator group (e.g. 'sdk'). Omit to list all groups."
948474
+ }).option("api", {
948475
+ type: "string",
948476
+ description: "Filter to a specific API in a multi-API repo (e.g. 'foo' for fern/apis/foo/). Omit to list all APIs."
948477
+ }).option("version", {
948478
+ type: "string",
948479
+ description: "Version string to include in generated commands (e.g. 'AUTO' for AI-based versioning)"
948480
+ }).option("auto-merge", {
948481
+ boolean: true,
948482
+ default: false,
948483
+ description: "Include --auto-merge flag in generated commands"
948484
+ }),
948485
+ async (argv) => {
948486
+ const project = await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
948487
+ commandLineApiWorkspace: argv.api,
948488
+ defaultToAllApiWorkspaces: true
948489
+ });
948490
+ const commands = [];
948491
+ for (const workspace of project.apiWorkspaces) {
948492
+ const groups2 = workspace.generatorsConfiguration?.groups ?? [];
948493
+ for (const group of groups2) {
948494
+ if (argv.group != null && group.groupName !== argv.group) {
948495
+ continue;
948496
+ }
948497
+ for (let i11 = 0; i11 < group.generators.length; i11++) {
948498
+ const generator = group.generators[i11];
948499
+ if (generator == null || !generator.automation.generate) {
948500
+ continue;
948501
+ }
948502
+ const parts = ["fern", "automations", "generate"];
948503
+ if (workspace.workspaceName != null) {
948504
+ parts.push("--api", workspace.workspaceName);
948505
+ }
948506
+ parts.push("--group", group.groupName);
948507
+ parts.push("--generator", String(i11));
948508
+ if (argv.version != null) {
948509
+ parts.push("--version", argv.version);
948510
+ }
948511
+ if (argv["auto-merge"]) {
948512
+ parts.push("--auto-merge");
948513
+ }
948514
+ commands.push(parts.join(" "));
948515
+ }
948516
+ }
948517
+ }
948518
+ process.stdout.write(JSON.stringify(commands));
948519
+ }
948520
+ );
948521
+ }
948522
+ function addAutomationsGenerateCommand(cli, cliContext) {
948523
+ cli.command(
948524
+ "generate",
948525
+ false,
948526
+ // hidden
948527
+ (yargs) => yargs.option("api", {
948528
+ type: "string",
948529
+ description: "Target a specific API in a multi-API repo (e.g. 'foo' for fern/apis/foo/). Required when the project has multiple APIs."
948530
+ }).option("group", {
948531
+ type: "string",
948532
+ description: "The generator group to run (e.g. 'sdk'). Falls back to default-group in generators.yml if omitted."
948533
+ }).option("generator", {
948534
+ type: "string",
948535
+ description: "Target a specific generator by 0-based index (e.g. '0', '1') or by name. Index is preferred for deterministic targeting when duplicate names exist."
948536
+ }).option("version", {
948537
+ type: "string",
948538
+ description: "Version for generated packages. Use 'AUTO' for AI-based semantic versioning that analyzes the diff and determines MAJOR/MINOR/PATCH automatically."
948539
+ }).option("auto-merge", {
948540
+ boolean: true,
948541
+ default: false,
948542
+ description: "Enable GitHub automerge on generated PRs. Automerge is skipped when breaking changes (MAJOR bump) are detected, regardless of this flag."
948543
+ }),
948544
+ async (argv) => {
948545
+ const { generatorName: genName, generatorIndex: genIndex } = parseGeneratorArg(argv.generator);
948546
+ await cliContext.runTask(async () => {
948547
+ await generateAPIWorkspaces({
948548
+ project: await loadProjectAndRegisterWorkspacesWithContext(cliContext, {
948549
+ commandLineApiWorkspace: argv.api,
948550
+ defaultToAllApiWorkspaces: false
948551
+ }),
948552
+ cliContext,
948553
+ version: argv.version,
948554
+ groupName: argv.group,
948555
+ generatorName: genName,
948556
+ generatorIndex: genIndex,
948557
+ shouldLogS3Url: false,
948558
+ keepDocker: false,
948559
+ useLocalDocker: false,
948560
+ preview: false,
948561
+ mode: void 0,
948562
+ force: true,
948563
+ runner: void 0,
948564
+ inspect: false,
948565
+ lfsOverride: void 0,
948566
+ fernignorePath: void 0,
948567
+ skipFernignore: false,
948568
+ dynamicIrOnly: false,
948569
+ outputDir: void 0,
948570
+ noReplay: false,
948571
+ retryRateLimited: false,
948572
+ requireEnvVars: false,
948573
+ automationMode: true,
948574
+ autoMerge: argv["auto-merge"]
948575
+ });
948576
+ });
948577
+ }
948578
+ );
948579
+ }
948187
948580
  function addSdkPreviewCommand(cli, cliContext) {
948188
948581
  cli.command(
948189
948582
  "preview",
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.65.3-5-gd8cee996921",
2
+ "version": "4.66.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",