framework tools/git: strict value guards + provider-failure normalization family-wide (codex blockers on PR #1464)
ci/woodpecker/pr/ci Pipeline is pending
ci/woodpecker/pr/ci Pipeline is pending
- Value guards now reject option-like values: --anything always, and single-dash flag shapes (-h, -i). Previously -b --help consumed --help as the body and performed the write (codex example: issue-close -i --help proceeding to 'Closed GitHub issue #--help'). Multi-char dash-leading text (-start of a list) stays a legal value. - Every remaining direct provider exec (gh/tea/CMD arrays across issue-create/edit/assign/list/view, milestone-*, pr-create/edit, pr-close, issue-close/reopen) wrapped with rc capture and normalized to exit 1 with a stderr message — provider exit 2 no longer collides with the reserved usage-error status. - All 16 usage-contract suites gained option-like and short-flag arms (16/16 green). Existing suites re-verified; test-pr-edit and test-issue-create-interactive-auth fail identically with these changes stashed (environment-coupled, not regressions; documented).
This commit is contained in:
@@ -82,7 +82,7 @@ if comments:
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-i|--issue)
|
||||
[[ $# -ge 2 ]] || usage_error "option $1 requires a value"
|
||||
[[ $# -ge 2 && "$2" != --* && ! "$2" =~ ^-[a-zA-Z]$ ]] || usage_error "option $1 requires a value (option-like values are rejected)"
|
||||
ISSUE_NUMBER="$2"
|
||||
shift 2
|
||||
;;
|
||||
@@ -109,7 +109,9 @@ fi
|
||||
detect_platform >/dev/null
|
||||
|
||||
if [[ "$PLATFORM" == "github" ]]; then
|
||||
gh issue view "$ISSUE_NUMBER"
|
||||
prov_rc=0
|
||||
gh issue view "$ISSUE_NUMBER" || prov_rc=$?
|
||||
[[ "$prov_rc" -eq 0 ]] || { echo "Error: provider command failed (exit ${prov_rc}; provider failure, not a usage error)" >&2; exit 1; }
|
||||
elif [[ "$PLATFORM" == "gitea" ]]; then
|
||||
if command -v tea >/dev/null 2>&1; then
|
||||
# --comments is what makes tea print the comment bodies (#1357 F3).
|
||||
|
||||
Reference in New Issue
Block a user