Vai al contenuto principale
V

dsh-codemap

vip-pan/dsh-codemap

Project-scoped code graph tools for DSH: one bundle registers nine read-only tools (symbol lookup, call chains, dependencies, Cypher queries) and resolves the repository from each session's working directory by connecting to the codemap CLI over MCP.

Installazione

dsh plugin --profile web add github:vip-pan/dsh-codemap

README

dsh-codemap

npm

Project-scoped code graph tools for DeepSeek Harness, backed by the codemap CLI. It registers nine Host tools once and decides the repository per call, so a new workspace needs no configuration: open a session inside an indexed repository and the tools work.

Install

# from npm (recommended)
dsh plugin --profile <profile> add dsh-codemap

# or straight from this repository
dsh plugin --profile <profile> add github:vip-pan/dsh-codemap

The desktop app's plugin manager or plugin market can also install the bundle; the profile gains one row (codemap) and no client UI.

Tools

ToolPurpose
search_codeHybrid full-text + semantic code search.
find_symbolExact/prefix/suffix symbol lookup, batchable.
get_symbol_detailLocation, signature, docs, optional body.
get_call_chainUpstream callers and downstream callees.
get_type_hierarchyParent and child types of a class/interface.
get_dependenciesReverse dependencies, plus asset file references.
get_graph_statsFile/symbol/call/import counts.
query_cypherRead-only Cypher for counting and aggregation.
search_knowledgeBusiness rules and architecture docs from the code index.

How it works

Each tool call resolves the calling session's working directory (including a directory the session cded into) upwards to its repository root — the nearest .codemaker/ directory, else the nearest .git/, else the directory itself. The plugin then starts codemap serve -r <root> for that root on first use, proxies the MCP request over stdio, and shares the process with every other session in the same repository. Processes idle for ten minutes are stopped.

Because resolution happens per call, subagents and sessions in different repositories never share an index.

Requirements

This plugin does not ship codemap; it is only an MCP client for the codemap serve server that the CLI provides. Install the CLI separately, for example with its installer:

curl -fsSL https://codemaker.nie.netease.com/codemap-package/codemap/install.sh | sh
  • The codemap CLI, resolved from CODEMAP_BIN, ~/.local/codemap/codemap, or PATH.
  • A repository codemap has indexed (.codemaker/codemap/graph.db) — for example by running codemap setup or codemap build once in it. The codemap daemon owns index maintenance and file watching; a first-time index of a large repository takes time.

Configuration (environment variables)

  • CODEMAP_BIN — path to the codemap executable.
  • CODEMAP_IDLE_MS — idle milliseconds before a repository process is recycled (default 600000).
  • CODEMAP_INIT_TIMEOUT_MS — MCP initialize timeout (default 30000).
  • CODEMAP_CALL_TIMEOUT_MS — per-tool-call timeout (default 180000).

Limitations

  • Read-only: the tools query the graph and never edit source files.
  • A call without an agent session (for example directly in a CLI harness without an agent) fails instead of guessing a repository.
  • search_knowledge returns results only when the repository has .codemaker/codeindex/kb-config.json.
  • The plugin speaks the MCP tools that codemap serve exposes, so it is tied to codemap's tool contract rather than to a generic graph protocol.

Development

node tools/test-plugin.mjs      # offline: registration, render, agent requirement
node tools/test-broker.mjs      # offline: repository-root discovery

# end-to-end, needs an indexed repository:
CODEMAP_TEST_REPO=/path/to/indexed/repo node tools/test-plugin.mjs
CODEMAP_TEST_REPO=/path/to/indexed/repo CODEMAP_TEST_SYMBOL=SomeSymbol node tools/test-broker.mjs

Releasing

Releases are published by GitHub Actions through npm trusted publishing (OIDC), so no tokens are stored in the repository:

npm version patch --no-git-tag-version   # or edit package.json
git commit -am "chore: release vX.Y.Z"
git tag vX.Y.Z
git push origin main --tags

The Publish Package workflow verifies the tool contract, then runs npm publish --provenance against the npm registry.

License

MIT

Plugin correlati