Skip to content

update schema option - #73

Merged
eluce2 merged 1 commit into
mainfrom
08-29-update_schema_option
Aug 29, 2025
Merged

update schema option#73
eluce2 merged 1 commit into
mainfrom
08-29-update_schema_option

Conversation

@eluce2

@eluce2 eluce2 commented Aug 29, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added “Data Source” option to the interactive add flow.
    • Added “React Email” option to the main add flow.
    • Improved prompts: “Schema” option now appears only when at least one data source exists.
  • Chores

    • Updated component installation behavior to no longer force-overwrite existing files when adding UI components.

@vercel

vercel Bot commented Aug 29, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Updated (UTC)
proofkit-docs Skipped Skipped Aug 29, 2025 2:51pm

@eluce2
eluce2 marked this pull request as ready for review August 29, 2025 14:51

eluce2 commented Aug 29, 2025

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@pkg-pr-new

pkg-pr-new Bot commented Aug 29, 2025

Copy link
Copy Markdown

Open in StackBlitz

@proofkit/better-auth

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/better-auth@73

@proofkit/cli

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/cli@73

create-proofkit

pnpm add https://pkg.pr.new/proofgeist/proofkit/create-proofkit@73

@proofkit/fmdapi

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/fmdapi@73

@proofkit/typegen

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/typegen@73

@proofkit/webviewer

pnpm add https://pkg.pr.new/proofgeist/proofkit/@proofkit/webviewer@73

commit: 392b9e3

@coderabbitai

coderabbitai Bot commented Aug 29, 2025

Copy link
Copy Markdown

Walkthrough

Updated CLI add prompts to conditionally show Schema based on presence of data sources, added a new Data Source option, and introduced React Email in the main add flow. Adjusted shadcn component installation by removing the --overwrite flag from the command construction.

Changes

Cohort / File(s) Summary
CLI add prompt updates
packages/cli/src/cli/add/index.ts
Schema option is now shown only when settings.dataSources.length > 0 in both runAddFromRegistry and runAdd. Added a new Data Source option (always shown). In runAdd, added a React Email option alongside existing categories. No changes to error handling or post-prompt actions.
shadcn install command tweak
packages/cli/src/helpers/shadcn-cli.ts
Removed the "--overwrite" flag from the shadcn add command; invocation now uses ["shadcn@latest", "add", ...componentsArray] without forced overwrites. Other logic unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant CLI as CLI Add (runAddFromRegistry)
  participant P as Prompt

  U->>CLI: invoke add from registry
  CLI->>P: build choices
  alt dataSources.length > 0
    Note over P: Include Schema option
  else
    Note over P: Omit Schema option
  end
  Note over P: Always include Data Source
  P-->>U: present choices
  U-->>P: select category
  P-->>CLI: return selection
  CLI->>CLI: proceed with selected category flow
Loading
sequenceDiagram
  autonumber
  participant U as User
  participant CLI as CLI Add (runAdd)
  participant P as Prompt

  U->>CLI: invoke add
  CLI->>P: build choices
  alt dataSources.length > 0
    Note over P: Include Schema
  else
    Note over P: Omit Schema
  end
  Note over P: Include Page, Data Source, React Email
  P-->>U: present choices
  U-->>P: select category
  P-->>CLI: return selection
  CLI->>CLI: proceed with selected category flow
Loading
sequenceDiagram
  autonumber
  participant C as Caller
  participant H as shadcn-cli helper
  participant EX as execa

  C->>H: shadcnInstall(componentsArray)
  H->>EX: run ["shadcn@latest","add",...componentsArray]
  Note over H,EX: No --overwrite flag
  EX-->>H: result / error
  H-->>C: propagate outcome
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 08-29-update_schema_option

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/cli/src/cli/add/index.ts (1)

141-155: Make the schema visibility check null-safe; addition of React Email looks good

Guard settings.dataSources access. The new "React Email" option and "Data Source" entry integrate cleanly with the subsequent handlers.

