pi-lean-ctx 1.0.2 → 1.0.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/README.md CHANGED
@@ -42,12 +42,16 @@ The `read` tool automatically selects the optimal lean-ctx mode:
42
42
  | File Type | Size | Mode |
43
43
  |-----------|------|------|
44
44
  | `.md`, `.json`, `.toml`, `.yaml`, etc. | Any | `full` |
45
- | Code files (`.rs`, `.ts`, `.py`, etc.) | < 24 KB | `full` |
45
+ | Code files (55+ extensions) | < 24 KB | `full` |
46
46
  | Code files | 24–160 KB | `map` (deps + API signatures) |
47
47
  | Code files | > 160 KB | `signatures` (AST extraction) |
48
48
  | Other files | < 48 KB | `full` |
49
49
  | Other files | > 48 KB | `map` |
50
50
 
51
+ Code extensions include: `.rs`, `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.java`, `.c`, `.cpp`, `.cs`, `.rb`, `.php`, `.swift`, `.kt`, `.vue`, `.svelte`, `.astro`, `.html`, `.css`, `.scss`, `.lua`, `.zig`, `.dart`, `.scala`, `.sql`, `.graphql`, `.proto`, `.tf`, `.sh`, `.bash`, `.zsh`, `.fish`, `.ps1`, and more.
52
+
53
+ **Partial reads** (with `offset`/`limit`) are also routed through lean-ctx using `lines:N-M` mode for compression.
54
+
51
55
  ## Slash Command
52
56
 
53
57
  Use `/lean-ctx` in Pi to check which binary is being used.
@@ -31,6 +31,8 @@ const FULL_READ_EXTENSIONS = new Set([
31
31
  ]);
32
32
 
33
33
  const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".gif", ".webp"]);
34
+ const CODE_FULL_READ_MAX_BYTES = 8 * 1024;
35
+ const CODE_SIGNATURES_MIN_BYTES = 96 * 1024;
34
36
 
35
37
  const readSchema = Type.Object({
36
38
  path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
@@ -101,8 +103,8 @@ async function chooseReadMode(path: string): Promise<"full" | "map" | "signature
101
103
  const size = fileStat.size;
102
104
 
103
105
  if (!CODE_EXTENSIONS.has(ext)) return size > 48 * 1024 ? "map" : "full";
104
- if (size >= 160 * 1024) return "signatures";
105
- if (size >= 24 * 1024) return "map";
106
+ if (size >= CODE_SIGNATURES_MIN_BYTES) return "signatures";
107
+ if (size >= CODE_FULL_READ_MAX_BYTES) return "map";
106
108
  return "full";
107
109
  }
108
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lean-ctx",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Pi Coding Agent extension that routes bash, read, grep, find, and ls through lean-ctx for 60-90% token savings",
5
5
  "keywords": ["pi-package", "lean-ctx", "token-optimization", "compression"],
6
6
  "license": "MIT",