Skip to content

[cli] client add/list: shared-dev-credentials#2622

Merged
stopachka merged 2 commits into
mainfrom
cli-codex
May 4, 2026
Merged

[cli] client add/list: shared-dev-credentials#2622
stopachka merged 2 commits into
mainfrom
cli-codex

Conversation

@stopachka
Copy link
Copy Markdown
Contributor

@stopachka stopachka commented Apr 30, 2026

Our Google Clients now support shared dev credentials!

This PR updates npx instant-cli auth client add and npx instant-cli auth client list to support shared dev credentials.

Note: You may wonder: how do you upgrade a client from dev-credentials? A follow-on PR will implement the update command.

add

--dev-credentials

You can pass in a --dev-credentials flag to explicitly choose dev-credentials:

npx instant-cli auth client add --type google --app-type web --name google-dev --dev-credentials

When you do, we will include a notice in the prompt output saying you have dev credentials

--yes defaults to --dev-credentials

If you create with --yes and don't provide a --client-id or a --client-token, we will default to --dev-credentials

npx instant-cli auth client add --type google --app-type web --name google-dev --yes

Interactive mode asks you for your choice

For interactive runs, Google web asks whether to use dev credentials or your own Google credentials. If you pass --client-id, --client-secret, or --custom-redirect-uri, the CLI treats that as the custom credentials path.

This is how the output boxes look:

┌──────────────────────────────────────────────────┐
│ Google OAuth client created: google-custom       │
│ App type: web                                    │
│ ID: bc87b763-bccb-431d-87f0-e3daa22d474a         │
│ Google Client ID: test-google-client-id          │
│                                                  │
│ Add this redirect URI in Google Console:         │
│ https://api.instantdb.com/runtime/oauth/callback │
│                                                  │
└──────────────────────────────────────────────────┘

┌────────────────────────────────────────────────────────┐
│ Google OAuth client created: google-dev-yes2           │
│ App type: web                                          │
│ Credentials: Instant dev credentials                   │
│ ID: ae5ac75d-6840-42c9-a8d5-2881f630300e               │
│                                                        │
│ No Google Console setup required.                      │
│ Works on localhost and Expo during development.        │
│                                                        │
│ For production, use your own Google OAuth credentials. │
└────────────────────────────────────────────────────────┘

list

auth client list now explicitly notes that you are using dev-credentials.

This is how the output looks:

google-dev-yes2
  Provider: google
  App type: web
  Credentials: Instant dev credentials
  ID: ae5ac75d-6840-42c9-a8d5-2881f630300e
  Client id: managed by Instant
  Redirect URL: localhost and Expo allowed automatically
google-custom
  Provider: google
  App type: web
  Credentials: custom
  ID: bc87b763-bccb-431d-87f0-e3daa22d474a
  Client id: test-google-client-id
  Redirect URL: https://api.instantdb.com/runtime/oauth/callback

Testing

# 1. Come on into cli-nodejs and build a throwaway app.

export INSTANT_CLI_DEV=true
cd client/sandbox/cli-nodejs
rm -f .env
pnpm exec instant-cli init --yes --title testing-app

# 2. Create a Google web client with --yes and no Google credentials.

pnpm exec instant-cli auth client add \
  --type google \
  --app-type web \
  --name google-dev-yes \
  --yes

## This should choose dev credentials automatically.

# 3. Create a second Google web client by explicitly passing --dev-credentials.

pnpm exec instant-cli auth client add \
  --type google \
  --app-type web \
  --name google-dev-explicit \
  --dev-credentials

## This should automatically get created too

# 4. List confirm both dev clients show the same dev-credentials fields.

pnpm exec instant-cli auth client list

# 5. Create a normal custom Google web client.

pnpm exec instant-cli auth client add \
  --type google \
  --app-type web \
  --name google-custom \
  --client-id test-google-client-id \
  --client-secret test-google-client-secret \
  --yes

## Notice the success output is different from the dev-credentials flow:

# 6. List again and confirm the custom client is custom, while the first two are still dev clients.

pnpm exec instant-cli auth client list

# 7. Check JSON output. This should still be the raw API shape.

pnpm exec instant-cli auth client list --json

# 8. Test the interactive path.

#    Run add without --yes. 

pnpm exec instant-cli auth client add \
  --type google \
  --name google-dev-interactive

## See you get asked what type you want. Go through both the dev credential and custom flow

