milens 0.6.3 → 0.6.4

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 (137) hide show
  1. package/.agents/skills/adapters/SKILL.md +31 -0
  2. package/.agents/skills/analyzer/SKILL.md +55 -0
  3. package/.agents/skills/apps/SKILL.md +42 -0
  4. package/.agents/skills/docs/SKILL.md +46 -0
  5. package/.agents/skills/milens/SKILL.md +168 -0
  6. package/.agents/skills/milens-code-review/SKILL.md +186 -0
  7. package/.agents/skills/milens-eval/SKILL.md +221 -0
  8. package/.agents/skills/milens-plan/SKILL.md +227 -0
  9. package/.agents/skills/milens-refactor-clean/SKILL.md +209 -0
  10. package/.agents/skills/milens-security-review/SKILL.md +224 -0
  11. package/.agents/skills/milens-tdd/SKILL.md +156 -0
  12. package/.agents/skills/parser/SKILL.md +60 -0
  13. package/.agents/skills/root/SKILL.md +64 -0
  14. package/.agents/skills/scripts/SKILL.md +27 -0
  15. package/.agents/skills/security/SKILL.md +44 -0
  16. package/.agents/skills/server/SKILL.md +46 -0
  17. package/.agents/skills/store/SKILL.md +53 -0
  18. package/.agents/skills/test/SKILL.md +73 -0
  19. package/LICENSE +75 -75
  20. package/README.md +508 -432
  21. package/adapters/README.md +107 -0
  22. package/adapters/claude-code/.claude/mcp.json +9 -0
  23. package/adapters/claude-code/CLAUDE.md +58 -0
  24. package/adapters/codex/.codex/codex.md +52 -0
  25. package/adapters/copilot/.github/copilot-instructions.md +62 -0
  26. package/adapters/cursor/.cursorrules +9 -0
  27. package/adapters/gemini/.gemini/context.md +58 -0
  28. package/adapters/opencode/.opencode/config.json +9 -0
  29. package/adapters/opencode/AGENTS.md +58 -0
  30. package/adapters/zed/.zed/settings.json +8 -0
  31. package/dist/agents-md.d.ts +3 -0
  32. package/dist/agents-md.d.ts.map +1 -0
  33. package/dist/agents-md.js +112 -0
  34. package/dist/agents-md.js.map +1 -0
  35. package/dist/analyzer/engine.js +1 -1
  36. package/dist/analyzer/engine.js.map +1 -1
  37. package/dist/cli.js +1190 -401
  38. package/dist/cli.js.map +1 -1
  39. package/dist/metrics.d.ts +51 -0
  40. package/dist/metrics.d.ts.map +1 -0
  41. package/dist/metrics.js +64 -0
  42. package/dist/metrics.js.map +1 -0
  43. package/dist/parser/lang-go.js +47 -47
  44. package/dist/parser/lang-java.js +29 -29
  45. package/dist/parser/lang-js.js +105 -105
  46. package/dist/parser/lang-php.js +38 -38
  47. package/dist/parser/lang-py.js +34 -34
  48. package/dist/parser/lang-ruby.js +14 -14
  49. package/dist/parser/lang-rust.js +30 -30
  50. package/dist/parser/lang-ts.js +191 -191
  51. package/dist/security/deps.d.ts +38 -0
  52. package/dist/security/deps.d.ts.map +1 -0
  53. package/dist/security/deps.js +685 -0
  54. package/dist/security/deps.js.map +1 -0
  55. package/dist/security/rules.d.ts +42 -0
  56. package/dist/security/rules.d.ts.map +1 -0
  57. package/dist/security/rules.js +940 -0
  58. package/dist/security/rules.js.map +1 -0
  59. package/dist/server/hooks.d.ts +26 -0
  60. package/dist/server/hooks.d.ts.map +1 -0
  61. package/dist/server/hooks.js +253 -0
  62. package/dist/server/hooks.js.map +1 -0
  63. package/dist/server/mcp-prompts.d.ts +277 -0
  64. package/dist/server/mcp-prompts.d.ts.map +1 -0
  65. package/dist/server/mcp-prompts.js +627 -0
  66. package/dist/server/mcp-prompts.js.map +1 -0
  67. package/dist/server/mcp.d.ts.map +1 -1
  68. package/dist/server/mcp.js +618 -643
  69. package/dist/server/mcp.js.map +1 -1
  70. package/dist/server/test-plan.d.ts +20 -0
  71. package/dist/server/test-plan.d.ts.map +1 -0
  72. package/dist/server/test-plan.js +100 -0
  73. package/dist/server/test-plan.js.map +1 -0
  74. package/dist/skills.js +152 -152
  75. package/dist/store/annotations.d.ts +41 -0
  76. package/dist/store/annotations.d.ts.map +1 -0
  77. package/dist/store/annotations.js +192 -0
  78. package/dist/store/annotations.js.map +1 -0
  79. package/dist/store/confidence.d.ts +18 -0
  80. package/dist/store/confidence.d.ts.map +1 -0
  81. package/dist/store/confidence.js +82 -0
  82. package/dist/store/confidence.js.map +1 -0
  83. package/dist/store/db.d.ts +37 -14
  84. package/dist/store/db.d.ts.map +1 -1
  85. package/dist/store/db.js +332 -239
  86. package/dist/store/db.js.map +1 -1
  87. package/dist/store/schema.sql +128 -116
  88. package/dist/store/vectors.js +2 -2
  89. package/dist/types.d.ts +101 -0
  90. package/dist/types.d.ts.map +1 -1
  91. package/docs/README.md +24 -0
  92. package/package.json +80 -66
  93. package/dist/gateway/analyzer.d.ts +0 -6
  94. package/dist/gateway/analyzer.d.ts.map +0 -1
  95. package/dist/gateway/analyzer.js +0 -218
  96. package/dist/gateway/analyzer.js.map +0 -1
  97. package/dist/gateway/cache.d.ts +0 -35
  98. package/dist/gateway/cache.d.ts.map +0 -1
  99. package/dist/gateway/cache.js +0 -175
  100. package/dist/gateway/cache.js.map +0 -1
  101. package/dist/gateway/config.d.ts +0 -10
  102. package/dist/gateway/config.d.ts.map +0 -1
  103. package/dist/gateway/config.js +0 -167
  104. package/dist/gateway/config.js.map +0 -1
  105. package/dist/gateway/context-memory.d.ts +0 -68
  106. package/dist/gateway/context-memory.d.ts.map +0 -1
  107. package/dist/gateway/context-memory.js +0 -157
  108. package/dist/gateway/context-memory.js.map +0 -1
  109. package/dist/gateway/observability.d.ts +0 -83
  110. package/dist/gateway/observability.d.ts.map +0 -1
  111. package/dist/gateway/observability.js +0 -152
  112. package/dist/gateway/observability.js.map +0 -1
  113. package/dist/gateway/privacy.d.ts +0 -27
  114. package/dist/gateway/privacy.d.ts.map +0 -1
  115. package/dist/gateway/privacy.js +0 -139
  116. package/dist/gateway/privacy.js.map +0 -1
  117. package/dist/gateway/providers.d.ts +0 -66
  118. package/dist/gateway/providers.d.ts.map +0 -1
  119. package/dist/gateway/providers.js +0 -377
  120. package/dist/gateway/providers.js.map +0 -1
  121. package/dist/gateway/router.d.ts +0 -18
  122. package/dist/gateway/router.d.ts.map +0 -1
  123. package/dist/gateway/router.js +0 -102
  124. package/dist/gateway/router.js.map +0 -1
  125. package/dist/gateway/server.d.ts +0 -20
  126. package/dist/gateway/server.d.ts.map +0 -1
  127. package/dist/gateway/server.js +0 -387
  128. package/dist/gateway/server.js.map +0 -1
  129. package/dist/gateway/translator.d.ts +0 -19
  130. package/dist/gateway/translator.d.ts.map +0 -1
  131. package/dist/gateway/translator.js +0 -340
  132. package/dist/gateway/translator.js.map +0 -1
  133. package/dist/gateway/types.d.ts +0 -215
  134. package/dist/gateway/types.d.ts.map +0 -1
  135. package/dist/gateway/types.js +0 -3
  136. package/dist/gateway/types.js.map +0 -1
  137. package/dist/store/gateway-schema.sql +0 -53
