# Opencli Usage > Punto de partida de cualquier sesión de OpenCLI: mapa de lo que puede hacer, cómo descubrir adapters, qué flags y formatos de salida son universales, y qué skill especializada cargar después. Fuente: https://skillsagentes.com/skills/jackwener/opencli/opencli-usage Markdown: https://skillsagentes.com/skills/jackwener/opencli/opencli-usage.md Repositorio: https://github.com/jackwener/OpenCLI Autor: jackwener Licencia: Apache-2.0 Actualizado: el mes pasado Coste de contexto: 75 tok instalada, 2.6k tok al activarse, 2.6k tok con todos los archivos del bundle Bundle: 1 archivo, 10 KB Permisos que pide: bash(opencli:*), read ## Instalación Un skill son archivos markdown: los mismos archivos valen para cualquier agente y lo único que cambia es el directorio de destino, es decir la bandera `--agent`. Añade `-g` para instalarlo en todos los proyectos de la máquina. ```bash # Claude Code npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent claude-code # Cursor npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent cursor # Codex npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent codex # Gemini CLI npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent gemini # Windsurf npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent windsurf # Cline npx -y skills add jackwener/OpenCLI --skill opencli-usage --agent cline ``` ## Qué hace - Explica los tres pilares de OpenCLI: comandos adapter, conducción de navegador (opencli browser) y passthrough de CLIs externas. - Enseña a descubrir adapters instalados con opencli list en vez de memorizar una lista fija. - Documenta flags universales (-f/--format, -v), formatos de salida y variables de entorno. - Indica a qué skill saltar según la tarea: opencli-browser, opencli-adapter-author, opencli-autofix o smart-search. ## Cuándo usarla - Al empezar cualquier sesión de OpenCLI, antes de saber qué comando usar. - Cuando se pregunta qué puede hacer opencli o cómo encontrar el comando correcto. ## Qué la activa - "¿Qué puede hacer opencli?" - "¿Cómo encuentro el comando de OpenCLI para este sitio?" - "Lista los adapters instalados de OpenCLI" ## Antes de instalar - Requiere opencli instalado (npm install -g @jackwener/opencli) y Node >= 21. - Necesita en el PATH: git, npm, npx ## Archivos - SKILL.md — 10 KB ## SKILL.md Reproducido tal cual desde jackwener/OpenCLI bajo Apache-2.0. Esta sección es el documento original y está en inglés. # opencli-usage OpenCLI turns any website, Electron desktop app, or external CLI into a uniform `opencli ` surface that agents can drive without screen-scraping. This skill is the orientation layer — once you know what you want to do, load one of the specialized skills below. ## The three pillars - **Adapter commands** — `opencli [...]`. Built-in adapters live in `clis/`, user adapters in `~/.opencli/clis/`. Each is backed by a strategy (`PUBLIC | COOKIE | INTERCEPT | UI | LOCAL`) that tells you whether a Chrome session is needed. - **Browser driving** — `opencli browser *` subcommands (`open`, `state`, `click`, `type`, `select`, `find`, `extract`, `network`, …) for ad-hoc interaction and scraping when no adapter covers the task. See `opencli-browser`. - **Current-tab binding** — `opencli browser bind` attaches the Chrome tab the user already opened/logged into to that browser session. Follow-up commands use `opencli browser ...`. See `opencli-browser` before using it; bound sessions still block tab mutation. - **External CLI passthrough** — `opencli gh`, `opencli docker`, `opencli vercel`, etc. Managed via `opencli external install ` (auto-install from `external-clis.yaml`) or `opencli external register ` (bring your own). ## Install ```bash # npm global npm install -g @jackwener/opencli # binary: opencli, requires Node >= 21 opencli doctor # run before browser-dependent work (see below) # From source git clone git@github.com:jackwener/OpenCLI.git cd OpenCLI && npm install npx tsx src/main.ts # same surface, no global install ``` `opencli doctor` prints a structured `DoctorReport` — daemon status, extension connection, version checks, and a live browser connectivity probe. Scope is narrow: it diagnoses the **browser bridge** (daemon + extension + Chrome wiring). `PUBLIC` / `LOCAL` adapters, `opencli list`, `validate`, `verify`, plugin commands, and external-CLI passthrough don't need it to be green — only `COOKIE` / `INTERCEPT` / `UI` adapters and the `opencli browser *` subcommands do. Flag: `-v` (verbose). ## Prerequisites by command type | Strategy tag on `opencli list` | What it needs | |--------------------------------|---------------| | `PUBLIC` | Nothing — pure HTTP, no browser. | | `COOKIE` | Chrome logged into the target site + **OpenCLI** extension installed from the [Chrome Web Store](https://chromewebstore.google.com/detail/opencli/ildkmabpimmkaediidaifkhjpohdnifk). Command captures the credential from your live session — no re-login. | | `INTERCEPT` | Same as COOKIE, plus opencli opens an automation window to capture a signed request. | | `UI` | Same as COOKIE, full DOM interaction. | | `LOCAL` | No browser; talks to a local/dev endpoint. | Electron desktop apps (cursor, codex, chatwise, discord-app, doubao-app, antigravity, chatgpt-app) route through CDP against the running app — same cookie-less flow as a logged-in browser. Make sure the app is running before invoking. ## Discover what's installed — don't read this file, run a command ```bash opencli list # table, grouped by site opencli list -f json # machine-readable; pipe to jq or your agent opencli list | grep -i twitter # find commands for a specific site opencli --help # see that site's commands + flags opencli --help # see positional args and command-specific flags ``` Do not hard-code adapter lists — there are 100+ sites and the count moves every week. `opencli list -f json` is the source of truth; it emits one entry per command with `{site, name, aliases, description, strategy, browser, args, columns, ...}`. For an agent, that is always better than grepping a doc. Before falling back to raw `opencli browser` commands on high-change authenticated sites, check whether a site adapter already exposes the workflow. For example, ChatGPT web has higher-level commands for conversation reads and Deep Research result extraction; discover the current surface with `opencli chatgpt --help` or `opencli list -f json`. ## Universal flags (work on every adapter command) | flag | effect | |------|--------| | `-f, --format ` | `table` (default in TTY) · `yaml` (default in non-TTY) · `json` · `plain` · `md` · `csv`. Pass explicitly when you want a specific shape; agents almost always want `-f json`. | | `-v, --verbose` | Debug logs + stack traces on failure; also sets `OPENCLI_VERBOSE=1` for the process. | Command-specific flags (`--limit`, `--tab`, `--filter`, …) are not universal — consult ` --help`. ## Output formats - `json` — pretty-printed, 2-space indent. Default choice for agents. - `plain` — prints a single primary field for chat-style commands (`response`/`content`/`text`/`value`). Useful for piping to another tool. - `yaml` — fallback when output is not a TTY and `-f` is not explicit. - `table` — color-coded, site-grouped; meant for humans. - `md`, `csv` — straightforward tabular dumps. A few commands override the default via `cmd.defaultFormat` (e.g. chat commands default to `plain`), so don't assume without reading `--help`. ## Environment variables | variable | default | purpose | |----------|---------|---------| | `OPENCLI_BROWSER_CONNECT_TIMEOUT` | `45` | Seconds to wait for the browser bridge. | | `OPENCLI_BROWSER_COMMAND_TIMEOUT` | `60` | Per-command timeout. | | `OPENCLI_CDP_ENDPOINT` | — | Manual CDP endpoint override (dev / remote Chrome / Electron). | | `OPENCLI_CACHE_DIR` | `~/.opencli/cache` | Network capture + browser-state cache. | | `OPENCLI_WINDOW` | command-specific | `foreground` or `background` browser window mode. | | `OPENCLI_VERBOSE` | `false` | Verbose logging (also triggered by `-v`). | ## Self-repair When an adapter command fails because the site changed (selectors drifted, API rotated, response schema shifted), re-run with `--trace retain-on-failure`. The error envelope includes a `trace` block pointing at `summary.md`; patch only the `adapterSourcePath` from that summary and retry. Max 3 repair rounds. The full flow is in `opencli-autofix`. ## Writing your own adapter Two-path storage: - **Private**: `~/.opencli/clis//.js` — no build step, hot-available, not visible in the public package. - **Public / PR**: `clis//.js` — for upstream contribution; requires build. Scaffolding & verification: ```bash opencli browser init / # generates a skeleton opencli validate [target] # semantic checks on the loaded registry (description, domain, pipeline step names, func|pipeline|_lazy presence, arg duplicates) — no network, no browser opencli verify [target] [--smoke] # run the command with synthetic args opencli browser verify / # end-to-end smoke inside the bridge ``` Adapters import only `@jackwener/opencli/registry` and `@jackwener/opencli/errors`. `columns` must align 1:1 (in name and order) with keys of the object returned by `func`. For the full workflow see `opencli-adapter-author`. ## Plugins Plugins are third-party extensions pulled from git, separate from the main adapter registry: ```bash opencli plugin install github:user/repo # install opencli plugin list [-f json] # see installed opencli plugin update [name] | --all # keep current opencli plugin uninstall opencli plugin create # scaffold a new plugin ``` ## External CLI passthrough Wraps external command-line tools so you can discover + invoke them through the same `opencli …` entrypoint: ```bash opencli external install gh # auto-install via brew/apt/npm per external-clis.yaml opencli external register my-tool \ --binary my-tool \ --install "npm i -g my-tool" \ --desc "My internal CLI" opencli external list opencli gh pr list --limit 5 # passthrough; stdio is inherited, exit code propagated opencli docker ps ``` Built-in entries live in `src/external-clis.yaml`; user overrides and additions in `~/.opencli/external-clis.yaml`. Commonly shipped: `gh`, `docker`, `vercel`, `lark-cli`, `longbridge`, `dws`, `wecom-cli`, `obsidian`, `ntn`, `tg(tg-cli)`, `discord(discord-cli)`, `wx(wx-cli)`. Some official CLIs use shell-script installers instead of a shell-free package-manager command. Entries without an `install` config, such as `ntn`, must be installed manually from their homepage before passthrough use. ## Shell completion ```bash opencli completion bash # also: zsh, fish # -> script on stdout; source or save per your shell's convention ``` ## Where to go next | If you're about to… | Load this skill | |---------------------|-----------------| | Drive a live browser ad-hoc (no adapter available, or prototyping) | `opencli-browser` | | Write a new adapter, or add a command to an existing site | `opencli-adapter-author` | | Fix a broken adapter after a command failure | `opencli-autofix` | | Route a search / lookup / research request to the right adapter | `smart-search` | ## Commands that used to exist The following were removed in the PR #1094 consolidation — don't try to invoke them: - `opencli explore ` — superseded by `opencli browser network` + `opencli browser find` for live API discovery, and by the `opencli-adapter-author` workflow for capture. - `opencli record ` — removed; manual capture now lives in `opencli browser network --detail`. - `opencli web read` / `opencli desktop *` as top-level groups — folded into their respective adapters (`opencli web read` still exists as the `web` adapter's `read` command, but there is no standalone `web` / `desktop` top-level group command). ## Don't - Don't paste this skill's command list into your plan; it will rot. Call `opencli list -f json` at the start of a task instead. - Don't assume every adapter needs a browser — strategy `PUBLIC` and `LOCAL` don't. Check the `strategy` field. - Don't silently fall back from a failing adapter to a hand-rolled `fetch` — `--trace retain-on-failure` gives you the browser evidence and adapter source path. Do that first. ## Dónde encaja - Categoría: [Herramientas para desarrolladores](https://skillsagentes.com/categorias/herramientas-desarrollo.md) — Skills que cambian cómo tu agente escribe, revisa y despliega código. - Creador: [jackwener](https://skillsagentes.com/creators/jackwener.md) — 8 skills en el directorio - [Todas las skills](https://skillsagentes.com/skills.md) - [Ranking de instalaciones](https://skillsagentes.com/ranking.md) ## Otras skills del mismo repositorio - [Opencli Adapter Author](https://skillsagentes.com/skills/jackwener/opencli/opencli-adapter-author.md): Guía de extremo a extremo para escribir un adapter de OpenCLI para un sitio nuevo o un comando nuevo, desde el reconocimiento hasta la decodificación de campos y la verificación. Sustituye a opencli-oneshot y opencli-explorer. - [Opencli Sitemap Author](https://skillsagentes.com/skills/jackwener/opencli/opencli-sitemap-author.md): Para crear o mantener sitemaps de OpenCLI orientados a agentes: navegación, estado de página, acciones, workflows, referencias de API y fallbacks de un sitio. Úsalo tras explorar el navegador o cuando el sitemap quede obsoleto. - [Opencli Browser](https://skillsagentes.com/skills/jackwener/opencli/opencli-browser.md): Para cuando un agente necesita conducir una ventana real de Chrome con opencli: inspeccionar una página, rellenar formularios, seguir flujos con sesión iniciada o extraer datos puntuales. No es para escribir adapters. - [Opencli Browser Sitemap](https://skillsagentes.com/skills/jackwener/opencli/opencli-browser-sitemap.md): Guía para consumir de forma perezosa los sitemaps de un sitio al navegar con opencli browser: elige entre adapter y fallback, retoma desde firmas de estado y marca entradas obsoletas sin confiar más en ellas que en el navegador real. - [Smart Search](https://skillsagentes.com/skills/jackwener/opencli/smart-search.md): Router de búsqueda inteligente basado en comandos opencli: dirige cada consulta a la mejor fuente cuando hay que buscar o investigar información en sitios, redes sociales, noticias, compras, viajes, empleo, finanzas o contenido en chino. --- Skills Agentes · [Índice de páginas en markdown](https://skillsagentes.com/sitemap.md) · [Inicio](https://skillsagentes.com/index.md)