{"id":29360027,"url":"https://github.com/laelluo/code_nexus","last_synced_at":"2026-05-17T00:02:13.408Z","repository":{"id":303567407,"uuid":"1015915074","full_name":"LaelLuo/code_nexus","owner":"LaelLuo","description":"A Rust-based code relationship management tool using MCP protocol. Organize and understand code structure through tags, comments, and relationships with advanced query capabilities (AND/OR/NOT/wildcards).","archived":false,"fork":false,"pushed_at":"2025-07-08T09:14:16.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-08T09:50:03.192Z","etag":null,"topics":["ai-integration","async-rust","code-analysis","code-management","code-nexus","code-organization","developer-tools","mcp","model-context-protocol","project-management","query-engine","relationship-mapping","rust","tagging-system","tokio"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LaelLuo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-08T08:13:36.000Z","updated_at":"2025-07-08T09:14:16.000Z","dependencies_parsed_at":"2025-07-08T09:50:12.966Z","dependency_job_id":null,"html_url":"https://github.com/LaelLuo/code_nexus","commit_stats":null,"previous_names":["laelluo/code_nexus"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LaelLuo/code_nexus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaelLuo%2Fcode_nexus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaelLuo%2Fcode_nexus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaelLuo%2Fcode_nexus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaelLuo%2Fcode_nexus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LaelLuo","download_url":"https://codeload.github.com/LaelLuo/code_nexus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LaelLuo%2Fcode_nexus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264411163,"owners_count":23603804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-integration","async-rust","code-analysis","code-management","code-nexus","code-organization","developer-tools","mcp","model-context-protocol","project-management","query-engine","relationship-mapping","rust","tagging-system","tokio"],"created_at":"2025-07-09T07:09:08.718Z","updated_at":"2025-10-20T02:06:01.988Z","avatar_url":"https://github.com/LaelLuo.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeNexus\n\nCodeNexus 是一个基于 Rust 和 Model Context Protocol (MCP) 的代码库关系管理工具，通过标签、注释和关联关系帮助开发者更好地组织和理解代码结构。\n\n## 功能特性\n\n- **标签管理**: 为文件添加结构化标签 (type:value 格式)\n- **注释系统**: 为文件添加描述性注释\n- **关联关系**: 建立文件间的依赖和关联关系\n- **智能查询**: 支持复杂的标签查询（AND、OR、NOT、通配符）和关系搜索\n- **多项目支持**: 同时管理多个项目，每个项目独立存储\n- **路径验证**: 确保文件路径安全性和有效性\n- **MCP 集成**: 通过 MCP 协议与 AI 助手无缝集成\n\n## 快速开始\n\n### 安装\n\n```bash\n# 克隆项目\ngit clone \u003crepository-url\u003e\ncd code_nexus\n\n# 构建项目\ncargo build --release\n```\n\n### 运行\n\n```bash\n# 启动 MCP 服务器\ncargo run\n```\n\n### 配置 MCP 客户端\n\n在你的 MCP 客户端配置中添加：\n\n```json\n{\n  \"mcpServers\": {\n    \"code-nexus\": {\n      \"command\": \"path/to/code-nexus\",\n      \"args\": [],\n      \"env\": {\n        \"RUST_LOG\": \"info\"\n      }\n    }\n  }\n}\n```\n\n## 使用示例\n\n### 标签管理\n\n```bash\n# 为文件添加标签（需要提供项目路径）\nadd_file_tags({\n  \"project_path\": \"/path/to/your/project\",\n  \"file_path\": \"src/api/user.rs\",\n  \"tags\": [\"category:api\", \"status:active\", \"tech:rust\"]\n})\n\n# 查询带有特定标签的文件\nquery_files_by_tags({\n  \"project_path\": \"/path/to/your/project\",\n  \"query\": \"category:api AND status:active\"\n})\n\n# 支持的查询语法：\n# - 单标签查询: \"category:api\"\n# - AND操作: \"category:api AND status:active\"\n# - OR操作: \"type:manager OR type:adapter\"\n# - NOT操作: \"NOT module:core\"\n# - 通配符: \"module:*\", \"type:*\"\n# - 复合查询: \"(type:manager OR type:adapter) AND NOT module:core\"\n\n# 获取所有标签\nget_all_tags({\n  \"project_path\": \"/path/to/your/project\"\n})\n```\n\n### 注释管理\n\n```bash\n# 添加文件注释\nadd_file_comment({\n  \"project_path\": \"/path/to/your/project\",\n  \"file_path\": \"src/api/user.rs\",\n  \"comment\": \"用户管理API，包含登录、注册等功能\"\n})\n\n# 更新注释\nupdate_file_comment({\n  \"project_path\": \"/path/to/your/project\",\n  \"file_path\": \"src/api/user.rs\",\n  \"comment\": \"用户管理API，支持OAuth登录\"\n})\n```\n\n## 查询语法\n\nCodeNexus 支持强大的查询语法，可以进行复杂的标签搜索：\n\n### 基本查询\n- **单标签查询**: `category:api`\n- **精确匹配**: `status:active`\n\n### 逻辑操作符\n- **AND操作**: `category:api AND status:active`\n- **OR操作**: `type:manager OR type:adapter`\n- **NOT操作**: `NOT module:core`\n\n### 通配符\n- **匹配所有**: `module:*` (匹配所有module标签)\n- **前缀匹配**: `type:manage*` (匹配type:manager等)\n\n### 复合查询\n- **组合查询**: `(type:manager OR type:adapter) AND NOT module:core`\n- **嵌套查询**: `layer:business AND (type:manager OR type:query)`\n\n### 查询示例\n```bash\n# 查找所有业务层的管理器文件\nquery_files_by_tags({\"query\": \"layer:business AND type:manager\"})\n\n# 查找非核心模块的所有文件\nquery_files_by_tags({\"query\": \"NOT module:core\"})\n\n# 查找管理器或适配器类型的文件\nquery_files_by_tags({\"query\": \"type:manager OR type:adapter\"})\n\n# 查找所有模块的文件（通配符）\nquery_files_by_tags({\"query\": \"module:*\"})\n```\n\n### 关联关系\n\n```bash\n# 添加文件关联\nadd_file_relation({\n  \"project_path\": \"/path/to/your/project\",\n  \"from_file\": \"src/api/user.rs\",\n  \"to_file\": \"src/models/user.rs\",\n  \"description\": \"依赖用户数据模型\"\n})\n\n# 查询文件关联\nquery_file_relations({\n  \"project_path\": \"/path/to/your/project\",\n  \"file_path\": \"src/api/user.rs\"\n})\n```\n\n## 多项目支持\n\nCodeNexus 支持同时管理多个项目，每个项目都有独立的数据存储：\n\n### 项目隔离\n- 每个项目在其根目录下创建 `.codenexus/` 数据目录\n- 项目间的标签、注释、关联关系完全隔离\n- 支持同时操作多个项目而不会相互干扰\n\n### 路径安全\n- 自动验证项目路径和文件路径的有效性\n- 防止路径遍历攻击，确保文件操作在项目范围内\n- 支持相对路径和绝对路径\n\n### 使用示例\n\n```bash\n# 项目A的操作\nadd_file_tags({\n  \"project_path\": \"/path/to/project-a\",\n  \"file_path\": \"src/main.rs\",\n  \"tags\": [\"category:entry\", \"lang:rust\"]\n})\n\n# 项目B的操作（完全独立）\nadd_file_tags({\n  \"project_path\": \"/path/to/project-b\",\n  \"file_path\": \"src/main.rs\",\n  \"tags\": [\"category:api\", \"lang:rust\"]\n})\n```\n\n## 项目结构\n\n```\ncode_nexus/\n├── src/\n│   ├── main.rs              # 程序入口\n│   ├── lib.rs               # 库入口\n│   ├── managers/            # 核心管理器\n│   │   ├── tag_manager.rs   # 标签管理\n│   │   ├── comment_manager.rs # 注释管理\n│   │   └── relation_manager.rs # 关联关系管理\n│   ├── query/               # 查询引擎\n│   ├── mcp/                 # MCP 适配器\n│   ├── storage/             # 数据存储\n│   ├── models.rs            # 数据模型\n│   └── error.rs             # 错误处理\n├── tests/                   # 测试文件\n├── docs/                    # 文档\n└── .codenexus/              # 数据存储目录\n    ├── tags.json            # 标签数据\n    ├── comments.json        # 注释数据\n    └── relations.json       # 关联关系数据\n```\n\n## 开发\n\n### 运行测试\n\n```bash\ncargo test\n```\n\n### 代码检查\n\n```bash\ncargo check\ncargo clippy\n```\n\n### 格式化代码\n\n```bash\ncargo fmt\n```\n\n## 技术栈\n\n- **Rust**: 核心编程语言\n- **rmcp**: Rust MCP SDK\n- **tokio**: 异步运行时\n- **serde**: 序列化/反序列化\n- **tracing**: 日志记录\n- **anyhow/thiserror**: 错误处理\n\n## 贡献\n\n欢迎提交 Issue 和 Pull Request！\n\n## 许可证\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaelluo%2Fcode_nexus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaelluo%2Fcode_nexus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaelluo%2Fcode_nexus/lists"}