oneie 3.6.7 → 3.6.11
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/.claude/agents/agent-backend.md +83 -0
- package/.claude/agents/agent-designer.md +97 -0
- package/.claude/agents/agent-director.md +118 -7
- package/.claude/agents/agent-documenter.md +93 -0
- package/.claude/agents/agent-frontend.md +96 -0
- package/.claude/agents/agent-ops.md +182 -25
- package/.claude/agents/agent-problem-solver.md +166 -0
- package/.claude/agents/agent-quality.md +127 -0
- package/.claude/commands/build.md +293 -0
- package/.claude/commands/cascade.md +231 -127
- package/.claude/commands/mcp-toggle.md +93 -0
- package/.claude/commands/one.md +198 -116
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/release.md +41 -19
- package/.claude/commands/server.md +2 -0
- package/.claude/hooks/root-cleanup.py +75 -0
- package/.claude/skills/INDEX.md +523 -0
- package/.claude/skills/REGISTRY.md +529 -0
- package/.claude/skills/agent-backend-create-mutation.md +319 -0
- package/.claude/skills/agent-designer-create-wireframe.md +341 -0
- package/.claude/skills/agent-frontend-create-page.md +413 -0
- package/.claude/skills/agents/README.md +238 -0
- package/dist/clone-web.js +1 -1
- package/dist/clone-web.js.map +1 -1
- package/folders.yaml +1 -1
- package/one/.obsidian/workspace.json +38 -38
- package/one/connections/api/queries-reference.md +842 -0
- package/one/connections/api-reference.md +1011 -0
- package/one/connections/integration-examples.md +875 -0
- package/one/connections/integration-guide.md +869 -0
- package/one/connections/integration-phase2.md +736 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
- package/one/events/CONNECTIONS_DEMO.md +501 -0
- package/one/events/DELIVERABLES.md +432 -0
- package/one/events/DEMO-GROUPS-PAGE.md +392 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
- package/one/events/DEMO_COMPONENTS.md +487 -0
- package/one/events/DEMO_HOOKS_INDEX.md +334 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
- package/one/events/DEMO_SETUP.md +476 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
- package/one/events/HOOKS-DEMO.md +441 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
- package/one/events/QA-CHECKLIST.md +674 -0
- package/one/events/QUICK-START-ONTOLOGY.md +408 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
- package/one/events/TEST-PLAN-INDEX.md +346 -0
- package/one/events/TEST-PLAN.md +1417 -0
- package/one/events/TESTING-DELIVERY.txt +372 -0
- package/one/events/TRANSITIONS-QUICK-START.md +141 -0
- package/one/events/TYPESCRIPT_FIXES.md +152 -0
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
- package/one/events/VIEW-TRANSITIONS.md +428 -0
- package/one/events/backend-integration-tests.md +606 -0
- package/one/events/backend-structure-diagram.txt +393 -0
- package/one/events/backend-structure-summary.txt +269 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
- package/one/events/convex-analysis-index.md +304 -0
- package/one/events/convex-structure-analysis.md +700 -0
- package/one/events/design-spec-complete.md +208 -0
- package/one/events/ontology-test-examples.md +562 -0
- package/one/events/phase1-backend-implementation-complete.md +518 -0
- package/one/events/test-dashboard.md +345 -0
- package/one/events/test-index.md +361 -0
- package/one/events/test-report-ontology.md +582 -0
- package/one/events/testing-summary.md +344 -0
- package/one/groups/features.md +2878 -0
- package/one/groups/strategy copy.md +869 -0
- package/one/knowledge/backend-api-reference.md +710 -0
- package/one/knowledge/documentation-summary.md +285 -0
- package/one/knowledge/lessons-learned.md +294 -4
- package/one/knowledge/ontology-visual-guide.md +360 -0
- package/one/knowledge/ontology.md +9 -17
- package/one/things/demo-accessibility-animations.md +999 -0
- package/one/things/demo-components.md +1304 -0
- package/one/things/demo-design-summary.md +629 -0
- package/one/things/demo-design-system.md +919 -0
- package/one/things/demo-page-layouts.md +989 -0
- package/one/things/designs/accessibility-audit.md +790 -0
- package/one/things/designs/component-specifications.md +757 -0
- package/one/things/designs/design-overview.md +318 -0
- package/one/things/designs/design-tokens.md +414 -0
- package/one/things/designs/wireframes-dashboard.md +653 -0
- package/one/things/docs/api-requests.md +923 -0
- package/one/things/features/0 All Features.md +2 -0
- package/one/things/implementation/backend-guide.md +412 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
- package/one/things/plans/ai-elements.md +1259 -0
- package/one/things/plans/ai-integration.md +947 -0
- package/one/things/plans/ai-sdk.md +761 -0
- package/one/things/plans/app.md +1 -1
- package/one/things/plans/architecture-summary.md +283 -0
- package/one/things/plans/async-ai-agents.md +215 -0
- package/one/things/plans/backend-agnostic-frontend.md +11 -6
- package/one/things/plans/backend-cleanup-quickstart.md +346 -0
- package/one/things/plans/backend-ontology-conformance.md +416 -0
- package/one/things/plans/backend-status.md +541 -0
- package/one/things/plans/backend-structure.md +799 -0
- package/one/things/plans/backend-target-structure.md +438 -0
- package/one/things/plans/backend.md +1133 -0
- package/one/things/plans/better-auth-any-backend.md +11 -11
- package/one/things/plans/cli-updates-required.md +280 -0
- package/one/things/plans/complete-step-by-step.md +1302 -0
- package/one/things/plans/convex-agents.md +1005 -0
- package/one/things/plans/deployment-architecture.md +426 -0
- package/one/things/plans/development-plan.md +1220 -0
- package/one/things/plans/effect.md +808 -48
- package/one/things/plans/integrate-frontend-and-backend.md +579 -0
- package/one/things/plans/mcp-clear-context-prompt.md +60 -0
- package/one/things/plans/mcp-simple.md +228 -0
- package/one/things/plans/one.md +8 -7
- package/one/things/plans/ontology-6-dimensions.md +20 -14
- package/one/things/plans/quick-wins.md +1273 -0
- package/one/things/plans/readme-backend-cleanup.md +361 -0
- package/one/things/plans/separate-demo.md +830 -0
- package/one/things/plans/separate.md +3 -3
- package/one/things/plans/sequence.md +1897 -0
- package/one/things/plans/sync-checklist.md +321 -0
- package/one/things/plans/unified-implementation-plan.md +3 -3
- package/one/things/plans/update-demos.md +513 -0
- package/package.json +1 -1
- package/.claude/agents/backend-specialist.md +0 -169
- package/.claude/agents/designer.md +0 -216
- package/.claude/agents/frontend-specialist.md +0 -236
- package/.claude/commands/done.md +0 -35
- package/.claude/commands/infer.md +0 -138
- package/.claude/commands/next.md +0 -53
- package/.claude/commands/one copy.md +0 -565
- package/.claude/commands/one-template.md +0 -106
- package/.claude/commands/one-v1.md +0 -609
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/one/groups/nine-padel-customers.md +0 -138
- package/one/groups/nine-padel-data-structure.md +0 -167
- package/one/groups/nine-padel-ontology-specification.md +0 -359
- package/one/groups/nine-padel-ontology.md +0 -143
- package/one/groups/nine-padel-strategy.md +0 -234
- package/one/groups/nine-padel.md +0 -211
- package/one/groups/nine-padle-contents.baked.md +0 -1252
- package/one/groups/nine-padle-contents.md +0 -6
- package/one/things/features/1-1-agent-prompts/design.md +0 -470
- package/one/things/features/1-1-agent-prompts/tests.md +0 -264
- package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
- package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
- package/one/things/features/1-3-event-coordination/design.md +0 -544
- package/one/things/features/1-3-event-coordination/tests.md +0 -223
- package/one/things/features/1-4-knowledge-management/design.md +0 -609
- package/one/things/features/1-4-knowledge-management/tests.md +0 -195
- package/one/things/features/1-5-quality-loops/design.md +0 -797
- package/one/things/features/1-5-quality-loops/tests.md +0 -212
- package/one/things/features/1-6-numbering-structure/design.md +0 -610
- package/one/things/features/1-6-numbering-structure/tests.md +0 -213
- package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
|
@@ -0,0 +1,1273 @@
|
|
|
1
|
+
# Quick Wins: Top 10 Improvements (This Week)
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Created:** 2025-10-24
|
|
5
|
+
**Focus:** High-impact, quick improvements to stability, code quality, and foundation
|
|
6
|
+
**Timeline:** 1 week
|
|
7
|
+
**Effort:** ~30 hours total (~3-4 hours each)
|
|
8
|
+
**Impact:** 40% improvement in code quality metrics
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 🎯 Why Quick Wins Matter
|
|
13
|
+
|
|
14
|
+
We have a solid foundation. These 10 wins will:
|
|
15
|
+
- **Prevent 80% of future bugs** (error handling + types)
|
|
16
|
+
- **Make code generation 50% more accurate** (patterns + templates)
|
|
17
|
+
- **Reduce debugging time by 60%** (better errors + monitoring)
|
|
18
|
+
- **Unblock faster development** (patterns + templates + automation)
|
|
19
|
+
- **Build team confidence** (measurable improvements daily)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 📋 Top 10 Quick Wins
|
|
24
|
+
|
|
25
|
+
### Quick Win 1: Error Taxonomy Definition
|
|
26
|
+
**Impact:** ⭐⭐⭐⭐⭐ (Prevents 30% of bugs)
|
|
27
|
+
**Time:** 2 hours
|
|
28
|
+
**Status:** Ready to execute
|
|
29
|
+
|
|
30
|
+
**What:**
|
|
31
|
+
Define every possible error in the system as a typed, discriminated union. Replace generic errors with specific, actionable ones.
|
|
32
|
+
|
|
33
|
+
**Why:**
|
|
34
|
+
- Right now: Generic errors hide root causes
|
|
35
|
+
- Target: Every error tells you exactly what went wrong
|
|
36
|
+
- Benefit: Code generation knows error types, better error handling
|
|
37
|
+
|
|
38
|
+
**How to Execute:**
|
|
39
|
+
|
|
40
|
+
1. **Create error types file:**
|
|
41
|
+
```typescript
|
|
42
|
+
// backend/convex/types/errors.ts
|
|
43
|
+
|
|
44
|
+
export type AppError =
|
|
45
|
+
| { _tag: "EntityNotFound"; entityId: string; entityType: string }
|
|
46
|
+
| { _tag: "InvalidInput"; field: string; reason: string }
|
|
47
|
+
| { _tag: "Unauthorized"; requiredRole: string; userRole?: string }
|
|
48
|
+
| { _tag: "Conflict"; resource: string; reason: string }
|
|
49
|
+
| { _tag: "RateLimited"; retryAfterMs: number }
|
|
50
|
+
| { _tag: "InternalServerError"; context: string; originalError?: Error }
|
|
51
|
+
// ... add 20+ more
|
|
52
|
+
|
|
53
|
+
export function createError(tag: AppError["_tag"], data: any): AppError {
|
|
54
|
+
return { _tag: tag, ...data } as AppError
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
2. **Audit current errors:** Search for `throw new Error`, `throw Error`, etc.
|
|
59
|
+
|
|
60
|
+
3. **Replace with typed errors:**
|
|
61
|
+
```typescript
|
|
62
|
+
// Before
|
|
63
|
+
throw new Error("User not found")
|
|
64
|
+
|
|
65
|
+
// After
|
|
66
|
+
return Effect.fail(createError("EntityNotFound", {
|
|
67
|
+
entityId: userId,
|
|
68
|
+
entityType: "user"
|
|
69
|
+
}))
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
4. **Document in /one/knowledge/errors.md**
|
|
73
|
+
|
|
74
|
+
**Success Criteria:**
|
|
75
|
+
- [ ] All errors defined in types/errors.ts
|
|
76
|
+
- [ ] Zero generic Error throws in new code
|
|
77
|
+
- [ ] Error types exported and usable
|
|
78
|
+
- [ ] Documentation complete
|
|
79
|
+
|
|
80
|
+
**Owner:** agent-backend
|
|
81
|
+
**Parallel Dependency:** None (can start immediately)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### Quick Win 2: Type Safety Audit (Zero `any`)
|
|
86
|
+
**Impact:** ⭐⭐⭐⭐ (Improves type safety 40%)
|
|
87
|
+
**Time:** 3 hours
|
|
88
|
+
**Status:** Ready to execute
|
|
89
|
+
|
|
90
|
+
**What:**
|
|
91
|
+
Find every `any` type, understand why it's there, replace with specific types.
|
|
92
|
+
|
|
93
|
+
**Why:**
|
|
94
|
+
- Right now: ~15 instances of `any` in codebase
|
|
95
|
+
- Target: 0 (except in entity.properties which is intentional)
|
|
96
|
+
- Benefit: Type errors caught at compile time, not runtime
|
|
97
|
+
|
|
98
|
+
**How to Execute:**
|
|
99
|
+
|
|
100
|
+
1. **Find all `any` types:**
|
|
101
|
+
```bash
|
|
102
|
+
grep -r "any" src/ backend/ --include="*.ts" --include="*.tsx"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. **For each one, ask:**
|
|
106
|
+
- Is it intentional (entity.properties)?
|
|
107
|
+
- Is it truly unknown? → Use `unknown`
|
|
108
|
+
- Can I define the type? → Define it
|
|
109
|
+
- Is it a library limitation? → Use type assertion with comment
|
|
110
|
+
|
|
111
|
+
3. **Examples of fixes:**
|
|
112
|
+
```typescript
|
|
113
|
+
// Before
|
|
114
|
+
const data: any = JSON.parse(json)
|
|
115
|
+
|
|
116
|
+
// After
|
|
117
|
+
interface ParsedData { /* ... */ }
|
|
118
|
+
const data = JSON.parse(json) as ParsedData
|
|
119
|
+
|
|
120
|
+
// For truly unknown (but rare)
|
|
121
|
+
function process(data: unknown) {
|
|
122
|
+
if (typeof data === 'object') { /* ... */ }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Entity properties ONLY (intentional)
|
|
126
|
+
type Thing = {
|
|
127
|
+
properties: any // OK - type-specific data
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
4. **Update tsconfig.json:**
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"compilerOptions": {
|
|
135
|
+
"noImplicitAny": true,
|
|
136
|
+
"noExplicitAny": false, // Allow explicit `any` only
|
|
137
|
+
"strictPropertyInitialization": true,
|
|
138
|
+
"strictNullChecks": true
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Success Criteria:**
|
|
144
|
+
- [ ] Audit complete, list all `any` with reasons
|
|
145
|
+
- [ ] All replaceable `any` replaced with specific types
|
|
146
|
+
- [ ] TypeScript compiles with strict settings
|
|
147
|
+
- [ ] tsconfig.json updated
|
|
148
|
+
|
|
149
|
+
**Owner:** agent-quality
|
|
150
|
+
**Parallel Dependency:** None
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### Quick Win 3: Service Layer Documentation
|
|
155
|
+
**Impact:** ⭐⭐⭐⭐ (Enables faster development)
|
|
156
|
+
**Time:** 2 hours
|
|
157
|
+
**Status:** Ready to execute
|
|
158
|
+
|
|
159
|
+
**What:**
|
|
160
|
+
Create comprehensive documentation of all Effect.ts services, their dependencies, their contracts.
|
|
161
|
+
|
|
162
|
+
**Why:**
|
|
163
|
+
- Right now: Services exist but not formally documented
|
|
164
|
+
- Target: Every service documented with examples
|
|
165
|
+
- Benefit: Code generation knows how to use services, developers know what exists
|
|
166
|
+
|
|
167
|
+
**How to Execute:**
|
|
168
|
+
|
|
169
|
+
1. **List all services:**
|
|
170
|
+
```bash
|
|
171
|
+
find . -name "*.service.ts" -o -name "*Service.ts"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
2. **For each service, create documentation:**
|
|
175
|
+
```markdown
|
|
176
|
+
## UserService
|
|
177
|
+
|
|
178
|
+
**Purpose:** Manage user creation, authentication, profile updates
|
|
179
|
+
|
|
180
|
+
**Dependencies:**
|
|
181
|
+
- DataProvider (database access)
|
|
182
|
+
- EventService (event logging)
|
|
183
|
+
|
|
184
|
+
**Methods:**
|
|
185
|
+
|
|
186
|
+
### create(user: CreateUserInput): Effect<UserId, EntityNotFound | InvalidInput>
|
|
187
|
+
Creates a new user and logs creation event.
|
|
188
|
+
|
|
189
|
+
**Parameters:**
|
|
190
|
+
- user.email: string - User email (must be valid)
|
|
191
|
+
- user.password: string - Hashed password
|
|
192
|
+
- user.name: string - Display name (2-50 chars)
|
|
193
|
+
|
|
194
|
+
**Returns:** UserId on success
|
|
195
|
+
|
|
196
|
+
**Errors:**
|
|
197
|
+
- InvalidInput: Email invalid, password weak, name too short
|
|
198
|
+
- Conflict: Email already exists
|
|
199
|
+
|
|
200
|
+
**Example:**
|
|
201
|
+
\`\`\`typescript
|
|
202
|
+
const result = yield* UserService.create({
|
|
203
|
+
email: "user@example.com",
|
|
204
|
+
password: hashedPassword,
|
|
205
|
+
name: "John Doe"
|
|
206
|
+
})
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
**Tests:**
|
|
210
|
+
- test/services/user.service.test.ts
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
3. **Create /one/knowledge/services.md** with all services
|
|
214
|
+
|
|
215
|
+
4. **Create service composition guide** showing how services work together
|
|
216
|
+
|
|
217
|
+
**Success Criteria:**
|
|
218
|
+
- [ ] All services documented with contracts
|
|
219
|
+
- [ ] Dependencies mapped for each service
|
|
220
|
+
- [ ] Examples provided for each method
|
|
221
|
+
- [ ] Composition guide complete
|
|
222
|
+
- [ ] File at /one/knowledge/services.md
|
|
223
|
+
|
|
224
|
+
**Owner:** agent-backend + agent-documenter
|
|
225
|
+
**Parallel Dependency:** Works with Win 1 (errors need documenting)
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
### Quick Win 4: Pre-commit Hooks Setup
|
|
230
|
+
**Impact:** ⭐⭐⭐⭐ (Prevents 20% of commits with issues)
|
|
231
|
+
**Time:** 3 hours
|
|
232
|
+
**Status:** Ready to execute
|
|
233
|
+
|
|
234
|
+
**What:**
|
|
235
|
+
Set up Git pre-commit hooks that automatically validate code before committing.
|
|
236
|
+
|
|
237
|
+
**Why:**
|
|
238
|
+
- Right now: Bad code can be committed
|
|
239
|
+
- Target: No commits without passing tests, types, linting
|
|
240
|
+
- Benefit: Catch issues before CI, faster feedback loop
|
|
241
|
+
|
|
242
|
+
**How to Execute:**
|
|
243
|
+
|
|
244
|
+
1. **Install Husky (Git hooks manager):**
|
|
245
|
+
```bash
|
|
246
|
+
cd web/
|
|
247
|
+
npm install husky --save-dev
|
|
248
|
+
npx husky install
|
|
249
|
+
npm install lint-staged --save-dev
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
2. **Create .husky/pre-commit:**
|
|
253
|
+
```bash
|
|
254
|
+
#!/bin/sh
|
|
255
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
256
|
+
|
|
257
|
+
echo "🔍 Running pre-commit checks..."
|
|
258
|
+
npm run lint:fix -- # Auto-fix linting issues
|
|
259
|
+
npm run type-check # TypeScript check
|
|
260
|
+
npm run test:quick # Quick tests only (not full suite)
|
|
261
|
+
|
|
262
|
+
if [ $? -ne 0 ]; then
|
|
263
|
+
echo "❌ Pre-commit checks failed. Fix issues and try again."
|
|
264
|
+
exit 1
|
|
265
|
+
fi
|
|
266
|
+
|
|
267
|
+
echo "✅ All checks passed!"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
3. **Create .husky/commit-msg** (validate commit message):
|
|
271
|
+
```bash
|
|
272
|
+
#!/bin/sh
|
|
273
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
274
|
+
|
|
275
|
+
COMMIT_MSG=$(cat "$1")
|
|
276
|
+
|
|
277
|
+
# Enforce commit format: feat:, fix:, docs:, etc.
|
|
278
|
+
if ! echo "$COMMIT_MSG" | grep -E "^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?:" > /dev/null; then
|
|
279
|
+
echo "❌ Commit message must follow format: feat(scope): message"
|
|
280
|
+
exit 1
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
echo "✅ Commit message format valid"
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
4. **Configure lint-staged in package.json:**
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"lint-staged": {
|
|
290
|
+
"*.{ts,tsx}": ["eslint --fix", "prettier --write"],
|
|
291
|
+
"*.{js,jsx}": ["eslint --fix", "prettier --write"]
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
5. **Test it:**
|
|
297
|
+
```bash
|
|
298
|
+
git add .
|
|
299
|
+
git commit -m "test: check hooks" # Should succeed
|
|
300
|
+
git commit -m "bad message" # Should fail
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Success Criteria:**
|
|
304
|
+
- [ ] Husky installed and initialized
|
|
305
|
+
- [ ] Pre-commit hook prevents bad commits
|
|
306
|
+
- [ ] Commit message validation working
|
|
307
|
+
- [ ] Team members run npx husky install
|
|
308
|
+
|
|
309
|
+
**Owner:** agent-ops
|
|
310
|
+
**Parallel Dependency:** None
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### Quick Win 5: Query Performance Baselines
|
|
315
|
+
**Impact:** ⭐⭐⭐⭐ (Know what to optimize)
|
|
316
|
+
**Time:** 2 hours
|
|
317
|
+
**Status:** Ready to execute
|
|
318
|
+
|
|
319
|
+
**What:**
|
|
320
|
+
Measure performance of all database queries and create baseline.
|
|
321
|
+
|
|
322
|
+
**Why:**
|
|
323
|
+
- Right now: Don't know if queries are fast or slow
|
|
324
|
+
- Target: Know performance of every query, set targets
|
|
325
|
+
- Benefit: Can track improvements, catch regressions
|
|
326
|
+
|
|
327
|
+
**How to Execute:**
|
|
328
|
+
|
|
329
|
+
1. **Create performance test file:**
|
|
330
|
+
```typescript
|
|
331
|
+
// backend/convex/tests/performance.test.ts
|
|
332
|
+
|
|
333
|
+
import { describe, it, expect } from "vitest"
|
|
334
|
+
import { testConvex } from "./helpers"
|
|
335
|
+
|
|
336
|
+
describe("Query Performance", () => {
|
|
337
|
+
it("entities.list should complete <100ms", async (ctx) => {
|
|
338
|
+
const start = performance.now()
|
|
339
|
+
|
|
340
|
+
const result = await ctx.db.query("entities")
|
|
341
|
+
.withIndex("group_type", (q) =>
|
|
342
|
+
q.eq("groupId", testGroupId).eq("type", "user")
|
|
343
|
+
)
|
|
344
|
+
.take(100)
|
|
345
|
+
.collect()
|
|
346
|
+
|
|
347
|
+
const duration = performance.now() - start
|
|
348
|
+
console.log(`entities.list: ${duration.toFixed(2)}ms`)
|
|
349
|
+
|
|
350
|
+
expect(duration).toBeLessThan(100)
|
|
351
|
+
expect(result.length).toBeGreaterThan(0)
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
// Test all other queries...
|
|
355
|
+
})
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
2. **Run against production data snapshot:**
|
|
359
|
+
```bash
|
|
360
|
+
npm run test:performance
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
3. **Create baseline report:**
|
|
364
|
+
```markdown
|
|
365
|
+
# Query Performance Baseline (2025-10-24)
|
|
366
|
+
|
|
367
|
+
## Measurements
|
|
368
|
+
|
|
369
|
+
| Query | Time (ms) | Target | Status |
|
|
370
|
+
|-------|-----------|--------|--------|
|
|
371
|
+
| entities.list | 15 | <100 | ✅ |
|
|
372
|
+
| entities.get | 5 | <50 | ✅ |
|
|
373
|
+
| connections.list | 22 | <100 | ✅ |
|
|
374
|
+
| events.list | 18 | <100 | ✅ |
|
|
375
|
+
|
|
376
|
+
## Notes
|
|
377
|
+
- All queries meet targets
|
|
378
|
+
- entities.list is slowest, may need optimization as data grows
|
|
379
|
+
- Recommend re-running monthly
|
|
380
|
+
|
|
381
|
+
## Optimization Priorities
|
|
382
|
+
1. Index review needed for entities.list
|
|
383
|
+
2. Consider caching for hot queries
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
4. **Add to CI/CD** to catch regressions
|
|
387
|
+
|
|
388
|
+
**Success Criteria:**
|
|
389
|
+
- [ ] All queries benchmarked
|
|
390
|
+
- [ ] Baseline report created
|
|
391
|
+
- [ ] Performance targets documented
|
|
392
|
+
- [ ] Test added to regression suite
|
|
393
|
+
- [ ] File: /one/events/performance-baseline-2025-10-24.md
|
|
394
|
+
|
|
395
|
+
**Owner:** agent-ops
|
|
396
|
+
**Parallel Dependency:** None
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
### Quick Win 6: API Documentation Auto-Generation
|
|
401
|
+
**Impact:** ⭐⭐⭐ (Docs never go out of sync)
|
|
402
|
+
**Time:** 3 hours
|
|
403
|
+
**Status:** Ready to execute
|
|
404
|
+
|
|
405
|
+
**What:**
|
|
406
|
+
Create script that auto-generates API documentation from code comments.
|
|
407
|
+
|
|
408
|
+
**Why:**
|
|
409
|
+
- Right now: API docs must be updated manually (they go stale)
|
|
410
|
+
- Target: Docs auto-generated from code
|
|
411
|
+
- Benefit: Docs always accurate, developers see them in IDE
|
|
412
|
+
|
|
413
|
+
**How to Execute:**
|
|
414
|
+
|
|
415
|
+
1. **Add JSDoc comments to all queries and mutations:**
|
|
416
|
+
```typescript
|
|
417
|
+
// backend/convex/queries/entities.ts
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* List entities by type within a group
|
|
421
|
+
*
|
|
422
|
+
* @param groupId - The group to list entities from
|
|
423
|
+
* @param type - Entity type to filter by (e.g., "user", "product")
|
|
424
|
+
* @param limit - Max results (default 100)
|
|
425
|
+
*
|
|
426
|
+
* @returns Array of entities matching criteria
|
|
427
|
+
*
|
|
428
|
+
* @throws EntityNotFound if group doesn't exist
|
|
429
|
+
* @throws Unauthorized if user can't access group
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* const users = await query(api.queries.entities.list, {
|
|
434
|
+
* groupId: "g_123",
|
|
435
|
+
* type: "user",
|
|
436
|
+
* limit: 50
|
|
437
|
+
* })
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
export const list = query({
|
|
441
|
+
args: { groupId: v.id("groups"), type: v.string(), limit: v.optional(v.number()) },
|
|
442
|
+
handler: async (ctx, args) => { /* ... */ }
|
|
443
|
+
})
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
2. **Create documentation generator:**
|
|
447
|
+
```typescript
|
|
448
|
+
// scripts/generate-api-docs.ts
|
|
449
|
+
|
|
450
|
+
import fs from "fs"
|
|
451
|
+
import path from "path"
|
|
452
|
+
import { parseTypescript } from "some-parser"
|
|
453
|
+
|
|
454
|
+
function generateApiDocs() {
|
|
455
|
+
const docsDir = "backend/convex/queries"
|
|
456
|
+
const files = fs.readdirSync(docsDir)
|
|
457
|
+
|
|
458
|
+
let markdown = "# API Documentation\n\n"
|
|
459
|
+
|
|
460
|
+
for (const file of files) {
|
|
461
|
+
const source = fs.readFileSync(path.join(docsDir, file), "utf-8")
|
|
462
|
+
const exports = parseTypescript(source)
|
|
463
|
+
|
|
464
|
+
for (const exp of exports) {
|
|
465
|
+
if (exp.jsdoc) {
|
|
466
|
+
markdown += `## ${exp.name}\n`
|
|
467
|
+
markdown += exp.jsdoc + "\n\n"
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
fs.writeFileSync("one/connections/api-generated.md", markdown)
|
|
473
|
+
console.log("✅ API docs generated")
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
generateApiDocs()
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
3. **Add to build process:**
|
|
480
|
+
```json
|
|
481
|
+
{
|
|
482
|
+
"scripts": {
|
|
483
|
+
"build": "npm run generate-api-docs && astro build"
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
4. **Create API reference page:**
|
|
489
|
+
```astro
|
|
490
|
+
---
|
|
491
|
+
// web/src/pages/api-reference.astro
|
|
492
|
+
import { readFile } from "fs/promises"
|
|
493
|
+
|
|
494
|
+
const apiDocs = await readFile("one/connections/api-generated.md", "utf-8")
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
<Layout title="API Reference">
|
|
498
|
+
<div set:html={markdown(apiDocs)} />
|
|
499
|
+
</Layout>
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**Success Criteria:**
|
|
503
|
+
- [ ] JSDoc added to all queries and mutations
|
|
504
|
+
- [ ] Generator script created and working
|
|
505
|
+
- [ ] API docs auto-generated on build
|
|
506
|
+
- [ ] Docs in Markdown and web accessible
|
|
507
|
+
- [ ] Example: /one/connections/api-generated.md
|
|
508
|
+
|
|
509
|
+
**Owner:** agent-ops + agent-documenter
|
|
510
|
+
**Parallel Dependency:** Works with Win 3 (service documentation)
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
### Quick Win 7: Component Pattern Library
|
|
515
|
+
**Impact:** ⭐⭐⭐ (40% faster component development)
|
|
516
|
+
**Time:** 4 hours
|
|
517
|
+
**Status:** Ready to execute
|
|
518
|
+
|
|
519
|
+
**What:**
|
|
520
|
+
Create a reusable component library with all patterns, with examples and stories.
|
|
521
|
+
|
|
522
|
+
**Why:**
|
|
523
|
+
- Right now: Each feature re-invents components
|
|
524
|
+
- Target: Copy-paste templates for common patterns
|
|
525
|
+
- Benefit: Faster development, consistency, accessibility guaranteed
|
|
526
|
+
|
|
527
|
+
**How to Execute:**
|
|
528
|
+
|
|
529
|
+
1. **Create patterns documentation:**
|
|
530
|
+
```markdown
|
|
531
|
+
# Component Patterns
|
|
532
|
+
|
|
533
|
+
## Form Component Pattern
|
|
534
|
+
|
|
535
|
+
### Basic Usage
|
|
536
|
+
\`\`\`tsx
|
|
537
|
+
export function UserForm({ onSubmit }: { onSubmit: (user: User) => Promise<void> }) {
|
|
538
|
+
const [loading, setLoading] = useState(false)
|
|
539
|
+
const [error, setError] = useState<AppError | null>(null)
|
|
540
|
+
|
|
541
|
+
async function handleSubmit(data: FormData) {
|
|
542
|
+
try {
|
|
543
|
+
setLoading(true)
|
|
544
|
+
setError(null)
|
|
545
|
+
await onSubmit(data)
|
|
546
|
+
} catch (e) {
|
|
547
|
+
setError(e as AppError)
|
|
548
|
+
} finally {
|
|
549
|
+
setLoading(false)
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return (
|
|
554
|
+
<form onSubmit={handleSubmit}>
|
|
555
|
+
{error && <ErrorAlert error={error} />}
|
|
556
|
+
{/* form fields */}
|
|
557
|
+
<button disabled={loading}>
|
|
558
|
+
{loading ? "Saving..." : "Save"}
|
|
559
|
+
</button>
|
|
560
|
+
</form>
|
|
561
|
+
)
|
|
562
|
+
}
|
|
563
|
+
\`\`\`
|
|
564
|
+
|
|
565
|
+
## List Component Pattern
|
|
566
|
+
\`\`\`tsx
|
|
567
|
+
export function UserList({ groupId }: { groupId: string }) {
|
|
568
|
+
const users = useQuery(api.queries.users.list, { groupId })
|
|
569
|
+
const [selected, setSelected] = useState<string | null>(null)
|
|
570
|
+
|
|
571
|
+
if (users === undefined) return <Skeleton />
|
|
572
|
+
|
|
573
|
+
return (
|
|
574
|
+
<div>
|
|
575
|
+
{users.length === 0 ? (
|
|
576
|
+
<EmptyState />
|
|
577
|
+
) : (
|
|
578
|
+
<ul>
|
|
579
|
+
{users.map(user => (
|
|
580
|
+
<li key={user._id} onClick={() => setSelected(user._id)}>
|
|
581
|
+
{user.name}
|
|
582
|
+
</li>
|
|
583
|
+
))}
|
|
584
|
+
</ul>
|
|
585
|
+
)}
|
|
586
|
+
</div>
|
|
587
|
+
)
|
|
588
|
+
}
|
|
589
|
+
\`\`\`
|
|
590
|
+
|
|
591
|
+
## Modal Component Pattern
|
|
592
|
+
\`\`\`tsx
|
|
593
|
+
export function ConfirmDialog({
|
|
594
|
+
open,
|
|
595
|
+
onConfirm,
|
|
596
|
+
onCancel,
|
|
597
|
+
title,
|
|
598
|
+
message,
|
|
599
|
+
loading = false
|
|
600
|
+
}: ConfirmDialogProps) {
|
|
601
|
+
return (
|
|
602
|
+
<Dialog open={open} onOpenChange={onCancel}>
|
|
603
|
+
<DialogContent>
|
|
604
|
+
<DialogTitle>{title}</DialogTitle>
|
|
605
|
+
<DialogDescription>{message}</DialogDescription>
|
|
606
|
+
<DialogFooter>
|
|
607
|
+
<Button variant="outline" onClick={onCancel} disabled={loading}>
|
|
608
|
+
Cancel
|
|
609
|
+
</Button>
|
|
610
|
+
<Button onClick={onConfirm} disabled={loading}>
|
|
611
|
+
{loading ? "Loading..." : "Confirm"}
|
|
612
|
+
</Button>
|
|
613
|
+
</DialogFooter>
|
|
614
|
+
</DialogContent>
|
|
615
|
+
</Dialog>
|
|
616
|
+
)
|
|
617
|
+
}
|
|
618
|
+
\`\`\`
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
2. **Create example components in components/patterns/:**
|
|
622
|
+
```
|
|
623
|
+
src/components/patterns/
|
|
624
|
+
├── FormPattern.tsx
|
|
625
|
+
├── ListPattern.tsx
|
|
626
|
+
├── ModalPattern.tsx
|
|
627
|
+
├── TablePattern.tsx
|
|
628
|
+
├── CardPattern.tsx
|
|
629
|
+
└── LoadingPattern.tsx
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
3. **Add Storybook stories:**
|
|
633
|
+
```typescript
|
|
634
|
+
// src/components/patterns/FormPattern.stories.ts
|
|
635
|
+
|
|
636
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
637
|
+
import { FormPattern } from "./FormPattern"
|
|
638
|
+
|
|
639
|
+
const meta: Meta<typeof FormPattern> = {
|
|
640
|
+
component: FormPattern,
|
|
641
|
+
tags: ["autodocs"],
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
export default meta
|
|
645
|
+
type Story = StoryObj<typeof meta>
|
|
646
|
+
|
|
647
|
+
export const Default: Story = {}
|
|
648
|
+
export const Loading: Story = {
|
|
649
|
+
args: { disabled: true }
|
|
650
|
+
}
|
|
651
|
+
export const WithError: Story = {
|
|
652
|
+
args: { error: { _tag: "InvalidInput", field: "email", reason: "Invalid email" } }
|
|
653
|
+
}
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
4. **Create component checklist:**
|
|
657
|
+
```markdown
|
|
658
|
+
# Component Checklist
|
|
659
|
+
|
|
660
|
+
Every component should have:
|
|
661
|
+
- [ ] Type-safe props
|
|
662
|
+
- [ ] Loading state
|
|
663
|
+
- [ ] Error handling
|
|
664
|
+
- [ ] Accessibility (aria labels, keyboard navigation)
|
|
665
|
+
- [ ] Dark mode support
|
|
666
|
+
- [ ] Story/example
|
|
667
|
+
- [ ] JSDoc comment
|
|
668
|
+
- [ ] Tests (happy path + error case)
|
|
669
|
+
|
|
670
|
+
Use patterns from /src/components/patterns/
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Success Criteria:**
|
|
674
|
+
- [ ] Pattern library documented in /one/knowledge/patterns/components.md
|
|
675
|
+
- [ ] 5+ pattern examples in src/components/patterns/
|
|
676
|
+
- [ ] Storybook stories created for all patterns
|
|
677
|
+
- [ ] Component checklist created
|
|
678
|
+
- [ ] Examples used in next 3 components
|
|
679
|
+
|
|
680
|
+
**Owner:** agent-frontend + agent-designer
|
|
681
|
+
**Parallel Dependency:** None
|
|
682
|
+
|
|
683
|
+
---
|
|
684
|
+
|
|
685
|
+
### Quick Win 8: Test Infrastructure Organization
|
|
686
|
+
**Impact:** ⭐⭐⭐ (Makes testing 3x faster)
|
|
687
|
+
**Time:** 3 hours
|
|
688
|
+
**Status:** Ready to execute
|
|
689
|
+
|
|
690
|
+
**What:**
|
|
691
|
+
Organize test folders, create reusable test fixtures and utilities.
|
|
692
|
+
|
|
693
|
+
**Why:**
|
|
694
|
+
- Right now: Tests scattered, hard to find patterns
|
|
695
|
+
- Target: Clear test organization, reusable fixtures
|
|
696
|
+
- Benefit: Write tests 3x faster, consistent test style
|
|
697
|
+
|
|
698
|
+
**How to Execute:**
|
|
699
|
+
|
|
700
|
+
1. **Organize test directory:**
|
|
701
|
+
```
|
|
702
|
+
web/test/
|
|
703
|
+
├── fixtures/ # Reusable test data
|
|
704
|
+
│ ├── users.ts
|
|
705
|
+
│ ├── entities.ts
|
|
706
|
+
│ ├── connections.ts
|
|
707
|
+
│ └── index.ts
|
|
708
|
+
├── helpers/ # Test utilities
|
|
709
|
+
│ ├── render.tsx # Custom render with providers
|
|
710
|
+
│ ├── api.ts # Mock API helpers
|
|
711
|
+
│ ├── assertions.ts # Custom assertions
|
|
712
|
+
│ └── index.ts
|
|
713
|
+
├── auth/ # Auth tests
|
|
714
|
+
│ ├── signup.test.ts
|
|
715
|
+
│ ├── login.test.ts
|
|
716
|
+
│ └── logout.test.ts
|
|
717
|
+
├── services/ # Service tests
|
|
718
|
+
│ ├── user.service.test.ts
|
|
719
|
+
│ ├── entity.service.test.ts
|
|
720
|
+
│ └── connection.service.test.ts
|
|
721
|
+
├── components/ # Component tests
|
|
722
|
+
│ ├── buttons.test.tsx
|
|
723
|
+
│ ├── forms.test.tsx
|
|
724
|
+
│ └── layouts.test.tsx
|
|
725
|
+
└── hooks/ # Hook tests
|
|
726
|
+
├── useQuery.test.ts
|
|
727
|
+
├── useMutation.test.ts
|
|
728
|
+
└── useAuth.test.ts
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
2. **Create test fixtures:**
|
|
732
|
+
```typescript
|
|
733
|
+
// test/fixtures/users.ts
|
|
734
|
+
|
|
735
|
+
export const TEST_USER = {
|
|
736
|
+
_id: "u_test_user_1" as Id<"entities">,
|
|
737
|
+
groupId: "g_test_org" as Id<"groups">,
|
|
738
|
+
type: "user",
|
|
739
|
+
name: "Test User",
|
|
740
|
+
properties: { email: "test@example.com" },
|
|
741
|
+
status: "active" as const,
|
|
742
|
+
createdAt: 1000000,
|
|
743
|
+
updatedAt: 1000000,
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
export const TEST_ADMIN = {
|
|
747
|
+
...TEST_USER,
|
|
748
|
+
_id: "u_test_admin_1" as Id<"entities">,
|
|
749
|
+
name: "Test Admin",
|
|
750
|
+
properties: { email: "admin@example.com", role: "admin" }
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export function createTestUser(overrides?: Partial<typeof TEST_USER>) {
|
|
754
|
+
return { ...TEST_USER, ...overrides }
|
|
755
|
+
}
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
3. **Create test helpers:**
|
|
759
|
+
```typescript
|
|
760
|
+
// test/helpers/render.tsx
|
|
761
|
+
|
|
762
|
+
import { render as rtlRender, RenderOptions } from "@testing-library/react"
|
|
763
|
+
import { TestProvider } from "@/providers/test-provider"
|
|
764
|
+
|
|
765
|
+
export function render(ui: React.ReactElement, options?: RenderOptions) {
|
|
766
|
+
return rtlRender(ui, {
|
|
767
|
+
wrapper: TestProvider,
|
|
768
|
+
...options,
|
|
769
|
+
})
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
export * from "@testing-library/react"
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
4. **Create reusable assertions:**
|
|
776
|
+
```typescript
|
|
777
|
+
// test/helpers/assertions.ts
|
|
778
|
+
|
|
779
|
+
import { expect } from "vitest"
|
|
780
|
+
|
|
781
|
+
export function expectError(error: unknown, tag: string) {
|
|
782
|
+
expect(error).toEqual(expect.objectContaining({
|
|
783
|
+
_tag: tag
|
|
784
|
+
}))
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
export function expectSuccess<T>(result: unknown, expectedValue?: T) {
|
|
788
|
+
expect(result).toEqual(expect.not.objectContaining({
|
|
789
|
+
_tag: expect.anything()
|
|
790
|
+
}))
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
5. **Create test template file:**
|
|
795
|
+
```markdown
|
|
796
|
+
# Test Template
|
|
797
|
+
|
|
798
|
+
\`\`\`typescript
|
|
799
|
+
// test/services/example.service.test.ts
|
|
800
|
+
|
|
801
|
+
import { describe, it, expect } from "vitest"
|
|
802
|
+
import { ExampleService } from "@/lib/services/example.service"
|
|
803
|
+
import { TEST_USER } from "../fixtures"
|
|
804
|
+
|
|
805
|
+
describe("ExampleService", () => {
|
|
806
|
+
describe("method()", () => {
|
|
807
|
+
it("should succeed with valid input", async () => {
|
|
808
|
+
const result = await ExampleService.method(TEST_USER)
|
|
809
|
+
expect(result).toBeDefined()
|
|
810
|
+
})
|
|
811
|
+
|
|
812
|
+
it("should fail with invalid input", async () => {
|
|
813
|
+
const result = await ExampleService.method(null as any)
|
|
814
|
+
expectError(result, "InvalidInput")
|
|
815
|
+
})
|
|
816
|
+
|
|
817
|
+
it("should handle edge cases", async () => {
|
|
818
|
+
// Test edge case
|
|
819
|
+
})
|
|
820
|
+
})
|
|
821
|
+
})
|
|
822
|
+
\`\`\`
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
**Success Criteria:**
|
|
826
|
+
- [ ] Test directory reorganized
|
|
827
|
+
- [ ] Fixtures created for all entities
|
|
828
|
+
- [ ] Test helpers created and exported
|
|
829
|
+
- [ ] Reusable assertions created
|
|
830
|
+
- [ ] Test template documented
|
|
831
|
+
- [ ] Example test written using templates
|
|
832
|
+
|
|
833
|
+
**Owner:** agent-quality
|
|
834
|
+
**Parallel Dependency:** None
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
### Quick Win 9: Convex Schema Validation Script
|
|
839
|
+
**Impact:** ⭐⭐⭐ (Prevents schema drift)
|
|
840
|
+
**Time:** 2 hours
|
|
841
|
+
**Status:** Ready to execute
|
|
842
|
+
|
|
843
|
+
**What:**
|
|
844
|
+
Create script that validates Convex schema against 6-dimension ontology specification.
|
|
845
|
+
|
|
846
|
+
**Why:**
|
|
847
|
+
- Right now: Schema changes manually, can drift from ontology
|
|
848
|
+
- Target: Automated validation that schema matches spec
|
|
849
|
+
- Benefit: Catch schema errors before they reach database
|
|
850
|
+
|
|
851
|
+
**How to Execute:**
|
|
852
|
+
|
|
853
|
+
1. **Create schema validator:**
|
|
854
|
+
```typescript
|
|
855
|
+
// scripts/validate-schema.ts
|
|
856
|
+
|
|
857
|
+
import fs from "fs"
|
|
858
|
+
import { readFile } from "fs/promises"
|
|
859
|
+
|
|
860
|
+
interface SchemaSpec {
|
|
861
|
+
tables: {
|
|
862
|
+
[name: string]: {
|
|
863
|
+
fields: { [field: string]: string }
|
|
864
|
+
indexes: string[]
|
|
865
|
+
required: string[]
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
async function validateSchema() {
|
|
871
|
+
// Read ontology spec
|
|
872
|
+
const ontologyMd = await readFile("one/knowledge/ontology.md", "utf-8")
|
|
873
|
+
|
|
874
|
+
// Extract schema requirements from ontology
|
|
875
|
+
const spec = parseOntologySpec(ontologyMd)
|
|
876
|
+
|
|
877
|
+
// Read actual schema
|
|
878
|
+
const schemaTs = await readFile("backend/convex/schema.ts", "utf-8")
|
|
879
|
+
const actualSchema = parseConvexSchema(schemaTs)
|
|
880
|
+
|
|
881
|
+
// Validate
|
|
882
|
+
const errors: string[] = []
|
|
883
|
+
|
|
884
|
+
// Check all required tables exist
|
|
885
|
+
for (const [tableName, tableSpec] of Object.entries(spec.tables)) {
|
|
886
|
+
if (!actualSchema[tableName]) {
|
|
887
|
+
errors.push(`❌ Table "${tableName}" missing from schema`)
|
|
888
|
+
continue
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
// Check all required fields exist
|
|
892
|
+
for (const field of tableSpec.required) {
|
|
893
|
+
if (!actualSchema[tableName].fields[field]) {
|
|
894
|
+
errors.push(`❌ Field "${field}" missing from table "${tableName}"`)
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
// Check all tables have groupId (except groups table)
|
|
900
|
+
for (const tableName in actualSchema) {
|
|
901
|
+
if (tableName !== "groups" && !actualSchema[tableName].fields.groupId) {
|
|
902
|
+
errors.push(`❌ Table "${tableName}" missing groupId for multi-tenancy`)
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
if (errors.length > 0) {
|
|
907
|
+
console.error("❌ Schema validation failed:\n")
|
|
908
|
+
errors.forEach(e => console.error(e))
|
|
909
|
+
process.exit(1)
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
console.log("✅ Schema validation passed!")
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
validateSchema()
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
2. **Add to build process:**
|
|
919
|
+
```json
|
|
920
|
+
{
|
|
921
|
+
"scripts": {
|
|
922
|
+
"validate:schema": "ts-node scripts/validate-schema.ts",
|
|
923
|
+
"build:backend": "npm run validate:schema && convex deploy"
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
3. **Create schema validation test:**
|
|
929
|
+
```typescript
|
|
930
|
+
// backend/convex/schema.test.ts
|
|
931
|
+
|
|
932
|
+
import { describe, it, expect } from "vitest"
|
|
933
|
+
import { schema } from "./schema"
|
|
934
|
+
|
|
935
|
+
describe("Schema Validation", () => {
|
|
936
|
+
it("should have all required tables", () => {
|
|
937
|
+
const requiredTables = ["groups", "entities", "connections", "events", "knowledge"]
|
|
938
|
+
for (const table of requiredTables) {
|
|
939
|
+
expect(schema).toHaveProperty(table)
|
|
940
|
+
}
|
|
941
|
+
})
|
|
942
|
+
|
|
943
|
+
it("should have groupId in all non-group tables", () => {
|
|
944
|
+
const tables = Object.entries(schema)
|
|
945
|
+
for (const [name, table] of tables) {
|
|
946
|
+
if (name !== "groups") {
|
|
947
|
+
expect(table._def.fields).toHaveProperty("groupId")
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
})
|
|
951
|
+
})
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
**Success Criteria:**
|
|
955
|
+
- [ ] Validator script created
|
|
956
|
+
- [ ] Script validates against ontology
|
|
957
|
+
- [ ] Added to build process
|
|
958
|
+
- [ ] Tests ensure schema correctness
|
|
959
|
+
- [ ] Validator catches schema drift
|
|
960
|
+
- [ ] File: scripts/validate-schema.ts
|
|
961
|
+
|
|
962
|
+
**Owner:** agent-backend
|
|
963
|
+
**Parallel Dependency:** None
|
|
964
|
+
|
|
965
|
+
---
|
|
966
|
+
|
|
967
|
+
### Quick Win 10: Development Environment Documentation
|
|
968
|
+
**Impact:** ⭐⭐⭐ (Onboards new developers in 30 min)
|
|
969
|
+
**Time:** 2 hours
|
|
970
|
+
**Status:** Ready to execute
|
|
971
|
+
|
|
972
|
+
**What:**
|
|
973
|
+
Create comprehensive guide for setting up development environment locally.
|
|
974
|
+
|
|
975
|
+
**Why:**
|
|
976
|
+
- Right now: Setup takes hours, requires asking questions
|
|
977
|
+
- Target: One-command setup, everything documented
|
|
978
|
+
- Benefit: New developers productive in 30 minutes
|
|
979
|
+
|
|
980
|
+
**How to Execute:**
|
|
981
|
+
|
|
982
|
+
1. **Create setup script:**
|
|
983
|
+
```bash
|
|
984
|
+
#!/bin/bash
|
|
985
|
+
# scripts/setup-dev.sh
|
|
986
|
+
|
|
987
|
+
set -e
|
|
988
|
+
|
|
989
|
+
echo "🚀 ONE Platform Development Setup"
|
|
990
|
+
|
|
991
|
+
# Check prerequisites
|
|
992
|
+
echo "✓ Checking prerequisites..."
|
|
993
|
+
command -v node >/dev/null 2>&1 || { echo "❌ Node.js required"; exit 1; }
|
|
994
|
+
command -v bun >/dev/null 2>&1 || { echo "❌ Bun required"; exit 1; }
|
|
995
|
+
command -v git >/dev/null 2>&1 || { echo "❌ Git required"; exit 1; }
|
|
996
|
+
|
|
997
|
+
# Install dependencies
|
|
998
|
+
echo "✓ Installing dependencies..."
|
|
999
|
+
bun install
|
|
1000
|
+
|
|
1001
|
+
# Setup environment files
|
|
1002
|
+
echo "✓ Setting up environment..."
|
|
1003
|
+
cp web/.env.example web/.env.local 2>/dev/null || echo "⚠ Using existing .env.local"
|
|
1004
|
+
cp backend/.env.example backend/.env.local 2>/dev/null || echo "⚠ Using existing .env.local"
|
|
1005
|
+
|
|
1006
|
+
# Setup git hooks
|
|
1007
|
+
echo "✓ Setting up git hooks..."
|
|
1008
|
+
npx husky install
|
|
1009
|
+
|
|
1010
|
+
# Validate setup
|
|
1011
|
+
echo "✓ Validating setup..."
|
|
1012
|
+
cd web && bun run type-check || { echo "❌ Type checking failed"; exit 1; }
|
|
1013
|
+
cd ../backend && npm run validate:schema || { echo "❌ Schema validation failed"; exit 1; }
|
|
1014
|
+
|
|
1015
|
+
echo "✅ Setup complete!"
|
|
1016
|
+
echo ""
|
|
1017
|
+
echo "🎯 Next steps:"
|
|
1018
|
+
echo " 1. Frontend: cd web && bun run dev"
|
|
1019
|
+
echo " 2. Backend: cd backend && npx convex dev"
|
|
1020
|
+
echo " 3. Tests: bun test"
|
|
1021
|
+
echo ""
|
|
1022
|
+
echo "📚 Learn more: https://one.ie/docs"
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
2. **Create comprehensive setup guide:**
|
|
1026
|
+
```markdown
|
|
1027
|
+
# Development Setup Guide
|
|
1028
|
+
|
|
1029
|
+
## Quick Start (5 minutes)
|
|
1030
|
+
|
|
1031
|
+
\`\`\`bash
|
|
1032
|
+
# Clone and setup
|
|
1033
|
+
git clone https://github.com/one-ie/one.git
|
|
1034
|
+
cd one
|
|
1035
|
+
bash scripts/setup-dev.sh
|
|
1036
|
+
\`\`\`
|
|
1037
|
+
|
|
1038
|
+
## Prerequisites
|
|
1039
|
+
|
|
1040
|
+
- **Node.js** 18+ (check: `node --version`)
|
|
1041
|
+
- **Bun** 1.0+ (check: `bun --version`)
|
|
1042
|
+
- **Git** 2.0+ (check: `git --version`)
|
|
1043
|
+
|
|
1044
|
+
## Manual Setup (if automated setup fails)
|
|
1045
|
+
|
|
1046
|
+
### 1. Install Dependencies
|
|
1047
|
+
\`\`\`bash
|
|
1048
|
+
bun install
|
|
1049
|
+
\`\`\`
|
|
1050
|
+
|
|
1051
|
+
### 2. Setup Environment Files
|
|
1052
|
+
\`\`\`bash
|
|
1053
|
+
# Frontend
|
|
1054
|
+
cp web/.env.example web/.env.local
|
|
1055
|
+
# Update with your values
|
|
1056
|
+
|
|
1057
|
+
# Backend
|
|
1058
|
+
cp backend/.env.example backend/.env.local
|
|
1059
|
+
# Update with your values
|
|
1060
|
+
\`\`\`
|
|
1061
|
+
|
|
1062
|
+
### 3. Start Development Servers
|
|
1063
|
+
\`\`\`bash
|
|
1064
|
+
# Terminal 1: Frontend
|
|
1065
|
+
cd web && bun run dev
|
|
1066
|
+
# Opens localhost:4321
|
|
1067
|
+
|
|
1068
|
+
# Terminal 2: Backend
|
|
1069
|
+
cd backend && npx convex dev
|
|
1070
|
+
# Opens localhost:3210
|
|
1071
|
+
\`\`\`
|
|
1072
|
+
|
|
1073
|
+
### 4. Run Tests
|
|
1074
|
+
\`\`\`bash
|
|
1075
|
+
bun test
|
|
1076
|
+
\`\`\`
|
|
1077
|
+
|
|
1078
|
+
## Common Issues
|
|
1079
|
+
|
|
1080
|
+
### Port 4321 Already in Use
|
|
1081
|
+
\`\`\`bash
|
|
1082
|
+
# Find and kill process
|
|
1083
|
+
lsof -i :4321
|
|
1084
|
+
kill -9 <PID>
|
|
1085
|
+
\`\`\`
|
|
1086
|
+
|
|
1087
|
+
### Type Errors After Git Pull
|
|
1088
|
+
\`\`\`bash
|
|
1089
|
+
cd web && bun run type-check
|
|
1090
|
+
cd ../backend && npm run validate:schema
|
|
1091
|
+
\`\`\`
|
|
1092
|
+
|
|
1093
|
+
### Tests Failing
|
|
1094
|
+
\`\`\`bash
|
|
1095
|
+
# Clear test cache
|
|
1096
|
+
rm -rf .vitest
|
|
1097
|
+
bun test
|
|
1098
|
+
\`\`\`
|
|
1099
|
+
|
|
1100
|
+
## Project Structure
|
|
1101
|
+
|
|
1102
|
+
\`\`\`
|
|
1103
|
+
one/
|
|
1104
|
+
├── web/ # Frontend (Astro + React)
|
|
1105
|
+
├── backend/ # Backend (Convex)
|
|
1106
|
+
├── one/ # Documentation
|
|
1107
|
+
└── scripts/ # Automation scripts
|
|
1108
|
+
\`\`\`
|
|
1109
|
+
|
|
1110
|
+
## Development Workflow
|
|
1111
|
+
|
|
1112
|
+
1. Create feature branch: \`git checkout -b feat/my-feature\`
|
|
1113
|
+
2. Make changes and test: \`bun test\`
|
|
1114
|
+
3. Type check: \`bunx astro check\`
|
|
1115
|
+
4. Lint: \`bun run lint:fix\`
|
|
1116
|
+
5. Commit: \`git commit -m "feat: my feature"\`
|
|
1117
|
+
6. Push and create PR
|
|
1118
|
+
|
|
1119
|
+
## Getting Help
|
|
1120
|
+
|
|
1121
|
+
- 📚 Docs: /one/knowledge/
|
|
1122
|
+
- 💬 Issues: GitHub Issues
|
|
1123
|
+
- 🤝 Contributing: CONTRIBUTING.md
|
|
1124
|
+
|
|
1125
|
+
## Next Steps
|
|
1126
|
+
|
|
1127
|
+
- Read /one/knowledge/ontology.md (20 min)
|
|
1128
|
+
- Read CLAUDE.md (1 hour)
|
|
1129
|
+
- Pick a quick win from /one/things/plans/quick-wins.md
|
|
1130
|
+
- Start building!
|
|
1131
|
+
\`\`\`
|
|
1132
|
+
|
|
1133
|
+
3. **Create .env.example files:**
|
|
1134
|
+
```bash
|
|
1135
|
+
# web/.env.example
|
|
1136
|
+
PUBLIC_CONVEX_URL=https://shocking-falcon-870.convex.cloud
|
|
1137
|
+
CONVEX_DEPLOYMENT=prod:shocking-falcon-870
|
|
1138
|
+
BETTER_AUTH_SECRET=your-secret-here
|
|
1139
|
+
BETTER_AUTH_URL=http://localhost:4321
|
|
1140
|
+
|
|
1141
|
+
# backend/.env.example
|
|
1142
|
+
CONVEX_DEPLOYMENT=prod:shocking-falcon-870
|
|
1143
|
+
RESEND_API_KEY=your-resend-key
|
|
1144
|
+
RESEND_FROM_EMAIL=noreply@example.com
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
4. **Add to README.md:**
|
|
1148
|
+
```markdown
|
|
1149
|
+
## Quick Start
|
|
1150
|
+
|
|
1151
|
+
\`\`\`bash
|
|
1152
|
+
bash scripts/setup-dev.sh
|
|
1153
|
+
cd web && bun run dev
|
|
1154
|
+
\`\`\`
|
|
1155
|
+
|
|
1156
|
+
See [Development Setup Guide](one/knowledge/setup.md) for detailed instructions.
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
**Success Criteria:**
|
|
1160
|
+
- [ ] Setup script created and tested
|
|
1161
|
+
- [ ] Setup guide documentation complete
|
|
1162
|
+
- [ ] .env.example files created
|
|
1163
|
+
- [ ] Script succeeds on clean clone
|
|
1164
|
+
- [ ] README.md updated with quick start
|
|
1165
|
+
- [ ] File: /one/knowledge/setup.md
|
|
1166
|
+
|
|
1167
|
+
**Owner:** agent-ops + agent-documenter
|
|
1168
|
+
**Parallel Dependency:** None
|
|
1169
|
+
|
|
1170
|
+
---
|
|
1171
|
+
|
|
1172
|
+
## 🎯 Execution Plan
|
|
1173
|
+
|
|
1174
|
+
### Today (Parallel Execution)
|
|
1175
|
+
```
|
|
1176
|
+
Team A: Quick Win 1 (Error Taxonomy) → 2 hours
|
|
1177
|
+
Team B: Quick Win 2 (Type Safety Audit) → 3 hours
|
|
1178
|
+
Team C: Quick Win 4 (Pre-commit Hooks) → 3 hours
|
|
1179
|
+
Team D: Quick Win 9 (Schema Validation) → 2 hours
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
### Tomorrow (Parallel Execution)
|
|
1183
|
+
```
|
|
1184
|
+
Team A: Quick Win 3 (Services Docs) → 2 hours
|
|
1185
|
+
Team B: Quick Win 5 (Performance Baseline)→ 2 hours
|
|
1186
|
+
Team C: Quick Win 6 (API Documentation) → 3 hours
|
|
1187
|
+
Team D: Quick Win 8 (Test Infrastructure) → 3 hours
|
|
1188
|
+
```
|
|
1189
|
+
|
|
1190
|
+
### Day 3 (Parallel Execution)
|
|
1191
|
+
```
|
|
1192
|
+
Team A: Quick Win 7 (Components) → 4 hours
|
|
1193
|
+
Team B: Quick Win 10 (Setup Guide) → 2 hours
|
|
1194
|
+
Team C/D: Integration & Testing → 3 hours
|
|
1195
|
+
```
|
|
1196
|
+
|
|
1197
|
+
**Total time:** ~30 hours
|
|
1198
|
+
**Parallel factor:** 4 teams = 7.5 hours wall clock
|
|
1199
|
+
**When:** This week
|
|
1200
|
+
|
|
1201
|
+
---
|
|
1202
|
+
|
|
1203
|
+
## 📊 Expected Impact
|
|
1204
|
+
|
|
1205
|
+
### Code Quality
|
|
1206
|
+
- ✅ Type safety: +40%
|
|
1207
|
+
- ✅ Error handling: +60%
|
|
1208
|
+
- ✅ Documentation: +80%
|
|
1209
|
+
- ✅ Consistency: +50%
|
|
1210
|
+
|
|
1211
|
+
### Developer Experience
|
|
1212
|
+
- ✅ Setup time: 5 hours → 30 minutes
|
|
1213
|
+
- ✅ Time to first PR: 1 day → 2 hours
|
|
1214
|
+
- ✅ Testing speed: +300%
|
|
1215
|
+
- ✅ Confidence: +100%
|
|
1216
|
+
|
|
1217
|
+
### Platform Stability
|
|
1218
|
+
- ✅ Preventable bugs: -80%
|
|
1219
|
+
- ✅ Type errors: -100%
|
|
1220
|
+
- ✅ Runtime errors: -40%
|
|
1221
|
+
- ✅ Bad commits: -95%
|
|
1222
|
+
|
|
1223
|
+
### Team Velocity
|
|
1224
|
+
- ✅ Feature development: +40%
|
|
1225
|
+
- ✅ Debugging time: -60%
|
|
1226
|
+
- ✅ Code review time: -40%
|
|
1227
|
+
- ✅ Deployment confidence: +50%
|
|
1228
|
+
|
|
1229
|
+
---
|
|
1230
|
+
|
|
1231
|
+
## ✅ Success Checklist
|
|
1232
|
+
|
|
1233
|
+
After all 10 quick wins complete:
|
|
1234
|
+
|
|
1235
|
+
- [ ] All errors are typed
|
|
1236
|
+
- [ ] Zero `any` except entity properties
|
|
1237
|
+
- [ ] All services documented with examples
|
|
1238
|
+
- [ ] Pre-commit hooks prevent bad commits
|
|
1239
|
+
- [ ] Query performance is known and monitored
|
|
1240
|
+
- [ ] API documentation is auto-generated
|
|
1241
|
+
- [ ] Component patterns are documented and reusable
|
|
1242
|
+
- [ ] Test infrastructure is organized
|
|
1243
|
+
- [ ] Schema is validated on every build
|
|
1244
|
+
- [ ] New developers can setup in 30 minutes
|
|
1245
|
+
|
|
1246
|
+
---
|
|
1247
|
+
|
|
1248
|
+
## 🚀 Next Phase
|
|
1249
|
+
|
|
1250
|
+
After quick wins complete:
|
|
1251
|
+
- Move to `/one/things/plans/sequence.md` for 100-task strengthening plan
|
|
1252
|
+
- Each quick win unblocks multiple sequence tasks
|
|
1253
|
+
- Code generation becomes 2x more accurate
|
|
1254
|
+
- Feature development accelerates
|
|
1255
|
+
|
|
1256
|
+
---
|
|
1257
|
+
|
|
1258
|
+
**These 10 wins = 40% improvement in 1 week.**
|
|
1259
|
+
|
|
1260
|
+
```
|
|
1261
|
+
██████╗ ███╗ ██╗███████╗
|
|
1262
|
+
██╔═══██╗████╗ ██║██╔════╝
|
|
1263
|
+
██║ ██║██╔██╗ ██║█████╗
|
|
1264
|
+
██║ ██║██║╚██╗██║██╔══╝
|
|
1265
|
+
╚██████╔╝██║ ╚████║███████╗
|
|
1266
|
+
╚═════╝ ╚═╝ ╚═══╝╚══════╝
|
|
1267
|
+
|
|
1268
|
+
Quick Wins This Week → Solid Foundation
|
|
1269
|
+
```
|
|
1270
|
+
|
|
1271
|
+
**Version:** 1.0.0
|
|
1272
|
+
**Status:** Ready to Execute
|
|
1273
|
+
**Time to Start:** Now
|