@fern-api/generator-cli 0.9.33 → 0.9.34
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.js +1877 -64
- package/dist/cli.js +238 -48
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -22126,7 +22126,7 @@ var init_diff3 = __esm({
|
|
|
22126
22126
|
}
|
|
22127
22127
|
});
|
|
22128
22128
|
|
|
22129
|
-
// ../../node_modules/.pnpm/@fern-api+replay@0.16.
|
|
22129
|
+
// ../../node_modules/.pnpm/@fern-api+replay@0.16.2/node_modules/@fern-api/replay/dist/index.js
|
|
22130
22130
|
var dist_exports = {};
|
|
22131
22131
|
__export(dist_exports, {
|
|
22132
22132
|
CREDENTIAL_PATTERNS: () => CREDENTIAL_PATTERNS,
|
|
@@ -22437,13 +22437,13 @@ function isSensitiveFile(filePath) {
|
|
|
22437
22437
|
return SENSITIVE_FILE_PATTERNS.some((re) => re.test(filePath));
|
|
22438
22438
|
}
|
|
22439
22439
|
function scanForCredentials(content) {
|
|
22440
|
-
const
|
|
22440
|
+
const matches2 = [];
|
|
22441
22441
|
for (const { name, re } of CREDENTIAL_PATTERNS) {
|
|
22442
22442
|
if (re.test(content)) {
|
|
22443
|
-
|
|
22443
|
+
matches2.push(name);
|
|
22444
22444
|
}
|
|
22445
22445
|
}
|
|
22446
|
-
return
|
|
22446
|
+
return matches2;
|
|
22447
22447
|
}
|
|
22448
22448
|
function isGenerationCommit(commit) {
|
|
22449
22449
|
const isFernSupport = FERN_SUPPORT_NAMES.includes(commit.authorName);
|
|
@@ -22485,6 +22485,15 @@ function isBinaryFile(filePath) {
|
|
|
22485
22485
|
const ext2 = (0, import_path9.extname)(filePath).toLowerCase();
|
|
22486
22486
|
return BINARY_EXTENSIONS.has(ext2);
|
|
22487
22487
|
}
|
|
22488
|
+
function matchesFernignorePattern(filePath, patterns) {
|
|
22489
|
+
if (patterns.length === 0) return false;
|
|
22490
|
+
return patterns.some((p2) => {
|
|
22491
|
+
if (filePath === p2) return true;
|
|
22492
|
+
if (minimatch(filePath, p2)) return true;
|
|
22493
|
+
if (!p2.includes("*") && !p2.includes("?") && filePath.startsWith(p2 + "/")) return true;
|
|
22494
|
+
return false;
|
|
22495
|
+
});
|
|
22496
|
+
}
|
|
22488
22497
|
function parsePatchFileHeaders(patchContent) {
|
|
22489
22498
|
const results = [];
|
|
22490
22499
|
let currentPath = null;
|
|
@@ -22525,11 +22534,13 @@ async function capturePatchSnapshot(git, files, treeish) {
|
|
|
22525
22534
|
}
|
|
22526
22535
|
return snapshot;
|
|
22527
22536
|
}
|
|
22528
|
-
function filterInfrastructureAndSensitiveFiles(rawFilesOutput) {
|
|
22537
|
+
function filterInfrastructureAndSensitiveFiles(rawFilesOutput, fernignorePatterns) {
|
|
22529
22538
|
const allFiles = rawFilesOutput.trim().split("\n").filter(Boolean).filter((f) => !INFRASTRUCTURE_FILES.has(f)).filter((f) => !f.startsWith(".fern/"));
|
|
22530
22539
|
const sensitiveFiles = allFiles.filter((f) => isSensitiveFile(f));
|
|
22531
|
-
const
|
|
22532
|
-
|
|
22540
|
+
const nonSensitive = allFiles.filter((f) => !isSensitiveFile(f));
|
|
22541
|
+
const fernignoredFiles = nonSensitive.filter((f) => matchesFernignorePattern(f, fernignorePatterns));
|
|
22542
|
+
const files = nonSensitive.filter((f) => !matchesFernignorePattern(f, fernignorePatterns));
|
|
22543
|
+
return { files, sensitiveFiles, fernignoredFiles };
|
|
22533
22544
|
}
|
|
22534
22545
|
function threeWayMerge(base, ours, theirs) {
|
|
22535
22546
|
const baseLines = base.split("\n");
|
|
@@ -23375,6 +23386,93 @@ function computeCommitBuckets(results, absorbedPatchIds, patchesPassedToCommit)
|
|
|
23375
23386
|
}
|
|
23376
23387
|
return { applied, unresolved, absorbed };
|
|
23377
23388
|
}
|
|
23389
|
+
function computeLegacyFernignoreCleanse(patch, fernignorePatterns, computeContentHash2) {
|
|
23390
|
+
const matchesFernignore = (filePath) => fernignorePatterns.some((p2) => {
|
|
23391
|
+
if (filePath === p2) return true;
|
|
23392
|
+
if (minimatch(filePath, p2)) return true;
|
|
23393
|
+
if (!p2.includes("*") && !p2.includes("?") && filePath.startsWith(p2 + "/")) return true;
|
|
23394
|
+
return false;
|
|
23395
|
+
});
|
|
23396
|
+
const strippedFromFiles = patch.files.filter(matchesFernignore);
|
|
23397
|
+
const survivingFiles = patch.files.filter((f) => !matchesFernignore(f));
|
|
23398
|
+
let survivingSnapshot = void 0;
|
|
23399
|
+
let snapshotChanged = false;
|
|
23400
|
+
if (patch.theirs_snapshot) {
|
|
23401
|
+
survivingSnapshot = {};
|
|
23402
|
+
for (const [key, value] of Object.entries(patch.theirs_snapshot)) {
|
|
23403
|
+
if (matchesFernignore(key)) {
|
|
23404
|
+
snapshotChanged = true;
|
|
23405
|
+
} else {
|
|
23406
|
+
survivingSnapshot[key] = value;
|
|
23407
|
+
}
|
|
23408
|
+
}
|
|
23409
|
+
}
|
|
23410
|
+
const { stripped: patchContentStripped, content: newPatchContent, strippedSectionPaths } = stripFernignoreDiffSections(patch.patch_content, matchesFernignore);
|
|
23411
|
+
const unchanged = strippedFromFiles.length === 0 && !snapshotChanged && !patchContentStripped;
|
|
23412
|
+
if (unchanged) {
|
|
23413
|
+
return {
|
|
23414
|
+
unchanged: true,
|
|
23415
|
+
remove: false,
|
|
23416
|
+
files: patch.files,
|
|
23417
|
+
patch_content: patch.patch_content,
|
|
23418
|
+
content_hash: patch.content_hash,
|
|
23419
|
+
theirs_snapshot: patch.theirs_snapshot,
|
|
23420
|
+
strippedPaths: []
|
|
23421
|
+
};
|
|
23422
|
+
}
|
|
23423
|
+
const strippedPaths = Array.from(/* @__PURE__ */ new Set([...strippedFromFiles, ...strippedSectionPaths]));
|
|
23424
|
+
if (survivingFiles.length === 0 || newPatchContent.trim() === "") {
|
|
23425
|
+
return {
|
|
23426
|
+
unchanged: false,
|
|
23427
|
+
remove: true,
|
|
23428
|
+
files: [],
|
|
23429
|
+
patch_content: "",
|
|
23430
|
+
content_hash: "",
|
|
23431
|
+
strippedPaths
|
|
23432
|
+
};
|
|
23433
|
+
}
|
|
23434
|
+
const newContentHash = patchContentStripped ? computeContentHash2(newPatchContent) : patch.content_hash;
|
|
23435
|
+
return {
|
|
23436
|
+
unchanged: false,
|
|
23437
|
+
remove: false,
|
|
23438
|
+
files: survivingFiles,
|
|
23439
|
+
patch_content: newPatchContent,
|
|
23440
|
+
content_hash: newContentHash,
|
|
23441
|
+
...survivingSnapshot !== void 0 ? { theirs_snapshot: survivingSnapshot } : {},
|
|
23442
|
+
strippedPaths
|
|
23443
|
+
};
|
|
23444
|
+
}
|
|
23445
|
+
function stripFernignoreDiffSections(patchContent, matchesFernignore) {
|
|
23446
|
+
const lines = patchContent.split("\n");
|
|
23447
|
+
const sectionStarts = [];
|
|
23448
|
+
for (let i2 = 0; i2 < lines.length; i2++) {
|
|
23449
|
+
const line = lines[i2];
|
|
23450
|
+
if (line.startsWith("diff --git ")) {
|
|
23451
|
+
const match2 = line.match(/^diff --git a\/(.+?) b\/(.+?)$/);
|
|
23452
|
+
const path5 = match2 ? match2[2] : null;
|
|
23453
|
+
sectionStarts.push({ idx: i2, path: path5 });
|
|
23454
|
+
}
|
|
23455
|
+
}
|
|
23456
|
+
if (sectionStarts.length === 0) {
|
|
23457
|
+
return { stripped: false, content: patchContent, strippedSectionPaths: [] };
|
|
23458
|
+
}
|
|
23459
|
+
const preamble = lines.slice(0, sectionStarts[0].idx);
|
|
23460
|
+
const newLines = [...preamble];
|
|
23461
|
+
const strippedSectionPaths = [];
|
|
23462
|
+
let stripped = false;
|
|
23463
|
+
for (let i2 = 0; i2 < sectionStarts.length; i2++) {
|
|
23464
|
+
const section = sectionStarts[i2];
|
|
23465
|
+
const next = sectionStarts[i2 + 1];
|
|
23466
|
+
const endIdx = next ? next.idx : lines.length;
|
|
23467
|
+
if (section.path !== null && matchesFernignore(section.path)) {
|
|
23468
|
+
stripped = true;
|
|
23469
|
+
strippedSectionPaths.push(section.path);
|
|
23470
|
+
continue;
|
|
23471
|
+
}
|
|
23472
|
+
newLines.push(...lines.slice(section.idx, endIdx));
|
|
23473
|
+
}
|
|
23474
|
+
return { stripped, content: newLines.join("\n"), strippedSectionPaths };
|
|
23475
|
+
}
|
|
23378
23476
|
async function bootstrap(outputDir, options) {
|
|
23379
23477
|
const git = new GitClient(outputDir);
|
|
23380
23478
|
const lockManager = new LockfileManager(outputDir);
|
|
@@ -23958,7 +24056,7 @@ function status(outputDir) {
|
|
|
23958
24056
|
}
|
|
23959
24057
|
var import_promises3, import_os, import_path7, import_fs6, import_path8, import_yaml, import_crypto, import_path9, import_promises4, import_os2, import_path10, import_promises5, import_path11, import_promises6, import_path12, import_fs7, import_promises7, import_path13, import_promises8, import_os3, import_path14, import_child_process3, import_crypto2, import_fs8, import_path15, import_yaml2, import_crypto3, import_fs9, import_path16, import_fs10, import_promises9, import_path17, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, HybridReconstruction_exports, init_HybridReconstruction, PatchApplyTheirs_exports, init_PatchApplyTheirs, CREDENTIAL_PATTERNS, SENSITIVE_FILE_PATTERNS, FERN_BOT_NAME, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileNotFoundError, LockfileManager, BINARY_EXTENSIONS, INFRASTRUCTURE_FILES, ReplayDetector, MergeAccumulator, CONFLICT_OPENER, CONFLICT_SEPARATOR, CONFLICT_CLOSER, ReplayApplicator, ReplayCommitter, FileOwnership, FirstGenerationFlow, SkipApplicationFlow, NoPatchesFlow, NormalRegenerationFlow, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES, GITATTRIBUTES_ENTRIES, EMPTY_RESULT;
|
|
23960
24058
|
var init_dist3 = __esm({
|
|
23961
|
-
"../../node_modules/.pnpm/@fern-api+replay@0.16.
|
|
24059
|
+
"../../node_modules/.pnpm/@fern-api+replay@0.16.2/node_modules/@fern-api/replay/dist/index.js"() {
|
|
23962
24060
|
"use strict";
|
|
23963
24061
|
init_esm4();
|
|
23964
24062
|
import_promises3 = require("fs/promises");
|
|
@@ -23969,6 +24067,7 @@ var init_dist3 = __esm({
|
|
|
23969
24067
|
init_esm3();
|
|
23970
24068
|
import_yaml = __toESM(require_dist3(), 1);
|
|
23971
24069
|
import_crypto = require("crypto");
|
|
24070
|
+
init_esm3();
|
|
23972
24071
|
import_path9 = require("path");
|
|
23973
24072
|
init_diff3();
|
|
23974
24073
|
import_promises4 = require("fs/promises");
|
|
@@ -24451,11 +24550,13 @@ var init_dist3 = __esm({
|
|
|
24451
24550
|
git;
|
|
24452
24551
|
lockManager;
|
|
24453
24552
|
sdkOutputDir;
|
|
24553
|
+
fernignorePatterns;
|
|
24454
24554
|
warnings = [];
|
|
24455
|
-
constructor(git, lockManager, sdkOutputDir) {
|
|
24555
|
+
constructor(git, lockManager, sdkOutputDir, fernignorePatterns = []) {
|
|
24456
24556
|
this.git = git;
|
|
24457
24557
|
this.lockManager = lockManager;
|
|
24458
24558
|
this.sdkOutputDir = sdkOutputDir;
|
|
24559
|
+
this.fernignorePatterns = fernignorePatterns;
|
|
24459
24560
|
}
|
|
24460
24561
|
/**
|
|
24461
24562
|
* Derive the previous-generation SHA from git history instead of trusting
|
|
@@ -24562,22 +24663,30 @@ var init_dist3 = __esm({
|
|
|
24562
24663
|
continue;
|
|
24563
24664
|
}
|
|
24564
24665
|
const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
24565
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24666
|
+
const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24667
|
+
filesOutput,
|
|
24668
|
+
this.fernignorePatterns
|
|
24669
|
+
);
|
|
24566
24670
|
if (sensitiveFiles.length > 0) {
|
|
24567
24671
|
this.warnings.push(
|
|
24568
24672
|
`Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
24569
24673
|
);
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24674
|
+
}
|
|
24675
|
+
if (fernignoredFiles.length > 0) {
|
|
24676
|
+
this.warnings.push(
|
|
24677
|
+
`.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
|
|
24678
|
+
);
|
|
24679
|
+
}
|
|
24680
|
+
if ((sensitiveFiles.length > 0 || fernignoredFiles.length > 0) && files.length > 0) {
|
|
24681
|
+
const parentSha = parents[0];
|
|
24682
|
+
if (parentSha) {
|
|
24683
|
+
try {
|
|
24684
|
+
patchContent = await this.git.exec(["diff", parentSha, commit.sha, "--", ...files]);
|
|
24685
|
+
} catch {
|
|
24686
|
+
continue;
|
|
24580
24687
|
}
|
|
24688
|
+
if (!patchContent.trim()) continue;
|
|
24689
|
+
contentHash = this.computeContentHash(patchContent);
|
|
24581
24690
|
}
|
|
24582
24691
|
}
|
|
24583
24692
|
if (files.length === 0) {
|
|
@@ -24776,12 +24885,20 @@ var init_dist3 = __esm({
|
|
|
24776
24885
|
resolvedBaseGeneration = fallback;
|
|
24777
24886
|
}
|
|
24778
24887
|
const filesOutput = await this.git.exec(["diff", "--name-only", diffBase, "HEAD"]);
|
|
24779
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24888
|
+
const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24889
|
+
filesOutput,
|
|
24890
|
+
this.fernignorePatterns
|
|
24891
|
+
);
|
|
24780
24892
|
if (sensitiveFiles.length > 0) {
|
|
24781
24893
|
this.warnings.push(
|
|
24782
24894
|
`Sensitive file(s) excluded from composite patch: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
24783
24895
|
);
|
|
24784
24896
|
}
|
|
24897
|
+
if (fernignoredFiles.length > 0) {
|
|
24898
|
+
this.warnings.push(
|
|
24899
|
+
`.fernignore-protected file(s) excluded from composite patch: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
|
|
24900
|
+
);
|
|
24901
|
+
}
|
|
24785
24902
|
if (files.length === 0) return { patches: [], revertedPatchIds: [] };
|
|
24786
24903
|
const diff = await this.git.exec(["diff", diffBase, "HEAD", "--", ...files]);
|
|
24787
24904
|
if (!diff.trim()) return { patches: [], revertedPatchIds: [] };
|
|
@@ -24864,23 +24981,31 @@ var init_dist3 = __esm({
|
|
|
24864
24981
|
continue;
|
|
24865
24982
|
}
|
|
24866
24983
|
const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
24867
|
-
const { files, sensitiveFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24984
|
+
const { files, sensitiveFiles, fernignoredFiles } = filterInfrastructureAndSensitiveFiles(
|
|
24985
|
+
filesOutput,
|
|
24986
|
+
this.fernignorePatterns
|
|
24987
|
+
);
|
|
24868
24988
|
if (sensitiveFiles.length > 0) {
|
|
24869
24989
|
this.warnings.push(
|
|
24870
24990
|
`Sensitive file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${sensitiveFiles.join(", ")}. These files will not be tracked by replay.`
|
|
24871
24991
|
);
|
|
24872
|
-
|
|
24873
|
-
|
|
24874
|
-
|
|
24875
|
-
}
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
|
|
24879
|
-
|
|
24880
|
-
|
|
24881
|
-
|
|
24882
|
-
|
|
24992
|
+
}
|
|
24993
|
+
if (fernignoredFiles.length > 0) {
|
|
24994
|
+
this.warnings.push(
|
|
24995
|
+
`.fernignore-protected file(s) excluded from patch for commit ${commit.sha.slice(0, 7)}: ${fernignoredFiles.join(", ")}. These files are managed by .fernignore, not Replay.`
|
|
24996
|
+
);
|
|
24997
|
+
}
|
|
24998
|
+
if ((sensitiveFiles.length > 0 || fernignoredFiles.length > 0) && files.length > 0) {
|
|
24999
|
+
if (parents.length === 0) {
|
|
25000
|
+
continue;
|
|
25001
|
+
}
|
|
25002
|
+
try {
|
|
25003
|
+
patchContent = await this.git.exec(["diff", parents[0], commit.sha, "--", ...files]);
|
|
25004
|
+
} catch {
|
|
25005
|
+
continue;
|
|
24883
25006
|
}
|
|
25007
|
+
if (!patchContent.trim()) continue;
|
|
25008
|
+
contentHash = this.computeContentHash(patchContent);
|
|
24884
25009
|
}
|
|
24885
25010
|
if (files.length === 0) {
|
|
24886
25011
|
continue;
|
|
@@ -26097,7 +26222,8 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
26097
26222
|
this.git = git;
|
|
26098
26223
|
this.outputDir = outputDir;
|
|
26099
26224
|
this.lockManager = new LockfileManager(outputDir);
|
|
26100
|
-
|
|
26225
|
+
const fernignorePatterns = this.readFernignorePatterns();
|
|
26226
|
+
this.detector = new ReplayDetector(git, this.lockManager, outputDir, fernignorePatterns);
|
|
26101
26227
|
this.applicator = new ReplayApplicator(git, this.lockManager, outputDir);
|
|
26102
26228
|
this.committer = new ReplayCommitter(git, outputDir);
|
|
26103
26229
|
this.fileOwnership = new FileOwnership(git);
|
|
@@ -26117,8 +26243,60 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
|
|
|
26117
26243
|
async prepareReplay(options) {
|
|
26118
26244
|
this.warnings = [];
|
|
26119
26245
|
this.detector.warnings.length = 0;
|
|
26246
|
+
this.cleanseLegacyFernignoreEntries();
|
|
26120
26247
|
return this.selectFlow(options).prepare(options);
|
|
26121
26248
|
}
|
|
26249
|
+
/**
|
|
26250
|
+
* ADR 0002 migration step. Strips `.fernignore`-matched entries from
|
|
26251
|
+
* `patch.files`, `patch.theirs_snapshot` keys, and `diff --git` sections
|
|
26252
|
+
* in `patch.patch_content` for every patch in the lockfile. Patches that
|
|
26253
|
+
* end up with no surviving files are removed entirely.
|
|
26254
|
+
*
|
|
26255
|
+
* Idempotent: a second run is a no-op because the first run already
|
|
26256
|
+
* matches the contract. Per-patch try/catch ensures one bad patch does
|
|
26257
|
+
* not block the rest. Each affected patch emits a warning naming the
|
|
26258
|
+
* stripped paths. `patch_content` is left untouched if no parseable
|
|
26259
|
+
* `diff --git` headers are found (fail-safe for exotic legacy formats).
|
|
26260
|
+
*/
|
|
26261
|
+
cleanseLegacyFernignoreEntries() {
|
|
26262
|
+
const patterns = this.readFernignorePatterns();
|
|
26263
|
+
if (patterns.length === 0) return;
|
|
26264
|
+
if (!this.lockManager.exists()) return;
|
|
26265
|
+
this.lockManager.read();
|
|
26266
|
+
let lockfileMutated = false;
|
|
26267
|
+
const patches = this.lockManager.getPatches();
|
|
26268
|
+
for (const patch of patches) {
|
|
26269
|
+
try {
|
|
26270
|
+
const result = computeLegacyFernignoreCleanse(
|
|
26271
|
+
patch,
|
|
26272
|
+
patterns,
|
|
26273
|
+
(content) => this.detector.computeContentHash(content)
|
|
26274
|
+
);
|
|
26275
|
+
if (result.unchanged) continue;
|
|
26276
|
+
if (result.remove) {
|
|
26277
|
+
this.lockManager.removePatch(patch.id);
|
|
26278
|
+
this.warnings.push(
|
|
26279
|
+
`Cleansed legacy patch ${patch.id}: all referenced files match .fernignore \u2014 patch removed. Customer's on-disk content for those files is preserved by .fernignore. (ADR 0002: .fernignore-protected files are not tracked by Replay.)`
|
|
26280
|
+
);
|
|
26281
|
+
} else {
|
|
26282
|
+
this.lockManager.updatePatch(patch.id, {
|
|
26283
|
+
files: result.files,
|
|
26284
|
+
patch_content: result.patch_content,
|
|
26285
|
+
content_hash: result.content_hash,
|
|
26286
|
+
...result.theirs_snapshot !== void 0 ? { theirs_snapshot: result.theirs_snapshot } : {}
|
|
26287
|
+
});
|
|
26288
|
+
this.warnings.push(
|
|
26289
|
+
`Cleansed legacy patch ${patch.id}: stripped .fernignore-matched entries (${result.strippedPaths.join(", ")}). Customer's on-disk content for those files is preserved by .fernignore. (ADR 0002.)`
|
|
26290
|
+
);
|
|
26291
|
+
}
|
|
26292
|
+
lockfileMutated = true;
|
|
26293
|
+
} catch {
|
|
26294
|
+
}
|
|
26295
|
+
}
|
|
26296
|
+
if (lockfileMutated) {
|
|
26297
|
+
this.lockManager.save();
|
|
26298
|
+
}
|
|
26299
|
+
}
|
|
26122
26300
|
/**
|
|
26123
26301
|
* Phase 2 of the two-phase replay flow. Applies patches, rebases them against
|
|
26124
26302
|
* the generation, saves the lockfile, and commits `[fern-replay]` (or stages
|
|
@@ -31413,6 +31591,11 @@ var ClonedRepository = class _ClonedRepository {
|
|
|
31413
31591
|
}
|
|
31414
31592
|
await this.git.raw([...args, ...Array.isArray(files) ? files : [files]]);
|
|
31415
31593
|
}
|
|
31594
|
+
async listTrackedFiles() {
|
|
31595
|
+
await this.git.cwd(this.clonePath);
|
|
31596
|
+
const result = await this.git.raw(["ls-tree", "-r", "HEAD", "--name-only"]);
|
|
31597
|
+
return result.split("\n").filter((line) => line.length > 0);
|
|
31598
|
+
}
|
|
31416
31599
|
async restoreFilesFromCommit(commitSha, files) {
|
|
31417
31600
|
await this.git.cwd(this.clonePath);
|
|
31418
31601
|
const fileList = Array.isArray(files) ? files : [files];
|
|
@@ -31835,6 +32018,20 @@ async function cloneRepository({ githubRepository, installationToken, targetDire
|
|
|
31835
32018
|
});
|
|
31836
32019
|
}
|
|
31837
32020
|
|
|
32021
|
+
// ../commons/github/lib/expandFernignorePatterns.js
|
|
32022
|
+
init_esm3();
|
|
32023
|
+
function expandFernignorePatterns(fernignoreContent, candidatePaths) {
|
|
32024
|
+
const patterns = fernignoreContent.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
32025
|
+
return candidatePaths.filter((candidate) => patterns.some((pattern) => matches(candidate, pattern)));
|
|
32026
|
+
}
|
|
32027
|
+
function matches(candidate, pattern) {
|
|
32028
|
+
const normalized = pattern.endsWith("/") ? pattern.slice(0, -1) : pattern;
|
|
32029
|
+
if (minimatch(candidate, normalized, { dot: true })) {
|
|
32030
|
+
return true;
|
|
32031
|
+
}
|
|
32032
|
+
return candidate === normalized || candidate.startsWith(normalized + "/");
|
|
32033
|
+
}
|
|
32034
|
+
|
|
31838
32035
|
// ../../node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.js
|
|
31839
32036
|
function getUserAgent() {
|
|
31840
32037
|
if (typeof navigator === "object" && "userAgent" in navigator) {
|
|
@@ -32051,11 +32248,11 @@ function removeNonChars(variableName) {
|
|
|
32051
32248
|
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
|
32052
32249
|
}
|
|
32053
32250
|
function extractUrlVariableNames(url) {
|
|
32054
|
-
const
|
|
32055
|
-
if (!
|
|
32251
|
+
const matches2 = url.match(urlVariableRegex);
|
|
32252
|
+
if (!matches2) {
|
|
32056
32253
|
return [];
|
|
32057
32254
|
}
|
|
32058
|
-
return
|
|
32255
|
+
return matches2.map(removeNonChars).reduce((a, b3) => a.concat(b3), []);
|
|
32059
32256
|
}
|
|
32060
32257
|
function omit(object2, keysToOmit) {
|
|
32061
32258
|
const result = { __proto__: null };
|
|
@@ -32498,8 +32695,8 @@ async function fetchWrapper(requestOptions) {
|
|
|
32498
32695
|
data: ""
|
|
32499
32696
|
};
|
|
32500
32697
|
if ("deprecation" in responseHeaders) {
|
|
32501
|
-
const
|
|
32502
|
-
const deprecationLink =
|
|
32698
|
+
const matches2 = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/);
|
|
32699
|
+
const deprecationLink = matches2 && matches2.pop();
|
|
32503
32700
|
log.warn(
|
|
32504
32701
|
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
|
|
32505
32702
|
);
|
|
@@ -35583,15 +35780,8 @@ var GitHub = class {
|
|
|
35583
35780
|
if (fernignore === void 0) {
|
|
35584
35781
|
return [];
|
|
35585
35782
|
}
|
|
35586
|
-
const
|
|
35587
|
-
|
|
35588
|
-
for (const line of fernignoreLines) {
|
|
35589
|
-
const trimmedLine = line.trim();
|
|
35590
|
-
if (!trimmedLine.startsWith("#") && trimmedLine.length > 0 && await repository.fileExists({ relativeFilePath: trimmedLine })) {
|
|
35591
|
-
fernignoreFiles.push(trimmedLine);
|
|
35592
|
-
}
|
|
35593
|
-
}
|
|
35594
|
-
return fernignoreFiles;
|
|
35783
|
+
const tracked = await repository.listTrackedFiles();
|
|
35784
|
+
return expandFernignorePatterns(fernignore, tracked);
|
|
35595
35785
|
}
|
|
35596
35786
|
async restoreFiles(repository, files) {
|
|
35597
35787
|
if (files.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/generator-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.34",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fern-api/fern.git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@boundaryml/baml": "^0.219.0",
|
|
26
|
-
"@fern-api/replay": "0.16.
|
|
26
|
+
"@fern-api/replay": "0.16.2",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
28
|
"es-toolkit": "^1.45.1",
|
|
29
29
|
"semver": "^7.6.3",
|