@bragduck/cli 2.2.0 → 2.2.1
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/bin/bragduck.js +18 -8
- package/dist/bin/bragduck.js.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/bragduck.js
CHANGED
|
@@ -1166,11 +1166,19 @@ var init_api_service = __esm({
|
|
|
1166
1166
|
* Refine brags using AI
|
|
1167
1167
|
*/
|
|
1168
1168
|
async refineBrags(request) {
|
|
1169
|
-
|
|
1169
|
+
const MAX_TEXT_LENGTH = 1e4;
|
|
1170
|
+
const trimmedRequest = {
|
|
1171
|
+
...request,
|
|
1172
|
+
brags: request.brags.map((brag) => ({
|
|
1173
|
+
...brag,
|
|
1174
|
+
text: brag.text && brag.text.length > MAX_TEXT_LENGTH ? brag.text.substring(0, MAX_TEXT_LENGTH) : brag.text
|
|
1175
|
+
}))
|
|
1176
|
+
};
|
|
1177
|
+
logger.debug(`Refining ${trimmedRequest.brags.length} brags`);
|
|
1170
1178
|
try {
|
|
1171
1179
|
const response = await this.makeRequest(API_ENDPOINTS.BRAGS.REFINE, {
|
|
1172
1180
|
method: "POST",
|
|
1173
|
-
body:
|
|
1181
|
+
body: trimmedRequest
|
|
1174
1182
|
});
|
|
1175
1183
|
logger.debug(`Successfully refined ${response.refined_brags.length} brags`);
|
|
1176
1184
|
return response;
|
|
@@ -2161,12 +2169,12 @@ function formatRefinedCommitsTable(brags, selectedCommits) {
|
|
|
2161
2169
|
});
|
|
2162
2170
|
brags.forEach((brag, index) => {
|
|
2163
2171
|
const isNewBragType = !("sha" in brag);
|
|
2164
|
-
let displaySha
|
|
2172
|
+
let displaySha = `#${index + 1}`;
|
|
2165
2173
|
if (isNewBragType && selectedCommits) {
|
|
2166
2174
|
const commit = selectedCommits[index];
|
|
2167
|
-
if (commit.sha.startsWith("pr-")) {
|
|
2175
|
+
if (commit && commit.sha.startsWith("pr-")) {
|
|
2168
2176
|
displaySha = commit.sha.replace("pr-", "#");
|
|
2169
|
-
} else {
|
|
2177
|
+
} else if (commit) {
|
|
2170
2178
|
displaySha = commit.sha.substring(0, 7);
|
|
2171
2179
|
}
|
|
2172
2180
|
} else if (!isNewBragType) {
|
|
@@ -2312,12 +2320,14 @@ async function promptReviewBrags(refinedBrags, selectedCommits) {
|
|
|
2312
2320
|
let reviewingBrag = true;
|
|
2313
2321
|
while (reviewingBrag) {
|
|
2314
2322
|
const isNewBragType = !("sha" in currentBrag);
|
|
2315
|
-
let displaySha
|
|
2323
|
+
let displaySha = `#${i + 1}`;
|
|
2316
2324
|
let prUrl;
|
|
2317
2325
|
if (isNewBragType && selectedCommits) {
|
|
2318
2326
|
const commit = selectedCommits[i];
|
|
2319
|
-
|
|
2320
|
-
|
|
2327
|
+
if (commit) {
|
|
2328
|
+
displaySha = commit.sha.startsWith("pr-") ? commit.sha.replace("pr-", "#") : commit.sha.substring(0, 7);
|
|
2329
|
+
prUrl = commit.url;
|
|
2330
|
+
}
|
|
2321
2331
|
} else if (!isNewBragType) {
|
|
2322
2332
|
const commit = currentBrag;
|
|
2323
2333
|
displaySha = commit.sha.startsWith("pr-") ? commit.sha.replace("pr-", "#") : commit.sha.substring(0, 7);
|