cmp-standards 2.0.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 (238) hide show
  1. package/README.md +541 -0
  2. package/dist/analytics/index.d.ts +5 -0
  3. package/dist/analytics/index.d.ts.map +1 -0
  4. package/dist/analytics/index.js +5 -0
  5. package/dist/analytics/index.js.map +1 -0
  6. package/dist/analytics/tracker.d.ts +107 -0
  7. package/dist/analytics/tracker.d.ts.map +1 -0
  8. package/dist/analytics/tracker.js +333 -0
  9. package/dist/analytics/tracker.js.map +1 -0
  10. package/dist/auto-improve/eslint-generator.d.ts +36 -0
  11. package/dist/auto-improve/eslint-generator.d.ts.map +1 -0
  12. package/dist/auto-improve/eslint-generator.js +280 -0
  13. package/dist/auto-improve/eslint-generator.js.map +1 -0
  14. package/dist/auto-improve/index.d.ts +6 -0
  15. package/dist/auto-improve/index.d.ts.map +1 -0
  16. package/dist/auto-improve/index.js +6 -0
  17. package/dist/auto-improve/index.js.map +1 -0
  18. package/dist/auto-improve/pattern-detector.d.ts +92 -0
  19. package/dist/auto-improve/pattern-detector.d.ts.map +1 -0
  20. package/dist/auto-improve/pattern-detector.js +231 -0
  21. package/dist/auto-improve/pattern-detector.js.map +1 -0
  22. package/dist/cli/index.d.ts +18 -0
  23. package/dist/cli/index.d.ts.map +1 -0
  24. package/dist/cli/index.js +769 -0
  25. package/dist/cli/index.js.map +1 -0
  26. package/dist/dashboard/index.d.ts +6 -0
  27. package/dist/dashboard/index.d.ts.map +1 -0
  28. package/dist/dashboard/index.js +6 -0
  29. package/dist/dashboard/index.js.map +1 -0
  30. package/dist/dashboard/server.d.ts +15 -0
  31. package/dist/dashboard/server.d.ts.map +1 -0
  32. package/dist/dashboard/server.js +373 -0
  33. package/dist/dashboard/server.js.map +1 -0
  34. package/dist/dashboard/ui.d.ts +9 -0
  35. package/dist/dashboard/ui.d.ts.map +1 -0
  36. package/dist/dashboard/ui.js +530 -0
  37. package/dist/dashboard/ui.js.map +1 -0
  38. package/dist/db/client.d.ts +66 -0
  39. package/dist/db/client.d.ts.map +1 -0
  40. package/dist/db/client.js +159 -0
  41. package/dist/db/client.js.map +1 -0
  42. package/dist/db/drizzle-client.d.ts +302 -0
  43. package/dist/db/drizzle-client.d.ts.map +1 -0
  44. package/dist/db/drizzle-client.js +404 -0
  45. package/dist/db/drizzle-client.js.map +1 -0
  46. package/dist/db/index.d.ts +5 -0
  47. package/dist/db/index.d.ts.map +1 -0
  48. package/dist/db/index.js +5 -0
  49. package/dist/db/index.js.map +1 -0
  50. package/dist/eslint/config-builder.d.ts +45 -0
  51. package/dist/eslint/config-builder.d.ts.map +1 -0
  52. package/dist/eslint/config-builder.js +128 -0
  53. package/dist/eslint/config-builder.js.map +1 -0
  54. package/dist/eslint/index.d.ts +161 -0
  55. package/dist/eslint/index.d.ts.map +1 -0
  56. package/dist/eslint/index.js +106 -0
  57. package/dist/eslint/index.js.map +1 -0
  58. package/dist/eslint/rules/consistent-error-handling.d.ts +9 -0
  59. package/dist/eslint/rules/consistent-error-handling.d.ts.map +1 -0
  60. package/dist/eslint/rules/consistent-error-handling.js +52 -0
  61. package/dist/eslint/rules/consistent-error-handling.js.map +1 -0
  62. package/dist/eslint/rules/finance-ledger-sync.d.ts +12 -0
  63. package/dist/eslint/rules/finance-ledger-sync.d.ts.map +1 -0
  64. package/dist/eslint/rules/finance-ledger-sync.js +72 -0
  65. package/dist/eslint/rules/finance-ledger-sync.js.map +1 -0
  66. package/dist/eslint/rules/no-async-useeffect.d.ts +10 -0
  67. package/dist/eslint/rules/no-async-useeffect.d.ts.map +1 -0
  68. package/dist/eslint/rules/no-async-useeffect.js +49 -0
  69. package/dist/eslint/rules/no-async-useeffect.js.map +1 -0
  70. package/dist/eslint/rules/no-await-in-loop.d.ts +10 -0
  71. package/dist/eslint/rules/no-await-in-loop.d.ts.map +1 -0
  72. package/dist/eslint/rules/no-await-in-loop.js +51 -0
  73. package/dist/eslint/rules/no-await-in-loop.js.map +1 -0
  74. package/dist/eslint/rules/no-inline-functions-in-jsx.d.ts +10 -0
  75. package/dist/eslint/rules/no-inline-functions-in-jsx.d.ts.map +1 -0
  76. package/dist/eslint/rules/no-inline-functions-in-jsx.js +45 -0
  77. package/dist/eslint/rules/no-inline-functions-in-jsx.js.map +1 -0
  78. package/dist/eslint/rules/no-raw-sql.d.ts +19 -0
  79. package/dist/eslint/rules/no-raw-sql.d.ts.map +1 -0
  80. package/dist/eslint/rules/no-raw-sql.js +136 -0
  81. package/dist/eslint/rules/no-raw-sql.js.map +1 -0
  82. package/dist/eslint/rules/no-sequential-api-calls.d.ts +10 -0
  83. package/dist/eslint/rules/no-sequential-api-calls.d.ts.map +1 -0
  84. package/dist/eslint/rules/no-sequential-api-calls.js +72 -0
  85. package/dist/eslint/rules/no-sequential-api-calls.js.map +1 -0
  86. package/dist/eslint/rules/prefer-server-components.d.ts +10 -0
  87. package/dist/eslint/rules/prefer-server-components.d.ts.map +1 -0
  88. package/dist/eslint/rules/prefer-server-components.js +76 -0
  89. package/dist/eslint/rules/prefer-server-components.js.map +1 -0
  90. package/dist/eslint/rules/require-loading-states.d.ts +9 -0
  91. package/dist/eslint/rules/require-loading-states.d.ts.map +1 -0
  92. package/dist/eslint/rules/require-loading-states.js +85 -0
  93. package/dist/eslint/rules/require-loading-states.js.map +1 -0
  94. package/dist/eslint/rules/require-zod-validation.d.ts +10 -0
  95. package/dist/eslint/rules/require-zod-validation.d.ts.map +1 -0
  96. package/dist/eslint/rules/require-zod-validation.js +70 -0
  97. package/dist/eslint/rules/require-zod-validation.js.map +1 -0
  98. package/dist/eslint/rules/semantic-tokens-only.d.ts +10 -0
  99. package/dist/eslint/rules/semantic-tokens-only.d.ts.map +1 -0
  100. package/dist/eslint/rules/semantic-tokens-only.js +62 -0
  101. package/dist/eslint/rules/semantic-tokens-only.js.map +1 -0
  102. package/dist/feedback/collector.d.ts +74 -0
  103. package/dist/feedback/collector.d.ts.map +1 -0
  104. package/dist/feedback/collector.js +231 -0
  105. package/dist/feedback/collector.js.map +1 -0
  106. package/dist/feedback/index.d.ts +5 -0
  107. package/dist/feedback/index.d.ts.map +1 -0
  108. package/dist/feedback/index.js +5 -0
  109. package/dist/feedback/index.js.map +1 -0
  110. package/dist/hooks/index.d.ts +8 -0
  111. package/dist/hooks/index.d.ts.map +1 -0
  112. package/dist/hooks/index.js +8 -0
  113. package/dist/hooks/index.js.map +1 -0
  114. package/dist/hooks/memory-checkpoint.d.ts +43 -0
  115. package/dist/hooks/memory-checkpoint.d.ts.map +1 -0
  116. package/dist/hooks/memory-checkpoint.js +257 -0
  117. package/dist/hooks/memory-checkpoint.js.map +1 -0
  118. package/dist/hooks/post-tool-use.d.ts +61 -0
  119. package/dist/hooks/post-tool-use.d.ts.map +1 -0
  120. package/dist/hooks/post-tool-use.js +262 -0
  121. package/dist/hooks/post-tool-use.js.map +1 -0
  122. package/dist/hooks/pre-tool-use.d.ts +34 -0
  123. package/dist/hooks/pre-tool-use.d.ts.map +1 -0
  124. package/dist/hooks/pre-tool-use.js +358 -0
  125. package/dist/hooks/pre-tool-use.js.map +1 -0
  126. package/dist/hooks/session-start.d.ts +38 -0
  127. package/dist/hooks/session-start.d.ts.map +1 -0
  128. package/dist/hooks/session-start.js +274 -0
  129. package/dist/hooks/session-start.js.map +1 -0
  130. package/dist/index.d.ts +29 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +39 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/mcp/index.d.ts +5 -0
  135. package/dist/mcp/index.d.ts.map +1 -0
  136. package/dist/mcp/index.js +5 -0
  137. package/dist/mcp/index.js.map +1 -0
  138. package/dist/mcp/server.d.ts +42 -0
  139. package/dist/mcp/server.d.ts.map +1 -0
  140. package/dist/mcp/server.js +599 -0
  141. package/dist/mcp/server.js.map +1 -0
  142. package/dist/registry/embeddings.d.ts +38 -0
  143. package/dist/registry/embeddings.d.ts.map +1 -0
  144. package/dist/registry/embeddings.js +110 -0
  145. package/dist/registry/embeddings.js.map +1 -0
  146. package/dist/registry/generator.d.ts +41 -0
  147. package/dist/registry/generator.d.ts.map +1 -0
  148. package/dist/registry/generator.js +323 -0
  149. package/dist/registry/generator.js.map +1 -0
  150. package/dist/registry/index.d.ts +6 -0
  151. package/dist/registry/index.d.ts.map +1 -0
  152. package/dist/registry/index.js +6 -0
  153. package/dist/registry/index.js.map +1 -0
  154. package/dist/services/IdeaCollector.d.ts +103 -0
  155. package/dist/services/IdeaCollector.d.ts.map +1 -0
  156. package/dist/services/IdeaCollector.js +371 -0
  157. package/dist/services/IdeaCollector.js.map +1 -0
  158. package/dist/services/ProjectScaffold.d.ts +76 -0
  159. package/dist/services/ProjectScaffold.d.ts.map +1 -0
  160. package/dist/services/ProjectScaffold.js +479 -0
  161. package/dist/services/ProjectScaffold.js.map +1 -0
  162. package/dist/services/ProjectScanner.d.ts +81 -0
  163. package/dist/services/ProjectScanner.d.ts.map +1 -0
  164. package/dist/services/ProjectScanner.js +349 -0
  165. package/dist/services/ProjectScanner.js.map +1 -0
  166. package/dist/services/TaskTracker.d.ts +89 -0
  167. package/dist/services/TaskTracker.d.ts.map +1 -0
  168. package/dist/services/TaskTracker.js +324 -0
  169. package/dist/services/TaskTracker.js.map +1 -0
  170. package/dist/services/WorkPlanManager.d.ts +107 -0
  171. package/dist/services/WorkPlanManager.d.ts.map +1 -0
  172. package/dist/services/WorkPlanManager.js +440 -0
  173. package/dist/services/WorkPlanManager.js.map +1 -0
  174. package/dist/services/auto-inject.d.ts +77 -0
  175. package/dist/services/auto-inject.d.ts.map +1 -0
  176. package/dist/services/auto-inject.js +289 -0
  177. package/dist/services/auto-inject.js.map +1 -0
  178. package/dist/services/auto-tag.d.ts +61 -0
  179. package/dist/services/auto-tag.d.ts.map +1 -0
  180. package/dist/services/auto-tag.js +203 -0
  181. package/dist/services/auto-tag.js.map +1 -0
  182. package/dist/services/cross-project-sync.d.ts +76 -0
  183. package/dist/services/cross-project-sync.d.ts.map +1 -0
  184. package/dist/services/cross-project-sync.js +235 -0
  185. package/dist/services/cross-project-sync.js.map +1 -0
  186. package/dist/services/index.d.ts +17 -0
  187. package/dist/services/index.d.ts.map +1 -0
  188. package/dist/services/index.js +23 -0
  189. package/dist/services/index.js.map +1 -0
  190. package/dist/services/memory-consolidation.d.ts +77 -0
  191. package/dist/services/memory-consolidation.d.ts.map +1 -0
  192. package/dist/services/memory-consolidation.js +298 -0
  193. package/dist/services/memory-consolidation.js.map +1 -0
  194. package/dist/services/semantic-search.d.ts +93 -0
  195. package/dist/services/semantic-search.d.ts.map +1 -0
  196. package/dist/services/semantic-search.js +278 -0
  197. package/dist/services/semantic-search.js.map +1 -0
  198. package/dist/services/weekly-digest.d.ts +105 -0
  199. package/dist/services/weekly-digest.d.ts.map +1 -0
  200. package/dist/services/weekly-digest.js +292 -0
  201. package/dist/services/weekly-digest.js.map +1 -0
  202. package/dist/types/index.d.ts +274 -0
  203. package/dist/types/index.d.ts.map +1 -0
  204. package/dist/types/index.js +84 -0
  205. package/dist/types/index.js.map +1 -0
  206. package/dist/utils/config.d.ts +21 -0
  207. package/dist/utils/config.d.ts.map +1 -0
  208. package/dist/utils/config.js +89 -0
  209. package/dist/utils/config.js.map +1 -0
  210. package/dist/utils/index.d.ts +6 -0
  211. package/dist/utils/index.d.ts.map +1 -0
  212. package/dist/utils/index.js +6 -0
  213. package/dist/utils/index.js.map +1 -0
  214. package/dist/utils/paths.d.ts +28 -0
  215. package/dist/utils/paths.d.ts.map +1 -0
  216. package/dist/utils/paths.js +80 -0
  217. package/dist/utils/paths.js.map +1 -0
  218. package/package.json +95 -0
  219. package/templates/agents/architecture-expert.md +61 -0
  220. package/templates/agents/database-expert.md +62 -0
  221. package/templates/agents/documentation-expert.md +57 -0
  222. package/templates/agents/memory-expert.md +88 -0
  223. package/templates/agents/performance-expert.md +61 -0
  224. package/templates/agents/security-expert.md +59 -0
  225. package/templates/agents/ux-expert.md +63 -0
  226. package/templates/agents/worker.md +75 -0
  227. package/templates/ai-skills/SKILL_TEMPLATE.md +55 -0
  228. package/templates/commands/experts.md +138 -0
  229. package/templates/hooks/README.md +158 -0
  230. package/templates/hooks/project.config.json.template +77 -0
  231. package/templates/hooks/settings.local.json.template +57 -0
  232. package/templates/memory-config.json +82 -0
  233. package/templates/memory-config.schema.json +212 -0
  234. package/templates/settings.json +58 -0
  235. package/templates/workflows/business-improvement.md +264 -0
  236. package/templates/workflows/expert-review.md +153 -0
  237. package/templates/workflows/internal-app.md +245 -0
  238. package/templates/workflows/sync-docs.md +187 -0
