Conversation
| * | ||
| * Encapsulates URL construction, headers, and JSON parsing. | ||
| */ | ||
| export default async function apiRequest<T>( |
Contributor
There was a problem hiding this comment.
Unused generic type parameter
The generic type parameter T is declared on the function signature but is never used — the return type is Promise<Response>, not Promise<T>. TypeScript will flag this as an unused type parameter. Either remove it or update the return type to use it:
Suggested change
| export default async function apiRequest<T>( | |
| export default async function apiRequest( |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/utils/fetch.ts
Line: 10
Comment:
Unused generic type parameter
The generic type parameter `T` is declared on the function signature but is never used — the return type is `Promise<Response>`, not `Promise<T>`. TypeScript will flag this as an unused type parameter. Either remove it or update the return type to use it:
```suggestion
export default async function apiRequest(
```
How can I resolve this? If you propose a fix, please make it concise.| await this.handleLoginCommand(options); | ||
| logger.endCommand( | ||
| `Done! A ${options.keyType} key has been generated and saved to your .env.local file.` | ||
| `Done! ${options.keyType} keys have been generated and saved to your .env.local file.` |
Contributor
There was a problem hiding this comment.
Incorrect plural in success message for single key type
When options.keyType is 'development' or 'production', the message reads e.g. "Done! development keys have been generated..." — but only one key was produced. The phrasing should vary based on whether one or two keys were requested:
Suggested change
| `Done! ${options.keyType} keys have been generated and saved to your .env.local file.` | |
| `Done! ${options.keyType === 'all' ? 'Development and production keys have' : `A ${options.keyType} key has`} been generated and saved to your .env.local file.` |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/cli/src/cli/base.ts
Line: 354
Comment:
Incorrect plural in success message for single key type
When `options.keyType` is `'development'` or `'production'`, the message reads e.g. _"Done! development keys have been generated..."_ — but only one key was produced. The phrasing should vary based on whether one or two keys were requested:
```suggestion
`Done! ${options.keyType === 'all' ? 'Development and production keys have' : `A ${options.keyType} key has`} been generated and saved to your .env.local file.`
```
How can I resolve this? If you propose a fix, please make it concise.
archie-mckenzie
approved these changes
Mar 7, 2026
Merged
brian-lou
pushed a commit
that referenced
this pull request
Mar 7, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## gt@2.7.1 ### Patch Changes - [#1085](#1085) [`dad7824`](dad7824) Thanks [@brian-lou](https://github.com/brian-lou)! - feat: Auth wizard supports both types of key creation - [#1082](#1082) [`3cb3bbd`](3cb3bbd) Thanks [@fernando-aviles](https://github.com/fernando-aviles)! - Bumping CLI timeouts - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 ## @generaltranslation/compiler@1.1.25 ### Patch Changes - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 ## generaltranslation@8.1.14 ### Patch Changes - [#1085](#1085) [`dad7824`](dad7824) Thanks [@brian-lou](https://github.com/brian-lou)! - feat: Auth wizard supports both types of key creation ## gtx-cli@2.7.1 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824), [`3cb3bbd`](3cb3bbd), [`19ae4eb`](19ae4eb)]: - gt@2.7.1 ## gt-i18n@0.4.2 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 - @generaltranslation/supported-locales@2.0.47 ## locadex@1.0.111 ### Patch Changes - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824), [`3cb3bbd`](3cb3bbd), [`19ae4eb`](19ae4eb)]: - gt@2.7.1 ## gt-next@6.13.5 ### Patch Changes - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824), [`19ae4eb`](19ae4eb)]: - generaltranslation@8.1.14 - @generaltranslation/compiler@1.1.25 - gt-i18n@0.4.2 - gt-react@10.11.4 - @generaltranslation/supported-locales@2.0.47 ## @generaltranslation/gt-next-lint@11.0.5 ### Patch Changes - Updated dependencies \[[`19ae4eb`](19ae4eb)]: - gt-next@6.13.5 ## gt-node@0.2.8 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 - gt-i18n@0.4.2 ## gt-react@10.11.4 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824), [`19ae4eb`](19ae4eb)]: - generaltranslation@8.1.14 - @generaltranslation/react-core@1.5.4 - @generaltranslation/supported-locales@2.0.47 ## @generaltranslation/react-core@1.5.4 ### Patch Changes - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 - gt-i18n@0.4.2 - @generaltranslation/supported-locales@2.0.47 ## gt-sanity@1.1.21 ### Patch Changes - [#1076](#1076) [`19ae4eb`](19ae4eb) Thanks [@moss-bryophyta](https://github.com/moss-bryophyta)! - Apply style guide to error messages and warnings: remove "Please", simplify verbose phrasing, fix `in-line` → `inline`. - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 ## @generaltranslation/supported-locales@2.0.47 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824)]: - generaltranslation@8.1.14 ## gt-tanstack-start@0.1.11 ### Patch Changes - Updated dependencies \[[`dad7824`](dad7824), [`19ae4eb`](19ae4eb)]: - generaltranslation@8.1.14 - @generaltranslation/react-core@1.5.4 - gt-i18n@0.4.2 - gt-react@10.11.4 ## gt-next-middleware-e2e@0.1.5 ### Patch Changes - Updated dependencies \[[`19ae4eb`](19ae4eb)]: - gt-next@6.13.5 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Greptile Summary
This PR upgrades the
auth/initwizard in the CLI to let users explicitly choose which type of API key to generate (development,production, orall/both), replacing the previous automatic detection heuristic. It also introduces a centralizedapiRequestutility (fetch.ts) that standardises URL construction and shared headers (including a newgt-api-versionheader) across all credential-related requests.Key changes:
fetch.tshelper: Wraps all CLI→API calls with shared headers (Content-Type,gt-api-version) and a default POST method. Contains an unused generic type parameterTthat should be removed.credentials.tsrefactor:Credentialsnow carries anApiKey[]array instead of a singleapiKeystring, allowing multiple keys to be returned and written in one session.setCredentialsno longer requires atypeargument; key type is read from eachApiKeyobject.areCredentialsSet()now accepts eitherGT_API_KEYorGT_DEV_API_KEY.base.tswizard flow: Auto-detection logic removed; an interactivepromptSelectis shown instead. The'all'option generates both keys in one browser session. The success message uses incorrect plural wording for single-key selections.2.6.30→2.7.0.The logic changes are well-scoped and internally consistent. Main items to address: remove the unused generic type parameter, and fix the grammar in the success message.
Confidence Score: 4/5
Sequence Diagram
sequenceDiagram participant User participant CLI (base.ts) participant credentials.ts participant fetch.ts (apiRequest) participant GT API User->>CLI (base.ts): gt auth (or init wizard) CLI (base.ts)->>User: promptSelect — key type? User-->>CLI (base.ts): development | production | all CLI (base.ts)->>credentials.ts: retrieveCredentials(settings, keyType) credentials.ts->>fetch.ts (apiRequest): POST /cli/wizard/session {keyType} fetch.ts (apiRequest)->>GT API: POST /cli/wizard/session GT API-->>fetch.ts (apiRequest): { sessionId } fetch.ts (apiRequest)-->>credentials.ts: Response credentials.ts->>User: Open browser → dashboard/cli/wizard/:sessionId loop Poll every 2 s credentials.ts->>fetch.ts (apiRequest): GET /cli/wizard/:sessionId fetch.ts (apiRequest)->>GT API: GET /cli/wizard/:sessionId GT API-->>fetch.ts (apiRequest): 200 { apiKeys: ApiKey[], projectId } fetch.ts (apiRequest)-->>credentials.ts: Response end credentials.ts->>fetch.ts (apiRequest): DELETE /cli/wizard/:sessionId credentials.ts-->>CLI (base.ts): Credentials { apiKeys[], projectId } CLI (base.ts)->>credentials.ts: setCredentials(credentials, framework) credentials.ts->>credentials.ts: Write GT_PROJECT_ID + GT_DEV_API_KEY / GT_API_KEY to .env.localLast reviewed commit: 4f413db