cmp-standards 2.0.1 → 2.4.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.
- package/README.md +171 -101
- package/dist/cli/index.js +239 -7
- package/dist/cli/index.js.map +1 -1
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +203 -39
- package/dist/dashboard/server.js.map +1 -1
- package/dist/db/cloud.d.ts +174 -0
- package/dist/db/cloud.d.ts.map +1 -0
- package/dist/db/cloud.js +241 -0
- package/dist/db/cloud.js.map +1 -0
- package/dist/db/errors.d.ts +76 -0
- package/dist/db/errors.d.ts.map +1 -0
- package/dist/db/errors.js +135 -0
- package/dist/db/errors.js.map +1 -0
- package/dist/db/turso-client.d.ts +178 -0
- package/dist/db/turso-client.d.ts.map +1 -0
- package/dist/db/turso-client.js +455 -0
- package/dist/db/turso-client.js.map +1 -0
- package/dist/db/upstash-client.d.ts +161 -0
- package/dist/db/upstash-client.d.ts.map +1 -0
- package/dist/db/upstash-client.js +325 -0
- package/dist/db/upstash-client.js.map +1 -0
- package/dist/hooks/cloud-post-tool-use.d.ts +30 -0
- package/dist/hooks/cloud-post-tool-use.d.ts.map +1 -0
- package/dist/hooks/cloud-post-tool-use.js +116 -0
- package/dist/hooks/cloud-post-tool-use.js.map +1 -0
- package/dist/hooks/cloud-pre-tool-use.d.ts +19 -0
- package/dist/hooks/cloud-pre-tool-use.d.ts.map +1 -0
- package/dist/hooks/cloud-pre-tool-use.js +149 -0
- package/dist/hooks/cloud-pre-tool-use.js.map +1 -0
- package/dist/hooks/cloud-session-start.d.ts +20 -0
- package/dist/hooks/cloud-session-start.d.ts.map +1 -0
- package/dist/hooks/cloud-session-start.js +130 -0
- package/dist/hooks/cloud-session-start.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/memory-checkpoint.d.ts.map +1 -1
- package/dist/hooks/memory-checkpoint.js +12 -20
- package/dist/hooks/memory-checkpoint.js.map +1 -1
- package/dist/hooks/pre-tool-use.d.ts +2 -8
- package/dist/hooks/pre-tool-use.d.ts.map +1 -1
- package/dist/hooks/pre-tool-use.js +7 -106
- package/dist/hooks/pre-tool-use.js.map +1 -1
- package/dist/hooks/session-start.d.ts.map +1 -1
- package/dist/hooks/session-start.js +15 -6
- package/dist/hooks/session-start.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +223 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/schema/tracking.d.ts +644 -0
- package/dist/schema/tracking.d.ts.map +1 -0
- package/dist/schema/tracking.js +204 -0
- package/dist/schema/tracking.js.map +1 -0
- package/dist/services/ProjectScaffold.d.ts.map +1 -1
- package/dist/services/ProjectScaffold.js +33 -5
- package/dist/services/ProjectScaffold.js.map +1 -1
- package/dist/services/TaskTracker.d.ts +1 -1
- package/dist/services/TaskTracker.d.ts.map +1 -1
- package/dist/services/TaskTracker.js +4 -8
- package/dist/services/TaskTracker.js.map +1 -1
- package/dist/services/WorkPlanManager.d.ts +1 -1
- package/dist/services/WorkPlanManager.d.ts.map +1 -1
- package/dist/services/WorkPlanManager.js +8 -14
- package/dist/services/WorkPlanManager.js.map +1 -1
- package/dist/services/auto-inject.d.ts +1 -0
- package/dist/services/auto-inject.d.ts.map +1 -1
- package/dist/services/auto-inject.js +12 -17
- package/dist/services/auto-inject.js.map +1 -1
- package/dist/services/cross-project-sync.d.ts +2 -0
- package/dist/services/cross-project-sync.d.ts.map +1 -1
- package/dist/services/cross-project-sync.js +26 -21
- package/dist/services/cross-project-sync.js.map +1 -1
- package/dist/services/memory-consolidation.d.ts.map +1 -1
- package/dist/services/memory-consolidation.js +30 -27
- package/dist/services/memory-consolidation.js.map +1 -1
- package/dist/utils/env-loader.d.ts +41 -0
- package/dist/utils/env-loader.d.ts.map +1 -0
- package/dist/utils/env-loader.js +78 -0
- package/dist/utils/env-loader.js.map +1 -0
- package/dist/utils/git.d.ts +52 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +267 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/paths.d.ts +39 -5
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +88 -7
- package/dist/utils/paths.js.map +1 -1
- package/package.json +8 -2
- package/standards/README.md +50 -0
- package/standards/experts/expert-routing.md +215 -0
- package/standards/general/code-quality.md +86 -0
- package/standards/general/memory-usage.md +205 -0
- package/standards/general/sync-workflow.md +235 -0
- package/standards/general/workflow.md +82 -0
- package/standards/hooks/mandatory-tracking.md +446 -0
- package/standards/infrastructure/cloud-database.md +287 -0
- package/standards/mcp/server-design.md +243 -0
- package/standards/mcp/tool-patterns.md +354 -0
- package/standards/skills/skill-structure.md +286 -0
- package/standards/skills/workflow-design.md +323 -0
- package/standards/tools/tool-design.md +297 -0
- package/templates/claude-settings.json +72 -0
- package/templates/memory-config.json +2 -28
- package/templates/skills/continue.md +205 -0
package/README.md
CHANGED
|
@@ -1,45 +1,101 @@
|
|
|
1
|
-
# cmp-
|
|
1
|
+
# cmp-standards
|
|
2
2
|
|
|
3
|
-
> Unified memory & workflow system for Claude Code projects
|
|
3
|
+
> Unified standards, memory, ESLint rules & workflow system for Claude Code projects
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
+
### Core
|
|
8
|
+
- **ESLint Plugin** - 11+ custom rules for code quality
|
|
7
9
|
- **Task Tracking** - Automatic task registration in database
|
|
8
10
|
- **Idea Capture** - Collect ideas and improvements during work
|
|
9
11
|
- **Work Plans** - Persistent work plans across sessions
|
|
10
12
|
- **Memory System** - Session context and memory management
|
|
11
|
-
- **Auto-Improvement** - Pattern detection
|
|
13
|
+
- **Auto-Improvement** - Pattern detection and ESLint rule generation
|
|
12
14
|
- **Dashboard** - Web UI for visualization
|
|
13
15
|
- **MCP Server** - Model Context Protocol integration
|
|
14
16
|
- **Analytics** - Usage tracking and insights
|
|
15
17
|
|
|
18
|
+
### Cloud Infrastructure (v2.2.0+)
|
|
19
|
+
- **Turso** (SQLite Edge) - Tasks, improvements, memories
|
|
20
|
+
- **Upstash Redis** - Session cache, rate limiting
|
|
21
|
+
- **Upstash Vector** - Semantic search with embeddings
|
|
22
|
+
- **Cloud Hooks** - Session tracking across IDE restarts
|
|
23
|
+
|
|
24
|
+
## Cloud Quick Start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { cloud } from 'cmp-standards'
|
|
28
|
+
|
|
29
|
+
// Initialize cloud services
|
|
30
|
+
await cloud.init()
|
|
31
|
+
|
|
32
|
+
// Start work session
|
|
33
|
+
const session = await cloud.startWorkSession('MYPROJECT')
|
|
34
|
+
console.log(`Active tasks: ${session.activeTasks.length}`)
|
|
35
|
+
|
|
36
|
+
// Start task
|
|
37
|
+
const taskId = await cloud.startTask('MYPROJECT', session.sessionId, {
|
|
38
|
+
title: 'Implement feature X',
|
|
39
|
+
plan: ['Step 1', 'Step 2'],
|
|
40
|
+
domain: 'features'
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Complete task (requires at least 1 improvement)
|
|
44
|
+
await cloud.completeTask(taskId, {
|
|
45
|
+
result: 'success',
|
|
46
|
+
improvements: [{
|
|
47
|
+
area: 'features',
|
|
48
|
+
title: 'Add caching',
|
|
49
|
+
description: 'Could cache API responses',
|
|
50
|
+
priority: 'medium'
|
|
51
|
+
}],
|
|
52
|
+
lessons: ['Pattern X works better']
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Environment Variables
|
|
57
|
+
|
|
58
|
+
```env
|
|
59
|
+
# Turso (SQLite Edge)
|
|
60
|
+
TURSO_DATABASE_URL=libsql://your-db.turso.io
|
|
61
|
+
TURSO_AUTH_TOKEN=your-token
|
|
62
|
+
|
|
63
|
+
# Upstash Redis
|
|
64
|
+
UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
|
|
65
|
+
UPSTASH_REDIS_REST_TOKEN=your-token
|
|
66
|
+
|
|
67
|
+
# Upstash Vector
|
|
68
|
+
UPSTASH_VECTOR_REST_URL=https://your-vector.upstash.io
|
|
69
|
+
UPSTASH_VECTOR_REST_TOKEN=your-token
|
|
70
|
+
```
|
|
71
|
+
|
|
16
72
|
## Installation
|
|
17
73
|
|
|
18
74
|
```bash
|
|
19
|
-
npm install cmp-
|
|
75
|
+
npm install cmp-standards
|
|
20
76
|
```
|
|
21
77
|
|
|
22
78
|
## Quick Start
|
|
23
79
|
|
|
24
80
|
```bash
|
|
25
81
|
# Initialize in project
|
|
26
|
-
cmp-
|
|
82
|
+
cmp-standards init --system MYPROJECT --name "My Project"
|
|
27
83
|
|
|
28
84
|
# Check status
|
|
29
|
-
cmp-
|
|
85
|
+
cmp-standards status
|
|
30
86
|
|
|
31
|
-
#
|
|
32
|
-
|
|
87
|
+
# Start dashboard
|
|
88
|
+
cmp-standards dashboard
|
|
33
89
|
```
|
|
34
90
|
|
|
35
91
|
## CLI Commands
|
|
36
92
|
|
|
37
|
-
### `
|
|
93
|
+
### `cmp-standards init`
|
|
38
94
|
|
|
39
|
-
Initialize
|
|
95
|
+
Initialize the system in current project.
|
|
40
96
|
|
|
41
97
|
```bash
|
|
42
|
-
|
|
98
|
+
cmp-standards init [options]
|
|
43
99
|
|
|
44
100
|
Options:
|
|
45
101
|
-s, --system <system> System identifier (SWARMSCALE, PANEL)
|
|
@@ -47,100 +103,100 @@ Options:
|
|
|
47
103
|
-f, --force Overwrite existing configuration
|
|
48
104
|
```
|
|
49
105
|
|
|
50
|
-
### `
|
|
106
|
+
### `cmp-standards generate`
|
|
51
107
|
|
|
52
108
|
Generate embedding registry from documentation.
|
|
53
109
|
|
|
54
110
|
```bash
|
|
55
|
-
|
|
111
|
+
cmp-standards generate [options]
|
|
56
112
|
|
|
57
113
|
Options:
|
|
58
114
|
-i, --incremental Only update changed files
|
|
59
115
|
--files <files> Specific files (comma-separated)
|
|
60
116
|
```
|
|
61
117
|
|
|
62
|
-
### `
|
|
118
|
+
### `cmp-standards scan`
|
|
63
119
|
|
|
64
120
|
Scan codebase for patterns.
|
|
65
121
|
|
|
66
122
|
```bash
|
|
67
|
-
|
|
123
|
+
cmp-standards scan [options]
|
|
68
124
|
|
|
69
125
|
Options:
|
|
70
126
|
-d, --dir <directory> Directory to scan (default: src)
|
|
71
127
|
-t, --threshold <n> Pattern threshold (default: 3)
|
|
72
128
|
```
|
|
73
129
|
|
|
74
|
-
### `
|
|
130
|
+
### `cmp-standards improve`
|
|
75
131
|
|
|
76
132
|
Run auto-improvement for triggered patterns.
|
|
77
133
|
|
|
78
134
|
```bash
|
|
79
|
-
|
|
135
|
+
cmp-standards improve [options]
|
|
80
136
|
|
|
81
137
|
Options:
|
|
82
138
|
--dry-run Show without making changes
|
|
83
139
|
-p, --pattern <id> Specific pattern to improve
|
|
84
140
|
```
|
|
85
141
|
|
|
86
|
-
### `
|
|
142
|
+
### `cmp-standards status`
|
|
87
143
|
|
|
88
144
|
Show memory system status.
|
|
89
145
|
|
|
90
|
-
### `
|
|
146
|
+
### `cmp-standards dashboard`
|
|
91
147
|
|
|
92
148
|
Start the memory dashboard web UI.
|
|
93
149
|
|
|
94
150
|
```bash
|
|
95
|
-
|
|
151
|
+
cmp-standards dashboard [options]
|
|
96
152
|
|
|
97
153
|
Options:
|
|
98
154
|
-p, --port <port> Port to run on (default: 3847)
|
|
99
155
|
--no-open Don't open browser automatically
|
|
100
156
|
```
|
|
101
157
|
|
|
102
|
-
### `
|
|
158
|
+
### `cmp-standards analytics`
|
|
103
159
|
|
|
104
160
|
Show analytics and system health.
|
|
105
161
|
|
|
106
162
|
```bash
|
|
107
|
-
|
|
163
|
+
cmp-standards analytics [options]
|
|
108
164
|
|
|
109
165
|
Options:
|
|
110
166
|
-p, --period <period> Time period (day, week, month)
|
|
111
167
|
--json Output as JSON
|
|
112
168
|
```
|
|
113
169
|
|
|
114
|
-
### `
|
|
170
|
+
### `cmp-standards feedback`
|
|
115
171
|
|
|
116
172
|
View feedback statistics.
|
|
117
173
|
|
|
118
|
-
### `
|
|
174
|
+
### `cmp-standards mcp`
|
|
119
175
|
|
|
120
176
|
Start the MCP server for Claude integration.
|
|
121
177
|
|
|
122
178
|
---
|
|
123
179
|
|
|
124
|
-
## Workflow Commands
|
|
180
|
+
## Workflow Commands
|
|
125
181
|
|
|
126
|
-
### `
|
|
182
|
+
### `cmp-standards tasks`
|
|
127
183
|
|
|
128
184
|
View and manage tasks.
|
|
129
185
|
|
|
130
186
|
```bash
|
|
131
|
-
|
|
187
|
+
cmp-standards tasks [options]
|
|
132
188
|
|
|
133
189
|
Options:
|
|
134
190
|
-a, --all Show all tasks including completed
|
|
135
191
|
-l, --limit <number> Limit number of tasks (default: 10)
|
|
136
192
|
```
|
|
137
193
|
|
|
138
|
-
### `
|
|
194
|
+
### `cmp-standards ideas`
|
|
139
195
|
|
|
140
196
|
View captured ideas.
|
|
141
197
|
|
|
142
198
|
```bash
|
|
143
|
-
|
|
199
|
+
cmp-standards ideas [options]
|
|
144
200
|
|
|
145
201
|
Options:
|
|
146
202
|
-c, --category <cat> Filter by category (feature, refactor, bug, optimization, documentation)
|
|
@@ -148,12 +204,12 @@ Options:
|
|
|
148
204
|
-l, --limit <number> Limit number of ideas (default: 20)
|
|
149
205
|
```
|
|
150
206
|
|
|
151
|
-
### `
|
|
207
|
+
### `cmp-standards improvements`
|
|
152
208
|
|
|
153
209
|
View suggested improvements.
|
|
154
210
|
|
|
155
211
|
```bash
|
|
156
|
-
|
|
212
|
+
cmp-standards improvements [options]
|
|
157
213
|
|
|
158
214
|
Options:
|
|
159
215
|
-t, --type <type> Filter by type (code_quality, performance, security, ux, architecture)
|
|
@@ -161,12 +217,12 @@ Options:
|
|
|
161
217
|
-l, --limit <number> Limit number (default: 20)
|
|
162
218
|
```
|
|
163
219
|
|
|
164
|
-
### `
|
|
220
|
+
### `cmp-standards plan`
|
|
165
221
|
|
|
166
222
|
Manage work plans.
|
|
167
223
|
|
|
168
224
|
```bash
|
|
169
|
-
|
|
225
|
+
cmp-standards plan [options]
|
|
170
226
|
|
|
171
227
|
Options:
|
|
172
228
|
-s, --status Show current plan status
|
|
@@ -175,20 +231,20 @@ Options:
|
|
|
175
231
|
-h, --history Show plan history
|
|
176
232
|
```
|
|
177
233
|
|
|
178
|
-
### `
|
|
234
|
+
### `cmp-standards capture <text>`
|
|
179
235
|
|
|
180
236
|
Quick capture an idea or improvement. Auto-categorizes based on content.
|
|
181
237
|
|
|
182
238
|
```bash
|
|
183
|
-
|
|
239
|
+
cmp-standards capture "Consider adding caching to API calls"
|
|
184
240
|
```
|
|
185
241
|
|
|
186
|
-
### `
|
|
242
|
+
### `cmp-standards export`
|
|
187
243
|
|
|
188
244
|
Export ideas and improvements as markdown.
|
|
189
245
|
|
|
190
246
|
```bash
|
|
191
|
-
|
|
247
|
+
cmp-standards export [options]
|
|
192
248
|
|
|
193
249
|
Options:
|
|
194
250
|
-o, --output <file> Output file (default: IDEAS_AND_IMPROVEMENTS.md)
|
|
@@ -199,13 +255,22 @@ Options:
|
|
|
199
255
|
## Architecture
|
|
200
256
|
|
|
201
257
|
```
|
|
202
|
-
|
|
258
|
+
cmp-standards
|
|
203
259
|
├── src/
|
|
204
260
|
│ ├── hooks/
|
|
205
261
|
│ │ ├── session-start.ts # Context loader on session start
|
|
206
262
|
│ │ ├── pre-tool-use.ts # Guards + embedding injection
|
|
207
263
|
│ │ ├── post-tool-use.ts # Record changes after Edit/Write
|
|
208
264
|
│ │ └── memory-checkpoint.ts # Record learnings after changes
|
|
265
|
+
│ ├── eslint/
|
|
266
|
+
│ │ ├── index.ts # ESLint plugin entry
|
|
267
|
+
│ │ ├── rules/ # Custom ESLint rules
|
|
268
|
+
│ │ └── config-builder.ts # Dynamic config generation
|
|
269
|
+
│ ├── services/
|
|
270
|
+
│ │ ├── TaskTracker.ts # Task tracking
|
|
271
|
+
│ │ ├── IdeaCollector.ts # Idea/improvement capture
|
|
272
|
+
│ │ ├── WorkPlanManager.ts # Work plan management
|
|
273
|
+
│ │ └── ... # Other services
|
|
209
274
|
│ ├── registry/
|
|
210
275
|
│ │ ├── generator.ts # Parse docs → embeddings
|
|
211
276
|
│ │ └── embeddings.ts # OpenAI/Gemini embedding service
|
|
@@ -220,13 +285,10 @@ Options:
|
|
|
220
285
|
│ ├── dashboard/
|
|
221
286
|
│ │ ├── server.ts # Express dashboard server
|
|
222
287
|
│ │ └── ui.ts # React UI generator
|
|
223
|
-
│ ├── feedback/
|
|
224
|
-
│ │ └── collector.ts # User feedback collection
|
|
225
|
-
│ ├── analytics/
|
|
226
|
-
│ │ └── tracker.ts # Usage analytics & insights
|
|
227
288
|
│ ├── utils/
|
|
228
289
|
│ │ ├── config.ts # Configuration management
|
|
229
|
-
│ │
|
|
290
|
+
│ │ ├── paths.ts # Path utilities with traversal protection
|
|
291
|
+
│ │ └── git.ts # Safe git operations (simple-git)
|
|
230
292
|
│ ├── types/
|
|
231
293
|
│ │ └── index.ts # Type definitions
|
|
232
294
|
│ ├── cli/
|
|
@@ -277,7 +339,7 @@ Options:
|
|
|
277
339
|
"matcher": "Task",
|
|
278
340
|
"hooks": [{
|
|
279
341
|
"type": "command",
|
|
280
|
-
"command": "npx tsx node_modules
|
|
342
|
+
"command": "npx tsx node_modules/cmp-standards/dist/hooks/pre-tool-use.js"
|
|
281
343
|
}]
|
|
282
344
|
}
|
|
283
345
|
],
|
|
@@ -286,14 +348,14 @@ Options:
|
|
|
286
348
|
"matcher": "",
|
|
287
349
|
"hooks": [{
|
|
288
350
|
"type": "command",
|
|
289
|
-
"command": "npx tsx node_modules
|
|
351
|
+
"command": "npx tsx node_modules/cmp-standards/dist/hooks/session-start.js"
|
|
290
352
|
}]
|
|
291
353
|
}
|
|
292
354
|
]
|
|
293
355
|
},
|
|
294
356
|
"plugins": {
|
|
295
|
-
"
|
|
296
|
-
"version": "
|
|
357
|
+
"cmp-standards": {
|
|
358
|
+
"version": "2.0.0",
|
|
297
359
|
"enabled": true
|
|
298
360
|
}
|
|
299
361
|
}
|
|
@@ -310,7 +372,7 @@ Executes on session start:
|
|
|
310
372
|
3. Returns formatted context
|
|
311
373
|
|
|
312
374
|
```typescript
|
|
313
|
-
import { SessionStartHook } from '
|
|
375
|
+
import { SessionStartHook } from 'cmp-standards/hooks'
|
|
314
376
|
|
|
315
377
|
const hook = new SessionStartHook()
|
|
316
378
|
const result = await hook.execute()
|
|
@@ -324,7 +386,7 @@ Executes before Edit/Write/Task tools:
|
|
|
324
386
|
2. **Task**: Injects relevant knowledge via embeddings
|
|
325
387
|
|
|
326
388
|
```typescript
|
|
327
|
-
import { PreToolUseHook } from '
|
|
389
|
+
import { PreToolUseHook } from 'cmp-standards/hooks'
|
|
328
390
|
|
|
329
391
|
const hook = new PreToolUseHook()
|
|
330
392
|
const result = await hook.execute({
|
|
@@ -337,6 +399,30 @@ if (result.mode === 'block') {
|
|
|
337
399
|
}
|
|
338
400
|
```
|
|
339
401
|
|
|
402
|
+
## ESLint Plugin
|
|
403
|
+
|
|
404
|
+
The package includes a custom ESLint plugin with 11+ rules.
|
|
405
|
+
|
|
406
|
+
### Using the ESLint Plugin
|
|
407
|
+
|
|
408
|
+
```javascript
|
|
409
|
+
// eslint.config.mjs
|
|
410
|
+
import cmpStandards from 'cmp-standards/eslint'
|
|
411
|
+
|
|
412
|
+
export default [
|
|
413
|
+
...cmpStandards.configs.recommended,
|
|
414
|
+
]
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Dynamic Configuration
|
|
418
|
+
|
|
419
|
+
```typescript
|
|
420
|
+
import { generateConfig } from 'cmp-standards/eslint'
|
|
421
|
+
|
|
422
|
+
// Generate config based on project structure
|
|
423
|
+
const config = await generateConfig(process.cwd())
|
|
424
|
+
```
|
|
425
|
+
|
|
340
426
|
## Auto-Improvement
|
|
341
427
|
|
|
342
428
|
### Pattern Detection
|
|
@@ -355,15 +441,15 @@ When a pattern is detected 3+ times:
|
|
|
355
441
|
|
|
356
442
|
```bash
|
|
357
443
|
# Scan for patterns
|
|
358
|
-
|
|
444
|
+
cmp-standards scan
|
|
359
445
|
|
|
360
446
|
# Output:
|
|
361
|
-
#
|
|
447
|
+
# any-type [high]
|
|
362
448
|
# Count: 5, Files: 3
|
|
363
|
-
#
|
|
449
|
+
# Patterns ready for auto-improvement
|
|
364
450
|
|
|
365
451
|
# Generate ESLint rule
|
|
366
|
-
|
|
452
|
+
cmp-standards improve
|
|
367
453
|
|
|
368
454
|
# Creates: eslint-plugin-charter/rules/no-any-type.js
|
|
369
455
|
```
|
|
@@ -376,7 +462,7 @@ import {
|
|
|
376
462
|
PatternDetector,
|
|
377
463
|
ESLintGenerator,
|
|
378
464
|
RegistryGenerator
|
|
379
|
-
} from '
|
|
465
|
+
} from 'cmp-standards'
|
|
380
466
|
|
|
381
467
|
// Load config
|
|
382
468
|
const config = await loadConfig(process.cwd())
|
|
@@ -415,6 +501,34 @@ db.select().from(devItems).where(eq(devItems.system, 'SWARMSCALE'))
|
|
|
415
501
|
db.select().from(devItems)
|
|
416
502
|
```
|
|
417
503
|
|
|
504
|
+
## Security Features
|
|
505
|
+
|
|
506
|
+
### Path Traversal Protection
|
|
507
|
+
|
|
508
|
+
All path operations are validated to prevent directory traversal attacks:
|
|
509
|
+
|
|
510
|
+
```typescript
|
|
511
|
+
import { validateSafePath, safeJoin } from 'cmp-standards'
|
|
512
|
+
|
|
513
|
+
// Throws PathTraversalError if path escapes base
|
|
514
|
+
validateSafePath(projectRoot, userPath)
|
|
515
|
+
|
|
516
|
+
// Safe path joining with validation
|
|
517
|
+
const safePath = safeJoin(projectRoot, 'subdir', filename)
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Safe Git Operations
|
|
521
|
+
|
|
522
|
+
Git operations use `simple-git` instead of shell commands to prevent command injection:
|
|
523
|
+
|
|
524
|
+
```typescript
|
|
525
|
+
import { getCurrentBranch, getRecentChanges } from 'cmp-standards'
|
|
526
|
+
|
|
527
|
+
// Safe - uses simple-git internally
|
|
528
|
+
const branch = await getCurrentBranch(projectRoot)
|
|
529
|
+
const changes = await getRecentChanges(projectRoot, { commits: 10 })
|
|
530
|
+
```
|
|
531
|
+
|
|
418
532
|
## Environment Variables
|
|
419
533
|
|
|
420
534
|
```bash
|
|
@@ -451,7 +565,7 @@ The MCP (Model Context Protocol) server exposes memory tools that Claude can use
|
|
|
451
565
|
|
|
452
566
|
```bash
|
|
453
567
|
# Start MCP server
|
|
454
|
-
|
|
568
|
+
cmp-standards mcp
|
|
455
569
|
```
|
|
456
570
|
|
|
457
571
|
**Available Tools:**
|
|
@@ -468,7 +582,7 @@ claude-memory mcp
|
|
|
468
582
|
Start the standalone web dashboard:
|
|
469
583
|
|
|
470
584
|
```bash
|
|
471
|
-
|
|
585
|
+
cmp-standards dashboard
|
|
472
586
|
# Opens http://localhost:3847
|
|
473
587
|
```
|
|
474
588
|
|
|
@@ -480,50 +594,6 @@ claude-memory dashboard
|
|
|
480
594
|
- Create new memories
|
|
481
595
|
- View analytics and system health
|
|
482
596
|
|
|
483
|
-
## Feedback Loop
|
|
484
|
-
|
|
485
|
-
The feedback system adjusts memory relevance based on user feedback:
|
|
486
|
-
|
|
487
|
-
```typescript
|
|
488
|
-
import { createFeedbackCollector } from '@metanautical/claude-memory'
|
|
489
|
-
|
|
490
|
-
const collector = createFeedbackCollector('SWARMSCALE')
|
|
491
|
-
|
|
492
|
-
// Submit feedback
|
|
493
|
-
await collector.submitFeedback(memoryId, true, 'Very helpful!')
|
|
494
|
-
|
|
495
|
-
// Get feedback stats
|
|
496
|
-
const stats = await collector.getStats()
|
|
497
|
-
// { helpfulRate: 0.85, topHelpfulMemories: [...] }
|
|
498
|
-
|
|
499
|
-
// Get suggestions for deprecation
|
|
500
|
-
const deprecations = await collector.getSuggestedDeprecations()
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
## Analytics
|
|
504
|
-
|
|
505
|
-
Track usage and get insights:
|
|
506
|
-
|
|
507
|
-
```typescript
|
|
508
|
-
import { createAnalyticsTracker } from '@metanautical/claude-memory'
|
|
509
|
-
|
|
510
|
-
const tracker = createAnalyticsTracker('SWARMSCALE')
|
|
511
|
-
|
|
512
|
-
// Track an event
|
|
513
|
-
await tracker.track('memory_access', { memoryId: '...' })
|
|
514
|
-
|
|
515
|
-
// Get usage stats
|
|
516
|
-
const usage = await tracker.getUsageStats('week')
|
|
517
|
-
// { sessions: 12, memoriesCreated: 5, searchesPerformed: 23, ... }
|
|
518
|
-
|
|
519
|
-
// Get system health
|
|
520
|
-
const health = await tracker.getSystemHealth()
|
|
521
|
-
// { status: 'healthy', issues: [], recommendations: [...] }
|
|
522
|
-
|
|
523
|
-
// Generate full report
|
|
524
|
-
const report = await tracker.generateReport()
|
|
525
|
-
```
|
|
526
|
-
|
|
527
597
|
## Database Configuration
|
|
528
598
|
|
|
529
599
|
Set environment variables for database connection:
|
|
@@ -538,4 +608,4 @@ DATABASE_NAME=metanautical
|
|
|
538
608
|
|
|
539
609
|
## License
|
|
540
610
|
|
|
541
|
-
MIT -
|
|
611
|
+
MIT - Carlos Martin Pavon
|