projecta-rrr 1.5.27 → 1.6.0

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.
package/README.md CHANGED
@@ -164,6 +164,63 @@ If you prefer not to use that flag, add this to your project's `.claude/settings
164
164
 
165
165
  ---
166
166
 
167
+ ## Projecta Preferred Pack
168
+
169
+ RRR includes a default stack optimized for rapid MVP development. Defaults are recommended but overrideable.
170
+
171
+ ### Where Defaults Live
172
+
173
+ | File | Purpose |
174
+ |------|---------|
175
+ | `projecta.defaults.json` | Global defaults (core stack, preferred providers, discouraged list) |
176
+ | `.planning/MVP_FEATURES.yml` | Per-project capability selections |
177
+ | `.planning/PROJECT.md` | Deviation Notes (any overrides from defaults) |
178
+
179
+ ### Core Stack (always assumed)
180
+
181
+ - **Framework:** Next.js (App Router) + TypeScript
182
+ - **Package Manager:** npm
183
+ - **UI:** Tailwind CSS + shadcn/ui
184
+ - **Testing:** Vitest (unit) + Playwright (e2e)
185
+
186
+ ### Preferred Providers
187
+
188
+ | Capability | Default | Alternative |
189
+ |------------|---------|-------------|
190
+ | Database | Neon | — |
191
+ | Auth | Clerk | Neon Auth |
192
+ | Payments | Stripe | — |
193
+ | Object Storage | Cloudflare R2 | — |
194
+ | Analytics | PostHog | — |
195
+ | Voice | Deepgram | — |
196
+ | Deploy | Render | — |
197
+
198
+ ### Agent Stack (when agents needed)
199
+
200
+ - **Orchestration:** Mastra
201
+ - **Agent Auth:** Auth.dev
202
+ - **Agent Mail:** Agentmail
203
+ - **Sandbox:** E2B
204
+ - **Browser Automation:** Browserbase
205
+
206
+ ### Overrides
207
+
208
+ If you choose a non-default provider, RRR asks for a reason and records it in Deviation Notes:
209
+
210
+ ```markdown
211
+ ## Deviation Notes
212
+
213
+ | Capability | Default | Chosen | Reason |
214
+ |------------|---------|--------|--------|
215
+ | auth | clerk | auth0 | Client requires Auth0 for SSO compliance |
216
+ ```
217
+
218
+ ### Discouraged Providers
219
+
220
+ These are allowed but require explicit justification: Firebase, Supabase, Auth0, Vercel, PlanetScale.
221
+
222
+ ---
223
+
167
224
  ## How It Works
168
225
 
169
226
  ### 1. Initialize Project (~10 minutes)
