Implements a Rust napi-rs module that parses YAML-like frontmatter,
markdown sections, and roadmap structures from .gsd/ files. Provides
parseFrontmatter, extractSection, extractAllSections, batchParseGsdFiles,
and parseRoadmapFile functions exposed via @gsd/native. The JS parsers
in files.ts fall back transparently when the native module is unavailable.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the edit tool's hot-path diffing operations from JS to native Rust:
- `normalizeForFuzzyMatch`: single-pass Unicode normalization (smart quotes,
dashes, special spaces, trailing whitespace)
- `fuzzyFindText`: exact-then-fuzzy substring search with UTF-16 index
conversion for JS compatibility
- `generateDiff`: unified diff generation using the `similar` crate
(Myers' algorithm with optimizations)
The Rust module at `native/crates/engine/src/diff.rs` exposes three napi
functions. The TypeScript wrapper at `packages/native/src/diff/` follows
the existing module pattern. `edit-diff.ts` now delegates to native
implementations while keeping line-ending handling and file I/O in JS.
18 tests covering normalization, fuzzy matching (including UTF-16 index
correctness with emoji/surrogate pairs), and diff generation.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TTSR's checkDelta() runs O(rules x conditions) regex evaluations per
streaming token — the hottest path in GSD. This adds a Rust native
module that compiles all condition patterns into a single RegexSet,
testing them in one DFA pass instead of sequential JS RegExp iteration.
The TtsrManager transparently uses the native engine when available and
falls back to the existing JS regex loop when it is not.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds the `gsd-ast` crate providing AST-aware code search (`astGrep`) and
rewrite (`astEdit`) via ast-grep with tree-sitter grammars for 38+ languages.
Replaces Oh My Pi's fs_cache/task dependencies with the `ignore` crate for
.gitignore-respecting file walking. Includes TypeScript type declarations
and wrappers in packages/native.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port image processing from Oh My Pi's pi-natives crate, adapted for napi-rs v2.
Exposes NativeImage class with async parse/encode/resize methods backed by the
Rust `image` crate (PNG, JPEG, WebP, GIF support).
Includes:
- task.rs: lightweight async task scheduling for libuv thread pool
- image.rs: NativeImage class with SamplingFilter enum
- TypeScript types and wrapper (parseImage, ImageFormat, SamplingFilter)
- 8 passing tests covering decode, encode, resize, round-trip, error cases
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cross-platform clipboard access (text read/write, image read) via the
arboard Rust crate. No external tools (pbcopy, xclip, etc.) required.
Ported from Oh My Pi's clipboard module with adaptations for GSD's
architecture (direct AsyncTask instead of task::blocking wrapper).
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port ast-grep integration from Oh My Pi with 38+ language support via tree-sitter
grammars. Exposes `astGrep` (search) and `astEdit` (rewrite) as N-API functions
with TypeScript wrappers.
Key changes:
- New `gsd-ast` crate with language definitions, glob utilities, and ast-grep core
- Replaces fs_cache/task dependencies with `ignore` crate for file walking
- Synchronous API matching the existing grep module pattern
- Full TypeScript type declarations in packages/native/src/ast/
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port glob, glob_util, and fs_cache modules from Oh My Pi's pi-natives crate,
adapted for napi-rs v2. Provides gitignore-respecting filesystem discovery
with a TTL-based scan cache, mtime sorting, file-type filtering, and
node_modules exclusion.
Includes a task module for async N-API work scheduling with cooperative
cancellation (timeout-based), TypeScript type declarations and wrapper,
and 12 integration tests covering pattern matching, recursion, gitignore,
maxResults, sortByMtime, fileType filtering, and cache invalidation.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port Oh My Pi's ps module providing efficient process tree enumeration
and termination using platform-native APIs (libproc on macOS, /proc on
Linux, Toolhelp32 on Windows).
Exposes four napi functions: killTree, listDescendants, processGroupId,
and killProcessGroup.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Port HTML-to-Markdown conversion from Oh My Pi's html module using
html-to-markdown-rs. Exposes `htmlToMarkdown()` via N-API with options
for content cleaning (strip nav/forms/headers/footers) and image skipping.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cross-platform clipboard access (text read/write, image read) via the
arboard Rust crate. No external tools (pbcopy, xclip, etc.) required.
Ported from Oh My Pi's clipboard module with adaptations for GSD's
architecture (direct AsyncTask instead of task::blocking wrapper).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: scaffold Rust native engine with grep module (napi-rs)
Adds a Rust N-API addon architecture inspired by Oh My Pi's pi-natives.
The grep module wraps ripgrep's core crates (grep-regex, grep-searcher,
grep-matcher) and exposes `search()` and `grep()` to Node.js via napi-rs.
Includes:
- Cargo workspace at native/ with engine (cdylib) and grep (lib) crates
- Build script (native/scripts/build.js) producing platform-tagged .node files
- TypeScript wrapper package (@gsd/native) with types and loader
- 6 Rust unit tests + 9 Node.js integration tests (all passing)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: audit fixes for rust native engine PR
- Fix repository URL to gsd-build/gsd-2
- Remove dead add_custom_ignore_filename("") call
- Unify error model: search() now returns Result<> (throws) matching grep()
- Remove error field from NapiSearchResult and SearchResult types
- Use t.after() in integration tests for reliable temp dir cleanup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>