feat: add ReScript language support#58
Conversation
Add ReScript (https://rescript-lang.org/) as a supported language with tree-sitter parsing for .res and .resi files. The tree-sitter-rescript.wasm grammar (908KB) was built from https://github.com/rescript-lang/tree-sitter-rescript via Docker + emscripten. AST node mappings cover let_declaration, module_declaration, type_declaration, call_expression, pipe_expression, open_statement, and include_statement. Fix symbol disambiguation in MCP tools: add file parameter to codegraph_node, codegraph_callers, codegraph_callees, and codegraph_impact so that ambiguous symbol names can be resolved by file path. When file is provided but no match is found, return an error instead of silently falling back to a different symbol. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…E.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolves merge conflicts with upstream's refactored extraction architecture: - Language extraction split into per-file modules in src/extraction/languages/ - ReScript extractor moved to src/extraction/languages/rescript.ts using the visitNode hook with ExtractorContext API - MCP tools updated to use upstream's findAllSymbols approach (file param for disambiguation superseded by aggregation across all matching symbols) - CLAUDE.md and README.md updated with both Svelte and ReScript Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The file parameter was added to codegraph_callers, codegraph_callees, codegraph_impact, and codegraph_node schemas but the handlers never used it. Conflict resolution replaced the implementation with upstream's findAllSymbols aggregation approach. Remove the dead schema entries to keep the diff purely ReScript-related. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oading Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…architecture Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi! Sorry to drop in cold — I've been working through the open PR backlog and noticed your PR is waiting on the same architectural conflict as a bunch of other language PRs. I've opened a refactor PR (#116) that turns "adding a language" from a 6-file mutation into a 1-file addition. Once that lands, this PR rebases cleanly. Sharing the rebase template inline so you don't have to read the maintainer guide to do it. After #116 merges, the rebase is mechanicalStep 1. Discard your changes to the monolithic files (#116 makes them auto-derived from the registry): git checkout main -- \
src/types.ts \
src/extraction/grammars.ts \
src/extraction/languages/index.ts \
CLAUDE.mdStep 2. Move your extractor's registration into one file, import { yourExtractor } from './your-extractor-config';
import type { LanguageDef } from './types';
export const YOUR_DEF: LanguageDef = {
name: 'yourlang',
displayName: 'Your Language',
extensions: ['.ext'],
includeGlobs: ['**/*.ext'],
// For a tree-sitter grammar:
grammar: { wasmFile: 'tree-sitter-yourlang.wasm', vendored: true, extractor: yourExtractor },
// OR for a custom regex/template extractor (Liquid, HCL pattern):
// customExtractor: (filePath, source) => new YourExtractor(filePath, source).extract(),
};Step 3. Add 2 lines to import { YOUR_DEF } from './yourlang'; // alphabetical
// ...
const ALL_DEFS: readonly LanguageDef[] = [
// ... alphabetical
YOUR_DEF,
// ...
];Step 4. Add Step 5. Your test additions in That's it. If your existing Three of my own language PRs (#92, #94, #95) are already pre-rebased to this pattern as references if you want to see what a finished rebase looks like. Happy to help with the rebase if you'd like — just let me know. |
…istry External PR (malo). Originally based on monolithic grammars.ts; rebased to per-language registry pattern. - src/extraction/languages/rescript.ts (rescriptExtractor + RESCRIPT_DEF) - 'rescript' added to Language union - Vendored tree-sitter-rescript.wasm - Extensions: .res, .resi. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…y syntax errors Friction colbymchenry#58: FTS5 reserved characters (hyphens, quotes, operators) were causing "invalid FTS5 query syntax" crashes when users included them in intent-mode queries (e.g., "fallback when no issue-tagged" → FTS5 interprets as "issue MINUS tagged"). Solution: Pre-sanitize user queries by replacing FTS5-reserved chars (-, ^, *, (, ), :, ") with spaces, collapsing whitespace. Surface sanitization as a non-blocking footer notice so users understand the transformation and know to use mode='exact' for FTS5 operators. Implementation: - Added sanitizeQueryForFts5() helper that returns both sanitized query and a flag - Sanitization occurs at the entry point before any FTS5 execution - Error on empty-after-sanitization to catch purely operator-only queries - Footer notice shows original vs sanitized when modification occurred - 10 unit tests cover: hyphens, parentheses, colons, asterisks, quotes, whitespace, mixed operators, clean queries, and integration with the CLI Tests pass: 20/20 intent-search tests, full suite 2005/2040 (1 pre-existing timeout in unrelated test). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add ReScript (https://rescript-lang.org/) as a supported language with tree-sitter parsing for .res and .resi files.
The tree-sitter-rescript.wasm grammar (908KB) was built from https://github.com/rescript-lang/tree-sitter-rescript via Docker + emscripten. AST node mappings cover let_declaration, module_declaration, type_declaration, call_expression, pipe_expression, open_statement, and include_statement.
Fix symbol disambiguation in MCP tools: add file parameter to codegraph_node, codegraph_callers, codegraph_callees, and codegraph_impact so that ambiguous symbol names can be resolved by file path. When file is provided but no match is found, return an error instead of silently falling back to a different symbol.