cmp-standards 2.7.0 → 2.8.0-alpha

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 (114) hide show
  1. package/README.md +633 -633
  2. package/dist/cache/EmbeddingCache.d.ts +109 -0
  3. package/dist/cache/EmbeddingCache.d.ts.map +1 -0
  4. package/dist/cache/EmbeddingCache.js +239 -0
  5. package/dist/cache/EmbeddingCache.js.map +1 -0
  6. package/dist/cache/index.d.ts +6 -0
  7. package/dist/cache/index.d.ts.map +1 -0
  8. package/dist/cache/index.js +6 -0
  9. package/dist/cache/index.js.map +1 -0
  10. package/dist/cli/index.js +0 -0
  11. package/dist/db/turso-client.js +11 -11
  12. package/dist/eslint/rules/no-async-useeffect.js +6 -6
  13. package/dist/events/EventBus.d.ts +87 -0
  14. package/dist/events/EventBus.d.ts.map +1 -0
  15. package/dist/events/EventBus.js +200 -0
  16. package/dist/events/EventBus.js.map +1 -0
  17. package/dist/events/index.d.ts +7 -0
  18. package/dist/events/index.d.ts.map +1 -0
  19. package/dist/events/index.js +9 -0
  20. package/dist/events/index.js.map +1 -0
  21. package/dist/events/types.d.ts +989 -0
  22. package/dist/events/types.d.ts.map +1 -0
  23. package/dist/events/types.js +136 -0
  24. package/dist/events/types.js.map +1 -0
  25. package/dist/experts/ConsensusEngine.d.ts +57 -0
  26. package/dist/experts/ConsensusEngine.d.ts.map +1 -0
  27. package/dist/experts/ConsensusEngine.js +146 -0
  28. package/dist/experts/ConsensusEngine.js.map +1 -0
  29. package/dist/experts/ExpertPanelService.d.ts +84 -0
  30. package/dist/experts/ExpertPanelService.d.ts.map +1 -0
  31. package/dist/experts/ExpertPanelService.js +204 -0
  32. package/dist/experts/ExpertPanelService.js.map +1 -0
  33. package/dist/experts/ExpertRouter.d.ts +68 -0
  34. package/dist/experts/ExpertRouter.d.ts.map +1 -0
  35. package/dist/experts/ExpertRouter.js +374 -0
  36. package/dist/experts/ExpertRouter.js.map +1 -0
  37. package/dist/experts/VoteCollector.d.ts +58 -0
  38. package/dist/experts/VoteCollector.d.ts.map +1 -0
  39. package/dist/experts/VoteCollector.js +146 -0
  40. package/dist/experts/VoteCollector.js.map +1 -0
  41. package/dist/experts/index.d.ts +9 -0
  42. package/dist/experts/index.d.ts.map +1 -0
  43. package/dist/experts/index.js +13 -0
  44. package/dist/experts/index.js.map +1 -0
  45. package/dist/hooks/cloud-pre-tool-use.js +20 -20
  46. package/dist/hooks/expert-review.d.ts +74 -0
  47. package/dist/hooks/expert-review.d.ts.map +1 -0
  48. package/dist/hooks/expert-review.js +220 -0
  49. package/dist/hooks/expert-review.js.map +1 -0
  50. package/dist/hooks/index.d.ts +1 -0
  51. package/dist/hooks/index.d.ts.map +1 -1
  52. package/dist/hooks/index.js +2 -0
  53. package/dist/hooks/index.js.map +1 -1
  54. package/dist/index.d.ts +13 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +22 -0
  57. package/dist/index.js.map +1 -1
  58. package/dist/performance/Debouncer.d.ts +91 -0
  59. package/dist/performance/Debouncer.d.ts.map +1 -0
  60. package/dist/performance/Debouncer.js +198 -0
  61. package/dist/performance/Debouncer.js.map +1 -0
  62. package/dist/performance/MemoryDecay.d.ts +82 -0
  63. package/dist/performance/MemoryDecay.d.ts.map +1 -0
  64. package/dist/performance/MemoryDecay.js +153 -0
  65. package/dist/performance/MemoryDecay.js.map +1 -0
  66. package/dist/performance/index.d.ts +7 -0
  67. package/dist/performance/index.d.ts.map +1 -0
  68. package/dist/performance/index.js +9 -0
  69. package/dist/performance/index.js.map +1 -0
  70. package/dist/schema/expert-types.d.ts +395 -0
  71. package/dist/schema/expert-types.d.ts.map +1 -0
  72. package/dist/schema/expert-types.js +250 -0
  73. package/dist/schema/expert-types.js.map +1 -0
  74. package/dist/services/ContextGenerator.js +7 -7
  75. package/dist/services/ProjectScaffold.js +76 -76
  76. package/dist/services/memory-router.js +35 -35
  77. package/dist/services/pattern-tracker.js +90 -90
  78. package/dist/services/semantic-search.js +2 -2
  79. package/package.json +105 -104
  80. package/standards/README.md +50 -50
  81. package/standards/experts/expert-routing.md +215 -215
  82. package/standards/general/code-quality.md +86 -86
  83. package/standards/general/memory-usage.md +205 -205
  84. package/standards/general/sync-workflow.md +235 -235
  85. package/standards/general/workflow.md +82 -82
  86. package/standards/hooks/mandatory-tracking.md +446 -446
  87. package/standards/infrastructure/cloud-database.md +287 -287
  88. package/standards/mcp/server-design.md +243 -243
  89. package/standards/mcp/tool-patterns.md +354 -354
  90. package/standards/skills/skill-structure.md +286 -286
  91. package/standards/skills/workflow-design.md +323 -323
  92. package/standards/tools/tool-design.md +297 -297
  93. package/templates/agents/architecture-expert.md +61 -61
  94. package/templates/agents/database-expert.md +62 -62
  95. package/templates/agents/documentation-expert.md +57 -57
  96. package/templates/agents/memory-expert.md +88 -88
  97. package/templates/agents/performance-expert.md +61 -61
  98. package/templates/agents/security-expert.md +59 -59
  99. package/templates/agents/ux-expert.md +63 -63
  100. package/templates/agents/worker.md +75 -75
  101. package/templates/ai-skills/SKILL_TEMPLATE.md +55 -55
  102. package/templates/claude-settings.json +72 -72
  103. package/templates/commands/experts.md +138 -138
  104. package/templates/hooks/README.md +158 -158
  105. package/templates/hooks/project.config.json.template +77 -77
  106. package/templates/hooks/settings.local.json.template +57 -57
  107. package/templates/memory-config.json +56 -56
  108. package/templates/memory-config.schema.json +212 -212
  109. package/templates/settings.json +58 -58
  110. package/templates/skills/continue.md +205 -205
  111. package/templates/workflows/business-improvement.md +264 -264
  112. package/templates/workflows/expert-review.md +153 -153
  113. package/templates/workflows/internal-app.md +245 -245
  114. package/templates/workflows/sync-docs.md +187 -187
