@usesidekick/cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +130 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @usesidekick/cli
2
+
3
+ Command-line tool for integrating and managing [Sidekick](https://github.com/zhendershot/sidekick) in Next.js applications. Analyzes your app, generates AI-powered override modules, and scaffolds the full integration in one command.
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx @usesidekick/cli init
9
+ ```
10
+
11
+ This single command will:
12
+
13
+ 1. Install `@usesidekick/react`, `drizzle-orm`, `@neondatabase/serverless`, and build plugins
14
+ 2. Configure `.babelrc` with the Sidekick JSX runtime
15
+ 3. Add webpack aliases to `next.config.js`
16
+ 4. Create a database schema and connection (`lib/db/`)
17
+ 5. Create a catch-all API route (`api/sidekick/[...action]/`)
18
+ 6. Add `SidekickBootstrap` to your app layout
19
+ 7. Analyze your components and generate `schema.json`
20
+
21
+ After init, just add your env vars and push the DB:
22
+
23
+ ```bash
24
+ # .env.local
25
+ DATABASE_URL=your_neon_database_url
26
+ ANTHROPIC_API_KEY=your_api_key
27
+ ```
28
+
29
+ ```bash
30
+ npx drizzle-kit push
31
+ npm run dev
32
+ ```
33
+
34
+ ## Commands
35
+
36
+ ### `sidekick init`
37
+
38
+ Initialize Sidekick in an existing Next.js project.
39
+
40
+ ```bash
41
+ sidekick init [options]
42
+ ```
43
+
44
+ | Option | Default | Description |
45
+ |--------|---------|-------------|
46
+ | `-d, --dir <path>` | `.` | Target project directory |
47
+
48
+ **Detects automatically:** package manager (npm/yarn/pnpm), Next.js version, TypeScript, `src/app` vs `app` directory structure. Skips already-installed dependencies and already-configured files. Creates backups before modifying existing configs.
49
+
50
+ ### `sidekick analyze`
51
+
52
+ Analyze your app's components, extension points, data models, and design system to generate a `schema.json` that powers AI override generation.
53
+
54
+ ```bash
55
+ sidekick analyze [options]
56
+ ```
57
+
58
+ | Option | Default | Description |
59
+ |--------|---------|-------------|
60
+ | `-d, --dir <path>` | `.` | Target directory to analyze |
61
+ | `-o, --output <path>` | `./sidekick/schema.json` | Output path for schema |
62
+
63
+ ### `sidekick generate`
64
+
65
+ Generate an override module from a natural language description using Claude.
66
+
67
+ ```bash
68
+ sidekick generate <request> [options]
69
+ ```
70
+
71
+ | Option | Default | Description |
72
+ |--------|---------|-------------|
73
+ | `-s, --schema <path>` | `./sidekick/schema.json` | Path to schema.json |
74
+ | `-o, --output <path>` | `./sidekick/overrides` | Output directory for generated overrides |
75
+ | `-k, --api-key <key>` | `ANTHROPIC_API_KEY` env var | Anthropic API key |
76
+
77
+ **Example:**
78
+
79
+ ```bash
80
+ sidekick generate "Add a purple banner above the task board that says 'Beta'"
81
+ ```
82
+
83
+ The generated override is validated against the SDK's safety rules (no DOM access, no eval, only `@usesidekick/react` and `react` imports allowed).
84
+
85
+ ### `sidekick validate`
86
+
87
+ Validate an override module file for correctness and safety.
88
+
89
+ ```bash
90
+ sidekick validate <file>
91
+ ```
92
+
93
+ Checks for:
94
+ - Valid JavaScript/TypeScript syntax
95
+ - Forbidden APIs (`document`, `window`, `eval`, `fetch`, etc.)
96
+ - Import restrictions (only `@usesidekick/react` and `react`)
97
+ - Required `createOverride` export
98
+
99
+ ## What `init` Creates
100
+
101
+ ```
102
+ your-app/
103
+ .babelrc # JSX runtime config
104
+ next.config.js # Webpack aliases (modified)
105
+ drizzle.config.ts # Drizzle Kit config
106
+ src/
107
+ lib/db/
108
+ schema.ts # Overrides table definition
109
+ index.ts # Neon DB connection
110
+ components/
111
+ SidekickBootstrap.tsx # Provider + Panel wrapper
112
+ app/
113
+ layout.tsx # Modified to include SidekickBootstrap
114
+ api/sidekick/[...action]/
115
+ route.ts # Thin handler (delegates to SDK)
116
+ sidekick/
117
+ schema.json # App analysis output
118
+ overrides/ # Generated override modules
119
+ ```
120
+
121
+ ## Requirements
122
+
123
+ - **Next.js 14+** with App Router
124
+ - **Node.js 18+**
125
+ - **Neon** (or any PostgreSQL) for the overrides database
126
+ - **Anthropic API key** for AI generation
127
+
128
+ ## License
129
+
130
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usesidekick/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "sidekick": "dist/index.js"