gl-life-claude-zen 1.3.3 → 1.3.5
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 +61 -27
- package/bin/create-gl-life-claude.js +4 -5
- package/dist/hooks/auto-format.js +1 -1
- package/dist/hooks/check-pending-reviews.js +1 -1
- package/dist/hooks/complete-task.js +1 -1
- package/dist/hooks/detect-pending-reviews.js +1 -1
- package/dist/hooks/enforce-hard-requirements.js +1 -1
- package/dist/hooks/enforce-migration-workflow.js +1 -1
- package/dist/hooks/enforce-structured-development.js +1 -1
- package/dist/hooks/enforce-test-pyramid.js +1 -1
- package/dist/hooks/init-task-tracker.js +1 -1
- package/dist/hooks/performance-cache.js +1 -1
- package/dist/hooks/prevent-read-bypass.js +1 -1
- package/dist/hooks/start-task.js +1 -1
- package/dist/hooks/task-status.js +1 -1
- package/dist/hooks/validate-component-contract.js +1 -1
- package/dist/hooks/validate-database-changes.js +1 -1
- package/dist/hooks/validate-e2e-coverage.js +1 -1
- package/dist/hooks/validate-git-workflow.js +1 -1
- package/dist/hooks/validate-integration-site.js +1 -1
- package/dist/hooks/validate-migration-impact.js +1 -1
- package/dist/hooks/validate-task-completion.js +1 -1
- package/dist/hooks/validate-test-quality.js +1 -1
- package/dist/hooks/validate-test-results.js +1 -1
- package/dist/hooks/validate-ui-integration.js +1 -1
- package/dist/hooks/validate-ui-runtime.js +1 -1
- package/dist/hooks/validate-ui-syntax.js +1 -1
- package/dist/hooks/validate-ui-visual-native.js +1 -1
- package/dist/hooks/validate-ui-visual.js +1 -1
- package/dist/hooks/validate-visual-regression.js +1 -1
- package/dist/scripts/help.js +1 -1
- package/dist/scripts/plan-amend.js +1 -1
- package/dist/scripts/plan-create.js +1 -1
- package/dist/scripts/plan-generate.js +2 -0
- package/dist/scripts/plan-help.js +1 -1
- package/dist/scripts/plan-init.js +1 -1
- package/dist/scripts/plan-manager.js +1 -1
- package/dist/scripts/pre-publish-checklist.js +1 -1
- package/dist/scripts/production-test.js +1 -1
- package/dist/scripts/profile-hooks.js +1 -1
- package/dist/scripts/setup-git-hooks.js +1 -1
- package/dist/scripts/task-done.js +1 -1
- package/dist/scripts/task-merge.js +1 -1
- package/dist/scripts/task-next.js +1 -1
- package/dist/scripts/task-start.js +1 -1
- package/dist/scripts/task-status.js +1 -1
- package/dist/scripts/verify-hooks.js +1 -1
- package/lib/init.js +52 -0
- package/package.json +1 -1
- package/templates/.claude/CLAUDE.md +23 -22
- package/templates/.claude/ONBOARDING.md +712 -0
- package/templates/.claude/settings.json +2 -4
- package/templates/package.json +1 -0
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
# 🎯 CRITICAL: READ THIS FIRST
|
|
2
|
+
|
|
3
|
+
## Your Environment Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
project-root/
|
|
7
|
+
├── .claude/
|
|
8
|
+
│ ├── settings.json ← PERMISSIONS & HOOKS (enforced)
|
|
9
|
+
│ ├── CLAUDE.md ← YOUR INSTRUCTIONS (read carefully)
|
|
10
|
+
│ ├── ONBOARDING.md ← THIS FILE
|
|
11
|
+
│ ├── plans/ ← Project plans (immutable once locked)
|
|
12
|
+
│ └── hooks/ ← NOT PRESENT (hooks are in node_modules)
|
|
13
|
+
│
|
|
14
|
+
├── node_modules/
|
|
15
|
+
│ └── .gl-life-claude/
|
|
16
|
+
│ ├── scripts/ ← 17 WORKFLOW SCRIPTS (bundled, protected)
|
|
17
|
+
│ └── hooks/ ← 28 ENFORCEMENT HOOKS (bundled, protected)
|
|
18
|
+
│
|
|
19
|
+
├── .git/hooks/ ← GIT HOOKS (installed by setup:git-hooks)
|
|
20
|
+
│
|
|
21
|
+
├── Agent/ ← YOUR WORKSPACE (you can modify)
|
|
22
|
+
│ ├── src/ ← Source code
|
|
23
|
+
│ ├── tests/ ← Test files
|
|
24
|
+
│ └── db/ ← Database scripts (write only, human executes)
|
|
25
|
+
│
|
|
26
|
+
├── scripts/ ← CUSTOM SCRIPTS (you can modify)
|
|
27
|
+
│
|
|
28
|
+
└── package.json ← NPM scripts configured
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 🚨 HARD RULES - NEVER VIOLATED
|
|
32
|
+
|
|
33
|
+
### Rule 1: NO WORK WITHOUT ACTIVE PLAN + TASK
|
|
34
|
+
**BLOCKED BY:** `enforce-structured-development.js` hook (PreToolUse)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# ALWAYS start with a plan:
|
|
38
|
+
npm run plan:generate # AI-assisted (recommended)
|
|
39
|
+
# OR
|
|
40
|
+
npm run plan:create # Manual
|
|
41
|
+
|
|
42
|
+
# Then lock it:
|
|
43
|
+
npm run plan:init
|
|
44
|
+
|
|
45
|
+
# Then start a task:
|
|
46
|
+
npm run task:start TASK-001
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**What gets blocked if no active task:**
|
|
50
|
+
- ❌ Edit()
|
|
51
|
+
- ❌ Write()
|
|
52
|
+
- ❌ TodoWrite()
|
|
53
|
+
- ❌ Read() on project files
|
|
54
|
+
- ❌ Grep() on project files
|
|
55
|
+
- ❌ Glob() on project files
|
|
56
|
+
|
|
57
|
+
**Only allowed without task:**
|
|
58
|
+
- ✅ npm run commands
|
|
59
|
+
- ✅ git status/log/diff
|
|
60
|
+
- ✅ Reading documentation
|
|
61
|
+
|
|
62
|
+
### Rule 2: WORK ONLY ON MAIN BRANCH
|
|
63
|
+
**BLOCKED BY:** Permission system in `settings.json`
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# ✅ ALLOWED:
|
|
67
|
+
git checkout main
|
|
68
|
+
git add .
|
|
69
|
+
git commit -m "[TASK-001] Description"
|
|
70
|
+
git push origin main
|
|
71
|
+
|
|
72
|
+
# ❌ BLOCKED:
|
|
73
|
+
git checkout -b feature/anything # DENIED
|
|
74
|
+
git checkout -b task/anything # DENIED
|
|
75
|
+
git merge # DENIED
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**All work happens directly on main branch. No branching.**
|
|
79
|
+
|
|
80
|
+
### Rule 3: RESTRICTED DIRECTORY ACCESS
|
|
81
|
+
**BLOCKED BY:** Permission system in `settings.json`
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# ✅ YOU CAN MODIFY:
|
|
85
|
+
./Agent/** # Your source code
|
|
86
|
+
./scripts/** # Your custom scripts
|
|
87
|
+
|
|
88
|
+
# ❌ YOU CANNOT MODIFY:
|
|
89
|
+
./docs/** # Documentation (DENIED)
|
|
90
|
+
./.claude/** # Framework files (DENIED)
|
|
91
|
+
./node_modules/** # Dependencies (DENIED)
|
|
92
|
+
**/*.md # Markdown files (DENIED)
|
|
93
|
+
./.env* # Environment files (DENIED)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Rule 4: NO DANGEROUS OPERATIONS
|
|
97
|
+
**BLOCKED BY:** Permission system in `settings.json`
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# ❌ BLOCKED COMMANDS:
|
|
101
|
+
git push --force
|
|
102
|
+
rm -rf
|
|
103
|
+
sudo
|
|
104
|
+
npm install # Ask user first
|
|
105
|
+
npm publish
|
|
106
|
+
curl / wget
|
|
107
|
+
psql / mysql / mongosh
|
|
108
|
+
node ./scripts/** # Write scripts, human executes
|
|
109
|
+
node ./Agent/db/** # Write scripts, human executes
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 📋 Available Commands
|
|
113
|
+
|
|
114
|
+
### Planning Commands (ALWAYS START HERE)
|
|
115
|
+
```bash
|
|
116
|
+
npm run plan:generate # AI-assisted plan generation
|
|
117
|
+
npm run plan:create # Manual plan creation
|
|
118
|
+
npm run plan:init # Lock plan, create task tracker
|
|
119
|
+
npm run plan:manager # Switch between plans
|
|
120
|
+
npm run plan:amend # Amend locked plan (audit trail)
|
|
121
|
+
npm run plan:help # Planning help
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Task Commands (USE AFTER PLAN IS LOCKED)
|
|
125
|
+
```bash
|
|
126
|
+
npm run task:start TASK-001 # Start specific task
|
|
127
|
+
npm run task:next # Auto-start next available task
|
|
128
|
+
npm run task:done TASK-001 # Complete current task
|
|
129
|
+
npm run task:status # View project progress
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Utility Commands
|
|
133
|
+
```bash
|
|
134
|
+
npm run help # Show all commands
|
|
135
|
+
npm run setup:git-hooks # Install git hooks
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 🔒 How Hooks Protect the Workflow
|
|
139
|
+
|
|
140
|
+
### PreToolUse Hooks (RUN BEFORE EVERY ACTION)
|
|
141
|
+
1. **enforce-hard-requirements.js** - Validates critical constraints
|
|
142
|
+
2. **prevent-read-bypass.js** - Prevents unauthorized file access
|
|
143
|
+
3. **enforce-structured-development.js** - Requires active task
|
|
144
|
+
4. **validate-git-workflow.js** - Validates git operations
|
|
145
|
+
5. **validate-task-completion.js** - Ensures task is active
|
|
146
|
+
|
|
147
|
+
### PostToolUse Hooks (RUN AFTER EVERY ACTION)
|
|
148
|
+
1. **auto-format.js** - Auto-formats code
|
|
149
|
+
2. **validate-test-quality.js** - Blocks fake tests
|
|
150
|
+
3. **validate-ui-integration.js** - Requires UI tests
|
|
151
|
+
4. **validate-database-changes.js** - Validates migrations
|
|
152
|
+
5. **enforce-test-pyramid.js** - Warns on missing tests
|
|
153
|
+
6. And 23 more hooks...
|
|
154
|
+
|
|
155
|
+
**ALL HOOKS USE `process.exit(1)` OR `process.exit(2)` TO HARD BLOCK VIOLATIONS**
|
|
156
|
+
|
|
157
|
+
## ✅ MANDATORY: Task Completion Steps
|
|
158
|
+
|
|
159
|
+
**EVERY SINGLE TASK MUST FOLLOW THESE STEPS - NO EXCEPTIONS**
|
|
160
|
+
|
|
161
|
+
### Step-by-Step Task Completion Checklist
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
□ 1. Read task file: .claude/plans/<plan-id>/tasks/TASK-XXX.json
|
|
165
|
+
- Read description, completionCriteria, testCases
|
|
166
|
+
- Understand what needs to be done
|
|
167
|
+
|
|
168
|
+
□ 2. Read related files mentioned in task
|
|
169
|
+
- Check artifacts.code for files to modify
|
|
170
|
+
- Read existing code before changing
|
|
171
|
+
|
|
172
|
+
□ 3. Make changes in ./Agent/ or ./scripts/ only
|
|
173
|
+
- Edit/Write only in allowed directories
|
|
174
|
+
- Follow task requirements exactly
|
|
175
|
+
|
|
176
|
+
□ 4. Write/update tests
|
|
177
|
+
- Create test file if doesn't exist
|
|
178
|
+
- Add test cases from task.testCases
|
|
179
|
+
- Ensure tests have real assertions
|
|
180
|
+
|
|
181
|
+
□ 5. Run tests and verify they pass
|
|
182
|
+
- npm test (or project-specific test command)
|
|
183
|
+
- Fix any failures before continuing
|
|
184
|
+
|
|
185
|
+
□ 6. Commit changes with task ID
|
|
186
|
+
- git add .
|
|
187
|
+
- git commit -m "[TASK-XXX] Description"
|
|
188
|
+
- Include task ID in EVERY commit
|
|
189
|
+
|
|
190
|
+
□ 7. Push to remote
|
|
191
|
+
- git push origin main
|
|
192
|
+
- Backup work regularly
|
|
193
|
+
|
|
194
|
+
□ 8. Verify all completion criteria met
|
|
195
|
+
- Check task.completionCriteria array
|
|
196
|
+
- Ensure EVERY criterion is satisfied
|
|
197
|
+
|
|
198
|
+
□ 9. Mark task complete
|
|
199
|
+
- npm run task:done TASK-XXX
|
|
200
|
+
- System validates all changes committed
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**If ANY step fails, DO NOT proceed. Fix the issue first.**
|
|
204
|
+
|
|
205
|
+
## 🧪 TEST-DRIVEN DEVELOPMENT - HARD RULES
|
|
206
|
+
|
|
207
|
+
**ALL TESTING RULES ARE ENFORCED BY HOOKS - VIOLATIONS WILL BLOCK COMMITS**
|
|
208
|
+
|
|
209
|
+
### Rule 1: Tests MUST Have Real Assertions
|
|
210
|
+
**ENFORCED BY:** `validate-test-quality.js` (PostToolUse)
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
// ❌ BLOCKED - Fake test
|
|
214
|
+
test('should work', () => {
|
|
215
|
+
// empty test
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// ❌ BLOCKED - No assertions
|
|
219
|
+
test('should calculate', () => {
|
|
220
|
+
const result = add(2, 3);
|
|
221
|
+
// no assertion
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// ✅ ALLOWED - Real assertion
|
|
225
|
+
test('should add numbers', () => {
|
|
226
|
+
const result = add(2, 3);
|
|
227
|
+
expect(result).toBe(5);
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Hook blocks:**
|
|
232
|
+
- Empty test functions
|
|
233
|
+
- Tests without expect/assert/should
|
|
234
|
+
- Comment-only tests
|
|
235
|
+
- Console.log-only tests
|
|
236
|
+
|
|
237
|
+
### Rule 2: UI Components MUST Have Tests
|
|
238
|
+
**ENFORCED BY:** `validate-ui-integration.js` (PostToolUse)
|
|
239
|
+
|
|
240
|
+
When you modify UI components (`.tsx`, `.jsx`, `.vue`, `.svelte`):
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# ❌ BLOCKED - No test file
|
|
244
|
+
src/components/Button.tsx # modified
|
|
245
|
+
# Missing: src/components/Button.test.tsx
|
|
246
|
+
|
|
247
|
+
# ✅ ALLOWED - Test file exists
|
|
248
|
+
src/components/Button.tsx # modified
|
|
249
|
+
src/components/Button.test.tsx # exists with real tests
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Required in UI tests:**
|
|
253
|
+
- Import and render the component
|
|
254
|
+
- Provide required props
|
|
255
|
+
- Simulate user events (clicks, inputs)
|
|
256
|
+
- Mock API calls if used
|
|
257
|
+
- Validate state changes
|
|
258
|
+
- Test form submission if applicable
|
|
259
|
+
- Test conditional rendering paths
|
|
260
|
+
|
|
261
|
+
### Rule 3: UI Components MUST Be in Integration Site
|
|
262
|
+
**ENFORCED BY:** `validate-integration-site.js` (PostToolUse)
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# ❌ BLOCKED - Not in test-site
|
|
266
|
+
src/components/NewWidget.tsx # created
|
|
267
|
+
# Missing: test-site/src/components/NewWidget.tsx
|
|
268
|
+
|
|
269
|
+
# ✅ ALLOWED - Added to integration site
|
|
270
|
+
src/components/NewWidget.tsx # created
|
|
271
|
+
test-site/src/components/NewWidget.tsx # added for stakeholder preview
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Purpose:** Integration site allows stakeholders to preview components with hot-reload.
|
|
275
|
+
|
|
276
|
+
### Rule 4: Tests MUST Pass Before Commit
|
|
277
|
+
**ENFORCED BY:** `validate-test-results.js` (PostToolUse)
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# ❌ BLOCKED - Tests failing
|
|
281
|
+
npm test
|
|
282
|
+
# 5 passing, 2 failing
|
|
283
|
+
git commit -m "Add feature"
|
|
284
|
+
# BLOCKED: Tests must pass
|
|
285
|
+
|
|
286
|
+
# ✅ ALLOWED - All tests pass
|
|
287
|
+
npm test
|
|
288
|
+
# 7 passing
|
|
289
|
+
git commit -m "Add feature"
|
|
290
|
+
# Commit succeeds
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**Hook checks npm test exit code. Non-zero = blocked.**
|
|
294
|
+
|
|
295
|
+
### Rule 5: Database Changes MUST Use Migrations
|
|
296
|
+
**ENFORCED BY:** `validate-database-changes.js` (PostToolUse)
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# ❌ BLOCKED - Direct schema edit
|
|
300
|
+
Edit(./Agent/db/schema.sql) # DENIED by permissions
|
|
301
|
+
|
|
302
|
+
# ✅ ALLOWED - Migration workflow
|
|
303
|
+
Write(./Agent/migrations/001_add_users_table.sql)
|
|
304
|
+
# Migration file created, human executes
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Rules:**
|
|
308
|
+
- NEVER edit existing migrations (immutable)
|
|
309
|
+
- ALWAYS create new migration files
|
|
310
|
+
- NEVER run database CLI directly (psql, mysql)
|
|
311
|
+
- Human executes migrations, Claude writes them
|
|
312
|
+
|
|
313
|
+
### Rule 6: Test Pyramid Must Be Balanced
|
|
314
|
+
**ENFORCED BY:** `enforce-test-pyramid.js` (PostToolUse)
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
# ⚠️ WARNING - Imbalanced tests
|
|
318
|
+
Unit tests: 50
|
|
319
|
+
Integration tests: 5
|
|
320
|
+
E2E tests: 0
|
|
321
|
+
# Warning: Need more integration and E2E tests
|
|
322
|
+
|
|
323
|
+
# ✅ GOOD - Balanced pyramid
|
|
324
|
+
Unit tests: 100
|
|
325
|
+
Integration tests: 30
|
|
326
|
+
E2E tests: 10
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
**Recommended ratio:** 70% unit, 20% integration, 10% e2e
|
|
330
|
+
|
|
331
|
+
## 📝 TASK DEVELOPMENT WORKFLOW (STEP-BY-STEP)
|
|
332
|
+
|
|
333
|
+
**Follow this EXACT workflow for EVERY task - hooks enforce it**
|
|
334
|
+
|
|
335
|
+
### Phase 1: Planning (Before Code)
|
|
336
|
+
```bash
|
|
337
|
+
□ 1. Read task file
|
|
338
|
+
cat .claude/plans/<plan-id>/tasks/TASK-XXX.json
|
|
339
|
+
|
|
340
|
+
□ 2. Understand requirements
|
|
341
|
+
- Read description
|
|
342
|
+
- Check completionCriteria (what defines "done")
|
|
343
|
+
- Check testCases (what tests are required)
|
|
344
|
+
- Check artifacts.code (which files to modify)
|
|
345
|
+
|
|
346
|
+
□ 3. Read existing code
|
|
347
|
+
Read(./Agent/src/target-file.ts)
|
|
348
|
+
# NEVER modify code you haven't read first
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Phase 2: Write Tests First (TDD)
|
|
352
|
+
```bash
|
|
353
|
+
□ 4. Create test file
|
|
354
|
+
Write(./Agent/tests/feature.test.ts)
|
|
355
|
+
|
|
356
|
+
□ 5. Write test cases from task
|
|
357
|
+
- Use task.testCases as test names
|
|
358
|
+
- Write failing tests with real assertions
|
|
359
|
+
- Test expected behavior, edge cases, errors
|
|
360
|
+
|
|
361
|
+
□ 6. Run tests (should fail)
|
|
362
|
+
npm test
|
|
363
|
+
# Tests should fail - no implementation yet
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Phase 3: Implement Code
|
|
367
|
+
```bash
|
|
368
|
+
□ 7. Write minimum code to pass tests
|
|
369
|
+
Edit(./Agent/src/feature.ts)
|
|
370
|
+
# Only in ./Agent/** or ./scripts/**
|
|
371
|
+
|
|
372
|
+
□ 8. Run tests (should pass)
|
|
373
|
+
npm test
|
|
374
|
+
# Fix until all tests pass
|
|
375
|
+
|
|
376
|
+
□ 9. Refactor if needed
|
|
377
|
+
# Improve code while tests stay green
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Phase 4: UI Components (If Applicable)
|
|
381
|
+
```bash
|
|
382
|
+
□ 10. Create UI test
|
|
383
|
+
Write(./Agent/src/components/Widget.test.tsx)
|
|
384
|
+
- Import and render component
|
|
385
|
+
- Test props, events, state, API mocks
|
|
386
|
+
|
|
387
|
+
□ 11. Implement UI component
|
|
388
|
+
Edit(./Agent/src/components/Widget.tsx)
|
|
389
|
+
|
|
390
|
+
□ 12. Add to integration site
|
|
391
|
+
Write(./test-site/src/components/Widget.tsx)
|
|
392
|
+
# For stakeholder preview
|
|
393
|
+
|
|
394
|
+
□ 13. Run UI tests
|
|
395
|
+
npm test
|
|
396
|
+
# Hooks validate test quality
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Phase 5: Commit & Push
|
|
400
|
+
```bash
|
|
401
|
+
□ 14. Verify completion criteria
|
|
402
|
+
# Check task.completionCriteria - ALL must be met
|
|
403
|
+
|
|
404
|
+
□ 15. Run full test suite
|
|
405
|
+
npm test
|
|
406
|
+
# MUST pass - hooks will block otherwise
|
|
407
|
+
|
|
408
|
+
□ 16. Commit with task ID
|
|
409
|
+
git add .
|
|
410
|
+
git commit -m "[TASK-XXX] Implement feature with tests"
|
|
411
|
+
# Hooks validate:
|
|
412
|
+
# - Active task exists
|
|
413
|
+
# - Tests pass
|
|
414
|
+
# - Tests have assertions
|
|
415
|
+
# - UI components have tests
|
|
416
|
+
# - No fake/empty tests
|
|
417
|
+
|
|
418
|
+
□ 17. Push to remote
|
|
419
|
+
git push origin main
|
|
420
|
+
# Backup work regularly
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Phase 6: Complete Task
|
|
424
|
+
```bash
|
|
425
|
+
□ 18. Mark complete
|
|
426
|
+
npm run task:done TASK-XXX
|
|
427
|
+
# System validates:
|
|
428
|
+
# - All changes committed
|
|
429
|
+
# - No uncommitted files
|
|
430
|
+
# - Task not already completed
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## ⚠️ Common Test Violations (WILL BE BLOCKED)
|
|
434
|
+
|
|
435
|
+
### Violation 1: Empty Tests
|
|
436
|
+
```javascript
|
|
437
|
+
// ❌ BLOCKED by validate-test-quality.js
|
|
438
|
+
test('should work', () => {});
|
|
439
|
+
test('should do something', () => {
|
|
440
|
+
// TODO: implement
|
|
441
|
+
});
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Violation 2: No Assertions
|
|
445
|
+
```javascript
|
|
446
|
+
// ❌ BLOCKED by validate-test-quality.js
|
|
447
|
+
test('calculates total', () => {
|
|
448
|
+
const result = calculateTotal(items);
|
|
449
|
+
console.log(result); // No assertion!
|
|
450
|
+
});
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Violation 3: UI Without Tests
|
|
454
|
+
```javascript
|
|
455
|
+
// ❌ BLOCKED by validate-ui-integration.js
|
|
456
|
+
// Created: src/components/Button.tsx
|
|
457
|
+
// Missing: src/components/Button.test.tsx
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Violation 4: Failing Tests
|
|
461
|
+
```bash
|
|
462
|
+
# ❌ BLOCKED by validate-test-results.js
|
|
463
|
+
$ npm test
|
|
464
|
+
FAIL src/feature.test.ts
|
|
465
|
+
✓ works in basic case
|
|
466
|
+
✗ handles edge case
|
|
467
|
+
|
|
468
|
+
$ git commit -m "Add feature"
|
|
469
|
+
# BLOCKED: Tests must pass
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Violation 5: Modifying Code Without Task
|
|
473
|
+
```bash
|
|
474
|
+
# ❌ BLOCKED by enforce-structured-development.js
|
|
475
|
+
$ Edit(./Agent/src/app.ts)
|
|
476
|
+
# ERROR: No active task
|
|
477
|
+
# Start task first: npm run task:start TASK-XXX
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## ✅ Correct Test-Driven Workflow Example
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
# 1. Start task
|
|
484
|
+
npm run task:start TASK-005
|
|
485
|
+
|
|
486
|
+
# 2. Read task requirements
|
|
487
|
+
cat .claude/plans/plan-001/tasks/TASK-005.json
|
|
488
|
+
|
|
489
|
+
# 3. Read existing code
|
|
490
|
+
Read(./Agent/src/calculator.ts)
|
|
491
|
+
|
|
492
|
+
# 4. Write failing test
|
|
493
|
+
Write(./Agent/tests/calculator.test.ts)
|
|
494
|
+
"""
|
|
495
|
+
test('should multiply numbers', () => {
|
|
496
|
+
const result = multiply(3, 4);
|
|
497
|
+
expect(result).toBe(12);
|
|
498
|
+
});
|
|
499
|
+
"""
|
|
500
|
+
|
|
501
|
+
# 5. Run test (should fail)
|
|
502
|
+
npm test
|
|
503
|
+
# FAIL: multiply is not defined
|
|
504
|
+
|
|
505
|
+
# 6. Implement feature
|
|
506
|
+
Edit(./Agent/src/calculator.ts)
|
|
507
|
+
"""
|
|
508
|
+
export function multiply(a, b) {
|
|
509
|
+
return a * b;
|
|
510
|
+
}
|
|
511
|
+
"""
|
|
512
|
+
|
|
513
|
+
# 7. Run test (should pass)
|
|
514
|
+
npm test
|
|
515
|
+
# PASS: 1 test passed
|
|
516
|
+
|
|
517
|
+
# 8. Commit
|
|
518
|
+
git add .
|
|
519
|
+
git commit -m "[TASK-005] Add multiply function with tests"
|
|
520
|
+
# Hooks validate:
|
|
521
|
+
# ✓ Active task exists
|
|
522
|
+
# ✓ Tests pass
|
|
523
|
+
# ✓ Tests have real assertions
|
|
524
|
+
# ✓ Code only in allowed directories
|
|
525
|
+
|
|
526
|
+
# 9. Push
|
|
527
|
+
git push origin main
|
|
528
|
+
|
|
529
|
+
# 10. Complete task
|
|
530
|
+
npm run task:done TASK-005
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**If ANY step fails, DO NOT proceed. Fix the issue first.**
|
|
534
|
+
|
|
535
|
+
## 🎯 Correct Workflow (ALWAYS FOLLOW THIS)
|
|
536
|
+
|
|
537
|
+
### Step 1: Generate Plan
|
|
538
|
+
```bash
|
|
539
|
+
npm run plan:generate "Build a REST API with:
|
|
540
|
+
- User authentication
|
|
541
|
+
- CRUD operations for tasks
|
|
542
|
+
- PostgreSQL database
|
|
543
|
+
- Express + TypeScript"
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
This creates `.claude/plans/plan-001-generated/PROJECT-REQUIREMENTS.txt`
|
|
547
|
+
|
|
548
|
+
### Step 2: Ask Claude to Create Plan
|
|
549
|
+
In Claude Code chat:
|
|
550
|
+
```
|
|
551
|
+
"Please read .claude/plans/plan-001-generated/PROJECT-REQUIREMENTS.txt
|
|
552
|
+
and create a detailed PROJECT-PLAN.json with tasks, dependencies, and phases"
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
Claude will create structured plan with TASK-001, TASK-002, etc.
|
|
556
|
+
|
|
557
|
+
### Step 3: Lock the Plan
|
|
558
|
+
```bash
|
|
559
|
+
npm run plan:init
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
This creates:
|
|
563
|
+
- `TASK-TRACKER.json` (tracks progress)
|
|
564
|
+
- `tasks/TASK-001.json`, `tasks/TASK-002.json`, etc.
|
|
565
|
+
- `.plan-locked` (makes plan immutable)
|
|
566
|
+
|
|
567
|
+
### Step 4: Start Working
|
|
568
|
+
```bash
|
|
569
|
+
npm run task:start TASK-001
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
Now you can:
|
|
573
|
+
- Edit files in `./Agent/`
|
|
574
|
+
- Write tests
|
|
575
|
+
- Commit changes: `git commit -m "[TASK-001] Implemented feature"`
|
|
576
|
+
- Push: `git push origin main`
|
|
577
|
+
|
|
578
|
+
### Step 5: Complete Task
|
|
579
|
+
```bash
|
|
580
|
+
npm run task:done TASK-001
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Step 6: Continue
|
|
584
|
+
```bash
|
|
585
|
+
npm run task:next # Automatically starts TASK-002
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
## ⚠️ Common Mistakes (DON'T DO THIS)
|
|
589
|
+
|
|
590
|
+
### ❌ WRONG: Working without a plan
|
|
591
|
+
```bash
|
|
592
|
+
# This will FAIL - no active task:
|
|
593
|
+
Edit(./Agent/src/app.ts)
|
|
594
|
+
# ❌ BLOCKED: No active task
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### ✅ CORRECT: Start with plan
|
|
598
|
+
```bash
|
|
599
|
+
npm run plan:generate "My project requirements..."
|
|
600
|
+
# Claude creates plan
|
|
601
|
+
npm run plan:init
|
|
602
|
+
npm run task:start TASK-001
|
|
603
|
+
# Now Edit() works
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
### ❌ WRONG: Creating branches
|
|
607
|
+
```bash
|
|
608
|
+
git checkout -b feature/my-feature
|
|
609
|
+
# ❌ BLOCKED: Permission denied
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
### ✅ CORRECT: Work on main
|
|
613
|
+
```bash
|
|
614
|
+
git checkout main
|
|
615
|
+
# Work here, commit, push
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### ❌ WRONG: Editing framework files
|
|
619
|
+
```bash
|
|
620
|
+
Edit(./.claude/settings.json)
|
|
621
|
+
# ❌ BLOCKED: Permission denied
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### ✅ CORRECT: Only edit your code
|
|
625
|
+
```bash
|
|
626
|
+
Edit(./Agent/src/myfile.ts) # ✅ Allowed
|
|
627
|
+
Edit(./scripts/myutil.js) # ✅ Allowed
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
### ❌ WRONG: Running scripts directly
|
|
631
|
+
```bash
|
|
632
|
+
Bash(node ./scripts/setup.js)
|
|
633
|
+
# ❌ BLOCKED: Permission denied
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
### ✅ CORRECT: Write scripts, human executes
|
|
637
|
+
```bash
|
|
638
|
+
Write(./scripts/setup.js) # ✅ Allowed
|
|
639
|
+
# Tell user: "Run: node ./scripts/setup.js"
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
## 🔍 Debugging Blocked Actions
|
|
643
|
+
|
|
644
|
+
If you get blocked, check:
|
|
645
|
+
|
|
646
|
+
1. **Is there an active plan?**
|
|
647
|
+
```bash
|
|
648
|
+
cat .claude/ACTIVE-PLAN
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
2. **Is the plan locked?**
|
|
652
|
+
```bash
|
|
653
|
+
ls .claude/plans/plan-*/. plan-locked
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
3. **Is there an active task?**
|
|
657
|
+
```bash
|
|
658
|
+
npm run task:status
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
4. **Are hooks installed?**
|
|
662
|
+
```bash
|
|
663
|
+
ls .git/hooks/pre-commit
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
5. **What are my permissions?**
|
|
667
|
+
```bash
|
|
668
|
+
cat .claude/settings.json
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## 📖 Where to Find More Info
|
|
672
|
+
|
|
673
|
+
- **Workflow rules:** `.claude/CLAUDE.md`
|
|
674
|
+
- **Permissions:** `.claude/settings.json`
|
|
675
|
+
- **Active plan:** `.claude/ACTIVE-PLAN`
|
|
676
|
+
- **Task progress:** `.claude/plans/<plan-id>/TASK-TRACKER.json`
|
|
677
|
+
- **Help commands:** `npm run help`
|
|
678
|
+
|
|
679
|
+
## 🚀 Quick Start for Claude
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
# 1. Check if plan exists
|
|
683
|
+
npm run task:status
|
|
684
|
+
|
|
685
|
+
# 2a. If no plan, create one:
|
|
686
|
+
npm run plan:generate
|
|
687
|
+
|
|
688
|
+
# 2b. If plan exists but not locked:
|
|
689
|
+
npm run plan:init
|
|
690
|
+
|
|
691
|
+
# 3. Start working:
|
|
692
|
+
npm run task:next
|
|
693
|
+
|
|
694
|
+
# 4. Work on files in ./Agent/ directory
|
|
695
|
+
# 5. Commit frequently with task ID
|
|
696
|
+
# 6. Complete task when done:
|
|
697
|
+
npm run task:done TASK-XXX
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
## 🎓 Remember
|
|
701
|
+
|
|
702
|
+
1. **NEVER** work without an active task
|
|
703
|
+
2. **NEVER** create branches (work on main)
|
|
704
|
+
3. **NEVER** modify framework files (`.claude/`, `node_modules/`)
|
|
705
|
+
4. **NEVER** run dangerous commands (force push, rm -rf, sudo)
|
|
706
|
+
5. **ALWAYS** use npm run commands for workflow
|
|
707
|
+
6. **ALWAYS** commit with task ID: `[TASK-XXX] Description`
|
|
708
|
+
7. **ALWAYS** check `npm run task:status` if blocked
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
**This framework enforces professional development practices. The hooks and permissions exist to prevent mistakes, not to annoy you. Follow the workflow and you'll be productive.**
|