@@ -0,0 +1,153 @@
1
+ ---
2
+ description: "/experts - Multi-lens code review with consensus-based approval"
3
+ ---
4
+
5
+ # Expert Review Workflow
6
+
7
+ This workflow provides structured code review through multiple expert lenses.
8
+
9
+ ## When to Use
10
+ - Before committing critical code (finance, auth, schema)
11
+ - After completing a large refactor
12
+ - When you want structured code feedback
13
+
14
+ ## Steps
15
+
16
+ ### 1. Identify Criticality
17
+
18
+ Analyze the files being reviewed:
19
+ - **CRITICAL**: finance/*, auth/*, schema/*, payments/*
20
+ - **NORMAL**: components/*, utils/*, pages/*
21
+
22
+ ### 2. Run Expert Lenses
23
+
24
+ For each file, analyze through these lenses:
25
+
26
+ **Security Lens:**
27
+ - SQL injection risks (no raw SQL)
28
+ - Input validation (Zod schemas)
29
+ - Auth checks (protected procedures)
30
+ - Finance dual-write compliance
31
+
32
+ **Performance Lens:**
33
+ - API waterfalls
34
+ - N+1 queries
35
+ - Missing lazy loading
36
+ - Inline functions in JSX
37
+
38
+ **Architecture Lens:**
39
+ - Type inference chain (DB -> API -> UI)
40
+ - Domain-driven structure
41
+ - Circular dependencies
42
+ - SOLID principles
43
+
44
+ **UX Lens:**
45
+ - Accessibility (ARIA, keyboard nav)
46
+ - Mobile-first (320px, touch targets)
47
+ - Semantic tokens
48
+ - Correct modal system
49
+
50
+ **Database Lens:**
51
+ - Schema consistency
52
+ - Migration safety
53
+ - Query optimization
54
+ - Relation integrity
55
+
56
+ **Memory Lens:**
57
+ - Pattern detection
58
+ - ESLint rule generation
59
+ - Knowledge extraction
60
+ - Recurring issue tracking
61
+
62
+ ### 3. Collect Issues
63
+
64
+ Document findings:
65
+ ```
66
+ APPROVE / REJECT / ABSTAIN per lens
67
+ If REJECT: clearly state why and how to fix
68
+ ```
69
+
70
+ ### 4. Verdict
71
+
72
+ **For CRITICAL code:**
73
+ - All lenses must APPROVE (0 REJECT)
74
+
75
+ **For NORMAL code:**
76
+ - Majority (3/4+) must APPROVE
77
+
78
+ ### 5. Self-Improvement Check
79
+
80
+ If you found a pattern that occurred 3+ times:
81
+ 1. Propose an ESLint rule
82
+ 2. Record in memory system as 'knowledge'
83
+ 3. Consider creating a check script
84
+
85
+ ### 6. Record Review
86
+
87
+ ```bash
88
+ cmp-memory capture --type knowledge --title "Review: {files}" --content "{summary}"
89
+ ```
90
+
91
+ ## Example Output Format
92
+
93
+ ```
94
+ ## Expert Review: src/server/api/routers/finances/expenses.ts
95
+
96
+ Criticality: CRITICAL (finance code)
97
+ Consensus: UNANIMITY required
98
+
99
+ Security: APPROVE
100
+ Zod validation present, no SQL injection
101
+
102
+ Performance: APPROVE
103
+ No N+1 queries, proper pagination
104
+
105
+ Architecture: APPROVE
106
+ Type inference correct, domain structure valid
107
+
108
+ UX: ABSTAIN
109
+ No UI changes
110
+
111
+ Database: APPROVE
112
+ Queries optimized, indexes used correctly
113
+
114
+ Verdict: APPROVED (4 APPROVE, 0 REJECT, 1 ABSTAIN)
115
+ ```
116
+
117
+ ## Criticality Mapping
118
+
119
+ | Path Pattern | Criticality | Required Consensus |
120
+ |:---|:---|:---|
121
+ | `*/finance/*` | CRITICAL | Unanimity |
122
+ | `*/auth/*` | CRITICAL | Unanimity |
123
+ | `*/schema/*` | CRITICAL | Unanimity |
124
+ | `*/payments/*` | CRITICAL | Unanimity |
125
+ | `*/api/*` | HIGH | 4/5 Approve |
126
+ | `*/components/*` | NORMAL | Majority |
127
+ | `*/utils/*` | NORMAL | Majority |
128
+ | `*/pages/*` | NORMAL | Majority |
129
+
130
+ ## Expert Specializations
131
+
132
+ Each expert has specific focus areas:
133
+
134
+ - **Security Expert**: OWASP Top 10, input validation, auth/authz
135
+ - **Performance Expert**: Bundle size, render optimization, caching
136
+ - **Architecture Expert**: SOLID, DDD, type chains, circular deps
137
+ - **UX Expert**: A11y, mobile-first, brand compliance
138
+ - **Database Expert**: Schema design, migrations, query optimization
139
+ - **Memory Expert**: Pattern learning, rule generation
140
+ - **Documentation Expert**: Code comments, API docs, README updates
141
+
142
+ ## Integration with CI/CD
143
+
144
+ ```yaml
145
+ # Example GitHub Action
146
+ - name: Expert Review
147
+ run: cmp-memory experts --files "${{ github.event.pull_request.files }}"
148
+ ```
149
+
150
+ ---
151
+
152
+ **Last Updated**: {{date}}
153
+ **Status**: Production Ready
@@ -0,0 +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
@@ -0,0 +1,187 @@
1
+ ---
2
+ description: "/sync - Synchronize and validate all project documentation automatically"
3
+ ---
4
+
5
+ # Documentation Sync Workflow
6
+
7
+ This workflow executes all documentation validations and updates.
8
+
9
+ ## Overview
10
+
11
+ The `/sync` command ensures all project documentation is:
12
+ - Up to date with code changes
13
+ - Consistent across files
14
+ - Following established patterns
15
+ - Properly validated
16
+
17
+ ## Execution Steps
18
+
19
+ ### 1. Health Check
20
+
21
+ Run documentation health check:
22
+ ```bash
23
+ npm run docs:health
24
+ # Or custom command for your project
25
+ ```
26
+
27
+ Verifies:
28
+ - All required docs exist
29
+ - No broken internal links
30
+ - Timestamps are recent
31
+
32
+ ### 2. Schema Documentation
33
+
34
+ Generate schema documentation:
35
+ ```bash
36
+ npm run docs:schema
37
+ # Or: npx drizzle-kit generate
38
+ ```
39
+
40
+ Updates:
41
+ - Database schema docs
42
+ - Type definitions
43
+ - API documentation
44
+
45
+ ### 3. AI Context Sync
46
+
47
+ Sync AI context files:
48
+ ```bash
49
+ cmp-memory sync
50
+ ```
51
+
52
+ Updates:
53
+ - CLAUDE.md with latest project state
54
+ - Skills registry
55
+ - Agent configurations
56
+
57
+ ### 4. Translation Check
58
+
59
+ Verify translations (if applicable):
60
+ ```bash
61
+ npm run i18n:check
62
+ ```
63
+
64
+ Checks:
65
+ - Missing translation keys
66
+ - Inconsistent translations
67
+ - Unused keys
68
+
69
+ ### 5. Finance Sync (if applicable)
70
+
71
+ Verify finance-ledger synchronization:
72
+ ```bash
73
+ npm run lint:finance-sync
74
+ ```
75
+
76
+ Ensures:
77
+ - All finance operations have ledger entries
78
+ - Cash flow integrity maintained
79
+
80
+ ### 6. Lint Report
81
+
82
+ Generate intelligent lint report:
83
+ ```bash
84
+ npm run lint:report
85
+ # Or: npx eslint . --format json > .lint/report.json
86
+ ```
87
+
88
+ Produces:
89
+ - Categorized issues
90
+ - Priority ranking
91
+ - Fix suggestions
92
+
93
+ ## Full Report
94
+
95
+ The sync produces a comprehensive report:
96
+
97
+ ```
98
+ Documentation Sync Report
99
+ ========================
100
+
101
+ Health Check:
102
+ - CLAUDE.md: OK (updated 2h ago)
103
+ - README.md: OK
104
+ - API docs: STALE (updated 7d ago) <-- Action needed
105
+
106
+ Schema:
107
+ - 47 tables documented
108
+ - 3 new columns since last sync
109
+ - Types: up to date
110
+
111
+ AI Context:
112
+ - 12 agents configured
113
+ - 8 skills registered
114
+ - Hooks: synchronized
115
+
116
+ Translations:
117
+ - en: 100% (847/847)
118
+ - es: 98% (834/847) <-- 13 missing
119
+ - de: 95% (805/847) <-- 42 missing
120
+
121
+ Lint Summary:
122
+ - Errors: 0
123
+ - Warnings: 12
124
+ - Info: 45
125
+
126
+ Overall: NEEDS_ATTENTION
127
+ Action Items:
128
+ 1. Update API documentation
129
+ 2. Add 13 Spanish translations
130
+ 3. Review 12 lint warnings
131
+ ```
132
+
133
+ ## Automation
134
+
135
+ ### Pre-commit Hook
136
+
137
+ Add to `.claude/hooks/pre-commit.sh`:
138
+ ```bash
139
+ #!/bin/bash
140
+ cmp-memory sync --quick
141
+ if [ $? -ne 0 ]; then
142
+ echo "Documentation sync failed"
143
+ exit 1
144
+ fi
145
+ ```
146
+
147
+ ### CI Integration
148
+
149
+ ```yaml
150
+ - name: Documentation Sync
151
+ run: |
152
+ cmp-memory sync
153
+ git diff --exit-code docs/
154
+ ```
155
+
156
+ ## Customization
157
+
158
+ Configure in `project.config.json`:
159
+
160
+ ```json
161
+ {
162
+ "sync": {
163
+ "healthCheck": true,
164
+ "schemaDoc": true,
165
+ "aiContext": true,
166
+ "i18n": false,
167
+ "financeSync": false,
168
+ "lintReport": true
169
+ }
170
+ }
171
+ ```
172
+
173
+ ## When to Run
174
+
175
+ ### Automatic Triggers
176
+ - Pre-commit (quick mode)
177
+ - PR creation
178
+ - Release preparation
179
+
180
+ ### Manual Triggers
181
+ - After major refactors
182
+ - Before important demos
183
+ - Monthly maintenance
184
+
185
+ ---
186
+
187
+ **Status**: Production Ready