@fern-api/fern-api-dev 5.14.1 → 5.15.0-1-g3bd6856f480
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +87 -59
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -310912,6 +310912,8 @@ var require_buildReplayTelemetryProps = __commonJS({
|
|
|
310912
310912
|
executed: replay?.executed ?? false,
|
|
310913
310913
|
flow: replay?.flow ?? null,
|
|
310914
310914
|
replay_crashed: replay?.replayCrashed === true,
|
|
310915
|
+
auto_bootstrapped: replay?.autoBootstrapped === true,
|
|
310916
|
+
bootstrap_attempted: replay?.bootstrapAttempted === true,
|
|
310915
310917
|
pipeline_success: pipelineResult.success,
|
|
310916
310918
|
pipeline_warnings_count: pipelineResult.warnings?.length ?? 0,
|
|
310917
310919
|
replay_warnings_count: replay?.warnings?.length ?? 0,
|
|
@@ -322399,11 +322401,39 @@ var require_replay_run = __commonJS({
|
|
|
322399
322401
|
var fs_1 = require("fs");
|
|
322400
322402
|
var path_1 = require("path");
|
|
322401
322403
|
var fernignore_1 = require_fernignore();
|
|
322402
|
-
async function replayPrepare(params2) {
|
|
322404
|
+
async function replayPrepare(params2, state) {
|
|
322403
322405
|
const { outputDir, cliVersion, generatorVersions, stageOnly = false, generatorName, skipApplication, logger: logger4 } = params2;
|
|
322404
322406
|
const lockfilePath = (0, path_1.join)(outputDir, ".fern", "replay.lock");
|
|
322407
|
+
let autoBootstrapped = false;
|
|
322408
|
+
let bootstrapAttempted = false;
|
|
322405
322409
|
if (!(0, fs_1.existsSync)(lockfilePath)) {
|
|
322406
|
-
|
|
322410
|
+
if (process.env.FERN_DISABLE_AUTO_BOOTSTRAP === "true" || process.env.FERN_DISABLE_AUTO_BOOTSTRAP === "1") {
|
|
322411
|
+
return null;
|
|
322412
|
+
}
|
|
322413
|
+
bootstrapAttempted = true;
|
|
322414
|
+
if (state) {
|
|
322415
|
+
state.bootstrapAttempted = true;
|
|
322416
|
+
}
|
|
322417
|
+
try {
|
|
322418
|
+
const bootstrapResult = await (0, replay_1.bootstrap)(outputDir, {
|
|
322419
|
+
fernignoreAction: "skip",
|
|
322420
|
+
force: false,
|
|
322421
|
+
importHistory: false
|
|
322422
|
+
});
|
|
322423
|
+
if (bootstrapResult.generationCommit == null) {
|
|
322424
|
+
return null;
|
|
322425
|
+
}
|
|
322426
|
+
autoBootstrapped = true;
|
|
322427
|
+
} catch (error50) {
|
|
322428
|
+
logger4?.warn("Replay auto-bootstrap failed, continuing without replay: " + String(error50));
|
|
322429
|
+
try {
|
|
322430
|
+
if ((0, fs_1.existsSync)(lockfilePath)) {
|
|
322431
|
+
(0, fs_1.unlinkSync)(lockfilePath);
|
|
322432
|
+
}
|
|
322433
|
+
} catch {
|
|
322434
|
+
}
|
|
322435
|
+
return null;
|
|
322436
|
+
}
|
|
322407
322437
|
}
|
|
322408
322438
|
const baseBranchHead = gitRevParse(outputDir, "HEAD");
|
|
322409
322439
|
let previousGenerationSha = null;
|
|
@@ -322477,7 +322507,9 @@ var require_replay_run = __commonJS({
|
|
|
322477
322507
|
flow: preparation.flow,
|
|
322478
322508
|
previousGenerationSha,
|
|
322479
322509
|
currentGenerationSha: preparation.currentGenerationSha,
|
|
322480
|
-
baseBranchHead
|
|
322510
|
+
baseBranchHead,
|
|
322511
|
+
autoBootstrapped,
|
|
322512
|
+
bootstrapAttempted
|
|
322481
322513
|
};
|
|
322482
322514
|
}
|
|
322483
322515
|
async function replayApply(prepared, params2 = {}) {
|
|
@@ -322493,6 +322525,8 @@ var require_replay_run = __commonJS({
|
|
|
322493
322525
|
previousGenerationSha: prepared.previousGenerationSha,
|
|
322494
322526
|
currentGenerationSha: prepared.currentGenerationSha,
|
|
322495
322527
|
baseBranchHead: prepared.baseBranchHead,
|
|
322528
|
+
autoBootstrapped: prepared.autoBootstrapped,
|
|
322529
|
+
bootstrapAttempted: prepared.bootstrapAttempted,
|
|
322496
322530
|
failureReason: String(error50)
|
|
322497
322531
|
};
|
|
322498
322532
|
}
|
|
@@ -322515,13 +322549,16 @@ var require_replay_run = __commonJS({
|
|
|
322515
322549
|
fernignoreUpdated,
|
|
322516
322550
|
previousGenerationSha: prepared.previousGenerationSha,
|
|
322517
322551
|
currentGenerationSha: prepared.currentGenerationSha,
|
|
322518
|
-
baseBranchHead: resolvedBaseBranchHead
|
|
322552
|
+
baseBranchHead: resolvedBaseBranchHead,
|
|
322553
|
+
autoBootstrapped: prepared.autoBootstrapped,
|
|
322554
|
+
bootstrapAttempted: prepared.bootstrapAttempted
|
|
322519
322555
|
};
|
|
322520
322556
|
}
|
|
322521
322557
|
async function replayRun(params2) {
|
|
322558
|
+
const prepareState = { bootstrapAttempted: false };
|
|
322522
322559
|
let prepared;
|
|
322523
322560
|
try {
|
|
322524
|
-
prepared = await replayPrepare(params2);
|
|
322561
|
+
prepared = await replayPrepare(params2, prepareState);
|
|
322525
322562
|
} catch (error50) {
|
|
322526
322563
|
return {
|
|
322527
322564
|
report: null,
|
|
@@ -322529,6 +322566,8 @@ var require_replay_run = __commonJS({
|
|
|
322529
322566
|
previousGenerationSha: null,
|
|
322530
322567
|
currentGenerationSha: null,
|
|
322531
322568
|
baseBranchHead: null,
|
|
322569
|
+
autoBootstrapped: false,
|
|
322570
|
+
bootstrapAttempted: prepareState.bootstrapAttempted,
|
|
322532
322571
|
failureReason: error50 instanceof ReplayPrepareError ? error50.reason : String(error50)
|
|
322533
322572
|
};
|
|
322534
322573
|
}
|
|
@@ -322538,7 +322577,9 @@ var require_replay_run = __commonJS({
|
|
|
322538
322577
|
fernignoreUpdated: false,
|
|
322539
322578
|
previousGenerationSha: null,
|
|
322540
322579
|
currentGenerationSha: null,
|
|
322541
|
-
baseBranchHead: null
|
|
322580
|
+
baseBranchHead: null,
|
|
322581
|
+
autoBootstrapped: false,
|
|
322582
|
+
bootstrapAttempted: prepareState.bootstrapAttempted
|
|
322542
322583
|
};
|
|
322543
322584
|
}
|
|
322544
322585
|
return replayApply(prepared, { stageOnly: params2.stageOnly, logger: params2.logger });
|
|
@@ -322630,6 +322671,7 @@ var require_GenerationCommitStep = __commonJS({
|
|
|
322630
322671
|
}
|
|
322631
322672
|
async execute(_context) {
|
|
322632
322673
|
const headBeforePrepare = tryRevParse(this.outputDir, "HEAD");
|
|
322674
|
+
const prepareState = { bootstrapAttempted: false };
|
|
322633
322675
|
let prepared;
|
|
322634
322676
|
try {
|
|
322635
322677
|
prepared = await (0, replay_run_1.replayPrepare)({
|
|
@@ -322639,7 +322681,7 @@ var require_GenerationCommitStep = __commonJS({
|
|
|
322639
322681
|
generatorName: this.generatorName,
|
|
322640
322682
|
skipApplication: this.config.skipApplication,
|
|
322641
322683
|
logger: this.logger
|
|
322642
|
-
});
|
|
322684
|
+
}, prepareState);
|
|
322643
322685
|
} catch (error50) {
|
|
322644
322686
|
const reason = error50 instanceof replay_run_1.ReplayPrepareError ? error50.reason : String(error50);
|
|
322645
322687
|
if (headBeforePrepare != null) {
|
|
@@ -322655,14 +322697,16 @@ var require_GenerationCommitStep = __commonJS({
|
|
|
322655
322697
|
executed: true,
|
|
322656
322698
|
success: true,
|
|
322657
322699
|
errorMessage: reason,
|
|
322658
|
-
preparedReplay: null
|
|
322700
|
+
preparedReplay: null,
|
|
322701
|
+
bootstrapAttempted: prepareState.bootstrapAttempted
|
|
322659
322702
|
};
|
|
322660
322703
|
}
|
|
322661
322704
|
if (prepared == null) {
|
|
322662
322705
|
return {
|
|
322663
322706
|
executed: true,
|
|
322664
322707
|
success: true,
|
|
322665
|
-
preparedReplay: null
|
|
322708
|
+
preparedReplay: null,
|
|
322709
|
+
bootstrapAttempted: prepareState.bootstrapAttempted
|
|
322666
322710
|
};
|
|
322667
322711
|
}
|
|
322668
322712
|
return {
|
|
@@ -322672,7 +322716,8 @@ var require_GenerationCommitStep = __commonJS({
|
|
|
322672
322716
|
previousGenerationSha: prepared.previousGenerationSha ?? void 0,
|
|
322673
322717
|
currentGenerationSha: prepared.currentGenerationSha,
|
|
322674
322718
|
baseBranchHead: prepared.baseBranchHead ?? void 0,
|
|
322675
|
-
flow: prepared.flow
|
|
322719
|
+
flow: prepared.flow,
|
|
322720
|
+
bootstrapAttempted: prepareState.bootstrapAttempted
|
|
322676
322721
|
};
|
|
322677
322722
|
}
|
|
322678
322723
|
};
|
|
@@ -327338,6 +327383,8 @@ var require_ReplayStep = __commonJS({
|
|
|
327338
327383
|
success: true,
|
|
327339
327384
|
replayCrashed: true,
|
|
327340
327385
|
errorMessage: generationCommit.errorMessage,
|
|
327386
|
+
autoBootstrapped: false,
|
|
327387
|
+
bootstrapAttempted: generationCommit.bootstrapAttempted === true,
|
|
327341
327388
|
flow: "normal-regeneration",
|
|
327342
327389
|
patchesDetected: 0,
|
|
327343
327390
|
patchesApplied: 0,
|
|
@@ -327348,6 +327395,8 @@ var require_ReplayStep = __commonJS({
|
|
|
327348
327395
|
return {
|
|
327349
327396
|
executed: true,
|
|
327350
327397
|
success: true,
|
|
327398
|
+
autoBootstrapped: false,
|
|
327399
|
+
bootstrapAttempted: generationCommit.bootstrapAttempted === true,
|
|
327351
327400
|
flow: "first-generation",
|
|
327352
327401
|
patchesDetected: 0,
|
|
327353
327402
|
patchesApplied: 0,
|
|
@@ -327375,6 +327424,8 @@ var require_ReplayStep = __commonJS({
|
|
|
327375
327424
|
previousGenerationSha: result.previousGenerationSha ?? void 0,
|
|
327376
327425
|
currentGenerationSha: result.currentGenerationSha ?? void 0,
|
|
327377
327426
|
baseBranchHead: result.baseBranchHead ?? void 0,
|
|
327427
|
+
autoBootstrapped: result.autoBootstrapped,
|
|
327428
|
+
bootstrapAttempted: result.bootstrapAttempted,
|
|
327378
327429
|
flow: "normal-regeneration",
|
|
327379
327430
|
patchesDetected: 0,
|
|
327380
327431
|
patchesApplied: 0,
|
|
@@ -327388,6 +327439,8 @@ var require_ReplayStep = __commonJS({
|
|
|
327388
327439
|
previousGenerationSha: result.previousGenerationSha ?? void 0,
|
|
327389
327440
|
currentGenerationSha: result.currentGenerationSha ?? void 0,
|
|
327390
327441
|
baseBranchHead: result.baseBranchHead ?? void 0,
|
|
327442
|
+
autoBootstrapped: result.autoBootstrapped,
|
|
327443
|
+
bootstrapAttempted: result.bootstrapAttempted,
|
|
327391
327444
|
flow: "first-generation",
|
|
327392
327445
|
patchesDetected: 0,
|
|
327393
327446
|
patchesApplied: 0,
|
|
@@ -327401,6 +327454,8 @@ var require_ReplayStep = __commonJS({
|
|
|
327401
327454
|
previousGenerationSha: result.previousGenerationSha ?? void 0,
|
|
327402
327455
|
currentGenerationSha: result.currentGenerationSha ?? void 0,
|
|
327403
327456
|
baseBranchHead: result.baseBranchHead ?? void 0,
|
|
327457
|
+
autoBootstrapped: result.autoBootstrapped,
|
|
327458
|
+
bootstrapAttempted: result.bootstrapAttempted,
|
|
327404
327459
|
flow: report.flow,
|
|
327405
327460
|
patchesDetected: report.patchesDetected,
|
|
327406
327461
|
patchesApplied: report.patchesApplied,
|
|
@@ -623478,7 +623533,7 @@ var AccessTokenPosthogManager = class {
|
|
|
623478
623533
|
properties: {
|
|
623479
623534
|
...event,
|
|
623480
623535
|
...event.properties,
|
|
623481
|
-
version: "5.
|
|
623536
|
+
version: "5.15.0-1-g3bd6856f480",
|
|
623482
623537
|
usingAccessToken: true
|
|
623483
623538
|
}
|
|
623484
623539
|
});
|
|
@@ -623527,17 +623582,16 @@ var UserPosthogManager = class {
|
|
|
623527
623582
|
}
|
|
623528
623583
|
}
|
|
623529
623584
|
async sendEvent(event) {
|
|
623530
|
-
const
|
|
623585
|
+
const userEmail = await this.getUserEmail();
|
|
623531
623586
|
this.posthog.capture({
|
|
623532
623587
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
623533
623588
|
event: "CLI",
|
|
623534
623589
|
properties: {
|
|
623535
|
-
version: "5.
|
|
623590
|
+
version: "5.15.0-1-g3bd6856f480",
|
|
623536
623591
|
...event,
|
|
623537
623592
|
...event.properties,
|
|
623538
623593
|
usingAccessToken: false,
|
|
623539
|
-
...userEmail != null ? { userEmail } : {}
|
|
623540
|
-
...orgId != null ? { org_id: orgId } : {}
|
|
623594
|
+
...userEmail != null ? { userEmail } : {}
|
|
623541
623595
|
}
|
|
623542
623596
|
});
|
|
623543
623597
|
}
|
|
@@ -623570,42 +623624,6 @@ var UserPosthogManager = class {
|
|
|
623570
623624
|
this.userEmail = null;
|
|
623571
623625
|
return void 0;
|
|
623572
623626
|
}
|
|
623573
|
-
/**
|
|
623574
|
-
* Cached primary `OrganizationId` for the current user. `null` is the
|
|
623575
|
-
* "tried and gave up" sentinel — distinct from `undefined` (not yet tried)
|
|
623576
|
-
* so subsequent `sendEvent` calls don't repeatedly hit venus when the user
|
|
623577
|
-
* has no orgs or the call failed.
|
|
623578
|
-
*
|
|
623579
|
-
* Picks the first org returned by `getOrgIdsFromToken`. Multi-org users
|
|
623580
|
-
* appear under their first org for adoption metrics — accurate enough for
|
|
623581
|
-
* dashboards, and matches autopilot's distinct-id pattern.
|
|
623582
|
-
*/
|
|
623583
|
-
orgId;
|
|
623584
|
-
async getPrimaryOrgId() {
|
|
623585
|
-
if (this.orgId === null) {
|
|
623586
|
-
return void 0;
|
|
623587
|
-
}
|
|
623588
|
-
if (this.orgId != null) {
|
|
623589
|
-
return this.orgId;
|
|
623590
|
-
}
|
|
623591
|
-
if (this.token == null) {
|
|
623592
|
-
this.orgId = null;
|
|
623593
|
-
return void 0;
|
|
623594
|
-
}
|
|
623595
|
-
try {
|
|
623596
|
-
const response = await createVenusService({ token: this.token.value }).organization.getOrgIdsFromToken();
|
|
623597
|
-
if (response.ok && response.body.length > 0) {
|
|
623598
|
-
const first3 = response.body[0];
|
|
623599
|
-
if (first3 != null) {
|
|
623600
|
-
this.orgId = first3;
|
|
623601
|
-
return this.orgId;
|
|
623602
|
-
}
|
|
623603
|
-
}
|
|
623604
|
-
} catch {
|
|
623605
|
-
}
|
|
623606
|
-
this.orgId = null;
|
|
623607
|
-
return void 0;
|
|
623608
|
-
}
|
|
623609
623627
|
persistedDistinctId;
|
|
623610
623628
|
async getPersistedDistinctId() {
|
|
623611
623629
|
if (this.persistedDistinctId == null) {
|
|
@@ -848520,7 +848538,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
848520
848538
|
var LOGS_FOLDER_NAME = "logs";
|
|
848521
848539
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
848522
848540
|
function getCliSource() {
|
|
848523
|
-
const version7 = "5.
|
|
848541
|
+
const version7 = "5.15.0-1-g3bd6856f480";
|
|
848524
848542
|
return `cli@${version7}`;
|
|
848525
848543
|
}
|
|
848526
848544
|
var DebugLogger = class {
|
|
@@ -859190,11 +859208,16 @@ var RemoteTaskHandler = class {
|
|
|
859190
859208
|
// the dashboard plan — would require structural change.
|
|
859191
859209
|
durationMs: Date.now() - this.taskStartedAtMs
|
|
859192
859210
|
});
|
|
859211
|
+
const propsWithOverlay = {
|
|
859212
|
+
...props,
|
|
859213
|
+
surface: "fiddle",
|
|
859214
|
+
org_id: this.telemetryContext.orgId
|
|
859215
|
+
};
|
|
859193
859216
|
this.context.instrumentPostHogEvent({
|
|
859194
859217
|
command: "replay",
|
|
859195
|
-
properties:
|
|
859218
|
+
properties: propsWithOverlay
|
|
859196
859219
|
});
|
|
859197
|
-
this.context.logger.debug(`[telemetry] replay event sent: ${JSON.stringify(
|
|
859220
|
+
this.context.logger.debug(`[telemetry] replay event sent: ${JSON.stringify(propsWithOverlay)}`);
|
|
859198
859221
|
this.replayEventEmitted = true;
|
|
859199
859222
|
} catch (error50) {
|
|
859200
859223
|
this.context.logger.debug(`[telemetry] failed to send replay event: ${String(error50)}`);
|
|
@@ -859743,6 +859766,7 @@ async function runRemoteGenerationForGenerator({ projectConfig, organization, wo
|
|
|
859743
859766
|
absolutePathToPreview,
|
|
859744
859767
|
telemetryContext: {
|
|
859745
859768
|
cliVersion: workspace.cliVersion,
|
|
859769
|
+
orgId: projectConfig.organization,
|
|
859746
859770
|
automationMode: automationMode === true,
|
|
859747
859771
|
autoMerge: autoMerge === true,
|
|
859748
859772
|
skipIfNoDiff: skipIfNoDiff === true,
|
|
@@ -861319,7 +861343,7 @@ var LegacyDocsPublisher = class {
|
|
|
861319
861343
|
previewId,
|
|
861320
861344
|
disableTemplates: void 0,
|
|
861321
861345
|
skipUpload,
|
|
861322
|
-
cliVersion: "5.
|
|
861346
|
+
cliVersion: "5.15.0-1-g3bd6856f480",
|
|
861323
861347
|
loginCommand: "fern auth login"
|
|
861324
861348
|
});
|
|
861325
861349
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -914156,12 +914180,16 @@ generators:
|
|
|
914156
914180
|
previewMode: selfhostedGithubConfig.previewMode === true,
|
|
914157
914181
|
durationMs: pipelineDurationMs
|
|
914158
914182
|
});
|
|
914159
|
-
const
|
|
914183
|
+
const propsWithOverlay = {
|
|
914184
|
+
...replayTelemetryProps,
|
|
914185
|
+
surface: "cli",
|
|
914186
|
+
org_id: projectConfig.organization
|
|
914187
|
+
};
|
|
914160
914188
|
interactiveTaskContext.instrumentPostHogEvent({
|
|
914161
914189
|
command: "replay",
|
|
914162
|
-
properties:
|
|
914190
|
+
properties: propsWithOverlay
|
|
914163
914191
|
});
|
|
914164
|
-
interactiveTaskContext.logger.debug(`[telemetry] replay event sent: ${JSON.stringify(
|
|
914192
|
+
interactiveTaskContext.logger.debug(`[telemetry] replay event sent: ${JSON.stringify(propsWithOverlay)}`);
|
|
914165
914193
|
} catch (error50) {
|
|
914166
914194
|
interactiveTaskContext.logger.debug(`[telemetry] failed to send replay event: ${String(error50)}`);
|
|
914167
914195
|
}
|
|
@@ -935840,7 +935868,7 @@ var CliContext = class _CliContext {
|
|
|
935840
935868
|
if (false) {
|
|
935841
935869
|
this.logger.error("CLI_VERSION is not defined");
|
|
935842
935870
|
}
|
|
935843
|
-
return "5.
|
|
935871
|
+
return "5.15.0-1-g3bd6856f480";
|
|
935844
935872
|
}
|
|
935845
935873
|
getCliName() {
|
|
935846
935874
|
if (false) {
|
package/package.json
CHANGED