Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jimliu avatar

Baoyu Electron Extract

  • 5.9k installs
  • 24.6k repo stars
  • Updated July 4, 2026
  • jimliu/baoyu-skills

baoyu-electron-extract is a CLI skill that unpacks Electron app.asar bundles and restores or formats bundled JavaScript for inspection.

About

baoyu-electron-extract unpacks installed Electron desktop applications by extracting app.asar bundles and rebuilding readable source when embedded JavaScript source maps exist. A Bun or npx-driven script discovers macOS and Windows installs, unpacks ASAR archives, restores original file trees from sourcesContent in .js.map files, and runs Prettier on minified JavaScript when maps are missing or external-only. It skips node_modules, copies app.asar.unpacked native assets, emits extract-report.json with counts and warnings, and writes to ~/Downloads/<AppName>-electron-extract/ by default. Users invoke it to extract Electron apps, decompile bundles, inspect how Codex, Cursor, Discord, VS Code, or ChatGPT desktop clients are built, or pass absolute .app, install directory, or .asar paths. Dry-run previews discovery, --force overwrites populated output, and --json returns machine-readable summaries. Readable restored paths collapse bundler-relative segments like ../../src/main.ts into restored/src/main.ts instead of hashed placeholders.

  • Unpacks app.asar from discovered macOS or Windows Electron installs by app name or absolute path.
  • Restores original source trees from embedded sourcesContent in .js.map when maps are usable.
  • Prettier-formats minified JS and CSS in extracted/ when maps are missing or external-only.
  • Skips node_modules, copies app.asar.unpacked native modules, and emits extract-report.json.
  • Supports dry-run discovery, custom --output, --asar override, --force overwrite, and --json summary.

Baoyu Electron Extract by the numbers

  • 5,866 all-time installs (skills.sh)
  • +243 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #35 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

baoyu-electron-extract capabilities & compatibility

Capabilities
auto discover electron installs on macos and win · extract app.asar and optional app.asar.unpacked · restore sourcescontent trees with bundler relati · prettier format minified js and css when maps ar · emit extract report.json, dry run discovery, and
Use cases
debugging · research
Platforms
macOS · Windows
Runs
Runs locally
Pricing
Free
From the docs

What baoyu-electron-extract says it does

Extracts resources and code from an installed Electron app's `app.asar`.
SKILL.md
When a `.js.map` is present, restores the original source files from the embedded `sourcesContent`
SKILL.md
Always skips `node_modules`.
SKILL.md
**node_modules** is always skipped
SKILL.md
npx skills add https://github.com/jimliu/baoyu-skills --skill baoyu-electron-extract

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs5.9k
repo stars24.6k
Security audit2 / 3 scanners passed
Last updatedJuly 4, 2026
Repositoryjimliu/baoyu-skills

How do I extract, decompile, or read the bundled source inside an installed Electron desktop application?

Extract and inspect installed Electron app.asar bundles with source-map restoration or Prettier formatting on macOS and Windows.

Who is it for?

Researchers inspecting how Electron apps like VS Code, Discord, or Cursor package and bundle desktop client code.

Skip if: Greenfield Electron app development, mobile app reverse engineering, or Linux installs without an explicit --asar path.

When should I use this skill?

User asks to extract Electron app, decompile app.asar, inspect desktop app source, or see how an Electron client is built.

What you get

An output folder with extracted assets, optional restored/ source tree, formatted JS, and extract-report.json counts.

  • Restored source file tree
  • Normalized project paths from maps

Files

SKILL.mdMarkdownGitHub ↗

Electron App Extract

Extracts resources and code from an installed Electron app's app.asar. When a .js.map is present, restores the original source files from the embedded sourcesContent; otherwise formats the minified code with Prettier. Source-map paths are resolved relative to the .js.map file first, so bundled paths like ../../src/main.ts restore to readable paths such as restored/src/main.ts instead of hashed placeholders. Always skips node_modules. Works on macOS and Windows.

User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

1. Prefer built-in user-input tools exposed by the current agent runtime — e.g., AskUserQuestion, request_user_input, clarify, ask_user, or any equivalent. 2. Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. 3. Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.

Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.

Script Directory

Scripts in scripts/ subdirectory. {baseDir} = this SKILL.md's directory path. Resolve ${BUN_X} runtime: if bun installed → bun; if npx available → npx -y bun; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.

ScriptPurpose
scripts/main.tsApp discovery + asar extraction + source-map restoration + Prettier formatting

When to use

Use this skill whenever the user wants to look inside an installed Electron application or inspect its bundled code. Trigger phrases include:

  • "extract Electron app", "decompile this Electron app", "unpack app.asar"
  • "show me the source of <app>", "look inside <app>", "how is <app> built"
  • "get the source code of Codex / Cursor / Discord / Slack / VS Code / Notion / Obsidian / ChatGPT desktop"
  • "提取 Electron 应用", "看 <app> 的源码", "反编译 Electron", "解包 app.asar", "还原 source map"

Both app name (e.g., Codex) and absolute path (e.g., /Applications/Codex.app, a .asar file, or a Windows install dir) are accepted. The script handles discovery for both platforms.

Workflow

1. Determine the input. Ask the user for the app name or path if they haven't given one. If they want a custom output directory, ask for that too.

2. Run the script.

${BUN_X} {baseDir}/scripts/main.ts "<app>" [--output <dir>] [--asar <path>] [--force]

Start with --dry-run first if you're unsure whether discovery will find the right bundle — it prints the resolved paths and exits without touching the filesystem.

