commit 3aef0f6c8458223413949ec48883fa94c00f6727 Author: Zhongwei Li Date: Sat Nov 29 18:18:56 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..5b72d90 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "browser-pilot", + "description": "Chrome DevTools Protocol (CDP) browser automation, web scraping, and crawling with React compatibility", + "version": "1.10.0", + "author": { + "name": "Dev GOM", + "url": "https://github.com/Dev-GOM/claude-code-marketplace" + }, + "skills": [ + "./skills" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a75ac24 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# browser-pilot + +Chrome DevTools Protocol (CDP) browser automation, web scraping, and crawling with React compatibility diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..a240535 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,309 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:Dev-GOM/claude-code-marketplace:plugins/browser-pilot", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "4efa229eee19c084e4c09e6633ef82485bfc263e", + "treeHash": "9ce781902752f5a5275646ca73c877a51eb6d2567786b72371e0ee666ddad875", + "generatedAt": "2025-11-28T10:10:17.589693Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "browser-pilot", + "description": "Chrome DevTools Protocol (CDP) browser automation, web scraping, and crawling with React compatibility", + "version": "1.10.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "a6b6d4720c9297fbdec226d7bf1785a8112c744b7ae0b88e62284b3a8d8b6016" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "4b52d22927abfab2bff34f8b2adf142058b2605251f571cbd2e419f88f24fa58" + }, + { + "path": "skills/SKILL.md", + "sha256": "113530dfc519f84a65faaa311d0cef4634536df5f562bc928bef0274d51b32ba" + }, + { + "path": "skills/references/commands-reference.md", + "sha256": "deb78776496e97fac9ab389a2424b8de683907a1d941fa0949a8ce01dacddee3" + }, + { + "path": "skills/references/selector-guide.md", + "sha256": "65a872fa0f67b3191cba7934670334904e58817adfed19cd222d767399ae4feb" + }, + { + "path": "skills/references/interaction-map.md", + "sha256": "b1de092948922f1619edd0eb1bef616c796cefb35bfca858615d645a1a60a755" + }, + { + "path": "skills/scripts/package.json", + "sha256": "a3eea0902133ffbb7c09d8e5ddfa04daeba2a3a3f0c41177968e3a75bd48d1ec" + }, + { + "path": "skills/scripts/tsconfig.json", + "sha256": "dbac69ac1ad7ecb10ff1dc9cae7059ffc1c7f24d5d7342409813799efe4f49a9" + }, + { + "path": "skills/scripts/eslint.config.mjs", + "sha256": "1147567cc49454b578398e51774ef908ac51bc069611bd9aaf66ed6b9293818f" + }, + { + "path": "skills/scripts/src/cdp/utils.ts", + "sha256": "dd109a1810185f336db050937b8cfbb403d0b3908778ae02c12b3a8fa6a7af57" + }, + { + "path": "skills/scripts/src/cdp/browser.ts", + "sha256": "19ec63fc421c737d8f4d972387c7ebaaf41bea87cb76e2fe5c9aa642d6d95059" + }, + { + "path": "skills/scripts/src/cdp/actions.ts", + "sha256": "dd37c8e62c782f8ae19bf2004078dd3f29c4f79080d90ac927b62575dad2a98e" + }, + { + "path": "skills/scripts/src/cdp/client.ts", + "sha256": "75985cc843baae6c624120bb9585ffd874e36cee9ad9e541c09e2d831c10268f" + }, + { + "path": "skills/scripts/src/cdp/config.ts", + "sha256": "00b62151b233701b6f077620125d9c2050056e11339bfefc9cb3b566f6f0b16a" + }, + { + "path": "skills/scripts/src/cdp/map/generate-interaction-map.ts", + "sha256": "7eb0140eaebf53eadfc5b8a5422201dfafb3b1599204ce5ade23603f7460bcbe" + }, + { + "path": "skills/scripts/src/cdp/map/query-map.ts", + "sha256": "46c3617d898cf73749528caf426ad6e38cd21f9de19708dd62a796d225d843be" + }, + { + "path": "skills/scripts/src/cdp/actions/data.ts", + "sha256": "bce34a1ac5e7fc49c2b0d15706e5ffcd0db276bcde6288ee48012c110b2b1195" + }, + { + "path": "skills/scripts/src/cdp/actions/helpers.ts", + "sha256": "483503eae2e810f88b000431457799f498e69ff364727a87a69998cccd8f5707" + }, + { + "path": "skills/scripts/src/cdp/actions/dialogs.ts", + "sha256": "d34eec0a3c9d5ea6254efeeff13e5753a01623a22729e97bbb5985c32169892d" + }, + { + "path": "skills/scripts/src/cdp/actions/verify.ts", + "sha256": "764ea4e0029787ff194a153ec43f4319ccfccb97263583f7aaf427cb070f8bb3" + }, + { + "path": "skills/scripts/src/cdp/actions/navigation.ts", + "sha256": "633961ac587a9d8a1ad9df7fb49d857e647efc4a8431c126ac89d033aac3afe1" + }, + { + "path": "skills/scripts/src/cdp/actions/network.ts", + "sha256": "ea5ace071fb8569c22795487563a579b027b05c287e4498bca5a33c797e385f1" + }, + { + "path": "skills/scripts/src/cdp/actions/input.ts", + "sha256": "acc78b56750ca5edcdc6ba15f62dc7a29ab52ad1f10f225bc7685ecbc2b6146c" + }, + { + "path": "skills/scripts/src/cdp/actions/capture.ts", + "sha256": "65e0a1cb263719bee7b289f50f58e0a7c04c3705e5ae9e38987c6ed580ccb5b1" + }, + { + "path": "skills/scripts/src/cdp/actions/forms.ts", + "sha256": "67a6a5df967f560a2136b257ba7119c7fb48559f7957ad8436c4973b1c4dc1dd" + }, + { + "path": "skills/scripts/src/cdp/actions/debugging.ts", + "sha256": "20080fb55d16f24821aa5a2d620ff91b622932d7d52f19762a4740465a1dd4b4" + }, + { + "path": "skills/scripts/src/cdp/actions/emulation.ts", + "sha256": "506b58b0ac69771788693c73631faad4f69cdc031ec56dad6f0deadad46c33c4" + }, + { + "path": "skills/scripts/src/cdp/actions/wait.ts", + "sha256": "9aa1e410a023e9b0e3122cc9ee14ae8fefa807c5c24e333b355c4a8c47f3dd26" + }, + { + "path": "skills/scripts/src/cdp/actions/scroll.ts", + "sha256": "636b3becbca5bfa66c63b0be5ee0dd1f5fc50a2bb45b1cdccc64c97b016cfeb6" + }, + { + "path": "skills/scripts/src/cdp/actions/tabs.ts", + "sha256": "bd77b56f88c79c9792b46febb1c9effcecc49995f4ed9d449b08214aff2e3b95" + }, + { + "path": "skills/scripts/src/cdp/actions/interaction.ts", + "sha256": "9e79e9bb2526fffa2f30b149055dd3a2cb7d665983cf37492bdcea58b3a21bd9" + }, + { + "path": "skills/scripts/src/cdp/actions/cookies.ts", + "sha256": "e98bf8723a083b2f29a87c4615f81bbf8fd130c64abaa3156abb0cd90e9279a0" + }, + { + "path": "skills/scripts/src/constants/index.ts", + "sha256": "9cb84b6e98052b3d23c2beb5ecef14bddbdf509ba7bd4c8dfcd681dab8a1590e" + }, + { + "path": "skills/scripts/src/utils/timestamp.ts", + "sha256": "f995aef19dd989911e8d27c0120f17d6d556e6425d7e6db3b715e837eb82f11c" + }, + { + "path": "skills/scripts/src/utils/logger.ts", + "sha256": "985b830942754994ce13104095047c43d58a68a686b2cd6f868f10549f8958d1" + }, + { + "path": "skills/scripts/src/cli/daemon-helper.ts", + "sha256": "ffe42c17fa1d198ee6b1add5d2ce352ca155836b7f0f5a1878257513031822b1" + }, + { + "path": "skills/scripts/src/cli/cli.ts", + "sha256": "2bab2d5370eedbcf29b9bbabee9e56599d140411f450062a93d25dceee7bf287" + }, + { + "path": "skills/scripts/src/cli/commands/focus.ts", + "sha256": "bc977c0e3617c22daeab2283b90ce7f0e79514890f4587f08d021dd28fb1e09c" + }, + { + "path": "skills/scripts/src/cli/commands/daemon.ts", + "sha256": "bc9848f7cb0cf0123ada9edad54ab3a65989b7d5db68a30964abacf8f07e9174" + }, + { + "path": "skills/scripts/src/cli/commands/data.ts", + "sha256": "42bc1b2f00800f9a24110ddcce1067cebe588335e3b474d6d16e68c8a80692e8" + }, + { + "path": "skills/scripts/src/cli/commands/selector-helper.ts", + "sha256": "10ad7e8c5b746802014ab4608f70653890eba05ab5d9c138702b9b5454315981" + }, + { + "path": "skills/scripts/src/cli/commands/dialogs.ts", + "sha256": "cf0a667b9696a479f0fc5a6b77ca1cb18440e04f5d6549e56ffd42d4ed7e2b88" + }, + { + "path": "skills/scripts/src/cli/commands/accessibility.ts", + "sha256": "771180962ab7dc9a751441b927cbbb5991178a29e1c0e0ed59449b1c4ee5fa70" + }, + { + "path": "skills/scripts/src/cli/commands/navigation.ts", + "sha256": "01b5e2ac44e7b9244094f52426337349819e03c485ff8ca58a5d6fde58bbc9a2" + }, + { + "path": "skills/scripts/src/cli/commands/network.ts", + "sha256": "5e578c8b29239f9506daa4bc323b02dd5d66f99f5a4826de5cdf87d3e5a96528" + }, + { + "path": "skills/scripts/src/cli/commands/capture.ts", + "sha256": "b1e734d4bfd3731e4472a12c2d700826d34c9967a69fed9d6575222c2ff615e0" + }, + { + "path": "skills/scripts/src/cli/commands/forms.ts", + "sha256": "f8b958e96a225d96d7d9e3d9a44e575357b95bd047e9524eaeb3de794982d5a9" + }, + { + "path": "skills/scripts/src/cli/commands/emulation.ts", + "sha256": "dd130d9ab619de79c457cbec4aed3b006d1b33c021be0fa877decaab20aeb0ae" + }, + { + "path": "skills/scripts/src/cli/commands/wait.ts", + "sha256": "5a077ac6ff83e25f07fc571858a439c99f4430f53d2be222abb96526f11b4fed" + }, + { + "path": "skills/scripts/src/cli/commands/scroll.ts", + "sha256": "6e9e8db9ab8be035ee2e2449759868feceb04ba6a355ab25b7a488b7b99cbe3f" + }, + { + "path": "skills/scripts/src/cli/commands/chain.ts", + "sha256": "089722859c841463a376f35c2cc621b5117ff754f87c388c964b8cbd61e991e7" + }, + { + "path": "skills/scripts/src/cli/commands/tabs.ts", + "sha256": "9f6d8c55e13ce759f90bf701b9c2462d81656cc230db80a07b22053d5adb6dda" + }, + { + "path": "skills/scripts/src/cli/commands/interaction.ts", + "sha256": "82424470f754304ae321f3cd0777b4fb4434cd563b2634a3dc697dbf6c5164db" + }, + { + "path": "skills/scripts/src/cli/commands/query.ts", + "sha256": "0908d9ef05b229c0348b71ae1511e6322781f42ede28a19c0f78491d23790aec" + }, + { + "path": "skills/scripts/src/cli/commands/system.ts", + "sha256": "16543760c9a4b1f097a4b19b31bdd5a137fbff0ef3bb398f0510d6ff25fdaff9" + }, + { + "path": "skills/scripts/src/cli/commands/console.ts", + "sha256": "f81b7d246a96c41a15d85bc5af9e449156cebcf780d3591e11e91ce2ed789f4e" + }, + { + "path": "skills/scripts/src/cli/commands/cookies.ts", + "sha256": "49c946bbc040a7fd0b387a1eb4b92e152d82218e26fcdb0274d6558272079607" + }, + { + "path": "skills/scripts/src/daemon/manager.ts", + "sha256": "d73ea3290bfc8fa752dbcf2c3a0b283ec0e9d1689849bdde270b046fa5db89f8" + }, + { + "path": "skills/scripts/src/daemon/client.ts", + "sha256": "a377f3d24386cc08a29648aa2ced40ec27509eafa5037447f2674e31fc50df3e" + }, + { + "path": "skills/scripts/src/daemon/protocol.ts", + "sha256": "c3293fa4073152f76169b30440b7bf13a7e04337a0ca53fb067cf2c8fa3a2542" + }, + { + "path": "skills/scripts/src/daemon/map-manager.ts", + "sha256": "e32adcf83b9e22c486bd45ab07255eaf77e62911d0b54b9003dffd5fc5a0602d" + }, + { + "path": "skills/scripts/src/daemon/server.ts", + "sha256": "8d374b0b021ae5db412e5445e539f79aeadbe2f37df9c453a4de4abf7b9e6bd8" + }, + { + "path": "skills/scripts/src/daemon/handlers/utility-handlers.ts", + "sha256": "2195ec7c2a54c8ba1d605bfce52361f1f3d754303dbbd0335790a22b3caba0fb" + }, + { + "path": "skills/scripts/src/daemon/handlers/capture-handlers.ts", + "sha256": "60e736208c164cd8341b6c51ee21112e94774f9570ae17cbf65dfca32675154c" + }, + { + "path": "skills/scripts/src/daemon/handlers/index.ts", + "sha256": "264bee94f51371a75391bcb43be0b8c0a446ca0095a27f1cb58df30d8b58ba04" + }, + { + "path": "skills/scripts/src/daemon/handlers/interaction-handlers.ts", + "sha256": "dfc9492608b14c36711b5d747821ecfdbd5ba2707350f736823f876e28aff264" + }, + { + "path": "skills/scripts/src/daemon/handlers/map-handlers.ts", + "sha256": "520d96f88ec1a8534434b114d8e0b1caa54857bd7736d7654a52e0cc4e8cf4a1" + }, + { + "path": "skills/scripts/src/daemon/handlers/data-handlers.ts", + "sha256": "fa80d68e312df5eefb46b9f774405abefde0629758fa1ddced3333d01f8652fd" + }, + { + "path": "skills/scripts/src/daemon/handlers/navigation-handlers.ts", + "sha256": "ad18d102c89bfdd2e5ea0d2e8fe936084bb381975a4c9d57c7d8741a6aab518c" + } + ], + "dirSha256": "9ce781902752f5a5275646ca73c877a51eb6d2567786b72371e0ee666ddad875" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/SKILL.md b/skills/SKILL.md new file mode 100644 index 0000000..4d1a0ae --- /dev/null +++ b/skills/SKILL.md @@ -0,0 +1,240 @@ +--- +name: browser-pilot +description: | + Chrome DevTools Protocol (CDP) browser automation, web scraping, crawling. 브라우저 자동화, 웹 스크래핑, 크롤링. + + Features/기능: screenshot with region control 영역지정스크린샷, viewport control 뷰포트제어, PDF generation PDF생성, web scraping 웹스크래핑, data extraction 데이터추출, form filling 폼작성, login automation 로그인자동화, click/input 클릭/입력, element finder 요소찾기, tab management 탭관리, cookie control 쿠키제어, JavaScript execution JS실행, page navigation 페이지이동, wait for element 요소대기, scroll 스크롤, accessibility tree 접근성트리, console messages 콘솔메시지, network idle 네트워크대기, back/forward 뒤로/앞으로, reload 새로고침, file upload 파일업로드, React compatibility React호환성, Smart Mode with Interaction Map 스마트모드. + + Selectors 셀렉터: CSS selectors (ID, class, attribute), XPath selectors with wildcard * (text-based, structural), XPath indexing (select N-th element with same text). Smart Mode: text-based element search with automatic selector generation. + + Bot detection bypass 봇감지우회 (navigator.webdriver=false). Auto Chrome connection 자동크롬연결. Headless/headed mode. Daemon-based architecture 데몬기반. Interaction Map System 인터랙션맵. React/framework compatibility React/프레임워크호환성. +--- + +# browser-pilot + +## Purpose + +Automate Chrome browser using Chrome DevTools Protocol (CDP) with a daemon-based architecture. Maintains persistent browser connection for instant command execution. Features Smart Mode with Interaction Map for reliable element targeting using text-based search instead of brittle selectors. + +**Always run scripts with `--help` first** to see usage. DO NOT read the source until you try running the script first and find that a customized solution is abslutely necessary. These scripts can be very large and thus pollute your context window. They exist to be called directly as black-box scripts rather than ingested into your context window. + +## When to Use + +Use browser-pilot when tasks involve: +- Browser automation, web scraping, data extraction +- Screenshot capture, PDF generation +- Form filling, login automation, element interaction +- Tab management, cookie control, JavaScript execution +- Tasks requiring text-based element selection ("click the 3rd Delete button") +- Bot detection bypass requirements (navigator.webdriver = false) + +## ⚠️ Important Guidelines + +**When to Ask User:** Use AskUserQuestion tool if: +- Task requirements unclear or ambiguous +- Multiple implementation approaches possible +- Element selectors not working despite troubleshooting +- User intent uncertain (e.g., "automate this" without specifics) + +**DO NOT** guess or assume user requirements. Always clarify first. + +## Prerequisites + +Chrome must be installed. Local scripts initialize automatically on session start (no manual setup required). + +## Getting Help + +All commands support `--help` for detailed options: + +```bash +# See all available commands +node .browser-pilot/bp --help + +# Get help for specific command +node .browser-pilot/bp --help +``` + +## Architecture + +**Daemon-based design:** +- Background daemon maintains persistent CDP connection +- CLI commands communicate via IPC +- Auto-starts on first command, stops at session end +- 30-minute inactivity timeout + +**Interaction Map System:** +- Auto-generates JSON map of interactive elements on page load +- Enables text-based search with automatic selector generation +- Handles duplicates with indexing +- 10-minute cache with auto-regeneration + +## Core Workflow + +### 1. Extract Required Information + +From user's request, identify: +- Target URL(s) to visit +- Actions to perform (screenshot, click, fill, etc.) +- Element identifiers (text content, CSS selectors, or XPath) +- Output file names (for screenshots/PDFs) +- Data to extract or forms to fill + +When information is missing or ambiguous, use AskUserQuestion tool. + +### 2. Execute Commands + +All commands use `.browser-pilot/bp` wrapper script. Replace placeholders with actual values. + +**Navigation:** +```bash +node .browser-pilot/bp navigate -u +node .browser-pilot/bp back +node .browser-pilot/bp forward +node .browser-pilot/bp reload +``` + +**Interaction (Smart Mode - Recommended):** +```bash +# Text-based element search (map auto-generated) +# No quotes for single words +node .browser-pilot/bp click --text Login --type button +node .browser-pilot/bp fill --text Email -v + +# Use quotes when text contains spaces +node .browser-pilot/bp click --text "Sign In" --type button +node .browser-pilot/bp fill --text "Email Address" -v + +# Handle duplicates with indexing +node .browser-pilot/bp click --text Delete --index 2 + +# Filter visible elements only +node .browser-pilot/bp click --text Submit --viewport-only + +# Type aliases (auto-expanded) +node .browser-pilot/bp click --text Search --type input # Matches: input, input-text, input-search, etc. + +# Tag-based filtering (HTML tag) +node .browser-pilot/bp click --text Submit --tag button # Matches all