fix: improve cli visibility for hwlab rollout
This commit is contained in:
+23
-5
@@ -29,7 +29,13 @@ const ISSUE_LIST_STATES = ["open", "closed", "all"] as const;
|
||||
const BODY_UPDATE_MODES = ["replace", "append"] as const;
|
||||
const BOARD_MUTATION_SECTIONS = ["open", "closed"] as const;
|
||||
const BOARD_GITHUB_STATUSES = ["OPEN", "CLOSED"] as const;
|
||||
const GH_VALUE_OPTIONS = new Set(["--repo", "--limit", "--board-issue", "--known-meta-issue", "--ignore-issue", "--title", "--body-file", "--body", "--base", "--head", "--json", "--state", "--mode", "--expect-updated-at", "--expect-body-sha", "--body-profile", "--label", "--field", "--value", "--section", "--to", "--status", "--row-file", "--category", "--branch", "--tasks", "--summary", "--focus", "--validation", "--progress", "--number"]);
|
||||
const GH_VALUE_OPTIONS = new Set([
|
||||
"--repo", "--limit", "--board-issue", "--known-meta-issue", "--ignore-issue", "--title",
|
||||
"--body-file", "--body", "--base", "--head", "--json", "--state", "--mode",
|
||||
"--expect-updated-at", "--expect-body-sha", "--body-profile", "--label", "--field",
|
||||
"--value", "--section", "--to", "--status", "--row-file", "--category", "--branch",
|
||||
"--tasks", "--summary", "--focus", "--validation", "--progress", "--number", "--pr",
|
||||
]);
|
||||
const GH_FLAG_OPTIONS = new Set(["--dry-run", "--draft", "--notify-claudeqq-brief-diff", "--allow-short-body", "--raw", "--full", "--stat", "--merge", "--squash", "--rebase", "--delete-branch"]);
|
||||
const MIN_SAFE_BODY_SCAN_CHARS = MIN_SAFE_ISSUE_BODY_CHARS;
|
||||
const ISSUE_SCAN_MAX_FINDINGS = 60;
|
||||
@@ -816,15 +822,27 @@ function parsePositionalNumberForCommand(repo: string, args: string[], startInde
|
||||
|
||||
function resolvePositionalPrReference(args: string[], startIndex: number, label: string, options: GitHubOptions): GitHubResolvedNumberReference | GitHubCommandResult {
|
||||
const targets = positionalArgs(args.slice(startIndex));
|
||||
if (targets.length !== 1) {
|
||||
return validationError(label, options.repo, `${label} requires exactly one positive integer or owner/repo#number positional argument`, {
|
||||
const prOption = optionValue(args, "--pr");
|
||||
if (targets.length > 0 && prOption !== undefined) {
|
||||
return validationError(label, options.repo, `${label} accepts either a positional PR target or --pr, not both`, {
|
||||
supportedCommands: [
|
||||
`bun scripts/cli.ts gh ${label} <number> --repo ${options.repo}`,
|
||||
`bun scripts/cli.ts gh ${label} --pr <number> --repo ${options.repo}`,
|
||||
`bun scripts/cli.ts gh ${label} ${options.repo}#<number>`,
|
||||
],
|
||||
});
|
||||
}
|
||||
const shorthand = parseOwnerRepoNumberShorthand(targets[0]);
|
||||
const effectiveTargets = prOption !== undefined ? [prOption] : targets;
|
||||
if (effectiveTargets.length !== 1) {
|
||||
return validationError(label, options.repo, `${label} requires exactly one positive integer or owner/repo#number positional argument`, {
|
||||
supportedCommands: [
|
||||
`bun scripts/cli.ts gh ${label} <number> --repo ${options.repo}`,
|
||||
`bun scripts/cli.ts gh ${label} --pr <number> --repo ${options.repo}`,
|
||||
`bun scripts/cli.ts gh ${label} ${options.repo}#<number>`,
|
||||
],
|
||||
});
|
||||
}
|
||||
const shorthand = parseOwnerRepoNumberShorthand(effectiveTargets[0]);
|
||||
if (shorthand !== null) {
|
||||
const explicitRepo = optionValue(args, "--repo");
|
||||
if (explicitRepo !== undefined && explicitRepo !== shorthand.repo) {
|
||||
@@ -835,7 +853,7 @@ function resolvePositionalPrReference(args: string[], startIndex: number, label:
|
||||
}
|
||||
return { repo: shorthand.repo, number: shorthand.number, shorthand };
|
||||
}
|
||||
const number = parseNumberForCommand(options.repo, targets[0], label);
|
||||
const number = parseNumberForCommand(options.repo, effectiveTargets[0], label);
|
||||
if (typeof number !== "number") return number;
|
||||
return { repo: options.repo, number };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user