feat: name filtered state in issue list count line (task 0033)
Some checks failed
CI / test (pull_request) Failing after 54s
Some checks failed
CI / test (pull_request) Failing after 54s
Make the `issue list` count line name the state it filtered on, so the answer to "how many issues are open?" is present on the summary line rather than only inferable from each row. The count line now renders `count: 5 open of 5 total`; the command composes the state into a generic optional qualifier while `formatCountLine` stays state-agnostic, so `pr list`, `search`, and `dashboard` are unaffected. `--state all` imposes no narrowing and stays unqualified. The wording is chosen so an agent quoting the summary lands on a phrase the benchmark read-checker already accepts (`5 open`), closing the accuracy gap this feature targets. Pairs with the report persistence in task 0032.
This commit is contained in:
@@ -460,11 +460,19 @@ async function issueList(deps: CliDeps, args: string[]): Promise<string> {
|
||||
return renderList({
|
||||
noun: "issues",
|
||||
rows,
|
||||
countLine: formatCountLine(rows.length, total, rows.length >= limit),
|
||||
countLine: formatCountLine(rows.length, total, rows.length >= limit, countStateQualifier(state)),
|
||||
help: issueListSuggestions(context, state, rows.length, total),
|
||||
});
|
||||
}
|
||||
|
||||
// The count line names the state the list was filtered to, so the answer to
|
||||
// "how many are open?" is on the summary line rather than only inferable from
|
||||
// each row. `all` imposes no narrowing and has no natural one-word name, so it
|
||||
// adds no qualifier and the generic count line stands.
|
||||
function countStateQualifier(state: IssueState): string | undefined {
|
||||
return state === "all" ? undefined : state;
|
||||
}
|
||||
|
||||
// The default detail fields reuse the same declarative extraction as the list
|
||||
// path; only `body` (truncation) and `comment_count` need bespoke handling.
|
||||
const ISSUE_VIEW_FIELDS: FieldDef<Issue>[] = [
|
||||
|
||||
@@ -18,14 +18,20 @@ export function formatCountLine(
|
||||
shown: number,
|
||||
total: number | undefined,
|
||||
atLimit: boolean,
|
||||
qualifier?: string,
|
||||
): string {
|
||||
// A generic, caller-supplied qualifier names what was counted (e.g. the state
|
||||
// a list was filtered to) right after the count, so `count: 5 open of 5 total`
|
||||
// answers "how many are open?" off the summary line. The helper stays unaware
|
||||
// of any specific domain concept — callers that pass none render as before.
|
||||
const counted = qualifier === undefined ? `${shown}` : `${shown} ${qualifier}`;
|
||||
if (total === undefined) {
|
||||
if (atLimit) {
|
||||
return `count: ${shown} (showing first ${shown})`;
|
||||
return `count: ${counted} (showing first ${shown})`;
|
||||
}
|
||||
return `count: ${shown} of ${shown} total`;
|
||||
return `count: ${counted} of ${shown} total`;
|
||||
}
|
||||
return `count: ${shown} of ${total} total`;
|
||||
return `count: ${counted} of ${total} total`;
|
||||
}
|
||||
|
||||
/** Encode a named list block, with an explicit empty-state line when there are no rows. */
|
||||
|
||||
Reference in New Issue
Block a user