From 32d3517fa90de6dc08552794621a4e27f985ccb2 Mon Sep 17 00:00:00 2001 From: Codex Date: Thu, 21 May 2026 04:33:43 +0000 Subject: [PATCH] fix: expose gh read/view help surface --- scripts/gh-cli-issue-guard-contract-test.ts | 11 +++++++++++ scripts/gh-cli-pr-contract-test.ts | 6 ++++++ scripts/src/gh.ts | 6 ++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/gh-cli-issue-guard-contract-test.ts b/scripts/gh-cli-issue-guard-contract-test.ts index c6d0679e..095fd040 100644 --- a/scripts/gh-cli-issue-guard-contract-test.ts +++ b/scripts/gh-cli-issue-guard-contract-test.ts @@ -457,6 +457,17 @@ async function startMockGitHub(): Promise<{ baseUrl: string; requests: MockReque } export async function runGhCliIssueGuardContract(): Promise { + const help = await runCli(["gh", "help"]); + assertCondition(help.status === 0, "gh help should succeed", help.json ?? { stdout: help.stdout }); + const helpData = dataOf(help.json ?? {}); + const usage = Array.isArray(helpData.usage) ? helpData.usage.map((value) => String(value)) : []; + const notes = Array.isArray(helpData.notes) ? helpData.notes.map((value) => String(value)) : []; + assertCondition(usage.some((line) => line.includes("gh issue list")), "gh help should list issue list", { usage }); + assertCondition(usage.some((line) => line.includes("gh issue read")), "gh help should list issue read", { usage }); + assertCondition(usage.some((line) => line.includes("gh issue view")), "gh help should list issue view", { usage }); + assertCondition(notes.some((line) => line.includes("canonical read path")), "gh help should state issue read is canonical", { notes }); + assertCondition(notes.some((line) => line.includes("compatibility alias")), "gh help should state issue view is alias", { notes }); + const mock = await startMockGitHub(); const tmp = mkdtempSync(join(tmpdir(), "unidesk-gh-issue-guard-")); const env = { diff --git a/scripts/gh-cli-pr-contract-test.ts b/scripts/gh-cli-pr-contract-test.ts index cf813a93..dab346c6 100644 --- a/scripts/gh-cli-pr-contract-test.ts +++ b/scripts/gh-cli-pr-contract-test.ts @@ -143,8 +143,14 @@ export async function runGhCliPrContract(): Promise { assertCondition(help.status === 0, "gh help should succeed", help.json ?? { stdout: help.stdout }); const helpData = dataOf(help.json ?? {}); const usage = Array.isArray(helpData.usage) ? helpData.usage.map((value) => String(value)) : []; + const notes = Array.isArray(helpData.notes) ? helpData.notes.map((value) => String(value)) : []; + assertCondition(usage.some((line) => line.includes("gh pr list")), "gh help should list pr list", { usage }); + assertCondition(usage.some((line) => line.includes("gh pr read")), "gh help should list pr read", { usage }); + assertCondition(usage.some((line) => line.includes("gh pr view")), "gh help should list pr view", { usage }); assertCondition(usage.some((line) => line.includes("gh pr create")), "gh help should list pr create", { usage }); assertCondition(usage.some((line) => line.includes("gh pr comment")), "gh help should list pr comment", { usage }); + assertCondition(notes.some((line) => line.includes("canonical read path")), "gh help should state pr read is canonical", { notes }); + assertCondition(notes.some((line) => line.includes("compatibility alias")), "gh help should state pr view is alias", { notes }); const mock = await startMockGitHub(); const env = { diff --git a/scripts/src/gh.ts b/scripts/src/gh.ts index 24be6fd9..d915773f 100644 --- a/scripts/src/gh.ts +++ b/scripts/src/gh.ts @@ -2908,7 +2908,8 @@ export function ghHelp(): unknown { usage: [ "bun scripts/cli.ts gh auth status [--repo owner/name]", "bun scripts/cli.ts gh issue list [--state open|closed|all] [--limit N] [--repo owner/name] [--json number,title,state,url,updatedAt,createdAt,author,labels]", - "bun scripts/cli.ts gh issue read|view [--repo owner/name] [--json body,title,state,comments]", + "bun scripts/cli.ts gh issue read [--repo owner/name] [--json body,title,state,comments]", + "bun scripts/cli.ts gh issue view [--repo owner/name] [compatibility alias for issue read]", "bun scripts/cli.ts gh issue create --title --body-file <file> [--label label[,label...]]... [--repo owner/name] [--dry-run]", "bun scripts/cli.ts gh issue update <number> --mode replace|append --body-file <file> [--title title] [--repo owner/name] [--dry-run] [--expect-updated-at ts|--expect-body-sha sha256] [--body-profile auto|code-queue-board|commander-brief] [--allow-short-body]", "bun scripts/cli.ts gh issue edit <number> --body-file <file> [compat alias for issue update --mode replace]", @@ -2921,7 +2922,8 @@ export function ghHelp(): unknown { "bun scripts/cli.ts gh issue cleanup-plan [--repo owner/name] [--limit N] [--dry-run]", "bun scripts/cli.ts gh issue board-audit [--repo owner/name] [--board-issue 20] [--limit N] [--known-meta-issue N[,N...]] [--ignore-issue N[,N...]] [--dry-run]", "bun scripts/cli.ts gh pr list [--repo owner/name] [--limit N] [--json number,title,state,url,updatedAt,createdAt,author,head,base,draft]", - "bun scripts/cli.ts gh pr read|view <number> [--repo owner/name] [--json body,title,state,head,base,draft]", + "bun scripts/cli.ts gh pr read <number> [--repo owner/name] [--json body,title,state,head,base,draft]", + "bun scripts/cli.ts gh pr view <number> [--repo owner/name] [compatibility alias for pr read]", "bun scripts/cli.ts gh pr create --title <title> --body-file <file>|--body <text> --base <branch> --head <branch> [--repo owner/name] [--draft] [--dry-run]", "bun scripts/cli.ts gh pr update <number> --mode replace|append --body-file <file>|--body <text> [--title title] [--repo owner/name] [--dry-run]", "bun scripts/cli.ts gh pr comment create <number> --body-file <file>|--body <text> [--repo owner/name] [--dry-run]",