Files
rea/docs/javascript-artifact-reconstruction.md
T
morluto 844bb46351 fix(javascript): retain Electron switch conditions (#7910)
* fix(javascript): retain Electron switch conditions

* fix(javascript): bound switch path traversal
2026-10-29 07:56:15 +08:00

62 KiB

JavaScript artifact reconstruction

Inspect a local Electron/JavaScript directory or ASAR without executing its code. analyze_javascript_application and the CLI routes below return an Evidence record with the application graph, static Electron observations, statistics, limitations, and coverage.

Start with the public workflow, select sources when useful, then read the analysis. Use application workflows for tracing and comparisons, or partial recovery when an operation is interrupted.

Public workflow

The tool reads the caller-selected local directory or ASAR path directly:

rea analyze /absolute/path/to/apps/app.asar --json
rea analyze-javascript-application /absolute/path/to/apps/app.asar \
  --integrity-policy record-and-continue --json

Generic rea analyze selects this static provider for directories and .asar paths when neither --provider nor --snapshot is supplied. The dedicated command and the generic route return their complete results inline. Native targets, single JavaScript files, .app bundles, and explicit deep-provider or snapshot requests retain the native deep-analysis route.

Both CLI routes emit rea_progress JSON lines on stderr as inventory, source parsing, graph construction, validation, and Evidence hashing begin. Stdout remains the selected result document. Completion is reported after Evidence creation; a failed analysis retains its typed diagnostic result.

Configure an MCP client with the ordinary REA setup command:

rea setup

The equivalent MCP input is:

{
  "input_path": "/absolute/path/to/apps/app.asar",
  "format": "auto",
  "integrity_policy": "fail"
}

input_path must be absolute. format accepts auto, asar, or directory. integrity_policy accepts fail or record-and-continue; both CLI routes and the MCP tool default to fail. Evidence parameters retain the caller-selected input_path, including a symlink alias. Both CLI routes anchor relative inputs to their working directory without resolving symlinks. The subject and normalized result use the resolved path for artifact identity; the selected path remains a separate request fact. Older Evidence can omit this parameter; retained records are validated without resolving their paths against the live filesystem. The result retains the canonical local path, root artifact digest, artifact manifest and graph commitments, JavaScript Application Graph, static Electron summary, reconstruction stat