token-pilot 0.30.0 → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -4
  3. package/README.md +24 -0
  4. package/agents/tp-api-surface-tracker.md +1 -1
  5. package/agents/tp-audit-scanner.md +1 -1
  6. package/agents/tp-commit-writer.md +1 -1
  7. package/agents/tp-context-engineer.md +1 -1
  8. package/agents/tp-dead-code-finder.md +1 -1
  9. package/agents/tp-debugger.md +1 -1
  10. package/agents/tp-dep-health.md +1 -1
  11. package/agents/tp-doc-writer.md +1 -1
  12. package/agents/tp-history-explorer.md +1 -1
  13. package/agents/tp-impact-analyzer.md +1 -1
  14. package/agents/tp-incident-timeline.md +1 -1
  15. package/agents/tp-incremental-builder.md +1 -1
  16. package/agents/tp-migration-scout.md +1 -1
  17. package/agents/tp-onboard.md +1 -1
  18. package/agents/tp-performance-profiler.md +1 -1
  19. package/agents/tp-pr-reviewer.md +1 -1
  20. package/agents/tp-refactor-planner.md +1 -1
  21. package/agents/tp-review-impact.md +1 -1
  22. package/agents/tp-run.md +1 -1
  23. package/agents/tp-session-restorer.md +1 -1
  24. package/agents/tp-ship-coordinator.md +1 -1
  25. package/agents/tp-spec-writer.md +1 -1
  26. package/agents/tp-test-coverage-gapper.md +1 -1
  27. package/agents/tp-test-triage.md +1 -1
  28. package/agents/tp-test-writer.md +1 -1
  29. package/dist/ast-index/client.d.ts +17 -2
  30. package/dist/ast-index/client.js +233 -107
  31. package/dist/core/edit-prep-state.d.ts +42 -0
  32. package/dist/core/edit-prep-state.js +108 -0
  33. package/dist/handlers/explore-area.js +6 -1
  34. package/dist/handlers/read-for-edit.d.ts +5 -5
  35. package/dist/handlers/read-for-edit.js +188 -110
  36. package/dist/hooks/installer.js +18 -0
  37. package/dist/hooks/pre-bash.d.ts +9 -0
  38. package/dist/hooks/pre-bash.js +48 -0
  39. package/dist/hooks/pre-edit.d.ts +69 -0
  40. package/dist/hooks/pre-edit.js +104 -0
  41. package/dist/hooks/pre-grep.d.ts +10 -0
  42. package/dist/hooks/pre-grep.js +38 -2
  43. package/dist/index.d.ts +30 -0
  44. package/dist/index.js +83 -20
  45. package/dist/server/tool-definitions.js +18 -6
  46. package/dist/server.js +21 -5
  47. package/docs/installation.md +27 -1
  48. package/hooks/hooks.json +18 -0
  49. package/package.json +1 -1
  50. package/start.sh +19 -9
@@ -1,6 +1,32 @@
1
1
  # Installation Guide
2
2
 
3
- ## Quickest path
3
+ ## TL;DR
4
+
5
+ **Claude Code — plugin (recommended):**
6
+ ```bash
7
+ # New machine:
8
+ claude plugin marketplace add https://github.com/Digital-Threads/token-pilot
9
+ claude plugin install token-pilot@token-pilot
10
+
11
+ # Update:
12
+ claude plugin update token-pilot
13
+ ```
14
+
15
+ **Other clients (Cursor, Codex, Cline, …):**
16
+ ```bash
17
+ # New machine:
18
+ npx -y token-pilot init
19
+
20
+ # Update — npx always pulls fresh, just restart your client.
21
+ # Or if installed globally:
22
+ npm i -g token-pilot@latest
23
+ npx token-pilot install-hook
24
+ npx token-pilot install-agents --scope=user --force
25
+ ```
26
+
27
+ ---
28
+
29
+ ## First-time setup (full walkthrough)
4
30
 
5
31
  ```bash
6
32
  npx -y token-pilot init
package/hooks/hooks.json CHANGED
@@ -19,6 +19,24 @@
19
19
  }
20
20
  ]
21
21
  },
22
+ {
23
+ "matcher": "MultiEdit",
24
+ "hooks": [
25
+ {
26
+ "type": "command",
27
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/dist/index.js hook-edit"
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ "matcher": "Write",
33
+ "hooks": [
34
+ {
35
+ "type": "command",
36
+ "command": "node ${CLAUDE_PLUGIN_ROOT}/dist/index.js hook-edit"
37
+ }
38
+ ]
39
+ },
22
40
  {
23
41
  "matcher": "Bash",
24
42
  "hooks": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "token-pilot",
3
- "version": "0.30.0",
3
+ "version": "0.30.1",
4
4
  "description": "Save up to 80% tokens when AI reads code — MCP server for token-efficient code navigation, AST-aware structural reading instead of dumping full files into context window",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/start.sh CHANGED
@@ -5,24 +5,34 @@
5
5
  set -e
6
6
 
7
7
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8
+
9
+ # Capture user's working directory BEFORE `cd $SCRIPT_DIR` — this is the
10
+ # project root fallback when CLAUDE_PROJECT_DIR is not set. Without this,
11
+ # `$(pwd)` below would resolve to the plugin cache dir and every relative
12
+ # file path would be resolved inside the plugin install, not the project.
13
+ USER_CWD="${PWD:-$(pwd)}"
14
+
8
15
  cd "$SCRIPT_DIR"
9
16
 
10
17
  # 1. Install runtime dependencies when the package is incomplete.
11
18
  if [ ! -f "node_modules/@modelcontextprotocol/sdk/package.json" ]; then
12
- echo "[token-pilot] Installing runtime dependencies..." >&2
13
- npm install --production --no-audit --no-fund 2>&1 >&2
19
+ echo "[token-pilot] Installing runtime dependencies..." >&2
20
+ npm install --production --no-audit --no-fund 2>&1 >&2
14
21
  fi
15
22
 
16
23
  # 2. Build if dist/ is missing.
17
24
  if [ ! -f "dist/index.js" ]; then
18
- echo "[token-pilot] Building..." >&2
19
- if [ ! -f "node_modules/typescript/bin/tsc" ]; then
20
- npm install --no-audit --no-fund 2>&1 >&2
21
- fi
22
- npm run build 2>&1 >&2
25
+ echo "[token-pilot] Building..." >&2
26
+ if [ ! -f "node_modules/typescript/bin/tsc" ]; then
27
+ npm install --no-audit --no-fund 2>&1 >&2
28
+ fi
29
+ npm run build 2>&1 >&2
23
30
  fi
24
31
 
25
32
  # 3. Start the MCP server.
26
- # Pass CLAUDE_PROJECT_DIR as project root if available, otherwise cwd.
27
- PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
33
+ # Priority for project root:
34
+ # 1. CLAUDE_PROJECT_DIR — set by Claude Code for the active workspace
35
+ # 2. USER_CWD — the user's shell working directory (captured pre-cd)
36
+ # Passing the plugin cache dir here would poison every relative path lookup.
37
+ PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$USER_CWD}"
28
38
  exec node "$SCRIPT_DIR/dist/index.js" "$PROJECT_ROOT"