milens 0.6.3 → 0.6.5

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 (155) hide show
  1. package/.agents/skills/adapters/SKILL.md +51 -0
  2. package/.agents/skills/analyzer/SKILL.md +77 -0
  3. package/.agents/skills/apps/SKILL.md +66 -0
  4. package/.agents/skills/docs/SKILL.md +73 -0
  5. package/.agents/skills/milens/SKILL.md +198 -0
  6. package/.agents/skills/milens-architect/SKILL.md +128 -0
  7. package/.agents/skills/milens-code-review/SKILL.md +186 -0
  8. package/.agents/skills/milens-debugger/SKILL.md +141 -0
  9. package/.agents/skills/milens-eval/SKILL.md +221 -0
  10. package/.agents/skills/milens-plan/SKILL.md +227 -0
  11. package/.agents/skills/milens-refactor-clean/SKILL.md +209 -0
  12. package/.agents/skills/milens-security-review/SKILL.md +224 -0
  13. package/.agents/skills/milens-tdd/SKILL.md +156 -0
  14. package/.agents/skills/orchestrator/SKILL.md +59 -0
  15. package/.agents/skills/parser/SKILL.md +81 -0
  16. package/.agents/skills/root/SKILL.md +86 -0
  17. package/.agents/skills/scripts/SKILL.md +45 -0
  18. package/.agents/skills/security/SKILL.md +65 -0
  19. package/.agents/skills/server/SKILL.md +72 -0
  20. package/.agents/skills/store/SKILL.md +75 -0
  21. package/.agents/skills/test/SKILL.md +121 -0
  22. package/LICENSE +21 -75
  23. package/README.md +356 -453
  24. package/adapters/README.md +107 -0
  25. package/adapters/claude-code/.claude/mcp.json +9 -0
  26. package/adapters/claude-code/CLAUDE.md +58 -0
  27. package/adapters/codex/.codex/codex.md +52 -0
  28. package/adapters/copilot/.github/copilot-instructions.md +62 -0
  29. package/adapters/cursor/.cursorrules +9 -0
  30. package/adapters/gemini/.gemini/context.md +58 -0
  31. package/adapters/opencode/.opencode/config.json +9 -0
  32. package/adapters/opencode/AGENTS.md +58 -0
  33. package/adapters/zed/.zed/settings.json +8 -0
  34. package/dist/agents-md.d.ts +3 -0
  35. package/dist/agents-md.d.ts.map +1 -0
  36. package/dist/agents-md.js +114 -0
  37. package/dist/agents-md.js.map +1 -0
  38. package/dist/analyzer/engine.d.ts +1 -0
  39. package/dist/analyzer/engine.d.ts.map +1 -1
  40. package/dist/analyzer/engine.js +37 -7
  41. package/dist/analyzer/engine.js.map +1 -1
  42. package/dist/cli.js +1472 -406
  43. package/dist/cli.js.map +1 -1
  44. package/dist/metrics.d.ts +51 -0
  45. package/dist/metrics.d.ts.map +1 -0
  46. package/dist/metrics.js +64 -0
  47. package/dist/metrics.js.map +1 -0
  48. package/dist/orchestrator/orchestrator.d.ts +65 -0
  49. package/dist/orchestrator/orchestrator.d.ts.map +1 -0
  50. package/dist/orchestrator/orchestrator.js +178 -0
  51. package/dist/orchestrator/orchestrator.js.map +1 -0
  52. package/dist/orchestrator/reporter.d.ts +15 -0
  53. package/dist/orchestrator/reporter.d.ts.map +1 -0
  54. package/dist/orchestrator/reporter.js +38 -0
  55. package/dist/orchestrator/reporter.js.map +1 -0
  56. package/dist/parser/lang-go.js +47 -47
  57. package/dist/parser/lang-java.js +29 -29
  58. package/dist/parser/lang-js.js +105 -105
  59. package/dist/parser/lang-php.js +38 -38
  60. package/dist/parser/lang-py.js +34 -34
  61. package/dist/parser/lang-ruby.js +14 -14
  62. package/dist/parser/lang-rust.js +30 -30
  63. package/dist/parser/lang-ts.js +191 -191
  64. package/dist/security/deps.d.ts +38 -0
  65. package/dist/security/deps.d.ts.map +1 -0
  66. package/dist/security/deps.js +685 -0
  67. package/dist/security/deps.js.map +1 -0
  68. package/dist/security/rules.d.ts +42 -0
  69. package/dist/security/rules.d.ts.map +1 -0
  70. package/dist/security/rules.js +943 -0
  71. package/dist/security/rules.js.map +1 -0
  72. package/dist/server/hooks.d.ts +29 -0
  73. package/dist/server/hooks.d.ts.map +1 -0
  74. package/dist/server/hooks.js +332 -0
  75. package/dist/server/hooks.js.map +1 -0
  76. package/dist/server/mcp-prompts.d.ts +277 -0
  77. package/dist/server/mcp-prompts.d.ts.map +1 -0
  78. package/dist/server/mcp-prompts.js +627 -0
  79. package/dist/server/mcp-prompts.js.map +1 -0
  80. package/dist/server/mcp.d.ts.map +1 -1
  81. package/dist/server/mcp.js +1030 -652
  82. package/dist/server/mcp.js.map +1 -1
  83. package/dist/server/test-plan.d.ts +20 -0
  84. package/dist/server/test-plan.d.ts.map +1 -0
  85. package/dist/server/test-plan.js +100 -0
  86. package/dist/server/test-plan.js.map +1 -0
  87. package/dist/server/watcher.d.ts +39 -0
  88. package/dist/server/watcher.d.ts.map +1 -0
  89. package/dist/server/watcher.js +134 -0
  90. package/dist/server/watcher.js.map +1 -0
  91. package/dist/skills.js +197 -153
  92. package/dist/skills.js.map +1 -1
  93. package/dist/store/annotations.d.ts +41 -0
  94. package/dist/store/annotations.d.ts.map +1 -0
  95. package/dist/store/annotations.js +195 -0
  96. package/dist/store/annotations.js.map +1 -0
  97. package/dist/store/confidence.d.ts +28 -0
  98. package/dist/store/confidence.d.ts.map +1 -0
  99. package/dist/store/confidence.js +109 -0
  100. package/dist/store/confidence.js.map +1 -0
  101. package/dist/store/db.d.ts +53 -14
  102. package/dist/store/db.d.ts.map +1 -1
  103. package/dist/store/db.js +447 -240
  104. package/dist/store/db.js.map +1 -1
  105. package/dist/store/schema.sql +143 -116
  106. package/dist/store/vectors.js +2 -2
  107. package/dist/types.d.ts +101 -0
  108. package/dist/types.d.ts.map +1 -1
  109. package/docs/README.md +22 -0
  110. package/package.json +81 -66
  111. package/dist/gateway/analyzer.d.ts +0 -6
  112. package/dist/gateway/analyzer.d.ts.map +0 -1
  113. package/dist/gateway/analyzer.js +0 -218
  114. package/dist/gateway/analyzer.js.map +0 -1
  115. package/dist/gateway/cache.d.ts +0 -35
  116. package/dist/gateway/cache.d.ts.map +0 -1
  117. package/dist/gateway/cache.js +0 -175
  118. package/dist/gateway/cache.js.map +0 -1
  119. package/dist/gateway/config.d.ts +0 -10
  120. package/dist/gateway/config.d.ts.map +0 -1
  121. package/dist/gateway/config.js +0 -167
  122. package/dist/gateway/config.js.map +0 -1
  123. package/dist/gateway/context-memory.d.ts +0 -68
  124. package/dist/gateway/context-memory.d.ts.map +0 -1
  125. package/dist/gateway/context-memory.js +0 -157
  126. package/dist/gateway/context-memory.js.map +0 -1
  127. package/dist/gateway/observability.d.ts +0 -83
  128. package/dist/gateway/observability.d.ts.map +0 -1
  129. package/dist/gateway/observability.js +0 -152
  130. package/dist/gateway/observability.js.map +0 -1
  131. package/dist/gateway/privacy.d.ts +0 -27
  132. package/dist/gateway/privacy.d.ts.map +0 -1
  133. package/dist/gateway/privacy.js +0 -139
  134. package/dist/gateway/privacy.js.map +0 -1
  135. package/dist/gateway/providers.d.ts +0 -66
  136. package/dist/gateway/providers.d.ts.map +0 -1
  137. package/dist/gateway/providers.js +0 -377
  138. package/dist/gateway/providers.js.map +0 -1
  139. package/dist/gateway/router.d.ts +0 -18
  140. package/dist/gateway/router.d.ts.map +0 -1
  141. package/dist/gateway/router.js +0 -102
  142. package/dist/gateway/router.js.map +0 -1
  143. package/dist/gateway/server.d.ts +0 -20
  144. package/dist/gateway/server.d.ts.map +0 -1
  145. package/dist/gateway/server.js +0 -387
  146. package/dist/gateway/server.js.map +0 -1
  147. package/dist/gateway/translator.d.ts +0 -19
  148. package/dist/gateway/translator.d.ts.map +0 -1
  149. package/dist/gateway/translator.js +0 -340
  150. package/dist/gateway/translator.js.map +0 -1
  151. package/dist/gateway/types.d.ts +0 -215
  152. package/dist/gateway/types.d.ts.map +0 -1
  153. package/dist/gateway/types.js +0 -3
  154. package/dist/gateway/types.js.map +0 -1
  155. package/dist/store/gateway-schema.sql +0 -53
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: milens-adapters
3
+ description: Code intelligence for the adapters area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Adapters
7
+
8
+ ## Working with this area
9
+ When working with code in **adapters/**, follow these mandatory safety rules:
10
+
11
+ ### Before editing any symbol in this area:
12
+ 1. Call `mcp_milens_impact({target: "<symbol>", repo: "<workspaceRoot>"})` — check blast radius
13
+ 2. If depth-1 dependents > 5 → **STOP and warn** before proceeding
14
+ 3. Call `mcp_milens_context({name: "<symbol>", repo: "<workspaceRoot>"})` — see all callers/callees
15
+
16
+ ### Before committing changes in this area:
17
+ 1. Call `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` — verify scope
18
+ 2. If unexpected files changed → **STOP and report**
19
+
20
+ ### Key tools for this area:
21
+ | Task | Tool |
22
+ |---|---|
23
+ | Find all references | `mcp_milens_context` |
24
+ | Check edit safety | `mcp_milens_edit_check` |
25
+ | Text search across files | `mcp_milens_grep` |
26
+ | See file symbols | `mcp_milens_get_file_symbols` |
27
+
28
+ ## Overview
29
+ Contains 30 symbols (27 exported) across 3 files.
30
+
31
+ ## Key Symbols
32
+ - **`Milens — Code Intelligence for Claude Code`** [section] (adapters/claude-code/CLAUDE.md:1) — 0 refs
33
+ - **`Available Tools`** [section] (adapters/claude-code/CLAUDE.md:5) — 0 refs
34
+ - **`Session Workflow`** [section] (adapters/claude-code/CLAUDE.md:25) — 0 refs
35
+ - **`Edit Safety (Mandatory)`** [section] (adapters/claude-code/CLAUDE.md:33) — 0 refs
36
+ - **`Tool Selection`** [section] (adapters/claude-code/CLAUDE.md:49) — 0 refs
37
+ - **`Reference`** [section] (adapters/claude-code/CLAUDE.md:55) — 0 refs
38
+ - **`Milens — Code Intelligence for OpenCode`** [section] (adapters/opencode/AGENTS.md:1) — 0 refs
39
+ - **`Available Tools`** [section] (adapters/opencode/AGENTS.md:5) — 0 refs
40
+ - **`Session Workflow`** [section] (adapters/opencode/AGENTS.md:25) — 0 refs
41
+ - **`Edit Safety (Mandatory)`** [section] (adapters/opencode/AGENTS.md:33) — 0 refs
42
+ - **`Tool Selection`** [section] (adapters/opencode/AGENTS.md:49) — 0 refs
43
+ - **`Reference`** [section] (adapters/opencode/AGENTS.md:55) — 0 refs
44
+ - **`Milens Adapter Packs`** [section] (adapters/README.md:1) — 0 refs
45
+ - **`What is milens?`** [section] (adapters/README.md:5) — 0 refs
46
+ - **`Available Adapters`** [section] (adapters/README.md:9) — 0 refs
47
+
48
+ ## Files
49
+ - adapters/README.md
50
+ - adapters/claude-code/CLAUDE.md
51
+ - adapters/opencode/AGENTS.md
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: milens-analyzer
3
+ description: Code intelligence for the analyzer area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Analyzer
7
+
8
+ ## Working with this area
9
+ When working with code in **analyzer/**, follow these mandatory safety rules:
10
+
11
+ ### Before editing any symbol in this area:
12
+ 1. Call `mcp_milens_impact({target: "<symbol>", repo: "<workspaceRoot>"})` — check blast radius
13
+ 2. If depth-1 dependents > 5 → **STOP and warn** before proceeding
14
+ 3. Call `mcp_milens_context({name: "<symbol>", repo: "<workspaceRoot>"})` — see all callers/callees
15
+
16
+ ### Before committing changes in this area:
17
+ 1. Call `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` — verify scope
18
+ 2. If unexpected files changed → **STOP and report**
19
+
20
+ ### Key tools for this area:
21
+ | Task | Tool |
22
+ |---|---|
23
+ | Find all references | `mcp_milens_context` |
24
+ | Check edit safety | `mcp_milens_edit_check` |
25
+ | Text search across files | `mcp_milens_grep` |
26
+ | See file symbols | `mcp_milens_get_file_symbols` |
27
+
28
+ ## Overview
29
+ Contains 80 symbols (21 exported) across 7 files.
30
+
31
+ ## Key Symbols
32
+ - **`reviewPr`** [function] (src/analyzer/review.ts:101) — 7 refs
33
+ - **`resolveLinksWithStats`** [function] (src/analyzer/resolver.ts:35) — 5 refs
34
+ - **`loadAliases`** [function] (src/analyzer/config.ts:10) — 4 refs
35
+ - **`analyze`** [function] (src/analyzer/engine.ts:125) — 4 refs
36
+ - **`enrichMetadata`** [function] (src/analyzer/enrich.ts:21) — 4 refs
37
+ - **`ReviewResult`** [interface] (src/analyzer/review.ts:17) — 4 refs
38
+ - **`scanFiles`** [function] (src/analyzer/scanner.ts:11) — 4 refs
39
+ - **`resolveLinks`** [function] (src/analyzer/resolver.ts:30) — 3 refs
40
+ - **`reviewSymbol`** [function] (src/analyzer/review.ts:167) — 2 refs
41
+ - **`generateTestPlan`** [function] (src/analyzer/testplan.ts:104) — 2 refs
42
+ - **`findCoverageGaps`** [function] (src/analyzer/testplan.ts:175) — 2 refs
43
+ - **`analyzeTestImpact`** [function] (src/analyzer/testplan.ts:208) — 2 refs
44
+ - **`ResolutionResult`** [interface] (src/analyzer/resolver.ts:22) — 1 refs
45
+ - **`SymbolRisk`** [interface] (src/analyzer/review.ts:8) — 1 refs
46
+ - **`RiskLevel`** [type] (src/analyzer/review.ts:6) — 1 refs
47
+
48
+ ## Entry Points
49
+ - **`find`** [function] — 22 incoming references
50
+ - **`resolve`** [method] — 15 incoming references
51
+ - **`reviewPr`** [function] — 7 incoming references
52
+ - **`resolveLinksWithStats`** [function] — 5 incoming references
53
+ - **`loadAliases`** [function] — 4 incoming references
54
+
55
+ ## Dependencies
56
+ - **parser**: `langForFile`, `supportedExtensions`, `getParser`, `loadLanguage`, `extractFromTree`, `clearQueryCache`, `extractVueScript`, `extractVueTemplateRefs` (+6 more)
57
+ - **root**: `isTestFile`, `CodeSymbol`, `ExtractionResult`, `RawImport`, `RawCall`, `RawHeritage`, `RawReExport`, `RawTypeBinding` (+8 more)
58
+ - **store**: `Database`, `TfIdfProvider`, `EmbeddingStore`, `buildEmbeddingText`, `get`, `clearFiles`, `clear`, `isFileUpToDate` (+23 more)
59
+ - **test**: `parser`, `lang`
60
+
61
+ ## Used By
62
+ - **root**: `loadAliases`, `analyze`, `resolve`, `clear`
63
+ - **orchestrator**: `reviewPr`, `ReviewResult`, `SymbolRisk`
64
+ - **server**: `reviewPr`, `resolve`, `find`
65
+ - **test**: `enrichMetadata`, `resolveLinks`, `resolveLinksWithStats`, `reviewSymbol`, `reviewPr`, `scanFiles`, `generateTestPlan`, `findCoverageGaps` (+5 more)
66
+ - **scripts**: `resolve`
67
+ - **parser**: `find`, `resolve`
68
+ - **store**: `find`, `resolve`
69
+
70
+ ## Files
71
+ - src/analyzer/config.ts
72
+ - src/analyzer/engine.ts
73
+ - src/analyzer/enrich.ts
74
+ - src/analyzer/resolver.ts
75
+ - src/analyzer/review.ts
76
+ - src/analyzer/scanner.ts
77
+ - src/analyzer/testplan.ts
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: milens-apps
3
+ description: Code intelligence for the apps area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Apps
7
+
8
+ ## Working with this area
9
+ When working with code in **apps/**, follow these mandatory safety rules:
10
+
11
+ ### Before editing any symbol in this area:
12
+ 1. Call `mcp_milens_impact({target: "<symbol>", repo: "<workspaceRoot>"})` — check blast radius
13
+ 2. If depth-1 dependents > 5 → **STOP and warn** before proceeding
14
+ 3. Call `mcp_milens_context({name: "<symbol>", repo: "<workspaceRoot>"})` — see all callers/callees
15
+
16
+ ### Before committing changes in this area:
17
+ 1. Call `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` — verify scope
18
+ 2. If unexpected files changed → **STOP and report**
19
+
20
+ ### Key tools for this area:
21
+ | Task | Tool |
22
+ |---|---|
23
+ | Find all references | `mcp_milens_context` |
24
+ | Check edit safety | `mcp_milens_edit_check` |
25
+ | Text search across files | `mcp_milens_grep` |
26
+ | See file symbols | `mcp_milens_get_file_symbols` |
27
+
28
+ ## Overview
29
+ Contains 38 symbols (12 exported) across 10 files.
30
+
31
+ ## Key Symbols
32
+ - **`Milens Desktop Dashboard`** [section] (apps/dashboard/README.md:1) — 0 refs
33
+ - **`Features`** [section] (apps/dashboard/README.md:5) — 0 refs
34
+ - **`Development`** [section] (apps/dashboard/README.md:13) — 0 refs
35
+ - **`Build`** [section] (apps/dashboard/README.md:19) — 0 refs
36
+ - **`Milens GitHub App`** [section] (apps/github/README.md:1) — 0 refs
37
+ - **`Features`** [section] (apps/github/README.md:5) — 0 refs
38
+ - **`Deployment`** [section] (apps/github/README.md:10) — 0 refs
39
+ - **`Local Development`** [section] (apps/github/README.md:15) — 0 refs
40
+ - **`AgentsMdGenerator`** [class] (apps/github/generators/agents-md.js:1) — 0 refs
41
+ - **`SecurityGenerator`** [class] (apps/github/generators/security.js:1) — 0 refs
42
+ - **`SkillsGenerator`** [class] (apps/github/generators/skills.js:1) — 0 refs
43
+ - **`MilensRunner`** [class] (apps/github/handlers/milens-runner.js:6) — 0 refs
44
+
45
+ ## Entry Points
46
+ - **`createWindow`** [function] — 1 incoming references
47
+ - **`__dirname`** [variable] — 1 incoming references
48
+ - **`checkRateLimit`** [function] — 1 incoming references
49
+ - **`getTier`** [function] — 1 incoming references
50
+ - **`runMilensAnalyze`** [function] — 1 incoming references
51
+
52
+ ## Dependencies
53
+ - **store**: `remove`, `Database`, `getCodebaseSummary`, `close`
54
+ - **test**: `dbPath`
55
+
56
+ ## Files
57
+ - apps/dashboard/README.md
58
+ - apps/dashboard/index.html
59
+ - apps/dashboard/main.js
60
+ - apps/dashboard/preload.js
61
+ - apps/github/README.md
62
+ - apps/github/app.js
63
+ - apps/github/generators/agents-md.js
64
+ - apps/github/generators/security.js
65
+ - apps/github/generators/skills.js
66
+ - apps/github/handlers/milens-runner.js
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: milens-docs
3
+ description: Code intelligence for the docs area — symbols, dependencies, and entry points
4
+ ---
5
+
6
+ # Docs
7
+
8
+ ## Working with this area
9
+ When working with code in **docs/**, follow these mandatory safety rules:
10
+
11
+ ### Before editing any symbol in this area:
12
+ 1. Call `mcp_milens_impact({target: "<symbol>", repo: "<workspaceRoot>"})` — check blast radius
13
+ 2. If depth-1 dependents > 5 → **STOP and warn** before proceeding
14
+ 3. Call `mcp_milens_context({name: "<symbol>", repo: "<workspaceRoot>"})` — see all callers/callees
15
+
16
+ ### Before committing changes in this area:
17
+ 1. Call `mcp_milens_detect_changes({repo: "<workspaceRoot>"})` — verify scope
18
+ 2. If unexpected files changed → **STOP and report**
19
+
20
+ ### Key tools for this area:
21
+ | Task | Tool |
22
+ |---|---|
23
+ | Find all references | `mcp_milens_context` |
24
+ | Check edit safety | `mcp_milens_edit_check` |
25
+ | Text search across files | `mcp_milens_grep` |
26
+ | See file symbols | `mcp_milens_get_file_symbols` |
27
+
28
+ ## Overview
29
+ Contains 129 symbols (109 exported) across 18 files.
30
+
31
+ ## Key Symbols
32
+ - **`Adapter Packs`** [section] (docs/adapters.md:1) — 0 refs
33
+ - **`Available Adapters`** [section] (docs/adapters.md:5) — 0 refs
34
+ - **`Quick Install`** [section] (docs/adapters.md:17) — 0 refs
35
+ - **`Claude Code`** [section] (docs/adapters.md:21) — 0 refs
36
+ - **`OpenCode`** [section] (docs/adapters.md:29) — 0 refs
37
+ - **`Cursor`** [section] (docs/adapters.md:36) — 0 refs
38
+ - **`GitHub Copilot`** [section] (docs/adapters.md:42) — 0 refs
39
+ - **`Codex`** [section] (docs/adapters.md:48) — 0 refs
40
+ - **`Gemini`** [section] (docs/adapters.md:54) — 0 refs
41
+ - **`Zed`** [section] (docs/adapters.md:60) — 0 refs
42
+ - **`Automated Install`** [section] (docs/adapters.md:66) — 0 refs
43
+ - **`Profile Selection`** [section] (docs/adapters.md:74) — 0 refs
44
+ - **`MCP Config Reference`** [section] (docs/adapters.md:86) — 0 refs
45
+ - **`Milens Pricing`** [section] (docs/pricing.md:1) — 0 refs
46
+ - **`Why Pay?`** [section] (docs/pricing.md:7) — 0 refs
47
+
48
+ ## Entry Points
49
+ - **`applyFilters`** [function] — 1 incoming references
50
+ - **`applyFilters`** [function] — 1 incoming references
51
+
52
+ ## Dependencies
53
+ - **store**: `remove`
54
+
55
+ ## Files
56
+ - docs/README.md
57
+ - docs/adapters.html
58
+ - docs/adapters.md
59
+ - docs/changelog.html
60
+ - docs/compare.html
61
+ - docs/github-app.html
62
+ - docs/index.html
63
+ - docs/learning.html
64
+ - docs/platforms.html
65
+ - docs/pricing.html
66
+ - docs/pricing.md
67
+ - docs/quickstart.md
68
+ - docs/scenarios.html
69
+ - docs/security-presets.md
70
+ - docs/security.html
71
+ - docs/skills.html
72
+ - docs/tools.md
73
+ - docs/vi-VN/README.md
@@ -0,0 +1,198 @@
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 — AI-DOS
8
+
9
+ The Operating System for AI-Driven Development. This project is indexed by milens (1048 symbols, 1771 links, 129 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
+ | "generate tests for `X`" | `mcp_milens_test_generate({symbol: "X", repo: "<workspaceRoot>"})` |
81
+ | "fix security issue in `X`" | `mcp_milens_fix_apply({ruleId, file, line, repo: "<workspaceRoot>"})` |
82
+ | "remove dead code" | `mcp_milens_find_dead_code()` then `dead_code_remove` prompt |
83
+ | "orchestrate/check changes" | `mcp_milens_orchestrate({repo: "<workspaceRoot>"})` |
84
+ | "compare impact of `X`" | `mcp_milens_compare_impact({name: "X", action: "snapshot"|"compare", repo: "<workspaceRoot>"})` |
85
+ | "check pre-commit" | `mcp_milens_pre_commit_check({repo: "<workspaceRoot>"})` |
86
+ | "save/restore context" | `mcp_milens_hook_preCompact()` / `mcp_milens_hook_postCompact()` |
87
+ | "scan security / audit security" | `mcp_milens_security_scan({repo: "<workspaceRoot>"})` — full audit across all 50+ rules |
88
+ | "end session" / "finish work" | `mcp_milens_session_end({session_id: "..."})` — record stats, trigger onSessionEnd hook |
89
+ | "what did session X do" | `mcp_milens_session_context({session_id: "..."})` — get annotations + tool calls |
90
+ | "file changed to X" | `mcp_milens_hook_onFileChange({files: ["path/to/file"], repo: "<workspaceRoot>"})` |
91
+
92
+ ## Documentation Workflows
93
+
94
+ Milens indexes **Markdown files** (.md, .mdx) — headings become `section` symbols with parent-child hierarchy, and local links become cross-file references.
95
+
96
+ ### Researching or exploring documentation:
97
+ 1. `mcp_milens_get_file_symbols({file: "README.md", repo: "<workspaceRoot>"})` — see the full heading outline (TOC) of any doc
98
+ 2. `mcp_milens_query({query: "<topic>"})` — search section headings across all docs and code
99
+ 3. `mcp_milens_grep({pattern: "<keyword>", include: "**/*.md"})` — text search within docs only
100
+
101
+ ### Before updating documentation:
102
+ 1. `mcp_milens_get_file_symbols({file: "<doc.md>"})` — understand document structure first
103
+ 2. If documenting a code symbol: `mcp_milens_context({name: "<symbolName>"})` — get full symbol info (signature, callers, deps)
104
+ 3. `mcp_milens_grep({pattern: "<symbolName>", include: "**/*.md"})` — check if other docs already reference it
105
+
106
+ ### After renaming/deleting a code symbol:
107
+ - `mcp_milens_grep({pattern: "<oldName>", include: "**/*.md"})` — find docs that need updating (milens indexes markdown links as cross-file references)
108
+
109
+ ## Never Do
110
+
111
+ - NEVER edit a symbol without first running `mcp_milens_impact` on it.
112
+ - NEVER delete or rename without running both `mcp_milens_grep` and `mcp_milens_impact`.
113
+ - NEVER commit without running `mcp_milens_detect_changes()`.
114
+ - NEVER call milens MCP tools without the `repo` parameter.
115
+ - NEVER use `mcp_milens_query` for multi-word display text or UI labels — use `mcp_milens_grep`.
116
+
117
+ ---
118
+
119
+ ## Reference
120
+
121
+ ### Tools
122
+
123
+ | Tool | Purpose |
124
+ |---|---|
125
+ | `mcp_milens_query` | Find symbol definitions by name (FTS5) |
126
+ | `mcp_milens_grep` | Text search ALL files (templates, styles, configs, docs) |
127
+ | `mcp_milens_context` | 360° view: incoming refs + outgoing deps |
128
+ | `mcp_milens_impact` | Blast radius before editing |
129
+ | `mcp_milens_detect_changes` | Pre-commit scope check |
130
+ | `mcp_milens_explain_relationship` | Shortest path between two symbols |
131
+ | `mcp_milens_get_file_symbols` | All symbols in a file |
132
+ | `mcp_milens_get_type_hierarchy` | Class inheritance tree |
133
+ | `mcp_milens_find_dead_code` | Unused exported symbols |
134
+ | `mcp_milens_status` | Index stats for a repository: symbols, links, files, coverage %, staleness |
135
+ | `mcp_milens_edit_check` | Pre-edit safety: callers + export status + re-export chains + test coverage |
136
+ | `mcp_milens_trace` | Execution flow: call chains from entrypoints to a symbol |
137
+ | `mcp_milens_routes` | Detect framework routes/endpoints (Express, FastAPI, NestJS, etc.) |
138
+ | `mcp_milens_smart_context` | Intent-aware context: understand/edit/debug/test |
139
+ | `mcp_milens_overview` | Combined context + impact + grep in ONE call. Preferred before editing/deleting/renaming a symbol. |
140
+ | `mcp_milens_domains` | Domain clusters: groups of files forming logical modules |
141
+ | `mcp_milens_repos` | List all indexed repositories with summary stats |
142
+ | `mcp_milens_ast_explore` | Explore raw AST structure of a code file |
143
+ | `mcp_milens_test_query` | Run a tree-sitter query against a code snippet and return matched nodes with capture names |
144
+ | `mcp_milens_review_pr` | PR risk assessment: scores changed symbols by blast radius + test coverage |
145
+ | `mcp_milens_review_symbol` | Single symbol risk: role, heat, dependents, test status |
146
+ | `mcp_milens_test_plan` | Dependency-aware test plan: mocks, strategies, suggested tests |
147
+ | `mcp_milens_test_coverage_gaps` | Untested exported symbols sorted by risk |
148
+ | `mcp_milens_test_impact` | Which tests to run for current changes |
149
+ | `mcp_milens_annotate` | Store observation/note about a symbol (persists across sessions) |
150
+ | `mcp_milens_recall` | Retrieve annotations (filter by symbol, key, agent, session) |
151
+ | `mcp_milens_session_start` | Register agent session for multi-agent coordination |
152
+ | `mcp_milens_session_context` | Get session metadata + annotations |
153
+ | `mcp_milens_handoff` | Transfer context between agent sessions |
154
+ | `mcp_milens_codebase_summary` | High-level bootstrapping context: domains, key symbols, coverage |
155
+ | `mcp_milens_semantic_search` | Hybrid FTS5 + vector search (requires --embeddings) |
156
+ | `mcp_milens_find_similar` | Find symbols similar by embedding proximity |
157
+ | `mcp_milens_compare_impact` | Compare impact graph before/after edit — detects regressions |
158
+ | `mcp_milens_orchestrate` | Run full orchestration cycle: detect_changes → review_pr → impact → coverage gaps → dead code → action plan |
159
+ | `mcp_milens_fix_apply` | Apply a security fix to a file (creates backup) |
160
+ | `mcp_milens_test_generate` | Auto-generate test file: detects framework (vitest/jest/mocha/pytest) and writes complete test with mock strategy |
161
+ | `mcp_milens_pre_commit_check` | Pre-commit risk scan: review_pr + dead code + coverage gaps |
162
+ | `mcp_milens_hook_preCompact` | Save metrics snapshot before context compaction |
163
+ | `mcp_milens_hook_postCompact` | Restore context by recalling annotations after compaction |
164
+ | `mcp_milens_session_end` | End a session and record its stats. Use at the end of every session. |
165
+ | `mcp_milens_hook_onFileChange` | Trigger the onFileChange hook. Call when files are modified to get impact summary. |
166
+ | `mcp_milens_security_scan` | Scan codebase for security vulnerabilities using 50+ built-in rules. Replaces multiple manual grep() calls. |
167
+
168
+ ### Keeping the Index Fresh
169
+
170
+ After significant code changes: `npx milens analyze -p . --force` (replace `.` with your project root if running from a different directory)
171
+
172
+ ### Skills
173
+
174
+ | Task | Read this skill file |
175
+ |------|---------------------|
176
+ | General milens tools reference | `.agents/skills/milens/SKILL.md` |
177
+ | Work in the Adapters area | `.agents/skills/adapters/SKILL.md` |
178
+ | Work in the Root area | `.agents/skills/root/SKILL.md` |
179
+ | Work in the Apps area | `.agents/skills/apps/SKILL.md` |
180
+ | Work in the Docs area | `.agents/skills/docs/SKILL.md` |
181
+ | Work in the Test area | `.agents/skills/test/SKILL.md` |
182
+ | Work in the Scripts area | `.agents/skills/scripts/SKILL.md` |
183
+ | Work in the Analyzer area | `.agents/skills/analyzer/SKILL.md` |
184
+ | Work in the Orchestrator area | `.agents/skills/orchestrator/SKILL.md` |
185
+ | Work in the Parser area | `.agents/skills/parser/SKILL.md` |
186
+ | Work in the Security area | `.agents/skills/security/SKILL.md` |
187
+ | Work in the Server area | `.agents/skills/server/SKILL.md` |
188
+ | Work in the Store area | `.agents/skills/store/SKILL.md` |
189
+ | Execute milens-plan workflow | `.agents/skills/milens-plan/SKILL.md` |
190
+ | Execute milens-code-review workflow | `.agents/skills/milens-code-review/SKILL.md` |
191
+ | Execute milens-tdd workflow | `.agents/skills/milens-tdd/SKILL.md` |
192
+ | Execute milens-security-review workflow | `.agents/skills/milens-security-review/SKILL.md` |
193
+ | Execute milens-refactor-clean workflow | `.agents/skills/milens-refactor-clean/SKILL.md` |
194
+ | Execute milens-eval workflow | `.agents/skills/milens-eval/SKILL.md` |
195
+ | Execute milens-architect workflow | `.agents/skills/milens-architect/SKILL.md` |
196
+ | Execute milens-debugger workflow | `.agents/skills/milens-debugger/SKILL.md` |
197
+
198
+ <!-- milens:end -->
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: milens-architect
3
+ description: Architecture Analysis — domains, routes, coupling, class hierarchy, and refactoring suggestions with scorecard
4
+ ---
5
+
6
+ # milens-architect — Architecture Analysis
7
+
8
+ Analyze the architecture of the codebase: domain clusters, API routes, execution traces, class hierarchies, coupling hotspots, and produce a structured scorecard with refactoring suggestions.
9
+
10
+ ## Tools Required
11
+
12
+ | Tool | Purpose |
13
+ |---|---|
14
+ | `mcp_milens_codebase_summary` | High-level project overview |
15
+ | `mcp_milens_domains` | Module clusters with cohesion scores |
16
+ | `mcp_milens_routes` | API endpoints inventory |
17
+ | `mcp_milens_get_type_hierarchy` | Class/interface inheritance trees |
18
+ | `mcp_milens_trace` | Execution flow from entrypoints |
19
+ | `mcp_milens_explain_relationship` | Shortest path between two symbols |
20
+ | `mcp_milens_find_dead_code` | Unused exported symbols |
21
+ | `mcp_milens_review_symbol` | Deep-dive single symbol risk |
22
+ | `mcp_milens_impact` | Blast radius analysis |
23
+
24
+ > **CRITICAL:** All milens MCP tool calls MUST include the `repo` parameter set to the **absolute path of the workspace root**.
25
+
26
+ ## Workflow
27
+
28
+ ### Step 1: Codebase Overview
29
+
30
+ Get a high-level picture of the codebase structure.
31
+
32
+ ```
33
+ mcp_milens_codebase_summary({repo: "<workspaceRoot>"})
34
+ ```
35
+
36
+ ### Step 2: Domain Map
37
+
38
+ Identify logical module groupings and cohesion.
39
+
40
+ ```
41
+ mcp_milens_domains({repo: "<workspaceRoot>"})
42
+ ```
43
+
44
+ For each domain with > 5 files, note: file count, symbol count, and description.
45
+
46
+ ### Step 3: Route Inventory
47
+
48
+ Map all API endpoints to handler functions.
49
+
50
+ ```
51
+ mcp_milens_routes({repo: "<workspaceRoot>"})
52
+ ```
53
+
54
+ Document: HTTP method, path, handler symbol, and domain.
55
+
56
+ ### Step 4: Class Hierarchy
57
+
58
+ For each key class/interface in the codebase, trace inheritance chains.
59
+
60
+ ```
61
+ mcp_milens_get_type_hierarchy({name: "<BaseClass>", repo: "<workspaceRoot>"})
62
+ ```
63
+
64
+ ### Step 5: Execution Traces
65
+
66
+ Trace critical execution paths from entrypoints.
67
+
68
+ ```
69
+ mcp_milens_trace({name: "<entrypoint>", direction: "from", repo: "<workspaceRoot>"})
70
+ ```
71
+
72
+ ### Step 6: Coupling Analysis
73
+
74
+ For the top 5 hub symbols, analyze inter-domain coupling:
75
+
76
+ ```
77
+ mcp_milens_impact({target: "<hubSymbol>", depth: 3, repo: "<workspaceRoot>"})
78
+ ```
79
+
80
+ ```
81
+ mcp_milens_explain_relationship({from: "<domain-a>", to: "<domain-b>", repo: "<workspaceRoot>"})
82
+ ```
83
+
84
+ ### Step 7: Dead Code Detection
85
+
86
+ Find unused symbols that may indicate architectural drift.
87
+
88
+ ```
89
+ mcp_milens_find_dead_code({limit: 30, repo: "<workspaceRoot>"})
90
+ ```
91
+
92
+ ### Step 8: Architecture Scorecard
93
+
94
+ Produce a structured scorecard:
95
+
96
+ | Dimension | Score (1-10) | Notes |
97
+ |---|---|---|
98
+ | Domain Cohesion | | |
99
+ | Inter-domain Coupling | | |
100
+ | Route Coverage | | |
101
+ | Entry Point Clarity | | |
102
+ | Inheritance Depth | | |
103
+ | Dead Code Ratio | | |
104
+
105
+ List top 3 refactoring suggestions with risk levels and effort estimates.
106
+
107
+ ## Quality Gate
108
+
109
+ ### PASS if:
110
+ - [x] All domains documented with file/symbol counts
111
+ - [x] All API routes mapped to handlers
112
+ - [x] At least 5 class hierarchies traced
113
+ - [x] At least 3 execution traces analyzed
114
+ - [x] Coupling hotspots identified
115
+ - [x] Architecture scorecard completed with scores
116
+ - [x] Top 3 refactoring suggestions documented with risk levels
117
+
118
+ ### FAIL if:
119
+ - [ ] Any step skipped without documented reason
120
+ - [ ] Scorecard incomplete or scored without evidence
121
+ - [ ] Refactoring suggestions lack risk assessment
122
+
123
+ ## Never Skip
124
+
125
+ 1. Always run `mcp_milens_codebase_summary` first — it provides the scaffolding for all other steps
126
+ 2. Never skip coupling analysis — it's the most critical architecture insight
127
+ 3. Always include risk levels and effort estimates in refactoring suggestions
128
+ 4. Cross-reference findings with `mcp_milens_review_symbol` for CRITICAL hubs