token-pilot 0.30.3 → 0.30.5
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/pre-bash.js +22 -7
- package/dist/hooks/pre-edit.js +25 -18
- 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.5"
|
|
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.5",
|
|
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.5",
|
|
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.5"
|
|
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/pre-bash.js
CHANGED
|
@@ -108,8 +108,16 @@ function detectHeavyPatternSingle(command) {
|
|
|
108
108
|
"to bound the walk. Re-run with `-maxdepth` to bypass.",
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
// 3. cat <code-file> at top level
|
|
112
|
-
|
|
111
|
+
// 3. cat <code-file> at top level — simple read-to-stdout pattern only.
|
|
112
|
+
// v0.30.4: skip when cat is writing, not reading: `cat > file`,
|
|
113
|
+
// `cat >> file`, `cat << TAG` (heredoc). A heredoc body that happens to
|
|
114
|
+
// contain a `.sh` / `.ts` path was tripping the old rule. Pipes stay
|
|
115
|
+
// exempt as before (pipes mean user is processing, not just dumping).
|
|
116
|
+
if (invokes(cmd, "cat") &&
|
|
117
|
+
CODE_EXT_RE.test(cmd) &&
|
|
118
|
+
!cmd.includes("|") &&
|
|
119
|
+
!/>/.test(cmd) &&
|
|
120
|
+
!/<</.test(cmd)) {
|
|
113
121
|
return {
|
|
114
122
|
kind: "deny",
|
|
115
123
|
reason: "`cat` on a code file dumps the whole thing into context. " +
|
|
@@ -118,10 +126,15 @@ function detectHeavyPatternSingle(command) {
|
|
|
118
126
|
"For head/tail access use `head -n N` or `tail -n N`.",
|
|
119
127
|
};
|
|
120
128
|
}
|
|
121
|
-
// 4. git log without -n / -N
|
|
129
|
+
// 4. git log without -n / -N / -<N> (short-form max-count) / --max-count
|
|
130
|
+
// v0.30.3: added -<N> support — `git log --oneline -5` is canonical
|
|
131
|
+
// bounded syntax and must not trip the heuristic.
|
|
132
|
+
// v0.30.4: require `git log` at the START of the command (or after a
|
|
133
|
+
// separator), not anywhere in it — otherwise `git commit -m "... git log ..."`
|
|
134
|
+
// gets wrongly flagged because "git log" appears inside the message.
|
|
122
135
|
if (invokes(cmd, "git") &&
|
|
123
|
-
|
|
124
|
-
!/-n\s*\d+|-N\s*\d+|--max-count=\d
|
|
136
|
+
/(^|[;&|\n]\s*)git\s+log\b/.test(cmd) &&
|
|
137
|
+
!/-n\s*\d+|-N\s*\d+|--max-count=\d+|\s-\d+(\s|$)/.test(cmd) &&
|
|
125
138
|
!/\|\s*head/.test(cmd)) {
|
|
126
139
|
return {
|
|
127
140
|
kind: "deny",
|
|
@@ -131,9 +144,11 @@ function detectHeavyPatternSingle(command) {
|
|
|
131
144
|
};
|
|
132
145
|
}
|
|
133
146
|
// 5. git diff with no path argument (common mistake on large repos)
|
|
134
|
-
|
|
147
|
+
// v0.30.4: anchor to command start / separator so an embedded "git diff"
|
|
148
|
+
// inside a commit message or comment doesn't trip the rule.
|
|
149
|
+
if (/(^|[;&|\n]\s*)git\s+diff\b/.test(cmd) &&
|
|
135
150
|
!/\bgit\s+diff\s+[^\s|]*--stat/.test(cmd) &&
|
|
136
|
-
|
|
151
|
+
/(^|[;&|\n]\s*)git\s+diff\s*($|[|;&])/.test(cmd)) {
|
|
137
152
|
return {
|
|
138
153
|
kind: "deny",
|
|
139
154
|
reason: "Bare `git diff` on a big working tree is huge. " +
|
package/dist/hooks/pre-edit.js
CHANGED
|
@@ -58,25 +58,32 @@ export function decidePreEdit(input, ctx) {
|
|
|
58
58
|
if (ctx.isPrepared)
|
|
59
59
|
return { kind: "allow" };
|
|
60
60
|
const suggestion = `mcp__token-pilot__read_for_edit(path="${filePath}", symbol="<target>")`;
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
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 };
|
|
70
77
|
}
|
|
71
|
-
// deny
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
};
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
89
|
* Render the Claude Code hook JSON response.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "token-pilot",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.5",
|
|
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",
|