cmp-standards 2.4.0 → 2.7.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.
Files changed (97) hide show
  1. package/README.md +633 -611
  2. package/dist/cli/index.js +0 -0
  3. package/dist/db/drizzle-client.d.ts +3 -3
  4. package/dist/db/drizzle-client.d.ts.map +1 -1
  5. package/dist/db/drizzle-client.js +57 -58
  6. package/dist/db/drizzle-client.js.map +1 -1
  7. package/dist/db/turso-client.js +11 -11
  8. package/dist/eslint/rules/no-async-useeffect.js +6 -6
  9. package/dist/hooks/cloud-pre-tool-use.js +20 -20
  10. package/dist/hooks/cloud-session-start.d.ts +15 -3
  11. package/dist/hooks/cloud-session-start.d.ts.map +1 -1
  12. package/dist/hooks/cloud-session-start.js +135 -8
  13. package/dist/hooks/cloud-session-start.js.map +1 -1
  14. package/dist/hooks/session-start.d.ts +2 -1
  15. package/dist/hooks/session-start.d.ts.map +1 -1
  16. package/dist/hooks/session-start.js +99 -74
  17. package/dist/hooks/session-start.js.map +1 -1
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +4 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/mcp/server.js +2 -2
  23. package/dist/mcp/server.js.map +1 -1
  24. package/dist/schema/plans.d.ts +194 -0
  25. package/dist/schema/plans.d.ts.map +1 -0
  26. package/dist/schema/plans.js +180 -0
  27. package/dist/schema/plans.js.map +1 -0
  28. package/dist/schema/tracking.d.ts +90 -90
  29. package/dist/services/ContextGenerator.d.ts +16 -0
  30. package/dist/services/ContextGenerator.d.ts.map +1 -0
  31. package/dist/services/ContextGenerator.js +62 -0
  32. package/dist/services/ContextGenerator.js.map +1 -0
  33. package/dist/services/PlanManager.d.ts +99 -0
  34. package/dist/services/PlanManager.d.ts.map +1 -0
  35. package/dist/services/PlanManager.js +372 -0
  36. package/dist/services/PlanManager.js.map +1 -0
  37. package/dist/services/ProjectScaffold.js +76 -76
  38. package/dist/services/context-injector.d.ts +111 -0
  39. package/dist/services/context-injector.d.ts.map +1 -0
  40. package/dist/services/context-injector.js +397 -0
  41. package/dist/services/context-injector.js.map +1 -0
  42. package/dist/services/index.d.ts +15 -15
  43. package/dist/services/index.d.ts.map +1 -1
  44. package/dist/services/index.js +18 -20
  45. package/dist/services/index.js.map +1 -1
  46. package/dist/services/memory-router.d.ts +122 -0
  47. package/dist/services/memory-router.d.ts.map +1 -0
  48. package/dist/services/memory-router.js +517 -0
  49. package/dist/services/memory-router.js.map +1 -0
  50. package/dist/services/pattern-tracker.d.ts +97 -0
  51. package/dist/services/pattern-tracker.d.ts.map +1 -0
  52. package/dist/services/pattern-tracker.js +425 -0
  53. package/dist/services/pattern-tracker.js.map +1 -0
  54. package/dist/services/semantic-search.d.ts +33 -35
  55. package/dist/services/semantic-search.d.ts.map +1 -1
  56. package/dist/services/semantic-search.js +207 -165
  57. package/dist/services/semantic-search.js.map +1 -1
  58. package/dist/types/index.d.ts +329 -4
  59. package/dist/types/index.d.ts.map +1 -1
  60. package/dist/types/index.js +186 -9
  61. package/dist/types/index.js.map +1 -1
  62. package/package.json +104 -100
  63. package/standards/README.md +50 -50
  64. package/standards/experts/expert-routing.md +215 -215
  65. package/standards/general/code-quality.md +86 -86
  66. package/standards/general/memory-usage.md +205 -205
  67. package/standards/general/sync-workflow.md +235 -235
  68. package/standards/general/workflow.md +82 -82
  69. package/standards/hooks/mandatory-tracking.md +446 -446
  70. package/standards/infrastructure/cloud-database.md +287 -287
  71. package/standards/mcp/server-design.md +243 -243
  72. package/standards/mcp/tool-patterns.md +354 -354
  73. package/standards/skills/skill-structure.md +286 -286
  74. package/standards/skills/workflow-design.md +323 -323
  75. package/standards/tools/tool-design.md +297 -297
  76. package/templates/agents/architecture-expert.md +61 -61
  77. package/templates/agents/database-expert.md +62 -62
  78. package/templates/agents/documentation-expert.md +57 -57
  79. package/templates/agents/memory-expert.md +88 -88
  80. package/templates/agents/performance-expert.md +61 -61
  81. package/templates/agents/security-expert.md +59 -59
  82. package/templates/agents/ux-expert.md +63 -63
  83. package/templates/agents/worker.md +75 -75
  84. package/templates/ai-skills/SKILL_TEMPLATE.md +55 -55
  85. package/templates/claude-settings.json +72 -72
  86. package/templates/commands/experts.md +138 -138
  87. package/templates/hooks/README.md +158 -158
  88. package/templates/hooks/project.config.json.template +77 -77
  89. package/templates/hooks/settings.local.json.template +57 -57
  90. package/templates/memory-config.json +56 -56
  91. package/templates/memory-config.schema.json +212 -212
  92. package/templates/settings.json +58 -58
  93. package/templates/skills/continue.md +205 -205
  94. package/templates/workflows/business-improvement.md +264 -264
  95. package/templates/workflows/expert-review.md +153 -153
  96. package/templates/workflows/internal-app.md +245 -245
  97. package/templates/workflows/sync-docs.md +187 -187
