pi-read-chunks 1.0.5 → 1.0.6
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/package.json +1 -1
- package/read-chunks.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-read-chunks",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "A Pi Agent extension that uses a subagent to enhance `read` functionality for large text files to reduce context bloat, rot and lost in the middle issues.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
package/read-chunks.ts
CHANGED
|
@@ -688,7 +688,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
688
688
|
|
|
689
689
|
return {
|
|
690
690
|
block: true,
|
|
691
|
-
reason: "
|
|
691
|
+
reason: "For text files: use read-chunks(path/file) or read-chunks(path/file, query) with a concise query describing what you are looking for or read-chunks(path/file):linestart-lineend for a bounded file read.",
|
|
692
692
|
};
|
|
693
693
|
});
|
|
694
694
|
|
|
@@ -753,6 +753,15 @@ function formatReadChunksCall(args: any, theme: any, cwd: string): string {
|
|
|
753
753
|
if (m && m.index !== undefined) {
|
|
754
754
|
rangeSuffix = `:${m[2]}${m[3] !== undefined ? `-${m[3]}` : ""}`;
|
|
755
755
|
pathPart = m[1];
|
|
756
|
+
} else {
|
|
757
|
+
// No `:suffix` on path: derive the same `:START[-END]` form from explicit
|
|
758
|
+
// offset/limit args so the header reflects what was actually requested.
|
|
759
|
+
// Matches execute()'s semantics: offset alone = start at line N, read to EOF.
|
|
760
|
+
const off = typeof args?.offset === "number" ? args.offset : undefined;
|
|
761
|
+
const lim = typeof args?.limit === "number" ? args.limit : undefined;
|
|
762
|
+
if (off !== undefined) {
|
|
763
|
+
rangeSuffix = lim !== undefined ? `:${off}-${off + lim - 1}` : `:${off}`;
|
|
764
|
+
}
|
|
756
765
|
}
|
|
757
766
|
|
|
758
767
|
const pathDisplay = renderToolPath(pathPart || null, theme, cwd);
|