@fern-api/generator-cli 0.6.8 → 0.6.9
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 +0 -82
- package/dist/cli.js +0 -82
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -9938,85 +9938,6 @@ function formatReplayPrBody(result, options) {
|
|
|
9938
9938
|
return parts.join("\n");
|
|
9939
9939
|
}
|
|
9940
9940
|
|
|
9941
|
-
// src/pipeline/github/postConflictComments.ts
|
|
9942
|
-
function resolveGuidance(conflictReason) {
|
|
9943
|
-
switch (conflictReason) {
|
|
9944
|
-
case "same-line-edit":
|
|
9945
|
-
return "You likely want to combine both -- keep your logic while incorporating the generation's structural changes.";
|
|
9946
|
-
case "new-file-both":
|
|
9947
|
-
return "Compare both versions and merge any unique content. If you created the file intentionally, your version is likely correct.";
|
|
9948
|
-
case "base-generation-mismatch":
|
|
9949
|
-
return "Review carefully -- the generated code changed significantly. You may need to re-apply your customization on top of the new structure.";
|
|
9950
|
-
case "patch-apply-failed":
|
|
9951
|
-
return "Your customization could not be applied automatically. Re-apply your changes manually on top of the new generated code.";
|
|
9952
|
-
default:
|
|
9953
|
-
return "Review both sides and keep whichever version (or combination) is correct for your use case.";
|
|
9954
|
-
}
|
|
9955
|
-
}
|
|
9956
|
-
function buildConflictCommentBody(conflictDetails) {
|
|
9957
|
-
const entries2 = [];
|
|
9958
|
-
for (const detail of conflictDetails) {
|
|
9959
|
-
const description = patchDescription(detail);
|
|
9960
|
-
for (const file of detail.files) {
|
|
9961
|
-
if (file.status === "conflict") {
|
|
9962
|
-
entries2.push({
|
|
9963
|
-
file: file.file,
|
|
9964
|
-
customization: description,
|
|
9965
|
-
reason: formatConflictReason(file.conflictReason),
|
|
9966
|
-
guidance: resolveGuidance(file.conflictReason)
|
|
9967
|
-
});
|
|
9968
|
-
}
|
|
9969
|
-
}
|
|
9970
|
-
}
|
|
9971
|
-
if (entries2.length === 0) {
|
|
9972
|
-
return void 0;
|
|
9973
|
-
}
|
|
9974
|
-
const parts = [];
|
|
9975
|
-
parts.push("## Conflict Resolution Guide\n");
|
|
9976
|
-
parts.push(
|
|
9977
|
-
`This PR has **${entries2.length} file${entries2.length === 1 ? "" : "s"}** where your customizations conflict with the new SDK generation. Below is per-file guidance to help you resolve each conflict.
|
|
9978
|
-
`
|
|
9979
|
-
);
|
|
9980
|
-
parts.push(
|
|
9981
|
-
'> In GitHub\'s conflict editor, `<<<<<<< HEAD` ("Accept current") = **new generated code**, `>>>>>>> main` ("Accept incoming") = **your customization**.\n'
|
|
9982
|
-
);
|
|
9983
|
-
parts.push("| File | Your customization | Why it conflicted | Suggested resolution |");
|
|
9984
|
-
parts.push("|------|-------------------|-------------------|---------------------|");
|
|
9985
|
-
for (const entry of entries2) {
|
|
9986
|
-
parts.push(`| \`${entry.file}\` | ${entry.customization} | ${entry.reason} | ${entry.guidance} |`);
|
|
9987
|
-
}
|
|
9988
|
-
parts.push("\n---");
|
|
9989
|
-
parts.push("*Posted by Fern Replay to help resolve SDK customization conflicts.*");
|
|
9990
|
-
return parts.join("\n");
|
|
9991
|
-
}
|
|
9992
|
-
async function postConflictComments(octokit, owner, repo, prNumber, replayResult, logger) {
|
|
9993
|
-
if (replayResult == null) {
|
|
9994
|
-
return;
|
|
9995
|
-
}
|
|
9996
|
-
const conflictDetails = replayResult.conflictDetails;
|
|
9997
|
-
if (conflictDetails == null || conflictDetails.length === 0) {
|
|
9998
|
-
return;
|
|
9999
|
-
}
|
|
10000
|
-
const body = buildConflictCommentBody(conflictDetails);
|
|
10001
|
-
if (body == null) {
|
|
10002
|
-
logger.debug("No conflict files to comment on -- skipping conflict comment");
|
|
10003
|
-
return;
|
|
10004
|
-
}
|
|
10005
|
-
try {
|
|
10006
|
-
await octokit.issues.createComment({
|
|
10007
|
-
owner,
|
|
10008
|
-
repo,
|
|
10009
|
-
issue_number: prNumber,
|
|
10010
|
-
body
|
|
10011
|
-
});
|
|
10012
|
-
logger.debug(`Posted conflict resolution guide comment on PR #${prNumber}`);
|
|
10013
|
-
} catch (error) {
|
|
10014
|
-
logger.debug(
|
|
10015
|
-
`Could not post conflict comment on PR #${prNumber}: ${error instanceof Error ? error.message : String(error)}`
|
|
10016
|
-
);
|
|
10017
|
-
}
|
|
10018
|
-
}
|
|
10019
|
-
|
|
10020
9941
|
// src/pipeline/steps/BaseStep.ts
|
|
10021
9942
|
var BaseStep = class {
|
|
10022
9943
|
constructor(outputDir, logger) {
|
|
@@ -10202,9 +10123,6 @@ var GithubStep = class extends BaseStep {
|
|
|
10202
10123
|
}
|
|
10203
10124
|
}
|
|
10204
10125
|
}
|
|
10205
|
-
if (!this.config.previewMode && replayConflictInfo?.hasConflicts === true && result.prNumber != null) {
|
|
10206
|
-
await postConflictComments(octokit, owner, repo, result.prNumber, replayResult, this.logger);
|
|
10207
|
-
}
|
|
10208
10126
|
if (!this.config.previewMode && result.prNumber != null && replayConflictInfo?.hasConflicts === true && replayResult != null) {
|
|
10209
10127
|
await this.postWebEditorFallbackComment(
|
|
10210
10128
|
octokit,
|
package/dist/cli.js
CHANGED
|
@@ -31065,85 +31065,6 @@ function formatReplayPrBody(result, options) {
|
|
|
31065
31065
|
return parts.join("\n");
|
|
31066
31066
|
}
|
|
31067
31067
|
|
|
31068
|
-
// src/pipeline/github/postConflictComments.ts
|
|
31069
|
-
function resolveGuidance(conflictReason) {
|
|
31070
|
-
switch (conflictReason) {
|
|
31071
|
-
case "same-line-edit":
|
|
31072
|
-
return "You likely want to combine both -- keep your logic while incorporating the generation's structural changes.";
|
|
31073
|
-
case "new-file-both":
|
|
31074
|
-
return "Compare both versions and merge any unique content. If you created the file intentionally, your version is likely correct.";
|
|
31075
|
-
case "base-generation-mismatch":
|
|
31076
|
-
return "Review carefully -- the generated code changed significantly. You may need to re-apply your customization on top of the new structure.";
|
|
31077
|
-
case "patch-apply-failed":
|
|
31078
|
-
return "Your customization could not be applied automatically. Re-apply your changes manually on top of the new generated code.";
|
|
31079
|
-
default:
|
|
31080
|
-
return "Review both sides and keep whichever version (or combination) is correct for your use case.";
|
|
31081
|
-
}
|
|
31082
|
-
}
|
|
31083
|
-
function buildConflictCommentBody(conflictDetails) {
|
|
31084
|
-
const entries2 = [];
|
|
31085
|
-
for (const detail of conflictDetails) {
|
|
31086
|
-
const description = patchDescription(detail);
|
|
31087
|
-
for (const file of detail.files) {
|
|
31088
|
-
if (file.status === "conflict") {
|
|
31089
|
-
entries2.push({
|
|
31090
|
-
file: file.file,
|
|
31091
|
-
customization: description,
|
|
31092
|
-
reason: formatConflictReason(file.conflictReason),
|
|
31093
|
-
guidance: resolveGuidance(file.conflictReason)
|
|
31094
|
-
});
|
|
31095
|
-
}
|
|
31096
|
-
}
|
|
31097
|
-
}
|
|
31098
|
-
if (entries2.length === 0) {
|
|
31099
|
-
return void 0;
|
|
31100
|
-
}
|
|
31101
|
-
const parts = [];
|
|
31102
|
-
parts.push("## Conflict Resolution Guide\n");
|
|
31103
|
-
parts.push(
|
|
31104
|
-
`This PR has **${entries2.length} file${entries2.length === 1 ? "" : "s"}** where your customizations conflict with the new SDK generation. Below is per-file guidance to help you resolve each conflict.
|
|
31105
|
-
`
|
|
31106
|
-
);
|
|
31107
|
-
parts.push(
|
|
31108
|
-
'> In GitHub\'s conflict editor, `<<<<<<< HEAD` ("Accept current") = **new generated code**, `>>>>>>> main` ("Accept incoming") = **your customization**.\n'
|
|
31109
|
-
);
|
|
31110
|
-
parts.push("| File | Your customization | Why it conflicted | Suggested resolution |");
|
|
31111
|
-
parts.push("|------|-------------------|-------------------|---------------------|");
|
|
31112
|
-
for (const entry of entries2) {
|
|
31113
|
-
parts.push(`| \`${entry.file}\` | ${entry.customization} | ${entry.reason} | ${entry.guidance} |`);
|
|
31114
|
-
}
|
|
31115
|
-
parts.push("\n---");
|
|
31116
|
-
parts.push("*Posted by Fern Replay to help resolve SDK customization conflicts.*");
|
|
31117
|
-
return parts.join("\n");
|
|
31118
|
-
}
|
|
31119
|
-
async function postConflictComments(octokit, owner, repo, prNumber, replayResult, logger) {
|
|
31120
|
-
if (replayResult == null) {
|
|
31121
|
-
return;
|
|
31122
|
-
}
|
|
31123
|
-
const conflictDetails = replayResult.conflictDetails;
|
|
31124
|
-
if (conflictDetails == null || conflictDetails.length === 0) {
|
|
31125
|
-
return;
|
|
31126
|
-
}
|
|
31127
|
-
const body = buildConflictCommentBody(conflictDetails);
|
|
31128
|
-
if (body == null) {
|
|
31129
|
-
logger.debug("No conflict files to comment on -- skipping conflict comment");
|
|
31130
|
-
return;
|
|
31131
|
-
}
|
|
31132
|
-
try {
|
|
31133
|
-
await octokit.issues.createComment({
|
|
31134
|
-
owner,
|
|
31135
|
-
repo,
|
|
31136
|
-
issue_number: prNumber,
|
|
31137
|
-
body
|
|
31138
|
-
});
|
|
31139
|
-
logger.debug(`Posted conflict resolution guide comment on PR #${prNumber}`);
|
|
31140
|
-
} catch (error) {
|
|
31141
|
-
logger.debug(
|
|
31142
|
-
`Could not post conflict comment on PR #${prNumber}: ${error instanceof Error ? error.message : String(error)}`
|
|
31143
|
-
);
|
|
31144
|
-
}
|
|
31145
|
-
}
|
|
31146
|
-
|
|
31147
31068
|
// src/pipeline/steps/BaseStep.ts
|
|
31148
31069
|
var BaseStep = class {
|
|
31149
31070
|
constructor(outputDir, logger) {
|
|
@@ -31329,9 +31250,6 @@ var GithubStep = class extends BaseStep {
|
|
|
31329
31250
|
}
|
|
31330
31251
|
}
|
|
31331
31252
|
}
|
|
31332
|
-
if (!this.config.previewMode && replayConflictInfo?.hasConflicts === true && result.prNumber != null) {
|
|
31333
|
-
await postConflictComments(octokit, owner, repo, result.prNumber, replayResult, this.logger);
|
|
31334
|
-
}
|
|
31335
31253
|
if (!this.config.previewMode && result.prNumber != null && replayConflictInfo?.hasConflicts === true && replayResult != null) {
|
|
31336
31254
|
await this.postWebEditorFallbackComment(
|
|
31337
31255
|
octokit,
|