pi-readseek 0.3.0 → 0.3.2
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/index.ts +0 -8
- package/package.json +1 -1
- package/src/readseek-client.ts +1 -12
- package/src/readseek-command.ts +2 -17
package/index.ts
CHANGED
|
@@ -7,8 +7,6 @@ import { registerWriteTool } from "./src/write.js";
|
|
|
7
7
|
import { registerLsTool } from "./src/ls.js";
|
|
8
8
|
import { registerFindTool } from "./src/find.js";
|
|
9
9
|
import { registerReadseekCommand } from "./src/readseek-command.js";
|
|
10
|
-
import { hasReadseekDir } from "./src/readseek-repo.js";
|
|
11
|
-
import { readseekUpdate } from "./src/readseek-client.js";
|
|
12
10
|
import { applyContextHygieneStaleContext } from "./src/context-application.js";
|
|
13
11
|
import {
|
|
14
12
|
createContextHygieneTracker,
|
|
@@ -88,12 +86,6 @@ export default function piReadseekExtension(pi: ExtensionAPI): void {
|
|
|
88
86
|
registerFindTool(pi);
|
|
89
87
|
registerReadseekCommand(pi);
|
|
90
88
|
|
|
91
|
-
pi.on("session_start", async (_event, ctx) => {
|
|
92
|
-
if (hasReadseekDir(ctx.cwd)) {
|
|
93
|
-
readseekUpdate(ctx.cwd).catch(() => {});
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
89
|
pi.on("tool_call", (event: any) => {
|
|
98
90
|
recordToolCall(
|
|
99
91
|
doomLoopState,
|
package/package.json
CHANGED
package/src/readseek-client.ts
CHANGED
|
@@ -339,7 +339,7 @@ function parseSearchOutput(value: unknown): ReadseekSearchOutput {
|
|
|
339
339
|
|
|
340
340
|
export async function readseekRead(filePath: string, startLine?: number, endLine?: number): Promise<ReadseekReadOutput> {
|
|
341
341
|
const args = ["read", filePath];
|
|
342
|
-
if (startLine !== undefined) args.push("--
|
|
342
|
+
if (startLine !== undefined) args.push("--offset", String(startLine));
|
|
343
343
|
if (endLine !== undefined) args.push("--end", String(endLine));
|
|
344
344
|
return parseReadOutput(await runReadseek(args));
|
|
345
345
|
}
|
|
@@ -389,14 +389,3 @@ export async function readseekMapContent(
|
|
|
389
389
|
);
|
|
390
390
|
return fileMapFromReadseekOutput(output, filePath, Buffer.byteLength(content, "utf8"));
|
|
391
391
|
}
|
|
392
|
-
|
|
393
|
-
export interface ReadseekUpdateStats {
|
|
394
|
-
created: number;
|
|
395
|
-
removed: number;
|
|
396
|
-
unchanged: number;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
export async function readseekUpdate(cwd: string): Promise<ReadseekUpdateStats> {
|
|
400
|
-
const stdout = await runReadseekRaw(["update", cwd]);
|
|
401
|
-
return JSON.parse(stdout) as ReadseekUpdateStats;
|
|
402
|
-
}
|
package/src/readseek-command.ts
CHANGED
|
@@ -3,9 +3,8 @@ import { Key, matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/
|
|
|
3
3
|
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative } from "node:path";
|
|
5
5
|
import { findReadseekDir, initReadseekDir } from "./readseek-repo.js";
|
|
6
|
-
import { readseekUpdate } from "./readseek-client.js";
|
|
7
6
|
|
|
8
|
-
type ReadseekAction = "init" | "deinit" |
|
|
7
|
+
type ReadseekAction = "init" | "deinit" | null;
|
|
9
8
|
|
|
10
9
|
function stripFromGitignore(dir: string): void {
|
|
11
10
|
const gitignorePath = join(dir, ".gitignore");
|
|
@@ -35,7 +34,6 @@ async function init(ctx: ExtensionContext): Promise<void> {
|
|
|
35
34
|
}
|
|
36
35
|
initReadseekDir(projectDir);
|
|
37
36
|
ctx.ui.notify("Initialized .readseek/", "info");
|
|
38
|
-
await readseekUpdate(projectDir);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
export function registerReadseekCommand(pi: ExtensionAPI): void {
|
|
@@ -98,12 +96,7 @@ export function registerReadseekCommand(pi: ExtensionAPI): void {
|
|
|
98
96
|
|
|
99
97
|
if (initialized) {
|
|
100
98
|
lines.push(
|
|
101
|
-
row(
|
|
102
|
-
`${accent("▶")} ${dim("[u]")} Update ${dim("refresh map cache")}`,
|
|
103
|
-
),
|
|
104
|
-
);
|
|
105
|
-
lines.push(
|
|
106
|
-
row(` ${dim("[d]")} Deinit ${dim("remove .readseek/")}`),
|
|
99
|
+
row(`${accent("▶")} ${dim("[d]")} Deinit ${dim("remove .readseek/")}`),
|
|
107
100
|
);
|
|
108
101
|
} else {
|
|
109
102
|
lines.push(
|
|
@@ -137,10 +130,6 @@ export function registerReadseekCommand(pi: ExtensionAPI): void {
|
|
|
137
130
|
done("deinit");
|
|
138
131
|
return;
|
|
139
132
|
}
|
|
140
|
-
if (initialized && (data === "u" || data === "U")) {
|
|
141
|
-
done("update");
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
133
|
},
|
|
145
134
|
|
|
146
135
|
invalidate(): void {},
|
|
@@ -161,10 +150,6 @@ export function registerReadseekCommand(pi: ExtensionAPI): void {
|
|
|
161
150
|
|
|
162
151
|
if (action === "init") await init(ctx);
|
|
163
152
|
else if (action === "deinit") await deinit(ctx);
|
|
164
|
-
else if (action === "update") {
|
|
165
|
-
await readseekUpdate(ctx.cwd);
|
|
166
|
-
ctx.ui.notify("Map cache updated", "info");
|
|
167
|
-
}
|
|
168
153
|
},
|
|
169
154
|
});
|
|
170
155
|
}
|