@hopla/claude-setup 1.8.1 → 1.9.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/cli.js +1 -0
- package/files/commands/hopla-init-project.md +221 -49
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -180,6 +180,7 @@ async function install() {
|
|
|
180
180
|
// Determine which command files will be installed
|
|
181
181
|
const allCommandEntries = fs.readdirSync(path.join(FILES_DIR, "commands"));
|
|
182
182
|
const allCommandFiles = allCommandEntries.filter((f) => {
|
|
183
|
+
if (f.startsWith(".")) return false;
|
|
183
184
|
const stat = fs.statSync(path.join(FILES_DIR, "commands", f));
|
|
184
185
|
return stat.isFile();
|
|
185
186
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
description: Initialize a new project with a CLAUDE.md and .agents/ structure
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> **Language:** All user-facing output must match the user's language. Code, paths, and commands stay in English.
|
|
6
6
|
|
|
7
7
|
Set up the Layer 1 planning foundation for this project: a project-specific `CLAUDE.md` with rules and architecture decisions, plus the `.agents/` directory structure.
|
|
8
8
|
|
|
@@ -18,31 +18,99 @@ Before asking anything, check what already exists:
|
|
|
18
18
|
|
|
19
19
|
If a `CLAUDE.md` already exists at the project root, tell the user and ask if they want to update it or start fresh.
|
|
20
20
|
|
|
21
|
-
## Step 2:
|
|
21
|
+
## Step 2: Default Stack or Custom
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Present the **Hopla Default Stack** to the user:
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
```
|
|
26
|
+
Hopla Default Stack:
|
|
27
|
+
|
|
28
|
+
Frontend:
|
|
29
|
+
- Language: TypeScript (strict: false)
|
|
30
|
+
- UI Framework: React 19 + React Router 7
|
|
31
|
+
- Bundler: Vite
|
|
32
|
+
- Styling: Tailwind CSS 4 + Shadcn UI
|
|
33
|
+
- Data Tables: AG Grid Community
|
|
34
|
+
- Forms: React Hook Form + Zod
|
|
35
|
+
- Icons: Lucide React
|
|
36
|
+
- Testing: Vitest
|
|
37
|
+
- Linting: ESLint
|
|
38
|
+
- Formatting: Prettier
|
|
39
|
+
|
|
40
|
+
Backend:
|
|
41
|
+
- Runtime: Cloudflare Workers
|
|
42
|
+
- Routing: Hono
|
|
43
|
+
- Database: Cloudflare D1 (SQLite)
|
|
44
|
+
- Cache: Cloudflare KV
|
|
45
|
+
- Stateful Logic: Cloudflare Durable Objects (if needed)
|
|
46
|
+
- Auth: Firebase (Google Sign-In) + JOSE (if needed)
|
|
47
|
+
|
|
48
|
+
Package manager: npm
|
|
49
|
+
Path alias: @/* -> ./src/*
|
|
50
|
+
|
|
51
|
+
Architecture:
|
|
52
|
+
src/
|
|
53
|
+
├── components/ <- shared UI components
|
|
54
|
+
│ ├── common/ <- generic reusable components
|
|
55
|
+
│ └── ui/ <- Shadcn primitives (do not edit)
|
|
56
|
+
├── modules/ <- self-contained feature modules
|
|
57
|
+
│ └── [feature]/ <- components, hooks, view per feature
|
|
58
|
+
├── hooks/ <- shared hooks
|
|
59
|
+
├── lib/ <- utilities and helpers
|
|
60
|
+
├── types/ <- shared TypeScript types
|
|
61
|
+
├── layouts/ <- sidebar, topbar, app shell
|
|
62
|
+
├── pages/ <- page-level components
|
|
63
|
+
└── main.tsx <- entry point
|
|
64
|
+
worker/
|
|
65
|
+
├── src/
|
|
66
|
+
│ ├── index.ts <- worker entry point, route registration
|
|
67
|
+
│ ├── routes/ <- API route handlers (one file per domain)
|
|
68
|
+
│ ├── lib/ <- backend utilities, auth, business logic
|
|
69
|
+
│ └── types/ <- backend type definitions
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Ask the user:
|
|
73
|
+
> "This is the Hopla default stack. Do you want to use it as-is, or would you prefer to customize it?"
|
|
74
|
+
|
|
75
|
+
**Option A — Use default:** Skip directly to Step 2.1 (ask only project name and any reference guides), then proceed to Step 3.
|
|
76
|
+
|
|
77
|
+
**Option B — Customize:** Proceed to Step 2.2 (full conversational discovery).
|
|
78
|
+
|
|
79
|
+
### Step 2.1: Quick Setup (Default Stack)
|
|
80
|
+
|
|
81
|
+
Ask only these minimal questions:
|
|
82
|
+
|
|
83
|
+
1. **Project name** — What should I call this project?
|
|
84
|
+
2. **Project description** — One-line summary of what this project does.
|
|
85
|
+
3. **Reference Guides** (optional) — Are there specific task types that need step-by-step guidance? (e.g. "When adding a page", "When creating an API route"). If none, skip this — guides can always be added later.
|
|
86
|
+
|
|
87
|
+
Then proceed to Step 3 using the default stack values for all other fields.
|
|
88
|
+
|
|
89
|
+
### Step 2.2: Custom Setup (Conversational Discovery)
|
|
90
|
+
|
|
91
|
+
Ask one topic at a time. Wait for each answer before continuing. For each topic, show the default value so the user can just confirm or override.
|
|
92
|
+
|
|
93
|
+
**Topic A — Tech Stack** (default: TypeScript, React 19, Vite, Tailwind CSS 4, Shadcn UI, npm)
|
|
26
94
|
- What languages, frameworks, and key libraries does this project use?
|
|
27
95
|
- What versions matter? (e.g. Python 3.12, FastAPI 0.118, React 19)
|
|
28
96
|
- What package manager? (npm, bun, uv, pip, etc.)
|
|
29
97
|
|
|
30
|
-
**Topic B — Architecture**
|
|
98
|
+
**Topic B — Architecture** (default: modules-based under src/ + worker/)
|
|
31
99
|
- How is the project structured? (e.g. layered, vertical slices, feature-based)
|
|
32
|
-
- What are the main layers or modules? (e.g. routes
|
|
100
|
+
- What are the main layers or modules? (e.g. routes -> services -> models)
|
|
33
101
|
- Are there naming conventions for files and folders?
|
|
34
102
|
|
|
35
|
-
**Topic C — Code Style**
|
|
103
|
+
**Topic C — Code Style** (default: ESLint + Prettier, TypeScript strict: false)
|
|
36
104
|
- Any strict naming conventions? (e.g. verbose fields like `product_id`, snake_case, camelCase)
|
|
37
|
-
- TypeScript strict mode?
|
|
38
|
-
- Linting/formatting tools and configs? (
|
|
105
|
+
- TypeScript strict mode?
|
|
106
|
+
- Linting/formatting tools and configs? (ESLint, Biome, Prettier, Ruff)
|
|
39
107
|
|
|
40
|
-
**Topic D — Testing**
|
|
41
|
-
- Testing framework? (
|
|
42
|
-
- Test structure? (mirrors source, separate folder
|
|
108
|
+
**Topic D — Testing** (default: Vitest)
|
|
109
|
+
- Testing framework? (vitest, jest, pytest)
|
|
110
|
+
- Test structure? (colocated, mirrors source, separate folder)
|
|
43
111
|
- Any naming conventions for tests?
|
|
44
112
|
|
|
45
|
-
**Topic E — Development Commands**
|
|
113
|
+
**Topic E — Development Commands** (default: Vite + Wrangler scripts)
|
|
46
114
|
- How do you run the dev server?
|
|
47
115
|
- How do you run tests?
|
|
48
116
|
- How do you lint/format?
|
|
@@ -59,44 +127,139 @@ Collect enough detail to write a full guide for each task type — not just the
|
|
|
59
127
|
|
|
60
128
|
Save to `CLAUDE.md` at the project root. Use this structure:
|
|
61
129
|
|
|
130
|
+
**For default stack projects**, use these pre-filled values:
|
|
131
|
+
|
|
62
132
|
```markdown
|
|
63
133
|
# [Project Name] — Development Rules
|
|
64
134
|
|
|
65
135
|
## 1. Core Principles
|
|
66
136
|
|
|
67
|
-
|
|
137
|
+
- Functional React only — hooks, no class components
|
|
138
|
+
- Feature modules are self-contained under `src/modules/`
|
|
139
|
+
- Shadcn UI components in `src/components/ui/` are NOT to be edited
|
|
140
|
+
- Code and comments in English, user-facing strings can be localized
|
|
141
|
+
- Always run `npm run format` after making code changes
|
|
68
142
|
|
|
69
143
|
---
|
|
70
144
|
|
|
71
145
|
## 2. Tech Stack
|
|
72
146
|
|
|
73
|
-
|
|
147
|
+
### Frontend
|
|
148
|
+
|
|
149
|
+
| Tool | Version | Purpose |
|
|
150
|
+
|---|---|---|
|
|
151
|
+
| React | 19 | UI framework |
|
|
152
|
+
| TypeScript | 5.x | Type safety (strict: false) |
|
|
153
|
+
| React Router | v7 | Client-side routing |
|
|
154
|
+
| Vite | 7.x | Build tool + dev server |
|
|
155
|
+
| Tailwind CSS | 4.x | Styling |
|
|
156
|
+
| Shadcn UI + Radix | — | Accessible component primitives |
|
|
157
|
+
| AG Grid Community | 35.x | Data tables and grids |
|
|
158
|
+
| React Hook Form + Zod | — | Form handling and validation |
|
|
159
|
+
| Lucide React | — | Icons (always use Lucide) |
|
|
160
|
+
| Vitest | — | Unit testing |
|
|
161
|
+
|
|
162
|
+
### Backend
|
|
163
|
+
|
|
164
|
+
| Tool | Version | Purpose |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| Cloudflare Workers | — | Serverless runtime |
|
|
167
|
+
| Cloudflare D1 | — | SQLite on the edge (database) |
|
|
168
|
+
| Cloudflare KV | — | Key-value cache layer |
|
|
169
|
+
| Cloudflare Durable Objects | — | Stateful long-running logic (if needed) |
|
|
170
|
+
| Hono | 4.x | HTTP routing framework |
|
|
171
|
+
| Firebase + JOSE | — | Authentication, Google Sign-In (if needed) |
|
|
74
172
|
|
|
75
173
|
---
|
|
76
174
|
|
|
77
175
|
## 3. Architecture
|
|
78
176
|
|
|
79
|
-
|
|
177
|
+
```
|
|
178
|
+
src/
|
|
179
|
+
├── components/ <- shared UI components
|
|
180
|
+
│ ├── common/ <- generic reusable components
|
|
181
|
+
│ └── ui/ <- Shadcn primitives (do not edit)
|
|
182
|
+
├── modules/ <- self-contained feature modules
|
|
183
|
+
│ └── [feature]/ <- components, hooks, view per feature
|
|
184
|
+
├── hooks/ <- shared hooks
|
|
185
|
+
├── lib/ <- utilities and helpers (api, firebase, utils)
|
|
186
|
+
├── types/ <- shared TypeScript types (index.ts)
|
|
187
|
+
├── layouts/ <- sidebar, topbar, app shell
|
|
188
|
+
├── pages/ <- page-level components (login, 404)
|
|
189
|
+
├── App.tsx <- root router
|
|
190
|
+
├── main.tsx <- entry point
|
|
191
|
+
└── index.css <- global styles
|
|
192
|
+
worker/
|
|
193
|
+
├── src/
|
|
194
|
+
│ ├── index.ts <- worker entry, route registration
|
|
195
|
+
│ ├── routes/ <- API route handlers (one file per domain)
|
|
196
|
+
│ ├── lib/ <- backend utilities, auth, business logic
|
|
197
|
+
│ └── types/ <- backend type definitions
|
|
198
|
+
├── wrangler.jsonc <- Cloudflare Workers config
|
|
199
|
+
└── migrations/ <- D1 SQLite migrations (numbered, sequential)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Key rules:
|
|
203
|
+
- Feature modules in `src/modules/` are self-contained with their own components and hooks
|
|
204
|
+
- Shared hooks go in `src/hooks/`, feature-specific ones stay in the module
|
|
205
|
+
- All data tables use AG Grid Community — Shadcn UI for everything else
|
|
206
|
+
- All icons use Lucide React — no other icon libraries
|
|
207
|
+
- All API routes are under `/api`, organized by domain in `worker/src/routes/`
|
|
208
|
+
- Backend uses prepared statements for D1 queries
|
|
209
|
+
- Durable Objects for stateful long-running operations (if needed)
|
|
80
210
|
|
|
81
211
|
---
|
|
82
212
|
|
|
83
213
|
## 4. Code Style
|
|
84
214
|
|
|
85
|
-
###
|
|
86
|
-
|
|
215
|
+
### TypeScript
|
|
216
|
+
- strict: false
|
|
217
|
+
- Path alias: `@/*` maps to `./src/*`
|
|
218
|
+
- Interfaces for object shapes, types for unions/intersections
|
|
219
|
+
- Named exports preferred
|
|
220
|
+
|
|
221
|
+
### React
|
|
222
|
+
- Functional components only
|
|
223
|
+
- Props defined as interface above the component
|
|
224
|
+
- File name matches component name: `UserCard.tsx` exports `UserCard`
|
|
225
|
+
|
|
226
|
+
### Naming
|
|
227
|
+
- Components: `PascalCase.tsx`
|
|
228
|
+
- Hooks: `useCamelCase.ts`
|
|
229
|
+
- Utilities: `camelCase.ts`
|
|
230
|
+
- Types/Interfaces: `PascalCase`
|
|
231
|
+
- Constants: `UPPER_SNAKE_CASE`
|
|
232
|
+
- Route files: `kebab-case.ts`
|
|
233
|
+
|
|
234
|
+
### Backend (Hono)
|
|
235
|
+
- One route file per domain in `worker/src/routes/`
|
|
236
|
+
- Register static routes BEFORE parameterized routes
|
|
237
|
+
- Use prepared statements for D1 queries
|
|
238
|
+
- Auth middleware on protected routes
|
|
87
239
|
|
|
88
240
|
---
|
|
89
241
|
|
|
90
242
|
## 5. Testing
|
|
91
243
|
|
|
92
|
-
|
|
244
|
+
- **Framework:** Vitest
|
|
245
|
+
- **Run:** `npm run test` (vitest run)
|
|
93
246
|
|
|
94
247
|
---
|
|
95
248
|
|
|
96
249
|
## 6. Development Commands
|
|
97
250
|
|
|
98
251
|
```bash
|
|
99
|
-
|
|
252
|
+
npm run dev # Vite frontend dev server
|
|
253
|
+
npm run dev:worker # Wrangler worker only
|
|
254
|
+
npm run dev:full # Both frontend and worker concurrently
|
|
255
|
+
npm run build # Production build
|
|
256
|
+
npm run deploy # Deploy to Cloudflare Workers
|
|
257
|
+
npm run db:migrate # Apply pending D1 migrations (local)
|
|
258
|
+
npm run db:migrate:remote # Apply pending D1 migrations (production)
|
|
259
|
+
npm run typecheck # TypeScript type checking (tsc -b --noEmit)
|
|
260
|
+
npm run lint # ESLint
|
|
261
|
+
npm run format # Prettier formatting
|
|
262
|
+
npm run test # Vitest unit tests
|
|
100
263
|
```
|
|
101
264
|
|
|
102
265
|
---
|
|
@@ -109,9 +272,11 @@ Read: `.agents/guides/[guide-name].md`
|
|
|
109
272
|
This guide covers: [bullet list]
|
|
110
273
|
```
|
|
111
274
|
|
|
275
|
+
**For custom stack projects**, fill in the values collected during Step 2.2 following the same structure.
|
|
276
|
+
|
|
112
277
|
## Step 3.5: Generate Reference Guides
|
|
113
278
|
|
|
114
|
-
For each task type identified in Topic F, create a guide at `.agents/guides/[kebab-case-task-name].md`.
|
|
279
|
+
For each task type identified (in Step 2.1 or Topic F), create a guide at `.agents/guides/[kebab-case-task-name].md`.
|
|
115
280
|
|
|
116
281
|
Use this template for every guide:
|
|
117
282
|
|
|
@@ -120,7 +285,7 @@ Use this template for every guide:
|
|
|
120
285
|
|
|
121
286
|
## When to Use This Guide
|
|
122
287
|
|
|
123
|
-
Load this guide when: [exact trigger condition, e.g. "adding a new API
|
|
288
|
+
Load this guide when: [exact trigger condition, e.g. "adding a new API route", "creating a React component"]
|
|
124
289
|
|
|
125
290
|
---
|
|
126
291
|
|
|
@@ -129,13 +294,15 @@ Load this guide when: [exact trigger condition, e.g. "adding a new API endpoint"
|
|
|
129
294
|
[Describe the layer structure for this task type. e.g.:]
|
|
130
295
|
|
|
131
296
|
```
|
|
132
|
-
|
|
297
|
+
src/modules/[feature]/components/[Component].tsx
|
|
298
|
+
src/modules/[feature]/hooks/use[Hook].ts
|
|
299
|
+
worker/src/routes/[domain].ts
|
|
133
300
|
```
|
|
134
301
|
|
|
135
302
|
Key rules:
|
|
136
|
-
- [Rule 1: e.g. "All business logic goes in
|
|
137
|
-
- [Rule 2: e.g. "
|
|
138
|
-
- [Rule 3: e.g. "
|
|
303
|
+
- [Rule 1: e.g. "All business logic goes in hooks or backend services, never in components"]
|
|
304
|
+
- [Rule 2: e.g. "Use prepared statements for all D1 queries"]
|
|
305
|
+
- [Rule 3: e.g. "Register static routes before parameterized routes"]
|
|
139
306
|
|
|
140
307
|
---
|
|
141
308
|
|
|
@@ -165,7 +332,7 @@ Follow these existing implementations as pattern:
|
|
|
165
332
|
|
|
166
333
|
## Code Examples
|
|
167
334
|
|
|
168
|
-
### [Filename pattern, e.g.
|
|
335
|
+
### [Filename pattern, e.g. worker/src/routes/products.ts]
|
|
169
336
|
```[language]
|
|
170
337
|
// Example showing the exact pattern to follow
|
|
171
338
|
[concrete code snippet]
|
|
@@ -188,25 +355,27 @@ Follow these existing implementations as pattern:
|
|
|
188
355
|
## Validation
|
|
189
356
|
|
|
190
357
|
After implementing, verify:
|
|
191
|
-
- [ ] `
|
|
192
|
-
- [ ] `
|
|
193
|
-
- [ ]
|
|
358
|
+
- [ ] `npm run lint`
|
|
359
|
+
- [ ] `npm run typecheck`
|
|
360
|
+
- [ ] `npm run test`
|
|
361
|
+
- [ ] `npm run format`
|
|
362
|
+
- [ ] [Manual check if applicable]
|
|
194
363
|
```
|
|
195
364
|
|
|
196
|
-
**Important:** Guides must contain concrete, project-specific information — not generic advice. If the user's answers
|
|
365
|
+
**Important:** Guides must contain concrete, project-specific information — not generic advice. If the user's answers don't have enough detail for a section, ask a follow-up before writing the guide.
|
|
197
366
|
|
|
198
367
|
Also update the `CLAUDE.md` Section 7 (Task-Specific Reference Guides) to reference each guide created:
|
|
199
368
|
|
|
200
369
|
```markdown
|
|
201
370
|
## 7. Task-Specific Reference Guides
|
|
202
371
|
|
|
203
|
-
**When adding an API
|
|
204
|
-
Read: `.agents/guides/api-
|
|
205
|
-
This guide covers:
|
|
372
|
+
**When adding an API route:**
|
|
373
|
+
Read: `.agents/guides/api-route.md`
|
|
374
|
+
This guide covers: Hono route setup, D1 queries, auth middleware, response format
|
|
206
375
|
|
|
207
|
-
**When creating a
|
|
208
|
-
Read: `.agents/guides/
|
|
209
|
-
This guide covers:
|
|
376
|
+
**When creating a feature module:**
|
|
377
|
+
Read: `.agents/guides/feature-module.md`
|
|
378
|
+
This guide covers: module structure, components, hooks, routing
|
|
210
379
|
```
|
|
211
380
|
|
|
212
381
|
## Step 4: Create .agents/ Structure
|
|
@@ -215,11 +384,11 @@ Create the following directories (with `.gitkeep` where needed):
|
|
|
215
384
|
|
|
216
385
|
```
|
|
217
386
|
.agents/
|
|
218
|
-
├── plans/
|
|
219
|
-
├── guides/
|
|
220
|
-
├── execution-reports/
|
|
221
|
-
├── code-reviews/
|
|
222
|
-
└── system-reviews/
|
|
387
|
+
├── plans/ <- /hopla-plan-feature saves here (commit these)
|
|
388
|
+
├── guides/ <- on-demand reference guides (commit these)
|
|
389
|
+
├── execution-reports/ <- /hopla-execution-report saves here (do NOT commit)
|
|
390
|
+
├── code-reviews/ <- /hopla-code-review saves here (do NOT commit)
|
|
391
|
+
└── system-reviews/ <- /hopla-system-review saves here (do NOT commit)
|
|
223
392
|
```
|
|
224
393
|
|
|
225
394
|
Add to `.gitignore` (create if it doesn't exist):
|
|
@@ -233,22 +402,25 @@ Add to `.gitignore` (create if it doesn't exist):
|
|
|
233
402
|
|
|
234
403
|
Create `.claude/commands/` at the project root for project-specific commands that override or extend the global ones.
|
|
235
404
|
|
|
236
|
-
Common project-specific commands to create:
|
|
237
|
-
|
|
238
405
|
**`validate.md`** — runs the full validation sequence for this project:
|
|
406
|
+
|
|
407
|
+
For default stack:
|
|
239
408
|
```markdown
|
|
240
409
|
---
|
|
241
410
|
description: Run full validation for this project
|
|
242
411
|
---
|
|
243
412
|
Run in order, stop if any level fails:
|
|
244
|
-
1. `
|
|
245
|
-
2. `
|
|
246
|
-
3. `
|
|
413
|
+
1. `npm run lint`
|
|
414
|
+
2. `npm run typecheck`
|
|
415
|
+
3. `npm run test`
|
|
416
|
+
4. `npm run format`
|
|
247
417
|
```
|
|
248
418
|
|
|
249
|
-
|
|
419
|
+
For custom stack, use the commands collected during discovery.
|
|
420
|
+
|
|
421
|
+
Ask the user: "Do you want me to create a project-specific `/validate` command?"
|
|
250
422
|
|
|
251
|
-
If yes, create `.claude/commands/validate.md
|
|
423
|
+
If yes, create `.claude/commands/validate.md`.
|
|
252
424
|
|
|
253
425
|
## Step 6: Confirm and Save
|
|
254
426
|
|