ConflictHQ/navegador

GitHub: ConflictHQ/navegador

基于知识图谱的代码上下文引擎,将源代码与团队知识组织成可查询图谱以提升 AI 编码效率。

Stars: 7 | Forks: 0

# 浏览器 **你的代码库以及团队对其了解的一切 — 整合到一个可查询的图谱中。** Navegador 将源代码解析为属性图,并在其上叠加团队的知识:决策、概念、规则、人员、维基页面和会议输出。AI 编码代理获得的是结构化、精确的上下文,而非原始文件转储。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/236deb93c8195129.svg)](https://github.com/ConflictHQ/navegador/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/navegador)](https://pypi.org/project/navegador/) [![Python](https://img.shields.io/pypi/pyversions/navegador)](https://pypi.org/project/navegador/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Docs](https://img.shields.io/badge/docs-navegador.dev-blue)](https://navegador.dev) ## 两层,一个图谱 ``` ┌─────────────────────────────────────────────────────────────────┐ │ KNOWLEDGE LAYER │ │ Concepts · Rules · Decisions · WikiPages · People · Domains │ │ │ │ ↕ GOVERNS / IMPLEMENTS / DOCUMENTS / ANNOTATES │ │ │ │ CODE LAYER │ │ Repository · File · Module · Class · Function · Method │ │ Variable · Import · Decorator · (call graphs, hierarchies) │ └─────────────────────────────────────────────────────────────────┘ stored in FalkorDB (SQLite local · Redis prod) ``` **代码层** 通过摄取源代码树自动构建。**知识层** 由团队填充——通过手动操作、维基摄取或 [PlanOpticon](https://github.com/ConflictHQ/PlanOpticon) 会议分析输出。 ## 快速开始 ``` pip install navegador # 导入你的仓库 navegador ingest ./myrepo # 加载文件的上下文 navegador context src/auth.py # 在代码 + 知识中搜索 navegador search "rate limit" --all # 解释一个符号 navegador explain AuthService # 检查图表统计 navegador stats ``` ## MCP 集成 添加到你的 Claude / Cursor / Gemini MCP 配置: ``` { "mcpServers": { "navegador": { "command": "navegador", "args": ["mcp", "--db", ".navegador/graph.db"] } } } ``` 可用的 MCP 工具: | 工具 | 描述 | |------|-------------| | `ingest_repo` | 解析并加载仓库到图谱 | | `load_file_context` | 文件中的所有符号及其关系 | | `load_function_context` | 函数的调用关系与调用者 | | `load_class_context` | 类的方法、继承与子类 | | `search_symbols` | 按名称模糊搜索函数/类 | | `query_graph` | 原始 Cypher 透传(带安全加固) | | `graph_stats` | 节点与边数量统计 | | `get_rationale` | 决策理由、替代方案与状态 | | `find_owners` | 分配给任意节点的人员 | | `search_knowledge` | 搜索概念、规则、决策、维基 | | `blast_radius` | 影响分析——变更影响范围 | ## 知识层 除了代码结构,Navegador 还存储团队已知的内容: ``` # 记录架构决策 navegador add decision "Use FalkorDB for graph storage" \ --rationale "Cypher queries, SQLite-backed zero-infra mode" # 定义业务概念并链接到代码 navegador add concept PaymentProcessing navegador annotate PaymentProcessing --function process_charge # 添加一条规则 navegador add rule "All writes must go through the service layer" # 导入你的 GitHub Wiki navegador wiki ingest --repo myorg/myrepo # 导入 PlanOpticon 会议分析 navegador planopticon ingest ./meeting-output/ ``` ## 图谱模式 **代码节点:** `Repository` · `File` · `Module` · `Class` · `Function` · `Method` · `Variable` · `Import` · `Decorator` **知识节点:** `Concept` · `Rule` · `Decision` · `Person` · `Domain` · `WikiPage` **边:** `CONTAINS` · `DEFINES` · `IMPORTS` · `CALLS` · `INHERITS` · `REFERENCES` · `DEPENDS_ON` · `GOVERNS` · `IMPLEMENTS` · `DOCUMENTS` · `ANNOTATES` ## 存储 | 模式 | 后端 | 适用场景 | |------|---------|-------------| | 默认 | `falkordblite`(SQLite) | 本地开发,零基础设施 | | 生产 | Redis + FalkorDB 模块 | 共享部署、代理集群 | ``` from navegador.graph import GraphStore store = GraphStore.sqlite(".navegador/graph.db") # default store = GraphStore.redis("redis://localhost:6379") # production ``` ## 语言支持 | 语言 | 状态 | |------|--------| | Python | ✅ | | TypeScript / JavaScript | ✅ | | Go | ✅ | | Rust | ✅ | | Java | ✅ | | Kotlin | ✅ | | C# | ✅ | | PHP | ✅ | | Ruby | ✅ | | Swift | ✅ | | C / C++ | ✅ | ## 框架增强 在摄取代码后,Navegador 可将通用 AST 节点提升为框架特定的语义类型: ``` navegador enrich # auto-detect frameworks navegador enrich --framework django # target a specific framework ``` 支持的框架:**Django**、**FastAPI**、**React / Next.js**、**Express.js**、**React Native**、**Rails**、**Spring Boot**、**Laravel** ## 结构分析 ``` navegador impact AuthService --depth 3 # blast radius navegador trace handle_request # execution flow from entry point navegador deadcode # unreachable functions/classes navegador cycles # circular dependencies navegador testmap # link tests to production code navegador diff # map uncommitted changes to graph navegador churn . # behavioural coupling from git history ``` ## 智能层 ``` navegador semantic-search "authentication flow" # embedding-based search navegador communities # detect code communities navegador ask "what calls the payment service?" # natural language queries navegador docs src/auth.py # generate documentation ``` 需要 LLM 提供者:`pip install navegador[llm]` ## Python SDK ``` from navegador import Navegador nav = Navegador.sqlite(".navegador/graph.db") nav.ingest("./myrepo") nav.add_concept("Payment", description="Payment processing", domain="billing") results = nav.search("auth") bundle = nav.explain("AuthService") owners = nav.find_owners("AuthService") ``` ## 集群模式(代理集群) 适用于共享基于 Redis 后端的图谱的多代理设置: ``` navegador init --redis redis://host:6379 --cluster ``` 特性:共享图谱、本地快照、发布/订阅通知、任务队列、分布式锁、会话命名空间、检查点、代理消息传递、可观测性仪表板。 ## 额外集成 ``` navegador codeowners ./myrepo # parse CODEOWNERS → ownership graph navegador adr ingest docs/decisions/ # Architecture Decision Records navegador api ingest openapi.yaml # OpenAPI / GraphQL schemas navegador deps ingest package.json # external dependency tracking navegador pm ingest --github org/repo # GitHub issues → knowledge graph navegador editor setup claude-code # generate MCP config for editors navegador explore # browser-based graph visualization ``` ## 安装 ### PyPI ``` pip install navegador ``` ### 独立二进制文件 无需 Python — 从 [GitHub Releases](https://github.com/ConflictHQ/navegador/releases) 下载预编译二进制文件: | 平台 | 二进制文件 | |------|--------| | macOS(Apple Silicon) | `navegador-macos-arm64` | | macOS(Intel) | `navegador-macos-x86_64` | | Linux | `navegador-linux-x86_64` | | Windows | `navegador-windows-x86_64.exe` | ### 从源码构建 ``` git clone https://github.com/ConflictHQ/navegador.git cd navegador pip install -e ".[dev]" pytest ``` ## 贡献 参见 [CONTRIBUTING.md](.github/CONTRIBUTING.md)。欢迎通过 [GitHub Issues](https://github.com/ConflictHQ/navegador/issues) 提交错误报告和功能请求。 ## 许可证 MIT — [CONFLICT](https://weareconflict.com)
标签:AI编码代理, AI编程助手, FalkorDB, Python, Redis, SQLite, 上下文引擎, 代码分析, 代码导航, 代码库图, 代码推荐, 代码搜索, 代码文档, 代码理解, 会议记录, 依赖图, 决策记录, 凭证管理, 可查询图, 团队知识, 搜索引擎查询, 无后门, 知识管理, 结构化上下文, 规则, 调用图, 逆向工具, 领域概念