@fern-api/generator-cli 0.9.22 → 0.9.23
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/dist/api.d.ts +7 -1
- package/dist/api.js +45 -13
- package/dist/cli.js +205 -57
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -572,7 +572,7 @@ interface ReplayRunParams {
|
|
|
572
572
|
logger?: PipelineLogger;
|
|
573
573
|
}
|
|
574
574
|
interface ReplayRunResult {
|
|
575
|
-
/** null if replay wasn't initialized (no lockfile) */
|
|
575
|
+
/** null if replay wasn't initialized (no lockfile) OR if prepare/apply crashed (see failureReason) */
|
|
576
576
|
report: ReplayReport | null;
|
|
577
577
|
/** Whether .fernignore was updated */
|
|
578
578
|
fernignoreUpdated: boolean;
|
|
@@ -582,6 +582,12 @@ interface ReplayRunResult {
|
|
|
582
582
|
currentGenerationSha: string | null;
|
|
583
583
|
/** SHA of main's HEAD before replay ran. Always on main's lineage, stable after squash merges. */
|
|
584
584
|
baseBranchHead: string | null;
|
|
585
|
+
/**
|
|
586
|
+
* Set when prepare or apply crashed (e.g. corrupted lockfile, git failure, library bug).
|
|
587
|
+
* Distinguishes a real failure from "no replay initialized" (lockfile missing → null report, no failureReason).
|
|
588
|
+
* Generation never fails on replay errors — callers should surface this for telemetry/logging only.
|
|
589
|
+
*/
|
|
590
|
+
failureReason?: string;
|
|
585
591
|
}
|
|
586
592
|
/**
|
|
587
593
|
* Backwards-compatible atomic entry point. Composes `replayPrepare` +
|
package/dist/api.js
CHANGED
|
@@ -6173,7 +6173,9 @@ function newRepositoryReference({ remote, owner, repo }) {
|
|
|
6173
6173
|
repoUrl,
|
|
6174
6174
|
cloneUrl,
|
|
6175
6175
|
getAuthedCloneUrl: (installationToken) => {
|
|
6176
|
-
|
|
6176
|
+
const isInstallationToken = installationToken.startsWith("ghs_") || installationToken.startsWith("ghu_");
|
|
6177
|
+
const userPrefix = isInstallationToken ? "x-access-token:" : "";
|
|
6178
|
+
return cloneUrl.replace("https://", `https://${userPrefix}${installationToken}@`);
|
|
6177
6179
|
}
|
|
6178
6180
|
};
|
|
6179
6181
|
}
|
|
@@ -9894,7 +9896,7 @@ function cwd() {
|
|
|
9894
9896
|
// ../commons/fs-utils/lib/resolve.js
|
|
9895
9897
|
var import_path2 = __toESM(require("path"), 1);
|
|
9896
9898
|
function resolve2(...paths) {
|
|
9897
|
-
return import_path2.default.resolve(...paths.map(convertToOsPath));
|
|
9899
|
+
return convertToOsPath(import_path2.default.resolve(...paths.map(convertToOsPath)));
|
|
9898
9900
|
}
|
|
9899
9901
|
|
|
9900
9902
|
// src/github/GitHub.ts
|
|
@@ -10295,12 +10297,17 @@ async function replayPrepare(params) {
|
|
|
10295
10297
|
`fern-generation-base tag ${tagSha} is not reachable from HEAD \u2014 skipping divergent-merge sync. The tag likely points at an unmerged generation (PR closed without merge).`
|
|
10296
10298
|
);
|
|
10297
10299
|
} else {
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10300
|
+
try {
|
|
10301
|
+
const syncService = new import_replay4.ReplayService(outputDir, { enabled: true });
|
|
10302
|
+
await syncService.syncFromDivergentMerge(tagSha, {
|
|
10303
|
+
cliVersion,
|
|
10304
|
+
generatorVersions,
|
|
10305
|
+
baseBranchHead: baseBranchHead ?? void 0
|
|
10306
|
+
});
|
|
10307
|
+
} catch (error) {
|
|
10308
|
+
logger?.warn("Replay divergent-merge sync failed, continuing without sync: " + String(error));
|
|
10309
|
+
throw new ReplayPrepareError(String(error), error);
|
|
10310
|
+
}
|
|
10304
10311
|
try {
|
|
10305
10312
|
const freshLockManager = new import_replay4.LockfileManager(outputDir);
|
|
10306
10313
|
if (freshLockManager.exists()) {
|
|
@@ -10322,8 +10329,8 @@ async function replayPrepare(params) {
|
|
|
10322
10329
|
baseBranchHead: baseBranchHead ?? void 0
|
|
10323
10330
|
});
|
|
10324
10331
|
} catch (error) {
|
|
10325
|
-
logger?.warn("Replay failed, continuing without replay: " + String(error));
|
|
10326
|
-
|
|
10332
|
+
logger?.warn("Replay prepare failed, continuing without replay: " + String(error));
|
|
10333
|
+
throw new ReplayPrepareError(String(error), error);
|
|
10327
10334
|
}
|
|
10328
10335
|
return {
|
|
10329
10336
|
_service: service,
|
|
@@ -10341,13 +10348,14 @@ async function replayApply(prepared, params = {}) {
|
|
|
10341
10348
|
try {
|
|
10342
10349
|
report = await prepared._service.applyPreparedReplay(prepared._preparation, { stageOnly });
|
|
10343
10350
|
} catch (error) {
|
|
10344
|
-
logger?.warn("Replay failed, continuing without replay: " + String(error));
|
|
10351
|
+
logger?.warn("Replay apply failed, continuing without replay: " + String(error));
|
|
10345
10352
|
return {
|
|
10346
10353
|
report: null,
|
|
10347
10354
|
fernignoreUpdated: false,
|
|
10348
10355
|
previousGenerationSha: prepared.previousGenerationSha,
|
|
10349
10356
|
currentGenerationSha: prepared.currentGenerationSha,
|
|
10350
|
-
baseBranchHead: prepared.baseBranchHead
|
|
10357
|
+
baseBranchHead: prepared.baseBranchHead,
|
|
10358
|
+
failureReason: String(error)
|
|
10351
10359
|
};
|
|
10352
10360
|
}
|
|
10353
10361
|
let resolvedBaseBranchHead = prepared.baseBranchHead;
|
|
@@ -10373,7 +10381,19 @@ async function replayApply(prepared, params = {}) {
|
|
|
10373
10381
|
};
|
|
10374
10382
|
}
|
|
10375
10383
|
async function replayRun(params) {
|
|
10376
|
-
|
|
10384
|
+
let prepared;
|
|
10385
|
+
try {
|
|
10386
|
+
prepared = await replayPrepare(params);
|
|
10387
|
+
} catch (error) {
|
|
10388
|
+
return {
|
|
10389
|
+
report: null,
|
|
10390
|
+
fernignoreUpdated: false,
|
|
10391
|
+
previousGenerationSha: null,
|
|
10392
|
+
currentGenerationSha: null,
|
|
10393
|
+
baseBranchHead: null,
|
|
10394
|
+
failureReason: error instanceof ReplayPrepareError ? error.reason : String(error)
|
|
10395
|
+
};
|
|
10396
|
+
}
|
|
10377
10397
|
if (prepared == null) {
|
|
10378
10398
|
return {
|
|
10379
10399
|
report: null,
|
|
@@ -10385,6 +10405,18 @@ async function replayRun(params) {
|
|
|
10385
10405
|
}
|
|
10386
10406
|
return replayApply(prepared, { stageOnly: params.stageOnly, logger: params.logger });
|
|
10387
10407
|
}
|
|
10408
|
+
var ReplayPrepareError = class extends Error {
|
|
10409
|
+
reason;
|
|
10410
|
+
constructor(reason, cause) {
|
|
10411
|
+
super(`Replay prepare failed: ${reason}`, { cause });
|
|
10412
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
10413
|
+
if (Error.captureStackTrace) {
|
|
10414
|
+
Error.captureStackTrace(this, this.constructor);
|
|
10415
|
+
}
|
|
10416
|
+
this.name = this.constructor.name;
|
|
10417
|
+
this.reason = reason;
|
|
10418
|
+
}
|
|
10419
|
+
};
|
|
10388
10420
|
function isTagMergedIntoHead(cwd2, tagSha) {
|
|
10389
10421
|
try {
|
|
10390
10422
|
(0, import_child_process3.execFileSync)("git", ["merge-base", "--is-ancestor", tagSha, "HEAD"], {
|
package/dist/cli.js
CHANGED
|
@@ -29211,11 +29211,11 @@ var VersionBump2;
|
|
|
29211
29211
|
var init_types = __esm({
|
|
29212
29212
|
"../cli/ai/lib/baml_client/types.js"() {
|
|
29213
29213
|
"use strict";
|
|
29214
|
-
(function(
|
|
29215
|
-
|
|
29216
|
-
|
|
29217
|
-
|
|
29218
|
-
|
|
29214
|
+
(function(VersionBump4) {
|
|
29215
|
+
VersionBump4["MAJOR"] = "MAJOR";
|
|
29216
|
+
VersionBump4["MINOR"] = "MINOR";
|
|
29217
|
+
VersionBump4["PATCH"] = "PATCH";
|
|
29218
|
+
VersionBump4["NO_CHANGE"] = "NO_CHANGE";
|
|
29219
29219
|
})(VersionBump2 || (VersionBump2 = {}));
|
|
29220
29220
|
}
|
|
29221
29221
|
});
|
|
@@ -29245,6 +29245,24 @@ var init_watchers = __esm({
|
|
|
29245
29245
|
});
|
|
29246
29246
|
|
|
29247
29247
|
// ../cli/ai/lib/baml_client/index.js
|
|
29248
|
+
var baml_client_exports = {};
|
|
29249
|
+
__export(baml_client_exports, {
|
|
29250
|
+
BamlClientFinishReasonError: () => import_baml6.BamlClientFinishReasonError,
|
|
29251
|
+
BamlClientHttpError: () => import_baml6.BamlClientHttpError,
|
|
29252
|
+
BamlValidationError: () => import_baml6.BamlValidationError,
|
|
29253
|
+
VersionBump: () => VersionBump2,
|
|
29254
|
+
all_succeeded: () => all_succeeded,
|
|
29255
|
+
b: () => b2,
|
|
29256
|
+
flush: () => flush,
|
|
29257
|
+
get_checks: () => get_checks,
|
|
29258
|
+
onLogEvent: () => onLogEvent,
|
|
29259
|
+
resetBamlEnvVars: () => resetBamlEnvVars,
|
|
29260
|
+
setTags: () => setTags,
|
|
29261
|
+
traceAsync: () => traceAsync,
|
|
29262
|
+
traceSync: () => traceSync,
|
|
29263
|
+
version: () => version,
|
|
29264
|
+
watchers: () => watchers_exports
|
|
29265
|
+
});
|
|
29248
29266
|
var import_baml5, import_baml6, version;
|
|
29249
29267
|
var init_baml_client = __esm({
|
|
29250
29268
|
"../cli/ai/lib/baml_client/index.js"() {
|
|
@@ -29262,6 +29280,10 @@ var init_baml_client = __esm({
|
|
|
29262
29280
|
});
|
|
29263
29281
|
|
|
29264
29282
|
// ../cli/ai/lib/configureBamlClient.js
|
|
29283
|
+
var configureBamlClient_exports = {};
|
|
29284
|
+
__export(configureBamlClient_exports, {
|
|
29285
|
+
configureBamlClient: () => configureBamlClient
|
|
29286
|
+
});
|
|
29265
29287
|
function configureBamlClient(config) {
|
|
29266
29288
|
const registry = new import_baml7.ClientRegistry();
|
|
29267
29289
|
const clientOptions = {
|
|
@@ -29282,31 +29304,59 @@ var init_configureBamlClient = __esm({
|
|
|
29282
29304
|
}
|
|
29283
29305
|
});
|
|
29284
29306
|
|
|
29307
|
+
// ../cli/ai/lib/loader.js
|
|
29308
|
+
async function loadBamlDependencies() {
|
|
29309
|
+
try {
|
|
29310
|
+
const [baml, bamlClient, config] = await Promise.all([
|
|
29311
|
+
import("@boundaryml/baml"),
|
|
29312
|
+
Promise.resolve().then(() => (init_baml_client(), baml_client_exports)),
|
|
29313
|
+
Promise.resolve().then(() => (init_configureBamlClient(), configureBamlClient_exports))
|
|
29314
|
+
]);
|
|
29315
|
+
return {
|
|
29316
|
+
ClientRegistry: baml.ClientRegistry,
|
|
29317
|
+
BamlClient: bamlClient.b,
|
|
29318
|
+
configureBamlClient: config.configureBamlClient
|
|
29319
|
+
};
|
|
29320
|
+
} catch (error) {
|
|
29321
|
+
const original = error instanceof Error ? error.message : String(error);
|
|
29322
|
+
throw new Error(`${INSTALL_MESSAGE}
|
|
29323
|
+
|
|
29324
|
+
Original error: ${original}`);
|
|
29325
|
+
}
|
|
29326
|
+
}
|
|
29327
|
+
var INSTALL_MESSAGE;
|
|
29328
|
+
var init_loader = __esm({
|
|
29329
|
+
"../cli/ai/lib/loader.js"() {
|
|
29330
|
+
"use strict";
|
|
29331
|
+
INSTALL_MESSAGE = "@boundaryml/baml is required for AI features (auto-versioning, sdk-diff).\nInstall it with:\n npm install @boundaryml/baml\n pnpm add @boundaryml/baml";
|
|
29332
|
+
}
|
|
29333
|
+
});
|
|
29334
|
+
|
|
29335
|
+
// ../cli/ai/lib/types.js
|
|
29336
|
+
var VersionBump3;
|
|
29337
|
+
var init_types2 = __esm({
|
|
29338
|
+
"../cli/ai/lib/types.js"() {
|
|
29339
|
+
"use strict";
|
|
29340
|
+
(function(VersionBump4) {
|
|
29341
|
+
VersionBump4["MAJOR"] = "MAJOR";
|
|
29342
|
+
VersionBump4["MINOR"] = "MINOR";
|
|
29343
|
+
VersionBump4["PATCH"] = "PATCH";
|
|
29344
|
+
VersionBump4["NO_CHANGE"] = "NO_CHANGE";
|
|
29345
|
+
})(VersionBump3 || (VersionBump3 = {}));
|
|
29346
|
+
}
|
|
29347
|
+
});
|
|
29348
|
+
|
|
29285
29349
|
// ../cli/ai/lib/index.js
|
|
29286
29350
|
var lib_exports = {};
|
|
29287
29351
|
__export(lib_exports, {
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
BamlValidationError: () => import_baml6.BamlValidationError,
|
|
29291
|
-
VersionBump: () => VersionBump2,
|
|
29292
|
-
all_succeeded: () => all_succeeded,
|
|
29293
|
-
b: () => b2,
|
|
29294
|
-
configureBamlClient: () => configureBamlClient,
|
|
29295
|
-
flush: () => flush,
|
|
29296
|
-
get_checks: () => get_checks,
|
|
29297
|
-
onLogEvent: () => onLogEvent,
|
|
29298
|
-
resetBamlEnvVars: () => resetBamlEnvVars,
|
|
29299
|
-
setTags: () => setTags,
|
|
29300
|
-
traceAsync: () => traceAsync,
|
|
29301
|
-
traceSync: () => traceSync,
|
|
29302
|
-
version: () => version,
|
|
29303
|
-
watchers: () => watchers_exports
|
|
29352
|
+
VersionBump: () => VersionBump3,
|
|
29353
|
+
loadBamlDependencies: () => loadBamlDependencies
|
|
29304
29354
|
});
|
|
29305
29355
|
var init_lib = __esm({
|
|
29306
29356
|
"../cli/ai/lib/index.js"() {
|
|
29307
29357
|
"use strict";
|
|
29308
|
-
|
|
29309
|
-
|
|
29358
|
+
init_loader();
|
|
29359
|
+
init_types2();
|
|
29310
29360
|
}
|
|
29311
29361
|
});
|
|
29312
29362
|
|
|
@@ -29355,7 +29405,7 @@ async function doesPathExist(filepath, mode) {
|
|
|
29355
29405
|
// ../commons/fs-utils/lib/resolve.js
|
|
29356
29406
|
var import_path = __toESM(require("path"), 1);
|
|
29357
29407
|
function resolve(...paths) {
|
|
29358
|
-
return import_path.default.resolve(...paths.map(convertToOsPath));
|
|
29408
|
+
return convertToOsPath(import_path.default.resolve(...paths.map(convertToOsPath)));
|
|
29359
29409
|
}
|
|
29360
29410
|
|
|
29361
29411
|
// src/cli.ts
|
|
@@ -31347,7 +31397,9 @@ function newRepositoryReference({ remote, owner, repo }) {
|
|
|
31347
31397
|
repoUrl,
|
|
31348
31398
|
cloneUrl,
|
|
31349
31399
|
getAuthedCloneUrl: (installationToken) => {
|
|
31350
|
-
|
|
31400
|
+
const isInstallationToken = installationToken.startsWith("ghs_") || installationToken.startsWith("ghu_");
|
|
31401
|
+
const userPrefix = isInstallationToken ? "x-access-token:" : "";
|
|
31402
|
+
return cloneUrl.replace("https://", `https://${userPrefix}${installationToken}@`);
|
|
31351
31403
|
}
|
|
31352
31404
|
};
|
|
31353
31405
|
}
|
|
@@ -39298,12 +39350,17 @@ async function replayPrepare(params) {
|
|
|
39298
39350
|
`fern-generation-base tag ${tagSha} is not reachable from HEAD \u2014 skipping divergent-merge sync. The tag likely points at an unmerged generation (PR closed without merge).`
|
|
39299
39351
|
);
|
|
39300
39352
|
} else {
|
|
39301
|
-
|
|
39302
|
-
|
|
39303
|
-
|
|
39304
|
-
|
|
39305
|
-
|
|
39306
|
-
|
|
39353
|
+
try {
|
|
39354
|
+
const syncService = new ReplayService(outputDir, { enabled: true });
|
|
39355
|
+
await syncService.syncFromDivergentMerge(tagSha, {
|
|
39356
|
+
cliVersion,
|
|
39357
|
+
generatorVersions,
|
|
39358
|
+
baseBranchHead: baseBranchHead ?? void 0
|
|
39359
|
+
});
|
|
39360
|
+
} catch (error) {
|
|
39361
|
+
logger?.warn("Replay divergent-merge sync failed, continuing without sync: " + String(error));
|
|
39362
|
+
throw new ReplayPrepareError(String(error), error);
|
|
39363
|
+
}
|
|
39307
39364
|
try {
|
|
39308
39365
|
const freshLockManager = new LockfileManager(outputDir);
|
|
39309
39366
|
if (freshLockManager.exists()) {
|
|
@@ -39325,8 +39382,8 @@ async function replayPrepare(params) {
|
|
|
39325
39382
|
baseBranchHead: baseBranchHead ?? void 0
|
|
39326
39383
|
});
|
|
39327
39384
|
} catch (error) {
|
|
39328
|
-
logger?.warn("Replay failed, continuing without replay: " + String(error));
|
|
39329
|
-
|
|
39385
|
+
logger?.warn("Replay prepare failed, continuing without replay: " + String(error));
|
|
39386
|
+
throw new ReplayPrepareError(String(error), error);
|
|
39330
39387
|
}
|
|
39331
39388
|
return {
|
|
39332
39389
|
_service: service,
|
|
@@ -39344,13 +39401,14 @@ async function replayApply(prepared, params = {}) {
|
|
|
39344
39401
|
try {
|
|
39345
39402
|
report = await prepared._service.applyPreparedReplay(prepared._preparation, { stageOnly });
|
|
39346
39403
|
} catch (error) {
|
|
39347
|
-
logger?.warn("Replay failed, continuing without replay: " + String(error));
|
|
39404
|
+
logger?.warn("Replay apply failed, continuing without replay: " + String(error));
|
|
39348
39405
|
return {
|
|
39349
39406
|
report: null,
|
|
39350
39407
|
fernignoreUpdated: false,
|
|
39351
39408
|
previousGenerationSha: prepared.previousGenerationSha,
|
|
39352
39409
|
currentGenerationSha: prepared.currentGenerationSha,
|
|
39353
|
-
baseBranchHead: prepared.baseBranchHead
|
|
39410
|
+
baseBranchHead: prepared.baseBranchHead,
|
|
39411
|
+
failureReason: String(error)
|
|
39354
39412
|
};
|
|
39355
39413
|
}
|
|
39356
39414
|
let resolvedBaseBranchHead = prepared.baseBranchHead;
|
|
@@ -39376,7 +39434,19 @@ async function replayApply(prepared, params = {}) {
|
|
|
39376
39434
|
};
|
|
39377
39435
|
}
|
|
39378
39436
|
async function replayRun(params) {
|
|
39379
|
-
|
|
39437
|
+
let prepared;
|
|
39438
|
+
try {
|
|
39439
|
+
prepared = await replayPrepare(params);
|
|
39440
|
+
} catch (error) {
|
|
39441
|
+
return {
|
|
39442
|
+
report: null,
|
|
39443
|
+
fernignoreUpdated: false,
|
|
39444
|
+
previousGenerationSha: null,
|
|
39445
|
+
currentGenerationSha: null,
|
|
39446
|
+
baseBranchHead: null,
|
|
39447
|
+
failureReason: error instanceof ReplayPrepareError ? error.reason : String(error)
|
|
39448
|
+
};
|
|
39449
|
+
}
|
|
39380
39450
|
if (prepared == null) {
|
|
39381
39451
|
return {
|
|
39382
39452
|
report: null,
|
|
@@ -39388,6 +39458,18 @@ async function replayRun(params) {
|
|
|
39388
39458
|
}
|
|
39389
39459
|
return replayApply(prepared, { stageOnly: params.stageOnly, logger: params.logger });
|
|
39390
39460
|
}
|
|
39461
|
+
var ReplayPrepareError = class extends Error {
|
|
39462
|
+
reason;
|
|
39463
|
+
constructor(reason, cause) {
|
|
39464
|
+
super(`Replay prepare failed: ${reason}`, { cause });
|
|
39465
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
39466
|
+
if (Error.captureStackTrace) {
|
|
39467
|
+
Error.captureStackTrace(this, this.constructor);
|
|
39468
|
+
}
|
|
39469
|
+
this.name = this.constructor.name;
|
|
39470
|
+
this.reason = reason;
|
|
39471
|
+
}
|
|
39472
|
+
};
|
|
39391
39473
|
function isTagMergedIntoHead(cwd2, tagSha) {
|
|
39392
39474
|
try {
|
|
39393
39475
|
(0, import_child_process4.execFileSync)("git", ["merge-base", "--is-ancestor", tagSha, "HEAD"], {
|
|
@@ -39482,7 +39564,7 @@ var consolePipelineLogger = {
|
|
|
39482
39564
|
};
|
|
39483
39565
|
|
|
39484
39566
|
// src/pipeline/PostGenerationPipeline.ts
|
|
39485
|
-
var
|
|
39567
|
+
var import_child_process7 = require("child_process");
|
|
39486
39568
|
|
|
39487
39569
|
// src/pipeline/github/constants.ts
|
|
39488
39570
|
var FERN_BOT_NAME2 = "fern-api";
|
|
@@ -40810,7 +40892,7 @@ ${newBlock}${remainder}`;
|
|
|
40810
40892
|
return `${message.trimEnd()}${FERN_TRAILER}`;
|
|
40811
40893
|
}
|
|
40812
40894
|
async analyzeSingle(cleanedDiff, language, previousVersion) {
|
|
40813
|
-
const { client, VersionBump:
|
|
40895
|
+
const { client, VersionBump: VersionBump4 } = await this.loadBaml();
|
|
40814
40896
|
const result = await client.AnalyzeSdkDiff(
|
|
40815
40897
|
cleanedDiff,
|
|
40816
40898
|
language,
|
|
@@ -40818,7 +40900,7 @@ ${newBlock}${remainder}`;
|
|
|
40818
40900
|
this.config.priorChangelog ?? "",
|
|
40819
40901
|
this.config.specCommitMessage ?? ""
|
|
40820
40902
|
);
|
|
40821
|
-
if (result.version_bump ===
|
|
40903
|
+
if (result.version_bump === VersionBump4.NO_CHANGE) {
|
|
40822
40904
|
return null;
|
|
40823
40905
|
}
|
|
40824
40906
|
return {
|
|
@@ -40829,8 +40911,8 @@ ${newBlock}${remainder}`;
|
|
|
40829
40911
|
};
|
|
40830
40912
|
}
|
|
40831
40913
|
async analyzeChunks(chunks, language, previousVersion) {
|
|
40832
|
-
const { client, VersionBump:
|
|
40833
|
-
let bestBump =
|
|
40914
|
+
const { client, VersionBump: VersionBump4 } = await this.loadBaml();
|
|
40915
|
+
let bestBump = VersionBump4.NO_CHANGE;
|
|
40834
40916
|
let bestMessage = "";
|
|
40835
40917
|
let bestVersionBumpReason;
|
|
40836
40918
|
const changelogEntries = [];
|
|
@@ -40846,7 +40928,7 @@ ${newBlock}${remainder}`;
|
|
|
40846
40928
|
this.config.priorChangelog ?? "",
|
|
40847
40929
|
this.config.specCommitMessage ?? ""
|
|
40848
40930
|
);
|
|
40849
|
-
if (analysis.version_bump ===
|
|
40931
|
+
if (analysis.version_bump === VersionBump4.NO_CHANGE) {
|
|
40850
40932
|
continue;
|
|
40851
40933
|
}
|
|
40852
40934
|
const prev = bestBump;
|
|
@@ -40860,7 +40942,7 @@ ${newBlock}${remainder}`;
|
|
|
40860
40942
|
changelogEntries.push(entry);
|
|
40861
40943
|
}
|
|
40862
40944
|
}
|
|
40863
|
-
if (bestBump ===
|
|
40945
|
+
if (bestBump === VersionBump4.NO_CHANGE) {
|
|
40864
40946
|
return null;
|
|
40865
40947
|
}
|
|
40866
40948
|
if (changelogEntries.length <= 1) {
|
|
@@ -40907,11 +40989,12 @@ ${newBlock}${remainder}`;
|
|
|
40907
40989
|
if (this.config.ai == null) {
|
|
40908
40990
|
throw new Error("AutoVersionStep: ai config is missing. Set autoVersion.ai to a BAML provider+model pair.");
|
|
40909
40991
|
}
|
|
40910
|
-
const
|
|
40911
|
-
const
|
|
40992
|
+
const { loadBamlDependencies: loadBamlDependencies2, VersionBump: VersionBump4 } = await Promise.resolve().then(() => (init_lib(), lib_exports));
|
|
40993
|
+
const { BamlClient, configureBamlClient: configureBamlClient2 } = await loadBamlDependencies2();
|
|
40994
|
+
const registry = configureBamlClient2(this.config.ai);
|
|
40912
40995
|
return {
|
|
40913
|
-
client:
|
|
40914
|
-
VersionBump:
|
|
40996
|
+
client: BamlClient.withOptions({ clientRegistry: registry }),
|
|
40997
|
+
VersionBump: VersionBump4
|
|
40915
40998
|
};
|
|
40916
40999
|
}
|
|
40917
41000
|
/**
|
|
@@ -40938,6 +41021,7 @@ ${newBlock}${remainder}`;
|
|
|
40938
41021
|
};
|
|
40939
41022
|
|
|
40940
41023
|
// src/pipeline/steps/GenerationCommitStep.ts
|
|
41024
|
+
var import_child_process6 = require("child_process");
|
|
40941
41025
|
var GenerationCommitStep = class extends BaseStep {
|
|
40942
41026
|
constructor(outputDir, logger, config, cliVersion, generatorVersions, generatorName) {
|
|
40943
41027
|
super(outputDir, logger);
|
|
@@ -40952,14 +41036,35 @@ var GenerationCommitStep = class extends BaseStep {
|
|
|
40952
41036
|
generatorName;
|
|
40953
41037
|
name = "generationCommit";
|
|
40954
41038
|
async execute(_context) {
|
|
40955
|
-
const
|
|
40956
|
-
|
|
40957
|
-
|
|
40958
|
-
|
|
40959
|
-
|
|
40960
|
-
|
|
40961
|
-
|
|
40962
|
-
|
|
41039
|
+
const headBeforePrepare = tryRevParse(this.outputDir, "HEAD");
|
|
41040
|
+
let prepared;
|
|
41041
|
+
try {
|
|
41042
|
+
prepared = await replayPrepare({
|
|
41043
|
+
outputDir: this.outputDir,
|
|
41044
|
+
cliVersion: this.cliVersion,
|
|
41045
|
+
generatorVersions: this.generatorVersions,
|
|
41046
|
+
generatorName: this.generatorName,
|
|
41047
|
+
skipApplication: this.config.skipApplication,
|
|
41048
|
+
logger: this.logger
|
|
41049
|
+
});
|
|
41050
|
+
} catch (error) {
|
|
41051
|
+
const reason = error instanceof ReplayPrepareError ? error.reason : String(error);
|
|
41052
|
+
if (headBeforePrepare != null) {
|
|
41053
|
+
try {
|
|
41054
|
+
(0, import_child_process6.execFileSync)("git", ["reset", "--hard", headBeforePrepare], {
|
|
41055
|
+
cwd: this.outputDir,
|
|
41056
|
+
stdio: "pipe"
|
|
41057
|
+
});
|
|
41058
|
+
} catch {
|
|
41059
|
+
}
|
|
41060
|
+
}
|
|
41061
|
+
return {
|
|
41062
|
+
executed: true,
|
|
41063
|
+
success: true,
|
|
41064
|
+
errorMessage: reason,
|
|
41065
|
+
preparedReplay: null
|
|
41066
|
+
};
|
|
41067
|
+
}
|
|
40963
41068
|
if (prepared == null) {
|
|
40964
41069
|
return {
|
|
40965
41070
|
executed: true,
|
|
@@ -40978,6 +41083,17 @@ var GenerationCommitStep = class extends BaseStep {
|
|
|
40978
41083
|
};
|
|
40979
41084
|
}
|
|
40980
41085
|
};
|
|
41086
|
+
function tryRevParse(cwd2, rev) {
|
|
41087
|
+
try {
|
|
41088
|
+
return (0, import_child_process6.execFileSync)("git", ["rev-parse", "--verify", rev], {
|
|
41089
|
+
cwd: cwd2,
|
|
41090
|
+
encoding: "utf-8",
|
|
41091
|
+
stdio: "pipe"
|
|
41092
|
+
}).trim();
|
|
41093
|
+
} catch {
|
|
41094
|
+
return null;
|
|
41095
|
+
}
|
|
41096
|
+
}
|
|
40981
41097
|
|
|
40982
41098
|
// src/pipeline/steps/GithubStep.ts
|
|
40983
41099
|
var import_promises14 = require("fs/promises");
|
|
@@ -41708,6 +41824,18 @@ var ReplayStep = class extends BaseStep {
|
|
|
41708
41824
|
async execute(context) {
|
|
41709
41825
|
const generationCommit = context.previousStepResults.generationCommit;
|
|
41710
41826
|
const prepared = generationCommit?.preparedReplay;
|
|
41827
|
+
if (generationCommit != null && generationCommit.errorMessage != null && prepared == null) {
|
|
41828
|
+
return {
|
|
41829
|
+
executed: true,
|
|
41830
|
+
success: true,
|
|
41831
|
+
replayCrashed: true,
|
|
41832
|
+
errorMessage: generationCommit.errorMessage,
|
|
41833
|
+
flow: "normal-regeneration",
|
|
41834
|
+
patchesDetected: 0,
|
|
41835
|
+
patchesApplied: 0,
|
|
41836
|
+
patchesWithConflicts: 0
|
|
41837
|
+
};
|
|
41838
|
+
}
|
|
41711
41839
|
if (generationCommit != null && prepared == null) {
|
|
41712
41840
|
return {
|
|
41713
41841
|
executed: true,
|
|
@@ -41730,6 +41858,21 @@ var ReplayStep = class extends BaseStep {
|
|
|
41730
41858
|
skipApplication: this.config.skipApplication,
|
|
41731
41859
|
logger: this.logger
|
|
41732
41860
|
});
|
|
41861
|
+
if (result.failureReason != null) {
|
|
41862
|
+
return {
|
|
41863
|
+
executed: true,
|
|
41864
|
+
success: true,
|
|
41865
|
+
replayCrashed: true,
|
|
41866
|
+
errorMessage: result.failureReason,
|
|
41867
|
+
previousGenerationSha: result.previousGenerationSha ?? void 0,
|
|
41868
|
+
currentGenerationSha: result.currentGenerationSha ?? void 0,
|
|
41869
|
+
baseBranchHead: result.baseBranchHead ?? void 0,
|
|
41870
|
+
flow: "normal-regeneration",
|
|
41871
|
+
patchesDetected: 0,
|
|
41872
|
+
patchesApplied: 0,
|
|
41873
|
+
patchesWithConflicts: 0
|
|
41874
|
+
};
|
|
41875
|
+
}
|
|
41733
41876
|
if (result.report == null) {
|
|
41734
41877
|
return {
|
|
41735
41878
|
executed: true,
|
|
@@ -41758,6 +41901,11 @@ var ReplayStep = class extends BaseStep {
|
|
|
41758
41901
|
patchesRepointed: report.patchesRepointed,
|
|
41759
41902
|
patchesContentRebased: report.patchesContentRebased,
|
|
41760
41903
|
patchesKeptAsUserOwned: report.patchesKeptAsUserOwned,
|
|
41904
|
+
patchesSkipped: report.patchesSkipped,
|
|
41905
|
+
patchesPartiallyApplied: report.patchesPartiallyApplied,
|
|
41906
|
+
patchesConflictResolved: report.patchesConflictResolved,
|
|
41907
|
+
patchesReverted: report.patchesReverted,
|
|
41908
|
+
patchesRefreshed: report.patchesRefreshed,
|
|
41761
41909
|
unresolvedPatches: report.unresolvedPatches?.map((info) => ({
|
|
41762
41910
|
patchId: info.patchId,
|
|
41763
41911
|
patchMessage: info.patchMessage,
|
|
@@ -41826,8 +41974,8 @@ var PostGenerationPipeline = class {
|
|
|
41826
41974
|
async run() {
|
|
41827
41975
|
if (this.config.github?.enabled) {
|
|
41828
41976
|
try {
|
|
41829
|
-
(0,
|
|
41830
|
-
(0,
|
|
41977
|
+
(0, import_child_process7.execFileSync)("git", ["config", "user.name", FERN_BOT_NAME2], { cwd: this.config.outputDir });
|
|
41978
|
+
(0, import_child_process7.execFileSync)("git", ["config", "user.email", FERN_BOT_EMAIL2], { cwd: this.config.outputDir });
|
|
41831
41979
|
} catch {
|
|
41832
41980
|
}
|
|
41833
41981
|
}
|