@bensandee/forgejo-cli 0.5.0 → 0.5.2
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.mjs +21 -7
- package/package.json +1 -1
package/dist/bin.mjs
CHANGED
|
@@ -162,7 +162,7 @@ function loadEnvFileForBin(rawArgs, bin, io = processIo) {
|
|
|
162
162
|
//#region src/version.ts
|
|
163
163
|
const parsed = z.object({ version: z.string() }).safeParse({
|
|
164
164
|
name: "@bensandee/forgejo-cli",
|
|
165
|
-
version: "0.5.
|
|
165
|
+
version: "0.5.2",
|
|
166
166
|
description: "bst-fj: Forgejo API commands without the rest of bst",
|
|
167
167
|
license: "MIT",
|
|
168
168
|
repository: {
|
|
@@ -5762,9 +5762,10 @@ const prCloseCommand = defineCommand({
|
|
|
5762
5762
|
};
|
|
5763
5763
|
const number = parsePrNumber(args.number);
|
|
5764
5764
|
const comment = readBodySource(args.comment ?? void 0, args["comment-file"] ?? void 0, { flags });
|
|
5765
|
-
const conn = requireForgejoTargetFromRepo(process.cwd(), args.repo ?? void 0, "pr:close is Forgejo-only -- use gh pr close <n> on GitHub.");
|
|
5766
5765
|
const dryRun = args["dry-run"] === true;
|
|
5767
5766
|
try {
|
|
5767
|
+
rejectEmptyComment(comment);
|
|
5768
|
+
const conn = requireForgejoTargetFromRepo(process.cwd(), args.repo ?? void 0, "pr:close is Forgejo-only -- use gh pr close <n> on GitHub.");
|
|
5768
5769
|
const result = await closePullRequest(forgejoIssueApi(cliFetcher(), conn), {
|
|
5769
5770
|
number,
|
|
5770
5771
|
dryRun,
|
|
@@ -6437,8 +6438,21 @@ const PrFileEntrySchema = z.object({
|
|
|
6437
6438
|
additions: z.number().default(0),
|
|
6438
6439
|
deletions: z.number().default(0)
|
|
6439
6440
|
});
|
|
6440
|
-
|
|
6441
|
-
|
|
6441
|
+
const ALL_FILES_MAX_PAGES = 20;
|
|
6442
|
+
async function listAllPrFiles(executor, conn, prNumber) {
|
|
6443
|
+
const files = [];
|
|
6444
|
+
for (let page = 1; page <= ALL_FILES_MAX_PAGES; page++) {
|
|
6445
|
+
const listing = await readPrFilesPage(executor, conn, prNumber, page, DEFAULT_LIMIT);
|
|
6446
|
+
files.push(...listing.files);
|
|
6447
|
+
if (!listing.truncated) return {
|
|
6448
|
+
files,
|
|
6449
|
+
truncated: false
|
|
6450
|
+
};
|
|
6451
|
+
}
|
|
6452
|
+
return {
|
|
6453
|
+
files,
|
|
6454
|
+
truncated: true
|
|
6455
|
+
};
|
|
6442
6456
|
}
|
|
6443
6457
|
async function readPrFilesPage(executor, conn, prNumber, page, limit) {
|
|
6444
6458
|
const url = `${conn.serverUrl}/api/v1/repos/${conn.repository}/pulls/${String(prNumber)}/files?page=${String(page)}&limit=${String(limit)}`;
|
|
@@ -6463,7 +6477,7 @@ async function readPrFilesPage(executor, conn, prNumber, page, limit) {
|
|
|
6463
6477
|
//#region src/pr-files.ts
|
|
6464
6478
|
function runPrFiles(fetcher, options) {
|
|
6465
6479
|
const number = parsePrNumber(options.number);
|
|
6466
|
-
return
|
|
6480
|
+
return listAllPrFiles(fetcher, requireForgejoTarget(options.cwd, parseRepoTarget(options.repo), "pr:files is Forgejo-only -- gh pr diff --name-only already serves GitHub."), number);
|
|
6467
6481
|
}
|
|
6468
6482
|
function renderPrFiles(listing) {
|
|
6469
6483
|
const lines = listing.files.map((file) => `${file.status ?? "unknown"} ${file.filename}`);
|
|
@@ -6476,7 +6490,7 @@ function renderPrFiles(listing) {
|
|
|
6476
6490
|
const prFilesCommand = defineCommand({
|
|
6477
6491
|
meta: {
|
|
6478
6492
|
name: "pr:files",
|
|
6479
|
-
description: "List
|
|
6493
|
+
description: "List every file a pull request changes, reading every page (Forgejo-only)"
|
|
6480
6494
|
},
|
|
6481
6495
|
args: {
|
|
6482
6496
|
number: {
|
|
@@ -6490,7 +6504,7 @@ const prFilesCommand = defineCommand({
|
|
|
6490
6504
|
},
|
|
6491
6505
|
json: {
|
|
6492
6506
|
type: "boolean",
|
|
6493
|
-
description: "Emit one JSON document: files ([{filename, status (or null), additions, deletions}]), truncated."
|
|
6507
|
+
description: "Emit one JSON document: files ([{filename, status (or null), additions, deletions}]), truncated (true only when the pull request changes more files than the command reads, at least 1000)."
|
|
6494
6508
|
},
|
|
6495
6509
|
verbose: {
|
|
6496
6510
|
type: "boolean",
|