milens 0.7.2 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/adapters/SKILL.md +59 -59
- package/.agents/skills/analyzer/SKILL.md +83 -83
- package/.agents/skills/apps/SKILL.md +65 -65
- package/.agents/skills/docs/SKILL.md +63 -63
- package/.agents/skills/milens/SKILL.md +322 -322
- package/.agents/skills/milens-security-review/SKILL.md +224 -224
- package/.agents/skills/orchestrator/SKILL.md +64 -64
- package/.agents/skills/parser/SKILL.md +86 -86
- package/.agents/skills/root/SKILL.md +89 -89
- package/.agents/skills/scripts/SKILL.md +56 -56
- package/.agents/skills/security/SKILL.md +67 -67
- package/.agents/skills/server/SKILL.md +84 -84
- package/.agents/skills/store/SKILL.md +77 -77
- package/.agents/skills/test/SKILL.md +155 -155
- package/.agents/skills/ui/SKILL.md +56 -56
- package/README.md +577 -577
- package/adapters/README.md +144 -144
- package/adapters/claude-code/.claude/mcp.json +9 -9
- package/adapters/claude-code/.claude/settings.json.hooks-snippet.json +26 -26
- package/adapters/claude-code/.claude-plugin/plugin.json +11 -11
- package/adapters/claude-code/.mcp.json +9 -9
- package/adapters/claude-code/CLAUDE.md +81 -81
- package/adapters/claude-code/hooks/hooks.json +27 -27
- package/adapters/codex/.codex/config.toml +3 -3
- package/adapters/copilot/.vscode/mcp.json +10 -10
- package/adapters/cursor/.cursor/mcp.json +9 -9
- package/adapters/cursor/.cursorrules +69 -69
- package/adapters/gemini/.gemini/context.md +81 -81
- package/adapters/gemini/.gemini/settings.json +9 -9
- package/adapters/opencode/.opencode/config.json +8 -8
- package/adapters/zed/.zed/settings.json +8 -8
- package/dist/build-info.d.ts +2 -2
- package/dist/build-info.js +2 -2
- package/dist/cli.js +482 -482
- package/dist/parser/lang-css.js +9 -9
- package/dist/parser/lang-go.js +58 -58
- package/dist/parser/lang-html.js +3 -3
- package/dist/parser/lang-java.js +37 -37
- package/dist/parser/lang-js.js +105 -105
- package/dist/parser/lang-php.js +45 -45
- package/dist/parser/lang-py.js +43 -43
- package/dist/parser/lang-ruby.js +28 -28
- package/dist/parser/lang-rust.js +48 -48
- package/dist/parser/lang-ts.js +210 -210
- package/dist/server/mcp-prompts.js +502 -502
- package/dist/server/mcp.js +56 -56
- package/dist/skills.js +296 -296
- package/dist/store/annotations.js +1 -1
- package/dist/store/db.js +224 -224
- package/dist/store/schema.sql +144 -144
- package/dist/store/vectors.js +2 -2
- package/package.json +85 -85
package/dist/server/mcp.js
CHANGED
|
@@ -376,62 +376,62 @@ function loadGrepIgnoreRules(rootPath) {
|
|
|
376
376
|
return ig;
|
|
377
377
|
}
|
|
378
378
|
// ── Server instructions (sent to client via MCP protocol on initialize) ──
|
|
379
|
-
const MILENS_INSTRUCTIONS = `⚠️ CRITICAL: This project is indexed by milens (knowledge graph). Use milens MCP tools BEFORE reading files directly.
|
|
380
|
-
|
|
381
|
-
WHY: The knowledge graph already knows every symbol, dependency, and reference. Reading files manually = slower, more expensive, and misses hidden connections.
|
|
382
|
-
|
|
383
|
-
RULE: Before opening ANY file to understand code, call the appropriate milens tool:
|
|
384
|
-
- overview({name: "X"}) — understand a symbol (context + impact + grep). Replaces 3-5 file reads.
|
|
385
|
-
- impact({target: "X", mode: "strict"}) — check blast radius BEFORE editing. strict mode BLOCKS if >5 deps.
|
|
386
|
-
- guard_edit_check({name: "X", session_id}) — HARD safety gate. Call BEFORE every edit. Returns BLOCKED if high risk.
|
|
387
|
-
- grep({pattern: "X"}) — find ALL text references (code, templates, docs, configs, styles).
|
|
388
|
-
- codebase_summary() — 500-token project overview. Use INSTEAD of reading README or exploring directories.
|
|
389
|
-
- detect_changes() — verify changes before committing. Shows changed symbols + risk scores.
|
|
390
|
-
- query({query: "X"}) — find symbol definitions by name. FTS5 instant search.
|
|
391
|
-
|
|
392
|
-
AUDIT: session_end reports which symbols were safety-checked. Editing without checks = audit gap.
|
|
393
|
-
|
|
394
|
-
TOKEN SAVINGS: Using milens first typically means far fewer tokens than manual exploration, and fewer missed dependencies — impact/context track code-level references; pair with grep for templates/configs/docs.
|
|
395
|
-
|
|
396
|
-
milens — code intelligence engine. Indexes codebases into symbol graphs.
|
|
397
|
-
|
|
398
|
-
## Tool selection
|
|
399
|
-
- \`query\` — find symbol definitions (code identifiers only)
|
|
400
|
-
- \`grep\` — text search ALL files. Use \`scope\` param: all (default), code (source only), imports, definitions
|
|
401
|
-
- \`context\` — 360° view: incoming + outgoing for a symbol
|
|
402
|
-
- \`impact\` — blast radius: what breaks if symbol changes
|
|
403
|
-
- \`overview\` — combined context + impact + grep in one call (preferred for editing workflows)
|
|
404
|
-
- \`guard_edit_check\` — HARD pre-edit gate: blocks if dependents > 5, tracks checks for session audit
|
|
405
|
-
- \`edit_check\` — pre-edit safety: callers + export status + re-export chains + test coverage + ⚠ warnings (fastest for edits)
|
|
406
|
-
- \`trace\` — execution flow: call chains from entrypoints to a symbol (or downstream from it)
|
|
407
|
-
- \`routes\` — detect framework routes/endpoints (Express, FastAPI, NestJS, Flask, Go, PHP, Rails)
|
|
408
|
-
- \`smart_context\` — intent-aware context: understand/edit/debug/test (returns only what matters for intent)
|
|
409
|
-
- \`domains\` — show domain clusters: groups of files forming logical modules based on dependency graph
|
|
410
|
-
- \`repos\` — list all indexed repositories with summary stats (multi-repo support)
|
|
411
|
-
- \`detect_changes\` — git diff → affected symbols
|
|
412
|
-
- \`explain_relationship\` — shortest path between two symbols
|
|
413
|
-
- \`find_dead_code\` — unused exports
|
|
414
|
-
- \`get_file_symbols\` — all symbols in a file
|
|
415
|
-
- \`get_type_hierarchy\` — inheritance tree
|
|
416
|
-
|
|
417
|
-
## Rules
|
|
418
|
-
- Before editing a symbol: run \`guard_edit_check\` or \`edit_check\` or \`smart_context\` with intent=edit
|
|
419
|
-
- \`guard_edit_check({name, session_id})\` — HARD gate: records check for audit, blocks if dependents > 5
|
|
420
|
-
- \`impact({mode: "strict"})\` — strict mode returns BLOCKED when depth-1 deps > 5
|
|
421
|
-
- For debugging: run \`smart_context\` with intent=debug or \`trace\` to=symbol
|
|
422
|
-
- For writing tests: run \`smart_context\` with intent=test — shows deps to mock + callers to cover
|
|
423
|
-
- \`impact\` only tracks code deps — always pair with \`grep\` for templates/configs
|
|
424
|
-
- Use \`query\` for camelCase/PascalCase identifiers, \`grep\` for display text or multi-word strings
|
|
425
|
-
- impact depth: 1=WILL BREAK, 2=LIKELY AFFECTED, 3=MAY NEED TESTING
|
|
426
|
-
- ⚠ markers indicate unresolved INTERNAL references — external package imports/calls are tracked separately
|
|
427
|
-
- ✓ test coverage shown on edit_check — symbols with no test coverage get a warning
|
|
428
|
-
- ⏳ staleness: files not re-analyzed in 24h are flagged — consider re-running \`milens analyze\`
|
|
429
|
-
|
|
430
|
-
## Resources (MCP Resources protocol)
|
|
431
|
-
- \`milens://overview\` — index overview (stats, domains, coverage, staleness)
|
|
432
|
-
- \`milens://symbol/{name}\` — symbol context by name
|
|
433
|
-
- \`milens://file/{path}\` — all symbols in a file
|
|
434
|
-
- \`milens://domain/{name}\` — domain cluster details
|
|
379
|
+
const MILENS_INSTRUCTIONS = `⚠️ CRITICAL: This project is indexed by milens (knowledge graph). Use milens MCP tools BEFORE reading files directly.
|
|
380
|
+
|
|
381
|
+
WHY: The knowledge graph already knows every symbol, dependency, and reference. Reading files manually = slower, more expensive, and misses hidden connections.
|
|
382
|
+
|
|
383
|
+
RULE: Before opening ANY file to understand code, call the appropriate milens tool:
|
|
384
|
+
- overview({name: "X"}) — understand a symbol (context + impact + grep). Replaces 3-5 file reads.
|
|
385
|
+
- impact({target: "X", mode: "strict"}) — check blast radius BEFORE editing. strict mode BLOCKS if >5 deps.
|
|
386
|
+
- guard_edit_check({name: "X", session_id}) — HARD safety gate. Call BEFORE every edit. Returns BLOCKED if high risk.
|
|
387
|
+
- grep({pattern: "X"}) — find ALL text references (code, templates, docs, configs, styles).
|
|
388
|
+
- codebase_summary() — 500-token project overview. Use INSTEAD of reading README or exploring directories.
|
|
389
|
+
- detect_changes() — verify changes before committing. Shows changed symbols + risk scores.
|
|
390
|
+
- query({query: "X"}) — find symbol definitions by name. FTS5 instant search.
|
|
391
|
+
|
|
392
|
+
AUDIT: session_end reports which symbols were safety-checked. Editing without checks = audit gap.
|
|
393
|
+
|
|
394
|
+
TOKEN SAVINGS: Using milens first typically means far fewer tokens than manual exploration, and fewer missed dependencies — impact/context track code-level references; pair with grep for templates/configs/docs.
|
|
395
|
+
|
|
396
|
+
milens — code intelligence engine. Indexes codebases into symbol graphs.
|
|
397
|
+
|
|
398
|
+
## Tool selection
|
|
399
|
+
- \`query\` — find symbol definitions (code identifiers only)
|
|
400
|
+
- \`grep\` — text search ALL files. Use \`scope\` param: all (default), code (source only), imports, definitions
|
|
401
|
+
- \`context\` — 360° view: incoming + outgoing for a symbol
|
|
402
|
+
- \`impact\` — blast radius: what breaks if symbol changes
|
|
403
|
+
- \`overview\` — combined context + impact + grep in one call (preferred for editing workflows)
|
|
404
|
+
- \`guard_edit_check\` — HARD pre-edit gate: blocks if dependents > 5, tracks checks for session audit
|
|
405
|
+
- \`edit_check\` — pre-edit safety: callers + export status + re-export chains + test coverage + ⚠ warnings (fastest for edits)
|
|
406
|
+
- \`trace\` — execution flow: call chains from entrypoints to a symbol (or downstream from it)
|
|
407
|
+
- \`routes\` — detect framework routes/endpoints (Express, FastAPI, NestJS, Flask, Go, PHP, Rails)
|
|
408
|
+
- \`smart_context\` — intent-aware context: understand/edit/debug/test (returns only what matters for intent)
|
|
409
|
+
- \`domains\` — show domain clusters: groups of files forming logical modules based on dependency graph
|
|
410
|
+
- \`repos\` — list all indexed repositories with summary stats (multi-repo support)
|
|
411
|
+
- \`detect_changes\` — git diff → affected symbols
|
|
412
|
+
- \`explain_relationship\` — shortest path between two symbols
|
|
413
|
+
- \`find_dead_code\` — unused exports
|
|
414
|
+
- \`get_file_symbols\` — all symbols in a file
|
|
415
|
+
- \`get_type_hierarchy\` — inheritance tree
|
|
416
|
+
|
|
417
|
+
## Rules
|
|
418
|
+
- Before editing a symbol: run \`guard_edit_check\` or \`edit_check\` or \`smart_context\` with intent=edit
|
|
419
|
+
- \`guard_edit_check({name, session_id})\` — HARD gate: records check for audit, blocks if dependents > 5
|
|
420
|
+
- \`impact({mode: "strict"})\` — strict mode returns BLOCKED when depth-1 deps > 5
|
|
421
|
+
- For debugging: run \`smart_context\` with intent=debug or \`trace\` to=symbol
|
|
422
|
+
- For writing tests: run \`smart_context\` with intent=test — shows deps to mock + callers to cover
|
|
423
|
+
- \`impact\` only tracks code deps — always pair with \`grep\` for templates/configs
|
|
424
|
+
- Use \`query\` for camelCase/PascalCase identifiers, \`grep\` for display text or multi-word strings
|
|
425
|
+
- impact depth: 1=WILL BREAK, 2=LIKELY AFFECTED, 3=MAY NEED TESTING
|
|
426
|
+
- ⚠ markers indicate unresolved INTERNAL references — external package imports/calls are tracked separately
|
|
427
|
+
- ✓ test coverage shown on edit_check — symbols with no test coverage get a warning
|
|
428
|
+
- ⏳ staleness: files not re-analyzed in 24h are flagged — consider re-running \`milens analyze\`
|
|
429
|
+
|
|
430
|
+
## Resources (MCP Resources protocol)
|
|
431
|
+
- \`milens://overview\` — index overview (stats, domains, coverage, staleness)
|
|
432
|
+
- \`milens://symbol/{name}\` — symbol context by name
|
|
433
|
+
- \`milens://file/{path}\` — all symbols in a file
|
|
434
|
+
- \`milens://domain/{name}\` — domain cluster details
|
|
435
435
|
`;
|
|
436
436
|
// ── Server setup ──
|
|
437
437
|
export function createMcpServer(rootPath) {
|