Skip to main content

Overview

The grab init command automatically detects your framework and installs React Grab in your project. It supports Next.js, Vite, TanStack Start, and Webpack projects.

Usage

npx -y grab@latest init

Options

OptionAliasDescriptionDefault
--yes-ySkip confirmation promptsfalse
--force-fForce overwrite existing configfalse
--agent <agent>-aConnect to your agent (cursor, claude, copilot, windsurf, mcp)-
--key <key>-kActivation key (e.g., Meta+K, Ctrl+Shift+G, Space)-
--skip-install-Skip package installationfalse
--pkg <pkg>-Custom package URL for CLIgrab
--cwd <cwd>-cWorking directoryCurrent directory

Examples

Basic Installation

1

Run init command

Navigate to your project root and run:
npx -y grab@latest init
2

Review changes

The CLI will show a diff of changes to your files:
--- app/layout.tsx
+++ app/layout.tsx
@@ -1,6 +1,14 @@
+import Script from "next/script";
+
 export default function RootLayout({ children }) {
   return (
     <html>
+      <head>
+        {process.env.NODE_ENV === "development" && (
+          <Script src="//unpkg.com/react-grab/dist/index.global.js" />
+        )}
+      </head>
       <body>{children}</body>
     </html>
   );
3

Apply changes

Confirm to apply the changes when prompted:
? Apply these changes? (Y/n)
4

Start development server

React Grab is now installed. Start your development server:
npm run dev

Non-Interactive Mode

Skip all prompts with the --yes flag:
npx -y grab@latest init --yes

Install with Agent Integration

Connect to your coding agent during installation:
npx -y grab@latest init --agent cursor

Custom Activation Key

Set a custom keyboard shortcut:
npx -y grab@latest init --key "Meta+K"

Specify Working Directory

Install in a specific project directory:
npx -y grab@latest init --cwd ./packages/frontend

Force Reinstall

Overwrite existing React Grab configuration:
npx -y grab@latest init --force

Supported Frameworks

React Grab automatically detects and supports:
  • Next.js — Both App Router and Pages Router
  • Vite — React + Vite projects
  • TanStack Start — TanStack Start applications
  • Webpack — Custom Webpack configurations

Framework Detection

The CLI detects your framework by analyzing:
  1. Package dependencies in package.json
  2. Configuration files (next.config.ts, vite.config.ts, etc.)
  3. Project structure and file locations

Monorepo Support

For monorepos, React Grab will:
  1. Scan for all React projects in the workspace
  2. Prompt you to select a project
  3. Install React Grab in the selected project
Specify a project directly with --cwd:
npx -y grab@latest init --cwd apps/web

Output Example

$ npx -y grab@latest init
 React Grab 0.0.1

 Preflight checks.
 Verifying framework. Found Next.js.
 Detecting router type. Found App Router.
 Detecting package manager. Found pnpm.

? Would you like to connect it to your agent? (y/N)

--- app/layout.tsx
+++ app/layout.tsx
@@ -1,6 +1,14 @@
+import Script from "next/script";
+
 export default function RootLayout({ children }) {
   return (
     <html>
+      <head>
+        {process.env.NODE_ENV === "development" && (
+          <Script src="//unpkg.com/react-grab/dist/index.global.js" />
+        )}
+      </head>
       <body>{children}</body>
     </html>
   );

? Apply these changes? (Y/n)

 Installing react-grab.
 Applying changes to app/layout.tsx.

Success! React Grab has been installed.
You may now start your development server.

Troubleshooting

Framework Not Detected

If the CLI cannot detect your framework:
✖ Verifying framework. Could not detect a supported framework.

React Grab supports Next.js, Vite, TanStack Start, and Webpack projects.
Visit https://github.com/aidenybai/react-grab for manual setup.
Solution: Follow the manual installation guide.

Multiple Projects Found

For monorepos with multiple projects:
Found the following projects:

  frontend (Next.js) apps/frontend
  admin (Vite) apps/admin
  marketing (Next.js) apps/marketing

Re-run with -c <path> to specify a project:

  $ npx -y grab@latest init -c apps/frontend
Solution: Specify the project with --cwd.

Already Installed

If React Grab is already installed:
✔ Preflight checks.

✔ React Grab is already installed.

Currently installed agents: Cursor

? Would you like to customize options?
Options:
  • Use --force to reconfigure
  • Run grab configure to change options
  • Run grab add to add agent integrations

Build docs developers (and LLMs) love