pnpm exec instant-cli auth client list

# 9. Test that --dev-credentials is rejected for native Google clients.

pnpm exec instant-cli auth client add \
  --type google \
  --app-type ios \
  --name google-ios-dev \
  --dev-credentials

# Notice this fails with a message saying --dev-credentials is only supported for Google web clients.

# 10. Test that --dev-credentials cannot be combined with custom credential flags.

pnpm exec instant-cli auth client add \
  --type google \
  --app-type web \
  --name google-invalid \
  --dev-credentials \
  --client-id test-google-client-id

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Google "dev credentials" mode to CLI auth client flows: new --dev-credentials flag and interactive selector, validation preventing incompatible flags/non-web app types, plumbs use_shared_credentials through API/schema, adjusts list output for dev credentials, and adds tests for add/list and error cases.

Changes

Cohort / File(s) Summary
Core CLI commands
client/packages/cli/src/commands/auth/client/add.ts, client/packages/cli/src/commands/auth/client/list.ts
Introduce credential-mode resolution (dev vs custom), enforce --dev-credentials compatibility (web-only; incompatible with --client-id/--client-secret/--custom-redirect-uri), set/omit clientId/clientSecret/redirectUri for shared/dev mode, and update list output to show App type and Credentials with Instant-specific display strings.
CLI help/flags
client/packages/cli/src/index.ts
Add --dev-credentials help text and update Google option descriptions to reflect conditional requirements when using dev credentials.
API/schema layer
client/packages/cli/src/lib/oauth.ts
Add optional use_shared_credentials to OAuthClient schema/type and accept useSharedCredentials in addOAuthClient, mapping to API request body.
Tests — add flow
client/packages/cli/__tests__/authClientAddGoogle.test.ts
Add tests for non-interactive --yes dev client creation, rejecting incompatible flag combinations and non-web app types, and interactive selection of dev credentials.
Tests — list output
client/packages/cli/__tests__/authClientList.test.ts
Add tests mocking OAuth responses to verify human-readable and --json outputs include use_shared_credentials/dev-credentials labeling and expected fields for shared vs custom clients.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant Prompt as "Interactive Prompt"
  participant API as "Instant API"
  participant Logger

  User->>CLI: run `instant auth client add --provider google ...`
  CLI->>Prompt: resolve credential mode (auto from flags or ask)
  alt dev mode selected
    Prompt-->>CLI: "dev"
    CLI->>API: POST /oauth/clients { provider: google, use_shared_credentials: true, clientId: null, redirectUri: null }
    API-->>CLI: 201 created (client with use_shared_credentials: true)
    CLI->>Logger: log "Credentials: Instant dev credentials" and dev-specific messages
  else custom mode selected
    Prompt-->>CLI: "custom"
    CLI->>API: POST /oauth/clients { provider: google, clientId, clientSecret, redirectUri }
    API-->>CLI: 201 created (client with use_shared_credentials: false)
    CLI->>Logger: log custom credential lines and redirect instructions
  end
  CLI-->>User: command output
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • dwwoelfel
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[cli] client add/list: shared-dev-credentials' directly corresponds to the main changes, which add shared dev credentials support to the auth client add and list commands.
Description check ✅ Passed The description provides a comprehensive overview of the changes, including feature details for --dev-credentials, --yes behavior, interactive mode, list output, and testing instructions that all relate to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cli-codex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@client/packages/cli/src/commands/auth/client/update.ts`:
- Around line 228-235: The updateGoogleToDevCredentials function currently only
sets useSharedCredentials and redirectTo; modify the payload passed to
updateOAuthClient to also wipe stored custom Google credentials by setting the
client_id/client_secret (clientId and clientSecret) fields to null/empty so the
secret is removed when switching back to dev mode; keep existing fields
(oauthClientId, useSharedCredentials, redirectTo) and add explicit clientId:
null and clientSecret: null in the updateOAuthClient call.
- Around line 301-330: The code currently still calls promptFlag for missing
Google credential fields when switchingFromShared even in --yes mode; update the
logic so --yes never triggers interactive prompts: either (A) add an early check
after computing switchingFromShared that if yes && switchingFromShared &&
!hasAnyUpdateFlag (or specifically missing required flags as determined by
hasFlag(opts, 'client-id')/hasFlag(opts, 'client-secret')/hasFlag(opts,
'custom-redirect-uri')/hasFlag(opts, 'dev-credentials')) then return yield*
BadArgsError.make(...) indicating required flags are missing, or (B) make each
promptFlag call’s promptIf and required conditions include !yes (e.g. promptIf:
!yes && (promptAll || switchingFromShared && !hasFlag(...)), required: !yes &&
(promptAll || switchingFromShared)), so promptFlag is never invoked when yes is
true; reference symbols: yes, hasAnyUpdateFlag, switchingFromShared, promptAll,
promptFlag, hasFlag, and BadArgsError.make.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c1cc8acd-b7d6-41b4-9ddd-3e27486ae20b

📥 Commits

Reviewing files that changed from the base of the PR and between 9988b73 and 9063159.

📒 Files selected for processing (10)
  • client/packages/cli/__tests__/authClientAddGoogle.test.ts
  • client/packages/cli/__tests__/authClientList.test.ts
  • client/packages/cli/__tests__/authClientUpdate.test.ts
  • client/packages/cli/src/commands/auth/client/add.ts
  • client/packages/cli/src/commands/auth/client/list.ts
  • client/packages/cli/src/commands/auth/client/update.ts
  • client/packages/cli/src/index.ts
  • client/packages/cli/src/lib/oauth.ts
  • server/src/instant/dash/routes.clj
  • server/src/instant/model/app_oauth_client.clj

Comment on lines +228 to +235
const updateGoogleToDevCredentials = Effect.fn(function* (
client: OAuthClientRow,
) {
const response = yield* updateOAuthClient({
oauthClientId: client.id,
useSharedCredentials: true,
redirectTo: null,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Clear stored custom Google credentials when switching back to dev mode.

This update only flips useSharedCredentials and clears redirectTo. The previous client_id / client_secret will still be retained unless the backend does extra cleanup, which defeats the point of switching away from custom credentials and unnecessarily keeps a secret around. Please wipe those fields as part of this transition.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/packages/cli/src/commands/auth/client/update.ts` around lines 228 -
235, The updateGoogleToDevCredentials function currently only sets
useSharedCredentials and redirectTo; modify the payload passed to
updateOAuthClient to also wipe stored custom Google credentials by setting the
client_id/client_secret (clientId and clientSecret) fields to null/empty so the
secret is removed when switching back to dev mode; keep existing fields
(oauthClientId, useSharedCredentials, redirectTo) and add explicit clientId:
null and clientSecret: null in the updateOAuthClient call.

