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.
Files changed (157) hide show
  1. package/node_modules/@gsd/native/dist/ast/index.d.ts +4 -0
  2. package/node_modules/@gsd/native/dist/ast/index.js +7 -0
  3. package/node_modules/@gsd/native/dist/ast/types.d.ts +69 -0
  4. package/node_modules/@gsd/native/dist/ast/types.js +1 -0
  5. package/node_modules/@gsd/native/{src/clipboard/index.ts → dist/clipboard/index.d.ts} +3 -15
  6. package/node_modules/@gsd/native/dist/clipboard/index.js +33 -0
  7. package/node_modules/@gsd/native/dist/clipboard/types.d.ts +7 -0
  8. package/node_modules/@gsd/native/dist/clipboard/types.js +1 -0
  9. package/node_modules/@gsd/native/dist/diff/index.d.ts +33 -0
  10. package/node_modules/@gsd/native/dist/diff/index.js +38 -0
  11. package/node_modules/@gsd/native/dist/diff/types.d.ts +23 -0
  12. package/node_modules/@gsd/native/dist/diff/types.js +1 -0
  13. package/node_modules/@gsd/native/{src/fd/index.ts → dist/fd/index.d.ts} +2 -12
  14. package/node_modules/@gsd/native/dist/fd/index.js +26 -0
  15. package/node_modules/@gsd/native/dist/fd/types.d.ts +29 -0
  16. package/node_modules/@gsd/native/dist/fd/types.js +1 -0
  17. package/node_modules/@gsd/native/{src/glob/index.ts → dist/glob/index.d.ts} +3 -19
  18. package/node_modules/@gsd/native/dist/glob/index.js +31 -0
  19. package/node_modules/@gsd/native/dist/glob/types.d.ts +50 -0
  20. package/node_modules/@gsd/native/dist/glob/types.js +1 -0
  21. package/node_modules/@gsd/native/dist/grep/index.d.ts +20 -0
  22. package/node_modules/@gsd/native/dist/grep/index.js +23 -0
  23. package/node_modules/@gsd/native/dist/grep/types.d.ts +99 -0
  24. package/node_modules/@gsd/native/dist/grep/types.js +1 -0
  25. package/node_modules/@gsd/native/dist/gsd-parser/index.d.ts +45 -0
  26. package/node_modules/@gsd/native/dist/gsd-parser/index.js +54 -0
  27. package/node_modules/@gsd/native/dist/gsd-parser/types.d.ts +55 -0
  28. package/node_modules/@gsd/native/dist/gsd-parser/types.js +7 -0
  29. package/node_modules/@gsd/native/{src/highlight/index.ts → dist/highlight/index.d.ts} +3 -19
  30. package/node_modules/@gsd/native/dist/highlight/index.js +33 -0
  31. package/node_modules/@gsd/native/dist/highlight/types.d.ts +25 -0
  32. package/node_modules/@gsd/native/dist/highlight/types.js +1 -0
  33. package/node_modules/@gsd/native/{src/html/index.ts → dist/html/index.d.ts} +1 -10
  34. package/node_modules/@gsd/native/dist/html/index.js +16 -0
  35. package/node_modules/@gsd/native/dist/html/types.d.ts +7 -0
  36. package/node_modules/@gsd/native/dist/html/types.js +1 -0
  37. package/node_modules/@gsd/native/{src/image/index.ts → dist/image/index.d.ts} +1 -14
  38. package/node_modules/@gsd/native/dist/image/index.js +18 -0
  39. package/node_modules/@gsd/native/dist/image/types.d.ts +35 -0
  40. package/node_modules/@gsd/native/dist/image/types.js +26 -0
  41. package/node_modules/@gsd/native/{src/index.ts → dist/index.d.ts} +12 -60
  42. package/node_modules/@gsd/native/dist/index.js +28 -0
  43. package/node_modules/@gsd/native/dist/native.d.ts +44 -0
  44. package/node_modules/@gsd/native/dist/native.js +34 -0
  45. package/node_modules/@gsd/native/dist/ps/index.d.ts +38 -0
  46. package/node_modules/@gsd/native/{src/ps/index.ts → dist/ps/index.js} +8 -13
  47. package/node_modules/@gsd/native/{src/ps/types.ts → dist/ps/types.d.ts} +2 -2
  48. package/node_modules/@gsd/native/dist/ps/types.js +1 -0
  49. package/node_modules/@gsd/native/{src/text/index.ts → dist/text/index.d.ts} +6 -76
  50. package/node_modules/@gsd/native/dist/text/index.js +66 -0
  51. package/node_modules/@gsd/native/dist/text/types.d.ts +27 -0
  52. package/node_modules/@gsd/native/dist/text/types.js +10 -0
  53. package/node_modules/@gsd/native/{src/ttsr/index.ts → dist/ttsr/index.d.ts} +3 -15
  54. package/node_modules/@gsd/native/dist/ttsr/index.js +32 -0
  55. package/node_modules/@gsd/native/{src/ttsr/types.ts → dist/ttsr/types.d.ts} +4 -5
  56. package/node_modules/@gsd/native/dist/ttsr/types.js +1 -0
  57. package/node_modules/@gsd/native/package.json +24 -23
  58. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
  59. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  60. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
  61. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  62. package/node_modules/@gsd/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
  63. package/package.json +4 -2
  64. package/packages/native/dist/ast/index.d.ts +4 -0
  65. package/packages/native/dist/ast/index.js +7 -0
  66. package/packages/native/dist/ast/types.d.ts +69 -0
  67. package/packages/native/dist/ast/types.js +1 -0
  68. package/packages/native/dist/clipboard/index.d.ts +28 -0
  69. package/packages/native/dist/clipboard/index.js +33 -0
  70. package/packages/native/dist/clipboard/types.d.ts +7 -0
  71. package/packages/native/dist/clipboard/types.js +1 -0
  72. package/packages/native/dist/diff/index.d.ts +33 -0
  73. package/packages/native/dist/diff/index.js +38 -0
  74. package/packages/native/dist/diff/types.d.ts +23 -0
  75. package/packages/native/dist/diff/types.js +1 -0
  76. package/packages/native/dist/fd/index.d.ts +25 -0
  77. package/packages/native/dist/fd/index.js +26 -0
  78. package/packages/native/dist/fd/types.d.ts +29 -0
  79. package/packages/native/dist/fd/types.js +1 -0
  80. package/packages/native/dist/glob/index.d.ts +28 -0
  81. package/packages/native/dist/glob/index.js +31 -0
  82. package/packages/native/dist/glob/types.d.ts +50 -0
  83. package/packages/native/dist/glob/types.js +1 -0
  84. package/packages/native/dist/grep/index.d.ts +20 -0
  85. package/packages/native/dist/grep/index.js +23 -0
  86. package/packages/native/dist/grep/types.d.ts +99 -0
  87. package/packages/native/dist/grep/types.js +1 -0
  88. package/packages/native/dist/gsd-parser/index.d.ts +45 -0
  89. package/packages/native/dist/gsd-parser/index.js +54 -0
  90. package/packages/native/dist/gsd-parser/types.d.ts +55 -0
  91. package/packages/native/dist/gsd-parser/types.js +7 -0
  92. package/packages/native/dist/highlight/index.d.ts +28 -0
  93. package/packages/native/dist/highlight/index.js +33 -0
  94. package/packages/native/dist/highlight/types.d.ts +25 -0
  95. package/packages/native/dist/highlight/types.js +1 -0
  96. package/packages/native/dist/html/index.d.ts +15 -0
  97. package/packages/native/dist/html/index.js +16 -0
  98. package/packages/native/dist/html/types.d.ts +7 -0
  99. package/packages/native/dist/html/types.js +1 -0
  100. package/packages/native/dist/image/index.d.ts +15 -0
  101. package/packages/native/dist/image/index.js +18 -0
  102. package/packages/native/dist/image/types.d.ts +35 -0
  103. package/packages/native/dist/image/types.js +26 -0
  104. package/packages/native/dist/index.d.ts +40 -0
  105. package/packages/native/dist/index.js +28 -0
  106. package/packages/native/dist/native.d.ts +44 -0
  107. package/packages/native/dist/native.js +34 -0
  108. package/packages/native/dist/ps/index.d.ts +38 -0
  109. package/packages/native/dist/ps/index.js +47 -0
  110. package/packages/native/dist/ps/types.d.ts +5 -0
  111. package/packages/native/dist/ps/types.js +1 -0
  112. package/packages/native/dist/text/index.d.ts +55 -0
  113. package/packages/native/dist/text/index.js +66 -0
  114. package/packages/native/dist/text/types.d.ts +27 -0
  115. package/packages/native/dist/text/types.js +10 -0
  116. package/packages/native/dist/ttsr/index.d.ts +27 -0
  117. package/packages/native/dist/ttsr/index.js +32 -0
  118. package/packages/native/dist/ttsr/types.d.ts +9 -0
  119. package/packages/native/dist/ttsr/types.js +1 -0
  120. package/packages/native/package.json +24 -23
  121. package/packages/native/src/__tests__/diff.test.mjs +189 -0
  122. package/packages/native/src/__tests__/ttsr.test.mjs +135 -0
  123. package/packages/native/src/diff/index.ts +61 -0
  124. package/packages/native/src/diff/types.ts +24 -0
  125. package/packages/native/src/gsd-parser/index.ts +98 -0
  126. package/packages/native/src/gsd-parser/types.ts +62 -0
  127. package/packages/native/src/index.ts +23 -0
  128. package/packages/native/src/native.ts +8 -0
  129. package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
  130. package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  131. package/packages/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
  132. package/packages/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  133. package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
  134. package/src/resources/extensions/gsd/files.ts +9 -0
  135. package/src/resources/extensions/gsd/native-parser-bridge.ts +135 -0
  136. package/src/resources/extensions/ttsr/ttsr-manager.ts +86 -0
  137. package/node_modules/@gsd/native/src/__tests__/clipboard.test.mjs +0 -79
  138. package/node_modules/@gsd/native/src/__tests__/fd.test.mjs +0 -164
  139. package/node_modules/@gsd/native/src/__tests__/glob.test.mjs +0 -237
  140. package/node_modules/@gsd/native/src/__tests__/grep.test.mjs +0 -162
  141. package/node_modules/@gsd/native/src/__tests__/highlight.test.mjs +0 -156
  142. package/node_modules/@gsd/native/src/__tests__/html.test.mjs +0 -98
  143. package/node_modules/@gsd/native/src/__tests__/image.test.mjs +0 -137
  144. package/node_modules/@gsd/native/src/__tests__/ps.test.mjs +0 -109
  145. package/node_modules/@gsd/native/src/__tests__/text.test.mjs +0 -262
  146. package/node_modules/@gsd/native/src/ast/index.ts +0 -12
  147. package/node_modules/@gsd/native/src/ast/types.ts +0 -75
  148. package/node_modules/@gsd/native/src/clipboard/types.ts +0 -7
  149. package/node_modules/@gsd/native/src/fd/types.ts +0 -31
  150. package/node_modules/@gsd/native/src/glob/types.ts +0 -53
  151. package/node_modules/@gsd/native/src/grep/index.ts +0 -48
  152. package/node_modules/@gsd/native/src/grep/types.ts +0 -105
  153. package/node_modules/@gsd/native/src/highlight/types.ts +0 -25
  154. package/node_modules/@gsd/native/src/html/types.ts +0 -7
  155. package/node_modules/@gsd/native/src/image/types.ts +0 -41
  156. package/node_modules/@gsd/native/src/native.ts +0 -94
  157. package/node_modules/@gsd/native/src/text/types.ts +0 -29
