Printable idea sheet
analytical_package
reqlan rq/core-architecture.rq:60
Katz 0.167
`packages/analytical` ( `@reqlan/analytical` ) is the shared requirement graph index and analysis layer.
It owns the indexer.rq: extracts ideas and edges into a rusqlite store via the core native engine ( workspace-index.ts ), holds Zustand analytical state, and exposes analysers and an analysis API.
Headless CLI / MCP entry is `@reqlan/analytical/core` via `openAnalysisApi` ( native required; no Langium ).
Consumers: extension_package ( thin editor adapter ), mcp_package, cli_package.
Depends on language_package for the editor LSP only. Published to npm alongside cli_package; version graph role: package_versioning.
Rust engine port ( lexer / parser-for-index, indexer, search, export ): analytical_rust_port, shipped per rust_binary_distribution.
- plan
- goal
Replace the TypeScript analysis engine (parse-for-index, extract, SQLite index, search, export) with a Rust library behind the existing `createAnalysisRuntime` / `AnalysisApi` facade, shipped as per-architecture binaries and per-target VSIXes.
constraints
- Distribution: rust_binary_distribution + vsix_export — npm optional platform packages and host-targeted VSIX; website downloads and GitHub-release postinstall out of scope.
- Shared on-disk ideas_index under `<base>/.reqlan` is schema v4 rusqlite (native required; no sql.js fallback).
- The language server is language_server_rust. This analytical plan does not replace that process. Do not switch the language to tree-sitter (grammar_and_parser).
- Port the context-sensitive lexer (lexer_rust) rather than a parser-generator that cannot honour syntax.rq brace/fence rules.
- nonblocking_index and parse_budget_timeout still apply; rust_mindset and supply_chain (mature crates).
- Extension host requires the host-matching napi `.node` from the per-target VSIX (extension_host_target).
- Zustand host state, webviews, and HTML-export client JS stay TypeScript.
steps
1. Scaffold `crates/` + golden tests vs Langium (rust_crate_layout).
2. Lexer, then parser with recovery and budget (lexer_rust, parser_rust).
3. Extractor + rusqlite + incremental sync (indexer_rust).
4. Search analysers (search_rust).
5. Export snapshot + writers; keep interactive HTML JS (export_rust).
6. napi-rs per-arch host packages; CLI then MCP then extension via platform VSIX (native_bridge, cutover).
7. Publish on `analytical/v*` and ship per-target VSIXes (rust_binary_distribution, vsix_export).
open
- Language-server process: language_server_rust. CLI `parse` uses the core Rust engine. - status
- in-progress
Interactive page: analytical_package