gsd-pi 2.10.0 → 2.10.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/node_modules/@gsd/native/dist/ast/index.d.ts +4 -0
- package/node_modules/@gsd/native/dist/ast/index.js +7 -0
- package/node_modules/@gsd/native/dist/ast/types.d.ts +69 -0
- package/node_modules/@gsd/native/dist/ast/types.js +1 -0
- package/node_modules/@gsd/native/{src/clipboard/index.ts → dist/clipboard/index.d.ts} +3 -15
- package/node_modules/@gsd/native/dist/clipboard/index.js +33 -0
- package/node_modules/@gsd/native/dist/clipboard/types.d.ts +7 -0
- package/node_modules/@gsd/native/dist/clipboard/types.js +1 -0
- package/node_modules/@gsd/native/dist/diff/index.d.ts +33 -0
- package/node_modules/@gsd/native/dist/diff/index.js +38 -0
- package/node_modules/@gsd/native/dist/diff/types.d.ts +23 -0
- package/node_modules/@gsd/native/dist/diff/types.js +1 -0
- package/node_modules/@gsd/native/{src/fd/index.ts → dist/fd/index.d.ts} +2 -12
- package/node_modules/@gsd/native/dist/fd/index.js +26 -0
- package/node_modules/@gsd/native/dist/fd/types.d.ts +29 -0
- package/node_modules/@gsd/native/dist/fd/types.js +1 -0
- package/node_modules/@gsd/native/{src/glob/index.ts → dist/glob/index.d.ts} +3 -19
- package/node_modules/@gsd/native/dist/glob/index.js +31 -0
- package/node_modules/@gsd/native/dist/glob/types.d.ts +50 -0
- package/node_modules/@gsd/native/dist/glob/types.js +1 -0
- package/node_modules/@gsd/native/dist/grep/index.d.ts +20 -0
- package/node_modules/@gsd/native/dist/grep/index.js +23 -0
- package/node_modules/@gsd/native/dist/grep/types.d.ts +99 -0
- package/node_modules/@gsd/native/dist/grep/types.js +1 -0
- package/node_modules/@gsd/native/dist/gsd-parser/index.d.ts +45 -0
- package/node_modules/@gsd/native/dist/gsd-parser/index.js +54 -0
- package/node_modules/@gsd/native/dist/gsd-parser/types.d.ts +55 -0
- package/node_modules/@gsd/native/dist/gsd-parser/types.js +7 -0
- package/node_modules/@gsd/native/{src/highlight/index.ts → dist/highlight/index.d.ts} +3 -19
- package/node_modules/@gsd/native/dist/highlight/index.js +33 -0
- package/node_modules/@gsd/native/dist/highlight/types.d.ts +25 -0
- package/node_modules/@gsd/native/dist/highlight/types.js +1 -0
- package/node_modules/@gsd/native/{src/html/index.ts → dist/html/index.d.ts} +1 -10
- package/node_modules/@gsd/native/dist/html/index.js +16 -0
- package/node_modules/@gsd/native/dist/html/types.d.ts +7 -0
- package/node_modules/@gsd/native/dist/html/types.js +1 -0
- package/node_modules/@gsd/native/{src/image/index.ts → dist/image/index.d.ts} +1 -14
- package/node_modules/@gsd/native/dist/image/index.js +18 -0
- package/node_modules/@gsd/native/dist/image/types.d.ts +35 -0
- package/node_modules/@gsd/native/dist/image/types.js +26 -0
- package/node_modules/@gsd/native/{src/index.ts → dist/index.d.ts} +12 -60
- package/node_modules/@gsd/native/dist/index.js +28 -0
- package/node_modules/@gsd/native/dist/native.d.ts +44 -0
- package/node_modules/@gsd/native/dist/native.js +34 -0
- package/node_modules/@gsd/native/dist/ps/index.d.ts +38 -0
- package/node_modules/@gsd/native/{src/ps/index.ts → dist/ps/index.js} +8 -13
- package/node_modules/@gsd/native/{src/ps/types.ts → dist/ps/types.d.ts} +2 -2
- package/node_modules/@gsd/native/dist/ps/types.js +1 -0
- package/node_modules/@gsd/native/{src/text/index.ts → dist/text/index.d.ts} +6 -76
- package/node_modules/@gsd/native/dist/text/index.js +66 -0
- package/node_modules/@gsd/native/dist/text/types.d.ts +27 -0
- package/node_modules/@gsd/native/dist/text/types.js +10 -0
- package/node_modules/@gsd/native/{src/ttsr/index.ts → dist/ttsr/index.d.ts} +3 -15
- package/node_modules/@gsd/native/dist/ttsr/index.js +32 -0
- package/node_modules/@gsd/native/{src/ttsr/types.ts → dist/ttsr/types.d.ts} +4 -5
- package/node_modules/@gsd/native/dist/ttsr/types.js +1 -0
- package/node_modules/@gsd/native/package.json +24 -23
- package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
- package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
- package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
- package/node_modules/@gsd/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
- package/package.json +4 -2
- package/packages/native/dist/ast/index.d.ts +4 -0
- package/packages/native/dist/ast/index.js +7 -0
- package/packages/native/dist/ast/types.d.ts +69 -0
- package/packages/native/dist/ast/types.js +1 -0
- package/packages/native/dist/clipboard/index.d.ts +28 -0
- package/packages/native/dist/clipboard/index.js +33 -0
- package/packages/native/dist/clipboard/types.d.ts +7 -0
- package/packages/native/dist/clipboard/types.js +1 -0
- package/packages/native/dist/diff/index.d.ts +33 -0
- package/packages/native/dist/diff/index.js +38 -0
- package/packages/native/dist/diff/types.d.ts +23 -0
- package/packages/native/dist/diff/types.js +1 -0
- package/packages/native/dist/fd/index.d.ts +25 -0
- package/packages/native/dist/fd/index.js +26 -0
- package/packages/native/dist/fd/types.d.ts +29 -0
- package/packages/native/dist/fd/types.js +1 -0
- package/packages/native/dist/glob/index.d.ts +28 -0
- package/packages/native/dist/glob/index.js +31 -0
- package/packages/native/dist/glob/types.d.ts +50 -0
- package/packages/native/dist/glob/types.js +1 -0
- package/packages/native/dist/grep/index.d.ts +20 -0
- package/packages/native/dist/grep/index.js +23 -0
- package/packages/native/dist/grep/types.d.ts +99 -0
- package/packages/native/dist/grep/types.js +1 -0
- package/packages/native/dist/gsd-parser/index.d.ts +45 -0
- package/packages/native/dist/gsd-parser/index.js +54 -0
- package/packages/native/dist/gsd-parser/types.d.ts +55 -0
- package/packages/native/dist/gsd-parser/types.js +7 -0
- package/packages/native/dist/highlight/index.d.ts +28 -0
- package/packages/native/dist/highlight/index.js +33 -0
- package/packages/native/dist/highlight/types.d.ts +25 -0
- package/packages/native/dist/highlight/types.js +1 -0
- package/packages/native/dist/html/index.d.ts +15 -0
- package/packages/native/dist/html/index.js +16 -0
- package/packages/native/dist/html/types.d.ts +7 -0
- package/packages/native/dist/html/types.js +1 -0
- package/packages/native/dist/image/index.d.ts +15 -0
- package/packages/native/dist/image/index.js +18 -0
- package/packages/native/dist/image/types.d.ts +35 -0
- package/packages/native/dist/image/types.js +26 -0
- package/packages/native/dist/index.d.ts +40 -0
- package/packages/native/dist/index.js +28 -0
- package/packages/native/dist/native.d.ts +44 -0
- package/packages/native/dist/native.js +34 -0
- package/packages/native/dist/ps/index.d.ts +38 -0
- package/packages/native/dist/ps/index.js +47 -0
- package/packages/native/dist/ps/types.d.ts +5 -0
- package/packages/native/dist/ps/types.js +1 -0
- package/packages/native/dist/text/index.d.ts +55 -0
- package/packages/native/dist/text/index.js +66 -0
- package/packages/native/dist/text/types.d.ts +27 -0
- package/packages/native/dist/text/types.js +10 -0
- package/packages/native/dist/ttsr/index.d.ts +27 -0
- package/packages/native/dist/ttsr/index.js +32 -0
- package/packages/native/dist/ttsr/types.d.ts +9 -0
- package/packages/native/dist/ttsr/types.js +1 -0
- package/packages/native/package.json +24 -23
- package/packages/native/src/__tests__/diff.test.mjs +189 -0
- package/packages/native/src/__tests__/ttsr.test.mjs +135 -0
- package/packages/native/src/diff/index.ts +61 -0
- package/packages/native/src/diff/types.ts +24 -0
- package/packages/native/src/gsd-parser/index.ts +98 -0
- package/packages/native/src/gsd-parser/types.ts +62 -0
- package/packages/native/src/index.ts +23 -0
- package/packages/native/src/native.ts +8 -0
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
- package/packages/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
- package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
- package/src/resources/extensions/gsd/files.ts +9 -0
- package/src/resources/extensions/gsd/native-parser-bridge.ts +135 -0
- package/src/resources/extensions/ttsr/ttsr-manager.ts +86 -0
- package/node_modules/@gsd/native/src/__tests__/clipboard.test.mjs +0 -79
- package/node_modules/@gsd/native/src/__tests__/fd.test.mjs +0 -164
- package/node_modules/@gsd/native/src/__tests__/glob.test.mjs +0 -237
- package/node_modules/@gsd/native/src/__tests__/grep.test.mjs +0 -162
- package/node_modules/@gsd/native/src/__tests__/highlight.test.mjs +0 -156
- package/node_modules/@gsd/native/src/__tests__/html.test.mjs +0 -98
- package/node_modules/@gsd/native/src/__tests__/image.test.mjs +0 -137
- package/node_modules/@gsd/native/src/__tests__/ps.test.mjs +0 -109
- package/node_modules/@gsd/native/src/__tests__/text.test.mjs +0 -262
- package/node_modules/@gsd/native/src/ast/index.ts +0 -12
- package/node_modules/@gsd/native/src/ast/types.ts +0 -75
- package/node_modules/@gsd/native/src/clipboard/types.ts +0 -7
- package/node_modules/@gsd/native/src/fd/types.ts +0 -31
- package/node_modules/@gsd/native/src/glob/types.ts +0 -53
- package/node_modules/@gsd/native/src/grep/index.ts +0 -48
- package/node_modules/@gsd/native/src/grep/types.ts +0 -105
- package/node_modules/@gsd/native/src/highlight/types.ts +0 -25
- package/node_modules/@gsd/native/src/html/types.ts +0 -7
- package/node_modules/@gsd/native/src/image/types.ts +0 -41
- package/node_modules/@gsd/native/src/native.ts +0 -94
- package/node_modules/@gsd/native/src/text/types.ts +0 -29
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AstFindOptions, AstFindResult, AstReplaceOptions, AstReplaceResult, AstFindMatch, AstReplaceChange, AstReplaceFileChange } from "./types.js";
|
|
2
|
+
export type { AstFindMatch, AstFindOptions, AstFindResult, AstReplaceChange, AstReplaceFileChange, AstReplaceOptions, AstReplaceResult };
|
|
3
|
+
export declare function astGrep(options: AstFindOptions): AstFindResult;
|
|
4
|
+
export declare function astEdit(options: AstReplaceOptions): AstReplaceResult;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface AstFindOptions {
|
|
2
|
+
patterns: string[];
|
|
3
|
+
lang?: string;
|
|
4
|
+
path?: string;
|
|
5
|
+
glob?: string;
|
|
6
|
+
selector?: string;
|
|
7
|
+
strictness?: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
includeMeta?: boolean;
|
|
11
|
+
context?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface AstFindMatch {
|
|
14
|
+
path: string;
|
|
15
|
+
text: string;
|
|
16
|
+
byteStart: number;
|
|
17
|
+
byteEnd: number;
|
|
18
|
+
startLine: number;
|
|
19
|
+
startColumn: number;
|
|
20
|
+
endLine: number;
|
|
21
|
+
endColumn: number;
|
|
22
|
+
metaVariables?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export interface AstFindResult {
|
|
25
|
+
matches: AstFindMatch[];
|
|
26
|
+
totalMatches: number;
|
|
27
|
+
filesWithMatches: number;
|
|
28
|
+
filesSearched: number;
|
|
29
|
+
limitReached: boolean;
|
|
30
|
+
parseErrors?: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface AstReplaceOptions {
|
|
33
|
+
rewrites: Record<string, string>;
|
|
34
|
+
lang?: string;
|
|
35
|
+
path?: string;
|
|
36
|
+
glob?: string;
|
|
37
|
+
selector?: string;
|
|
38
|
+
strictness?: string;
|
|
39
|
+
dryRun?: boolean;
|
|
40
|
+
maxReplacements?: number;
|
|
41
|
+
maxFiles?: number;
|
|
42
|
+
failOnParseError?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface AstReplaceChange {
|
|
45
|
+
path: string;
|
|
46
|
+
before: string;
|
|
47
|
+
after: string;
|
|
48
|
+
byteStart: number;
|
|
49
|
+
byteEnd: number;
|
|
50
|
+
deletedLength: number;
|
|
51
|
+
startLine: number;
|
|
52
|
+
startColumn: number;
|
|
53
|
+
endLine: number;
|
|
54
|
+
endColumn: number;
|
|
55
|
+
}
|
|
56
|
+
export interface AstReplaceFileChange {
|
|
57
|
+
path: string;
|
|
58
|
+
count: number;
|
|
59
|
+
}
|
|
60
|
+
export interface AstReplaceResult {
|
|
61
|
+
changes: AstReplaceChange[];
|
|
62
|
+
fileChanges: AstReplaceFileChange[];
|
|
63
|
+
totalReplacements: number;
|
|
64
|
+
filesTouched: number;
|
|
65
|
+
filesSearched: number;
|
|
66
|
+
applied: boolean;
|
|
67
|
+
limitReached: boolean;
|
|
68
|
+
parseErrors?: string[];
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,37 +4,25 @@
|
|
|
4
4
|
* Cross-platform clipboard read/write backed by the `arboard` Rust crate.
|
|
5
5
|
* No external tools (pbcopy, xclip, etc.) required.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import { native } from "../native.js";
|
|
9
7
|
import type { ClipboardImage } from "./types.js";
|
|
10
|
-
|
|
11
8
|
export type { ClipboardImage };
|
|
12
|
-
|
|
13
9
|
/**
|
|
14
10
|
* Copy plain text to the system clipboard.
|
|
15
11
|
*
|
|
16
12
|
* Runs synchronously to avoid macOS AppKit pasteboard warnings
|
|
17
13
|
* when writing from worker threads.
|
|
18
14
|
*/
|
|
19
|
-
export function copyToClipboard(text: string): void
|
|
20
|
-
native.copyToClipboard(text);
|
|
21
|
-
}
|
|
22
|
-
|
|
15
|
+
export declare function copyToClipboard(text: string): void;
|
|
23
16
|
/**
|
|
24
17
|
* Read plain text from the system clipboard.
|
|
25
18
|
*
|
|
26
19
|
* Returns `null` when no text data is available.
|
|
27
20
|
*/
|
|
28
|
-
export function readTextFromClipboard(): string | null
|
|
29
|
-
return native.readTextFromClipboard() as string | null;
|
|
30
|
-
}
|
|
31
|
-
|
|
21
|
+
export declare function readTextFromClipboard(): string | null;
|
|
32
22
|
/**
|
|
33
23
|
* Read an image from the system clipboard.
|
|
34
24
|
*
|
|
35
25
|
* Returns a Promise that resolves to a `ClipboardImage` (PNG-encoded bytes)
|
|
36
26
|
* or `null` when no image data is available.
|
|
37
27
|
*/
|
|
38
|
-
export function readImageFromClipboard(): Promise<ClipboardImage | null
|
|
39
|
-
return native.readImageFromClipboard() as Promise<ClipboardImage | null>;
|
|
40
|
-
}
|
|
28
|
+
export declare function readImageFromClipboard(): Promise<ClipboardImage | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native clipboard access using N-API.
|
|
3
|
+
*
|
|
4
|
+
* Cross-platform clipboard read/write backed by the `arboard` Rust crate.
|
|
5
|
+
* No external tools (pbcopy, xclip, etc.) required.
|
|
6
|
+
*/
|
|
7
|
+
import { native } from "../native.js";
|
|
8
|
+
/**
|
|
9
|
+
* Copy plain text to the system clipboard.
|
|
10
|
+
*
|
|
11
|
+
* Runs synchronously to avoid macOS AppKit pasteboard warnings
|
|
12
|
+
* when writing from worker threads.
|
|
13
|
+
*/
|
|
14
|
+
export function copyToClipboard(text) {
|
|
15
|
+
native.copyToClipboard(text);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read plain text from the system clipboard.
|
|
19
|
+
*
|
|
20
|
+
* Returns `null` when no text data is available.
|
|
21
|
+
*/
|
|
22
|
+
export function readTextFromClipboard() {
|
|
23
|
+
return native.readTextFromClipboard();
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Read an image from the system clipboard.
|
|
27
|
+
*
|
|
28
|
+
* Returns a Promise that resolves to a `ClipboardImage` (PNG-encoded bytes)
|
|
29
|
+
* or `null` when no image data is available.
|
|
30
|
+
*/
|
|
31
|
+
export function readImageFromClipboard() {
|
|
32
|
+
return native.readImageFromClipboard();
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native fuzzy text matching and diff generation for the edit tool.
|
|
3
|
+
*
|
|
4
|
+
* Uses the `similar` Rust crate (Myers' algorithm) for O(n+d) diffing,
|
|
5
|
+
* and single-pass Unicode normalization for fuzzy matching.
|
|
6
|
+
*/
|
|
7
|
+
import type { DiffResult, FuzzyMatchResult } from "./types.js";
|
|
8
|
+
export type { DiffResult, FuzzyMatchResult };
|
|
9
|
+
/**
|
|
10
|
+
* Normalize text for fuzzy matching:
|
|
11
|
+
* - Strip trailing whitespace from each line
|
|
12
|
+
* - Smart quotes to ASCII equivalents
|
|
13
|
+
* - Unicode dashes/hyphens to ASCII hyphen
|
|
14
|
+
* - Special Unicode spaces to regular space
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeForFuzzyMatch(text: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Find `oldText` in `content`, trying exact match first, then fuzzy match.
|
|
19
|
+
*
|
|
20
|
+
* When fuzzy matching is used, `contentForReplacement` is the normalized
|
|
21
|
+
* version of `content`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult;
|
|
24
|
+
/**
|
|
25
|
+
* Generate a unified diff string with line numbers and context.
|
|
26
|
+
*
|
|
27
|
+
* Uses Myers' diff algorithm via the `similar` Rust crate.
|
|
28
|
+
*
|
|
29
|
+
* @param oldContent Original text
|
|
30
|
+
* @param newContent Modified text
|
|
31
|
+
* @param contextLines Number of context lines around changes (default: 4)
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateDiff(oldContent: string, newContent: string, contextLines?: number): DiffResult;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native fuzzy text matching and diff generation for the edit tool.
|
|
3
|
+
*
|
|
4
|
+
* Uses the `similar` Rust crate (Myers' algorithm) for O(n+d) diffing,
|
|
5
|
+
* and single-pass Unicode normalization for fuzzy matching.
|
|
6
|
+
*/
|
|
7
|
+
import { native } from "../native.js";
|
|
8
|
+
/**
|
|
9
|
+
* Normalize text for fuzzy matching:
|
|
10
|
+
* - Strip trailing whitespace from each line
|
|
11
|
+
* - Smart quotes to ASCII equivalents
|
|
12
|
+
* - Unicode dashes/hyphens to ASCII hyphen
|
|
13
|
+
* - Special Unicode spaces to regular space
|
|
14
|
+
*/
|
|
15
|
+
export function normalizeForFuzzyMatch(text) {
|
|
16
|
+
return native.normalizeForFuzzyMatch(text);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Find `oldText` in `content`, trying exact match first, then fuzzy match.
|
|
20
|
+
*
|
|
21
|
+
* When fuzzy matching is used, `contentForReplacement` is the normalized
|
|
22
|
+
* version of `content`.
|
|
23
|
+
*/
|
|
24
|
+
export function fuzzyFindText(content, oldText) {
|
|
25
|
+
return native.fuzzyFindText(content, oldText);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Generate a unified diff string with line numbers and context.
|
|
29
|
+
*
|
|
30
|
+
* Uses Myers' diff algorithm via the `similar` Rust crate.
|
|
31
|
+
*
|
|
32
|
+
* @param oldContent Original text
|
|
33
|
+
* @param newContent Modified text
|
|
34
|
+
* @param contextLines Number of context lines around changes (default: 4)
|
|
35
|
+
*/
|
|
36
|
+
export function generateDiff(oldContent, newContent, contextLines) {
|
|
37
|
+
return native.generateDiff(oldContent, newContent, contextLines);
|
|
38
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Result of fuzzy text matching (exact match tried first, then normalized). */
|
|
2
|
+
export interface FuzzyMatchResult {
|
|
3
|
+
/** Whether a match was found. */
|
|
4
|
+
found: boolean;
|
|
5
|
+
/** UTF-16 code unit index where the match starts (-1 if not found). */
|
|
6
|
+
index: number;
|
|
7
|
+
/** Length of the matched text in UTF-16 code units (0 if not found). */
|
|
8
|
+
matchLength: number;
|
|
9
|
+
/** Whether fuzzy (normalized) matching was used instead of exact. */
|
|
10
|
+
usedFuzzyMatch: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Content to use for replacement operations.
|
|
13
|
+
* Original content when exact match; normalized content when fuzzy match.
|
|
14
|
+
*/
|
|
15
|
+
contentForReplacement: string;
|
|
16
|
+
}
|
|
17
|
+
/** Result of unified diff generation. */
|
|
18
|
+
export interface DiffResult {
|
|
19
|
+
/** The unified diff string with line numbers. */
|
|
20
|
+
diff: string;
|
|
21
|
+
/** Line number of the first change in the new file (undefined if no changes). */
|
|
22
|
+
firstChangedLine: number | undefined;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,16 +4,8 @@
|
|
|
4
4
|
* High-performance fuzzy file search for autocomplete and @-mention resolution.
|
|
5
5
|
* Backed by Rust's `ignore` crate for directory walking with subsequence scoring.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import { native } from "../native.js";
|
|
9
|
-
import type {
|
|
10
|
-
FuzzyFindMatch,
|
|
11
|
-
FuzzyFindOptions,
|
|
12
|
-
FuzzyFindResult,
|
|
13
|
-
} from "./types.js";
|
|
14
|
-
|
|
7
|
+
import type { FuzzyFindMatch, FuzzyFindOptions, FuzzyFindResult } from "./types.js";
|
|
15
8
|
export type { FuzzyFindMatch, FuzzyFindOptions, FuzzyFindResult };
|
|
16
|
-
|
|
17
9
|
/**
|
|
18
10
|
* Fuzzy file path search.
|
|
19
11
|
*
|
|
@@ -30,6 +22,4 @@ export type { FuzzyFindMatch, FuzzyFindOptions, FuzzyFindResult };
|
|
|
30
22
|
*
|
|
31
23
|
* Directories receive a +10 score bonus.
|
|
32
24
|
*/
|
|
33
|
-
export function fuzzyFind(options: FuzzyFindOptions): FuzzyFindResult
|
|
34
|
-
return native.fuzzyFind(options) as FuzzyFindResult;
|
|
35
|
-
}
|
|
25
|
+
export declare function fuzzyFind(options: FuzzyFindOptions): FuzzyFindResult;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native fuzzy file path discovery using N-API.
|
|
3
|
+
*
|
|
4
|
+
* High-performance fuzzy file search for autocomplete and @-mention resolution.
|
|
5
|
+
* Backed by Rust's `ignore` crate for directory walking with subsequence scoring.
|
|
6
|
+
*/
|
|
7
|
+
import { native } from "../native.js";
|
|
8
|
+
/**
|
|
9
|
+
* Fuzzy file path search.
|
|
10
|
+
*
|
|
11
|
+
* Searches for files and directories whose paths match the query string.
|
|
12
|
+
* Results are sorted by match quality (higher score = better match).
|
|
13
|
+
*
|
|
14
|
+
* Scoring tiers (highest to lowest):
|
|
15
|
+
* - 120: exact filename match
|
|
16
|
+
* - 100: filename starts with query
|
|
17
|
+
* - 80: filename contains query
|
|
18
|
+
* - 60: full path contains query
|
|
19
|
+
* - 50-90: fuzzy subsequence match on filename
|
|
20
|
+
* - 30-70: fuzzy subsequence match on full path
|
|
21
|
+
*
|
|
22
|
+
* Directories receive a +10 score bonus.
|
|
23
|
+
*/
|
|
24
|
+
export function fuzzyFind(options) {
|
|
25
|
+
return native.fuzzyFind(options);
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Options for fuzzy file path search. */
|
|
2
|
+
export interface FuzzyFindOptions {
|
|
3
|
+
/** Fuzzy query to match against file paths (case-insensitive). */
|
|
4
|
+
query: string;
|
|
5
|
+
/** Directory to search. */
|
|
6
|
+
path: string;
|
|
7
|
+
/** Include hidden files (default: false). */
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
/** Respect .gitignore (default: true). */
|
|
10
|
+
gitignore?: boolean;
|
|
11
|
+
/** Maximum number of matches to return (default: 100). */
|
|
12
|
+
maxResults?: number;
|
|
13
|
+
}
|
|
14
|
+
/** A single match in fuzzy find results. */
|
|
15
|
+
export interface FuzzyFindMatch {
|
|
16
|
+
/** Relative path from the search root (uses `/` separators). Directories have a trailing `/`. */
|
|
17
|
+
path: string;
|
|
18
|
+
/** Whether this entry is a directory. */
|
|
19
|
+
isDirectory: boolean;
|
|
20
|
+
/** Match quality score (higher is better). */
|
|
21
|
+
score: number;
|
|
22
|
+
}
|
|
23
|
+
/** Result of fuzzy file path search. */
|
|
24
|
+
export interface FuzzyFindResult {
|
|
25
|
+
/** Matched entries (up to `maxResults`), sorted by score descending. */
|
|
26
|
+
matches: FuzzyFindMatch[];
|
|
27
|
+
/** Total number of matches found (may exceed `matches.length`). */
|
|
28
|
+
totalMatches: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,16 +4,8 @@
|
|
|
4
4
|
* Gitignore-respecting filesystem discovery backed by Rust's `ignore` and
|
|
5
5
|
* `globset` crates, with an optional TTL-based scan cache for repeated queries.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import { native } from "../native.js";
|
|
9
|
-
import type {
|
|
10
|
-
GlobMatch,
|
|
11
|
-
GlobOptions,
|
|
12
|
-
GlobResult,
|
|
13
|
-
} from "./types.js";
|
|
14
|
-
|
|
7
|
+
import type { GlobMatch, GlobOptions, GlobResult } from "./types.js";
|
|
15
8
|
export type { FileType, GlobMatch, GlobOptions, GlobResult } from "./types.js";
|
|
16
|
-
|
|
17
9
|
/**
|
|
18
10
|
* Find filesystem entries matching a glob pattern.
|
|
19
11
|
*
|
|
@@ -24,13 +16,7 @@ export type { FileType, GlobMatch, GlobOptions, GlobResult } from "./types.js";
|
|
|
24
16
|
* @param onMatch - Optional streaming callback invoked for each match.
|
|
25
17
|
* @returns Promise resolving to matched entries.
|
|
26
18
|
*/
|
|
27
|
-
export function glob(
|
|
28
|
-
options: GlobOptions,
|
|
29
|
-
onMatch?: (match: GlobMatch) => void,
|
|
30
|
-
): Promise<GlobResult> {
|
|
31
|
-
return native.glob(options, onMatch as ((match: unknown) => void) | undefined) as Promise<GlobResult>;
|
|
32
|
-
}
|
|
33
|
-
|
|
19
|
+
export declare function glob(options: GlobOptions, onMatch?: (match: GlobMatch) => void): Promise<GlobResult>;
|
|
34
20
|
/**
|
|
35
21
|
* Invalidate the filesystem scan cache.
|
|
36
22
|
*
|
|
@@ -39,6 +25,4 @@ export function glob(
|
|
|
39
25
|
*
|
|
40
26
|
* @param path - Specific path to invalidate, or omit to clear all.
|
|
41
27
|
*/
|
|
42
|
-
export function invalidateFsScanCache(path?: string): void
|
|
43
|
-
native.invalidateFsScanCache(path);
|
|
44
|
-
}
|
|
28
|
+
export declare function invalidateFsScanCache(path?: string): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native glob module using N-API.
|
|
3
|
+
*
|
|
4
|
+
* Gitignore-respecting filesystem discovery backed by Rust's `ignore` and
|
|
5
|
+
* `globset` crates, with an optional TTL-based scan cache for repeated queries.
|
|
6
|
+
*/
|
|
7
|
+
import { native } from "../native.js";
|
|
8
|
+
/**
|
|
9
|
+
* Find filesystem entries matching a glob pattern.
|
|
10
|
+
*
|
|
11
|
+
* Respects .gitignore by default. Skips `.git` and `node_modules` unless
|
|
12
|
+
* the pattern explicitly mentions them.
|
|
13
|
+
*
|
|
14
|
+
* @param options - Glob search options (pattern, path, filters, etc.)
|
|
15
|
+
* @param onMatch - Optional streaming callback invoked for each match.
|
|
16
|
+
* @returns Promise resolving to matched entries.
|
|
17
|
+
*/
|
|
18
|
+
export function glob(options, onMatch) {
|
|
19
|
+
return native.glob(options, onMatch);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Invalidate the filesystem scan cache.
|
|
23
|
+
*
|
|
24
|
+
* Call after file mutations (write, edit, rename, delete) to ensure
|
|
25
|
+
* subsequent glob queries see fresh data.
|
|
26
|
+
*
|
|
27
|
+
* @param path - Specific path to invalidate, or omit to clear all.
|
|
28
|
+
*/
|
|
29
|
+
export function invalidateFsScanCache(path) {
|
|
30
|
+
native.invalidateFsScanCache(path);
|
|
31
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** File type classification for filesystem entries. */
|
|
2
|
+
export declare const enum FileType {
|
|
3
|
+
/** Regular file. */
|
|
4
|
+
File = 1,
|
|
5
|
+
/** Directory. */
|
|
6
|
+
Dir = 2,
|
|
7
|
+
/** Symbolic link. */
|
|
8
|
+
Symlink = 3
|
|
9
|
+
}
|
|
10
|
+
/** A single filesystem entry matched by a glob operation. */
|
|
11
|
+
export interface GlobMatch {
|
|
12
|
+
/** Relative path from the search root, using forward slashes. */
|
|
13
|
+
path: string;
|
|
14
|
+
/** Resolved filesystem type for the match. */
|
|
15
|
+
fileType: FileType;
|
|
16
|
+
/** Modification time in milliseconds since Unix epoch. */
|
|
17
|
+
mtime: number | null;
|
|
18
|
+
}
|
|
19
|
+
/** Options for the glob operation. */
|
|
20
|
+
export interface GlobOptions {
|
|
21
|
+
/** Glob pattern to match (e.g., "*.ts"). */
|
|
22
|
+
pattern: string;
|
|
23
|
+
/** Directory to search. */
|
|
24
|
+
path: string;
|
|
25
|
+
/** Filter by file type: File (1), Dir (2), or Symlink (3). */
|
|
26
|
+
fileType?: FileType;
|
|
27
|
+
/** Match simple patterns recursively by default (default: true). */
|
|
28
|
+
recursive?: boolean;
|
|
29
|
+
/** Include hidden files (default: false). */
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
/** Maximum number of results to return. */
|
|
32
|
+
maxResults?: number;
|
|
33
|
+
/** Respect .gitignore files (default: true). */
|
|
34
|
+
gitignore?: boolean;
|
|
35
|
+
/** Enable shared filesystem scan cache (default: false). */
|
|
36
|
+
cache?: boolean;
|
|
37
|
+
/** Sort results by mtime (most recent first) before applying limit. */
|
|
38
|
+
sortByMtime?: boolean;
|
|
39
|
+
/** Include node_modules entries (default: false, unless pattern mentions it). */
|
|
40
|
+
includeNodeModules?: boolean;
|
|
41
|
+
/** Timeout in milliseconds for the operation. */
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
/** Result payload returned by a glob operation. */
|
|
45
|
+
export interface GlobResult {
|
|
46
|
+
/** Matched filesystem entries. */
|
|
47
|
+
matches: GlobMatch[];
|
|
48
|
+
/** Number of returned matches. */
|
|
49
|
+
totalMatches: number;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native ripgrep wrapper using N-API.
|
|
3
|
+
*
|
|
4
|
+
* High-performance regex search backed by Rust's grep-* crates
|
|
5
|
+
* (the same internals as ripgrep).
|
|
6
|
+
*/
|
|
7
|
+
import type { ContextLine, GrepMatch, GrepOptions, GrepResult, SearchMatch, SearchOptions, SearchResult } from "./types.js";
|
|
8
|
+
export type { ContextLine, GrepMatch, GrepOptions, GrepResult, SearchMatch, SearchOptions, SearchResult, };
|
|
9
|
+
/**
|
|
10
|
+
* Search in-memory content for a regex pattern.
|
|
11
|
+
*
|
|
12
|
+
* Accepts a Buffer/Uint8Array of UTF-8 encoded content.
|
|
13
|
+
*/
|
|
14
|
+
export declare function searchContent(content: Buffer | Uint8Array, options: SearchOptions): SearchResult;
|
|
15
|
+
/**
|
|
16
|
+
* Search files on disk for a regex pattern.
|
|
17
|
+
*
|
|
18
|
+
* Walks the directory tree respecting .gitignore and optional glob filters.
|
|
19
|
+
*/
|
|
20
|
+
export declare function grep(options: GrepOptions): GrepResult;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native ripgrep wrapper using N-API.
|
|
3
|
+
*
|
|
4
|
+
* High-performance regex search backed by Rust's grep-* crates
|
|
5
|
+
* (the same internals as ripgrep).
|
|
6
|
+
*/
|
|
7
|
+
import { native } from "../native.js";
|
|
8
|
+
/**
|
|
9
|
+
* Search in-memory content for a regex pattern.
|
|
10
|
+
*
|
|
11
|
+
* Accepts a Buffer/Uint8Array of UTF-8 encoded content.
|
|
12
|
+
*/
|
|
13
|
+
export function searchContent(content, options) {
|
|
14
|
+
return native.search(content, options);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Search files on disk for a regex pattern.
|
|
18
|
+
*
|
|
19
|
+
* Walks the directory tree respecting .gitignore and optional glob filters.
|
|
20
|
+
*/
|
|
21
|
+
export function grep(options) {
|
|
22
|
+
return native.grep(options);
|
|
23
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** A context line adjacent to a match. */
|
|
2
|
+
export interface ContextLine {
|
|
3
|
+
/** 1-indexed line number. */
|
|
4
|
+
lineNumber: number;
|
|
5
|
+
/** Line content (trailing newline stripped). */
|
|
6
|
+
line: string;
|
|
7
|
+
}
|
|
8
|
+
/** A single match from in-memory content search. */
|
|
9
|
+
export interface SearchMatch {
|
|
10
|
+
/** 1-indexed line number. */
|
|
11
|
+
lineNumber: number;
|
|
12
|
+
/** The matched line content. */
|
|
13
|
+
line: string;
|
|
14
|
+
/** Context lines before the match. */
|
|
15
|
+
contextBefore: ContextLine[];
|
|
16
|
+
/** Context lines after the match. */
|
|
17
|
+
contextAfter: ContextLine[];
|
|
18
|
+
/** Whether the line was truncated due to maxColumns. */
|
|
19
|
+
truncated: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Result of searching in-memory content. */
|
|
22
|
+
export interface SearchResult {
|
|
23
|
+
/** All matches found. */
|
|
24
|
+
matches: SearchMatch[];
|
|
25
|
+
/** Total number of matches (may exceed matches.length due to limit). */
|
|
26
|
+
matchCount: number;
|
|
27
|
+
/** Whether the limit was reached. */
|
|
28
|
+
limitReached: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Options for in-memory content search. */
|
|
31
|
+
export interface SearchOptions {
|
|
32
|
+
/** Regex pattern to search for. */
|
|
33
|
+
pattern: string;
|
|
34
|
+
/** Case-insensitive matching. */
|
|
35
|
+
ignoreCase?: boolean;
|
|
36
|
+
/** Enable multiline regex mode. */
|
|
37
|
+
multiline?: boolean;
|
|
38
|
+
/** Maximum number of matches to return. */
|
|
39
|
+
maxCount?: number;
|
|
40
|
+
/** Lines of context before matches. */
|
|
41
|
+
contextBefore?: number;
|
|
42
|
+
/** Lines of context after matches. */
|
|
43
|
+
contextAfter?: number;
|
|
44
|
+
/** Truncate lines longer than this (characters). */
|
|
45
|
+
maxColumns?: number;
|
|
46
|
+
}
|
|
47
|
+
/** A single match from filesystem search. */
|
|
48
|
+
export interface GrepMatch {
|
|
49
|
+
/** File path (relative for directory searches). */
|
|
50
|
+
path: string;
|
|
51
|
+
/** 1-indexed line number. */
|
|
52
|
+
lineNumber: number;
|
|
53
|
+
/** The matched line content. */
|
|
54
|
+
line: string;
|
|
55
|
+
/** Context lines before the match. */
|
|
56
|
+
contextBefore: ContextLine[];
|
|
57
|
+
/** Context lines after the match. */
|
|
58
|
+
contextAfter: ContextLine[];
|
|
59
|
+
/** Whether the line was truncated. */
|
|
60
|
+
truncated: boolean;
|
|
61
|
+
}
|
|
62
|
+
/** Result of a filesystem search. */
|
|
63
|
+
export interface GrepResult {
|
|
64
|
+
/** All matches found. */
|
|
65
|
+
matches: GrepMatch[];
|
|
66
|
+
/** Total matches across all files. */
|
|
67
|
+
totalMatches: number;
|
|
68
|
+
/** Number of files with at least one match. */
|
|
69
|
+
filesWithMatches: number;
|
|
70
|
+
/** Number of files searched. */
|
|
71
|
+
filesSearched: number;
|
|
72
|
+
/** Whether the limit stopped the search early. */
|
|
73
|
+
limitReached: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** Options for filesystem search. */
|
|
76
|
+
export interface GrepOptions {
|
|
77
|
+
/** Regex pattern to search for. */
|
|
78
|
+
pattern: string;
|
|
79
|
+
/** Directory or file to search. */
|
|
80
|
+
path: string;
|
|
81
|
+
/** Glob filter for filenames (e.g. "*.ts"). */
|
|
82
|
+
glob?: string;
|
|
83
|
+
/** Case-insensitive matching. */
|
|
84
|
+
ignoreCase?: boolean;
|
|
85
|
+
/** Enable multiline regex mode. */
|
|
86
|
+
multiline?: boolean;
|
|
87
|
+
/** Include hidden files (default: false). */
|
|
88
|
+
hidden?: boolean;
|
|
89
|
+
/** Respect .gitignore files (default: true). */
|
|
90
|
+
gitignore?: boolean;
|
|
91
|
+
/** Maximum number of matches to return. */
|
|
92
|
+
maxCount?: number;
|
|
93
|
+
/** Lines of context before matches. */
|
|
94
|
+
contextBefore?: number;
|
|
95
|
+
/** Lines of context after matches. */
|
|
96
|
+
contextAfter?: number;
|
|
97
|
+
/** Truncate lines longer than this (characters). */
|
|
98
|
+
maxColumns?: number;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|