@jarkkojs/readseek-api 0.9.5 → 0.9.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/dist/contract.d.ts +2 -3
- package/dist/index.js +20 -45
- package/package.json +2 -2
package/dist/contract.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const EDIT_VARIANTS: readonly ["set_line", "replace_lines", "inse
|
|
|
12
12
|
export type EditVariant = (typeof EDIT_VARIANTS)[number];
|
|
13
13
|
export declare const GIT_SELECTION_FLAGS: readonly ["cached", "others", "ignored"];
|
|
14
14
|
export type GitSelectionFlag = (typeof GIT_SELECTION_FLAGS)[number];
|
|
15
|
-
export declare const TOOL_NAMES: readonly ["
|
|
15
|
+
export declare const TOOL_NAMES: readonly ["digest", "edit", "write", "grep", "view", "search", "def", "refs", "rename"];
|
|
16
16
|
export type ToolName = (typeof TOOL_NAMES)[number];
|
|
17
17
|
export declare const PARAM_DESCRIPTIONS: {
|
|
18
18
|
readonly path: "Absolute or relative file path";
|
|
@@ -84,11 +84,10 @@ export declare const PARAM_DESCRIPTIONS: {
|
|
|
84
84
|
readonly scopeContext: "Context lines within each symbol";
|
|
85
85
|
};
|
|
86
86
|
export declare const TOOL_DESCRIPTIONS: {
|
|
87
|
-
readonly
|
|
87
|
+
readonly digest: "Digest source content and images into the native CLI envelope. Returns metadata plus requested facets unchanged from `readseek digest`. Use it before edits to obtain fresh `LINE:HASH` anchors; use for structural maps, diagnostics, and cursor identity.";
|
|
88
88
|
readonly edit: "Edit existing text files with fresh `LINE:HASH` anchors. Read or search first when no fresh anchors are available. Each `edits[]` item must use exactly one nested object: `{\"set_line\":{\"anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}`, `{\"replace_lines\":{\"start_anchor\":\"LINE:HASH\",\"end_anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}`, `{\"insert_after\":{\"anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}`, `{\"replace_symbol\":{\"symbol\":\"name\",\"new_body\":\"...\"}}`, or `{\"replace\":{\"old_text\":\"...\",\"new_text\":\"...\"}}`.";
|
|
89
89
|
readonly write: "Create or replace a complete text file and return `LINE:HASH` anchors. Use `edit` for small changes to an existing file.";
|
|
90
90
|
readonly grep: "Search text or regex in files and return edit-ready `LINE:HASH` anchors. Use for identifiers, strings, configuration, errors, comments, and documentation.";
|
|
91
|
-
readonly digest: "Digest source content and images into the native CLI envelope. Returns metadata plus requested facets unchanged from `readseek digest`; use for structural maps, diagnostics, and cursor identity.";
|
|
92
91
|
readonly view: "Digest a document's structure or selected content. Start with the overview, then narrow by page, node, kind, or depth instead of reading the whole document. PDF is the first supported document format.";
|
|
93
92
|
readonly search: "Search code by AST structure using ast-grep-style patterns. Results include line hashes usable as `LINE:HASH` anchors. Use `grep` for identifiers, strings, comments, configuration, documentation, or other plain text and regex.";
|
|
94
93
|
readonly def: "Go to a symbol definition or declaration by name. Accepts qualified or unqualified names; use this instead of text search for functions, methods, classes, types, and other declarations.";
|
package/dist/index.js
CHANGED
|
@@ -30,11 +30,10 @@ var EDIT_VARIANTS = [
|
|
|
30
30
|
];
|
|
31
31
|
var GIT_SELECTION_FLAGS = ["cached", "others", "ignored"];
|
|
32
32
|
var TOOL_NAMES = [
|
|
33
|
-
"
|
|
33
|
+
"digest",
|
|
34
34
|
"edit",
|
|
35
35
|
"write",
|
|
36
36
|
"grep",
|
|
37
|
-
"digest",
|
|
38
37
|
"view",
|
|
39
38
|
"search",
|
|
40
39
|
"def",
|
|
@@ -111,11 +110,10 @@ var PARAM_DESCRIPTIONS = {
|
|
|
111
110
|
scopeContext: "Context lines within each symbol"
|
|
112
111
|
};
|
|
113
112
|
var TOOL_DESCRIPTIONS = {
|
|
114
|
-
|
|
113
|
+
digest: "Digest source content and images into the native CLI envelope. Returns metadata plus requested facets unchanged from `readseek digest`. Use it before edits to obtain fresh `LINE:HASH` anchors; use for structural maps, diagnostics, and cursor identity.",
|
|
115
114
|
edit: 'Edit existing text files with fresh `LINE:HASH` anchors. Read or search first when no fresh anchors are available. Each `edits[]` item must use exactly one nested object: `{"set_line":{"anchor":"LINE:HASH","new_text":"..."}}`, `{"replace_lines":{"start_anchor":"LINE:HASH","end_anchor":"LINE:HASH","new_text":"..."}}`, `{"insert_after":{"anchor":"LINE:HASH","new_text":"..."}}`, `{"replace_symbol":{"symbol":"name","new_body":"..."}}`, or `{"replace":{"old_text":"...","new_text":"..."}}`.',
|
|
116
115
|
write: "Create or replace a complete text file and return `LINE:HASH` anchors. Use `edit` for small changes to an existing file.",
|
|
117
116
|
grep: "Search text or regex in files and return edit-ready `LINE:HASH` anchors. Use for identifiers, strings, configuration, errors, comments, and documentation.",
|
|
118
|
-
digest: "Digest source content and images into the native CLI envelope. Returns metadata plus requested facets unchanged from `readseek digest`; use for structural maps, diagnostics, and cursor identity.",
|
|
119
117
|
view: "Digest a document's structure or selected content. Start with the overview, then narrow by page, node, kind, or depth instead of reading the whole document. PDF is the first supported document format.",
|
|
120
118
|
search: "Search code by AST structure using ast-grep-style patterns. Results include line hashes usable as `LINE:HASH` anchors. Use `grep` for identifiers, strings, comments, configuration, documentation, or other plain text and regex.",
|
|
121
119
|
def: "Go to a symbol definition or declaration by name. Accepts qualified or unqualified names; use this instead of text search for functions, methods, classes, types, and other declarations.",
|
|
@@ -123,7 +121,10 @@ var TOOL_DESCRIPTIONS = {
|
|
|
123
121
|
rename: "Rename a symbol at a source location. Resolvable same-named bindings are preserved; verified edits apply by default. Set `apply: false` to preview the plan before changing files."
|
|
124
122
|
};
|
|
125
123
|
function renderToolDescription(name, aliases = {}) {
|
|
126
|
-
|
|
124
|
+
const desc = TOOL_DESCRIPTIONS[name];
|
|
125
|
+
if (!desc)
|
|
126
|
+
throw new Error(`Missing TOOL_DESCRIPTIONS for ${name}`);
|
|
127
|
+
return TOOL_NAMES.reduce((description, toolName) => description.replaceAll(`\`${toolName}\``, `\`${aliases[toolName] ?? toolName}\``), desc);
|
|
127
128
|
}
|
|
128
129
|
var gitFlagsSchema = {
|
|
129
130
|
cached: {
|
|
@@ -202,25 +203,27 @@ var editItemSchema = {
|
|
|
202
203
|
};
|
|
203
204
|
var TOOL_CONTRACTS = [
|
|
204
205
|
{
|
|
205
|
-
name: "
|
|
206
|
-
title: "
|
|
207
|
-
description: TOOL_DESCRIPTIONS.
|
|
206
|
+
name: "digest",
|
|
207
|
+
title: "Digest source",
|
|
208
|
+
description: TOOL_DESCRIPTIONS.digest,
|
|
208
209
|
inputSchema: {
|
|
209
210
|
type: "object",
|
|
210
211
|
properties: {
|
|
211
212
|
path: { type: "string", description: PARAM_DESCRIPTIONS.path },
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
select: { type: "string", description: PARAM_DESCRIPTIONS.select },
|
|
214
|
+
at: { type: "string", description: PARAM_DESCRIPTIONS.at },
|
|
215
|
+
end: { type: "integer", minimum: 1, description: PARAM_DESCRIPTIONS.end },
|
|
216
|
+
limit: { type: "integer", minimum: 1, description: PARAM_DESCRIPTIONS.limit },
|
|
217
|
+
language: { type: "string", description: PARAM_DESCRIPTIONS.languageOverride },
|
|
218
|
+
visionMode: {
|
|
216
219
|
type: "string",
|
|
217
|
-
enum: [
|
|
218
|
-
description: PARAM_DESCRIPTIONS.
|
|
220
|
+
enum: [...VISION_MODES],
|
|
221
|
+
description: PARAM_DESCRIPTIONS.visionModeDigest
|
|
219
222
|
},
|
|
220
|
-
|
|
223
|
+
visionLevel: {
|
|
221
224
|
type: "string",
|
|
222
|
-
enum: [...
|
|
223
|
-
description: PARAM_DESCRIPTIONS.
|
|
225
|
+
enum: [...VISION_LEVELS],
|
|
226
|
+
description: PARAM_DESCRIPTIONS.visionLevel
|
|
224
227
|
}
|
|
225
228
|
},
|
|
226
229
|
required: ["path"],
|
|
@@ -294,34 +297,6 @@ var TOOL_CONTRACTS = [
|
|
|
294
297
|
additionalProperties: false
|
|
295
298
|
}
|
|
296
299
|
},
|
|
297
|
-
{
|
|
298
|
-
name: "digest",
|
|
299
|
-
title: "Digest source",
|
|
300
|
-
description: TOOL_DESCRIPTIONS.digest,
|
|
301
|
-
inputSchema: {
|
|
302
|
-
type: "object",
|
|
303
|
-
properties: {
|
|
304
|
-
path: { type: "string", description: PARAM_DESCRIPTIONS.path },
|
|
305
|
-
select: { type: "string", description: PARAM_DESCRIPTIONS.select },
|
|
306
|
-
at: { type: "string", description: PARAM_DESCRIPTIONS.at },
|
|
307
|
-
end: { type: "integer", minimum: 1, description: PARAM_DESCRIPTIONS.end },
|
|
308
|
-
limit: { type: "integer", minimum: 1, description: PARAM_DESCRIPTIONS.limit },
|
|
309
|
-
language: { type: "string", description: PARAM_DESCRIPTIONS.languageOverride },
|
|
310
|
-
visionMode: {
|
|
311
|
-
type: "string",
|
|
312
|
-
enum: [...VISION_MODES],
|
|
313
|
-
description: PARAM_DESCRIPTIONS.visionModeDigest
|
|
314
|
-
},
|
|
315
|
-
visionLevel: {
|
|
316
|
-
type: "string",
|
|
317
|
-
enum: [...VISION_LEVELS],
|
|
318
|
-
description: PARAM_DESCRIPTIONS.visionLevel
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
required: ["path"],
|
|
322
|
-
additionalProperties: false
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
300
|
{
|
|
326
301
|
name: "view",
|
|
327
302
|
title: "View document",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jarkkojs/readseek-api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Shared ReadSeek CLI contract, validation, argv builders, and bounded process runners",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"hashline"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@jarkkojs/readseek": "^0.9.
|
|
48
|
+
"@jarkkojs/readseek": "^0.9.6"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.0.0",
|