[GH-ISSUE #68] Add native JavaScript bundle indexing and semantic queries #55

Closed
opened 2026-10-15 18:20:35 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @morluto on GitHub (Jul 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/68

Problem

Text search cannot reliably connect strings, protocol calls, duplicated modules, chunks, closures, and state fields in large minified bundles.

Outcome

Build a provider-neutral JavaScript bundle index and bounded semantic query engine as a native REA capability. The public contract, normalized index model, query semantics, evidence output, and persistence format belong to REA; optional parsers may be replaceable implementation details.

Capabilities

  • Index scripts, chunks, source maps, and extracted ASAR content.
  • Recover module and function boundaries where supported.
  • Build function and call graphs.
  • Link strings, constants, selectors, and properties to owning code.
  • Find protocol consumers and state-field reads and writes.
  • Detect duplicated or transformed bundled modules.
  • Correlate historical-source candidates using strings, constants, call shape, and structural similarity.
  • Record artifact hashes, index schema version, parser versions, confidence, limitations, and source locations.
  • Expose bounded literal, structural, and relationship queries through the same CLI/MCP schemas.

Safety

Never execute indexed JavaScript. Treat parse failures and unsupported syntax as partial evidence rather than absence. Bound patterns, queries, results, snippets, memory, disk usage, and indexing time. Redact declared secrets from snippets and exported evidence.

Acceptance criteria

  • Multi-chunk fixtures support string ownership, calls, duplicates, protocol consumers, and state-flow queries.
  • Source maps are tracked as a distinct authority rather than silently treated as shipped source.
  • Every query is bounded and returns pagination, total or truncation metadata, confidence, and limitations.
  • Indexes invalidate when artifact hashes, schema versions, or parser versions change.
  • Unsupported syntax and partial parses are typed and cannot be mistaken for exhaustive results.
  • Historical candidates are classified as unchanged, modified, removed, added, or unknown without claiming recovery of destroyed names or comments.
  • The implementation has no public dependency on, or terminology from, an external indexing product.

Dependencies

Parents #39 and #42. Requires artifact decomposition, provider SDK, and evidence bundles.

Non-goals

Runtime debugging, executing target code, guaranteed recovery of original boundaries without source maps, or coupling the public API to one parser or indexing backend.

Originally created by @morluto on GitHub (Jul 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/68 ## Problem Text search cannot reliably connect strings, protocol calls, duplicated modules, chunks, closures, and state fields in large minified bundles. ## Outcome Build a provider-neutral JavaScript bundle index and bounded semantic query engine as a native REA capability. The public contract, normalized index model, query semantics, evidence output, and persistence format belong to REA; optional parsers may be replaceable implementation details. ## Capabilities - Index scripts, chunks, source maps, and extracted ASAR content. - Recover module and function boundaries where supported. - Build function and call graphs. - Link strings, constants, selectors, and properties to owning code. - Find protocol consumers and state-field reads and writes. - Detect duplicated or transformed bundled modules. - Correlate historical-source candidates using strings, constants, call shape, and structural similarity. - Record artifact hashes, index schema version, parser versions, confidence, limitations, and source locations. - Expose bounded literal, structural, and relationship queries through the same CLI/MCP schemas. ## Safety Never execute indexed JavaScript. Treat parse failures and unsupported syntax as partial evidence rather than absence. Bound patterns, queries, results, snippets, memory, disk usage, and indexing time. Redact declared secrets from snippets and exported evidence. ## Acceptance criteria - Multi-chunk fixtures support string ownership, calls, duplicates, protocol consumers, and state-flow queries. - Source maps are tracked as a distinct authority rather than silently treated as shipped source. - Every query is bounded and returns pagination, total or truncation metadata, confidence, and limitations. - Indexes invalidate when artifact hashes, schema versions, or parser versions change. - Unsupported syntax and partial parses are typed and cannot be mistaken for exhaustive results. - Historical candidates are classified as unchanged, modified, removed, added, or unknown without claiming recovery of destroyed names or comments. - The implementation has no public dependency on, or terminology from, an external indexing product. ## Dependencies Parents #39 and #42. Requires artifact decomposition, provider SDK, and evidence bundles. ## Non-goals Runtime debugging, executing target code, guaranteed recovery of original boundaries without source maps, or coupling the public API to one parser or indexing backend.
Author
Owner

@morluto commented on GitHub (Jul 20, 2026):

Closing as completed. JavaScript bundle indexing and bounded semantic queries are now shipped:

  • The JavaScript Application Graph (src/domain/javascriptApplicationGraph*.ts) indexes scripts, chunks, modules, source maps, ASAR entries, Electron main/preload/renderer processes, IPC channels, native addons, and managed-assembly handoffs.
  • analyze_javascript_application (MCP/CLI) produces the graph and a bounded summary with paginated rea://evidence/ resources.
  • trace_application_feature traverses the graph from a literal seed (node, route, string, API, IPC channel, module, native export) with bounded direction/depth/nodes/edges/paths.
  • compare_application_versions compares two authenticated graphs using digest, module-source, source-map, structural-fingerprint, and semantic-key tiers.
  • reconcile_javascript_runtime correlates static graphs with passive CDP/Electron runtime evidence.
  • Tests (tests/javascriptApplicationGraph.test.ts, tests/javascriptApplicationWorkflows.test.ts, tests/javascriptSemanticAnalysis.test.ts, tests/javascriptBundlerAdapters.test.ts, tests/javascriptRuntimeReconciliation.test.ts) cover indexing, traversal, comparison, and reconciliation.
<!-- gh-comment-id:5023311839 --> @morluto commented on GitHub (Jul 20, 2026): Closing as completed. JavaScript bundle indexing and bounded semantic queries are now shipped: - The JavaScript Application Graph (`src/domain/javascriptApplicationGraph*.ts`) indexes scripts, chunks, modules, source maps, ASAR entries, Electron main/preload/renderer processes, IPC channels, native addons, and managed-assembly handoffs. - `analyze_javascript_application` (MCP/CLI) produces the graph and a bounded summary with paginated `rea://evidence/` resources. - `trace_application_feature` traverses the graph from a literal seed (node, route, string, API, IPC channel, module, native export) with bounded direction/depth/nodes/edges/paths. - `compare_application_versions` compares two authenticated graphs using digest, module-source, source-map, structural-fingerprint, and semantic-key tiers. - `reconcile_javascript_runtime` correlates static graphs with passive CDP/Electron runtime evidence. - Tests (`tests/javascriptApplicationGraph.test.ts`, `tests/javascriptApplicationWorkflows.test.ts`, `tests/javascriptSemanticAnalysis.test.ts`, `tests/javascriptBundlerAdapters.test.ts`, `tests/javascriptRuntimeReconciliation.test.ts`) cover indexing, traversal, comparison, and reconciliation.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#55
No description provided.