-        // only show schema option if there is at least one data source
-        ...(settings.dataSources.length > 0
+        // only show schema option if there is at least one data source
+        ...(((settings.dataSources?.length ?? 0) > 0)
           ? [
               {
                 label: "Schema",
                 value: "schema",
                 hint: "load data from a new table or layout from an existing data source",
               },
             ]
           : []),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between eadc93b and 392b9e3.

📒 Files selected for processing (2)
  • packages/cli/src/cli/add/index.ts (2 hunks)
  • packages/cli/src/helpers/shadcn-cli.ts (1 hunks)
⏰ 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: build
  • GitHub Check: build

Comment on lines +55 to +71
// only show schema option if there is at least one data source
...(settings.dataSources.length > 0
? [
{
label: "Data Source",
value: "data",
hint: "to connect to a new database or FileMaker file",
label: "Schema",
value: "schema",
hint: "load data from a new table or layout from an existing data source",
},
]
: []),

{
label: "Data Source",
value: "data",
hint: "to connect to a new database or FileMaker file",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Avoid collisions with registry categories; make data source check null-safe

Using values "schema" and "data" can collide with registry categories of the same name, causing the wrong branch to run. Also guard against settings.dataSources being undefined.

Apply:

-        // only show schema option if there is at least one data source
-        ...(settings.dataSources.length > 0
+        // only show schema option if there is at least one data source
+        ...(((settings.dataSources?.length ?? 0) > 0)
           ? [
               {
-                label: "Schema",
-                value: "schema",
+                label: "Schema",
+                value: "__builtin:schema",
                 hint: "load data from a new table or layout from an existing data source",
               },
             ]
           : []),
 
-        {
-          label: "Data Source",
-          value: "data",
-          hint: "to connect to a new database or FileMaker file",
-        },
+        {
+          label: "Data Source",
+          value: "__builtin:data",
+          hint: "to connect to a new database or FileMaker file",
+        },
 
-        // show the rest of the categories
-        ...categories
-          .filter((category) => category !== "page")
+        // show the rest of the categories (exclude built-ins that we handle specially)
+        ...categories
+          .filter((category) => !["page", "schema", "data"].includes(category))
           .map((category) => ({
             label: capitalize(category),
             value: category,
           })),

And update the selection handling:

-  if (addType === "schema") {
+  if (addType === "__builtin:schema") {
     await runAddSchemaAction();
-  } else if (addType === "data") {
+  } else if (addType === "__builtin:data") {
     await runAddDataSourceCommand();

If you prefer not to change the selected values, at least exclude "schema" and "data" from the categories list to prevent duplicate options mapping to the same value.

Also applies to: 72-79, 83-87

) {
const componentsArray = Array.isArray(components) ? components : [components];
const command = ["shadcn@latest", "add", ...componentsArray, "--overwrite"];
const command = ["shadcn@latest", "add", ...componentsArray];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Dropping --overwrite can cause interactive conflicts and non-idempotent installs

Without --overwrite, re-adding an already-added component may prompt/hang (especially in CI) or silently skip updates, leading to drift. Prefer a controlled toggle rather than removing it outright.

Proposed non-breaking toggle (opt-in), preserving current default:

 export async function shadcnInstall(
   components: string | string[],
-  friendlyComponentName?: string
+  friendlyComponentName?: string,
+  options?: { overwrite?: boolean }
 ) {
   const componentsArray = Array.isArray(components) ? components : [components];
-  const command = ["shadcn@latest", "add", ...componentsArray];
+  const command = ["shadcn@latest", "add", ...componentsArray, ...(options?.overwrite ? ["--overwrite"] : [])];

Optionally, auto-enable overwrite in CI to avoid prompts (verify state shape first):

-  const command = ["shadcn@latest", "add", ...componentsArray, ...(options?.overwrite ? ["--overwrite"] : [])];
+  const shouldOverwrite = options?.overwrite ?? Boolean((state as any)?.ci || (process.env.CI === "true"));
+  const command = ["shadcn@latest", "add", ...componentsArray, ...(shouldOverwrite ? ["--overwrite"] : [])];

To verify whether state.ci exists and is set by ciOption, run:


🏁 Script executed:

#!/bin/bash
rg -n -C2 'ciOption|state\.(ci|program\..*ci)|initProgramState' packages/cli

Length of output: 17388


Add optional --overwrite toggle to shadcnInstall
Without --overwrite, re-running shadcn add can prompt, hang, or silently skip updates, causing drift. Extend the helper’s signature and command array:

 export async function shadcnInstall(
   components: string | string[],
-  friendlyComponentName?: string
+  friendlyComponentName?: string,
+  options?: { overwrite?: boolean }
 ) {
   const componentsArray = Array.isArray(components) ? components : [components];
-  const command = ["shadcn@latest", "add", ...componentsArray];
+  const shouldOverwrite = options?.overwrite ?? state.ci;
+  const command = [
+    "shadcn@latest",
+    "add",
+    ...componentsArray,
+    ...(shouldOverwrite ? ["--overwrite"] : []),
+  ];

state.ci is already set via ciOption and initProgramState, so CI runs will default to overwrite and avoid interactive prompts.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const command = ["shadcn@latest", "add", ...componentsArray];
export async function shadcnInstall(
components: string | string[],
friendlyComponentName?: string,
options?: { overwrite?: boolean }
) {
const componentsArray = Array.isArray(components) ? components : [components];
const shouldOverwrite = options?.overwrite ?? state.ci;
const command = [
"shadcn@latest",
"add",
...componentsArray,
...(shouldOverwrite ? ["--overwrite"] : []),
];
// …rest of function…
}
🤖 Prompt for AI Agents
In packages/cli/src/helpers/shadcn-cli.ts around line 16, the constructed
command array lacks an optional '--overwrite' flag; update the shadcnInstall
helper signature to accept an optional overwrite boolean (default false) or use
state.ci to decide behavior, then conditionally push '--overwrite' into the
command array when overwrite === true || state.ci === true so CI runs and
explicit calls avoid interactive prompts and file-skipping issues; ensure the
function's call sites are adjusted or the default preserves current behavior.

@eluce2
eluce2 merged commit 5b9f5be into main Aug 29, 2025
7 checks passed
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.

1 participant