-
Notifications
You must be signed in to change notification settings - Fork 1
feat: undocumented user agent flag added #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdded an optional CLI input option Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Pre-merge checks✅ Passed checks (3 passed)
Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
claim-db-worker | e02ae35 | Commit Preview URL Branch Preview URL |
Dec 14 2025, 10:03 PM |
|
✅ Preview CLIs & Workers are live! Test the CLIs locally under tag npx create-db@pr70
npx create-pg@pr70
npx create-postgres@pr70Worker URLs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
create-db/src/index.ts (1)
120-124: Consider documenting the fallback behavior and adding format validation.The implementation is correct, but two optional improvements:
- The description doesn't mention that if
userAgentis not provided, it falls back toPRISMA_ACTOR_NAME/PRISMA_ACTOR_PROJECTfrom the .env file.- The example format
'test/test'suggests a pattern, but there's no validation to enforce it.To add format validation, you could use a regex refinement:
userAgent: z .string() .optional() + .refine((val) => !val || /^[\w-]+\/[\w-]+$/.test(val), { + error: () => "User agent must be in format 'name/project' (e.g. 'test/test')" + }) .describe("Custom user agent string (e.g. 'test/test')") .meta({ alias: "u" }),To document the fallback behavior:
- .describe("Custom user agent string (e.g. 'test/test')") + .describe("Custom user agent string (e.g. 'test/test'). Falls back to PRISMA_ACTOR_NAME/PRISMA_ACTOR_PROJECT from .env if not provided")
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
create-db/src/index.ts(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
create-db/src/index.ts (2)
create-db/src/database.ts (1)
getCommandName(5-10)create-db/src/env-utils.ts (1)
readUserEnvFile(4-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Workers Builds: create-db-worker
- GitHub Check: Workers Builds: claim-db-worker
🔇 Additional comments (4)
create-db/src/index.ts (4)
131-137: LGTM! Clean fallback logic.The implementation correctly prioritizes the CLI-provided
userAgentand only reads the environment file when needed. The constructed formatname/projectmatches the documented example.
203-207: LGTM! Consistent userAgent propagation.Both invocations of
createDatabaseCoreWithUrlcorrectly pass theuserAgentparameter, ensuring consistent behavior across json/env and interactive modes.Also applies to: 295-299
393-396: LGTM! Programmatic API correctly supports userAgent.The
create()function properly forwards the optionaluserAgentfrom options tocreateDatabaseCoreWithUrl, and the JSDoc documentation has been updated accordingly.
147-147: > Likely an incorrect or invalid review comment.
Summary by CodeRabbit
New Features
--userAgentCLI flag (alias-u) to specify custom user agent strings during database creation.Updates
✏️ Tip: You can customize this high-level summary in your review settings.