Managed Chrome CDP (prewarm + reusable cookies)
Use this when Chrome remote debugging (CDP) is blocked on first launch until enterprise policy is cached to disk.
Tool
- •Script:
~/.codex/skills/managed-chrome-cdp/scripts/browser-tools.ts - •First run auto-installs pinned deps into
scripts/.cache/(override cache root withBROWSER_TOOLS_CACHE_DIR).
Quick start
- •Start a headless CDP Chrome using a persistent profile dir:
- •
bun ~/.codex/skills/managed-chrome-cdp/scripts/browser-tools.ts start --headless --port 9333 - •Default profile:
.dev/chrome-cdp-profile(relative to your current directory)
- •
Login flow (cookie reuse)
- •Check if automation can access the portal:
- •
bun ~/.codex/skills/managed-chrome-cdp/scripts/browser-tools.ts ensure-auth "<url>" --port 9333
- •
- •If it says login is required:
- •
bun ~/.codex/skills/managed-chrome-cdp/scripts/browser-tools.ts login "<url>" --port 9333 - •This opens a headed Chrome for you to complete login, then restarts headless by default (so it won’t grab focus during automation).
- •
Reset / recovery
- •If the profile gets wedged/corrupted (or CDP won’t come up), reset it:
- •
bun ~/.codex/skills/managed-chrome-cdp/scripts/browser-tools.ts reset-profile --force - •Then re-run
startandloginas needed.
- •
Notes
- •Don’t run multiple Chrome instances using the same
--profile-dirat once (Chrome profile lock). - •The default profile dir is gitignored automatically when running inside a git repo.
- •The script may append
**/.dev/chrome-cdp-profile/to.gitignoreand.git/info/exclude(when using the default profile dir). - •
content/searchinject third-party JS fromunpkg.com(Readability/Turndown) into the page to extract readable text; avoid on sensitive pages if that trust boundary is a concern.