Skip to content

Conversation

@rudrankriyam
Copy link
Owner

Summary

This PR adds --sort support to the apps and builds commands for sorting results by upload date.

Changes

  • cmd/commands.go: Added --sort flag to apps and builds commands with validation
  • internal/asc/client.go: Added sort field to query structs and WithAppsSort/WithBuildsSort options
  • internal/asc/client_test.go: Added unit tests for new sort functionality

Usage

# Sort apps by uploaded date (descending)
asc apps --sort -uploadedDate --json

# Sort builds by uploaded date (ascending)
asc builds --app "123456789" --sort uploadedDate --json

Test plan

  • ✅ All unit tests pass
  • ✅ Integration tests pass with real App Store Connect API

🤖 Generated with Claude Code

- Add sort field to appsQuery and buildsQuery structs
- Add WithAppsSort and WithBuildsSort functional options
- Add --sort flag to apps command (sorts by uploadedDate or -uploadedDate)
- Add --sort flag to builds command (sorts by uploadedDate or -uploadedDate)
- Update query builders to use sort parameter
- Add unit tests for new sort options

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@cursor
Copy link

cursor bot commented Jan 20, 2026

PR Summary

Adds sortable results for apps and builds by propagating a sort param end-to-end.

  • cmd/commands.go: Introduces --sort flag for apps and builds with validation; passes asc.WithAppsSort/asc.WithBuildsSort; updates examples
  • internal/asc/client.go: Extends appsQuery/buildsQuery with sort; adds WithAppsSort/WithBuildsSort; updates GetApps/GetBuilds to include sort (and refactors query assembly for GetApps)
  • internal/asc/client_test.go: Adds unit tests covering sort propagation for apps/builds queries

Written by Cursor Bugbot for commit 5fb5721. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

}
if err := validateSort(*sort, "uploadedDate", "-uploadedDate"); err != nil {
return err
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apps command uses invalid sort field uploadedDate

Medium Severity

The apps command's --sort flag accepts uploadedDate and -uploadedDate as valid options, but AppAttributes doesn't contain an uploadedDate field—only Name, BundleID, SKU, and PrimaryLocale. The App Store Connect API only supports sorting by attributes that exist on the resource. The uploadedDate field exists in BuildAttributes, making it valid for the builds command but not for apps. This will either cause API errors or silently fail to sort results as users expect.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Jan 20, 2026

Bugbot Autofix prepared a fix for the bug found in the latest run.

  • ✅ Fixed: Apps command uses invalid sort field uploadedDate
    • Changed the apps command's --sort flag to accept valid AppAttributes fields (bundleId, name, sku) instead of the invalid uploadedDate field that only exists on BuildAttributes.

View PR

@rudrankriyam
Copy link
Owner Author

Superseded by #9 (corrected apps sort keys, expanded tests, and updated docs).

@rudrankriyam rudrankriyam deleted the feature/apps-builds-sort branch January 20, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants