token-pilot 0.14.2 → 0.15.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ All notable changes to Token Pilot will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.15.0] - 2026-03-19
9
+
10
+ ### Added
11
+ - **Regex fallback parser** — `smart_read` now works for TS/JS files even without ast-index binary. Parses classes, functions, interfaces, types, enums, and class methods via regex. Zero dependencies, 130 lines. Covers ~80% of new users who fail to download ast-index.
12
+ - **Guide skill** — `/guide` command shows a quick-reference table of all Token Pilot tools with usage examples and recommended workflow.
13
+ - **`hooks.denyThreshold` config** — hook deny threshold is now configurable in `.token-pilot.json` (default: 300, was hardcoded 500). Intercepts ~2x more native Read calls.
14
+
15
+ ### Changed
16
+ - **Compact session analytics** — `session_analytics` report reduced from ~30 lines to ~5 lines. Shows calls, tokens saved, top 5 tools, top 3 files, cache hit rate on a single screen.
17
+ - **`server.ts` refactor** — extracted tool definitions to `server/tool-definitions.ts` and token estimate helpers to `server/token-estimates.ts` (−500 lines from server.ts).
18
+ - **`find_usages` output** — results grouped by file with compact rendering. Single match per file on one line, multiple matches indented under file header.
19
+ - **Stale references** — all `grep_search` hints updated to `Grep` (code-audit, find-unused, find-usages).
20
+ - **409 tests** (was 393).
21
+
22
+ ### Fixed
23
+ - **`npx token-pilot` CLI** — symlink path resolution in `isDirectRun` check. All CLI commands now work correctly via npx.
24
+
8
25
  ## [0.14.1] - 2026-03-14
9
26
 
10
27
  ### Fixed
