[GH-ISSUE #83] Add build-number helper commands #27

Closed
opened 2026-02-26 21:32:51 +03:00 by kerem · 0 comments
Owner

Originally created by @rudrankriyam on GitHub (Jan 24, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/83

Summary

Add a convenience command to fetch the latest build for an app, optionally filtered by version string.

Rationale

While asc builds list --app APP_ID --sort -uploadedDate --limit 1 works, a dedicated builds latest command provides a cleaner interface for CI/CD scripts and AI agents that frequently need the most recent build.

Proposed CLI

# Get latest build for an app (full metadata)
asc builds latest --app APP_ID

# Get latest build for a specific version
asc builds latest --app APP_ID --version 1.2.3

# Filter by platform
asc builds latest --app APP_ID --platform IOS

# Output formats (follows existing pattern)
asc builds latest --app APP_ID --output table
asc builds latest --app APP_ID --output markdown

Output (JSON by default)

{
  "data": {
    "type": "builds",
    "id": "BUILD_ID",
    "attributes": {
      "version": "1.2.3",
      "buildNumber": "456",
      "uploadedDate": "2025-01-20T10:00:00Z",
      "processingState": "VALID",
      "minOsVersion": "17.0"
    }
  }
}

Design Principles (AI-Agent Friendly)

  • Returns full build metadata - Let the agent extract what it needs
  • No business logic in CLI - No --increment or --numeric flags; incrementing belongs in the calling script
  • Follows existing patterns - Uses --output not --format, same flag names as other commands
  • Single command - No fragmentation into testflight latest-build-number / appstore latest-build-number

API Endpoints

  • Builds list: GET /v1/builds?filter[app]=...&sort=-uploadedDate&limit=1
  • Pre-release versions: GET /v1/preReleaseVersions (for version filtering)

Implementation Plan

  1. Add BuildsLatestCommand() in cmd/builds.go or new file
  2. Reuse existing ListBuilds with sort and limit parameters
  3. Add --version filter using preReleaseVersion relationship
  4. Return single build object (not array)

Tests

  • CLI validation (missing --app)
  • Version filtering logic
  • Platform filtering
  • Output format tests

Acceptance Criteria

  • asc builds latest --app APP_ID returns latest build as JSON object
  • --version filter works correctly
  • --platform filter works correctly
  • --output table/markdown supported
  • Returns proper exit code when no builds found
Originally created by @rudrankriyam on GitHub (Jan 24, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/83 ## Summary Add a convenience command to fetch the latest build for an app, optionally filtered by version string. ## Rationale While `asc builds list --app APP_ID --sort -uploadedDate --limit 1` works, a dedicated `builds latest` command provides a cleaner interface for CI/CD scripts and AI agents that frequently need the most recent build. ## Proposed CLI ```bash # Get latest build for an app (full metadata) asc builds latest --app APP_ID # Get latest build for a specific version asc builds latest --app APP_ID --version 1.2.3 # Filter by platform asc builds latest --app APP_ID --platform IOS # Output formats (follows existing pattern) asc builds latest --app APP_ID --output table asc builds latest --app APP_ID --output markdown ``` ## Output (JSON by default) ```json { "data": { "type": "builds", "id": "BUILD_ID", "attributes": { "version": "1.2.3", "buildNumber": "456", "uploadedDate": "2025-01-20T10:00:00Z", "processingState": "VALID", "minOsVersion": "17.0" } } } ``` ## Design Principles (AI-Agent Friendly) - **Returns full build metadata** - Let the agent extract what it needs - **No business logic in CLI** - No `--increment` or `--numeric` flags; incrementing belongs in the calling script - **Follows existing patterns** - Uses `--output` not `--format`, same flag names as other commands - **Single command** - No fragmentation into `testflight latest-build-number` / `appstore latest-build-number` ## API Endpoints - Builds list: `GET /v1/builds?filter[app]=...&sort=-uploadedDate&limit=1` - Pre-release versions: `GET /v1/preReleaseVersions` (for version filtering) ## Implementation Plan 1. Add `BuildsLatestCommand()` in `cmd/builds.go` or new file 2. Reuse existing `ListBuilds` with sort and limit parameters 3. Add `--version` filter using preReleaseVersion relationship 4. Return single build object (not array) ## Tests - CLI validation (missing `--app`) - Version filtering logic - Platform filtering - Output format tests ## Acceptance Criteria - [x] `asc builds latest --app APP_ID` returns latest build as JSON object - [x] `--version` filter works correctly - [x] `--platform` filter works correctly - [x] `--output table/markdown` supported - [x] Returns proper exit code when no builds found
kerem closed this issue 2026-02-26 21:32:52 +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#27
No description provided.