3. Handle the result.

  • Success → report the output paths and the counts (extracted / restored / formatted).
  • Multiple matches → the script lists candidates and exits non-zero. Show the user the candidates, ask which one to use (via AskUserQuestion or the runtime equivalent), then re-run with the chosen absolute path.
  • Existing non-empty output dir → the script refuses without --force. Ask the user whether to overwrite (--force) or pick a new --output path.
  • Unsupported platform / no match → suggest passing --asar /full/path/to/app.asar if the user knows where the bundle lives.

4. Point the user at the result. The default output dir is ~/Downloads/<AppName>-electron-extract/. The most interesting subdirectory depends on what was found:

  • restored/ exists → the original source tree was reconstructed from .js.map files; this is what to read first.
  • Only extracted/ exists (no maps) → the JS/CSS in extracted/ was Prettier-formatted in place; read from there.

Source-map path restoration

The script should preserve original source names and directory structure as much as the source map allows:

  • Resolve each sources[] entry with sourceRoot when present, then relative to the .js.map file's directory inside extracted/.
  • Collapse normal bundler-relative paths into the restored project tree. For example, .vite/main/index.js.map + ../../src/main.ts becomes restored/src/main.ts.
  • If a source path climbs above extracted/, keep the readable remaining path under restored/ instead of hashing it. For example, .vite/main/index.js.map + ../../../shared/src/lib/foo.ts becomes restored/shared/src/lib/foo.ts.
  • Strip URL/query decorations from source names, including common webpack://, file://, and ?loader suffixes.
  • Use restored/__unknown/<hash>.<ext> only when the source name is empty or cannot be reduced to a safe file path.
  • Continue skipping node_modules and webpack/runtime/* entries; these are bundler/runtime noise, not app sources.

Usage

# Extract by app name (default output: ~/Downloads/Codex-electron-extract/)
${BUN_X} {baseDir}/scripts/main.ts Codex

# Extract by absolute path (works for .app bundles, install dirs, or .asar files)
${BUN_X} {baseDir}/scripts/main.ts "/Applications/Visual Studio Code.app"
${BUN_X} {baseDir}/scripts/main.ts "C:\Users\you\AppData\Local\Programs\codex"
${BUN_X} {baseDir}/scripts/main.ts --asar /Applications/Codex.app/Contents/Resources/app.asar Codex

# Custom output
${BUN_X} {baseDir}/scripts/main.ts Codex --output ~/work/codex-source

# Preview discovery without writing anything
${BUN_X} {baseDir}/scripts/main.ts Codex --dry-run

# Overwrite an existing output dir
${BUN_X} {baseDir}/scripts/main.ts Codex --force

# Machine-readable result (one JSON line on stdout)
${BUN_X} {baseDir}/scripts/main.ts Codex --json

Options

OptionShortDescriptionDefault
<app>App name or absolute path. Required unless --asar is given.
--output-oOutput directory~/Downloads/<AppName>-electron-extract
--asarOverride the resolved .asar pathauto-discovered
--force-fAllow writing into a non-empty existing output dirfalse
--skip-formatSkip Prettier formattingfalse
--skip-restoreSkip source-map restorationfalse
--no-unpackedDon't copy app.asar.unpacked/ alongsidefalse
--dry-runPrint resolved paths and exit without writingfalse
--jsonEmit one JSON-line summary on stdout (suppresses normal output)false

Output layout

~/Downloads/<AppName>-electron-extract/
├── extract-report.json          # JSON summary: counts, warnings, resolved paths
├── extracted/                   # raw asar contents (JS/CSS Prettier-formatted when no map)
│   └── ...                      # node_modules left untouched (skipped from format)
├── extracted.unpacked/          # copied from <asar>.unpacked/ if present
│   └── ...                      # native modules (.node), large assets
└── restored/                    # only present if at least one .js.map was usable
    └── <original/source/tree>   # rebuilt from sourcesContent in each .js.map

Notes

  • node_modules is always skipped — both for source-map restoration and Prettier formatting — because vendored dependencies are noise when inspecting an app.
  • Source-map restoration only works when the .js.map embeds sourcesContent. This is the common case for modern bundlers (webpack, esbuild, Vite, rollup). If a map references external .ts/.js files without embedding them, that map is skipped and the corresponding .js is Prettier-formatted instead. Skipped maps are listed in extract-report.json under warnings.
  • Readable paths over hashes — don't treat ../ segments in source-map paths as automatically unsafe. First resolve them from the map location and then sanitize the final output path so it still stays under restored/. Hash fallback is only for unusable source names.
  • App discovery searches /Applications + ~/Applications on macOS, and %LOCALAPPDATA%\Programs, %PROGRAMFILES%, %PROGRAMFILES(X86)%, %APPDATA% on Windows. If discovery finds multiple matches, the script exits and lists them — re-run with an absolute path. On Linux or other platforms, pass --asar /path/to/app.asar explicitly.
  • Safety — the script refuses to write to /, the user home directly, or the current working directory, and refuses to populate an existing non-empty output dir without --force.
  • No global installs@electron/asar and prettier are resolved on-the-fly via npx -y. First run will be slower while npx caches them.

Related skills

Forks & variants (1)

Baoyu Electron Extract has 1 known copy in the catalog totaling 20 installs. They canonicalize to this original listing.

FAQ

When does the skill restore original source files?

When a .js.map embeds sourcesContent, the script rebuilds the original tree under restored/; otherwise it Prettier-formats minified JS in extracted/.

Which platforms support automatic app discovery?

macOS searches /Applications and ~/Applications; Windows searches LOCALAPPDATA Programs and Program Files. Linux requires --asar with an explicit path.

What happens if multiple matching apps are found?

The script lists candidates and exits non-zero; re-run with the chosen absolute .app, install directory, or .asar path.

Is Baoyu Electron Extract safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

CLI & Terminalintegrationsdevops

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.