Chuyển đến nội dung
Skillpedia
Lập trình chung27k · #9955

baoyu-electron-extract

Skill này làm gì

Skill này giải nén các file bên trong một ứng dụng Electron để bạn đọc cách nó được xây dựng. Skill dành cho lập trình viên muốn xem xét một ứng dụng desktop đã cài trên máy.

Khi nào nên dùng

  • ✓Khi bạn muốn xem mã nguồn của một ứng dụng desktop Electron đã cài đặt.
  • ✓Khi bạn muốn hiểu một ứng dụng desktop được xây dựng như thế nào.
  • ✓Khi bạn cần lấy các tài nguyên được đóng gói trong gói ứng dụng.

Liên kết skill

https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-electron-extract/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-electron-extract/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Trích xuất mã nguồn từ ứng dụng Electron đã cài trên máy tính của tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent của bạn tìm ứng dụng, giải nén gói, khôi phục mã nguồn gốc từ source map khi có, và định dạng lại mã đã thu gọn nếu không có.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Electron App Extract

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

{baseDir} = this SKILL.md's directory. Resolve ${BUN_X}: bun if installed; else npx -y bun; else suggest installing bun. Replace {baseDir} and ${BUN_X} with actual values.

Script Purpose
scripts/main.ts App discovery + asar extraction + source-map restoration + Prettier formatting

Workflow

1. Determine the input. Accepts an app name (e.g., Codex) or absolute path (/Applications/Codex.app, a .asar file, or a Windows install dir). Ask for it if not given; ask for a custom output directory if they want one.

2. Run the script.

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

If unsure discovery will find the right bundle, run with --dry-run first (prints resolved paths, writes nothing).

3. Handle the result.

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

4. Point the user at the result (default ~/Downloads/<AppName>-electron-extract/):

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

Usage

${BUN_X} {baseDir}/scripts/main.ts Codex                                   # → ~/Downloads/Codex-electron-extract/
${BUN_X} {baseDir}/scripts/main.ts "/Applications/Visual Studio Code.app"  # .app bundle, install dir, or .asar
${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
${BUN_X} {baseDir}/scripts/main.ts Codex --output ~/work/codex-source
${BUN_X} {baseDir}/scripts/main.ts Codex --json                            # one JSON line on stdout

Options

Option Short Description Default
<app> App name or absolute path. Required unless --asar is given. —
--output -o Output directory ~/Downloads/<AppName>-electron-extract
--asar Override the resolved .asar path auto-discovered
--force -f Allow writing into a non-empty existing output dir false
--skip-format Skip Prettier formatting false
--skip-restore Skip source-map restoration false
--no-unpacked Don't copy app.asar.unpacked/ alongside false
--dry-run Print resolved
Câu hỏi thường gặp

Nó mở được những ứng dụng nào?

Skill hoạt động với các ứng dụng Electron đã cài, bạn có thể gọi tên hoặc chỉ đường dẫn đến chúng.

Nếu mã bị thu gọn thì sao?

Khi không có source map, skill định dạng lại mã đã thu gọn để dễ đọc hơn.

Skill có khôi phục tên file gốc không?

Có. Khi ứng dụng có source map, skill khôi phục các nguồn gốc từ đó.

Chi tiết

Mô tả gốc của tác giả

Extracts resources and JavaScript from any installed Electron app (`.asar` bundle), restoring original sources from `.js.map` files when available or formatting minified code with Prettier otherwise. Use when user wants to "extract Electron app", "decompile Electron", "get the source code of <app>", "inspect app.asar", "看 Electron 应用源码", "提取 .asar", or asks how a desktop Electron app is built. Skips `node_modules` and supports both macOS and Windows.

repo: JimLiu/baoyu-skills

Độ phổ biến

Sao GitHub
27k
Vị trí xếp hạng
#9955
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự