
Lenspr
io.github.kyrylopr由 GitHub 账号 kyrylopr 发布v0.1.1更新于 Oct 24, 2026
Stop vibecoding blind. Code graph so your AI stops breaking things across your codebase.
概览
为代码库构建本地依赖图,让 AI 助手在改代码前看到调用方、被调用方、测试与影响范围。
- 可以做什么
- LensPR 把本地代码库解析成依赖图,并提供 12 组、60 多个 lens_* 工具。导航与搜索工具一次调用即可返回源码、调用方、被调用方和相关测试;分析工具在改动前给出影响范围与严重级别;质量工具评估健康度、覆盖率、死代码和架构规则。它还支持按函数的 git blame 与历史、SQL、Docker、环境变量和 CI/CD 的基础设施映射,以及会话记忆和标注。
- 适用场景
- 当 AI 编程助手要修改 Python 或 TypeScript/JavaScript 项目、需要结构信息以避免破坏远处依赖时适用。适合重构前的影响检查、死代码与覆盖率审查、架构规则约束,以及前后端跨语言调用链追踪。
- 运行要求
- 以本地进程方式从 PyPI 安装(pip install 'lenspr[all]')。需要 Python 3.11+,仅支持 macOS 或 Linux,不支持 Windows;TypeScript/JavaScript 项目还需 Node.js 18+。安装后运行 lenspr init 与 lenspr setup,并重启 IDE。未声明账号、API 密钥或环境变量。
安装
在 SourceWeft 中
- 打开 控制台中的 Lenspr,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Code intelligence for AI coding agents. Your AI sees dependencies before making changes.
Alpha (0.1.x) — works on real projects, used daily by the author. Expect rough edges.
AI assistants edit your code one file at a time. They don't see dependencies. They grep, read, guess — and break things three files away.
LensPR builds a dependency graph of your codebase and gives your AI structural understanding before it changes anything.
Quick Start
Requires Python 3.11+, macOS or Linux. For TypeScript/JS projects, also Node.js 18+.
Restart your IDE. Done. Your AI now has lens_* tools.
Add
.lens/to your.gitignore— the graph is local and rebuilt from source.
What It Does
"What depends on this function?"
One call returns source code, who calls it, what it calls, and related tests:
Without LensPR your AI makes 5-7 grep/read calls and still misses things. With LensPR — one call, full picture.
"What breaks if I change this?"
Before any modification, the AI sees the blast radius:
The AI warns you, changes its approach, or asks for confirmation. No more blind edits.
"How healthy is this codebase?"
Track whether the codebase is improving or degrading over time.
Cross-language visibility
LensPR connects frontend and backend into a single graph:
Also tracks: database tables, Docker services, env vars, CI/CD workflows, SQL migrations.
Works With
Languages: Python (95%+ resolution via Jedi/Pyright) and TypeScript/JavaScript (85-95% via tree-sitter + TS Compiler API).
Infrastructure: .sql files, Dockerfiles, docker-compose.yml, GitHub Actions workflows, .env files — all parsed into the same graph.
Everything runs locally. Your code never leaves your machine.
Key Features
60+ tools organized in 12 groups — enable only what you need with lenspr tools.
All tools by category
Navigation & Search (8): lens_context, lens_get_node, lens_search, lens_grep, lens_find_usages, lens_get_structure, lens_list_nodes, lens_get_connections
Modification (6): lens_update_node, lens_patch_node, lens_add_node, lens_delete_node, lens_rename, lens_batch
Analysis (6): lens_check_impact, lens_validate_change, lens_health, lens_dead_code, lens_dependencies, lens_diff
Quality (7): lens_vibecheck, lens_nfr_check, lens_test_coverage, lens_security_scan, lens_dep_audit, lens_fix_plan, lens_generate_test_skeleton
Architecture (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
Infrastructure (5): lens_api_map, lens_db_map, lens_env_map, lens_ffi_map, lens_infra_map
Testing & Tracing (3): lens_run_tests, lens_trace, lens_trace_stats
Annotations (5): lens_annotate, lens_save_annotation, lens_batch_save_annotations, lens_annotate_batch, lens_annotation_stats
Session (4): lens_session_write, lens_session_read, lens_session_handoff, lens_resume
Temporal (2): lens_hotspots, lens_node_timeline
Explanation (1): lens_explain
Known Limitations
- Windows — not supported. macOS and Linux only.
self.method()calls — static parser can't fully resolve instance method dispatch. Workaround:lens_trace(Python 3.12+) resolves these at runtime.- Go, Rust, Java — not yet supported. Parser interface is ready for contributors.
- Dynamic code —
getattr,eval, dynamic imports can't be tracked statically.
Contributing
Try it. If it breaks, tell me.
- Bug reports — even "this doesn't work" is helpful
- Language parsers — Go, Rust, Java (BaseParser interface is ready)
- Ideas — open an issue
License
MIT
Built because AI kept breaking my code.
来源:README.md,提交 87bd1c9
工具
0版本历史
1- v0.1.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分