@@ -0,0 +1,45 @@
1
+ /**
2
+ * GSD file parser — native Rust implementation.
3
+ *
4
+ * Parses `.gsd/` directory markdown files containing YAML-like frontmatter
5
+ * and structured sections. Replaces the JS regex-based parser for
6
+ * performance-critical batch operations.
7
+ */
8
+ import type { BatchParseResult, FrontmatterResult, NativeRoadmap, SectionResult } from "./types.js";
9
+ export type { BatchParseResult, FrontmatterResult, NativeBoundaryMapEntry, NativeRoadmap, NativeRoadmapSlice, ParsedGsdFile, SectionResult, } from "./types.js";
10
+ /**
11
+ * Parse YAML-like frontmatter from markdown content.
12
+ *
13
+ * Returns `{ metadata, body }` where `metadata` is a JSON string
14
+ * of the parsed frontmatter key-value pairs. Parse it with `JSON.parse()`.
15
+ */
16
+ export declare function parseFrontmatter(content: string): FrontmatterResult;
17
+ /**
18
+ * Extract a section from markdown content by heading name.
19
+ *
20
+ * @param content Markdown content to search.
21
+ * @param heading Heading text to match (without the `#` prefix).
22
+ * @param level Heading level (default 2 for `##`).
23
+ */
24
+ export declare function extractSection(content: string, heading: string, level?: number): SectionResult;
25
+ /**
26
+ * Extract all sections at a given heading level.
27
+ *
28
+ * Returns a JSON string mapping heading names to their content.
29
+ * Parse with `JSON.parse()`.
30
+ */
31
+ export declare function extractAllSections(content: string, level?: number): string;
32
+ /**
33
+ * Batch-parse all `.md` files in a `.gsd/` directory tree.
34
+ *
35
+ * Reads and parses all markdown files under the given directory.
36
+ * Each file gets frontmatter parsing and section extraction.
37
+ */
38
+ export declare function batchParseGsdFiles(directory: string): BatchParseResult;
39
+ /**
40
+ * Parse a roadmap file's content into structured data.
41
+ *
42
+ * Extracts title, vision, success criteria, slices (with risk/depends),
43
+ * and boundary map entries.
44
+ */
45
+ export declare function parseRoadmapFile(content: string): NativeRoadmap;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * GSD file parser — native Rust implementation.
3
+ *
4
+ * Parses `.gsd/` directory markdown files containing YAML-like frontmatter
5
+ * and structured sections. Replaces the JS regex-based parser for
6
+ * performance-critical batch operations.
7
+ */
8
+ import { native } from "../native.js";
9
+ /**
10
+ * Parse YAML-like frontmatter from markdown content.
11
+ *
12
+ * Returns `{ metadata, body }` where `metadata` is a JSON string
13
+ * of the parsed frontmatter key-value pairs. Parse it with `JSON.parse()`.
14
+ */
15
+ export function parseFrontmatter(content) {
16
+ return native.parseFrontmatter(content);
17
+ }
18
+ /**
19
+ * Extract a section from markdown content by heading name.
20
+ *
21
+ * @param content Markdown content to search.
22
+ * @param heading Heading text to match (without the `#` prefix).
23
+ * @param level Heading level (default 2 for `##`).
24
+ */
25
+ export function extractSection(content, heading, level) {
26
+ return native.extractSection(content, heading, level);
27
+ }
28
+ /**
29
+ * Extract all sections at a given heading level.
30
+ *
31
+ * Returns a JSON string mapping heading names to their content.
32
+ * Parse with `JSON.parse()`.
33
+ */
34
+ export function extractAllSections(content, level) {
35
+ return native.extractAllSections(content, level);
36
+ }
37
+ /**
38
+ * Batch-parse all `.md` files in a `.gsd/` directory tree.
39
+ *
40
+ * Reads and parses all markdown files under the given directory.
41
+ * Each file gets frontmatter parsing and section extraction.
42
+ */
43
+ export function batchParseGsdFiles(directory) {
44
+ return native.batchParseGsdFiles(directory);
45
+ }
46
+ /**
47
+ * Parse a roadmap file's content into structured data.
48
+ *
49
+ * Extracts title, vision, success criteria, slices (with risk/depends),
50
+ * and boundary map entries.
51
+ */
52
+ export function parseRoadmapFile(content) {
53
+ return native.parseRoadmapFile(content);
54
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * GSD file parser type definitions.
3
+ *
4
+ * Types for the native Rust parser that handles `.gsd/` directory files
5
+ * containing YAML-like frontmatter and markdown sections.
6
+ */
7
+ export interface FrontmatterResult {
8
+ /** Parsed frontmatter as a JSON string of key-value pairs. */
9
+ metadata: string;
10
+ /** Body content after the frontmatter block. */
11
+ body: string;
12
+ }
13
+ export interface SectionResult {
14
+ /** The section content, or empty string if not found. */
15
+ content: string;
16
+ /** Whether the section was found. */
17
+ found: boolean;
18
+ }
19
+ export interface ParsedGsdFile {
20
+ /** Relative path from the base directory. */
21
+ path: string;
22
+ /** Parsed frontmatter as JSON string. */
23
+ metadata: string;
24
+ /** Body content after frontmatter. */
25
+ body: string;
26
+ /** Map of section heading to content, serialized as JSON. */
27
+ sections: string;
28
+ }
29
+ export interface BatchParseResult {
30
+ /** All parsed files. */
31
+ files: ParsedGsdFile[];
32
+ /** Number of files processed. */
33
+ count: number;
34
+ }
35
+ export interface NativeRoadmapSlice {
36
+ id: string;
37
+ title: string;
38
+ risk: string;
39
+ depends: string[];
40
+ done: boolean;
41
+ demo: string;
42
+ }
43
+ export interface NativeBoundaryMapEntry {
44
+ fromSlice: string;
45
+ toSlice: string;
46
+ produces: string;
47
+ consumes: string;
48
+ }
49
+ export interface NativeRoadmap {
50
+ title: string;
51
+ vision: string;
52
+ successCriteria: string[];
53
+ slices: NativeRoadmapSlice[];
54
+ boundaryMap: NativeBoundaryMapEntry[];
55
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * GSD file parser type definitions.
3
+ *
4
+ * Types for the native Rust parser that handles `.gsd/` directory files
5
+ * containing YAML-like frontmatter and markdown sections.
6
+ */
7
+ export {};
@@ -4,12 +4,8 @@
4
4
  * Provides ANSI-colored output for code blocks using semantic scope matching
5
5
  * across 11 token categories.
6
6
  */
7
-
8
- import { native } from "../native.js";
9
7
  import type { HighlightColors } from "./types.js";
10
-
11
8
  export type { HighlightColors };
12
-
13
9
  /**
14
10
  * Highlight source code and return ANSI-colored output.
15
11
  *
@@ -18,27 +14,15 @@ export type { HighlightColors };
18
14
  * @param colors - Theme colors as ANSI escape sequences
19
15
  * @returns Highlighted code with ANSI color codes
20
16
  */
21
- export function highlightCode(
22
- code: string,
23
- lang: string | null,
24
- colors: HighlightColors,
25
- ): string {
26
- return native.highlightCode(code, lang, colors) as string;
27
- }
28
-
17
+ export declare function highlightCode(code: string, lang: string | null, colors: HighlightColors): string;
29
18
  /**
30
19
  * Check if a language is supported for highlighting.
31
20
  *
32
21
  * Returns true if the language has either direct syntect support or a
33
22
  * fallback alias mapping.
34
23
  */
35
- export function supportsLanguage(lang: string): boolean {
36
- return native.supportsLanguage(lang) as boolean;
37
- }
38
-
24
+ export declare function supportsLanguage(lang: string): boolean;
39
25
  /**
40
26
  * Get list of all supported language names from syntect's default syntax set.
41
27
  */
42
- export function getSupportedLanguages(): string[] {
43
- return native.getSupportedLanguages() as string[];
44
- }
28
+ export declare function getSupportedLanguages(): string[];
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Syntect-based syntax highlighting via N-API.
3
+ *
4
+ * Provides ANSI-colored output for code blocks using semantic scope matching
5
+ * across 11 token categories.
6
+ */
7
+ import { native } from "../native.js";
8
+ /**
9
+ * Highlight source code and return ANSI-colored output.
10
+ *
11
+ * @param code - The source code to highlight
12
+ * @param lang - Language identifier (e.g., "rust", "typescript", "python"), or null for plain text
13
+ * @param colors - Theme colors as ANSI escape sequences
14
+ * @returns Highlighted code with ANSI color codes
15
+ */
16
+ export function highlightCode(code, lang, colors) {
17
+ return native.highlightCode(code, lang, colors);
18
+ }
19
+ /**
20
+ * Check if a language is supported for highlighting.
21
+ *
22
+ * Returns true if the language has either direct syntect support or a
23
+ * fallback alias mapping.
24
+ */
25
+ export function supportsLanguage(lang) {
26
+ return native.supportsLanguage(lang);
27
+ }
28
+ /**
29
+ * Get list of all supported language names from syntect's default syntax set.
30
+ */
31
+ export function getSupportedLanguages() {
32
+ return native.getSupportedLanguages();
33
+ }
@@ -0,0 +1,25 @@
1
+ /** Theme colors for syntax highlighting as ANSI escape sequences. */
2
+ export interface HighlightColors {
3
+ /** ANSI color for comments. */
4
+ comment: string;
5
+ /** ANSI color for keywords. */
6
+ keyword: string;
7
+ /** ANSI color for function names. */
8
+ function: string;
9
+ /** ANSI color for variables and identifiers. */
10
+ variable: string;
11
+ /** ANSI color for string literals. */
12
+ string: string;
13
+ /** ANSI color for numeric literals. */
14
+ number: string;
15
+ /** ANSI color for type identifiers. */
16
+ type: string;
17
+ /** ANSI color for operators. */
18
+ operator: string;
19
+ /** ANSI color for punctuation tokens. */
20
+ punctuation: string;
21
+ /** ANSI color for diff inserted lines. */
22
+ inserted?: string;
23
+ /** ANSI color for diff deleted lines. */
24
+ deleted?: string;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,21 +4,12 @@
4
4
  * Uses `html-to-markdown-rs` under the hood for high-performance
5
5
  * conversion with optional content cleaning (stripping nav, forms, etc.).
6
6
  */
7
-
8
- import { native } from "../native.js";
9
7
  import type { HtmlToMarkdownOptions } from "./types.js";
10
-
11
8
  export type { HtmlToMarkdownOptions };
12
-
13
9
  /**
14
10
  * Convert an HTML string to Markdown.
15
11
  *
16
12
  * When `cleanContent` is true, boilerplate elements (nav, forms, headers,
17
13
  * footers) are stripped before conversion.
18
14
  */
19
- export function htmlToMarkdown(
20
- html: string,
21
- options?: HtmlToMarkdownOptions,
22
- ): string {
23
- return native.htmlToMarkdown(html, options ?? {}) as string;
24
- }
15
+ export declare function htmlToMarkdown(html: string, options?: HtmlToMarkdownOptions): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * HTML to Markdown conversion via native Rust bindings.
3
+ *
4
+ * Uses `html-to-markdown-rs` under the hood for high-performance
5
+ * conversion with optional content cleaning (stripping nav, forms, etc.).
6
+ */
7
+ import { native } from "../native.js";
8
+ /**
9
+ * Convert an HTML string to Markdown.
10
+ *
11
+ * When `cleanContent` is true, boilerplate elements (nav, forms, headers,
12
+ * footers) are stripped before conversion.
13
+ */
14
+ export function htmlToMarkdown(html, options) {
15
+ return native.htmlToMarkdown(html, options ?? {});
16
+ }
@@ -0,0 +1,7 @@
1
+ /** Options for HTML to Markdown conversion. */
2
+ export interface HtmlToMarkdownOptions {
3
+ /** Remove navigation elements, forms, headers, footers. */
4
+ cleanContent?: boolean;
5
+ /** Skip images during conversion. */
6
+ skipImages?: boolean;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3,26 +3,13 @@
3
3
  *
4
4
  * High-performance image decode/encode/resize backed by the Rust `image` crate.
5
5
  */
6
-
7
- import { native } from "../native.js";
8
6
  import type { NativeImageHandle } from "./types.js";
9
7
  import { ImageFormat, SamplingFilter } from "./types.js";
10
-
11
8
  export { ImageFormat, SamplingFilter };
12
9
  export type { NativeImageHandle };
13
-
14
- const NativeImageClass = (native as Record<string, unknown>)
15
- .NativeImage as NativeImageConstructor;
16
-
17
- interface NativeImageConstructor {
18
- parse(bytes: Uint8Array): Promise<NativeImageHandle>;
19
- }
20
-
21
10
  /**
22
11
  * Decode image bytes (PNG, JPEG, WebP, GIF) into a NativeImage handle.
23
12
  *
24
13
  * Format is auto-detected from the byte content.
25
14
  */
26
- export function parseImage(bytes: Uint8Array): Promise<NativeImageHandle> {
27
- return NativeImageClass.parse(bytes);
28
- }
15
+ export declare function parseImage(bytes: Uint8Array): Promise<NativeImageHandle>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Native image processing module using N-API.
3
+ *
4
+ * High-performance image decode/encode/resize backed by the Rust `image` crate.
5
+ */
6
+ import { native } from "../native.js";
7
+ import { ImageFormat, SamplingFilter } from "./types.js";
8
+ export { ImageFormat, SamplingFilter };
9
+ const NativeImageClass = native
10
+ .NativeImage;
11
+ /**
12
+ * Decode image bytes (PNG, JPEG, WebP, GIF) into a NativeImage handle.
13
+ *
14
+ * Format is auto-detected from the byte content.
15
+ */
16
+ export function parseImage(bytes) {
17
+ return NativeImageClass.parse(bytes);
18
+ }
@@ -0,0 +1,35 @@
1
+ /** Sampling filter for resize operations. */
2
+ export declare enum SamplingFilter {
3
+ /** Nearest-neighbor sampling (fast, low quality). */
4
+ Nearest = 1,
5
+ /** Triangle filter (linear interpolation). */
6
+ Triangle = 2,
7
+ /** Catmull-Rom filter with sharper edges. */
8
+ CatmullRom = 3,
9
+ /** Gaussian filter for smoother results. */
10
+ Gaussian = 4,
11
+ /** Lanczos3 filter for high-quality downscaling. */
12
+ Lanczos3 = 5
13
+ }
14
+ /** Output image format for encoding. */
15
+ export declare enum ImageFormat {
16
+ /** PNG (lossless, quality ignored). */
17
+ PNG = 0,
18
+ /** JPEG (lossy, quality 0-100). */
19
+ JPEG = 1,
20
+ /** WebP (lossless, quality ignored). */
21
+ WebP = 2,
22
+ /** GIF (quality ignored). */
23
+ GIF = 3
24
+ }
25
+ /** Native image handle returned from parse(). */
26
+ export interface NativeImageHandle {
27
+ /** Image width in pixels. */
28
+ readonly width: number;
29
+ /** Image height in pixels. */
30
+ readonly height: number;
31
+ /** Encode to bytes in the specified format. Returns a Promise. */
32
+ encode(format: number, quality: number): Promise<number[]>;
33
+ /** Resize to the specified dimensions. Returns a new NativeImage Promise. */
34
+ resize(width: number, height: number, filter: SamplingFilter): Promise<NativeImageHandle>;
35
+ }
@@ -0,0 +1,26 @@
1
+ /** Sampling filter for resize operations. */
2
+ export var SamplingFilter;
3
+ (function (SamplingFilter) {
4
+ /** Nearest-neighbor sampling (fast, low quality). */
5
+ SamplingFilter[SamplingFilter["Nearest"] = 1] = "Nearest";
6
+ /** Triangle filter (linear interpolation). */
7
+ SamplingFilter[SamplingFilter["Triangle"] = 2] = "Triangle";
8
+ /** Catmull-Rom filter with sharper edges. */
9
+ SamplingFilter[SamplingFilter["CatmullRom"] = 3] = "CatmullRom";
10
+ /** Gaussian filter for smoother results. */
11
+ SamplingFilter[SamplingFilter["Gaussian"] = 4] = "Gaussian";
12
+ /** Lanczos3 filter for high-quality downscaling. */
13
+ SamplingFilter[SamplingFilter["Lanczos3"] = 5] = "Lanczos3";
14
+ })(SamplingFilter || (SamplingFilter = {}));
15
+ /** Output image format for encoding. */
16
+ export var ImageFormat;
17
+ (function (ImageFormat) {
18
+ /** PNG (lossless, quality ignored). */
19
+ ImageFormat[ImageFormat["PNG"] = 0] = "PNG";
20
+ /** JPEG (lossy, quality 0-100). */
21
+ ImageFormat[ImageFormat["JPEG"] = 1] = "JPEG";
22
+ /** WebP (lossless, quality ignored). */
23
+ ImageFormat[ImageFormat["WebP"] = 2] = "WebP";
24
+ /** GIF (quality ignored). */
25
+ ImageFormat[ImageFormat["GIF"] = 3] = "GIF";
26
+ })(ImageFormat || (ImageFormat = {}));
@@ -13,76 +13,28 @@
13
13
  * - image: decode, encode, and resize images
14
14
  for autocomplete and @-mention resolution
15
15
  */
16
-
17
- export {
18
- copyToClipboard,
19
- readTextFromClipboard,
20
- readImageFromClipboard,
21
- } from "./clipboard/index.js";
16
+ export { copyToClipboard, readTextFromClipboard, readImageFromClipboard, } from "./clipboard/index.js";
22
17
  export type { ClipboardImage } from "./clipboard/index.js";
23
-
24
- export {
25
- highlightCode,
26
- supportsLanguage,
27
- getSupportedLanguages,
28
- } from "./highlight/index.js";
18
+ export { highlightCode, supportsLanguage, getSupportedLanguages, } from "./highlight/index.js";
29
19
  export type { HighlightColors } from "./highlight/index.js";
30
-
31
20
  export { searchContent, grep } from "./grep/index.js";
32
- export type {
33
- ContextLine,
34
- GrepMatch,
35
- GrepOptions,
36
- GrepResult,
37
- SearchMatch,
38
- SearchOptions,
39
- SearchResult,
40
- } from "./grep/index.js";
41
-
42
- export {
43
- killTree,
44
- listDescendants,
45
- processGroupId,
46
- killProcessGroup,
47
- } from "./ps/index.js";
48
-
21
+ export type { ContextLine, GrepMatch, GrepOptions, GrepResult, SearchMatch, SearchOptions, SearchResult, } from "./grep/index.js";
22
+ export { killTree, listDescendants, processGroupId, killProcessGroup, } from "./ps/index.js";
49
23
  export { glob, invalidateFsScanCache } from "./glob/index.js";
50
- export type {
51
- FileType,
52
- GlobMatch,
53
- GlobOptions,
54
- GlobResult,
55
- } from "./glob/index.js";
56
-
24
+ export type { FileType, GlobMatch, GlobOptions, GlobResult, } from "./glob/index.js";
57
25
  export { astGrep, astEdit } from "./ast/index.js";
58
- export type {
59
- AstFindMatch, AstFindOptions, AstFindResult,
60
- AstReplaceChange, AstReplaceFileChange, AstReplaceOptions, AstReplaceResult,
61
- } from "./ast/index.js";
62
-
26
+ export type { AstFindMatch, AstFindOptions, AstFindResult, AstReplaceChange, AstReplaceFileChange, AstReplaceOptions, AstReplaceResult, } from "./ast/index.js";
63
27
  export { htmlToMarkdown } from "./html/index.js";
64
28
  export type { HtmlToMarkdownOptions } from "./html/index.js";
65
-
66
- export {
67
- wrapTextWithAnsi,
68
- truncateToWidth,
69
- sliceWithWidth,
70
- extractSegments,
71
- sanitizeText,
72
- visibleWidth,
73
- EllipsisKind,
74
- } from "./text/index.js";
29
+ export { wrapTextWithAnsi, truncateToWidth, sliceWithWidth, extractSegments, sanitizeText, visibleWidth, EllipsisKind, } from "./text/index.js";
75
30
  export type { SliceResult, ExtractSegmentsResult } from "./text/index.js";
76
-
31
+ export { normalizeForFuzzyMatch, fuzzyFindText, generateDiff, } from "./diff/index.js";
32
+ export type { FuzzyMatchResult, DiffResult } from "./diff/index.js";
77
33
  export { fuzzyFind } from "./fd/index.js";
78
- export type {
79
- FuzzyFindMatch,
80
- FuzzyFindOptions,
81
- FuzzyFindResult,
82
- } from "./fd/index.js";
83
-
34
+ export type { FuzzyFindMatch, FuzzyFindOptions, FuzzyFindResult, } from "./fd/index.js";
84
35
  export { parseImage, ImageFormat, SamplingFilter } from "./image/index.js";
85
36
  export type { NativeImageHandle } from "./image/index.js";
86
-
87
37
  export { ttsrCompileRules, ttsrCheckBuffer, ttsrFreeRules } from "./ttsr/index.js";
88
38
  export type { TtsrHandle, TtsrRuleInput } from "./ttsr/index.js";
39
+ export { parseFrontmatter, extractSection as nativeExtractSection, extractAllSections, batchParseGsdFiles, parseRoadmapFile, } from "./gsd-parser/index.js";
40
+ export type { BatchParseResult, FrontmatterResult, NativeBoundaryMapEntry, NativeRoadmap, NativeRoadmapSlice, ParsedGsdFile, SectionResult, } from "./gsd-parser/index.js";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @gsd/native — High-performance Rust modules exposed via N-API.
3
+ *
4
+ * Modules:
5
+ * - clipboard: native clipboard access (text + image)
6
+ * - grep: ripgrep-backed regex search (content + filesystem)
7
+ * - ps: cross-platform process tree management
8
+ * - glob: gitignore-respecting filesystem discovery with scan caching
9
+ * - highlight: syntect-based syntax highlighting
10
+ * - html: HTML to Markdown conversion
11
+ * - text: ANSI-aware text measurement and slicing
12
+ * - fd: fuzzy file path discovery
13
+ * - image: decode, encode, and resize images
14
+ for autocomplete and @-mention resolution
15
+ */
16
+ export { copyToClipboard, readTextFromClipboard, readImageFromClipboard, } from "./clipboard/index.js";
17
+ export { highlightCode, supportsLanguage, getSupportedLanguages, } from "./highlight/index.js";
18
+ export { searchContent, grep } from "./grep/index.js";
19
+ export { killTree, listDescendants, processGroupId, killProcessGroup, } from "./ps/index.js";
20
+ export { glob, invalidateFsScanCache } from "./glob/index.js";
21
+ export { astGrep, astEdit } from "./ast/index.js";
22
+ export { htmlToMarkdown } from "./html/index.js";
23
+ export { wrapTextWithAnsi, truncateToWidth, sliceWithWidth, extractSegments, sanitizeText, visibleWidth, EllipsisKind, } from "./text/index.js";
24
+ export { normalizeForFuzzyMatch, fuzzyFindText, generateDiff, } from "./diff/index.js";
25
+ export { fuzzyFind } from "./fd/index.js";
26
+ export { parseImage, ImageFormat, SamplingFilter } from "./image/index.js";
27
+ export { ttsrCompileRules, ttsrCheckBuffer, ttsrFreeRules } from "./ttsr/index.js";
28
+ export { parseFrontmatter, extractSection as nativeExtractSection, extractAllSections, batchParseGsdFiles, parseRoadmapFile, } from "./gsd-parser/index.js";
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Native addon loader.
3
+ *
4
+ * Locates and loads the compiled Rust N-API addon (`.node` file).
5
+ * Tries platform-tagged release builds first, then falls back to dev builds.
6
+ */
7
+ export declare const native: {
8
+ search: (content: Buffer | Uint8Array, options: unknown) => unknown;
9
+ grep: (options: unknown) => unknown;
10
+ killTree: (pid: number, signal: number) => number;
11
+ listDescendants: (pid: number) => number[];
12
+ processGroupId: (pid: number) => number | null;
13
+ killProcessGroup: (pgid: number, signal: number) => boolean;
14
+ glob: (options: unknown, onMatch?: ((match: unknown) => void) | undefined | null) => Promise<unknown>;
15
+ invalidateFsScanCache: (path?: string) => void;
16
+ highlightCode: (code: string, lang: string | null, colors: unknown) => unknown;
17
+ supportsLanguage: (lang: string) => unknown;
18
+ getSupportedLanguages: () => unknown;
19
+ copyToClipboard: (text: string) => void;
20
+ readTextFromClipboard: () => string | null;
21
+ readImageFromClipboard: () => Promise<unknown>;
22
+ astGrep: (options: unknown) => unknown;
23
+ astEdit: (options: unknown) => unknown;
24
+ htmlToMarkdown: (html: string, options: unknown) => unknown;
25
+ wrapTextWithAnsi: (text: string, width: number, tabWidth?: number) => string[];
26
+ truncateToWidth: (text: string, maxWidth: number, ellipsisKind: number, pad: boolean, tabWidth?: number) => string;
27
+ sliceWithWidth: (line: string, startCol: number, length: number, strict: boolean, tabWidth?: number) => unknown;
28
+ extractSegments: (line: string, beforeEnd: number, afterStart: number, afterLen: number, strictAfter: boolean, tabWidth?: number) => unknown;
29
+ sanitizeText: (text: string) => string;
30
+ visibleWidth: (text: string, tabWidth?: number) => number;
31
+ fuzzyFind: (options: unknown) => unknown;
32
+ normalizeForFuzzyMatch: (text: string) => string;
33
+ fuzzyFindText: (content: string, oldText: string) => unknown;
34
+ generateDiff: (oldContent: string, newContent: string, contextLines?: number) => unknown;
35
+ NativeImage: unknown;
36
+ ttsrCompileRules: (rules: unknown[]) => number;
37
+ ttsrCheckBuffer: (handle: number, buffer: string) => string[];
38
+ ttsrFreeRules: (handle: number) => void;
39
+ parseFrontmatter: (content: string) => unknown;
40
+ extractSection: (content: string, heading: string, level?: number) => unknown;
41
+ extractAllSections: (content: string, level?: number) => string;
42
+ batchParseGsdFiles: (directory: string) => unknown;
43
+ parseRoadmapFile: (content: string) => unknown;
44
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Native addon loader.
3
+ *
4
+ * Locates and loads the compiled Rust N-API addon (`.node` file).
5
+ * Tries platform-tagged release builds first, then falls back to dev builds.
6
+ */
7
+ import { createRequire } from "node:module";
8
+ import * as path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ const require = createRequire(import.meta.url);
12
+ const addonDir = path.resolve(__dirname, "..", "..", "..", "native", "addon");
13
+ const platformTag = `${process.platform}-${process.arch}`;
14
+ const candidates = [
15
+ path.join(addonDir, `gsd_engine.${platformTag}.node`),
16
+ path.join(addonDir, "gsd_engine.dev.node"),
17
+ ];
18
+ function loadNative() {
19
+ const errors = [];
20
+ for (const candidate of candidates) {
21
+ try {
22
+ return require(candidate);
23
+ }
24
+ catch (err) {
25
+ const message = err instanceof Error ? err.message : String(err);
26
+ errors.push(`${candidate}: ${message}`);
27
+ }
28
+ }
29
+ const details = errors.map((e) => ` - ${e}`).join("\n");
30
+ throw new Error(`Failed to load gsd_engine native addon for ${platformTag}.\n\n` +
31
+ `Tried:\n${details}\n\n` +
32
+ `Build with: npm run build:native -w @gsd/native`);
33
+ }
34
+ export const native = loadNative();