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,31 @@
1
+ ---
2
+ name: milens-adapters
3
+ description: Code intelligence for the adapters area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Adapters
7
+
8
+ ## Overview
9
+ Contains 30 symbols (27 exported) across 3 files.
10
+
11
+ ## Key Symbols
12
+ - **`Milens — Code Intelligence for Claude Code`** [section] (adapters/claude-code/CLAUDE.md:1) — 0 refs
13
+ - **`Available Tools`** [section] (adapters/claude-code/CLAUDE.md:5) — 0 refs
14
+ - **`Session Workflow`** [section] (adapters/claude-code/CLAUDE.md:25) — 0 refs
15
+ - **`Edit Safety (Mandatory)`** [section] (adapters/claude-code/CLAUDE.md:33) — 0 refs
16
+ - **`Tool Selection`** [section] (adapters/claude-code/CLAUDE.md:49) — 0 refs
17
+ - **`Reference`** [section] (adapters/claude-code/CLAUDE.md:55) — 0 refs
18
+ - **`Milens — Code Intelligence for OpenCode`** [section] (adapters/opencode/AGENTS.md:1) — 0 refs
19
+ - **`Available Tools`** [section] (adapters/opencode/AGENTS.md:5) — 0 refs
20
+ - **`Session Workflow`** [section] (adapters/opencode/AGENTS.md:25) — 0 refs
21
+ - **`Edit Safety (Mandatory)`** [section] (adapters/opencode/AGENTS.md:33) — 0 refs
22
+ - **`Tool Selection`** [section] (adapters/opencode/AGENTS.md:49) — 0 refs
23
+ - **`Reference`** [section] (adapters/opencode/AGENTS.md:55) — 0 refs
24
+ - **`Milens Adapter Packs`** [section] (adapters/README.md:1) — 0 refs
25
+ - **`What is milens?`** [section] (adapters/README.md:5) — 0 refs
26
+ - **`Available Adapters`** [section] (adapters/README.md:9) — 0 refs
27
+
28
+ ## Files
29
+ - adapters/README.md
30
+ - adapters/claude-code/CLAUDE.md
31
+ - adapters/opencode/AGENTS.md
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: milens-analyzer
3
+ description: Code intelligence for the analyzer area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Analyzer
7
+
8
+ ## Overview
9
+ Contains 79 symbols (21 exported) across 7 files.
10
+
11
+ ## Key Symbols
12
+ - **`resolveLinksWithStats`** [function] (src/analyzer/resolver.ts:35) — 5 refs
13
+ - **`loadAliases`** [function] (src/analyzer/config.ts:10) — 4 refs
14
+ - **`analyze`** [function] (src/analyzer/engine.ts:106) — 4 refs
15
+ - **`scanFiles`** [function] (src/analyzer/scanner.ts:11) — 4 refs
16
+ - **`resolveLinks`** [function] (src/analyzer/resolver.ts:30) — 3 refs
17
+ - **`reviewPr`** [function] (src/analyzer/review.ts:101) — 3 refs
18
+ - **`enrichMetadata`** [function] (src/analyzer/enrich.ts:21) — 2 refs
19
+ - **`reviewSymbol`** [function] (src/analyzer/review.ts:167) — 2 refs
20
+ - **`generateTestPlan`** [function] (src/analyzer/testplan.ts:104) — 2 refs
21
+ - **`findCoverageGaps`** [function] (src/analyzer/testplan.ts:175) — 2 refs
22
+ - **`ResolutionResult`** [interface] (src/analyzer/resolver.ts:22) — 1 refs
23
+ - **`ReviewResult`** [interface] (src/analyzer/review.ts:17) — 1 refs
24
+ - **`RiskLevel`** [type] (src/analyzer/review.ts:6) — 1 refs
25
+ - **`TestImpactResult`** [interface] (src/analyzer/testplan.ts:35) — 1 refs
26
+ - **`SymbolRisk`** [interface] (src/analyzer/review.ts:8) — 0 refs
27
+
28
+ ## Entry Points
29
+ - **`find`** [function] — 19 incoming references
30
+ - **`resolve`** [method] — 11 incoming references
31
+ - **`resolveLinksWithStats`** [function] — 5 incoming references
32
+ - **`loadAliases`** [function] — 4 incoming references
33
+ - **`analyze`** [function] — 4 incoming references
34
+
35
+ ## Dependencies
36
+ - **parser**: `langForFile`, `getParser`, `loadLanguage`, `extractFromTree`, `clearQueryCache`, `extractVueScript`, `extractVueTemplateRefs`, `extractHtmlScripts` (+6 more)
37
+ - **root**: `isTestFile`, `CodeSymbol`, `ExtractionResult`, `RawImport`, `RawCall`, `RawHeritage`, `RawReExport`, `RawTypeBinding` (+8 more)
38
+ - **store**: `Database`, `TfIdfProvider`, `EmbeddingStore`, `buildEmbeddingText`, `get`, `clear`, `isFileUpToDate`, `upsertFileHash` (+22 more)
39
+
40
+ ## Used By
41
+ - **root**: `loadAliases`, `analyze`, `resolve`, `clear`
42
+ - **server**: `reviewPr`, `resolve`, `find`
43
+ - **test**: `resolveLinks`, `resolveLinksWithStats`, `reviewSymbol`, `scanFiles`, `generateTestPlan`, `findCoverageGaps`, `analyze`, `loadAliases` (+1 more)
44
+ - **scripts**: `resolve`
45
+ - **parser**: `find`, `resolve`
46
+ - **store**: `find`, `resolve`
47
+
48
+ ## Files
49
+ - src/analyzer/config.ts
50
+ - src/analyzer/engine.ts
51
+ - src/analyzer/enrich.ts
52
+ - src/analyzer/resolver.ts
53
+ - src/analyzer/review.ts
54
+ - src/analyzer/scanner.ts
55
+ - src/analyzer/testplan.ts
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: milens-apps
3
+ description: Code intelligence for the apps area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Apps
7
+
8
+ ## Overview
9
+ Contains 34 symbols (12 exported) across 10 files.
10
+
11
+ ## Key Symbols
12
+ - **`Milens Desktop Dashboard`** [section] (apps/dashboard/README.md:1) — 0 refs
13
+ - **`Features`** [section] (apps/dashboard/README.md:5) — 0 refs
14
+ - **`Development`** [section] (apps/dashboard/README.md:13) — 0 refs
15
+ - **`Build`** [section] (apps/dashboard/README.md:19) — 0 refs
16
+ - **`Milens GitHub App`** [section] (apps/github/README.md:1) — 0 refs
17
+ - **`Features`** [section] (apps/github/README.md:5) — 0 refs
18
+ - **`Deployment`** [section] (apps/github/README.md:10) — 0 refs
19
+ - **`Local Development`** [section] (apps/github/README.md:15) — 0 refs
20
+ - **`AgentsMdGenerator`** [class] (apps/github/generators/agents-md.js:1) — 0 refs
21
+ - **`SecurityGenerator`** [class] (apps/github/generators/security.js:1) — 0 refs
22
+ - **`SkillsGenerator`** [class] (apps/github/generators/skills.js:1) — 0 refs
23
+ - **`MilensRunner`** [class] (apps/github/handlers/milens-runner.js:6) — 0 refs
24
+
25
+ ## Entry Points
26
+ - **`createWindow`** [function] — 1 incoming references
27
+ - **`__dirname`** [variable] — 1 incoming references
28
+
29
+ ## Dependencies
30
+ - **store**: `remove`, `Database`, `getCodebaseSummary`, `close`
31
+
32
+ ## Files
33
+ - apps/dashboard/README.md
34
+ - apps/dashboard/index.html
35
+ - apps/dashboard/main.js
36
+ - apps/dashboard/preload.js
37
+ - apps/github/README.md
38
+ - apps/github/app.js
39
+ - apps/github/generators/agents-md.js
40
+ - apps/github/generators/security.js
41
+ - apps/github/generators/skills.js
42
+ - apps/github/handlers/milens-runner.js
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: milens-docs
3
+ description: Code intelligence for the docs area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Docs
7
+
8
+ ## Overview
9
+ Contains 266 symbols (253 exported) across 12 files.
10
+
11
+ ## Key Symbols
12
+ - **`Adapter Packs`** [section] (docs/adapters.md:1) — 0 refs
13
+ - **`Available Adapters`** [section] (docs/adapters.md:5) — 0 refs
14
+ - **`Quick Install`** [section] (docs/adapters.md:17) — 0 refs
15
+ - **`Claude Code`** [section] (docs/adapters.md:21) — 0 refs
16
+ - **`OpenCode`** [section] (docs/adapters.md:29) — 0 refs
17
+ - **`Cursor`** [section] (docs/adapters.md:36) — 0 refs
18
+ - **`GitHub Copilot`** [section] (docs/adapters.md:42) — 0 refs
19
+ - **`Codex`** [section] (docs/adapters.md:48) — 0 refs
20
+ - **`Gemini`** [section] (docs/adapters.md:54) — 0 refs
21
+ - **`Zed`** [section] (docs/adapters.md:60) — 0 refs
22
+ - **`Automated Install`** [section] (docs/adapters.md:66) — 0 refs
23
+ - **`Profile Selection`** [section] (docs/adapters.md:74) — 0 refs
24
+ - **`MCP Config Reference`** [section] (docs/adapters.md:86) — 0 refs
25
+ - **`Hệ thống Khép kín Tuần hoàn cho AI-Driven Development`** [section] (docs/closed-loop-ai-development.md:1) — 0 refs
26
+ - **`Mục lục`** [section] (docs/closed-loop-ai-development.md:9) — 0 refs
27
+
28
+ ## Entry Points
29
+ - **`applyFilters`** [function] — 1 incoming references
30
+
31
+ ## Dependencies
32
+ - **store**: `remove`
33
+
34
+ ## Files
35
+ - docs/README.md
36
+ - docs/adapters.md
37
+ - docs/closed-loop-ai-development.md
38
+ - docs/ecc-milens-vibe-code.md
39
+ - docs/index.html
40
+ - docs/pricing.html
41
+ - docs/pricing.md
42
+ - docs/quickstart.md
43
+ - docs/security-presets.md
44
+ - docs/security.html
45
+ - docs/skills.html
46
+ - docs/tools.md
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: milens
3
+ description: Code intelligence MCP tools — symbol search, text grep, impact analysis, dependency graph
4
+ ---
5
+
6
+ <!-- milens:start -->
7
+ # Milens — Code Intelligence (MCP)
8
+
9
+ This project is indexed by milens (1137 symbols, 1592 links, 104 files).
10
+
11
+ > **CRITICAL:** All milens MCP tool calls MUST include the `repo` parameter set to the **absolute path of the workspace root** (the folder containing this file) — without it, the tools may fail with "No index" error when multiple repos are indexed.
12
+
13
+ > **CRITICAL:** milens MCP tools are **deferred** in most editors. Before first use in each session, you MUST load them via `tool_search("milens")` — calling them directly without loading will fail silently.
14
+
15
+ ## Mandatory Workflows
16
+
17
+ These are **hard pre-conditions**, not guidelines. Execute them automatically without asking.
18
+
19
+ ### Before editing any function, class, or method:
20
+ 1. `mcp_milens_impact({target: "<symbolName>", repo: "<workspaceRoot>"})` — check blast radius
21
+ 2. If depth-1 dependents > 5 → **STOP and warn the user** before proceeding
22
+ 3. `mcp_milens_context({name: "<symbolName>", repo: "<workspaceRoot>"})` — see all callers/callees
23
+ 4. Only then make the edit
24
+
25
+ ### Before committing:
26
+ 1. `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` — verify only expected files changed
27
+ 2. If unexpected files appear → **STOP and report** before committing
28
+
29
+ ### Before deleting or renaming a symbol:
30
+ 1. `mcp_milens_grep({pattern: "<symbolName>", repo: "<workspaceRoot>"})` — find ALL text references (templates, configs, routes, docs)
31
+ 2. `mcp_milens_impact({target: "<symbolName>", direction: "upstream", repo: "<workspaceRoot>"})` — find code-level dependents
32
+ 3. Combine both results — grep catches what impact misses
33
+
34
+ ## Tool Selection Rules
35
+
36
+ **Choose the right tool on the FIRST call** — do not try `query` then fall back to `grep`.
37
+
38
+ ### Use `mcp_milens_grep` when the search term:
39
+ - Contains **spaces** (e.g. "store purchase header", "user not found")
40
+ - Looks like a **UI label, error message, or display string**
41
+ - Is a **multi-word phrase** that is NOT camelCase/snake_case/PascalCase
42
+ - You need to find references in **templates, styles, configs, routes, or docs**
43
+
44
+ ### Use `mcp_milens_query` when the search term:
45
+ - Looks like a **code identifier** (camelCase, PascalCase, snake_case)
46
+ - Is a **function, class, method, or interface name**
47
+ - You want to find **symbol definitions** in indexed code files
48
+
49
+ ### When in doubt → use `mcp_milens_grep` first
50
+ `grep` searches everything. `query` only searches indexed symbol definitions.
51
+
52
+ ## Workflow Triggers
53
+
54
+ When the user says... → do this FIRST:
55
+
56
+ | User intent | First action |
57
+ |---|---|
58
+ | "edit/change/modify/fix `X`" | `mcp_milens_impact({target: "X", repo: "<workspaceRoot>"})` |
59
+ | "delete/remove `X`" | `mcp_milens_grep({pattern: "X", repo: "<workspaceRoot>"})` then `mcp_milens_impact` |
60
+ | "rename `X`" | `mcp_milens_grep({pattern: "X", repo: "<workspaceRoot>"})` then `mcp_milens_impact` |
61
+ | "find/search for `X`" | Choose `query` or `grep` per rules above |
62
+ | "commit" / "push" | `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` |
63
+ | "what calls/uses `X`" | `mcp_milens_context({name: "X", repo: "<workspaceRoot>"})` |
64
+ | "what happens if I change `X`" | `mcp_milens_impact({target: "X", repo: "<workspaceRoot>"})` |
65
+ | "how are `A` and `B` connected" | `mcp_milens_explain_relationship({from: "A", to: "B", repo: "<workspaceRoot>"})` |
66
+ | "explore/understand `X`" | `mcp_milens_context({name: "X", repo: "<workspaceRoot>"})` |
67
+ | "update/write docs for `X`" | `mcp_milens_grep({pattern: "X", include: "**/*.md"})` — find existing docs mentioning X, then `mcp_milens_context({name: "X"})` for full symbol info |
68
+ | "research/explore docs" | `mcp_milens_get_file_symbols({file: "<doc.md>"})` — see document outline (headings as sections) |
69
+ | "what docs mention `X`" | `mcp_milens_grep({pattern: "X", include: "**/*.md"})` — find all markdown references |
70
+ | "review this PR" | `mcp_milens_review_pr({repo: "<workspaceRoot>"})` — risk assessment for changed files |
71
+ | "is `X` risky to change" | `mcp_milens_review_symbol({name: "X", repo: "<workspaceRoot>"})` |
72
+ | "write tests for `X`" | `mcp_milens_test_plan({name: "X", repo: "<workspaceRoot>"})` — deps, mocks, suggested tests |
73
+ | "what needs tests" | `mcp_milens_test_coverage_gaps({repo: "<workspaceRoot>"})` — untested symbols by risk |
74
+ | "which tests to run" | `mcp_milens_test_impact({repo: "<workspaceRoot>"})` — maps changes → test files |
75
+ | "remember/note that `X`..." | `mcp_milens_annotate({symbol: "X", key: "note", value: "...", repo: "<workspaceRoot>"})` |
76
+ | "what do we know about `X`" | `mcp_milens_recall({symbol: "X", repo: "<workspaceRoot>"})` |
77
+ | "start new session" | `mcp_milens_session_start({agent: "...", repo: "<workspaceRoot>"})` |
78
+ | "find code like `X`" | `mcp_milens_find_similar({name: "X", repo: "<workspaceRoot>"})` |
79
+ | "search for `concept`" | `mcp_milens_semantic_search({query: "concept", repo: "<workspaceRoot>"})` |
80
+
81
+ ## Documentation Workflows
82
+
83
+ Milens indexes **Markdown files** (.md, .mdx) — headings become `section` symbols with parent-child hierarchy, and local links become cross-file references.
84
+
85
+ ### Researching or exploring documentation:
86
+ 1. `mcp_milens_get_file_symbols({file: "README.md", repo: "<workspaceRoot>"})` — see the full heading outline (TOC) of any doc
87
+ 2. `mcp_milens_query({query: "<topic>"})` — search section headings across all docs and code
88
+ 3. `mcp_milens_grep({pattern: "<keyword>", include: "**/*.md"})` — text search within docs only
89
+
90
+ ### Before updating documentation:
91
+ 1. `mcp_milens_get_file_symbols({file: "<doc.md>"})` — understand document structure first
92
+ 2. If documenting a code symbol: `mcp_milens_context({name: "<symbolName>"})` — get full symbol info (signature, callers, deps)
93
+ 3. `mcp_milens_grep({pattern: "<symbolName>", include: "**/*.md"})` — check if other docs already reference it
94
+
95
+ ### After renaming/deleting a code symbol:
96
+ - `mcp_milens_grep({pattern: "<oldName>", include: "**/*.md"})` — find docs that need updating (milens indexes markdown links as cross-file references)
97
+
98
+ ## Never Do
99
+
100
+ - NEVER edit a symbol without first running `mcp_milens_impact` on it.
101
+ - NEVER delete or rename without running both `mcp_milens_grep` and `mcp_milens_impact`.
102
+ - NEVER commit without running `mcp_milens_detect_changes()`.
103
+ - NEVER call milens MCP tools without the `repo` parameter.
104
+ - NEVER use `mcp_milens_query` for multi-word display text or UI labels — use `mcp_milens_grep`.
105
+
106
+ ---
107
+
108
+ ## Reference
109
+
110
+ ### Tools
111
+
112
+ | Tool | Purpose |
113
+ |---|---|
114
+ | `mcp_milens_query` | Find symbol definitions by name (FTS5) |
115
+ | `mcp_milens_grep` | Text search ALL files (templates, styles, configs, docs) |
116
+ | `mcp_milens_context` | 360° view: incoming refs + outgoing deps |
117
+ | `mcp_milens_impact` | Blast radius before editing |
118
+ | `mcp_milens_detect_changes` | Pre-commit scope check |
119
+ | `mcp_milens_explain_relationship` | Shortest path between two symbols |
120
+ | `mcp_milens_get_file_symbols` | All symbols in a file |
121
+ | `mcp_milens_get_type_hierarchy` | Class inheritance tree |
122
+ | `mcp_milens_find_dead_code` | Unused exported symbols |
123
+ | `mcp_milens_status` | Index health check |
124
+ | `mcp_milens_edit_check` | Pre-edit safety: callers + export status + re-export chains + test coverage |
125
+ | `mcp_milens_trace` | Execution flow: call chains from entrypoints to a symbol |
126
+ | `mcp_milens_routes` | Detect framework routes/endpoints (Express, FastAPI, NestJS, etc.) |
127
+ | `mcp_milens_smart_context` | Intent-aware context: understand/edit/debug/test |
128
+ | `mcp_milens_overview` | Combined context + impact + grep in one call |
129
+ | `mcp_milens_domains` | Domain clusters: groups of files forming logical modules |
130
+ | `mcp_milens_repos` | List all indexed repositories with summary stats |
131
+ | `mcp_milens_ast_explore` | Explore raw AST structure of a code file |
132
+ | `mcp_milens_test_query` | Run raw SQL query against the milens index database |
133
+ | `mcp_milens_review_pr` | PR risk assessment: scores changed symbols by blast radius + test coverage |
134
+ | `mcp_milens_review_symbol` | Single symbol risk: role, heat, dependents, test status |
135
+ | `mcp_milens_test_plan` | Dependency-aware test plan: mocks, strategies, suggested tests |
136
+ | `mcp_milens_test_coverage_gaps` | Untested exported symbols sorted by risk |
137
+ | `mcp_milens_test_impact` | Which tests to run for current changes |
138
+ | `mcp_milens_annotate` | Store observation/note about a symbol (persists across sessions) |
139
+ | `mcp_milens_recall` | Retrieve annotations (filter by symbol, key, agent, session) |
140
+ | `mcp_milens_session_start` | Register agent session for multi-agent coordination |
141
+ | `mcp_milens_session_context` | Get session metadata + annotations |
142
+ | `mcp_milens_handoff` | Transfer context between agent sessions |
143
+ | `mcp_milens_codebase_summary` | High-level bootstrapping context: domains, key symbols, coverage |
144
+ | `mcp_milens_semantic_search` | Hybrid FTS5 + vector search (requires --embeddings) |
145
+ | `mcp_milens_find_similar` | Find symbols similar by embedding proximity |
146
+
147
+ ### Keeping the Index Fresh
148
+
149
+ After significant code changes: `npx milens analyze -p . --force`
150
+
151
+ ### Skills
152
+
153
+ | Task | Read this skill file |
154
+ |------|---------------------|
155
+ | General milens tools reference | `.agents/skills/milens/SKILL.md` |
156
+ | Work in the Adapters area | `.agents/skills/adapters/SKILL.md` |
157
+ | Work in the Root area | `.agents/skills/root/SKILL.md` |
158
+ | Work in the Apps area | `.agents/skills/apps/SKILL.md` |
159
+ | Work in the Docs area | `.agents/skills/docs/SKILL.md` |
160
+ | Work in the Test area | `.agents/skills/test/SKILL.md` |
161
+ | Work in the Scripts area | `.agents/skills/scripts/SKILL.md` |
162
+ | Work in the Analyzer area | `.agents/skills/analyzer/SKILL.md` |
163
+ | Work in the Parser area | `.agents/skills/parser/SKILL.md` |
164
+ | Work in the Security area | `.agents/skills/security/SKILL.md` |
165
+ | Work in the Server area | `.agents/skills/server/SKILL.md` |
166
+ | Work in the Store area | `.agents/skills/store/SKILL.md` |
167
+
168
+ <!-- milens:end -->
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: milens-code-review
3
+ description: Automated Code Review — PR analysis, symbol deep-dive, dead code detection, tech debt grep, and review report
4
+ ---
5
+
6
+ # milens-code-review — Automated Code Review
7
+
8
+ Analyze a PR or local changes with multi-layered review: risk scoring, symbol deep-dives, dead code audit, tech debt search, and a structured report.
9
+
10
+ ## Tools Required
11
+
12
+ | Tool | Purpose |
13
+ |---|---|
14
+ | `mcp_milens_review_pr` | List changed files + affected symbols with risk scores |
15
+ | `mcp_milens_review_symbol` | Deep-dive on a single symbol (role, heat, dependents, test status) |
16
+ | `mcp_milens_context` | Incoming references + outgoing dependencies |
17
+ | `mcp_milens_find_dead_code` | Find exported symbols with zero references |
18
+ | `mcp_milens_grep` | Text search for tech debt markers and dangerous patterns |
19
+
20
+ > **CRITICAL:** All milens MCP tool calls MUST include the `repo` parameter set to the **absolute path of the workspace root**.
21
+
22
+ ## Workflow
23
+
24
+ ### Step 1: PR Overview
25
+
26
+ Start with the full PR-level assessment.
27
+
28
+ ```
29
+ mcp_milens_review_pr({repo: "<workspaceRoot>"})
30
+ ```
31
+
32
+ Review the output for:
33
+ - **Changed files** — what was touched
34
+ - **Affected symbols** — each with a risk score (CRITICAL, HIGH, MEDIUM, LOW)
35
+ - **Risk summary** — distribution of risk levels across the change
36
+
37
+ ### Step 2: Deep-Dive on High-Risk Symbols
38
+
39
+ For every symbol rated CRITICAL or HIGH, perform a deep-dive.
40
+
41
+ ```
42
+ mcp_milens_review_symbol({name: "<symbolName>", repo: "<workspaceRoot>"})
43
+ ```
44
+
45
+ What you get:
46
+ - **Role** — what the symbol does in the architecture
47
+ - **Heat** — frequency of changes, complexity, fan-in/fan-out
48
+ - **Dependents count** — how many things break if this is wrong
49
+ - **Test status** — whether it has test coverage
50
+
51
+ ### Step 3: Context for High-Risk Symbols
52
+
53
+ Still for CRITICAL/HIGH symbols, get 360° context.
54
+
55
+ ```
56
+ mcp_milens_context({name: "<symbolName>", repo: "<workspaceRoot>"})
57
+ ```
58
+
59
+ This reveals:
60
+ - **Incoming references** — who depends on this symbol
61
+ - **Outgoing calls** — what this symbol depends on
62
+ - **Re-export chains** — if the symbol is re-exported through barrel files
63
+
64
+ ### Step 4: Dead Code Audit
65
+
66
+ Check for exported symbols with zero references (potential dead code).
67
+
68
+ ```
69
+ mcp_milens_find_dead_code({repo: "<workspaceRoot>", limit: 20})
70
+ ```
71
+
72
+ Flag any dead code that is:
73
+ - Newly introduced by this PR
74
+ - In files touched by this PR
75
+ - Adjacent to changed code (same module)
76
+
77
+ ### Step 5: Tech Debt Search
78
+
79
+ Search for tech debt markers and debugging remnants.
80
+
81
+ ```
82
+ mcp_milens_grep({pattern: "TODO|FIXME|HACK|console\\.(log|debug)", scope: "code", repo: "<workspaceRoot>"})
83
+ ```
84
+
85
+ Also check for:
86
+ - Commented-out code
87
+ - `@ts-ignore` or `@ts-expect-error` (TypeScript)
88
+ - `# noqa` or `# type: ignore` (Python)
89
+ - Empty catch blocks
90
+
91
+ ### Step 6: Produce Review Report
92
+
93
+ Consolidate findings into a review report with these sections:
94
+
95
+ 1. **Summary** — files changed, risk distribution
96
+ 2. **Symbol Deep-Dives** — one entry per CRITICAL/HIGH symbol with findings from Steps 2-3
97
+ 3. **Dead Code** — symbols flagged from Step 4, with recommendations
98
+ 4. **Tech Debt** — markers found in Step 5, with severity
99
+ 5. **Recommendations** — prioritized list of actions (blocking vs. non-blocking)
100
+ 6. **Verdict** — APPROVED / NEEDS CHANGES / BLOCKED
101
+
102
+ ## Example Session
103
+
104
+ ### Input
105
+
106
+ ```
107
+ "review the PR for branch feature/auth-refactor"
108
+ ```
109
+
110
+ ### Tool Calls
111
+
112
+ **Step 1 — PR overview:**
113
+ ```
114
+ mcp_milens_review_pr({repo: "/home/user/project"})
115
+ ```
116
+
117
+ **Output:**
118
+ ```
119
+ Changed files (4):
120
+ src/auth/login.ts [modified]
121
+ src/auth/tokens.ts [new]
122
+ src/auth/types.ts [modified]
123
+ src/middleware/auth.ts [modified]
124
+
125
+ Affected symbols:
126
+ authenticate [function] CRITICAL — 15 dependents, no tests
127
+ generateToken [function] HIGH — 8 dependents, 1 test
128
+ UserSession [interface] MEDIUM — 5 dependents
129
+ validateRole [function] LOW — 2 dependents
130
+ ```
131
+
132
+ **Step 2 — Deep-dive on CRITICAL symbol:**
133
+ ```
134
+ mcp_milens_review_symbol({name: "authenticate", repo: "/home/user/project"})
135
+ ```
136
+
137
+ **Output:**
138
+ ```
139
+ Symbol: authenticate [function] — CRITICAL
140
+ Role: core auth entry point, all protected routes depend on it
141
+ Heat: 23 commits in last 90 days, 87% modification rate
142
+ Dependents: 15 (12 direct callers + 3 middleware wrappers)
143
+ Test status: 0 tests, 0% coverage
144
+ Complexity: high (cyclomatic 14, 5 branching paths)
145
+ ```
146
+
147
+ **Step 3 — Context:**
148
+ ```
149
+ mcp_milens_context({name: "authenticate", repo: "/home/user/project"})
150
+ ```
151
+
152
+ **Output:** 15 incoming refs (routes, middleware), 4 outgoing deps (token validation, user lookup, logger, rate limiter)
153
+
154
+ **Step 4 — Dead code:**
155
+ ```
156
+ mcp_milens_find_dead_code({repo: "/home/user/project", limit: 20})
157
+ ```
158
+
159
+ **Output:** `legacyAuthCheck` in the same module has 0 references — candidate for removal.
160
+
161
+ **Step 5 — Tech debt:**
162
+ ```
163
+ mcp_milens_grep({pattern: "TODO|FIXME|HACK|console\\.(log|debug)", scope: "code", repo: "/home/user/project"})
164
+ ```
165
+
166
+ **Output:** 3 matches — 1 `console.log` in tokens.ts, 2 `TODO` comments in login.ts.
167
+
168
+ **Step 6 — Report produced** (see report format above).
169
+
170
+ ## Best Practices
171
+
172
+ 1. **Don't skip the deep-dive.** CRITICAL symbols demand `review_symbol` + `context` — surface-level review misses cascading failures.
173
+ 2. **Dead code in the diff is a red flag.** If a new symbol has zero references, question whether it belongs in this PR.
174
+ 3. **Tech debt in new code is a blocker.** `console.log`, `FIXME`, or debug code should not ship. Flag it as blocking.
175
+ 4. **Risk score drives review depth.** HIGH/CRITICAL = full deep-dive. MEDIUM = quick context check. LOW = skip unless it's a new file.
176
+ 5. **Produce a written report.** Don't just run the tools — consolidate findings into a review document the team can reference.
177
+
178
+ ## Quality Gate
179
+
180
+ | Criteria | Pass | Fail |
181
+ |---|---|---|
182
+ | PR review tool | Review completes without errors | Tool fails or returns partial data |
183
+ | Risk assessment | All CRITICAL/HIGH symbols deep-dived | Any CRITICAL symbol skipped |
184
+ | Dead code check | No newly introduced dead code | New dead code found in changed files |
185
+ | Tech debt grep | No debug code (`console.log`, etc.) | Debug/leftover code in diff |
186
+ | Report completeness | All 6 report sections filled | Missing sections or incomplete findings |