@@ -0,0 +1,439 @@
1
+ ---
2
+ name: rrr:bootstrap-nextjs
3
+ description: Scaffold a Next.js App Router MVP with TypeScript, Tailwind, shadcn/ui, Vitest, and Playwright
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Edit
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - TodoWrite
12
+ ---
13
+
14
+ <objective>
15
+
16
+ Bootstrap a complete Next.js App Router project with Projecta's default MVP stack:
17
+
18
+ - **Framework:** Next.js (App Router) + TypeScript
19
+ - **Package Manager:** npm only
20
+ - **UI:** Tailwind CSS + shadcn/ui
21
+ - **Unit Tests:** Vitest + Testing Library
22
+ - **E2E Tests:** Playwright
23
+ - **Environment:** .env.example with common MVP placeholders
24
+
25
+ This command creates a production-ready foundation in ~5 minutes. Run once per project.
26
+
27
+ **After this command:** Run `/rrr:new-project` to define requirements and roadmap.
28
+
29
+ </objective>
30
+
31
+ <process>
32
+
33
+ ## Phase 1: Pre-flight Checks
34
+
35
+ **MANDATORY FIRST STEP — Execute these checks before ANY scaffolding:**
36
+
37
+ 1. **Check for existing project:**
38
+ ```bash
39
+ if [ -f package.json ]; then
40
+ echo "ERROR: package.json already exists. This command is for new projects only."
41
+ exit 1
42
+ fi
43
+ ```
44
+
45
+ 2. **Check npm is available:**
46
+ ```bash
47
+ npm --version || { echo "ERROR: npm not found"; exit 1; }
48
+ ```
49
+
50
+ 3. **Initialize git repo if needed:**
51
+ ```bash
52
+ if [ -d .git ] || [ -f .git ]; then
53
+ echo "Git repo exists"
54
+ else
55
+ git init
56
+ echo "Initialized new git repo"
57
+ fi
58
+ ```
59
+
60
+ ## Phase 2: Create Next.js Project
61
+
62
+ Display stage banner:
63
+ ```
64
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
+ RRR ► BOOTSTRAPPING NEXT.JS MVP
66
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
+ ```
68
+
69
+ 1. **Create Next.js app with App Router:**
70
+ ```bash
71
+ npx create-next-app@latest . --typescript --tailwind --eslint --app --src-dir --import-alias "@/*" --use-npm --no-turbopack
72
+ ```
73
+
74
+ This creates:
75
+ - TypeScript configuration
76
+ - Tailwind CSS setup
77
+ - ESLint configuration
78
+ - App Router (src/app/)
79
+ - Path alias @/*
80
+
81
+ 2. **Verify creation:**
82
+ ```bash
83
+ [ -f package.json ] && [ -d src/app ] && echo "Next.js created successfully"
84
+ ```
85
+
86
+ ## Phase 3: Install shadcn/ui
87
+
88
+ 1. **Initialize shadcn/ui:**
89
+ ```bash
90
+ npx shadcn@latest init -d
91
+ ```
92
+
93
+ This uses defaults:
94
+ - Style: New York
95
+ - Base color: Neutral
96
+ - CSS variables: Yes
97
+
98
+ 2. **Add Button component:**
99
+ ```bash
100
+ npx shadcn@latest add button -y
101
+ ```
102
+
103
+ 3. **Update homepage to show Button:**
104
+
105
+ Edit `src/app/page.tsx` to include a simple demo:
106
+
107
+ ```tsx
108
+ import { Button } from "@/components/ui/button";
109
+
110
+ export default function Home() {
111
+ return (
112
+ <main className="flex min-h-screen flex-col items-center justify-center p-24">
113
+ <div className="text-center space-y-6">
114
+ <h1 className="text-4xl font-bold">Welcome to Your MVP</h1>
115
+ <p className="text-muted-foreground">
116
+ Built with Next.js, TypeScript, Tailwind, and shadcn/ui
117
+ </p>
118
+ <Button size="lg">Get Started</Button>
119
+ </div>
120
+ </main>
121
+ );
122
+ }
123
+ ```
124
+
125
+ ## Phase 4: Setup Vitest + Testing Library
126
+
127
+ 1. **Install Vitest and Testing Library:**
128
+ ```bash
129
+ npm install -D vitest @vitejs/plugin-react jsdom @testing-library/react @testing-library/jest-dom @testing-library/user-event
130
+ ```
131
+
132
+ 2. **Create vitest.config.ts:**
133
+
134
+ Write to `vitest.config.ts`:
135
+ ```typescript
136
+ import { defineConfig } from 'vitest/config'
137
+ import react from '@vitejs/plugin-react'
138
+ import path from 'path'
139
+
140
+ export default defineConfig({
141
+ plugins: [react()],
142
+ test: {
143
+ environment: 'jsdom',
144
+ setupFiles: ['./src/test/setup.ts'],
145
+ include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
146
+ },
147
+ resolve: {
148
+ alias: {
149
+ '@': path.resolve(__dirname, './src'),
150
+ },
151
+ },
152
+ })
153
+ ```
154
+
155
+ 3. **Create test setup file:**
156
+
157
+ Create `src/test/setup.ts`:
158
+ ```typescript
159
+ import '@testing-library/jest-dom'
160
+ ```
161
+
162
+ 4. **Create smoke unit test:**
163
+
164
+ Create `src/app/page.test.tsx`:
165
+ ```tsx
166
+ import { render, screen } from '@testing-library/react'
167
+ import { describe, it, expect } from 'vitest'
168
+ import Home from './page'
169
+
170
+ describe('Home', () => {
171
+ it('renders the welcome heading', () => {
172
+ render(<Home />)
173
+ expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Welcome to Your MVP')
174
+ })
175
+
176
+ it('renders the get started button', () => {
177
+ render(<Home />)
178
+ expect(screen.getByRole('button', { name: /get started/i })).toBeInTheDocument()
179
+ })
180
+ })
181
+ ```
182
+
183
+ 5. **Add test script to package.json:**
184
+
185
+ Edit `package.json` to add:
186
+ ```json
187
+ "scripts": {
188
+ "test": "vitest run",
189
+ "test:watch": "vitest"
190
+ }
191
+ ```
192
+
193
+ ## Phase 5: Setup Playwright
194
+
195
+ 1. **Install Playwright:**
196
+ ```bash
197
+ npm install -D @playwright/test
198
+ npx playwright install chromium
199
+ ```
200
+
201
+ 2. **Create playwright.config.ts:**
202
+
203
+ Write to `playwright.config.ts`:
204
+ ```typescript
205
+ import { defineConfig, devices } from '@playwright/test'
206
+
207
+ export default defineConfig({
208
+ testDir: './e2e',
209
+ fullyParallel: true,
210
+ forbidOnly: !!process.env.CI,
211
+ retries: process.env.CI ? 2 : 0,
212
+ workers: process.env.CI ? 1 : undefined,
213
+ reporter: 'html',
214
+ use: {
215
+ baseURL: 'http://localhost:3000',
216
+ trace: 'on-first-retry',
217
+ },
218
+ projects: [
219
+ {
220
+ name: 'chromium',
221
+ use: { ...devices['Desktop Chrome'] },
222
+ },
223
+ ],
224
+ webServer: {
225
+ command: 'npm run dev',
226
+ url: 'http://localhost:3000',
227
+ reuseExistingServer: !process.env.CI,
228
+ },
229
+ })
230
+ ```
231
+
232
+ 3. **Create smoke e2e test:**
233
+
234
+ Create `e2e/home.spec.ts`:
235
+ ```typescript
236
+ import { test, expect } from '@playwright/test'
237
+
238
+ test.describe('Homepage', () => {
239
+ test('should display welcome message and button', async ({ page }) => {
240
+ await page.goto('/')
241
+
242
+ // Check heading
243
+ await expect(page.getByRole('heading', { level: 1 })).toContainText('Welcome to Your MVP')
244
+
245
+ // Check button exists and is clickable
246
+ const button = page.getByRole('button', { name: /get started/i })
247
+ await expect(button).toBeVisible()
248
+ })
249
+ })
250
+ ```
251
+
252
+ 4. **Add e2e script to package.json:**
253
+
254
+ Edit `package.json` to add:
255
+ ```json
256
+ "scripts": {
257
+ "e2e": "playwright test",
258
+ "e2e:ui": "playwright test --ui"
259
+ }
260
+ ```
261
+
262
+ ## Phase 6: Create Environment Template
263
+
264
+ Create `.env.example` with common MVP placeholders:
265
+
266
+ ```bash
267
+ # Database (Neon)
268
+ DATABASE_URL=
269
+
270
+ # Authentication (Clerk)
271
+ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
272
+ CLERK_SECRET_KEY=
273
+
274
+ # Payments (Stripe)
275
+ STRIPE_SECRET_KEY=
276
+ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
277
+ STRIPE_WEBHOOK_SECRET=
278
+
279
+ # Browser Automation (Browserbase)
280
+ BROWSERBASE_API_KEY=
281
+ BROWSERBASE_PROJECT_ID=
282
+
283
+ # Voice/Speech (Deepgram)
284
+ DEEPGRAM_API_KEY=
285
+
286
+ # App Config
287
+ NEXT_PUBLIC_APP_URL=http://localhost:3000
288
+ ```
289
+
290
+ Update `.gitignore` to ensure `.env` is ignored (should already be from create-next-app, but verify):
291
+ ```bash
292
+ grep -q "^\.env" .gitignore || echo ".env*.local" >> .gitignore
293
+ ```
294
+
295
+ ## Phase 7: Verification
296
+
297
+ Display verification banner:
298
+ ```
299
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
300
+ RRR ► VERIFYING SETUP
301
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
302
+ ```
303
+
304
+ 1. **Run unit tests:**
305
+ ```bash
306
+ npm test
307
+ ```
308
+
309
+ Expected: All tests pass (2 tests)
310
+
311
+ 2. **Run e2e tests:**
312
+ ```bash
313
+ npm run e2e
314
+ ```
315
+
316
+ Expected: All tests pass (1 test)
317
+
318
+ 3. **Verify dev server starts:**
319
+ ```bash
320
+ # Start dev server in background
321
+ npm run dev &
322
+ DEV_PID=$!
323
+
324
+ # Wait for server to be ready
325
+ sleep 5
326
+
327
+ # Check if server responds
328
+ curl -s http://localhost:3000 > /dev/null && echo "Dev server started successfully"
329
+
330
+ # Kill dev server
331
+ kill $DEV_PID 2>/dev/null
332
+ ```
333
+
334
+ **If any verification fails:** Stop and fix the issue before proceeding.
335
+
336
+ ## Phase 8: Commit Bootstrap
337
+
338
+ ```bash
339
+ git add -A
340
+ git commit -m "$(cat <<'EOF'
341
+ chore: bootstrap nextjs mvp
342
+
343
+ Stack:
344
+ - Next.js 15 (App Router) + TypeScript
345
+ - Tailwind CSS + shadcn/ui
346
+ - Vitest + Testing Library (unit)
347
+ - Playwright (e2e)
348
+
349
+ Includes:
350
+ - Button component on homepage
351
+ - Smoke unit test (2 assertions)
352
+ - Smoke e2e test (1 spec)
353
+ - .env.example with MVP placeholders
354
+ EOF
355
+ )"
356
+ ```
357
+
358
+ ## Phase 9: Done
359
+
360
+ Present completion:
361
+
362
+ ```
363
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
364
+ RRR ► BOOTSTRAP COMPLETE ✓
365
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
366
+
367
+ **Next.js MVP scaffolded successfully**
368
+
369
+ | Component | Status |
370
+ |-----------|--------|
371
+ | Next.js App Router | ✓ |
372
+ | TypeScript | ✓ |
373
+ | Tailwind CSS | ✓ |
374
+ | shadcn/ui | ✓ |
375
+ | Vitest + Testing Library | ✓ |
376
+ | Playwright | ✓ |
377
+ | .env.example | ✓ |
378
+
379
+ **Commands:**
380
+ npm run dev Start dev server
381
+ npm test Run unit tests
382
+ npm run e2e Run e2e tests
383
+
384
+ ───────────────────────────────────────────────────────────────
385
+
386
+ ## ▶ Next Up
387
+
388
+ Define your project requirements and create a roadmap:
389
+
390
+ `/rrr:new-project`
391
+
392
+ ───────────────────────────────────────────────────────────────
393
+ ```
394
+
395
+ </process>
396
+
397
+ <output>
398
+
399
+ Files created:
400
+ - `package.json` (with all dependencies)
401
+ - `src/app/page.tsx` (homepage with Button)
402
+ - `src/components/ui/button.tsx` (shadcn/ui Button)
403
+ - `vitest.config.ts`
404
+ - `src/test/setup.ts`
405
+ - `src/app/page.test.tsx` (smoke unit test)
406
+ - `playwright.config.ts`
407
+ - `e2e/home.spec.ts` (smoke e2e test)
408
+ - `.env.example`
409
+
410
+ </output>
411
+
412
+ <success_criteria>
413
+
414
+ - [ ] package.json exists with correct dependencies
415
+ - [ ] Next.js App Router structure created (src/app/)
416
+ - [ ] TypeScript configured (tsconfig.json)
417
+ - [ ] Tailwind CSS configured (tailwind.config.ts)
418
+ - [ ] shadcn/ui initialized with Button component
419
+ - [ ] Homepage shows Button component
420
+ - [ ] Vitest configured with Testing Library
421
+ - [ ] Smoke unit test passes (npm test)
422
+ - [ ] Playwright configured
423
+ - [ ] Smoke e2e test passes (npm run e2e)
424
+ - [ ] .env.example created with MVP placeholders
425
+ - [ ] Dev server starts successfully
426
+ - [ ] All files committed with message "chore: bootstrap nextjs mvp"
427
+
428
+ </success_criteria>
429
+
430
+ <anti_patterns>
431
+
432
+ - Do NOT use yarn or pnpm — npm only
433
+ - Do NOT use Pages Router — App Router only
434
+ - Do NOT add unnecessary dependencies
435
+ - Do NOT skip verification steps
436
+ - Do NOT commit if tests fail
437
+ - Do NOT create .env with real credentials
438
+
439
+ </anti_patterns>
@@ -50,7 +50,10 @@ npx projecta-rrr@latest
50
50
  **`/rrr:new-project`**
51
51
  Initialize new project through unified flow.
52
52
 
53
- One command takes you from idea to ready-for-planning:
53
+ **Automatically bootstraps if needed** detects if repo is a Next.js project. If not, runs the bootstrap sequence (Next.js + TypeScript + Tailwind + shadcn/ui + Vitest + Playwright) before proceeding.
54
+
55
+ One command takes you from empty folder to ready-for-planning:
56
+ - Bootstrap detection and execution (if needed)
54
57
  - Deep questioning to understand what you're building
55
58
  - Optional domain research (spawns 4 parallel researcher agents)
56
59
  - Requirements definition with v1/v2/out-of-scope scoping
@@ -66,6 +69,20 @@ Creates all `.planning/` artifacts:
66
69
 
67
70
  Usage: `/rrr:new-project`
68
71
 
72
+ **`/rrr:bootstrap-nextjs`**
73
+ Scaffold Next.js App Router project with Projecta defaults (standalone).
74
+
75
+ - Next.js (App Router) + TypeScript
76
+ - Tailwind CSS + shadcn/ui (with Button component)
77
+ - Vitest + Testing Library (smoke unit test)
78
+ - Playwright (smoke e2e test)
79
+ - `.env.example` with common MVP placeholders
80
+
81
+ Use this standalone when you only want the bootstrap without RRR planning.
82
+ Note: `/rrr:new-project` includes bootstrap automatically.
83
+
84
+ Usage: `/rrr:bootstrap-nextjs`
85
+
69
86
  **`/rrr:map-codebase`**
70
87
  Map an existing codebase for brownfield projects.
71
88
 
@@ -352,16 +369,24 @@ Change anytime by editing `.planning/config.json`
352
369
 
353
370
  ## Common Workflows
354
371
 
355
- **Starting a new project:**
372
+ **Starting a new project (from empty folder):**
356
373
 
357
374
  ```
358
- /rrr:new-project # Unified flow: questioningresearch → requirements → roadmap
375
+ /rrr:new-project # Bootstraps repo (if needed) questionnaire → requirements → roadmap
359
376
  /clear
360
377
  /rrr:plan-phase 1 # Create plans for first phase
361
378
  /clear
362
379
  /rrr:execute-phase 1 # Execute all plans in phase
363
380
  ```
364
381
 
382
+ That's it! `/rrr:new-project` handles everything from bootstrap to roadmap.
383
+
384
+ **Bootstrap only (no planning):**
385
+
386
+ ```
387
+ /rrr:bootstrap-nextjs # Just scaffold Next.js + testing + shadcn
388
+ ```
389
+
365
390
  **Resuming work after a break:**
366
391
 
367
392
  ```