memorylink 2.1.0 → 2.2.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/CHANGELOG.md +10 -2
- package/README.md +66 -52
- package/dist/cli/commands/delete.d.ts +7 -0
- package/dist/cli/commands/delete.d.ts.map +1 -0
- package/dist/cli/commands/delete.js +106 -0
- package/dist/cli/commands/delete.js.map +1 -0
- package/dist/cli/commands/gate.d.ts +1 -1
- package/dist/cli/commands/gate.d.ts.map +1 -1
- package/dist/cli/commands/gate.js +14 -0
- package/dist/cli/commands/gate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +17 -75
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/list.d.ts +7 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +129 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/remember.d.ts +3 -0
- package/dist/cli/commands/remember.d.ts.map +1 -0
- package/dist/cli/commands/remember.js +61 -0
- package/dist/cli/commands/remember.js.map +1 -0
- package/dist/cli/commands/retrieve.d.ts +3 -0
- package/dist/cli/commands/retrieve.d.ts.map +1 -0
- package/dist/cli/commands/retrieve.js +32 -0
- package/dist/cli/commands/retrieve.js.map +1 -0
- package/dist/cli/commands/scaffold.d.ts +6 -0
- package/dist/cli/commands/scaffold.d.ts.map +1 -0
- package/dist/cli/commands/scaffold.js +132 -0
- package/dist/cli/commands/scaffold.js.map +1 -0
- package/dist/cli/index.js +10 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/memory/gates.d.ts +17 -0
- package/dist/core/memory/gates.d.ts.map +1 -0
- package/dist/core/memory/gates.js +75 -0
- package/dist/core/memory/gates.js.map +1 -0
- package/dist/core/memory/git.d.ts +9 -0
- package/dist/core/memory/git.d.ts.map +1 -0
- package/dist/core/memory/git.js +57 -0
- package/dist/core/memory/git.js.map +1 -0
- package/dist/core/memory/storage.d.ts +11 -0
- package/dist/core/memory/storage.d.ts.map +1 -0
- package/dist/core/memory/storage.js +63 -0
- package/dist/core/memory/storage.js.map +1 -0
- package/dist/core/memory/structure.d.ts +10 -0
- package/dist/core/memory/structure.d.ts.map +1 -0
- package/dist/core/memory/structure.js +51 -0
- package/dist/core/memory/structure.js.map +1 -0
- package/dist/core/types.d.ts +13 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/gate/rules/valid-syntax.d.ts +16 -0
- package/dist/gate/rules/valid-syntax.d.ts.map +1 -0
- package/dist/gate/rules/valid-syntax.js +76 -0
- package/dist/gate/rules/valid-syntax.js.map +1 -0
- package/dist/quarantine/patterns.js +2 -2
- package/dist/quarantine/patterns.js.map +1 -1
- package/dist/tools/pointer-generator.d.ts.map +1 -1
- package/dist/tools/pointer-generator.js +2 -2
- package/dist/tools/pointer-generator.js.map +1 -1
- package/docs/USER_GUIDE.md +181 -0
- package/package.json +3 -3
- package/docs/COMPARISONS.md +0 -229
- package/docs/FAQ.md +0 -230
- package/docs/GETTING_STARTED.md +0 -185
- package/docs/PATTERNS.md +0 -206
- package/docs/QUICK_REFERENCE.md +0 -209
- package/docs/REMEDIATION.md +0 -332
- package/docs/THREAT_MODEL.md +0 -279
- package/docs/TROUBLESHOOTING.md +0 -280
package/docs/GETTING_STARTED.md
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# Getting Started with MemoryLink
|
|
2
|
-
|
|
3
|
-
Welcome to MemoryLink! This guide will help you get started with MemoryLink in just a few minutes.
|
|
4
|
-
|
|
5
|
-
## 🚀 Quick Start
|
|
6
|
-
|
|
7
|
-
### 1. Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Install globally
|
|
11
|
-
npm install -g @memorylink/cli
|
|
12
|
-
|
|
13
|
-
# Or install from source
|
|
14
|
-
git clone https://github.com/your-org/memorylink.git
|
|
15
|
-
cd memorylink
|
|
16
|
-
npm install
|
|
17
|
-
npm run build
|
|
18
|
-
npm link
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### 2. Initialize Your Project
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# Navigate to your project
|
|
25
|
-
cd /path/to/your/project
|
|
26
|
-
|
|
27
|
-
# Initialize MemoryLink (runs automatic security scan)
|
|
28
|
-
ml init
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The `ml init` command will:
|
|
32
|
-
- ✅ Scan your entire project for secrets and personal data
|
|
33
|
-
- ✅ Create `.memorylink/` directory structure
|
|
34
|
-
- ✅ Generate `AGENTS.md` (universal hub for AI tools)
|
|
35
|
-
- ✅ Create tool pointer files (`.cursorrules`, `CLAUDE.md`, etc.)
|
|
36
|
-
- ✅ Install Git hooks (pre-commit, pre-push)
|
|
37
|
-
|
|
38
|
-
### 3. Your First Memory
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# Capture a memory (E0 = raw, unverified)
|
|
42
|
-
ml capture --topic "project setup" --content "Use TypeScript strict mode"
|
|
43
|
-
|
|
44
|
-
# Query memories
|
|
45
|
-
ml query --topic "project setup"
|
|
46
|
-
|
|
47
|
-
# Promote to E2 (verified) - requires reason
|
|
48
|
-
ml promote --record-id "mem_..." --to E2 --reason "Verified in production"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## 📚 Core Concepts
|
|
52
|
-
|
|
53
|
-
### Evidence Levels
|
|
54
|
-
|
|
55
|
-
- **E0** (Raw): Just captured, unverified
|
|
56
|
-
- **E1** (Curated): Reviewed, seems valid
|
|
57
|
-
- **E2** (Verified): Proven true, policy-gated - **ONLY via `ml promote`**
|
|
58
|
-
|
|
59
|
-
### Memory Status
|
|
60
|
-
|
|
61
|
-
- **ACTIVE**: Currently in use, eligible for queries
|
|
62
|
-
- **DEPRECATED**: Superseded, excluded from truth queries
|
|
63
|
-
- **QUARANTINED**: Unsafe content detected, never returned in queries
|
|
64
|
-
|
|
65
|
-
### Commands Overview
|
|
66
|
-
|
|
67
|
-
| Command | Purpose | Example |
|
|
68
|
-
|---------|---------|---------|
|
|
69
|
-
| `ml init` | First-time setup | `ml init` |
|
|
70
|
-
| `ml capture` | Capture memory (E0/E1) | `ml capture -t "topic" -c "content"` |
|
|
71
|
-
| `ml query` | Query memories | `ml query -t "topic"` |
|
|
72
|
-
| `ml promote` | Promote to E2 | `ml promote -r "mem_..." --to E2 --reason "..."` |
|
|
73
|
-
| `ml gate` | Policy gate check | `ml gate -r block-quarantined` |
|
|
74
|
-
| `ml audit` | View audit trail | `ml audit --view timeline` |
|
|
75
|
-
| `ml scan` | Scan for secrets | `ml scan` |
|
|
76
|
-
|
|
77
|
-
## 🔒 Security Features
|
|
78
|
-
|
|
79
|
-
### Automatic Secret Detection
|
|
80
|
-
|
|
81
|
-
MemoryLink automatically detects and quarantines:
|
|
82
|
-
- API keys (OpenAI, AWS, GitHub, etc.)
|
|
83
|
-
- Passwords and tokens
|
|
84
|
-
- Personal data (SSN, credit cards, etc.)
|
|
85
|
-
- Browser data leaks (localStorage, console.log)
|
|
86
|
-
- Debug code with secrets
|
|
87
|
-
|
|
88
|
-
### Policy Gates
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# Check for quarantined content (blocks CI/CD if found)
|
|
92
|
-
ml gate --rule block-quarantined
|
|
93
|
-
|
|
94
|
-
# Check only changed files
|
|
95
|
-
ml gate --rule block-quarantined --diff
|
|
96
|
-
|
|
97
|
-
# Check commit history
|
|
98
|
-
ml gate --rule block-quarantined --history
|
|
99
|
-
|
|
100
|
-
# Check validity (active/inactive secrets)
|
|
101
|
-
ml gate --rule block-quarantined --check-validity
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Git Hooks
|
|
105
|
-
|
|
106
|
-
MemoryLink automatically installs Git hooks:
|
|
107
|
-
- **pre-commit**: Scans changed files before commit
|
|
108
|
-
- **pre-push**: Full repository scan before push
|
|
109
|
-
|
|
110
|
-
## 🎯 Common Workflows
|
|
111
|
-
|
|
112
|
-
### Workflow 1: First-Time Setup
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# 1. Initialize
|
|
116
|
-
ml init
|
|
117
|
-
|
|
118
|
-
# 2. Review scan results
|
|
119
|
-
# Fix any secrets found
|
|
120
|
-
|
|
121
|
-
# 3. Start capturing memories
|
|
122
|
-
ml capture --topic "architecture" --content "Use microservices pattern"
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Workflow 2: Daily Development
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Capture learnings
|
|
129
|
-
ml capture --topic "bug fix" --content "Fixed memory leak in cache"
|
|
130
|
-
|
|
131
|
-
# Query for context
|
|
132
|
-
ml query --topic "bug fix"
|
|
133
|
-
|
|
134
|
-
# Promote verified knowledge
|
|
135
|
-
ml promote --record-id "mem_..." --to E2 --reason "Tested in production"
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Workflow 3: CI/CD Integration
|
|
139
|
-
|
|
140
|
-
```yaml
|
|
141
|
-
# .github/workflows/gate.yml
|
|
142
|
-
- name: MemoryLink Gate
|
|
143
|
-
run: ml gate --rule block-quarantined
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## 📖 Next Steps
|
|
147
|
-
|
|
148
|
-
- Read [PATTERNS.md](./PATTERNS.md) - All 69+ detection patterns
|
|
149
|
-
- Read [REMEDIATION.md](./REMEDIATION.md) - How to fix detected secrets
|
|
150
|
-
- Read [COMPARISONS.md](./COMPARISONS.md) - MemoryLink vs alternatives
|
|
151
|
-
|
|
152
|
-
## ❓ Troubleshooting
|
|
153
|
-
|
|
154
|
-
### Issue: "Not a Git repository"
|
|
155
|
-
|
|
156
|
-
**Solution**: Initialize Git first:
|
|
157
|
-
```bash
|
|
158
|
-
git init
|
|
159
|
-
ml init
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Issue: "Secret detected" during capture
|
|
163
|
-
|
|
164
|
-
**Solution**: Remove the secret from your content, or use `--approve` if it's intentional:
|
|
165
|
-
```bash
|
|
166
|
-
ml capture --topic "..." --content "..." --approve
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Issue: Gate fails in CI/CD
|
|
170
|
-
|
|
171
|
-
**Solution**: Check for quarantined content:
|
|
172
|
-
```bash
|
|
173
|
-
ml gate --rule block-quarantined --json
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## 🆘 Need Help?
|
|
177
|
-
|
|
178
|
-
- Check the [README.md](../README.md) for full documentation
|
|
179
|
-
- Review [PATTERNS.md](./PATTERNS.md) for all detection patterns
|
|
180
|
-
- See [REMEDIATION.md](./REMEDIATION.md) for fixing issues
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
**Ready to go?** Run `ml init` in your project to get started! 🚀
|
|
185
|
-
|
package/docs/PATTERNS.md
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# MemoryLink Detection Patterns
|
|
2
|
-
|
|
3
|
-
MemoryLink detects **69+ patterns** across multiple categories to protect your codebase from secrets, personal data, and security risks.
|
|
4
|
-
|
|
5
|
-
## 📊 Pattern Statistics
|
|
6
|
-
|
|
7
|
-
- **Total Patterns**: 69+
|
|
8
|
-
- **Blocking (ERROR)**: 55+ patterns
|
|
9
|
-
- **Warning (WARN)**: 14+ patterns (browser/debug leaks)
|
|
10
|
-
|
|
11
|
-
## 🔐 API Keys & Tokens (28 patterns)
|
|
12
|
-
|
|
13
|
-
### Cloud Providers
|
|
14
|
-
- **OpenAI/Anthropic API Key** (`sk-...`)
|
|
15
|
-
- **Claude AI API Key** (`sk-ant-...`)
|
|
16
|
-
- **AWS Access Key** (`AKIA...`)
|
|
17
|
-
- **AWS Secret Key**
|
|
18
|
-
- **Google API Key** (`AIza...`)
|
|
19
|
-
- **Azure Key**
|
|
20
|
-
- **GCP Service Account JSON**
|
|
21
|
-
|
|
22
|
-
### Developer Tools
|
|
23
|
-
- **GitHub Token** (`ghp_...`)
|
|
24
|
-
- **GitHub OAuth Token** (`gho_...`)
|
|
25
|
-
- **Slack Token** (`xoxb-...`)
|
|
26
|
-
- **Slack Webhook URL**
|
|
27
|
-
- **Discord Token**
|
|
28
|
-
- **JWT Token** (`eyJ...`)
|
|
29
|
-
|
|
30
|
-
### Payment & E-commerce
|
|
31
|
-
- **Stripe API Key** (`sk_live_...`, `sk_test_...`)
|
|
32
|
-
- **PayPal Client Secret**
|
|
33
|
-
- **Square Access Token**
|
|
34
|
-
- **Shopify API Key** (`shpat_...`)
|
|
35
|
-
|
|
36
|
-
### Communication & Services
|
|
37
|
-
- **Twilio API Key**
|
|
38
|
-
- **SendGrid API Key** (`SG....`)
|
|
39
|
-
- **Mailgun API Key** (`key-...`)
|
|
40
|
-
- **Heroku API Key** (UUID format)
|
|
41
|
-
|
|
42
|
-
### Generic Patterns
|
|
43
|
-
- **Generic API Key** (`api_key=...`)
|
|
44
|
-
- **Key-Value Secret** (catches ANY key name with secret-like value)
|
|
45
|
-
- **Token** (authentication tokens)
|
|
46
|
-
- **Private Key** (RSA, etc.)
|
|
47
|
-
|
|
48
|
-
## 💳 Personal Data (PII) (12 patterns)
|
|
49
|
-
|
|
50
|
-
### Financial
|
|
51
|
-
- **Credit Card Number** (Visa, Mastercard, Amex, Discover)
|
|
52
|
-
- **CVV/CVC Code**
|
|
53
|
-
- **Bank Account Number**
|
|
54
|
-
- **IBAN** (International Bank Account Number)
|
|
55
|
-
- **UPI ID** (India)
|
|
56
|
-
|
|
57
|
-
### Government IDs
|
|
58
|
-
- **SSN** (US Social Security Number)
|
|
59
|
-
- **SIN** (Canadian Social Insurance Number)
|
|
60
|
-
- **PAN Card** (India)
|
|
61
|
-
- **Aadhaar Number** (India)
|
|
62
|
-
- **Driver License**
|
|
63
|
-
- **Passport Number**
|
|
64
|
-
|
|
65
|
-
### Contact Information
|
|
66
|
-
- **Email Address**
|
|
67
|
-
- **Phone Number**
|
|
68
|
-
- **Email + Password** (credential leak)
|
|
69
|
-
|
|
70
|
-
## 🌐 Browser Data Leaks (6 patterns - WARN)
|
|
71
|
-
|
|
72
|
-
These patterns detect secrets that could leak through browser storage or console:
|
|
73
|
-
|
|
74
|
-
- **localStorage.setItem with token**
|
|
75
|
-
- **sessionStorage.setItem with token**
|
|
76
|
-
- **console.log with Authorization header**
|
|
77
|
-
- **URL parameter ?token=**
|
|
78
|
-
- **URL parameter ?key=**
|
|
79
|
-
- **URL parameter ?auth=**
|
|
80
|
-
|
|
81
|
-
**Severity**: WARN (warning only, doesn't block)
|
|
82
|
-
|
|
83
|
-
## 🐛 Debug Code Leaks (8 patterns - WARN)
|
|
84
|
-
|
|
85
|
-
These patterns catch temporary debug code that could leak secrets:
|
|
86
|
-
|
|
87
|
-
- **console.log with sensitive data**
|
|
88
|
-
- **Logger with request/response data**
|
|
89
|
-
- **print/echo with secret**
|
|
90
|
-
- **TODO comment with secret**
|
|
91
|
-
- **Stack trace in production code**
|
|
92
|
-
- **Verbose error with sensitive data**
|
|
93
|
-
- **Temporary logging**
|
|
94
|
-
- **Development-only code**
|
|
95
|
-
|
|
96
|
-
**Severity**: WARN (warning only, doesn't block)
|
|
97
|
-
|
|
98
|
-
## 🔧 Infrastructure & DevOps (15 patterns)
|
|
99
|
-
|
|
100
|
-
### CI/CD
|
|
101
|
-
- **GitHub Actions Secret** (`${{ secrets.XXX }}`)
|
|
102
|
-
- **GitLab CI Secret**
|
|
103
|
-
- **Jenkins Credential**
|
|
104
|
-
- **CircleCI Secret**
|
|
105
|
-
- **CI Secret Dump** (printenv, env commands)
|
|
106
|
-
|
|
107
|
-
### Containers & Orchestration
|
|
108
|
-
- **Docker Registry Credentials**
|
|
109
|
-
- **Docker Compose Secret**
|
|
110
|
-
- **Kubernetes Secret**
|
|
111
|
-
- **Helm Chart Secret**
|
|
112
|
-
|
|
113
|
-
### Cloud Storage
|
|
114
|
-
- **S3 Public Bucket**
|
|
115
|
-
- **Azure Public Blob**
|
|
116
|
-
- **GCP Public Bucket**
|
|
117
|
-
- **Cloud Storage Credential**
|
|
118
|
-
|
|
119
|
-
### Infrastructure as Code
|
|
120
|
-
- **Terraform Secret**
|
|
121
|
-
- **Redis Credentials**
|
|
122
|
-
|
|
123
|
-
### Other Services
|
|
124
|
-
- **SMTP Credentials**
|
|
125
|
-
- **VPN Credentials**
|
|
126
|
-
- **OAuth Client Secret**
|
|
127
|
-
|
|
128
|
-
## 🛡️ Memory Poisoning Protection (8 patterns)
|
|
129
|
-
|
|
130
|
-
These patterns detect instruction-injection attacks (OWASP ASI06):
|
|
131
|
-
|
|
132
|
-
- **Ignore Previous Rules**
|
|
133
|
-
- **Ignore Security**
|
|
134
|
-
- **Always Log Secrets**
|
|
135
|
-
- **Exfiltrate Data**
|
|
136
|
-
- **Bypass Security**
|
|
137
|
-
- **Disable Checks**
|
|
138
|
-
- **Skip Validation**
|
|
139
|
-
- **Override Security**
|
|
140
|
-
|
|
141
|
-
## 📝 Log File Patterns (4 patterns)
|
|
142
|
-
|
|
143
|
-
- **Error Log with Secret**
|
|
144
|
-
- **Access Log with Secret**
|
|
145
|
-
- **Debug Log with Secret**
|
|
146
|
-
- **Stack Trace with Secret**
|
|
147
|
-
|
|
148
|
-
## 🔍 Dynamic Detection
|
|
149
|
-
|
|
150
|
-
MemoryLink also includes **dynamic detection** that catches secrets even if they don't match predefined patterns:
|
|
151
|
-
|
|
152
|
-
- **Key-Value Detection**: Catches any key name with secret-like values
|
|
153
|
-
- **Standalone Secret Detection**: Detects secrets without key names
|
|
154
|
-
- **High-Entropy Detection**: Identifies random-looking strings
|
|
155
|
-
- **Format Detection**: Base64, Hex, UUID patterns
|
|
156
|
-
|
|
157
|
-
## ⚙️ Pattern Configuration
|
|
158
|
-
|
|
159
|
-
You can customize patterns in `.memorylink/config.json`:
|
|
160
|
-
|
|
161
|
-
```json
|
|
162
|
-
{
|
|
163
|
-
"patterns": {
|
|
164
|
-
"disabled": ["email"], // Disable specific patterns
|
|
165
|
-
"custom": [ // Add custom patterns
|
|
166
|
-
{
|
|
167
|
-
"id": "my-custom-pattern",
|
|
168
|
-
"name": "My Custom Pattern",
|
|
169
|
-
"pattern": "YOUR_REGEX_HERE",
|
|
170
|
-
"description": "Custom pattern description"
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## 📊 Pattern Categories Summary
|
|
178
|
-
|
|
179
|
-
| Category | Count | Severity |
|
|
180
|
-
|----------|-------|----------|
|
|
181
|
-
| API Keys & Tokens | 28 | ERROR |
|
|
182
|
-
| Personal Data (PII) | 12 | ERROR |
|
|
183
|
-
| Browser Leaks | 6 | WARN |
|
|
184
|
-
| Debug Leaks | 8 | WARN |
|
|
185
|
-
| Infrastructure | 15 | ERROR |
|
|
186
|
-
| Memory Poisoning | 8 | ERROR |
|
|
187
|
-
| Log Files | 4 | ERROR |
|
|
188
|
-
| **Total** | **69+** | - |
|
|
189
|
-
|
|
190
|
-
## 🎯 Best Practices
|
|
191
|
-
|
|
192
|
-
1. **Review WARN patterns**: Browser and debug patterns are warnings - review them but don't block on them
|
|
193
|
-
2. **Customize patterns**: Disable patterns that cause false positives in your codebase
|
|
194
|
-
3. **Use whitelist**: Add test keys to whitelist in `.memorylink/config.json`
|
|
195
|
-
4. **Regular scans**: Run `ml scan` regularly to catch new secrets
|
|
196
|
-
|
|
197
|
-
## 📖 Related Documentation
|
|
198
|
-
|
|
199
|
-
- [GETTING_STARTED.md](./GETTING_STARTED.md) - Quick start guide
|
|
200
|
-
- [REMEDIATION.md](./REMEDIATION.md) - How to fix detected secrets
|
|
201
|
-
- [README.md](../README.md) - Full documentation
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
**Last Updated**: Based on MemoryLink v1.0.0
|
|
206
|
-
|
package/docs/QUICK_REFERENCE.md
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
# MemoryLink Quick Reference
|
|
2
|
-
|
|
3
|
-
## 5-Minute Setup
|
|
4
|
-
```bash
|
|
5
|
-
npm install -g memorylink
|
|
6
|
-
cd your-project
|
|
7
|
-
ml init
|
|
8
|
-
# Done! Hooks installed, scanning active.
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Essential Commands
|
|
14
|
-
|
|
15
|
-
| Command | What It Does |
|
|
16
|
-
|---------|--------------|
|
|
17
|
-
| `ml init` | Setup project + Git hooks |
|
|
18
|
-
| `ml scan` | Scan project for secrets |
|
|
19
|
-
| `ml gate` | Check before commit/push |
|
|
20
|
-
| `ml mode` | View/change security mode |
|
|
21
|
-
| `ml audit` | View security history |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Mode Switching
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# View current mode
|
|
29
|
-
ml mode
|
|
30
|
-
|
|
31
|
-
# Set mode permanently
|
|
32
|
-
ml mode active # Block on secrets
|
|
33
|
-
ml mode inactive # Warn only (default)
|
|
34
|
-
|
|
35
|
-
# One-time override
|
|
36
|
-
ML_MODE=active git push # Block this push
|
|
37
|
-
ML_MODE=inactive git push # Allow this push
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Scanning
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Scan entire project
|
|
46
|
-
ml scan
|
|
47
|
-
|
|
48
|
-
# Scan specific file
|
|
49
|
-
ml scan path/to/file.js
|
|
50
|
-
|
|
51
|
-
# Scan with details
|
|
52
|
-
ml scan --verbose
|
|
53
|
-
|
|
54
|
-
# Scan only changed files
|
|
55
|
-
ml gate --diff
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Handling False Positives
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
// Option 1: Inline ignore
|
|
64
|
-
const testKey = "AKIAEXAMPLE"; // ml:ignore
|
|
65
|
-
|
|
66
|
-
// Option 2: Block ignore
|
|
67
|
-
// ml:ignore-start
|
|
68
|
-
const testData = {...};
|
|
69
|
-
// ml:ignore-end
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
# Option 3: Command line
|
|
74
|
-
ml ignore add --file path/to/file.js
|
|
75
|
-
ml ignore add --pattern "api-key-2"
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## Git Hooks
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# Install hooks
|
|
84
|
-
ml hooks install
|
|
85
|
-
|
|
86
|
-
# Uninstall hooks
|
|
87
|
-
ml hooks uninstall
|
|
88
|
-
|
|
89
|
-
# Bypass temporarily (use with caution!)
|
|
90
|
-
git commit --no-verify
|
|
91
|
-
git push --no-verify
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## CI/CD Integration
|
|
97
|
-
|
|
98
|
-
```yaml
|
|
99
|
-
# GitHub Actions
|
|
100
|
-
- run: npm install -g memorylink
|
|
101
|
-
- run: ml gate --enforce
|
|
102
|
-
|
|
103
|
-
# Or with environment variable
|
|
104
|
-
- run: ML_MODE=active ml gate
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Memory Commands
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Store memory
|
|
113
|
-
ml capture --topic "config" "Use React 18"
|
|
114
|
-
|
|
115
|
-
# Query memories
|
|
116
|
-
ml query --topic "config"
|
|
117
|
-
|
|
118
|
-
# Promote evidence grade
|
|
119
|
-
ml promote <memory-id> --to E2
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Audit & History
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
# View audit log
|
|
128
|
-
ml audit
|
|
129
|
-
|
|
130
|
-
# Scan git history
|
|
131
|
-
ml gate --history
|
|
132
|
-
|
|
133
|
-
# View quarantined items
|
|
134
|
-
ml release --list
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Diagnostics
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
# Self-check
|
|
143
|
-
ml self-check
|
|
144
|
-
|
|
145
|
-
# View version
|
|
146
|
-
ml --version
|
|
147
|
-
|
|
148
|
-
# Debug mode
|
|
149
|
-
DEBUG=memorylink ml scan
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## Configuration
|
|
155
|
-
|
|
156
|
-
```json
|
|
157
|
-
// .memorylink/config.json
|
|
158
|
-
{
|
|
159
|
-
"block_mode": false,
|
|
160
|
-
"scan": {
|
|
161
|
-
"exclude": ["dist/**", "*.min.js"]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Exit Codes
|
|
169
|
-
|
|
170
|
-
| Code | Meaning |
|
|
171
|
-
|------|---------|
|
|
172
|
-
| 0 | Success / No issues |
|
|
173
|
-
| 1 | Secrets found (active mode) |
|
|
174
|
-
| 2 | Configuration error |
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Environment Variables
|
|
179
|
-
|
|
180
|
-
| Variable | Purpose |
|
|
181
|
-
|----------|---------|
|
|
182
|
-
| `ML_MODE` | Override mode (active/inactive) |
|
|
183
|
-
| `CI` | Auto-detected, forces active mode |
|
|
184
|
-
| `DEBUG` | Enable debug output |
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## Quick Troubleshooting
|
|
189
|
-
|
|
190
|
-
| Problem | Quick Fix |
|
|
191
|
-
|---------|-----------|
|
|
192
|
-
| Command not found | `npx memorylink` |
|
|
193
|
-
| Hooks not running | `ml hooks install` |
|
|
194
|
-
| False positive | `// ml:ignore` |
|
|
195
|
-
| Database locked | `rm .memorylink/*.lock` |
|
|
196
|
-
| Slow scans | Add excludes to config |
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## Getting Help
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
ml --help # All commands
|
|
204
|
-
ml scan --help # Command help
|
|
205
|
-
ml self-check # Diagnostics
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**Docs:** [TROUBLESHOOTING.md](./TROUBLESHOOTING.md) | [FAQ.md](./FAQ.md)
|
|
209
|
-
|