chore: initial commit for new commands#46
Conversation
There was a problem hiding this comment.
🤖 StallionDevX AI Review
Quality Score: ██████████ 95/100
Verdict: approve
Summary
This pull request introduces a significant set of new commands for listing resources (organizations, projects, buckets, bundles, releases) and managing CLI context. It also includes a major overhaul of the command-line interface's branding and user experience, moving to a new UI module and @inquirer/prompts. The architectural changes, particularly the user-client.ts module, centralize logic for resolving context and making authenticated API calls, which is a good improvement for maintainability. Overall, the changes are well-structured and enhance the CLI's functionality and usability.
⚠️ Warning (2)
- 🧹 Untyped API Response Data —
src/api/user-client.ts:129
The API responses forENDPOINTS.PROJECT.LISTandENDPOINTS.BUCKET.LISTare typed asany[]. This reduces type safety and makes the code harder to maintain and refactor, as the structure ofpandbobjects is inferred at runtime. - 🧹 Hardcoded Default Region 'ap' —
src/api/user-client.ts:13
The default region 'ap' is hardcoded as a fallback when parsing the CI token region or retrieving it from the context. While 'ap' might be the primary region, hardcoding it could lead to issues if the CLI is used in environments where 'ap' is not the default or if a token/context genuinely lacks region information and a different default is expected.
| /** | ||
| * Resolve a project id. Precedence: explicit flag > saved context (when it | ||
| * belongs to this org) > interactive pick. An interactive pick is saved back | ||
| * to the context. Pass useSaved: false to force a fresh pick. |
There was a problem hiding this comment.
Untyped API Response Data
The API responses for ENDPOINTS.PROJECT.LIST and ENDPOINTS.BUCKET.LIST are typed as any[]. This reduces type safety and makes the code harder to maintain and refactor, as the structure of p and b objects is inferred at runtime.
| * to the context. Pass useSaved: false to force a fresh pick. | |
| Define specific TypeScript interfaces (e.g., `ProjectSummary`, `BucketSummary`) for the expected structure of project and bucket objects returned by the API. Update the `client.post` calls to use these interfaces, for example: `client.post<{ data: ProjectSummary[] }>(...)`. |
| /** | ||
| * Build an ApiClient authenticated with a CI token (x-ci-token). Region is | ||
| * derived from the token itself. Used by the non-interactive --ci-token path of | ||
| * the project-scoped read commands. |
There was a problem hiding this comment.
Hardcoded Default Region 'ap'
The default region 'ap' is hardcoded as a fallback when parsing the CI token region or retrieving it from the context. While 'ap' might be the primary region, hardcoding it could lead to issues if the CLI is used in environments where 'ap' is not the default or if a token/context genuinely lacks region information and a different default is expected.
| * the project-scoped read commands. | |
| Consider making the default region configurable (e.g., via an environment variable or a global CLI config) or ensure that all tokens and context entries always contain a valid region to avoid relying on a hardcoded fallback. |
Summary
Generated by StallionDevX