@jarkkojs/readseek-api 0.9.5
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/LICENSE +176 -0
- package/README.md +47 -0
- package/dist/argv.d.ts +81 -0
- package/dist/contract.d.ts +111 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +952 -0
- package/dist/json.d.ts +2 -0
- package/dist/platform.d.ts +13 -0
- package/dist/process-bun.d.ts +4 -0
- package/dist/process-node.d.ts +4 -0
- package/dist/process.d.ts +30 -0
- package/dist/validation.d.ts +33 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @jarkkojs/readseek-api
|
|
2
|
+
|
|
3
|
+
Shared, host-agnostic ReadSeek API pieces for CLI contract metadata, parameter
|
|
4
|
+
validation, pure argv builders, platform package resolution, and bounded Node
|
|
5
|
+
or Bun process invocation.
|
|
6
|
+
|
|
7
|
+
This package intentionally excludes host permissions, cache management, install
|
|
8
|
+
flows, session state, and TUI rendering.
|
|
9
|
+
|
|
10
|
+
Repository plugins consume this source directly: Pi and OpenCode inline it into
|
|
11
|
+
their published bundles, and the Claude marketplace plugin imports the monorepo
|
|
12
|
+
sibling sources. External consumers install the published package.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @jarkkojs/readseek-api
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`@jarkkojs/readseek` arrives as a dependency.
|
|
21
|
+
|
|
22
|
+
## Exports
|
|
23
|
+
|
|
24
|
+
- Contract: tool descriptions, shared parameter text, and enums
|
|
25
|
+
- Validation: git selection, refs name/scope, vision level/mode, edit variants
|
|
26
|
+
- Argv builders: `digest`, `view`, `search`, `def`, `refs`, `edit`, `rename`, line locations
|
|
27
|
+
- Platform: binary name, platform package map, and default or caller-injected module resolution
|
|
28
|
+
- Process: Node and Bun runners with timeout, cancellation, stdin, cwd, hard
|
|
29
|
+
stdout/stderr caps, no shell, and strict JSON/error cleanup
|
|
30
|
+
|
|
31
|
+
## Example
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import {
|
|
35
|
+
buildDigestArgs,
|
|
36
|
+
resolveReadSeekBinaryFromPackages,
|
|
37
|
+
runReadSeekNodeJson,
|
|
38
|
+
} from "@jarkkojs/readseek-api";
|
|
39
|
+
|
|
40
|
+
const binary = resolveReadSeekBinaryFromPackages();
|
|
41
|
+
const args = buildDigestArgs({ path: "src/index.ts", select: "map" });
|
|
42
|
+
const envelope = await runReadSeekNodeJson(binary, args);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
Apache-2.0
|
package/dist/argv.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { DigestFacet, DocumentNodeKind, VisionAnalysisMode, VisionLevel, VisionMode } from "./contract.ts";
|
|
2
|
+
import { type GitSelectionInput } from "./validation.ts";
|
|
3
|
+
export declare function buildLineLocation(line: number, column?: number): string;
|
|
4
|
+
export declare function appendGitSelectionArgs(args: string[], input: GitSelectionInput): string[];
|
|
5
|
+
export type ApplyPlanHashOrder = "plan-hash-first" | "apply-first";
|
|
6
|
+
export type ApplyPlanHashInput = {
|
|
7
|
+
apply?: boolean;
|
|
8
|
+
planHash?: string;
|
|
9
|
+
flagOrder?: ApplyPlanHashOrder;
|
|
10
|
+
};
|
|
11
|
+
export declare function appendApplyAndPlanHash(args: string[], input: ApplyPlanHashInput): string[];
|
|
12
|
+
export type DigestArgsInput = {
|
|
13
|
+
path: string;
|
|
14
|
+
select?: DigestFacet | DigestFacet[] | string;
|
|
15
|
+
at?: string;
|
|
16
|
+
end?: number;
|
|
17
|
+
limit?: number;
|
|
18
|
+
language?: string;
|
|
19
|
+
visionMode?: VisionMode;
|
|
20
|
+
visionLevel?: VisionLevel;
|
|
21
|
+
stdinName?: string;
|
|
22
|
+
readseekDir?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function buildDigestArgs(input: DigestArgsInput): string[];
|
|
25
|
+
export type ViewArgsInput = {
|
|
26
|
+
path: string;
|
|
27
|
+
node?: string;
|
|
28
|
+
page?: number;
|
|
29
|
+
kind?: DocumentNodeKind | string;
|
|
30
|
+
depth?: number;
|
|
31
|
+
outline?: boolean;
|
|
32
|
+
visionMode?: VisionAnalysisMode;
|
|
33
|
+
visionLevel?: VisionLevel;
|
|
34
|
+
format?: "json" | "text";
|
|
35
|
+
readseekDir?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function buildViewArgs(input: ViewArgsInput): string[];
|
|
38
|
+
export type SearchArgsInput = {
|
|
39
|
+
path: string;
|
|
40
|
+
pattern: string;
|
|
41
|
+
language?: string;
|
|
42
|
+
} & GitSelectionInput;
|
|
43
|
+
export declare function buildSearchArgs(input: SearchArgsInput): string[];
|
|
44
|
+
export type DefArgsInput = {
|
|
45
|
+
path: string;
|
|
46
|
+
name: string;
|
|
47
|
+
language?: string;
|
|
48
|
+
format?: "plain" | "json";
|
|
49
|
+
} & GitSelectionInput;
|
|
50
|
+
export declare function buildDefArgs(input: DefArgsInput): string[];
|
|
51
|
+
export type RefsArgsInput = {
|
|
52
|
+
path: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
scope?: boolean;
|
|
55
|
+
line?: number;
|
|
56
|
+
column?: number;
|
|
57
|
+
language?: string;
|
|
58
|
+
format?: "plain" | "json";
|
|
59
|
+
} & GitSelectionInput;
|
|
60
|
+
export declare function buildRefsArgs(input: RefsArgsInput): string[];
|
|
61
|
+
export type EditArgsInput = {
|
|
62
|
+
path: string;
|
|
63
|
+
apply?: boolean;
|
|
64
|
+
planHash?: string;
|
|
65
|
+
language?: string;
|
|
66
|
+
requestFromStdin?: boolean;
|
|
67
|
+
flagOrder?: ApplyPlanHashOrder;
|
|
68
|
+
};
|
|
69
|
+
export declare function buildEditArgs(input: EditArgsInput): string[];
|
|
70
|
+
export type RenameArgsInput = {
|
|
71
|
+
path: string;
|
|
72
|
+
to: string;
|
|
73
|
+
line: number;
|
|
74
|
+
column?: number;
|
|
75
|
+
workspace?: string;
|
|
76
|
+
apply?: boolean;
|
|
77
|
+
planHash?: string;
|
|
78
|
+
language?: string;
|
|
79
|
+
flagOrder?: ApplyPlanHashOrder;
|
|
80
|
+
} & GitSelectionInput;
|
|
81
|
+
export declare function buildRenameArgs(input: RenameArgsInput): string[];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export declare const DIGEST_FACETS: readonly ["metadata", "content", "map", "diagnostics", "identity"];
|
|
2
|
+
export type DigestFacet = (typeof DIGEST_FACETS)[number];
|
|
3
|
+
export declare const VISION_MODES: readonly ["none", "all", "ocr", "caption", "objects"];
|
|
4
|
+
export type VisionMode = (typeof VISION_MODES)[number];
|
|
5
|
+
export declare const VISION_ANALYSIS_MODES: readonly ["all", "ocr", "caption", "objects"];
|
|
6
|
+
export type VisionAnalysisMode = (typeof VISION_ANALYSIS_MODES)[number];
|
|
7
|
+
export declare const VISION_LEVELS: readonly ["low", "medium", "high"];
|
|
8
|
+
export type VisionLevel = (typeof VISION_LEVELS)[number];
|
|
9
|
+
export declare const DOCUMENT_NODE_KINDS: readonly ["artifact", "footer", "header", "heading", "marginal_label", "page", "page_number", "paragraph", "section", "structural_section"];
|
|
10
|
+
export type DocumentNodeKind = (typeof DOCUMENT_NODE_KINDS)[number];
|
|
11
|
+
export declare const EDIT_VARIANTS: readonly ["set_line", "replace_lines", "insert_after", "replace", "replace_symbol"];
|
|
12
|
+
export type EditVariant = (typeof EDIT_VARIANTS)[number];
|
|
13
|
+
export declare const GIT_SELECTION_FLAGS: readonly ["cached", "others", "ignored"];
|
|
14
|
+
export type GitSelectionFlag = (typeof GIT_SELECTION_FLAGS)[number];
|
|
15
|
+
export declare const TOOL_NAMES: readonly ["read", "edit", "write", "grep", "digest", "view", "search", "def", "refs", "rename"];
|
|
16
|
+
export type ToolName = (typeof TOOL_NAMES)[number];
|
|
17
|
+
export declare const PARAM_DESCRIPTIONS: {
|
|
18
|
+
readonly path: "Absolute or relative file path";
|
|
19
|
+
readonly searchPath: "File or directory to search; defaults to the current directory";
|
|
20
|
+
readonly language: "Language override when auto-detection is ambiguous";
|
|
21
|
+
readonly languageOverride: "Language override";
|
|
22
|
+
readonly languageSymbol: "Language override for symbol replacement";
|
|
23
|
+
readonly pattern: "AST pattern (ast-grep style), such as console.log($$$ARGS)";
|
|
24
|
+
readonly grepPattern: "Regex pattern; set literal for exact text";
|
|
25
|
+
readonly name: "Qualified or unqualified symbol name";
|
|
26
|
+
readonly refsName: "Identifier to find references for";
|
|
27
|
+
readonly scope: "Restrict results to the binding at the cursor";
|
|
28
|
+
readonly line: "One-based cursor line; required with scope";
|
|
29
|
+
readonly renameLine: "One-based cursor line of the symbol to rename";
|
|
30
|
+
readonly column: "One-based cursor byte column for disambiguation";
|
|
31
|
+
readonly cached: "In a Git repository, search tracked/indexed files";
|
|
32
|
+
readonly others: "In a Git repository, search untracked files";
|
|
33
|
+
readonly ignored: "With others=true, include ignored untracked files";
|
|
34
|
+
readonly select: "Facets: metadata, content, map, diagnostics, identity (default content)";
|
|
35
|
+
readonly selectComma: "Comma-separated facets: metadata, content, map, diagnostics, identity";
|
|
36
|
+
readonly at: "Location: line:N[:COLUMN], hash:HASH[:COLUMN], or symbol:NAME";
|
|
37
|
+
readonly end: "Last line to include";
|
|
38
|
+
readonly limit: "Maximum number of lines to include";
|
|
39
|
+
readonly offset: "One-based starting line";
|
|
40
|
+
readonly readLimit: "Maximum lines to return";
|
|
41
|
+
readonly symbolRead: "Symbol name to read";
|
|
42
|
+
readonly bundle: "Include related symbols from the same file; requires symbol";
|
|
43
|
+
readonly image: "Standalone image mode: none, all, ocr, caption, objects. Required for standalone images.";
|
|
44
|
+
readonly visionModeDigest: "Standalone image mode: none, all, caption, objects, or ocr";
|
|
45
|
+
readonly visionModeView: "Analyze selected assets: all, ocr, caption, or objects";
|
|
46
|
+
readonly visionLevel: "Vision inference level: low (default), medium, or high";
|
|
47
|
+
readonly node: "Node ID to use as the view root";
|
|
48
|
+
readonly page: "One-based source page";
|
|
49
|
+
readonly kind: "Node kind filter";
|
|
50
|
+
readonly depth: "Maximum depth below selected roots";
|
|
51
|
+
readonly outline: "Return outline nodes only";
|
|
52
|
+
readonly edits: "Use set_line, replace_lines, insert_after, replace_symbol, or replace";
|
|
53
|
+
readonly editVariant: "Exactly one nested edit variant";
|
|
54
|
+
readonly setLine: "Replace one line: {\"set_line\":{\"anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}";
|
|
55
|
+
readonly replaceLines: "Replace a range: {\"replace_lines\":{\"start_anchor\":\"LINE:HASH\",\"end_anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}";
|
|
56
|
+
readonly insertAfter: "Insert text: {\"insert_after\":{\"anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}";
|
|
57
|
+
readonly replace: "Replace text: {\"replace\":{\"old_text\":\"...\",\"new_text\":\"...\"}}";
|
|
58
|
+
readonly replaceSymbol: "Replace a symbol: {\"replace_symbol\":{\"symbol\":\"name\",\"new_body\":\"...\"}}";
|
|
59
|
+
readonly anchor: "Fresh LINE:HASH anchor for the line to replace";
|
|
60
|
+
readonly startAnchor: "Fresh LINE:HASH anchor for the first line in the range";
|
|
61
|
+
readonly endAnchor: "Fresh LINE:HASH anchor for the last line in the range";
|
|
62
|
+
readonly insertAnchor: "Fresh LINE:HASH anchor for the line after which to insert";
|
|
63
|
+
readonly newTextLine: "Replacement text; use an empty string to delete the line";
|
|
64
|
+
readonly newTextRange: "Replacement text; use an empty string to delete the range";
|
|
65
|
+
readonly newTextInsert: "Text to insert after the anchored line";
|
|
66
|
+
readonly oldText: "Exact text to find";
|
|
67
|
+
readonly newText: "Replacement text";
|
|
68
|
+
readonly all: "Replace every exact match";
|
|
69
|
+
readonly symbol: "Mapped symbol name";
|
|
70
|
+
readonly newBody: "Complete replacement body for the symbol";
|
|
71
|
+
readonly apply: "When supported by the host, apply the verified plan instead of previewing only";
|
|
72
|
+
readonly planHash: "Require the apply plan to match this dry-run plan hash";
|
|
73
|
+
readonly workspace: "Rename across the project";
|
|
74
|
+
readonly to: "New symbol name";
|
|
75
|
+
readonly postEditVerify: "Read back and verify persisted content";
|
|
76
|
+
readonly content: "Complete text file content";
|
|
77
|
+
readonly glob: "File-name glob, such as *.ts";
|
|
78
|
+
readonly ignoreCase: "Ignore case";
|
|
79
|
+
readonly literal: "Treat pattern literally";
|
|
80
|
+
readonly context: "Surrounding lines for each match";
|
|
81
|
+
readonly matchLimit: "Maximum matches to return";
|
|
82
|
+
readonly summary: "Return per-file counts";
|
|
83
|
+
readonly grepScope: "Group matches by enclosing symbol";
|
|
84
|
+
readonly scopeContext: "Context lines within each symbol";
|
|
85
|
+
};
|
|
86
|
+
export declare const TOOL_DESCRIPTIONS: {
|
|
87
|
+
readonly read: "Read anchored text by range or symbol. Standalone images require an explicit mode. Use it before edits to obtain fresh `LINE:HASH` anchors; use `view` for documents and `digest` with the map facet for structural outlines.";
|
|
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
|
+
readonly write: "Create or replace a complete text file and return `LINE:HASH` anchors. Use `edit` for small changes to an existing file.";
|
|
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
|
+
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
|
+
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
|
+
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.";
|
|
95
|
+
readonly refs: "Find references or usages of an identifier by name or cursor binding. Results include enclosing symbols and line hashes usable as `LINE:HASH` anchors. Without cursor scope, results are identifier-name matches; with scope, they follow one binding and exclude shadows. Use text search for literals, and use this before renaming or deleting a symbol.";
|
|
96
|
+
readonly 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.";
|
|
97
|
+
};
|
|
98
|
+
export declare function renderToolDescription(name: ToolName, aliases?: Readonly<Partial<Record<ToolName, string>>>): string;
|
|
99
|
+
export type JsonSchema = {
|
|
100
|
+
type: "object";
|
|
101
|
+
properties: Record<string, unknown>;
|
|
102
|
+
required?: string[];
|
|
103
|
+
additionalProperties?: boolean;
|
|
104
|
+
};
|
|
105
|
+
export type ToolContract = {
|
|
106
|
+
name: ToolName;
|
|
107
|
+
title: string;
|
|
108
|
+
description: string;
|
|
109
|
+
inputSchema: JsonSchema;
|
|
110
|
+
};
|
|
111
|
+
export declare const TOOL_CONTRACTS: readonly ToolContract[];
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { DIGEST_FACETS, DOCUMENT_NODE_KINDS, EDIT_VARIANTS, GIT_SELECTION_FLAGS, PARAM_DESCRIPTIONS, TOOL_CONTRACTS, TOOL_DESCRIPTIONS, TOOL_NAMES, renderToolDescription, VISION_ANALYSIS_MODES, VISION_LEVELS, VISION_MODES, type DigestFacet, type DocumentNodeKind, type EditVariant, type GitSelectionFlag, type JsonSchema, type ToolContract, type ToolName, type VisionAnalysisMode, type VisionLevel, type VisionMode, } from "./contract.ts";
|
|
2
|
+
export { validateExactlyOneEditVariant, validateGitSelection, validateRefsNameVsScope, validateVisionLevelVsMode, type EditObject, type GitSelectionInput, type RefsScopeInput, type ValidationResult, type VisionInput, } from "./validation.ts";
|
|
3
|
+
export { appendApplyAndPlanHash, appendGitSelectionArgs, buildDefArgs, buildDigestArgs, buildEditArgs, buildLineLocation, buildRefsArgs, buildRenameArgs, buildSearchArgs, buildViewArgs, type ApplyPlanHashInput, type ApplyPlanHashOrder, type DefArgsInput, type DigestArgsInput, type EditArgsInput, type RefsArgsInput, type RenameArgsInput, type SearchArgsInput, type ViewArgsInput, } from "./argv.ts";
|
|
4
|
+
export { READSEEK_PLATFORM_PACKAGES, readSeekBinaryName, readSeekPlatformKey, resolveReadSeekBinaryFromPackages, type ModuleResolver, } from "./platform.ts";
|
|
5
|
+
export { cleanReadSeekErrorText, parseReadSeekJson, } from "./json.ts";
|
|
6
|
+
export { DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_READSEEK_TIMEOUT_MS, ensureSuccessfulStdout, failureFromProcessResult, parseSuccessfulJson, resolveProcessLimits, type ProcessRunOptions, type ProcessRunResult, } from "./process.ts";
|
|
7
|
+
export { runReadSeekNode, runReadSeekNodeJson, runReadSeekNodeText, } from "./process-node.ts";
|
|
8
|
+
export { runReadSeekBun, runReadSeekBunJson, runReadSeekBunText, } from "./process-bun.ts";
|