@@ -1,245 +1,245 @@
1
- ---
2
- description: "Create complex admin sections following the Internal App pattern (3+ tabs, mobile-first)"
3
- ---
4
-
5
- # Creating an Internal App Section
6
-
7
- Use this workflow when creating complex admin sections with 3+ tabs.
8
-
9
- **Examples**: EditEntity, EntitySettings, ComplexDashboard
10
-
11
- ---
12
-
13
- ## Prerequisites
14
-
15
- - [ ] Component will have 3+ distinct sections/tabs
16
- - [ ] Mobile usage is important (used in field/on-the-go)
17
- - [ ] Complex data management required
18
-
19
- ---
20
-
21
- ## Implementation Steps
22
-
23
- ### 1. Check Qualification
24
-
25
- Ask yourself:
26
- - Does it have 3+ tabs? -> YES
27
- - Will it be used on mobile? -> YES
28
- - Is it data-heavy? -> YES
29
-
30
- If 2/3 are YES, proceed with Internal App pattern.
31
-
32
- ### 2. Create File Structure
33
-
34
- ```bash
35
- mkdir -p src/components/[domain]/edit-component
36
- mkdir -p src/components/[domain]/edit-component/components
37
- mkdir -p src/components/[domain]/edit-component/hooks
38
- mkdir -p src/components/[domain]/edit-component/sections
39
- mkdir -p src/components/[domain]/edit-component/logic
40
- ```
41
-
42
- ### 3. Implement Core Components
43
-
44
- #### Main Component
45
- ```typescript
46
- import { useState } from 'react'
47
- import { useIsMobile } from '~/hooks/useIsMobile'
48
- import { MobileBottomNav } from './edit-component/components/MobileBottomNav'
49
- import { ErrorBoundary } from '~/components/shared/ErrorBoundary'
50
-
51
- type Section = 'GENERAL' | 'DETAILS' | 'ADVANCED'
52
-
53
- export const EditComponent = ({ id }: { id: string }) => {
54
- const [section, setSection] = useState<Section>('GENERAL')
55
- const isMobile = useIsMobile()
56
-
57
- // Data fetching
58
- const { data } = api.component.get.useQuery({ id })
59
-
60
- // Keyboard shortcuts
61
- useEffect(() => {
62
- const handleKeyPress = (e: KeyboardEvent) => {
63
- if (!(e.metaKey || e.ctrlKey)) return
64
- // Add shortcuts...
65
- }
66
-
67
- window.addEventListener('keydown', handleKeyPress)
68
- return () => window.removeEventListener('keydown', handleKeyPress)
69
- }, [])
70
-
71
- return (
72
- <>
73
- <ModalBase
74
- variant="sidePanel"
75
- customHeader={<Header isMobile={isMobile} />}
76
- >
77
- {/* Sections */}
78
- {section === 'GENERAL' && (
79
- <ErrorBoundary>
80
- <GeneralSection data={data} />
81
- </ErrorBoundary>
82
- )}
83
-
84
- {section === 'DETAILS' && (
85
- <ErrorBoundary>
86
- <DetailsSection data={data} />
87
- </ErrorBoundary>
88
- )}
89
- </ModalBase>
90
-
91
- {isMobile && (
92
- <MobileBottomNav
93
- section={section}
94
- onSectionChange={setSection}
95
- />
96
- )}
97
- </>
98
- )
99
- }
100
- ```
101
-
102
- #### MobileBottomNav
103
- ```typescript
104
- const tabs = [
105
- { id: 'GENERAL', label: t('General'), icon: <HomeIcon /> },
106
- { id: 'DETAILS', label: t('Details'), icon: <ListIcon /> },
107
- // Max 6 tabs
108
- ]
109
- ```
110
-
111
- ### 4. Add Optional Enhancements
112
-
113
- **Progress Tracking:**
114
- ```typescript
115
- // hooks/useCompletion.ts
116
- export function useCompletion(data) {
117
- return useMemo(() => {
118
- const checks = [
119
- { key: 'name', value: !!data.name },
120
- { key: 'description', value: !!data.description },
121
- // ...
122
- ]
123
-
124
- const percentage = Math.round(
125
- (checks.filter(c => c.value).length / checks.length) * 100
126
- )
127
-
128
- return { percentage }
129
- }, [data])
130
- }
131
- ```
132
-
133
- **Smart Suggestions:**
134
- ```typescript
135
- // hooks/useNextSuggestion.ts
136
- export function useNextSuggestion(data) {
137
- if (!data.name) return { message: 'Add a name', priority: 'high' }
138
- if (!data.description) return { message: 'Add description', priority: 'medium' }
139
- // ...
140
- }
141
- ```
142
-
143
- ### 5. Test Compliance
144
-
145
- ```bash
146
- # Run compliance checker
147
- npm run lint:internal-app
148
-
149
- # Expected output for new component:
150
- # EditComponent......... 100% (7/7 criteria)
151
- ```
152
-
153
- ### 6. Manual Testing
154
-
155
- **Mobile** (Chrome DevTools -> Toggle device toolbar):
156
- - [ ] Bottom nav appears (< 768px)
157
- - [ ] All 3+ tabs clickable
158
- - [ ] Smooth section transitions
159
- - [ ] Icons render correctly
160
- - [ ] Active state visible
161
-
162
- **Desktop** (>= 768px):
163
- - [ ] Top tabs visible in header
164
- - [ ] Bottom nav hidden
165
- - [ ] Keyboard shortcuts work (Cmd+G, Cmd+D, etc)
166
- - [ ] Tab overflow scrolls if > 5 tabs
167
-
168
- **Error Handling:**
169
- - [ ] Inject error in one section
170
- - [ ] ErrorBoundary catches it
171
- - [ ] Other sections still work
172
- - [ ] "Try Again" button works
173
-
174
- **Accessibility:**
175
- - [ ] Screen reader announces tabs
176
- - [ ] All buttons have aria-label
177
- - [ ] Keyboard navigation works
178
- - [ ] Focus management correct
179
-
180
- ---
181
-
182
- ## Common Issues & Solutions
183
-
184
- ### Issue: "Component has 4 tabs but missing MobileBottomNav"
185
-
186
- **Solution:**
187
- 1. Import MobileBottomNav
188
- 2. Import useIsMobile hook
189
- 3. Render conditionally: `{isMobile && <MobileBottomNav />}`
190
- 4. Wrap in fragment: `<>...</>`
191
-
192
- ### Issue: "Section not wrapped in ErrorBoundary"
193
-
194
- **Solution:**
195
- ```typescript
196
- {section === 'GENERAL' && (
197
- <ErrorBoundary> // <- Add this
198
- <GeneralSection />
199
- </ErrorBoundary> // <- And this
200
- )}
201
- ```
202
-
203
- ### Issue: Bottom nav not showing on mobile
204
-
205
- **Check:**
206
- 1. Viewport is < 768px
207
- 2. `isMobile` returns true (console.log it)
208
- 3. Z-index is 50 or higher
209
- 4. No CSS `display: none` overrides
210
-
211
- ---
212
-
213
- ## Performance Tips
214
-
215
- 1. **Lazy load sections:**
216
- ```typescript
217
- const AdvancedSection = lazy(() => import('./sections/AdvancedSection'))
218
- ```
219
-
220
- 2. **Prefetch on hover** (desktop):
221
- ```typescript
222
- onMouseEnter={() => void ctx.component.getData.prefetch({ id })}
223
- ```
224
-
225
- 3. **Memoize calculations:**
226
- ```typescript
227
- const processedData = useMemo(() => process(rawData), [rawData])
228
- ```
229
-
230
- ---
231
-
232
- ## Verification Checklist
233
-
234
- Before marking complete:
235
-
236
- - [ ] Lint check passes
237
- - [ ] TypeScript check passes
238
- - [ ] Manual mobile testing complete
239
- - [ ] Manual desktop testing complete
240
- - [ ] Accessibility verified
241
- - [ ] Documentation updated
242
-
243
- ---
244
-
245
- **Status**: Production Ready
1
+ ---
2
+ description: "Create complex admin sections following the Internal App pattern (3+ tabs, mobile-first)"
3
+ ---
4
+
5
+ # Creating an Internal App Section
6
+
7
+ Use this workflow when creating complex admin sections with 3+ tabs.
8
+
9
+ **Examples**: EditEntity, EntitySettings, ComplexDashboard
10
+
11
+ ---
12
+
13
+ ## Prerequisites
14
+
15
+ - [ ] Component will have 3+ distinct sections/tabs
16
+ - [ ] Mobile usage is important (used in field/on-the-go)
17
+ - [ ] Complex data management required
18
+
19
+ ---
20
+
21
+ ## Implementation Steps
22
+
23
+ ### 1. Check Qualification
24
+
25
+ Ask yourself:
26
+ - Does it have 3+ tabs? -> YES
27
+ - Will it be used on mobile? -> YES
28
+ - Is it data-heavy? -> YES
29
+
30
+ If 2/3 are YES, proceed with Internal App pattern.
31
+
32
+ ### 2. Create File Structure
33
+
34
+ ```bash
35
+ mkdir -p src/components/[domain]/edit-component
36
+ mkdir -p src/components/[domain]/edit-component/components
37
+ mkdir -p src/components/[domain]/edit-component/hooks
38
+ mkdir -p src/components/[domain]/edit-component/sections
39
+ mkdir -p src/components/[domain]/edit-component/logic
40
+ ```
41
+
42
+ ### 3. Implement Core Components
43
+
44
+ #### Main Component
45
+ ```typescript
46
+ import { useState } from 'react'
47
+ import { useIsMobile } from '~/hooks/useIsMobile'
48
+ import { MobileBottomNav } from './edit-component/components/MobileBottomNav'
49
+ import { ErrorBoundary } from '~/components/shared/ErrorBoundary'
50
+
51
+ type Section = 'GENERAL' | 'DETAILS' | 'ADVANCED'
52
+
53
+ export const EditComponent = ({ id }: { id: string }) => {
54
+ const [section, setSection] = useState<Section>('GENERAL')
55
+ const isMobile = useIsMobile()
56
+
57
+ // Data fetching
58
+ const { data } = api.component.get.useQuery({ id })
59
+
60
+ // Keyboard shortcuts
61
+ useEffect(() => {
62
+ const handleKeyPress = (e: KeyboardEvent) => {
63
+ if (!(e.metaKey || e.ctrlKey)) return
64
+ // Add shortcuts...
65
+ }
66
+
67
+ window.addEventListener('keydown', handleKeyPress)
68
+ return () => window.removeEventListener('keydown', handleKeyPress)
69
+ }, [])
70
+
71
+ return (
72
+ <>
73
+ <ModalBase
74
+ variant="sidePanel"
75
+ customHeader={<Header isMobile={isMobile} />}
76
+ >
77
+ {/* Sections */}
78
+ {section === 'GENERAL' && (
79
+ <ErrorBoundary>
80
+ <GeneralSection data={data} />
81
+ </ErrorBoundary>
82
+ )}
83
+
84
+ {section === 'DETAILS' && (
85
+ <ErrorBoundary>
86
+ <DetailsSection data={data} />
87
+ </ErrorBoundary>
88
+ )}
89
+ </ModalBase>
90
+
91
+ {isMobile && (
92
+ <MobileBottomNav
93
+ section={section}
94
+ onSectionChange={setSection}
95
+ />
96
+ )}
97
+ </>
98
+ )
99
+ }
100
+ ```
101
+
102
+ #### MobileBottomNav
103
+ ```typescript
104
+ const tabs = [
105
+ { id: 'GENERAL', label: t('General'), icon: <HomeIcon /> },
106
+ { id: 'DETAILS', label: t('Details'), icon: <ListIcon /> },
107
+ // Max 6 tabs
108
+ ]
109
+ ```
110
+
111
+ ### 4. Add Optional Enhancements
112
+
113
+ **Progress Tracking:**
114
+ ```typescript
115
+ // hooks/useCompletion.ts
116
+ export function useCompletion(data) {
117
+ return useMemo(() => {
118
+ const checks = [
119
+ { key: 'name', value: !!data.name },
120
+ { key: 'description', value: !!data.description },
121
+ // ...
122
+ ]
123
+
124
+ const percentage = Math.round(
125
+ (checks.filter(c => c.value).length / checks.length) * 100
126
+ )
127
+
128
+ return { percentage }
129
+ }, [data])
130
+ }
131
+ ```
132
+
133
+ **Smart Suggestions:**
134
+ ```typescript
135
+ // hooks/useNextSuggestion.ts
136
+ export function useNextSuggestion(data) {
137
+ if (!data.name) return { message: 'Add a name', priority: 'high' }
138
+ if (!data.description) return { message: 'Add description', priority: 'medium' }
139
+ // ...
140
+ }
141
+ ```
142
+
143
+ ### 5. Test Compliance
144
+
145
+ ```bash
146
+ # Run compliance checker
147
+ npm run lint:internal-app
148
+
149
+ # Expected output for new component:
150
+ # EditComponent......... 100% (7/7 criteria)
151
+ ```
152
+
153
+ ### 6. Manual Testing
154
+
155
+ **Mobile** (Chrome DevTools -> Toggle device toolbar):
156
+ - [ ] Bottom nav appears (< 768px)
157
+ - [ ] All 3+ tabs clickable
158
+ - [ ] Smooth section transitions
159
+ - [ ] Icons render correctly
160
+ - [ ] Active state visible
161
+
162
+ **Desktop** (>= 768px):
163
+ - [ ] Top tabs visible in header
164
+ - [ ] Bottom nav hidden
165
+ - [ ] Keyboard shortcuts work (Cmd+G, Cmd+D, etc)
166
+ - [ ] Tab overflow scrolls if > 5 tabs
167
+
168
+ **Error Handling:**
169
+ - [ ] Inject error in one section
170
+ - [ ] ErrorBoundary catches it
171
+ - [ ] Other sections still work
172
+ - [ ] "Try Again" button works
173
+
174
+ **Accessibility:**
175
+ - [ ] Screen reader announces tabs
176
+ - [ ] All buttons have aria-label
177
+ - [ ] Keyboard navigation works
178
+ - [ ] Focus management correct
179
+
180
+ ---
181
+
182
+ ## Common Issues & Solutions
183
+
184
+ ### Issue: "Component has 4 tabs but missing MobileBottomNav"
185
+
186
+ **Solution:**
187
+ 1. Import MobileBottomNav
188
+ 2. Import useIsMobile hook
189
+ 3. Render conditionally: `{isMobile && <MobileBottomNav />}`
190
+ 4. Wrap in fragment: `<>...</>`
191
+
192
+ ### Issue: "Section not wrapped in ErrorBoundary"
193
+
194
+ **Solution:**
195
+ ```typescript
196
+ {section === 'GENERAL' && (
197
+ <ErrorBoundary> // <- Add this
198
+ <GeneralSection />
199
+ </ErrorBoundary> // <- And this
200
+ )}
201
+ ```
202
+
203
+ ### Issue: Bottom nav not showing on mobile
204
+
205
+ **Check:**
206
+ 1. Viewport is < 768px
207
+ 2. `isMobile` returns true (console.log it)
208
+ 3. Z-index is 50 or higher
209
+ 4. No CSS `display: none` overrides
210
+
211
+ ---
212
+
213
+ ## Performance Tips
214
+
215
+ 1. **Lazy load sections:**
216
+ ```typescript
217
+ const AdvancedSection = lazy(() => import('./sections/AdvancedSection'))
218
+ ```
219
+
220
+ 2. **Prefetch on hover** (desktop):
221
+ ```typescript
222
+ onMouseEnter={() => void ctx.component.getData.prefetch({ id })}
223
+ ```
224
+
225
+ 3. **Memoize calculations:**
226
+ ```typescript
227
+ const processedData = useMemo(() => process(rawData), [rawData])
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Verification Checklist
233
+
234
+ Before marking complete:
235
+
236
+ - [ ] Lint check passes
237
+ - [ ] TypeScript check passes
238
+ - [ ] Manual mobile testing complete
239
+ - [ ] Manual desktop testing complete
240
+ - [ ] Accessibility verified
241
+ - [ ] Documentation updated
242
+
243
+ ---
244
+
245
+ **Status**: Production Ready