feat: add the two-tier dashboard (task 0017)
All checks were successful
CI / test (pull_request) Successful in 47s
CI / test (push) Successful in 50s

Wire the bare `gitea-axi` home command to a two-tier repository
dashboard (ADR 0012): the short tier shows up to 3 open issues and 3
open PRs with the client-side `review` decision, and `--full` shows the
20-row open-PR table plus open issue counts grouped by label, aggregated
across every page of open issues up to the 1000-issue cap with a `+`
suffix when capped. Empty states render the raw `prs: 0 open` /
`issues: 0 open` strings; issue fetches pass `type=issues`; outside a
Gitea repo the dashboard errors with REPO_NOT_FOUND.

`paginate.ts` now reports whether pagination stopped at the cap, which
drives the label-count `+` suffix.
This commit was merged in pull request #18.
This commit is contained in:
2026-07-14 11:01:07 -04:00
parent c2c5f1728c
commit 5b6a9b4917
7 changed files with 705 additions and 27 deletions

View File

@@ -16,6 +16,12 @@ export interface PaginatedResult<T> {
items: T[];
/** `X-Total-Count`, absent when the header is missing or not a number. */
total: number | undefined;
/**
* True when pagination stopped at the page cap with every page full, so the
* set may be incomplete — the dashboard's issue aggregation suffixes its
* counts with `+` in this case (see the spec's hard 1000-issue cap).
*/
capped: boolean;
}
export function readTotalCount(headers: Headers): number | undefined {
@@ -48,9 +54,11 @@ export async function fetchAllPages<T>(
}
const batch = response.data ?? [];
items.push(...batch);
// A short page is the last page: the set is complete.
if (batch.length < PAGE_SIZE) {
break;
return { items, total, capped: false };
}
}
return { items, total };
// Every page up to the cap came back full, so there may be more beyond it.
return { items, total, capped: true };
}