[PR #456] [MERGED] feat: CI/CD exit codes and JUnit reporting #539

Closed
opened 2026-02-26 22:31:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/456
Author: @rudrankriyam
Created: 2/9/2026
Status: Merged
Merged: 2/9/2026
Merged by: @rudrankriyam

Base: mainHead: ci-exit-codes


📝 Commits (10+)

  • 33b7f86 feat: add CI/CD exit codes and JUnit reporting
  • 8cb7b67 fix: improve JUnit report and flag validation
  • a65c392 fix: correct getCommandName args handling
  • ffe3302 fix: properly handle root flags before subcommand in getCommandName
  • ad1b395 docs: add edge case testing guidance to AGENTS.md
  • 475f35c refactor: clean up error mapping duplication and add more tests
  • 7873858 fix: clamp HTTP exit codes and keep working getCommandName
  • 4f23562 fix: add ErrConflict sentinel check in exit code mapper and validate --report-file without --report
  • 60430c2 Merge branch 'pr-459' into ci-exit-codes
  • d40ef43 fix: harden CI command parsing and API error exit mapping

📊 Changes

14 files changed (+1323 additions, -28 deletions)

View changed files

📝 AGENTS.md (+29 -0)
cmd/exit_codes.go (+114 -0)
cmd/exit_codes_test.go (+329 -0)
📝 cmd/run.go (+160 -13)
📝 internal/asc/client_http.go (+41 -9)
📝 internal/asc/client_test.go (+37 -0)
📝 internal/asc/errors.go (+7 -3)
📝 internal/asc/notary.go (+1 -1)
📝 internal/cli/cmdtest/error_hints_test.go (+2 -2)
internal/cli/cmdtest/exit_codes_test.go (+166 -0)
internal/cli/shared/ci_flags.go (+57 -0)
internal/cli/shared/junit_report.go (+176 -0)
internal/cli/shared/junit_report_test.go (+203 -0)
📝 internal/cli/shared/shared.go (+1 -0)

📄 Description

Summary

Add first-class CI/CD support with deterministic exit codes and optional JUnit XML report output.

Exit Codes

Code Meaning
0 Success
1 Generic error
2 Invalid usage / flags
3 Authentication failure
4 Resource not found
5 Conflict (resource exists)
10-59 HTTP 4xx errors
60-99 HTTP 5xx errors

New Flags

  • --report junit - Enable JUnit XML output
  • --report-file <path> - Write report to file
  • --no-update - Recommended for CI to skip update checks

Example Usage

asc builds list \
  --app "$ASC_APP_ID" \
  --no-update \
  --report junit \
  --report-file ./artifacts/builds.xml

Test plan

  • Exit code constants match specification
  • Exit code mapper handles all error types
  • JUnit XML writer produces valid XML
  • JUnit XML escapes special characters
  • CI flags are properly bound
  • All existing tests pass
  • make format, make lint, make test pass

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/456 **Author:** [@rudrankriyam](https://github.com/rudrankriyam) **Created:** 2/9/2026 **Status:** ✅ Merged **Merged:** 2/9/2026 **Merged by:** [@rudrankriyam](https://github.com/rudrankriyam) **Base:** `main` ← **Head:** `ci-exit-codes` --- ### 📝 Commits (10+) - [`33b7f86`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/33b7f863bb8e4d58eee82b65d12e0754a62b72c3) feat: add CI/CD exit codes and JUnit reporting - [`8cb7b67`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/8cb7b676bab8f44562021a4c692441564698e3d7) fix: improve JUnit report and flag validation - [`a65c392`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/a65c3920abd635c79d1cbef331006b66179ee6bd) fix: correct getCommandName args handling - [`ffe3302`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/ffe33024c4ae9015dfe69d4aacc8a171efab1632) fix: properly handle root flags before subcommand in getCommandName - [`ad1b395`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/ad1b39536a1815c8ef3104992b54e3b7a66aa5a3) docs: add edge case testing guidance to AGENTS.md - [`475f35c`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/475f35c01b1a22f060e1ed34cd6251eb84afd55c) refactor: clean up error mapping duplication and add more tests - [`7873858`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/78738581a8004d2579711be96cb1495c88abd9f1) fix: clamp HTTP exit codes and keep working getCommandName - [`4f23562`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/4f2356266ec3cbd533d945e988e3e904379c7ec5) fix: add ErrConflict sentinel check in exit code mapper and validate --report-file without --report - [`60430c2`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/60430c2a4d7bf2ce334930b33cb55a569c08a29c) Merge branch 'pr-459' into ci-exit-codes - [`d40ef43`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/d40ef435e85a3fdbba8441dd2e42afc780bffe82) fix: harden CI command parsing and API error exit mapping ### 📊 Changes **14 files changed** (+1323 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+29 -0) ➕ `cmd/exit_codes.go` (+114 -0) ➕ `cmd/exit_codes_test.go` (+329 -0) 📝 `cmd/run.go` (+160 -13) 📝 `internal/asc/client_http.go` (+41 -9) 📝 `internal/asc/client_test.go` (+37 -0) 📝 `internal/asc/errors.go` (+7 -3) 📝 `internal/asc/notary.go` (+1 -1) 📝 `internal/cli/cmdtest/error_hints_test.go` (+2 -2) ➕ `internal/cli/cmdtest/exit_codes_test.go` (+166 -0) ➕ `internal/cli/shared/ci_flags.go` (+57 -0) ➕ `internal/cli/shared/junit_report.go` (+176 -0) ➕ `internal/cli/shared/junit_report_test.go` (+203 -0) 📝 `internal/cli/shared/shared.go` (+1 -0) </details> ### 📄 Description ## Summary Add first-class CI/CD support with deterministic exit codes and optional JUnit XML report output. ### Exit Codes | Code | Meaning | |------|---------| | 0 | Success | | 1 | Generic error | | 2 | Invalid usage / flags | | 3 | Authentication failure | | 4 | Resource not found | | 5 | Conflict (resource exists) | | 10-59 | HTTP 4xx errors | | 60-99 | HTTP 5xx errors | ### New Flags - `--report junit` - Enable JUnit XML output - `--report-file <path>` - Write report to file - `--no-update` - Recommended for CI to skip update checks ### Example Usage ```bash asc builds list \ --app "$ASC_APP_ID" \ --no-update \ --report junit \ --report-file ./artifacts/builds.xml ``` ## Test plan - [x] Exit code constants match specification - [x] Exit code mapper handles all error types - [x] JUnit XML writer produces valid XML - [x] JUnit XML escapes special characters - [x] CI flags are properly bound - [x] All existing tests pass - [x] `make format`, `make lint`, `make test` pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 22:31:26 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#539
No description provided.