@flaid/devmap

中文文档
0.9.4发布于 2026/11/14MITTypeScriptES Module构建来源已验证近 30 天下载 2603

CLI that maps your codebase into a reusable context layer for developers and AI agents: entry points, critical files, features and routes for JS/TS projects.

原始使用文档
文档目录12 节
  1. Install
  2. Requirements
  3. Quick Start
  4. AI Provider Setup
  5. Commands
  6. MCP Server
  7. Generated Context
  8. For AI Agents
  9. Supported Stacks
  10. Privacy
  11. Links
  12. License

DevMap

npm version license node

Analyze once. Reuse context everywhere. A CLI that maps your codebase for developers and AI agents: entry points, critical files, features and routes.

Documentation · Website · GitHub

Every new AI chat about your code starts from zero — you re-explain the same codebase every time. DevMap fixes that.

It's a CLI that combines static analysis with optional AI interpretation to build a structured, reusable understanding layer of your project — once. That layer (.devmap/index.json, feature maps, DEVMAP.md) is what you and any AI agent read afterward, instead of re-scanning or re-pasting the whole repo. Full repo source stays local — nothing gets sent wholesale to the AI model.

Install

npm install --global @flaid/devmap

Or run without a global install:

npx @flaid/devmap --help

Requirements

  • Node.js 22.12 or newer
  • An API key for an AI provider: Groq, OpenRouter, or any custom OpenAI-compatible endpoint

Static analysis still works when AI is not configured.

Quick Start

Run these commands from the root of the project you want to understand:

devmap init
devmap analyze
devmap onboarding
devmap doctor

devmap init selects a provider, validates its key, stores configuration locally, prepares .devmap/, generates DEVMAP.md, and integrates with AGENTS.md safely.

AI Provider Setup

Choose Groq, OpenRouter, or a custom OpenAI-compatible endpoint with the arrow keys during:

devmap init

Groq keys are available at https://console.groq.com/keys. OpenRouter keys are available at https://openrouter.ai/keys.

For custom endpoints, DevMap asks for the base URL (prefilled with http://localhost:20128/v1) and lists the models your server exposes, so any OpenAI-compatible self-hosted gateway works out of the box.

For OpenRouter, DevMap prompts:

OpenRouter model [openrouter/free]:

Press Enter to use the free router, or type any free or paid OpenRouter model ID. The selected model is saved and used as the primary choice.

For non-interactive Groq setup:

GROQ_API_KEY="your-key" devmap init

On PowerShell:

$env:GROQ_API_KEY="your-key"
devmap init
Remove-Item Env:GROQ_API_KEY

For non-interactive OpenRouter setup:

OPENROUTER_API_KEY="your-key" devmap init

The key is stored locally in ~/.devmap/config.json. Requests go directly from your machine to the selected provider. DevMap does not send the key to a DevMap-owned server.

Commands

devmap init
devmap analyze
devmap analyze --fresh
devmap map                    # full project map
devmap map <feature-or-file>  # scoped to one feature or file
devmap flow                   # curated top flows
devmap flow <feature-or-route>
devmap explain <target>       # file, feature, or function
devmap onboarding --write
devmap onboarding --write --language id
devmap doctor
devmap config model auto
devmap mcp                    # run as an MCP server

Groq and OpenRouter use the model selected during init. Change either provider's model with:

devmap config model <model-id>
devmap config model auto

MCP Server

devmap mcp runs DevMap as a Model Context Protocol server over stdio. An AI agent asks the project map questions with tool calls and gets structured JSON back, instead of reading a whole context file up front.

devmap analyze
claude mcp add devmap -- npx -y @flaid/devmap mcp

Other clients launch the same command (npx -y @flaid/devmap mcp) as a stdio server:

{
  "mcpServers": {
    "devmap": {
      "command": "npx",
      "args": ["-y", "@flaid/devmap", "mcp"]
    }
  }
}

Tools: devmap_overview, devmap_map, devmap_flow, devmap_routes, devmap_impact, devmap_find, devmap_analyze and, only with --allow-ai, devmap_explain.

The server is read-only and static by default: no AI provider is contacted unless you start it with --allow-ai, and it only writes inside .devmap/ when the agent calls devmap_analyze or you start it with --auto-refresh. Every answer reports whether the snapshot is stale. See the MCP guide for client setup and tool inputs.

Generated Context

DevMap generates:

  • .devmap/index.json for lightweight AI-agent navigation
  • .devmap/features/*.json for focused feature maps and source priority
  • .devmap/snapshot.json for the full structured project analysis archive
  • DEVMAP.md for human and AI-agent usage guidance
  • a small DevMap block in AGENTS.md only after confirmation when the file already exists

Existing AGENTS.md and DEVMAP.md files are never overwritten.

For AI Agents

Read .devmap/index.json first, open the relevant feature map, and inspect its sourcePriority files. Use .devmap/snapshot.json only when the lightweight navigation layer is insufficient.

Use --json for scripts, editors, CI, or AI agents:

devmap analyze --json
devmap onboarding --json
devmap doctor --json

JSON mode writes one parseable JSON document to stdout without ANSI colors, terminal decoration, or streamed partial output.

Supported Stacks

  • Frontend: Next.js, Astro, SvelteKit, Nuxt, Remix, React Router v7, TanStack Router/Start, Expo Router, SolidStart, Qwik City, Angular, React, Vue, Svelte
  • Backend: Express, NestJS, Fastify, Hono, Elysia, Koa, AdonisJS

Detection covers the full list above; Next.js and Express receive the deepest analysis. Multi-package workspaces are classified per project type, so a monorepo containing a CLI and a web app is reported as both.

Privacy

  • Project analysis runs locally before AI interpretation.
  • Full repository source is not sent to the selected provider.
  • .env files and common generated directories are ignored.
  • API keys are stored locally and should never be committed.

License

MIT

版本与发布记录

@flaid/devmap 共发布 22 个版本,首次发布于 2026/08/23;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.4latest2026/11/141 天前
0.9.32026/11/114 天前
0.9.22026/11/078 天前
0.9.12026/11/069 天前
0.9.02026/10/3115 天前
0.8.42026/10/2917 天前

关于 @flaid/devmap 的常见问题

@flaid/devmap 是什么?

CLI that maps your codebase into a reusable context layer for developers and AI agents: entry points, critical files, features and routes for JS/TS projects.

如何安装 @flaid/devmap?

在项目目录运行 npm install @flaid/devmap,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 devmap,可以用 npx devmap 直接运行。

@flaid/devmap 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flaid/devmap 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@flaid/devmap 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@flaid/devmap 可以商用吗?

@flaid/devmap 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flaid/devmap 的下载量有多少?

根据 npm 官方下载统计,@flaid/devmap 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,603 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flaid/devmap 还在维护吗?

最新版本 0.9.4 发布于 2026/11/14(1 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/08/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。