pi-readseek 0.7.7 → 0.7.9
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 +28 -46
- package/dist/index.js +7333 -0
- package/package.json +8 -7
- package/index.ts +0 -147
- package/src/binary-detect.ts +0 -22
- package/src/check.ts +0 -92
- package/src/coerce-obvious-int.ts +0 -41
- package/src/confusable-hyphens.ts +0 -6
- package/src/def.ts +0 -143
- package/src/diff-data.ts +0 -302
- package/src/edit-classify.ts +0 -58
- package/src/edit-diff.ts +0 -359
- package/src/edit-output.ts +0 -110
- package/src/edit-render-helpers.ts +0 -141
- package/src/edit-syntax-validate.ts +0 -65
- package/src/edit.ts +0 -686
- package/src/file-map.ts +0 -17
- package/src/fs-error.ts +0 -33
- package/src/grep-budget.ts +0 -35
- package/src/grep-output.ts +0 -181
- package/src/grep-render-helpers.ts +0 -77
- package/src/grep-symbol-scope.ts +0 -184
- package/src/grep.ts +0 -608
- package/src/hashline.ts +0 -736
- package/src/hover.ts +0 -140
- package/src/path-utils.ts +0 -24
- package/src/pending-diff-preview.ts +0 -269
- package/src/read-local-bundle.ts +0 -75
- package/src/read-output.ts +0 -186
- package/src/read-render-helpers.ts +0 -104
- package/src/read.ts +0 -661
- package/src/readseek/constants.ts +0 -17
- package/src/readseek/enums.ts +0 -38
- package/src/readseek/formatter.ts +0 -350
- package/src/readseek/symbol-error-format.ts +0 -18
- package/src/readseek/symbol-lookup.ts +0 -240
- package/src/readseek/symbol-tree.ts +0 -21
- package/src/readseek/types.ts +0 -49
- package/src/readseek-client.ts +0 -1250
- package/src/readseek-params.ts +0 -39
- package/src/readseek-settings.ts +0 -263
- package/src/readseek-value.ts +0 -184
- package/src/refs-output.ts +0 -47
- package/src/refs.ts +0 -161
- package/src/register-tool.ts +0 -29
- package/src/rename.ts +0 -182
- package/src/replace-symbol.ts +0 -77
- package/src/runtime.ts +0 -3
- package/src/search-output.ts +0 -50
- package/src/search.ts +0 -214
- package/src/session-anchors.ts +0 -34
- package/src/stat-search-path.ts +0 -29
- package/src/syntax-validate-mode.ts +0 -15
- package/src/tool-prompt-metadata.ts +0 -107
- package/src/tool-types.ts +0 -12
- package/src/tui-diff-component.ts +0 -108
- package/src/tui-diff-renderer.ts +0 -92
- package/src/tui-render-utils.ts +0 -286
- package/src/view.ts +0 -158
- package/src/write.ts +0 -357
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { ReadSeekWarning } from "./readseek-value.js";
|
|
2
|
-
export interface ReadCallTextResult {
|
|
3
|
-
path: string | null;
|
|
4
|
-
suffix: string | undefined;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function formatReadCallText(
|
|
8
|
-
args: Record<string, unknown> | undefined,
|
|
9
|
-
): ReadCallTextResult {
|
|
10
|
-
const rawPath = typeof args?.path === "string" ? args.path : null;
|
|
11
|
-
|
|
12
|
-
if (typeof args?.symbol === "string" && args.symbol) {
|
|
13
|
-
return { path: rawPath, suffix: `→ symbol ${args.symbol}` };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (args?.map === true) {
|
|
17
|
-
return { path: rawPath, suffix: "+ map" };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (typeof args?.offset === "number") {
|
|
21
|
-
const offset = args.offset as number;
|
|
22
|
-
const limit = typeof args?.limit === "number" ? (args.limit as number) : undefined;
|
|
23
|
-
if (offset < 1) {
|
|
24
|
-
return { path: rawPath, suffix: undefined };
|
|
25
|
-
}
|
|
26
|
-
if (limit !== undefined) {
|
|
27
|
-
if (limit < 1) {
|
|
28
|
-
return { path: rawPath, suffix: undefined };
|
|
29
|
-
}
|
|
30
|
-
return { path: rawPath, suffix: `lines ${offset}-${offset + limit - 1}` };
|
|
31
|
-
}
|
|
32
|
-
return { path: rawPath, suffix: `from line ${offset}` };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return { path: rawPath, suffix: undefined };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export interface ReadResultTextInput {
|
|
40
|
-
range: { startLine: number; endLine: number; totalLines: number };
|
|
41
|
-
truncation: { outputLines: number; totalLines: number; outputBytes: number; totalBytes: number } | null;
|
|
42
|
-
symbol: { query: string; name: string; kind: string; parentName?: string; startLine: number; endLine: number } | null;
|
|
43
|
-
map: { requested: boolean; appended: boolean };
|
|
44
|
-
warnings: ReadSeekWarning[];
|
|
45
|
-
isError?: boolean;
|
|
46
|
-
errorText?: string;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface ReadResultTextOutput {
|
|
50
|
-
summary: string;
|
|
51
|
-
symbolBadge: string | undefined;
|
|
52
|
-
badges: string[];
|
|
53
|
-
truncated: boolean;
|
|
54
|
-
errorText: string | undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function formatReadResultText(input: ReadResultTextInput): ReadResultTextOutput {
|
|
58
|
-
const { range, truncation, symbol, map, warnings } = input;
|
|
59
|
-
|
|
60
|
-
// Error case
|
|
61
|
-
if (input.isError && input.errorText) {
|
|
62
|
-
return {
|
|
63
|
-
summary: "",
|
|
64
|
-
symbolBadge: undefined,
|
|
65
|
-
badges: [],
|
|
66
|
-
truncated: false,
|
|
67
|
-
errorText: input.errorText,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Line count
|
|
72
|
-
const lineCount = range.endLine - range.startLine + 1;
|
|
73
|
-
const isFullFile = range.startLine === 1 && range.endLine === range.totalLines;
|
|
74
|
-
const isTruncated = !!truncation;
|
|
75
|
-
|
|
76
|
-
let summary: string;
|
|
77
|
-
if (isTruncated) {
|
|
78
|
-
summary = `\u2713 ${truncation!.outputLines} of ${truncation!.totalLines} lines (truncated)`;
|
|
79
|
-
} else if (isFullFile) {
|
|
80
|
-
summary = `\u2713 ${lineCount} lines`;
|
|
81
|
-
} else {
|
|
82
|
-
summary = `\u2713 ${lineCount} lines (${range.startLine}-${range.endLine} of ${range.totalLines})`;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Symbol badge
|
|
86
|
-
const symbolBadge = symbol ? `${symbol.kind} ${symbol.name}` : undefined;
|
|
87
|
-
|
|
88
|
-
// Badges
|
|
89
|
-
const badges: string[] = [];
|
|
90
|
-
if (map.appended) badges.push("\ud83d\udcd0 map");
|
|
91
|
-
for (const w of warnings) {
|
|
92
|
-
if (w.code === "binary-content") badges.push("\u26a0 binary");
|
|
93
|
-
if (w.code === "bare-cr") badges.push("\u26a0 bare CR");
|
|
94
|
-
if (w.code === "fuzzy-symbol-match") badges.push("⚠ fuzzy match");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
summary,
|
|
99
|
-
symbolBadge,
|
|
100
|
-
badges,
|
|
101
|
-
truncated: isTruncated,
|
|
102
|
-
errorText: undefined,
|
|
103
|
-
};
|
|
104
|
-
}
|