@@ -0,0 +1,224 @@
1
+ ---
2
+ name: milens-security-review
3
+ description: Security Audit — scan for secrets, hidden unicode, dangerous patterns, data leaks, and produce a security report
4
+ ---
5
+
6
+ # milens-security-review — Security Audit
7
+
8
+ Scan the codebase for security vulnerabilities: exposed secrets, hidden unicode (Trojan Source), dangerous code patterns, data leakage, and unexpected file changes.
9
+
10
+ ## Tools Required
11
+
12
+ | Tool | Purpose |
13
+ |---|---|
14
+ | `mcp_milens_review_pr` | Initial risk assessment of changed files and symbols |
15
+ | `mcp_milens_grep` | Pattern search for secrets, unicode, dangerous calls, data leaks |
16
+ | `mcp_milens_review_symbol` | Deep-dive risk analysis on high-risk symbols |
17
+ | `mcp_milens_detect_changes` | Verify only expected files changed |
18
+
19
+ > **CRITICAL:** All milens MCP tool calls MUST include the `repo` parameter set to the **absolute path of the workspace root**.
20
+
21
+ ## Workflow
22
+
23
+ ### Step 1: Initial Risk Assessment
24
+
25
+ Start with a PR-level overview to identify high-risk areas.
26
+
27
+ ```
28
+ mcp_milens_review_pr({repo: "<workspaceRoot>"})
29
+ ```
30
+
31
+ Focus on:
32
+ - **New files** — highest risk for secrets or vulnerabilities
33
+ - **Modified config files** — `.env`, `config.*`, settings files
34
+ - **Auth/routing files** — middleware, guards, session handlers
35
+ - **CRITICAL-rated symbols** — these get deep-dived in Step 6
36
+
37
+ ### Step 2: Secret Detection
38
+
39
+ Search for hardcoded secrets and credentials.
40
+
41
+ ```
42
+ mcp_milens_grep({pattern: "password|secret|api_key|token|private_key|AUTH_TOKEN", scope: "code", repo: "<workspaceRoot>"})
43
+ ```
44
+
45
+ Key patterns to flag:
46
+ - **Assignments to secrets** — `const apiKey = "sk-..."` (critical)
47
+ - **Config values** — `password: "admin123"` (high)
48
+ - **Variable names only** — `const apiKey = process.env.KEY` (low — already env-var'd)
49
+ - **Test fixtures** — `const testPassword = "..."` (verify it's not a real password)
50
+
51
+ ### Step 3: Hidden Unicode Detection (Trojan Source)
52
+
53
+ Search for invisible and bidirectional Unicode characters used in supply-chain attacks.
54
+
55
+ ```
56
+ mcp_milens_grep({pattern: "[\\u200B\\u200C\\u200D\\u2060\\uFEFF\\u202A-\\u202E]", scope: "code", isRegex: true, repo: "<workspaceRoot>"})
57
+ ```
58
+
59
+ These characters can:
60
+ - Make code look like one thing but compile as another
61
+ - Hide backdoors in copy-pasted code
62
+ - Exploit bidirectional text in string literals and comments
63
+
64
+ **Any match is a CRITICAL finding** — flag for immediate removal.
65
+
66
+ ### Step 4: Dangerous Code Patterns
67
+
68
+ Search for patterns that enable code injection or arbitrary execution.
69
+
70
+ ```
71
+ mcp_milens_grep({pattern: "eval\\(|exec\\(|child_process|Function\\(", scope: "code", isRegex: true, repo: "<workspaceRoot>"})
72
+ ```
73
+
74
+ Severity guidance:
75
+ - `eval()` / `exec()` with user input — **CRITICAL**
76
+ - `child_process.exec()` with dynamic arguments — **CRITICAL**
77
+ - `new Function()` — **HIGH** (eval equivalent)
78
+ - `child_process.spawn()` with fixed arguments — **LOW** (safer than exec)
79
+
80
+ ### Step 5: Data Leak Detection
81
+
82
+ Find logging statements that may expose sensitive data.
83
+
84
+ ```
85
+ mcp_milens_grep({pattern: "console\\.(log|debug|info)\\(", scope: "code", isRegex: true, repo: "<workspaceRoot>"})
86
+ ```
87
+
88
+ Flag any `console.log` that logs:
89
+ - User data (emails, names, PII)
90
+ - Tokens, passwords, keys
91
+ - Request bodies or headers
92
+ - Database query results with user data
93
+
94
+ ### Step 6: Deep-Dive on Critical Symbols
95
+
96
+ For any symbol flagged as CRITICAL in Step 1, run a deep-dive.
97
+
98
+ ```
99
+ mcp_milens_review_symbol({name: "<symbolName>", repo: "<workspaceRoot>"})
100
+ ```
101
+
102
+ This provides:
103
+ - **Role** — what the symbol does (auth, routing, data access)
104
+ - **Heat** — how frequently it changes (volatile code = higher risk)
105
+ - **Dependents** — blast radius if compromised
106
+ - **Test status** — whether its behavior is verified
107
+
108
+ ### Step 7: Verify Change Scope
109
+
110
+ Confirm that only expected files were modified.
111
+
112
+ ```
113
+ mcp_milens_detect_changes({repo: "<workspaceRoot>"})
114
+ ```
115
+
116
+ This catches:
117
+ - Unintended file modifications (config drift)
118
+ - Stray files included in the commit
119
+ - Missing or extra changes vs. expectations
120
+
121
+ ### Step 8: Produce Security Audit Report
122
+
123
+ Consolidate into a structured report:
124
+
125
+ 1. **Executive Summary** — overall risk level, critical findings count
126
+ 2. **Secret Scan Results** — each match with file, line, severity, and remediation
127
+ 3. **Unicode Scan Results** — each match (any match is critical)
128
+ 4. **Dangerous Patterns** — each `eval`/`exec`/`Function` usage with justification
129
+ 5. **Data Leak Findings** — each `console.log` that logs sensitive data
130
+ 6. **Symbol Risk Deep-Dives** — per CRITICAL symbol from Step 6
131
+ 7. **Change Scope Verification** — expected vs. actual changed files
132
+ 8. **Remediation Plan** — ordered by severity, with specific fix recommendations
133
+ 9. **Verdict** — PASSED / NEEDS REMEDIATION / BLOCKED
134
+
135
+ ## Example Session
136
+
137
+ ### Input
138
+
139
+ ```
140
+ "run a security audit before the release"
141
+ ```
142
+
143
+ ### Tool Calls
144
+
145
+ **Step 1 — PR overview:**
146
+ ```
147
+ mcp_milens_review_pr({repo: "/home/user/project"})
148
+ ```
149
+
150
+ **Output:** 8 changed files, 2 CRITICAL symbols (`authHandler`, `paymentProcessor`).
151
+
152
+ **Step 2 — Secret detection:**
153
+ ```
154
+ mcp_milens_grep({pattern: "password|secret|api_key|token|private_key|AUTH_TOKEN", scope: "code", repo: "/home/user/project"})
155
+ ```
156
+
157
+ **Output:**
158
+ ```
159
+ src/config.ts:12 apiKey: "sk-prod-abc123..." ← CRITICAL: hardcoded API key
160
+ src/auth/login.ts:34 const password = req.body.pass ← LOW: variable assignment
161
+ src/__tests__/helpers.ts:8 const testToken = "test" ← OK: test fixture
162
+ ```
163
+
164
+ **Step 3 — Unicode scan:**
165
+ ```
166
+ mcp_milens_grep({pattern: "[\\u200B\\u200C\\u200D\\u2060\\uFEFF\\u202A-\\u202E]", scope: "code", isRegex: true, repo: "/home/user/project"})
167
+ ```
168
+
169
+ **Output:** 0 matches. Clean.
170
+
171
+ **Step 4 — Dangerous patterns:**
172
+ ```
173
+ mcp_milens_grep({pattern: "eval\\(|exec\\(|child_process|Function\\(", scope: "code", isRegex: true, repo: "/home/user/project"})
174
+ ```
175
+
176
+ **Output:**
177
+ ```
178
+ src/scripts/migrate.ts:22 exec(`pg_dump ${dbName}`) ← CRITICAL: dynamic args
179
+ ```
180
+
181
+ **Step 5 — Data leak:**
182
+ ```
183
+ mcp_milens_grep({pattern: "console\\.(log|debug|info)\\(", scope: "code", isRegex: true, repo: "/home/user/project"})
184
+ ```
185
+
186
+ **Output:**
187
+ ```
188
+ src/auth/login.ts:28 console.log("User login:", email) ← HIGH: logs PII
189
+ ```
190
+
191
+ **Step 6 — Deep-dive:**
192
+ ```
193
+ mcp_milens_review_symbol({name: "authHandler", repo: "/home/user/project"})
194
+ ```
195
+
196
+ **Output:** Core auth entry point, 23 dependents, 0 tests — very high risk.
197
+
198
+ **Step 7 — Verify scope:**
199
+ ```
200
+ mcp_milens_detect_changes({repo: "/home/user/project"})
201
+ ```
202
+
203
+ **Output:** 8 files changed — matches expectations.
204
+
205
+ **Step 8 — Report produced** (see report format above). Verdict: **NEEDS REMEDIATION** (1 critical secret, 1 critical dangerous pattern, 1 high data leak).
206
+
207
+ ## Best Practices
208
+
209
+ 1. **Don't assume variable names are safe.** `const password = process.env.DB_PASS` is fine; `const password = "admin123"` is not. Read the value, not just the name.
210
+ 2. **Unicode scan is non-negotiable.** Trojan Source attacks are invisible to human reviewers. Even a single zero-width character match is a blocking finding.
211
+ 3. **Test fixtures get a pass — but verify.** `const testApiKey = "test-key"` is acceptable, but `const testApiKey = "sk-live-..."` is a leaked production key.
212
+ 4. **Dynamic exec/Function is almost always wrong.** If `exec()` takes user-controlled input, it's remote code execution. The only acceptable pattern is fully-hardcoded command strings.
213
+ 5. **Detect changes verifies the boundary.** If `detect_changes` shows files you didn't touch, something went wrong — config drift, lockfile churn, or accidental staging.
214
+
215
+ ## Quality Gate
216
+
217
+ | Criteria | Pass | Fail |
218
+ |---|---|---|
219
+ | Secret scan | No hardcoded secrets found outside test fixtures | Any production secret in code |
220
+ | Unicode scan | Zero matches | Any hidden unicode character found |
221
+ | Dangerous patterns | No `eval`/`exec` with dynamic input | Any dynamic `exec()` or `Function()` call |
222
+ | Data leak | No PII/credentials in `console.log` | Sensitive data logged to console |
223
+ | Change scope | `detect_changes` matches expectations | Unexpected files in the diff |
224
+ | All scans completed | All 7 steps executed | Any tool call skipped or failed |
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: milens-tdd
3
+ description: Test-Driven Development with Code Intelligence — find gaps, generate test plans, implement, and verify
4
+ ---
5
+
6
+ # milens-tdd — Test-Driven Development with Code Intelligence
7
+
8
+ Identify untested symbols ranked by risk, generate targeted test strategies, implement tests, and verify coverage.
9
+
10
+ ## Tools Required
11
+
12
+ | Tool | Purpose |
13
+ |---|---|
14
+ | `mcp_milens_test_coverage_gaps` | Find untested symbols sorted by risk |
15
+ | `mcp_milens_test_plan` | Generate mock strategy and test scenarios for a symbol |
16
+ | `mcp_milens_test_impact` | Identify affected test files after changes |
17
+ | `mcp_milens_review_pr` | Post-change quality check for CRITICAL issues |
18
+
19
+ > **CRITICAL:** All milens MCP tool calls MUST include the `repo` parameter set to the **absolute path of the workspace root**.
20
+
21
+ ## Workflow
22
+
23
+ ### Step 1: Identify Untested Symbols
24
+
25
+ Start by finding symbols with no test coverage, sorted by risk (hotspots first).
26
+
27
+ ```
28
+ mcp_milens_test_coverage_gaps({repo: "<workspaceRoot>", limit: 10})
29
+ ```
30
+
31
+ Review the output:
32
+ - **HIGH risk symbols** — complex logic, high fan-in, many dependents. Prioritize these.
33
+ - **MEDIUM risk symbols** — moderate complexity, some dependents.
34
+ - **LOW risk symbols** — simple getters, one-liners. Lowest priority.
35
+
36
+ ### Step 2: Generate Test Plans
37
+
38
+ For each high-risk symbol identified in Step 1, request a test plan.
39
+
40
+ ```
41
+ mcp_milens_test_plan({name: "<symbolName>", repo: "<workspaceRoot>"})
42
+ ```
43
+
44
+ The test plan provides:
45
+ - **Mock strategy** — what to stub, what to isolate
46
+ - **3+ test scenarios** — happy path, edge cases, error states
47
+ - **Setup requirements** — dependencies to initialize
48
+ - **Expected assertions** — what each test should verify
49
+
50
+ ### Step 3: Implement Tests
51
+
52
+ Write test files based on the test plan output:
53
+
54
+ 1. Check if test files already exist for the module
55
+ 2. Follow existing test patterns in the codebase (frameworks, conventions, helper utilities)
56
+ 3. Implement each test scenario from the plan
57
+ 4. Keep tests focused — one behavior per test
58
+
59
+ ### Step 4: Verify Test Impact
60
+
61
+ After writing tests, confirm which test files changed and should run.
62
+
63
+ ```
64
+ mcp_milens_test_impact({repo: "<workspaceRoot>"})
65
+ ```
66
+
67
+ This lists all test files affected by the current changes. Run those tests to validate.
68
+
69
+ ### Step 5: Quality Check
70
+
71
+ Run the PR review to catch any CRITICAL issues before committing.
72
+
73
+ ```
74
+ mcp_milens_review_pr({repo: "<workspaceRoot>"})
75
+ ```
76
+
77
+ Address any CRITICAL or HIGH findings before completing the cycle.
78
+
79
+ ## Example Session
80
+
81
+ ### Input
82
+
83
+ ```
84
+ "add tests for the resolveLinks function"
85
+ ```
86
+
87
+ ### Tool Calls
88
+
89
+ **Step 1 — Find gaps:**
90
+ ```
91
+ mcp_milens_test_coverage_gaps({repo: "/home/user/project", limit: 10})
92
+ ```
93
+
94
+ **Output:**
95
+ ```
96
+ Coverage Gaps (untested exported symbols):
97
+ 1. resolveLinks [function] — HIGH risk (12 dependents, 8 callers)
98
+ 2. parseConfig [function] — MEDIUM risk (5 dependents)
99
+ 3. formatOutput [function] — LOW risk (1 dependent)
100
+ ...
101
+ ```
102
+
103
+ **Step 2 — Test plan for high-risk:**
104
+ ```
105
+ mcp_milens_test_plan({name: "resolveLinks", repo: "/home/user/project"})
106
+ ```
107
+
108
+ **Output:**
109
+ ```
110
+ Test Plan for resolveLinks:
111
+ Mock strategy: stub loadAliases, stub database queries
112
+ Tests:
113
+ 1. resolves direct links between two symbols
114
+ 2. handles circular dependency chain gracefully
115
+ 3. returns empty array when no links found
116
+ 4. throws on malformed symbol data
117
+ Setup: import SymbolLink from '@/types', mock store layer
118
+ ```
119
+
120
+ **Step 3 — Implement tests** in `src/__tests__/resolver.test.ts`
121
+
122
+ **Step 4 — Verify:**
123
+ ```
124
+ mcp_milens_test_impact({repo: "/home/user/project"})
125
+ ```
126
+
127
+ **Output:**
128
+ ```
129
+ Affected test files:
130
+ src/__tests__/resolver.test.ts (new)
131
+ src/__tests__/analyzer.test.ts (modified, re-export impact)
132
+ ```
133
+
134
+ **Step 5 — Quality:**
135
+ ```
136
+ mcp_milens_review_pr({repo: "/home/user/project"})
137
+ ```
138
+
139
+ **Output:** No CRITICAL issues. 2 LOW suggestions.
140
+
141
+ ## Best Practices
142
+
143
+ 1. **Prioritize by risk, not alphabetically.** A HIGH-risk utility with 50 callers matters more than a LOW-risk getter nobody uses.
144
+ 2. **Don't test implementation details.** Follow the test plan's mock strategy — stub at module boundaries, not internal functions.
145
+ 3. **One behavior per test.** Each test should verify a single scenario (happy path, edge case, error) with a descriptive name.
146
+ 4. **Verify before commit.** Always run Step 4 (`test_impact`) and Step 5 (`review_pr`) before merging. Don't skip the quality gate.
147
+ 5. **Re-check gaps after large refactors.** A refactor can move symbols from "tested" back to "untested."
148
+
149
+ ## Quality Gate
150
+
151
+ | Criteria | Pass | Fail |
152
+ |---|---|---|
153
+ | Test coverage gaps | HIGH-risk symbols have tests | HIGH-risk symbols still uncovered after session |
154
+ | Test plan adherence | ≥3 scenarios implemented per symbol | Tests don't match plan scenarios |
155
+ | Test impact verification | All affected test files pass | Any test file fails |
156
+ | PR review | No CRITICAL issues | Unresolved CRITICAL issues remain |
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: milens-parser
3
+ description: Code intelligence for the parser area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Parser
7
+
8
+ ## Overview
9
+ Contains 76 symbols (26 exported) across 15 files.
10
+
11
+ ## Key Symbols
12
+ - **`LangSpec`** [interface] (src/parser/extract.ts:6) — 30 refs
13
+ - **`loadLanguage`** [function] (src/parser/loader.ts:21) — 10 refs
14
+ - **`getParser`** [function] (src/parser/loader.ts:32) — 9 refs
15
+ - **`extractFromTree`** [function] (src/parser/extract.ts:250) — 6 refs
16
+ - **`extractHtmlScripts`** [function] (src/parser/lang-html.ts:33) — 5 refs
17
+ - **`extractMarkdown`** [function] (src/parser/lang-md.ts:34) — 5 refs
18
+ - **`extractVueScript`** [function] (src/parser/lang-vue.ts:18) — 5 refs
19
+ - **`extractHtmlRefs`** [function] (src/parser/lang-html.ts:52) — 4 refs
20
+ - **`extractVueTemplateRefs`** [function] (src/parser/lang-vue.ts:37) — 4 refs
21
+ - **`spec`** [variable] (src/parser/lang-js.ts:5) — 3 refs
22
+ - **`spec`** [variable] (src/parser/lang-ts.ts:5) — 3 refs
23
+ - **`clearQueryCache`** [function] (src/parser/extract.ts:67) — 2 refs
24
+ - **`spec`** [variable] (src/parser/lang-css.ts:5) — 2 refs
25
+ - **`spec`** [variable] (src/parser/lang-go.ts:5) — 2 refs
26
+ - **`spec`** [variable] (src/parser/lang-py.ts:5) — 2 refs
27
+
28
+ ## Entry Points
29
+ - **`LangSpec`** [interface] — 30 incoming references
30
+ - **`loadLanguage`** [function] — 10 incoming references
31
+ - **`getParser`** [function] — 9 incoming references
32
+ - **`extractFromTree`** [function] — 6 incoming references
33
+ - **`extractHtmlScripts`** [function] — 5 incoming references
34
+
35
+ ## Dependencies
36
+ - **root**: `CodeSymbol`, `RawImport`, `RawCall`, `RawHeritage`, `RawReExport`, `RawTypeBinding`, `RawAssignmentBinding`, `RawReturnType` (+4 more)
37
+ - **analyzer**: `find`, `resolve`
38
+ - **store**: `load`
39
+
40
+ ## Used By
41
+ - **analyzer**: `langForFile`, `getParser`, `loadLanguage`, `extractFromTree`, `clearQueryCache`, `extractVueScript`, `extractVueTemplateRefs`, `extractHtmlScripts` (+6 more)
42
+ - **server**: `getParser`, `loadLanguage`, `ALL_LANGS`
43
+ - **test**: `getParser`, `loadLanguage`, `extractFromTree`, `extractVueScript`, `extractVueTemplateRefs`, `spec`, `extractHtmlScripts`, `extractHtmlRefs` (+2 more)
44
+
45
+ ## Files
46
+ - src/parser/extract.ts
47
+ - src/parser/lang-css.ts
48
+ - src/parser/lang-go.ts
49
+ - src/parser/lang-html.ts
50
+ - src/parser/lang-java.ts
51
+ - src/parser/lang-js.ts
52
+ - src/parser/lang-md.ts
53
+ - src/parser/lang-php.ts
54
+ - src/parser/lang-py.ts
55
+ - src/parser/lang-ruby.ts
56
+ - src/parser/lang-rust.ts
57
+ - src/parser/lang-ts.ts
58
+ - src/parser/lang-vue.ts
59
+ - src/parser/languages.ts
60
+ - src/parser/loader.ts
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: milens-root
3
+ description: Code intelligence for the root area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Root
7
+
8
+ ## Overview
9
+ Contains 257 symbols (206 exported) across 14 files.
10
+
11
+ ## Key Symbols
12
+ - **`CodeSymbol`** [interface] (src/types.ts:8) — 30 refs
13
+ - **`SymbolLink`** [interface] (src/types.ts:26) — 13 refs
14
+ - **`isTestFile`** [function] (src/utils.ts:2) — 9 refs
15
+ - **`RawCall`** [interface] (src/types.ts:44) — 7 refs
16
+ - **`RawImport`** [interface] (src/types.ts:35) — 6 refs
17
+ - **`ExtractionResult`** [interface] (src/types.ts:60) — 6 refs
18
+ - **`RawHeritage`** [interface] (src/types.ts:52) — 4 refs
19
+ - **`RawTypeBinding`** [interface] (src/types.ts:80) — 4 refs
20
+ - **`RawAssignmentBinding`** [interface] (src/types.ts:88) — 4 refs
21
+ - **`RawReturnType`** [interface] (src/types.ts:96) — 4 refs
22
+ - **`RawCallResultBinding`** [interface] (src/types.ts:104) — 4 refs
23
+ - **`RawReExport`** [interface] (src/types.ts:73) — 3 refs
24
+ - **`Annotation`** [interface] (src/types.ts:138) — 3 refs
25
+ - **`generateAgentsMd`** [function] (src/agents-md.ts:43) — 2 refs
26
+ - **`computeMetrics`** [function] (src/metrics.ts:21) — 2 refs
27
+
28
+ ## Entry Points
29
+ - **`CodeSymbol`** [interface] — 30 incoming references
30
+ - **`has`** [function] — 26 incoming references
31
+ - **`SymbolLink`** [interface] — 13 incoming references
32
+ - **`isTestFile`** [function] — 9 incoming references
33
+ - **`RawCall`** [interface] — 7 incoming references
34
+
35
+ ## Dependencies
36
+ - **store**: `Database`, `RepoRegistry`, `AnnotationStore`, `runDecayPass`, `getIncomingLinks`, `getAllSymbols`, `getCodebaseSummary`, `register` (+23 more)
37
+ - **analyzer**: `loadAliases`, `analyze`, `resolve`, `clear`
38
+ - **server**: `startHttp`, `startStdio`, `HookManager`, `get`, `enableHook`, `loadConfig`, `saveConfig`, `disableHook`
39
+ - **security**: `loadRules`, `auditDependencies`
40
+ - **scripts**: `outDir`
41
+
42
+ ## Used By
43
+ - **analyzer**: `isTestFile`, `CodeSymbol`, `ExtractionResult`, `RawImport`, `RawCall`, `RawHeritage`, `RawReExport`, `RawTypeBinding` (+8 more)
44
+ - **parser**: `CodeSymbol`, `RawImport`, `RawCall`, `RawHeritage`, `RawReExport`, `RawTypeBinding`, `RawAssignmentBinding`, `RawReturnType` (+4 more)
45
+ - **store**: `Annotation`, `AnnotationKey`, `Session`, `EvolutionEvent`, `CodeSymbol`, `SymbolLink`, `RepoEntry`, `has` (+1 more)
46
+ - **test**: `CodeSymbol`, `SymbolLink`, `RawImport`, `RawCall`, `RawHeritage`, `RawTypeBinding`, `RawAssignmentBinding`, `RawReturnType` (+2 more)
47
+ - **security**: `has`
48
+ - **server**: `has`
49
+
50
+ ## Files
51
+ - AGENTS.md
52
+ - CLAUDE.md
53
+ - CONTRIBUTING.md
54
+ - DEPLOY.md
55
+ - README.md
56
+ - TODO.md
57
+ - TODO2.md
58
+ - src/agents-md.ts
59
+ - src/cli.ts
60
+ - src/metrics.ts
61
+ - src/skills.ts
62
+ - src/types.ts
63
+ - src/utils.ts
64
+ - vitest.config.ts
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: milens-scripts
3
+ description: Code intelligence for the scripts area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Scripts
7
+
8
+ ## Overview
9
+ Contains 29 symbols (0 exported) across 1 files.
10
+
11
+ ## Entry Points
12
+ - **`run`** [function] — 22 incoming references
13
+ - **`ROOT`** [variable] — 2 incoming references
14
+ - **`outDir`** [variable] — 2 incoming references
15
+ - **`resolveTargets`** [function] — 1 incoming references
16
+ - **`__dirname`** [variable] — 1 incoming references
17
+
18
+ ## Dependencies
19
+ - **analyzer**: `resolve`
20
+
21
+ ## Used By
22
+ - **root**: `outDir`
23
+ - **store**: `run`
24
+ - **test**: `run`
25
+
26
+ ## Files
27
+ - scripts/build-standalone.mjs
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: milens-security
3
+ description: Code intelligence for the security area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Security
7
+
8
+ ## Overview
9
+ Contains 35 symbols (15 exported) across 2 files.
10
+
11
+ ## Key Symbols
12
+ - **`loadRules`** [function] (src/security/rules.ts:1044) — 4 refs
13
+ - **`Ecosystem`** [type] (src/security/deps.ts:8) — 3 refs
14
+ - **`auditDependencies`** [function] (src/security/deps.ts:732) — 2 refs
15
+ - **`VulnerabilityReport`** [interface] (src/security/deps.ts:26) — 2 refs
16
+ - **`detectEcosystem`** [function] (src/security/deps.ts:512) — 1 refs
17
+ - **`parseDependencies`** [function] (src/security/deps.ts:524) — 1 refs
18
+ - **`checkVulnerabilities`** [function] (src/security/deps.ts:687) — 1 refs
19
+ - **`SecurityCategory`** [type] (src/security/rules.ts:3) — 1 refs
20
+ - **`Dependency`** [interface] (src/security/deps.ts:10) — 0 refs
21
+ - **`Vulnerability`** [interface] (src/security/deps.ts:16) — 0 refs
22
+ - **`getRulesByCategory`** [function] (src/security/rules.ts:1048) — 0 refs
23
+ - **`getRulesBySeverity`** [function] (src/security/rules.ts:1052) — 0 refs
24
+ - **`SecurityRule`** [interface] (src/security/rules.ts:14) — 0 refs
25
+ - **`SecurityMatch`** [interface] (src/security/rules.ts:29) — 0 refs
26
+ - **`SecurityReport`** [interface] (src/security/rules.ts:41) — 0 refs
27
+
28
+ ## Entry Points
29
+ - **`readManifest`** [function] — 6 incoming references
30
+ - **`loadRules`** [function] — 4 incoming references
31
+ - **`Ecosystem`** [type] — 3 incoming references
32
+ - **`manifestExists`** [function] — 2 incoming references
33
+ - **`parseSemver`** [function] — 2 incoming references
34
+
35
+ ## Dependencies
36
+ - **root**: `has`
37
+
38
+ ## Used By
39
+ - **root**: `loadRules`, `auditDependencies`
40
+ - **server**: `loadRules`
41
+
42
+ ## Files
43
+ - src/security/deps.ts
44
+ - src/security/rules.ts
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: milens-server
3
+ description: Code intelligence for the server area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Server
7
+
8
+ ## Overview
9
+ Contains 74 symbols (12 exported) across 4 files.
10
+
11
+ ## Key Symbols
12
+ - **`HookConfig`** [interface] (src/server/hooks.ts:5) — 3 refs
13
+ - **`HookManager`** [class] (src/server/hooks.ts:43) — 2 refs
14
+ - **`SessionContext`** [interface] (src/server/hooks.ts:15) — 2 refs
15
+ - **`registerAllPrompts`** [function] (src/server/mcp-prompts.ts:637) — 2 refs
16
+ - **`createMcpServer`** [function] (src/server/mcp.ts:367) — 2 refs
17
+ - **`startStdio`** [function] (src/server/mcp.ts:2289) — 2 refs
18
+ - **`startHttp`** [function] (src/server/mcp.ts:2297) — 2 refs
19
+ - **`generateTestPlan`** [function] (src/server/test-plan.ts:14) — 2 refs
20
+ - **`defaultOnSessionStart`** [function] (src/server/hooks.ts:100) — 0 refs
21
+ - **`defaultOnSessionEnd`** [function] (src/server/hooks.ts:164) — 0 refs
22
+ - **`defaultOnPreCommit`** [function] (src/server/hooks.ts:227) — 0 refs
23
+ - **`TestPlan`** [interface] (src/server/test-plan.ts:3) — 0 refs
24
+
25
+ ## Entry Points
26
+ - **`get`** [method] — 8 incoming references
27
+ - **`loadConfig`** [method] — 3 incoming references
28
+ - **`saveConfig`** [method] — 3 incoming references
29
+ - **`HookConfig`** [interface] — 3 incoming references
30
+ - **`HookManager`** [class] — 2 incoming references
31
+
32
+ ## Dependencies
33
+ - **store**: `Database`, `AnnotationStore`, `RepoRegistry`, `getCodebaseSummary`, `recall`, `close`, `getStats`, `getTestCoverage` (+33 more)
34
+ - **analyzer**: `reviewPr`, `resolve`, `find`
35
+ - **parser**: `getParser`, `loadLanguage`, `ALL_LANGS`
36
+ - **security**: `loadRules`
37
+ - **root**: `has`
38
+
39
+ ## Used By
40
+ - **root**: `startHttp`, `startStdio`, `HookManager`, `get`, `enableHook`, `loadConfig`, `saveConfig`, `disableHook`
41
+
42
+ ## Files
43
+ - src/server/hooks.ts
44
+ - src/server/mcp-prompts.ts
45
+ - src/server/mcp.ts
46
+ - src/server/test-plan.ts
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: milens-store
3
+ description: Code intelligence for the store area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Store
7
+
8
+ ## Overview
9
+ Contains 128 symbols (14 exported) across 5 files.
10
+
11
+ ## Key Symbols
12
+ - **`Database`** [class] (src/store/db.ts:10) — 42 refs
13
+ - **`AnnotationStore`** [class] (src/store/annotations.ts:10) — 14 refs
14
+ - **`RepoRegistry`** [class] (src/store/registry.ts:18) — 6 refs
15
+ - **`buildEmbeddingText`** [function] (src/store/vectors.ts:250) — 4 refs
16
+ - **`TfIdfProvider`** [class] (src/store/vectors.ts:44) — 4 refs
17
+ - **`EmbeddingStore`** [class] (src/store/vectors.ts:170) — 4 refs
18
+ - **`runDecayPass`** [function] (src/store/confidence.ts:84) — 2 refs
19
+ - **`EmbeddingProvider`** [interface] (src/store/vectors.ts:15) — 2 refs
20
+ - **`decayConfidence`** [function] (src/store/confidence.ts:21) — 1 refs
21
+ - **`boostConfidence`** [function] (src/store/confidence.ts:4) — 0 refs
22
+ - **`getStaleAnnotations`** [function] (src/store/confidence.ts:37) — 0 refs
23
+ - **`promoteSecurityAnnotations`** [function] (src/store/confidence.ts:47) — 0 refs
24
+ - **`NeuralProvider`** [class] (src/store/vectors.ts:122) — 0 refs
25
+ - **`SimilarResult`** [interface] (src/store/vectors.ts:23) — 0 refs
26
+
27
+ ## Entry Points
28
+ - **`Database`** [class] — 42 incoming references
29
+ - **`get`** [method] — 21 incoming references
30
+ - **`close`** [method] — 16 incoming references
31
+ - **`AnnotationStore`** [class] — 14 incoming references
32
+ - **`rowToSymbol`** [function] — 13 incoming references
33
+
34
+ ## Dependencies
35
+ - **root**: `Annotation`, `AnnotationKey`, `Session`, `EvolutionEvent`, `CodeSymbol`, `SymbolLink`, `RepoEntry`, `has` (+1 more)
36
+ - **scripts**: `run`
37
+ - **analyzer**: `find`, `resolve`
38
+
39
+ ## Used By
40
+ - **root**: `Database`, `RepoRegistry`, `AnnotationStore`, `runDecayPass`, `getIncomingLinks`, `getAllSymbols`, `getCodebaseSummary`, `register` (+23 more)
41
+ - **analyzer**: `Database`, `TfIdfProvider`, `EmbeddingStore`, `buildEmbeddingText`, `get`, `clear`, `isFileUpToDate`, `upsertFileHash` (+22 more)
42
+ - **server**: `Database`, `AnnotationStore`, `RepoRegistry`, `getCodebaseSummary`, `recall`, `close`, `getStats`, `getTestCoverage` (+33 more)
43
+ - **test**: `Database`, `RepoRegistry`, `TfIdfProvider`, `EmbeddingStore`, `buildEmbeddingText`, `close`, `insertSymbol`, `findSymbolByName` (+44 more)
44
+ - **apps**: `remove`, `Database`, `getCodebaseSummary`, `close`
45
+ - **docs**: `remove`
46
+ - **parser**: `load`
47
+
48
+ ## Files
49
+ - src/store/annotations.ts
50
+ - src/store/confidence.ts
51
+ - src/store/db.ts
52
+ - src/store/registry.ts
53
+ - src/store/vectors.ts