Comment on lines +301 to +330
if (yes && !hasAnyUpdateFlag) {
return yield* BadArgsError.make({
message:
'Must specify at least one of --client-id, --client-secret, --custom-redirect-uri, or --dev-credentials.',
});
}

const selectedMode =
isWeb && !hasAnyUpdateFlag && !yes
? yield* selectGoogleCredentialMode()
: ('custom' as const);

if (selectedMode === 'dev') {
return yield* updateGoogleToDevCredentials(client);
}

const promptAll = !hasAnyUpdateFlag && !yes;
const switchingFromShared = Boolean(client.use_shared_credentials);
const clientId = yield* promptFlag(opts, 'client-id', {
promptIf: promptAll || (switchingFromShared && !hasFlag(opts, 'client-id')),
required: promptAll || switchingFromShared,
prompt: clientIdPrompt(
link('https://console.developers.google.com/apis/credentials'),
),
});
const clientSecret = yield* promptFlag(opts, 'client-secret', {
promptIf:
isWeb &&
(promptAll || (switchingFromShared && !hasFlag(opts, 'client-secret'))),
required: isWeb && (promptAll || switchingFromShared),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't prompt in --yes mode when leaving shared Google credentials.

For a shared Google web client, switchingFromShared forces promptFlag(...) for any missing custom credential fields. That means instant-cli auth client update --yes --name google-shared --client-id ... still blocks on an interactive prompt for --client-secret. In --yes mode this should fail fast with a BadArgsError, not prompt.

Suggested direction
   if (yes && !hasAnyUpdateFlag) {
     return yield* BadArgsError.make({
       message:
         'Must specify at least one of --client-id, --client-secret, --custom-redirect-uri, or --dev-credentials.',
     });
   }
+
+  if (yes && switchingFromShared && !devCredentialsFlag) {
+    if (!hasFlag(opts, 'client-id') || (isWeb && !hasFlag(opts, 'client-secret'))) {
+      return yield* BadArgsError.make({
+        message:
+          'When disabling Google dev credentials with --yes, you must also provide --client-id and --client-secret.',
+      });
+    }
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/packages/cli/src/commands/auth/client/update.ts` around lines 301 -
330, The code currently still calls promptFlag for missing Google credential
fields when switchingFromShared even in --yes mode; update the logic so --yes
never triggers interactive prompts: either (A) add an early check after
computing switchingFromShared that if yes && switchingFromShared &&
!hasAnyUpdateFlag (or specifically missing required flags as determined by
hasFlag(opts, 'client-id')/hasFlag(opts, 'client-secret')/hasFlag(opts,
'custom-redirect-uri')/hasFlag(opts, 'dev-credentials')) then return yield*
BadArgsError.make(...) indicating required flags are missing, or (B) make each
promptFlag call’s promptIf and required conditions include !yes (e.g. promptIf:
!yes && (promptAll || switchingFromShared && !hasFlag(...)), required: !yes &&
(promptAll || switchingFromShared)), so promptFlag is never invoked when yes is
true; reference symbols: yes, hasAnyUpdateFlag, switchingFromShared, promptAll,
promptFlag, hasFlag, and BadArgsError.make.

@github-actions
Copy link
Copy Markdown
Contributor

View Vercel preview at instant-www-js-cli-codex-jsv.vercel.app.

@stopachka stopachka changed the title [codex-proposal] CLI shared dev credentials for OAuth clients [cli] client add/list: shared-dev-credentials Apr 30, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
client/packages/cli/src/commands/auth/client/add.ts (1)

156-162: 💤 Low value

Document the implicit dev-credentials default with --yes.

When --yes is passed without any credential flags, the code defaults to dev credentials for web apps. This is tested behavior but could surprise users expecting an error for missing credentials.

Consider adding a brief comment explaining this intentional default, or emitting a log message when dev credentials are auto-selected via --yes.

💡 Optional: Add clarifying comment
   const credentialMode =
     appType !== 'web' || hasCustomCredentialFlag
       ? 'custom'
       : devCredentialsFlag || yes
-        ? 'dev'
+        ? 'dev' // With --yes and no custom credentials, default to dev credentials for quick setup
         : yield* selectGoogleCredentialMode();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/packages/cli/src/commands/auth/client/add.ts` around lines 156 - 162,
The branch that sets credentialMode (symbols: credentialMode,
useSharedCredentials, selectGoogleCredentialMode, appType,
hasCustomCredentialFlag, devCredentialsFlag, yes) implicitly selects 'dev' for
web apps when --yes is provided; add either a brief inline comment above this
block documenting that --yes auto-selects dev credentials for web apps, or emit
a warning/info log when credentialMode is set to 'dev' because yes is true
(e.g., log that dev credentials were auto-selected due to --yes) so users aren’t
surprised by the implicit default.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@client/packages/cli/src/commands/auth/client/add.ts`:
- Around line 156-162: The branch that sets credentialMode (symbols:
credentialMode, useSharedCredentials, selectGoogleCredentialMode, appType,
hasCustomCredentialFlag, devCredentialsFlag, yes) implicitly selects 'dev' for
web apps when --yes is provided; add either a brief inline comment above this
block documenting that --yes auto-selects dev credentials for web apps, or emit
a warning/info log when credentialMode is set to 'dev' because yes is true
(e.g., log that dev credentials were auto-selected due to --yes) so users aren’t
surprised by the implicit default.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00a2a78e-06c4-4936-9402-d9481c7524a4

📥 Commits

Reviewing files that changed from the base of the PR and between 2fbe416 and a5dcf35.

📒 Files selected for processing (6)
  • client/packages/cli/__tests__/authClientAddGoogle.test.ts
  • client/packages/cli/__tests__/authClientList.test.ts
  • client/packages/cli/src/commands/auth/client/add.ts
  • client/packages/cli/src/commands/auth/client/list.ts
  • client/packages/cli/src/index.ts
  • client/packages/cli/src/lib/oauth.ts
✅ Files skipped from review due to trivial changes (1)
  • client/packages/cli/src/lib/oauth.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • client/packages/cli/tests/authClientList.test.ts
  • client/packages/cli/src/index.ts

@stopachka stopachka force-pushed the cli-codex branch 2 times, most recently from f9b11a1 to 2743584 Compare April 30, 2026 21:38
@stopachka
Copy link
Copy Markdown
Contributor Author

stopachka commented Apr 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread client/packages/cli/src/commands/auth/client/add.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
client/packages/cli/src/lib/oauth.ts (1)

110-139: ⚡ Quick win

Encode the shared-credentials invariant inside addOAuthClient.

client/packages/cli/src/commands/auth/client/add.ts currently has to blank out clientId, clientSecret, and redirectTo before calling this helper. Moving that branch here would keep the new useSharedCredentials contract from drifting in future add/update callers.

Suggested refactor
 export const addOAuthClient = Effect.fn(function* (params: {
   appId?: string;
   providerId: string;
   clientName: string;
   clientId?: string;
   clientSecret?: string;
   authorizationEndpoint?: string;
   tokenEndpoint?: string;
   discoveryEndpoint?: string;
   redirectTo?: string;
   meta?: unknown;
   useSharedCredentials?: boolean;
 }) {
   const http = (yield* InstantHttpAuthed).pipe(withCommand('auth'));
   const targetAppId = params.appId ?? (yield* CurrentApp).appId;
+  const usingSharedCredentials = params.useSharedCredentials === true;
 
   return yield* http
     .post(`/dash/apps/${targetAppId}/oauth_clients`, {
       body: HttpBody.unsafeJson({
         provider_id: params.providerId,
         client_name: params.clientName,
-        client_id: params.clientId,
-        client_secret: params.clientSecret,
         authorization_endpoint: params.authorizationEndpoint,
         token_endpoint: params.tokenEndpoint,
         discovery_endpoint: params.discoveryEndpoint,
-        redirect_to: params.redirectTo,
+        ...(usingSharedCredentials
+          ? {}
+          : {
+              client_id: params.clientId,
+              client_secret: params.clientSecret,
+              redirect_to: params.redirectTo,
+            }),
         meta: params.meta,
         use_shared_credentials: params.useSharedCredentials,
       }),
     })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/packages/cli/src/lib/oauth.ts` around lines 110 - 139, The
addOAuthClient helper should enforce the useSharedCredentials invariant rather
than relying on callers; inside the Effect.fn addOAuthClient ensure that when
params.useSharedCredentials is true you do not send client_id, client_secret, or
redirect_to in the HTTP body (omit or set them to null/undefined) and optionally
validate/throw if callers supplied conflicting values; update the body
construction in addOAuthClient to conditionally include provider_id,
client_name, meta and use_shared_credentials always but omit client_id,
client_secret, and redirect_to when params.useSharedCredentials is true so
callers (e.g., commands/auth/client/add.ts) no longer need to blank those
fields.
client/packages/cli/__tests__/authClientAddGoogle.test.ts (1)

251-315: ⚡ Quick win

Add a happy-path test for the explicit --dev-credentials flag.

This suite covers the --yes fallback, incompatibility errors, and the interactive selector, but not the primary success case for the new flag itself. Locking that down would protect the exact branch this PR adds.

Suggested test shape
 describe('web: dev credentials', () => {
+  test('--dev-credentials → creates dev credentials client', async () => {
+    await run(withEntry(webDevFlags, 'dev-credentials', 'true'), { yes: true });
+    expect(addedClients).toHaveLength(1);
+    expect(addedClients[0].useSharedCredentials).toBe(true);
+    expect(addedClients[0].clientId).toBeUndefined();
+    expect(addedClients[0].clientSecret).toBeUndefined();
+    expect(addedClients[0].redirectTo).toBeUndefined();
+    expect(logs.join('\n')).toContain('Credentials: Instant dev credentials');
+  });
+
   test('--yes with no Google credentials → creates dev credentials client', async () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@client/packages/cli/__tests__/authClientAddGoogle.test.ts` around lines 251 -
315, Add a new test in client/packages/cli/__tests__/authClientAddGoogle.test.ts
that asserts the happy-path when passing the explicit --dev-credentials flag:
call run(...) with webDevFlags plus ['dev-credentials','true'] and yes: true,
then verify addedClients has one entry whose clientName is 'google-web' (or
matches existing dev case), useSharedCredentials is true,
clientId/clientSecret/redirectTo are undefined, and logs include the same
messages checked in the existing '--yes with no Google credentials' test (e.g.,
'Credentials: Instant dev credentials', 'No Google Console setup required', and
no guidance about updating credentials or redirect URIs); use the same
helpers/constants (run, webDevFlags, addedClients, logs, prompts) so the new
test targets the exact branch implemented for --dev-credentials.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@client/packages/cli/src/commands/auth/client/add.ts`:
- Around line 143-145: The current hasProvidedSomeCustomCredentials uses
Boolean(opts['client-id'] || ...) which treats empty strings as not provided;
change the check to test presence of the flags by key instead of truthiness: use
Object.prototype.hasOwnProperty.call(opts, 'client-id') (or opts['client-id']
!== undefined) for each of 'client-id', 'client-secret', and
'custom-redirect-uri' and combine them the same way to set
hasProvidedSomeCustomCredentials so flags like --client-id "" are considered
provided.

---

Nitpick comments:
In `@client/packages/cli/__tests__/authClientAddGoogle.test.ts`:
- Around line 251-315: Add a new test in
client/packages/cli/__tests__/authClientAddGoogle.test.ts that asserts the
happy-path when passing the explicit --dev-credentials flag: call run(...) with
webDevFlags plus ['dev-credentials','true'] and yes: true, then verify
addedClients has one entry whose clientName is 'google-web' (or matches existing
dev case), useSharedCredentials is true, clientId/clientSecret/redirectTo are
undefined, and logs include the same messages checked in the existing '--yes
with no Google credentials' test (e.g., 'Credentials: Instant dev credentials',
'No Google Console setup required', and no guidance about updating credentials
or redirect URIs); use the same helpers/constants (run, webDevFlags,
addedClients, logs, prompts) so the new test targets the exact branch
implemented for --dev-credentials.

In `@client/packages/cli/src/lib/oauth.ts`:
- Around line 110-139: The addOAuthClient helper should enforce the
useSharedCredentials invariant rather than relying on callers; inside the
Effect.fn addOAuthClient ensure that when params.useSharedCredentials is true
you do not send client_id, client_secret, or redirect_to in the HTTP body (omit
or set them to null/undefined) and optionally validate/throw if callers supplied
conflicting values; update the body construction in addOAuthClient to
conditionally include provider_id, client_name, meta and use_shared_credentials
always but omit client_id, client_secret, and redirect_to when
params.useSharedCredentials is true so callers (e.g.,
commands/auth/client/add.ts) no longer need to blank those fields.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 759cefea-5ee1-4962-bb50-d56ac458c47b

📥 Commits

Reviewing files that changed from the base of the PR and between dbbbeaf and c4c829a.

📒 Files selected for processing (6)
  • client/packages/cli/__tests__/authClientAddGoogle.test.ts
  • client/packages/cli/__tests__/authClientList.test.ts
  • client/packages/cli/src/commands/auth/client/add.ts
  • client/packages/cli/src/commands/auth/client/list.ts
  • client/packages/cli/src/index.ts
  • client/packages/cli/src/lib/oauth.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • client/packages/cli/tests/authClientList.test.ts
  • client/packages/cli/src/commands/auth/client/list.ts
  • client/packages/cli/src/index.ts

Comment thread client/packages/cli/src/commands/auth/client/add.ts Outdated
Comment thread client/packages/cli/src/commands/auth/client/list.ts Outdated
Comment thread client/packages/cli/src/lib/oauth.ts Outdated
use_shared_credentials: NullableBoolean,
});

export type OAuthClient = Schema.Schema.Type<typeof OAuthClient>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tiny nit / fun fact: typeof OAuthClient.Type also works.
I generally prefer not to extract out effect schema types since they can be piped / modified but thats irrelevant here

@drew-harris
Copy link
Copy Markdown
Contributor

I feel like the warning "For production, use your own Google OAuth credentials." should be underlined/bolded

Comment thread client/packages/cli/src/commands/auth/client/add.ts
Comment thread client/packages/cli/src/commands/auth/client/add.ts
Comment thread client/packages/cli/src/commands/auth/client/add.ts Outdated
@stopachka
Copy link
Copy Markdown
Contributor Author

I feel like the warning "For production, use your own Google OAuth credentials." should be underlined/bolded

@drew-harris fixed!

Copy link
Copy Markdown
Contributor

@drew-harris drew-harris left a comment

Choose a reason for hiding this comment

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

Everything works and looks good

@stopachka stopachka merged commit 48fff27 into main May 4, 2026
28 checks passed
@stopachka stopachka deleted the cli-codex branch May 4, 2026 17:26
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