LensPR
Alpha(0.1.x)— 実際のプロジェクトで動作し、作者が毎日使用しています。粗い部分があることを想定してください。
AIアシスタントは一度に1ファイルずつコードを編集します。依存関係を確認できません。grepや読み取り、推測を行い——3ファイル先のものを壊してしまいます。
LensPRはコードベースの依存関係グラフを構築し、AIが何かを変更する前に構造的な理解を提供します。
クイックスタート
要件: Python 3.11以上、macOSまたはLinux。TypeScript/JSプロジェクトの場合は、Node.js 18以上も必要です。
pip install 'lenspr[all]'
lenspr init .
lenspr setup .IDEを再起動してください。完了です。あなたのAIはlens_*ツールを利用できるようになります。
.lens/を.gitignoreに追加してください — グラフはローカルに保存され、ソースから再構築されます。
Related MCP server: codemap
機能
"この関数に依存しているものは?"
1回の呼び出しで、ソースコード、呼び出し元、呼び出し先、関連テストを取得できます:
> lens_context("auth.login_handler")
source: 42 lines
callers: auth_routes.create_routes, test_auth.test_login_success
callees: db.get_user, crypto.verify_password, jwt.create_token
tests: test_login_success, test_login_wrong_passwordLensPRがない場合、AIは5〜7回のgrep/read呼び出しを行っても見落としが発生します。LensPRがあれば — 1回の呼び出しで全体像を把握できます。
"これを変更したら何が壊れる?"
変更を加える前に、AIは影響範囲を確認します:
> lens_check_impact("models.User")
severity: CRITICAL
direct_dependents: 15
indirect_dependents: 23
affected_modules: auth, payments, notifications
tests_covering: 3AIは警告を発し、アプローチを変更するか、確認を求めます。盲目的な編集はもうありません。
"このコードベースの健全性は?"
> lens_vibecheck()
score: 86/100 (B)
test_coverage: 17/25 — 67% functions tested
dead_code: 20/20 — 0% dead code
circular_imports: 15/15 — 0 cycles
architecture: 12/15 — 1 violation
documentation: 8/10 — 81% documented
graph_confidence: 14/15 — 94% edges resolvedコードベースが時間とともに改善しているか、悪化しているかを追跡します。
クロスランゲージの可視性
LensPRはフロントエンドとバックエンドを単一のグラフに接続します:
LoginModal.tsx → fetch("/api/auth/login")
↓ CALLS_API
Backend: @router.post("/login") → login_handler()
→ db.query(User) [reads: users]
→ verify_password()
→ create_jwt_token()さらに、データベーステーブル、Dockerサービス、環境変数、CI/CDワークフロー、SQLマイグレーションも追跡します。
対応環境
IDE | セットアップ |
Claude Code |
|
Cursor |
|
任意のMCPクライアント |
|
対応言語: Python(Jedi/Pyrightによる95%以上の解決率)、TypeScript/JavaScript(tree-sitter + TS Compiler APIによる85〜95%)。
インフラストラクチャ: .sqlファイル、Dockerfile、docker-compose.yml、GitHub Actionsワークフロー、.envファイル — すべて同じグラフに解析されます。
すべてローカルで実行されます。コードがマシンの外に出ることはありません。
主な機能
影響分析 | 変更前の重大度(LOW → CRITICAL) |
ワンコールコンテキスト | 1回のリクエストでソース + 呼び出し元 + 呼び出し先 + テスト |
クロスランゲージ | フロントエンドHTTP → バックエンドルート、DBテーブル、Docker、環境変数、CI/CD |
外科的編集 | 関数内のターゲットを絞った検索/置換 — ファイル全体の書き換えなし |
デッドコード | 到達不能な関数を検出(Django、FastAPI、Celeryエントリポイント) |
アーキテクチャルール | レイヤー境界を強制 — 違反は変更適用前に警告 |
関数単位のGit | 関数レベルでのblame、履歴、コミット範囲 |
セッションメモリ | AIはコンテキストリセット後も中断したところから再開 |
自動同期 | ファイルウォッチャーが保存のたびにグラフを更新 |
ヘルススコア | 6つの次元で0〜100のスコア — 品質を経時的に追跡 |
12グループに編成された60以上のツール — lenspr tools で必要なものだけを有効にできます。
ナビゲーションと検索 (8): lens_context, lens_get_node, lens_search, lens_grep, lens_find_usages, lens_get_structure, lens_list_nodes, lens_get_connections
変更 (6): lens_update_node, lens_patch_node, lens_add_node, lens_delete_node, lens_rename, lens_batch
解析 (6): lens_check_impact, lens_validate_change, lens_health, lens_dead_code, lens_dependencies, lens_diff
品質 (7): lens_vibecheck, lens_nfr_check, lens_test_coverage, lens_security_scan, lens_dep_audit, lens_fix_plan, lens_generate_test_skeleton
アーキテクチャ (9): lens_arch_rule_add, lens_arch_rule_list, lens_arch_rule_delete, lens_arch_check, lens_class_metrics, lens_project_metrics, lens_largest_classes, lens_compare_classes, lens_components
Git (4): lens_blame, lens_node_history, lens_commit_scope, lens_recent_changes
インフラストラクチャ (5): lens_api_map, lens_db_map, lens_env_map, lens_ffi_map, lens_infra_map
テストとトレース (3): lens_run_tests, lens_trace, lens_trace_stats
アノテーション (5): lens_annotate, lens_save_annotation, lens_batch_save_annotations, lens_annotate_batch, lens_annotation_stats
セッション (4): lens_session_write, lens_session_read, lens_session_handoff, lens_resume
時間 (2): lens_hotspots, lens_node_timeline
説明 (1): lens_explain
既知の制限
Windows — サポートされていません。macOSとLinuxのみです。
self.method()呼び出し — 静的パーサーはインスタンスメソッドのディスパッチを完全には解決できません。回避策:lens_trace(Python 3.12+)が実行時にこれらを解決します。Go、Rust、Java — まだサポートされていません。パーサーインターフェースはコントリビューター向けに用意されています。
動的コード —
getattr、eval、動的インポートは静的に追跡できません。
コントリビューション
試してみてください。壊れたら教えてください。
バグ報告 — 「動かない」でも助けになります
言語パーサー — Go、Rust、Java(BaseParserインターフェースは準備済み)
アイデア — issueを開く
ライセンス
MIT
AIがコードを壊し続けたから作った。
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceMCP server for AI coding agents that builds a complete code structure graph and semantic vector index, enabling fast querying of code entities, relationships, and impact analysis.20 npm11-
- AlicenseNot gradedqualityAmaintenanceMCP server for local-first code intelligence, providing structural code graph, semantic search, and impact analysis to AI agents.2MIT
- AlicenseNot gradedqualityBmaintenanceA persistent code-intelligence MCP server that builds a queryable knowledge graph of your codebase, enabling AI assistants to perform cross-file structural reasoning, dependency analysis, and blast radius detection.9MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that provides coding agents with structured repository context, including graph-based navigation, dependency analysis, runtime flow tracing, and configuration surface across supported stacks.75 npmMIT