SC

syahrul84/codemap

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 83 趋势 20MIT

Laravel、Vue、Nuxt 和 Next.js 项目的代码索引,提供给 Claude 而非 MCP:在 Claude 使用前检查名称,查找使用情况和受影响的测试,运行发布前检查并绘制代码映射。

概览

codemap读取Laravel、Vue 2、Vue 3或Nuxt(2/3/4)项目,并通过MCP向Claude提供相关信息,使Claude能够核对存在内容而非猜测: - 类、接口、特征、枚举、方法、函数、属性、常量、枚举案例。名称被完整解析,包含签名和文档摘要。- 对withRouting()、RouteServiceProvider及路由文件进行静态分析,包括组、资源和包含。可选支持php artisan route:list。- table、可填充/保护/隐藏、cast、append、relations、accessors、scopes、traits。- 通过重放迁移(以及压缩的schema:dump)重建,包含每列创建或最后更改的迁移和行。- 验证规则,链接到使用它们的控制器方法。

概述(AI 翻译)

为什么要用codemap。

  1. 它在AI发货前捕捉错误的猜测。 不存在的列、方法、端点和字段从verify返回为not_found,使用最接近的真实名称。这些漏洞在审查时看起来正确,只有在生产中才会失败。
  2. 它知道变更会破坏什么。 在某项更改或移除之前,find_usages 会列出所有使用该应用的地方,使用 file:line。更改后,它会命名覆盖该测试的具体情况,并给出只执行这些测试的具体命令,而非整个套件。
  3. 它会将前端与后端进行比对。 api_usage 会将 Vue、Nuxt 或 Next.js 代码中的每个 API 调用都匹配到服务它的 Laravel 路由,并标记不存在的路由调用,方法是错误的方法,并且前端读取后端从未返回。Grep 找不到这些。
  4. AI工作更快更便宜。 它要求一个类、一个组件或一个表,而不是读取整个文件。大多数答案不到一秒,长度只有几千字节,因此会话使用更少的令牌。
  5. **它能在发布前发现问题。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

codemap — project index MCP server for Laravel, Vue, Nuxt, Next.js, Swift, Android and Rust

codemap gives your AI assistant the facts about your project (classes, routes, columns, components, screens, endpoints), so it looks them up instead of guessing. You get fewer made-up names in the code it writes, fewer tokens spent reading whole files, and a correct picture of the project from the first message.

Why use codemap

  1. It catches made-up names before they ship. When the AI invents a column, method, route, component or endpoint (a “hallucination”), verify returns not_found with the closest real name, and codemap misses shows which names it keeps getting wrong. These bugs look correct in review and only fail in production.
  2. It knows what a change will break. Before something is renamed or removed, find_usages lists every place it’s used, with file:line. After a change, it names the tests that cover it and gives the exact commands to run only those, not the whole suite.
  3. It checks the frontend against the backend. api_usage matches every API call in Vue, Nuxt or Next.js code to the Laravel route that serves it, and flags calls to routes that don’t exist, the wrong method, and fields the frontend reads that the backend never returns. Grep can’t find these.
  4. The AI knows your project from the first message, and spends fewer tokens. One project_overview call (about 1,200 tokens on a 1,200-file app) gives the framework and version, layout, models, screens, crates or modules, and the names the AI got wrong in earlier sessions. After that it asks for one class, component or table instead of reading whole files. In a real Laravel app, get_symbol on the Order model answers in 5.3 KB instead of the 19.3 KB model file, and get_schema for orders in 8.9 KB instead of the 61.8 KB of the 26 migrations that build the table. codemap usage shows the answer sizes for your own project.
  5. It catches problems before a release. verify with release_check: true gives one list: missing endpoints, fields not returned, missing translations, unused code added on the branch, migrations not yet run, new environment variables, and what the server needs (migrate, cache clear, restart).

The same tools work across Laravel, Vue, Nuxt, Next.js, Swift, Android and Rust. Nothing leaves your machine: your code is never sent anywhere, and the index stays local.

Five-minute start

# macOS Apple Silicon: aarch64-apple-darwin · Intel Mac: x86_64-apple-darwin
# Linux: x86_64-unknown-linux-gnu / aarch64-unknown-linux-gnu · Windows: see below
curl -fsSL https://github.com/syahrul84/codemap/releases/latest/download/codemap-aarch64-apple-darwin.tar.gz | tar xz
mkdir -p ~/.local/bin && mv codemap ~/.local/bin/
codemap setup --dry-run   # see what setup would change
codemap setup             # Claude Code: register the server, add the rule block and the search hook
在 GitHub 查看完整 README

安装

docker run -i --rm -v ${PWD}:/workspace:ro -v codemap-data:/data codemap:latest serve --project /workspace
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "codemap": { "command": "codemap", "args": ["serve", "--project", "${PWD}"] } } }