token-pilot 0.30.2 → 0.30.4
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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/agents/tp-api-surface-tracker.md +1 -1
- package/agents/tp-audit-scanner.md +1 -1
- package/agents/tp-commit-writer.md +1 -1
- package/agents/tp-context-engineer.md +1 -1
- package/agents/tp-dead-code-finder.md +1 -1
- package/agents/tp-debugger.md +1 -1
- package/agents/tp-dep-health.md +1 -1
- package/agents/tp-doc-writer.md +1 -1
- package/agents/tp-history-explorer.md +1 -1
- package/agents/tp-impact-analyzer.md +1 -1
- package/agents/tp-incident-timeline.md +1 -1
- package/agents/tp-incremental-builder.md +1 -1
- package/agents/tp-migration-scout.md +1 -1
- package/agents/tp-onboard.md +1 -1
- package/agents/tp-performance-profiler.md +1 -1
- package/agents/tp-pr-reviewer.md +1 -1
- package/agents/tp-refactor-planner.md +1 -1
- package/agents/tp-review-impact.md +1 -1
- package/agents/tp-run.md +1 -1
- package/agents/tp-session-restorer.md +1 -1
- package/agents/tp-ship-coordinator.md +1 -1
- package/agents/tp-spec-writer.md +1 -1
- package/agents/tp-test-coverage-gapper.md +1 -1
- package/agents/tp-test-triage.md +1 -1
- package/agents/tp-test-writer.md +1 -1
- package/dist/hooks/installer.js +0 -9
- package/dist/hooks/pre-bash.js +12 -5
- package/dist/hooks/pre-edit.js +34 -23
- package/hooks/hooks.json +0 -9
- package/package.json +1 -1
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Token Pilot \u2014 save 60-90% tokens when AI reads code",
|
|
9
|
-
"version": "0.30.
|
|
9
|
+
"version": "0.30.4"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "token-pilot",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "Reduces token consumption by 60-90% via AST-aware lazy file reading, structural symbol navigation, and cross-session tool-usage analytics. 22 MCP tools + 19 subagents + budget watchdog hooks.",
|
|
16
|
-
"version": "0.30.
|
|
16
|
+
"version": "0.30.4",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Digital-Threads"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-pilot",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
4
4
|
"description": "Saves 60-90% tokens when AI reads code. AST-aware lazy reading, symbol navigation, cross-session tool-usage analytics, 22 subagents (haiku/sonnet/opus-tiered) with budget watchdog.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Digital-Threads",
|
package/agents/tp-debugger.md
CHANGED
package/agents/tp-dep-health.md
CHANGED
package/agents/tp-doc-writer.md
CHANGED
package/agents/tp-onboard.md
CHANGED
|
@@ -10,7 +10,7 @@ tools:
|
|
|
10
10
|
- mcp__token-pilot__smart_read
|
|
11
11
|
- mcp__token-pilot__smart_read_many
|
|
12
12
|
- mcp__token-pilot__read_section
|
|
13
|
-
token_pilot_version: "0.30.
|
|
13
|
+
token_pilot_version: "0.30.4"
|
|
14
14
|
token_pilot_body_hash: 4e82f7b3c6446663e958fb6bf5eb5348bbdf33389269c888ce0dab766e50561f
|
|
15
15
|
---
|
|
16
16
|
|
package/agents/tp-pr-reviewer.md
CHANGED
package/agents/tp-run.md
CHANGED
package/agents/tp-spec-writer.md
CHANGED
package/agents/tp-test-triage.md
CHANGED
package/agents/tp-test-writer.md
CHANGED
package/dist/hooks/installer.js
CHANGED
package/dist/hooks/pre-bash.js
CHANGED
|
@@ -118,10 +118,15 @@ function detectHeavyPatternSingle(command) {
|
|
|
118
118
|
"For head/tail access use `head -n N` or `tail -n N`.",
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
// 4. git log without -n / -N
|
|
121
|
+
// 4. git log without -n / -N / -<N> (short-form max-count) / --max-count
|
|
122
|
+
// v0.30.3: added -<N> support — `git log --oneline -5` is canonical
|
|
123
|
+
// bounded syntax and must not trip the heuristic.
|
|
124
|
+
// v0.30.4: require `git log` at the START of the command (or after a
|
|
125
|
+
// separator), not anywhere in it — otherwise `git commit -m "... git log ..."`
|
|
126
|
+
// gets wrongly flagged because "git log" appears inside the message.
|
|
122
127
|
if (invokes(cmd, "git") &&
|
|
123
|
-
|
|
124
|
-
!/-n\s*\d+|-N\s*\d+|--max-count=\d
|
|
128
|
+
/(^|[;&|\n]\s*)git\s+log\b/.test(cmd) &&
|
|
129
|
+
!/-n\s*\d+|-N\s*\d+|--max-count=\d+|\s-\d+(\s|$)/.test(cmd) &&
|
|
125
130
|
!/\|\s*head/.test(cmd)) {
|
|
126
131
|
return {
|
|
127
132
|
kind: "deny",
|
|
@@ -131,9 +136,11 @@ function detectHeavyPatternSingle(command) {
|
|
|
131
136
|
};
|
|
132
137
|
}
|
|
133
138
|
// 5. git diff with no path argument (common mistake on large repos)
|
|
134
|
-
|
|
139
|
+
// v0.30.4: anchor to command start / separator so an embedded "git diff"
|
|
140
|
+
// inside a commit message or comment doesn't trip the rule.
|
|
141
|
+
if (/(^|[;&|\n]\s*)git\s+diff\b/.test(cmd) &&
|
|
135
142
|
!/\bgit\s+diff\s+[^\s|]*--stat/.test(cmd) &&
|
|
136
|
-
|
|
143
|
+
/(^|[;&|\n]\s*)git\s+diff\s*($|[|;&])/.test(cmd)) {
|
|
137
144
|
return {
|
|
138
145
|
kind: "deny",
|
|
139
146
|
reason: "Bare `git diff` on a big working tree is huge. " +
|
package/dist/hooks/pre-edit.js
CHANGED
|
@@ -30,7 +30,13 @@
|
|
|
30
30
|
*/
|
|
31
31
|
export function decidePreEdit(input, ctx) {
|
|
32
32
|
const toolName = input.tool_name ?? "";
|
|
33
|
-
|
|
33
|
+
// Only Edit and MultiEdit touch a file partially with an old_string that
|
|
34
|
+
// MUST match disk byte-for-byte — those are the calls read_for_edit
|
|
35
|
+
// actually prepares. Write replaces the whole file (new content, no
|
|
36
|
+
// old_string) so enforcing prep on Write is overreach: blocks legit
|
|
37
|
+
// script regeneration / template overwrites that never needed prep.
|
|
38
|
+
// Pre-v0.30.3 we blocked Write too; that was wrong. Rolled back.
|
|
39
|
+
if (toolName !== "Edit" && toolName !== "MultiEdit") {
|
|
34
40
|
return { kind: "allow" };
|
|
35
41
|
}
|
|
36
42
|
const filePath = input.tool_input?.file_path;
|
|
@@ -41,10 +47,8 @@ export function decidePreEdit(input, ctx) {
|
|
|
41
47
|
// carry the same value, skip enforcement.
|
|
42
48
|
if (!ctx.isCodeFile)
|
|
43
49
|
return { kind: "allow" };
|
|
44
|
-
// Non-existent files
|
|
45
|
-
//
|
|
46
|
-
// - Edit / MultiEdit on a missing path will error downstream in
|
|
47
|
-
// Claude Code itself — nothing for us to add there
|
|
50
|
+
// Non-existent files — Edit/MultiEdit will error downstream in Claude Code
|
|
51
|
+
// itself. Nothing for us to add.
|
|
48
52
|
if (!ctx.fileExists)
|
|
49
53
|
return { kind: "allow" };
|
|
50
54
|
// Explicit escape hatch. Documented as TOKEN_PILOT_BYPASS=1.
|
|
@@ -54,25 +58,32 @@ export function decidePreEdit(input, ctx) {
|
|
|
54
58
|
if (ctx.isPrepared)
|
|
55
59
|
return { kind: "allow" };
|
|
56
60
|
const suggestion = `mcp__token-pilot__read_for_edit(path="${filePath}", symbol="<target>")`;
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
61
|
+
// v0.30.4 — only TOKEN_PILOT_MODE=strict produces a hard deny. The old
|
|
62
|
+
// "deny is default = hard-block every un-prepped Edit" was overreach:
|
|
63
|
+
// two real-project deadlocks reported on 2026-04-24 (MCP briefly
|
|
64
|
+
// disconnected, and an agent that simply forgot to prep). The cost of a
|
|
65
|
+
// false deny (stuck session, user scrambles for TOKEN_PILOT_BYPASS) is
|
|
66
|
+
// much worse than the cost of a missed nudge. Strict mode still exists
|
|
67
|
+
// for users who want the old hard-block behaviour.
|
|
68
|
+
if (ctx.mode === "strict") {
|
|
69
|
+
const reason = `File "${filePath}" was not prepared with read_for_edit. ` +
|
|
70
|
+
`Call ${suggestion} FIRST to obtain the exact old_string for Edit — ` +
|
|
71
|
+
`this is the canonical flow. Building old_string from smart_read or Read ` +
|
|
72
|
+
`snippets diverges from disk (whitespace, line-number prefixes) and Edit ` +
|
|
73
|
+
`silently mismatches. ` +
|
|
74
|
+
`Escape hatch: set TOKEN_PILOT_BYPASS=1 in the environment, or switch to ` +
|
|
75
|
+
`TOKEN_PILOT_MODE=deny / advisory for warn-only behaviour.`;
|
|
76
|
+
return { kind: "deny", reason };
|
|
66
77
|
}
|
|
67
|
-
// deny
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
// advisory + deny (default) both yield a non-blocking hint. The agent
|
|
79
|
+
// still runs the Edit; the additionalContext teaches the pattern next
|
|
80
|
+
// time without stranding the user mid-session.
|
|
81
|
+
return {
|
|
82
|
+
kind: "advise",
|
|
83
|
+
message: `File "${filePath}" was not prepared with read_for_edit. ` +
|
|
84
|
+
`Consider calling ${suggestion} first — the exact old_string it returns is what Edit actually needs. ` +
|
|
85
|
+
`Edit built from smart_read / Read snippets frequently mismatches on whitespace.`,
|
|
86
|
+
};
|
|
76
87
|
}
|
|
77
88
|
/**
|
|
78
89
|
* Render the Claude Code hook JSON response.
|
package/hooks/hooks.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-pilot",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
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",
|