跳到正文
DEV Community· VANSH ARORA·· 43 分鐘前AI 評分50

TokenCap 舊版設定遷移指南:三條命令及別名對照

Moving an Older TokenCap Setup Over: Three Commands and an Alias Table

AI 導讀

TokenCap 提供舊版設定的三步遷移流程:安裝最新版後,在每個儲存庫依次執行 `tokencap make --migrate` 和 `tokencap make`。

正文

TokenCap's CLI is organised around seven commands, and the generated artifacts follow published JSON schemas. If a repository was set up with an older TokenCap, this is the whole move.

The three commands

npm install -g tokencap
tokencap make --migrate
tokencap make

The install gets the latest TokenCap, which carries the fixes covered in recent posts: stricter redaction that leaves code references intact, every language parsing on Node 18 and 20, and an MCP server that no longer times out on a first run.

Check the install:

tokencap version

Then, in each repository, run the other two commands.

tokencap make --migrate upgrades .tokencap/config.json to the current format, publishes JSON schemas in .tokencap/schemas/, and writes .tokencap/migration.json. It prints the three paths and ends by telling you to run tokencap make.

The following tokencap make regenerates the artifact manifest and writes a build record, .tokencap/build.json, with the commit, time and the layers that built. Migration is a make flag on purpose, so the CLI stays at seven commands: make, ask, analyze, serve, update, help, version.

The alias table

The old compatibility aliases are gone. The ones you are most likely to have in scripts:

Old command Current command
tokencap impact <file>:<sym> tokencap ask impact <file>:<sym>
tokencap health tokencap analyze health
tokencap rebuild tokencap make --rebuild
tokencap remember tokencap serve session save
tokencap memory tokencap serve session list
tokencap handoff tokencap serve session handoff
tokencap migrate tokencap make --migrate
tokencap compress <file> tokencap analyze compress <file> --write
tokencap stats tokencap analyze stats
tokencap debt tokencap analyze debt
tokencap risk tokencap analyze risk
tokencap refactor tokencap analyze refactor
tokencap verify tokencap analyze verify
tokencap security scan tokencap analyze security scan

Removed commands tell you where they went

You do not have to grep your scripts first. A removed command prints a one-line error that says it was removed and names its replacement, then exits 1. tokencap rebuild points you to tokencap make --rebuild, and tokencap remember to tokencap serve session save.

It does not guess and run the new command for you. A CI job that calls an old name fails loudly, with the fix in the log line.

MCP setups keep working

tokencap mcp is the one exception to the removals. It still starts the MCP server, so host configs written for the old CLI keep working without edits. New configs written by tokencap serve --mcp --init launch tokencap serve --mcp.

The MCP tool contract is stable: tools are not renamed and documented fields keep their meaning. tokencap_mcp_status reports the contract the server speaks.

One thing to check if you use Claude Code: older builds wrote the config to .claude/mcp.json, which Claude Code does not read. TokenCap now writes .mcp.json at the project root:

tokencap serve --mcp --init --client claude-code

An existing tokencap entry is kept unless you pass --force.

Behaviour changes to check after the move

Coming from an older setup also brings a few behaviour changes. The ones most likely to touch you:

  • Constitution rule IDs are content-derived (CONST-API-F5BF63). Every ID changes once. A manual override that reuses an old positional ID like CONST-API-001 becomes an extra rule; copy the new ID from .tokencap/constitution/constitution.yaml.
  • A hand-written AGENTS.md is no longer overwritten. make only refreshes it while it still holds a TokenCap template.
  • Redaction keeps the original separator and quotes: OPENAI_API_KEY = '[REDACTED:KEY]' instead of OPENAI_API_KEY=[REDACTED:KEY]. Update anything that matches the old form.
  • Flag parsing. An unknown flag prints a warning on stderr, and --flag=value is parsed, so make --root=X now builds into X.

After this, tokencap update keeps you current. It is the only command that uses the network. make, ask, analyze health, diff and update each end with one Next: line, and when the index is behind your commits that line tells you to rebuild first.

Where the evidence stands

The open work is evidence, and it is listed in HONEST-NUMBERS.md. The model-in-the-loop harness, benchmarks/fair/answer-eval.js, exists but has not been run, so there is no published answer-quality result yet. The current benchmark measures whether the task pack holds the files a real commit changed, on 100 tasks: 89% of the needed files are shown as code, 74% of the edited lines are in the pack, at a median 18.4x fewer tokens than a keyword grep. On the held-out tasks: 88.9%, 74.5% and 18.0x. Grepping everything still finds more files (96%), and that limit is written down next to the number.

What would help most:

  1. If a migration step failed or printed something confusing, tell me the command and the output.
  2. If an old command you rely on has no obvious home in the new CLI, say which.
  3. Tell me which host and language you use. That decides what gets tested next.

Migration notes, docs and the changelog are at tokencap.vansharora.app

來源:DEV Community · dev.to