@@ -20,21 +20,8 @@ export declare class AstIndexClient {
20
20
  init(): Promise<void>;
21
21
  ensureIndex(): Promise<void>;
22
22
  private buildIndex;
23
- /** Mark index as oversized — disables index-dependent tools, outline still works */
24
23
  private handleOversizedIndex;
25
- /** Extract file count from stats output (JSON or text) */
26
- private parseFileCount;
27
24
  outline(filePath: string): Promise<FileStructure | null>;
28
- /**
29
- * Parse text output from `ast-index outline`:
30
- * Outline of src/file.ts:
31
- * :10 ClassName [class]
32
- * :11 propName [property]
33
- * :14 methodName [function]
34
- */
35
- private parseOutlineText;
36
- /** Compute end_line from sequential start positions */
37
- private computeEndLines;
38
25
  symbol(name: string): Promise<AstIndexSymbolDetail | null>;
39
26
  search(query: string, options?: {
40
27
  inFile?: string;
@@ -44,119 +31,43 @@ export declare class AstIndexClient {
44
31
  usages(symbolName: string): Promise<AstIndexUsageResult[]>;
45
32
  implementations(name: string): Promise<AstIndexImplementation[]>;
46
33
  hierarchy(name: string): Promise<AstIndexHierarchyNode | null>;
47
- private parseImplementationsText;
48
- private parseHierarchyText;
49
34
  stats(): Promise<string | null>;
50
- /**
51
- * List all files known to the ast-index.
52
- * Parses the `files` command output which lists one file per line.
53
- */
54
35
  listFiles(): Promise<string[]>;
55
- /**
56
- * Cross-references: definitions + imports + usages in one call.
57
- * Replaces separate symbol() + usages() calls.
58
- */
59
36
  refs(symbolName: string, limit?: number): Promise<AstIndexRefsResponse>;
60
- /**
61
- * Project map: directory structure with file counts and symbol kinds.
62
- */
63
37
  map(options?: {
64
38
  module?: string;
65
39
  limit?: number;
66
40
  }): Promise<AstIndexMapResponse | null>;
67
- /**
68
- * Detect project conventions: architecture, frameworks, naming patterns.
69
- */
70
41
  conventions(): Promise<AstIndexConventionsResponse | null>;
71
- /**
72
- * Find callers of a function.
73
- */
74
42
  callers(functionName: string, limit?: number): Promise<AstIndexCallerEntry[]>;
75
- /**
76
- * Show call hierarchy tree (callers tree up).
77
- */
78
43
  callTree(functionName: string, depth?: number): Promise<AstIndexCallTreeNode | null>;
79
- /**
80
- * Show changed symbols since base branch (git diff).
81
- */
82
44
  changed(base?: string): Promise<AstIndexChangedEntry[]>;
83
- /**
84
- * Find potentially unused symbols.
85
- */
86
45
  unusedSymbols(options?: {
87
46
  module?: string;
88
47
  exportOnly?: boolean;
89
48
  limit?: number;
90
49
  }): Promise<AstIndexUnusedSymbol[]>;
91
- /**
92
- * Get imports for a specific file.
93
- * Parses text output: " { X, Y } from 'source';"
94
- */
95
50
  fileImports(filePath: string): Promise<AstIndexImportEntry[]>;
96
- private parseImportsText;
97
- /** Check if ast-grep (sg) is available for structural pattern search */
98
51
  private checkAstGrep;
99
- /** Structural pattern search via ast-grep. Requires ast-grep (sg) installed. */
100
52
  agrep(pattern: string, options?: {
101
53
  lang?: string;
102
54
  limit?: number;
103
55
  }): Promise<AstIndexAgrepMatch[]>;
104
- private parseAgrepText;
105
- /** Find TODO/FIXME/HACK comments in the project */
106
56
  todo(): Promise<AstIndexTodoEntry[]>;
107
- private parseTodoText;
108
- /** Find @Deprecated symbols in the project */
109
57
  deprecated(): Promise<AstIndexDeprecatedEntry[]>;
110
- private parseDeprecatedText;
111
- /** Find symbols with a specific annotation/decorator */
112
58
  annotations(name: string): Promise<AstIndexAnnotationEntry[]>;
113
- private parseAnnotationsText;
114
- /** Trigger incremental index update (called by file watcher after edits) */
115
59
  incrementalUpdate(): Promise<void>;
116
- /** List project modules matching optional pattern */
117
60
  modules(pattern?: string): Promise<AstIndexModuleEntry[]>;
118
- /** Get dependencies of a module */
119
61
  moduleDeps(module: string): Promise<AstIndexModuleDep[]>;
120
- /** Get modules that depend on this module */
121
62
  moduleDependents(module: string): Promise<AstIndexModuleDep[]>;
122
- /** Find unused dependencies of a module */
123
63
  unusedDeps(module: string): Promise<AstIndexUnusedDep[]>;
124
- /** Get public API of a module */
125
64
  moduleApi(module: string): Promise<AstIndexModuleApi[]>;
126
- private parseModuleListText;
127
- private parseModuleDepText;
128
- private parseUnusedDepsText;
129
- private parseModuleApiText;
130
65
  isAvailable(): boolean;
131
- /** Returns true if the index was built but found >50k files (node_modules leak) */
132
66
  isOversized(): boolean;
133
- /** Returns true if index building is disabled (dangerous root like /) */
134
67
  isDisabled(): boolean;
135
- /** Disable index building (e.g. project root is / or home dir) */
136
68
  disableIndex(): void;
137
- /** Re-enable index building after auto-detecting a valid project root */
138
69
  enableIndex(): void;
139
- /** Update project root (e.g. after auto-detecting from file path) */
140
70
  updateProjectRoot(newRoot: string): void;
141
71
  private exec;
142
- private buildFileStructure;
143
- /**
144
- * Python: ast-index doesn't return methods inside classes.
145
- * Parse file content to extract `def` methods for classes without children.
146
- */
147
- private enrichPythonClassMethods;
148
- /**
149
- * PHP: ast-index doesn't return methods inside classes.
150
- * Parse file content to extract `function` methods for classes without children.
151
- */
152
- private enrichPHPClassMethods;
153
- /** Fix the last entry's end_line to use actual file line count */
154
- private fixLastEndLine;
155
- /** Read actual signature lines from file content */
156
- private enrichSignatures;
157
- private mapOutlineEntry;
158
- private mapKind;
159
- private mapVisibility;
160
- private detectLanguage;
161
72
  }
162
73
  //# sourceMappingURL=client.d.ts.map