@@ -1,138 +1,138 @@
1
- ## /experts - AI Code Review System
2
-
3
- > **Purpose**: Multi-expert code review with consensus voting
4
- > **Usage**: `/experts [files or task description]`
5
-
6
- ---
7
-
8
- ## Overview
9
-
10
- The `/experts` command launches a panel of AI experts to review your code:
11
-
12
- 1. **Security Expert** - SQL injection, auth, input validation
13
- 2. **Performance Expert** - Waterfalls, N+1, lazy loading
14
- 3. **Architecture Expert** - Types, modules, SOLID principles
15
- 4. **UX Expert** - Accessibility, mobile-first, design tokens
16
- 5. **Database Expert** - Schema, migrations, queries
17
- 6. **Memory Expert** - Pattern detection, auto-improvement
18
-
19
- ---
20
-
21
- ## Usage Examples
22
-
23
- ```bash
24
- # Review specific file
25
- /experts src/components/UserForm.tsx
26
-
27
- # Review directory
28
- /experts src/server/api/routers/
29
-
30
- # Review with context
31
- /experts "Review the new authentication flow"
32
- ```
33
-
34
- ---
35
-
36
- ## How It Works
37
-
38
- ```
39
- 1. ANALYZE CODE
40
- • Detect criticality (CRITICAL vs NORMAL)
41
- • Select relevant experts
42
-
43
- 2. PARALLEL REVIEW (30-45 seconds)
44
- • Each expert reviews independently
45
- • Generates vote and findings
46
-
47
- 3. CONSENSUS VOTING
48
- • CRITICAL: Unanimity required (0 REJECT)
49
- • NORMAL: Majority required (3/5 APPROVE)
50
-
51
- 4. RESULT
52
- • APPROVED → Verification runs
53
- • REJECTED → Detailed feedback provided
54
- ```
55
-
56
- ---
57
-
58
- ## Criticality Detection
59
-
60
- Code is **CRITICAL** if it involves:
61
- - Authentication/Authorization
62
- - Financial operations
63
- - Database schema changes
64
- - External payment integrations
65
-
66
- Critical code requires **unanimous approval** (no REJECT votes).
67
-
68
- ---
69
-
70
- ## Expert Responsibilities
71
-
72
- | Expert | Checks | Rejects On |
73
- |--------|--------|------------|
74
- | Security | SQL injection, auth, validation | Any security hole |
75
- | Performance | N+1, waterfalls, bundle size | Critical perf issues |
76
- | Architecture | Types, modules, SOLID | Type violations |
77
- | UX | A11y, mobile, tokens | Missing accessibility |
78
- | Database | Schema, migrations | Data loss risk |
79
- | Memory | Patterns | Never (ABSTAIN) |
80
-
81
- ---
82
-
83
- ## Output Example
84
-
85
- ```
86
- ## Expert Review
87
- Files: 1
88
- Criticality: NORMAL
89
- Experts: Security, Performance, Architecture, UX (4)
90
-
91
- [30 seconds - parallel review]
92
-
93
- ✅ APPROVED (4/4)
94
- Security: ✓ APPROVE
95
- Performance: ✓ APPROVE
96
- Architecture: ✓ APPROVE
97
- UX: ✓ APPROVE
98
-
99
- Running verification...
100
- ✓ typecheck passed
101
- ✓ lint passed
102
-
103
- All checks passed! ✅
104
- ```
105
-
106
- ---
107
-
108
- ## When to Use
109
-
110
- ✅ **Use /experts for:**
111
- - Critical changes (auth, payments, schema)
112
- - Before submitting PRs
113
- - Large refactors
114
- - Learning (get feedback)
115
-
116
- ❌ **Don't use for:**
117
- - WIP code
118
- - Trivial changes (typos)
119
- - Generated code
120
-
121
- ---
122
-
123
- ## Advanced Options
124
-
125
- ```bash
126
- # Review specific experts only
127
- /experts src/file.ts --only security,architecture
128
-
129
- # Verbose output (show reasoning)
130
- /experts src/file.ts --verbose
131
-
132
- # Dry run (no auto-improvements)
133
- /experts src/file.ts --dry-run
134
- ```
135
-
136
- ---
137
-
138
- *Part of cmp-memory-system - MetaNautical Group*
1
+ ## /experts - AI Code Review System
2
+
3
+ > **Purpose**: Multi-expert code review with consensus voting
4
+ > **Usage**: `/experts [files or task description]`
5
+
6
+ ---
7
+
8
+ ## Overview
9
+
10
+ The `/experts` command launches a panel of AI experts to review your code:
11
+
12
+ 1. **Security Expert** - SQL injection, auth, input validation
13
+ 2. **Performance Expert** - Waterfalls, N+1, lazy loading
14
+ 3. **Architecture Expert** - Types, modules, SOLID principles
15
+ 4. **UX Expert** - Accessibility, mobile-first, design tokens
16
+ 5. **Database Expert** - Schema, migrations, queries
17
+ 6. **Memory Expert** - Pattern detection, auto-improvement
18
+
19
+ ---
20
+
21
+ ## Usage Examples
22
+
23
+ ```bash
24
+ # Review specific file
25
+ /experts src/components/UserForm.tsx
26
+
27
+ # Review directory
28
+ /experts src/server/api/routers/
29
+
30
+ # Review with context
31
+ /experts "Review the new authentication flow"
32
+ ```
33
+
34
+ ---
35
+
36
+ ## How It Works
37
+
38
+ ```
39
+ 1. ANALYZE CODE
40
+ • Detect criticality (CRITICAL vs NORMAL)
41
+ • Select relevant experts
42
+
43
+ 2. PARALLEL REVIEW (30-45 seconds)
44
+ • Each expert reviews independently
45
+ • Generates vote and findings
46
+
47
+ 3. CONSENSUS VOTING
48
+ • CRITICAL: Unanimity required (0 REJECT)
49
+ • NORMAL: Majority required (3/5 APPROVE)
50
+
51
+ 4. RESULT
52
+ • APPROVED → Verification runs
53
+ • REJECTED → Detailed feedback provided
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Criticality Detection
59
+
60
+ Code is **CRITICAL** if it involves:
61
+ - Authentication/Authorization
62
+ - Financial operations
63
+ - Database schema changes
64
+ - External payment integrations
65
+
66
+ Critical code requires **unanimous approval** (no REJECT votes).
67
+
68
+ ---
69
+
70
+ ## Expert Responsibilities
71
+
72
+ | Expert | Checks | Rejects On |
73
+ |--------|--------|------------|
74
+ | Security | SQL injection, auth, validation | Any security hole |
75
+ | Performance | N+1, waterfalls, bundle size | Critical perf issues |
76
+ | Architecture | Types, modules, SOLID | Type violations |
77
+ | UX | A11y, mobile, tokens | Missing accessibility |
78
+ | Database | Schema, migrations | Data loss risk |
79
+ | Memory | Patterns | Never (ABSTAIN) |
80
+
81
+ ---
82
+
83
+ ## Output Example
84
+
85
+ ```
86
+ ## Expert Review
87
+ Files: 1
88
+ Criticality: NORMAL
89
+ Experts: Security, Performance, Architecture, UX (4)
90
+
91
+ [30 seconds - parallel review]
92
+
93
+ ✅ APPROVED (4/4)
94
+ Security: ✓ APPROVE
95
+ Performance: ✓ APPROVE
96
+ Architecture: ✓ APPROVE
97
+ UX: ✓ APPROVE
98
+
99
+ Running verification...
100
+ ✓ typecheck passed
101
+ ✓ lint passed
102
+
103
+ All checks passed! ✅
104
+ ```
105
+
106
+ ---
107
+
108
+ ## When to Use
109
+
110
+ ✅ **Use /experts for:**
111
+ - Critical changes (auth, payments, schema)
112
+ - Before submitting PRs
113
+ - Large refactors
114
+ - Learning (get feedback)
115
+
116
+ ❌ **Don't use for:**
117
+ - WIP code
118
+ - Trivial changes (typos)
119
+ - Generated code
120
+
121
+ ---
122
+
123
+ ## Advanced Options
124
+
125
+ ```bash
126
+ # Review specific experts only
127
+ /experts src/file.ts --only security,architecture
128
+
129
+ # Verbose output (show reasoning)
130
+ /experts src/file.ts --verbose
131
+
132
+ # Dry run (no auto-improvements)
133
+ /experts src/file.ts --dry-run
134
+ ```
135
+
136
+ ---
137
+
138
+ *Part of cmp-memory-system - MetaNautical Group*
@@ -1,158 +1,158 @@
1
- # Claude Code Hooks Configuration
2
-
3
- This directory contains hook templates for Claude Code integration.
4
-
5
- ## Available Hooks
6
-
7
- | Hook | When | Purpose |
8
- |:---|:---|:---|
9
- | `SessionStart` | Session begins | Load context, memories, work plan |
10
- | `PreToolUse` | Before tool runs | Guards, validation, knowledge injection |
11
- | `PostToolUse` | After tool runs | Change tracking, checkpoints |
12
- | `NotificationReceived` | On notifications | Custom notification handling |
13
- | `PromptSubmit` | Before prompt | Pre-processing user input |
14
- | `SubagentStop` | Agent completes | Post-agent processing |
15
-
16
- ## Configuration
17
-
18
- Add to your `.claude/settings.local.json`:
19
-
20
- ```json
21
- {
22
- "hooks": {
23
- "SessionStart": [
24
- {
25
- "matcher": "*",
26
- "hooks": [
27
- {
28
- "type": "command",
29
- "command": "npx cmp-memory session-context"
30
- }
31
- ]
32
- }
33
- ],
34
- "PreToolUse": [
35
- {
36
- "matcher": "Edit|Write",
37
- "hooks": [
38
- {
39
- "type": "command",
40
- "command": "npx cmp-memory pre-tool-guard $EVENT"
41
- }
42
- ]
43
- }
44
- ],
45
- "PostToolUse": [
46
- {
47
- "matcher": "Edit|Write",
48
- "hooks": [
49
- {
50
- "type": "command",
51
- "command": "npx cmp-memory post-tool-record $EVENT"
52
- }
53
- ]
54
- }
55
- ]
56
- }
57
- }
58
- ```
59
-
60
- ## Environment Variables
61
-
62
- Required for full functionality:
63
-
64
- ```bash
65
- # Database connection (for memory persistence)
66
- DATABASE_URL="mysql://user:pass@host:port/database"
67
-
68
- # Embedding (for semantic search - optional)
69
- OPENAI_API_KEY="sk-..."
70
- # or
71
- GEMINI_API_KEY="..."
72
- ```
73
-
74
- ## Guard Rules
75
-
76
- Define guards in `project.config.json`:
77
-
78
- ```json
79
- {
80
- "guards": {
81
- "enabled": true,
82
- "rules": [
83
- {
84
- "id": "no-modify-auth",
85
- "type": "block",
86
- "filePattern": "**/auth/**",
87
- "message": "Auth files require explicit approval",
88
- "excludeFiles": ["**/*.test.ts"]
89
- },
90
- {
91
- "id": "no-raw-sql",
92
- "type": "warn",
93
- "filePattern": "**/*.ts",
94
- "contentTrigger": "\\$\\{[^}]+\\}.*(?:SELECT|INSERT|UPDATE|DELETE)",
95
- "message": "Potential SQL injection - use parameterized queries"
96
- }
97
- ]
98
- }
99
- }
100
- ```
101
-
102
- ## Custom Hooks
103
-
104
- Create custom hook scripts in `.claude/hooks/`:
105
-
106
- ```bash
107
- #!/bin/bash
108
- # .claude/hooks/my-custom-hook.sh
109
-
110
- # Access event data
111
- EVENT_DATA="$1"
112
-
113
- # Parse with jq if needed
114
- TOOL_NAME=$(echo "$EVENT_DATA" | jq -r '.tool_name')
115
-
116
- # Your logic here
117
- echo "Tool called: $TOOL_NAME"
118
- ```
119
-
120
- Register in settings:
121
-
122
- ```json
123
- {
124
- "hooks": {
125
- "PreToolUse": [
126
- {
127
- "matcher": "*",
128
- "hooks": [
129
- {
130
- "type": "command",
131
- "command": ".claude/hooks/my-custom-hook.sh $EVENT"
132
- }
133
- ]
134
- }
135
- ]
136
- }
137
- }
138
- ```
139
-
140
- ## Troubleshooting
141
-
142
- ### Hook not running
143
- - Check that hook command is executable
144
- - Verify matcher pattern matches the tool name
145
- - Check `.claude/settings.local.json` syntax
146
-
147
- ### Guards not blocking
148
- - Ensure `guards.enabled: true` in `project.config.json`
149
- - Verify file patterns match (use glob syntax)
150
- - Check that rule `type` is "block" not "warn"
151
-
152
- ### Memory not persisting
153
- - Verify `DATABASE_URL` is set
154
- - Check database connection with `npx cmp-memory status`
155
-
156
- ---
157
-
158
- For more information, see the [cmp-memory-system documentation](https://github.com/carlosmartinpavon/carlosmartinpavon).
1
+ # Claude Code Hooks Configuration
2
+
3
+ This directory contains hook templates for Claude Code integration.
4
+
5
+ ## Available Hooks
6
+
7
+ | Hook | When | Purpose |
8
+ |:---|:---|:---|
9
+ | `SessionStart` | Session begins | Load context, memories, work plan |
10
+ | `PreToolUse` | Before tool runs | Guards, validation, knowledge injection |
11
+ | `PostToolUse` | After tool runs | Change tracking, checkpoints |
12
+ | `NotificationReceived` | On notifications | Custom notification handling |
13
+ | `PromptSubmit` | Before prompt | Pre-processing user input |
14
+ | `SubagentStop` | Agent completes | Post-agent processing |
15
+
16
+ ## Configuration
17
+
18
+ Add to your `.claude/settings.local.json`:
19
+
20
+ ```json
21
+ {
22
+ "hooks": {
23
+ "SessionStart": [
24
+ {
25
+ "matcher": "*",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "npx cmp-memory session-context"
30
+ }
31
+ ]
32
+ }
33
+ ],
34
+ "PreToolUse": [
35
+ {
36
+ "matcher": "Edit|Write",
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "npx cmp-memory pre-tool-guard $EVENT"
41
+ }
42
+ ]
43
+ }
44
+ ],
45
+ "PostToolUse": [
46
+ {
47
+ "matcher": "Edit|Write",
48
+ "hooks": [
49
+ {
50
+ "type": "command",
51
+ "command": "npx cmp-memory post-tool-record $EVENT"
52
+ }
53
+ ]
54
+ }
55
+ ]
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## Environment Variables
61
+
62
+ Required for full functionality:
63
+
64
+ ```bash
65
+ # Database connection (for memory persistence)
66
+ DATABASE_URL="mysql://user:pass@host:port/database"
67
+
68
+ # Embedding (for semantic search - optional)
69
+ OPENAI_API_KEY="sk-..."
70
+ # or
71
+ GEMINI_API_KEY="..."
72
+ ```
73
+
74
+ ## Guard Rules
75
+
76
+ Define guards in `project.config.json`:
77
+
78
+ ```json
79
+ {
80
+ "guards": {
81
+ "enabled": true,
82
+ "rules": [
83
+ {
84
+ "id": "no-modify-auth",
85
+ "type": "block",
86
+ "filePattern": "**/auth/**",
87
+ "message": "Auth files require explicit approval",
88
+ "excludeFiles": ["**/*.test.ts"]
89
+ },
90
+ {
91
+ "id": "no-raw-sql",
92
+ "type": "warn",
93
+ "filePattern": "**/*.ts",
94
+ "contentTrigger": "\\$\\{[^}]+\\}.*(?:SELECT|INSERT|UPDATE|DELETE)",
95
+ "message": "Potential SQL injection - use parameterized queries"
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Custom Hooks
103
+
104
+ Create custom hook scripts in `.claude/hooks/`:
105
+
106
+ ```bash
107
+ #!/bin/bash
108
+ # .claude/hooks/my-custom-hook.sh
109
+
110
+ # Access event data
111
+ EVENT_DATA="$1"
112
+
113
+ # Parse with jq if needed
114
+ TOOL_NAME=$(echo "$EVENT_DATA" | jq -r '.tool_name')
115
+
116
+ # Your logic here
117
+ echo "Tool called: $TOOL_NAME"
118
+ ```
119
+
120
+ Register in settings:
121
+
122
+ ```json
123
+ {
124
+ "hooks": {
125
+ "PreToolUse": [
126
+ {
127
+ "matcher": "*",
128
+ "hooks": [
129
+ {
130
+ "type": "command",
131
+ "command": ".claude/hooks/my-custom-hook.sh $EVENT"
132
+ }
133
+ ]
134
+ }
135
+ ]
136
+ }
137
+ }
138
+ ```
139
+
140
+ ## Troubleshooting
141
+
142
+ ### Hook not running
143
+ - Check that hook command is executable
144
+ - Verify matcher pattern matches the tool name
145
+ - Check `.claude/settings.local.json` syntax
146
+
147
+ ### Guards not blocking
148
+ - Ensure `guards.enabled: true` in `project.config.json`
149
+ - Verify file patterns match (use glob syntax)
150
+ - Check that rule `type` is "block" not "warn"
151
+
152
+ ### Memory not persisting
153
+ - Verify `DATABASE_URL` is set
154
+ - Check database connection with `npx cmp-memory status`
155
+
156
+ ---
157
+
158
+ For more information, see the [cmp-memory-system documentation](https://github.com/carlosmartinpavon/carlosmartinpavon).