Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

PR checklist

  • Ensure you have added or ran the appropriate tests for your PR.
  • DCO signed

What type of PR is this?

Feature enhancement

What this PR does / why we need it:

Users currently have no CLI-based way to discover their organization and project names for configuring recce-cloud commands. This adds list-orgs and list-projects commands for discovery.

Changes:

  • API Client (recce_cloud/api/client.py):

    • Added list_organizations() - fetches orgs user has access to
    • Added list_projects(org_id) - fetches projects in an org
  • CLI Commands (recce_cloud/cli.py):

    • Added list-orgs command with --json flag for table/JSON output
    • Added list-projects --org <name> command with --json flag
    • Fixed F541 flake8 errors: changed f-strings to regular strings where no placeholders exist (lines 115, 198)
  • Tests:

    • Added 7 API client tests covering success/empty/error cases
    • Added 12 CLI tests covering output formats, auth, and error handling

Usage:

# List organizations
recce-cloud list-orgs
recce-cloud list-orgs --json

# List projects in an org
recce-cloud list-projects --org myorg
recce-cloud list-projects --org myorg --json

Which issue(s) this PR fixes:

Fixes DRC-2270

Special notes for your reviewer:

Local imports (json, Table) intentionally kept within functions to maintain lightweight CLI design consistent with existing patterns.

Does this PR introduce a user-facing change?:

Added `recce-cloud list-orgs` and `recce-cloud list-projects` commands to discover organization and project names for CLI configuration.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add list-orgs and list-projects commands to recce-cloud CLI [DRC-2270] Add list-orgs and list-projects discovery commands to recce-cloud CLI Dec 14, 2025
Copilot AI requested a review from even-wei December 14, 2025 00:12
The list-projects API endpoint only accepts numeric organization IDs,
but the CLI was passing org names directly. Added _resolve_org_id()
helper that looks up org name via list_organizations() when a
non-numeric value is provided.

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

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: even-wei <[email protected]>
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