代码地图 是 AI Skill Hub 本期精选Agent工作流之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
代码地图 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
代码地图 是一套完整的 AI Agent 自动化工作流方案。通过可视化的节点编排,将复杂的多步骤任务拆解为清晰的自动化流程,实现全程无人值守的智能处理。支持与数百种外部服务和 API 无缝集成,适合构建数据处理管线、业务自动化和 AI 辅助决策系统。
# 方式一:npm 全局安装 npm install -g codemap # 方式二:npx 直接运行(无需安装) npx codemap --help # 方式三:项目依赖安装 npm install codemap # 方式四:从源码运行 git clone https://github.com/stainless-code/codemap cd codemap npm install npm start
# 命令行使用
codemap --help
# 基本用法
codemap [options] <input>
# Node.js 代码中使用
const codemap = require('codemap');
const result = await codemap.run(options);
console.log(result);
# codemap 配置说明 # 查看配置选项 codemap --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export CODEMAP_CONFIG="/path/to/config.yml"
Query your codebase. Codemap builds a local SQLite index of structural metadata (symbols, imports, exports, components, dependencies, CSS tokens, markers, and more) so AI agents and tools can answer “where / what / who” questions with SQL instead of scanning the whole tree.
ripgrep / your IDE for raw text matches. Codemap ships opt-in FTS5 (--with-fts / fts5: true) when you want body matches that JOIN with symbols / coverage / markers in one SQL.Documentation: docs/README.md is the hub (topic index + single-source rules). Topics: architecture, agents (codemap agents init), benchmark, golden queries, packaging, roadmap, why Codemap. Bundled rules/skills: .agents/rules/, .agents/skills/codemap/SKILL.md. Consumers: .github/CONTRIBUTING.md.
---
codemap query --save-baseline=base-files "SELECT path FROM files" codemap query --save-baseline=base-dependencies "SELECT from_path, to_path FROM dependencies" codemap query --save-baseline=base-deprecated -r deprecated-symbols codemap audit --baseline base # auto-resolves base-{files,dependencies,deprecated} codemap audit --json --summary --baseline base # counts-only — useful for CI dashboards codemap audit --files-baseline base-files # explicit per-delta — runs only the slots provided codemap audit --baseline base --files-baseline hotfix-files # mixed — auto-resolve deps + deprecated; override files codemap audit --baseline base --no-index # skip the auto-incremental-index prelude (frozen-DB CI) codemap audit --base origin/main --json # ad-hoc — added[].attribution; --summary adds added_introduced/inherited codemap audit --base origin/main --format sarif # emit SARIF 2.1.0 directly (Code Scanning); also: --ci alias codemap audit --base origin/main --ci # CI shortcut: --format sarif + non-zero exit on additions codemap audit --base v1.0.0 --files-baseline pre-release-files # mix --base with per-delta override
TOKEN=$(openssl rand -hex 32) codemap serve --port 7878 --token "$TOKEN" & # --token required when --host is not loopback curl -s -X POST http://127.0.0.1:7878/tool/query \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $TOKEN" \ -d '{"sql":"SELECT name, file_path FROM symbols LIMIT 5"}'
codemap impact handleQuery # both directions, depth 3, all compatible graphs codemap impact dup --in src/a.ts --via calls # homonym symbol scoped to one defining file codemap impact src/db.ts --direction up # what depends on db.ts (file-level, deps + imports) codemap impact handleAudit --depth 1 --via calls # direct callers via the calls table only codemap impact runWatchLoop --json --summary | jq '.summary.nodes' # CI-gate fan-in score
codemap affected --json # working-tree changes vs HEAD (git status + diff) git diff --name-only origin/main | codemap affected --stdin --json codemap affected src/lib/cache.ts --json # explicit changed paths codemap affected --changed-since origin/main --json # committed delta + working tree vs ref
```bash bun add @stainless-code/codemap
```
Engines: Node ^20.19.0 || >=22.12.0 and/or Bun >=1.0.0 — see package.json and docs/packaging.md.
---
codemap --full
codemap --with-fts --full codemap query --recipe text-in-deprecated-functions # demonstrates FTS5 ⨯ symbols ⨯ coverage JOIN
codemap skill # full codemap SKILL markdown to stdout codemap rule # full codemap rule markdown to stdout
codemap query --json --recipe fan-out codemap query --json --recipe fan-out-sample
codemap
codemap query "SELECT name, file_path FROM symbols LIMIT 10"
codemap query --recipe boundary-violations --format sarif > boundary-findings.sarif
codemap --config /path/to/config.json --full
```bash
import { createCodemap } from "@stainless-code/codemap";
const cm = await createCodemap({ root: "/path/to/repo" });
await cm.index({ mode: "incremental" });
await cm.index({ mode: "full" });
await cm.index({ mode: "files", files: ["src/a.ts"] });
await cm.index({ quiet: true });
const rows = cm.query("SELECT name FROM symbols LIMIT 5");
createCodemap configures a process-global runtime (initCodemap); only one active project per process is supported. Advanced: runCodemapIndex when you hold a CodemapDatabase handle (library integration — not a separate public openDb() export; use createCodemap for the supported path). Module layout: docs/architecture.md § Layering.
---
codemap query --json --summary --group-by directory -r fan-in codemap query --json --group-by owner -r deprecated-symbols codemap query --json --summary --group-by package "SELECT file_path FROM symbols"
创新的代码-AI交互方案,SQLite索引设计巧妙。但项目早期,生态完善度有限,适合探索性应用。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,代码地图 在Agent工作流赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | codemap |
| 原始描述 | 开源AI工作流:Query your codebase — structural SQLite index for AI agents。⭐8 · TypeScript |
| Topics | 代码索引AI工作流SQLite代码查询 |
| GitHub | https://github.com/stainless-code/codemap |
| License | MIT |
| 语言 | TypeScript |
收录时间:2026-06-11 · 更新时间:2026-06-11 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端