@agentrhq/webcmd 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +43 -268
  2. package/cli-manifest.json +184 -311
  3. package/clis/_shared/site-auth.js +37 -40
  4. package/clis/_shared/site-auth.test.js +109 -22
  5. package/clis/amazon/auth.js +0 -6
  6. package/clis/band/auth.js +0 -6
  7. package/clis/blinkit/auth.js +13 -40
  8. package/clis/blinkit/blinkit.test.js +39 -2
  9. package/clis/chatgpt/auth.js +0 -6
  10. package/clis/claude/auth.js +0 -6
  11. package/clis/coupang/auth.js +0 -6
  12. package/clis/district/auth.js +0 -2
  13. package/clis/facebook/auth.js +0 -6
  14. package/clis/gemini/auth.js +0 -6
  15. package/clis/github/auth.js +0 -6
  16. package/clis/grok/auth.js +0 -6
  17. package/clis/hackernews/hackernews.test.js +20 -1
  18. package/clis/hackernews/jobs.js +1 -1
  19. package/clis/hf/auth.js +2 -7
  20. package/clis/instagram/auth.js +0 -6
  21. package/clis/linkedin/auth.js +0 -6
  22. package/clis/linkedin-learning/auth.js +0 -6
  23. package/clis/manus/auth.js +0 -6
  24. package/clis/notebooklm/auth.js +0 -6
  25. package/clis/pixiv/auth.js +1 -7
  26. package/clis/practo/login.js +12 -38
  27. package/clis/practo/practo.test.js +13 -9
  28. package/clis/reddit/auth.js +0 -6
  29. package/clis/reuters/auth.js +0 -14
  30. package/clis/suno/auth.js +0 -6
  31. package/clis/tiktok/auth.js +0 -6
  32. package/clis/twitter/auth.js +0 -6
  33. package/clis/upwork/auth.js +0 -6
  34. package/clis/youtube/auth.js +0 -6
  35. package/clis/zepto/auth.js +16 -29
  36. package/clis/zepto/zepto.test.js +45 -2
  37. package/dist/src/browser/cdp.js +3 -1
  38. package/dist/src/browser/cdp.test.js +12 -0
  39. package/dist/src/browser/page.js +6 -2
  40. package/dist/src/browser/page.test.js +1 -0
  41. package/dist/src/browser/protocol.d.ts +2 -0
  42. package/dist/src/browser/runtime/local-cloak/actions.js +42 -21
  43. package/dist/src/browser/runtime/local-cloak/provider.test.js +33 -5
  44. package/dist/src/build-manifest.js +3 -3
  45. package/dist/src/build-manifest.test.js +14 -0
  46. package/dist/src/docs-sync-review.js +2 -2
  47. package/dist/src/docs-sync-review.test.js +2 -2
  48. package/dist/src/hosted/main-lifecycle.test.js +2 -1
  49. package/dist/src/hosted/manifest.test.js +2 -1
  50. package/dist/src/hosted/output-parity.test.js +2 -1
  51. package/dist/src/hosted/root-command-surface.test.js +1 -1
  52. package/dist/src/hosted/runner.test.js +8 -4
  53. package/dist/src/skills.test.js +54 -0
  54. package/hosted-contract.json +191 -366
  55. package/package.json +3 -3
  56. package/skills/webcmd-adapter-author/SKILL.md +2 -0
  57. package/skills/webcmd-autofix/SKILL.md +5 -3
  58. package/skills/webcmd-browser/SKILL.md +12 -11
  59. package/skills/webcmd-usage/SKILL.md +8 -0
  60. package/clis/practo/whoami.js +0 -28
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <img width="2056" height="765" alt="ChatGPT Image Jul 15, 2026, 12_14_45 PM" src="https://github.com/user-attachments/assets/5bcba7ee-588c-4839-9927-4f151055cdf6" />
1
+ <img width="1280" height="640" alt="Webcmd stop paying agents to rediscover the web" src="docs/readme-hero.png" />
2
2
 
3
3
 
4
4
  <p align="center">
@@ -8,7 +8,7 @@
8
8
  <a href="https://www.npmjs.com/package/@agentrhq/webcmd">
9
9
  <img alt="NPM downloads" src="https://img.shields.io/npm/dt/@agentrhq/webcmd.svg?style=for-the-badge&color=1E88E5&labelColor=000000">
10
10
  </a>
11
- <a href="https://docs.webcmd.dev">
11
+ <a href="https://webcmd.dev/docs">
12
12
  <img alt="Documentation" src="https://img.shields.io/badge/docs-webcmd.dev-7C3AED.svg?style=for-the-badge&labelColor=000000">
13
13
  </a>
14
14
  <a href="https://github.com/agentrhq/webcmd/blob/main/LICENSE">
@@ -37,236 +37,71 @@ On top of live browser control, WebCMD adds 3 layers of learnings. Each layer co
37
37
  | 3. CLI authoring | The action space is known, but the path is still too variable for one fixed sequence. | Explicitly author a reusable `webcmd <site>` adapter with structured output, so future agents spend tokens on the task instead of navigation. |
38
38
  | 4. Extend existing CLIs | The workflow is deterministic enough to stop browsing. | Extend the `webcmd <site>` adapter with a tailored command so the workflow runs instantly with the least amount of tokens. |
39
39
 
40
+ ## Demo
40
41
 
41
- ## Quick Start
42
+ https://github.com/user-attachments/assets/04eceadc-d398-4303-984d-ae3197bfa664
42
43
 
43
- ### 1. Install Webcmd
44
+ ## Quick Start
44
45
 
45
- Webcmd requires **Node.js >= 20**.
46
+ Webcmd requires Node.js 20+.
46
47
 
47
48
  ```bash
48
- node --version
49
49
  npm install -g @agentrhq/webcmd
50
- ```
51
-
52
- ### 2. Verify the browser runtime
53
-
54
- ```bash
55
- webcmd doctor
56
- ```
57
-
58
- `doctor` checks the Webcmd browser bridge: daemon status, browser runtime installation, profile selection, and a live connectivity probe. Pure public adapters and local passthrough commands do not need a green browser check, but `COOKIE`, `INTERCEPT`, `UI`, and `webcmd browser` workflows do.
59
-
60
- ### 3. Discover commands
61
-
62
- ```bash
63
- webcmd list
64
- webcmd list -f json
65
- webcmd reddit --help
66
- webcmd reddit hot --help
67
- ```
68
-
69
- `webcmd list -f json` is the source of truth for agents. It emits one row per command with the site, command name, arguments, output columns, browser requirement, and strategy.
70
-
71
- ### 4. Run your first command
72
-
73
- ```bash
74
- webcmd hackernews top --limit 5
75
- webcmd reddit popular --limit 5
76
- webcmd pubmed search "agentic browser automation" --limit 5 -f json
77
- ```
78
-
79
- ## For Humans
80
-
81
- Use Webcmd directly when you want a reliable command instead of a live browser session:
82
-
83
- ```bash
84
- webcmd list
85
- webcmd <site> --help
86
- webcmd <site> <command> --help
87
- webcmd <site> <command> -f yaml
88
- ```
89
-
90
- The everyday surface is intentionally small:
91
-
92
- - `webcmd list` shows every registered adapter and external command.
93
- - `webcmd <site> <command> ...` runs a built-in, plugin, or private adapter.
94
-
95
- For example:
96
-
97
- ```bash
98
- webcmd hackernews top --limit 10
99
- webcmd reddit subreddit programming --limit 10
100
- webcmd twitter whoami
101
- ```
102
-
103
- Adapter commands are tagged by strategy:
104
-
105
- | Strategy | What it means |
106
- |----------|---------------|
107
- | `PUBLIC` | No browser or login. Webcmd can call a public endpoint or page directly. |
108
- | `COOKIE` | Uses the logged-in Webcmd browser profile for authenticated reads. |
109
- | `INTERCEPT` | Uses the browser to capture a signed or stateful request before replaying it. |
110
- | `UI` | Drives the page UI directly. |
111
- | `LOCAL` | Talks to a local app, service, or CLI surface. |
112
-
113
- Output formats are consistent across adapters:
114
-
115
- ```bash
116
- webcmd hackernews top -f table
117
- webcmd hackernews top -f json
118
- webcmd hackernews top -f yaml
119
- webcmd hackernews top -f md
120
- webcmd hackernews top -f csv
121
- ```
122
-
123
- Agents usually want `-f json`; humans usually want table (default) or yaml.
124
-
125
- ## For AI Agents
126
-
127
- Webcmd is designed to be driven by coding agents such as Codex, Claude Code, Cursor, and similar tools.
128
-
129
- ## Add skills (also refreshes existing links)
130
-
131
- Add Webcmd skills to your agent environment:
132
-
133
- ```bash
134
50
  webcmd skills add
135
51
  ```
136
52
 
137
- The command asks whether to add globally or locally, then asks for the coding agent (`agents`, `codex`, `claude`) or a custom skills path. For scripts, pass flags such as `--scope project --provider codex` or `--path ./my-skills`.
138
-
139
- Remove Webcmd skill symlinks from all supported global and current-project locations with `webcmd skills remove`. Pass `--path ./my-skills` to include a custom directory.
140
-
141
- ### Which skill to use
142
-
143
- | Skill | When to use |
144
- |-------|-------------|
145
- | [`webcmd-usage`](./skills/webcmd-usage/SKILL.md) | Orient an agent to Webcmd commands, formats, strategies, plugins, and external CLIs. |
146
- | [`webcmd-browser`](./skills/webcmd-browser/SKILL.md) | Drive a real browser ad hoc: inspect, click, type, extract, network, tabs, waits. |
147
- | [`webcmd-adapter-author`](./skills/webcmd-adapter-author/SKILL.md) | Write or extend a reusable site adapter. |
148
- | [`webcmd-autofix`](./skills/webcmd-autofix/SKILL.md) | Repair an adapter after selectors, APIs, or response shapes drift. |
149
- | [`webcmd-browser-sitemap`](./skills/webcmd-browser-sitemap/SKILL.md) | Use recorded site knowledge while driving a browser task. |
150
- | [`webcmd-sitemap-author`](./skills/webcmd-sitemap-author/SKILL.md) | Capture or update reusable sitemap knowledge for future agents. |
151
- | [`smart-search`](./skills/smart-search/SKILL.md) | Route search and research requests to the right adapter. |
152
-
153
- The common agent workflow is:
154
-
155
- ```bash
156
- webcmd list -f json
157
- webcmd <site> <command> -f json
158
- webcmd <site> <command> --trace retain-on-failure -f json
159
- ```
160
-
161
- Start with adapters. Fall back to `webcmd browser` only when no adapter covers the task or you are teaching Webcmd a new site flow.
53
+ When prompted, choose a supported harness such as Codex or Claude, or enter a custom skills path.
162
54
 
163
- ## Live Browser Interaction
55
+ In your agent harness, load or tag `webcmd-usage`, then describe the outcome you want.
164
56
 
165
- `webcmd browser` gives agents a stable, structured interface to a real browser. Every command takes a session name immediately after `browser` — the session is required, so `webcmd browser tab list` without one is an error:
166
-
167
- ```bash
168
- webcmd browser <session> open https://example.com
57
+ ```text
58
+ Use webcmd to research the latest discussions about browser automation across Hacker News and Reddit, then return a concise comparison with source links.
169
59
  ```
170
60
 
171
- ### Tabs and page IDs
172
-
173
- `webcmd browser work open <url>` and `webcmd browser work tab new [url]` both return a page ID in the `page` field:
61
+ ## What You Can Ask
174
62
 
175
- ```bash
176
- $ webcmd browser work open https://reddit.com
177
- {
178
- "url": "https://reddit.com",
179
- "page": "page-1783484232033-8"
180
- }
181
- ```
63
+ - “Use webcmd to research agentic browser automation on PubMed and return the title, authors, publication date, abstract, and URL for each result.”
64
+ - “Use webcmd to find active AI infrastructure companies in the YC company directory and return the company, batch, description, location, profile URL, and source links. Keep it read-only.”
65
+ - “Use webcmd to look up parts on Grainger by part number and return price, stock, minimum order quantity, lead time, and product URL.”
66
+ - “Use webcmd with my logged-in `work` profile to summarize unread LinkedIn messages from the last seven days and return the sender, subject or opening text, received time, and conversation URL.”
67
+ - “Repair `webcmd reddit popular --limit 10` and keep returning the title, subreddit, score, comment count, and URL.”
68
+ - “Use webcmd to check Grainger part prices and SAP Ariba purchase-order status, then return a combined summary.”
182
69
 
183
- Use `webcmd browser work tab list` to inspect all tabs — each entry carries its page ID (`id`/`page`), the owning `session` (adapter sessions appear as `site:<name>`), and whether it is the currently `selected` tab. Pass `--tab <pageId>` to route a single command to a specific tab:
70
+ ## See It in Action: X CLI
184
71
 
185
- ```bash
186
- webcmd browser work open https://example.com --tab page-1783484232033-8
72
+ ```text
73
+ Use webcmd with my logged-in `social` profile to collect my recent X bookmarks and return the author, text, and URL.
187
74
  ```
188
75
 
189
- `tab new` creates a tab without changing the session's default tab; only `tab select <pageId>` promotes a tab to the default for later untargeted commands in the same session.
190
-
191
- Useful browser primitives include:
192
-
193
- | Area | Commands |
194
- |------|----------|
195
- | Navigation | `open`, `back`, `wait`, `scroll`, `close` |
196
- | Inspection | `state`, `find`, `get`, `frames`, `screenshot`, `extract` |
197
- | Interaction | `click`, `type`, `fill`, `select`, `keys`, `hover`, `focus`, `check`, `uncheck`, `upload`, `drag` |
198
- | Network | `network`, `network --detail <key>`, `network --filter <fields>` |
199
- | Tabs | `tab list`, `tab new`, `tab select`, `tab close`, `bind`, `unbind` |
200
- | Adapter work | `init`, `verify`, `analyze` |
201
-
202
- Every interaction command returns structured data: match count, target identity, confidence level, and machine-readable errors. That contract is why agents can recover from mild DOM drift instead of guessing.
203
-
204
- ### Profiles
205
-
206
- Named profiles let Webcmd keep separate browser identities:
207
-
208
- ```bash
209
- webcmd profile list
210
- webcmd profile rename <context-id> work
211
- webcmd profile use work
212
- webcmd --profile work browser work state
213
- ```
214
-
215
- If multiple browser profiles are connected and no default is selected, Webcmd asks you to choose rather than guessing.
216
-
217
- ## Built-in Commands
218
-
219
- Webcmd ships a large adapter registry. The list changes over time, so use `webcmd list -f json` for the current surface. Highlights include:
220
-
221
- | Site/App | Example commands |
222
- |----------|------------------|
223
- | `hackernews` | `top`, `new`, `best`, `ask`, `show`, `jobs`, `search`, `read`, `user` |
224
- | `reddit` | `hot`, `popular`, `search`, `subreddit`, `read`, `user`, `comment`, `save`, `upvote`, `subscribe` |
225
- | `linkedin` | `search`, `people-search`, `jobs-preferences`, `job-detail`, `profile-read`, `posts`, `inbox`, `safe-send` |
226
- | `twitter` | `trending`, `search`, `timeline`, `tweets`, `post`, `profile`, `bookmarks`, `notifications`, `follow`, `unfollow` |
227
- | `tiktok` | `search`, `explore`, `user`, `creator-videos`, `notifications`, `follow`, `comment`, `like`, `save` |
228
- | `amazon` | `search`, `product`, `offer`, `bestsellers`, `new-releases`, `movers-shakers`, `discussion` |
229
- | `pubmed` | `search`, `article`, `author`, `citations`, `clinical-trial`, `journal`, `mesh`, `related`, `review` |
230
- | `chatgpt` | `ask`, `send`, `new`, `read`, `history`, `detail`, `image`, `deep-research-result`, `model` |
231
- | `claude` | `ask`, `send`, `new`, `read`, `history`, `detail`, `status` |
232
- | `gemini` | `ask`, `new`, `image`, `deep-research`, `deep-research-result`, `models` |
233
- | `notebooklm` | `list`, `open`, `summary`, `source-list`, `source-get`, `source-fulltext`, `generate-audio`, `generate-slides` |
234
-
235
- Current registry size is generated from [`cli-manifest.json`](./cli-manifest.json); this README intentionally lists highlights, not a frozen catalog.
236
-
237
- ## External CLI Hub
76
+ The agent explores the X workflow once using the logged-in profile.
77
+ It creates a stable command that returns the requested bookmark fields.
78
+ Later agents reuse that command instead of repeating browser exploration; learn the pattern in [X → CLI](https://webcmd.dev/docs/x-session-cli).
238
79
 
239
- Webcmd can expose existing command-line tools through the same discovery and invocation surface:
80
+ ## Where Webcmd Works
240
81
 
241
- ```bash
242
- webcmd external install gh
243
- webcmd external register my-tool \
244
- --binary my-tool \
245
- --install "npm i -g my-tool" \
246
- --desc "My internal CLI"
247
- webcmd external list
248
-
249
- webcmd gh pr list --limit 5
250
- webcmd docker ps
251
- ```
82
+ Beyond website adapters, Webcmd can work through authenticated browser sessions, APIs, desktop apps, and local tools.
252
83
 
253
- Built-in external entries include common tools such as `gh`, `docker`, `vercel`, `wrangler`, `obsidian`, `longbridge`, `ntn`, `tg`, `discord`, and `wx`. User overrides live in `~/.webcmd/external-clis.yaml`.
84
+ | Group | Supported surfaces | Representative outcomes |
85
+ | --- | --- | --- |
86
+ | research and communities | Hacker News, Reddit, PubMed | Compare current discussions, find primary research, and return concise summaries with source links. |
87
+ | social and professional | X/Twitter, LinkedIn, TikTok | Collect bookmarks, monitor public posts, or research people and creators with a named profile when needed. |
88
+ | AI tools | ChatGPT, Claude, Gemini, NotebookLM | Retrieve conversations, research outputs, notebooks, and generated materials from the tools you already use. |
89
+ | shopping and bookings | Amazon, Blinkit, Zepto, BigBasket, District, Practo | Compare products, availability, prices, appointments, events, and delivery options. |
254
90
 
255
- ## Plugins
91
+ This list is illustrative; ask your agent to use webcmd to discover what is currently available.
256
92
 
257
- Plugins let you install third-party adapter packs without patching the core registry:
93
+ ## Learn More
258
94
 
259
- ```bash
260
- webcmd plugin install github:user/repo
261
- webcmd plugin list -f json
262
- webcmd plugin update --all
263
- webcmd plugin uninstall <name>
264
- webcmd plugin create <name>
265
- ```
95
+ Webcmd Cloud can run supported commands and browser sessions on hosted infrastructure. It is in active development and is not yet stable.
266
96
 
267
- `plugin create` prompts for the author's display name and GitHub handle. For non-interactive use, pass `--author-name <name>` and `--author-handle <handle>`.
97
+ - [Prompt Cookbook](https://webcmd.dev/docs/agent-prompts)
98
+ - [How Webcmd Works](https://webcmd.dev/docs/concepts)
99
+ - [Local or Cloud](https://webcmd.dev/docs/local-or-cloud)
100
+ - [Publish a Community Plugin](https://webcmd.dev/docs/publish-community-plugin)
101
+ - [X → CLI](https://webcmd.dev/docs/x-session-cli)
102
+ - [Command Surface](https://webcmd.dev/docs/cli-reference)
268
103
 
269
- Use plugins for private company workflows, community adapters, or experiments that are not ready for the built-in registry. This repo is also a plugin monorepo: community plugins promoted here live under [`plugins/`](./plugins/) and are advertised through [`webcmd-plugin.json`](./webcmd-plugin.json).
104
+ ## Community
270
105
 
271
106
  <!-- webcmd-community-plugins:start -->
272
107
  ### Community plugins
@@ -276,69 +111,9 @@ Use plugins for private company workflows, community adapters, or experiments th
276
111
  | [`skyscanner`](./plugins/skyscanner/) | Skyscanner flight search commands for Webcmd | [Rishabh](https://github.com/rishabhraj36) |
277
112
  <!-- webcmd-community-plugins:end -->
278
113
 
279
- ## Writing Adapters
280
-
281
- When a site is not covered yet, author a reusable adapter instead of leaving an agent to spend tokens clicking through the same browser flow every time.
282
-
283
- ```bash
284
- webcmd browser init <site>/<command>
285
- webcmd validate <site>/<command>
286
- webcmd verify <site>/<command> --smoke
287
- webcmd browser work verify <site>/<command>
288
- ```
289
-
290
- Adapter files import the public Webcmd registry/error APIs:
291
-
292
- ```js
293
- import { cli, Strategy } from '@agentrhq/webcmd/registry';
294
- import { CommandExecutionError } from '@agentrhq/webcmd/errors';
295
- ```
296
-
297
- Private adapters can live in `~/.webcmd/clis/<site>/<command>.js`; bundled upstream adapters live in [`clis/`](./clis/), while community upstream adapters live as plugins under [`plugins/`](./plugins/). For the full authoring workflow, install and use [`webcmd-adapter-author`](./skills/webcmd-adapter-author/SKILL.md).
298
-
299
- ## Configuration
300
-
301
- | Variable | Default | Description |
302
- |----------|---------|-------------|
303
- | `WEBCMD_PROFILE` | none | Browser runtime profile alias/context ID to use when multiple profiles are available. |
304
- | `WEBCMD_WINDOW` | command-specific | `foreground` or `background` browser window mode. |
305
- | `WEBCMD_BROWSER_CONNECT_TIMEOUT` | `45` | Seconds to wait for the browser bridge. |
306
- | `WEBCMD_BROWSER_COMMAND_TIMEOUT` | `60` | Seconds to wait for one browser command. |
307
- | `WEBCMD_CDP_ENDPOINT` | none | Manual CDP endpoint for remote browsers or Electron apps. |
308
- | `WEBCMD_CDP_TARGET` | none | Filter CDP targets by URL substring. |
309
- | `WEBCMD_CACHE_DIR` | `~/.webcmd/cache` | Browser state and network capture cache. |
310
- | `WEBCMD_VERBOSE` | `false` | Enable verbose logs. Also enabled by `-v`. |
311
-
312
- Common paths:
313
-
314
- | Path | Purpose |
315
- |------|---------|
316
- | `~/.webcmd/` | User-level Webcmd state. |
317
- | `~/.webcmd/clis/` | Private adapters. |
318
- | `~/.webcmd/cache/browser-network/` | Cached browser network captures. |
319
- | `~/.webcmd/external-clis.yaml` | User external CLI registry entries. |
320
- | `~/.agents/skills/` | Common global skills directory for agent skill managers. |
321
- | `.agents/skills/` | Common workspace-local skills directory. |
322
-
323
- ## Troubleshooting
324
-
325
- - **Browser bridge is unavailable**: run `webcmd doctor -v` and follow the daemon/profile/runtime hint it prints.
326
- - **Multiple profiles are connected**: run `webcmd profile list`, then `webcmd profile use <name>` or pass `--profile <name>`.
327
- - **Authenticated adapter returns empty or unauthorized**: log into the target site in the Webcmd-managed browser profile, then retry.
328
- - **A site changed and an adapter fails**: rerun with `--trace retain-on-failure -f json`, inspect the trace summary, and use `webcmd-autofix`.
329
- - **A browser target is stale**: run `webcmd browser <session> state` again and use the fresh numeric ref or locator.
330
- - **Node errors on startup**: Webcmd requires Node.js >= 20. Check `node --version`.
331
-
332
- ## Development
333
-
334
- ```bash
335
- npm install
336
- npm test
337
- npm run typecheck
338
- npm run build
339
- ```
114
+ ## Contributing
340
115
 
341
- Release engineering, Conventional Commits, CI, and npm publishing notes live in [`CONTRIBUTING.md`](./CONTRIBUTING.md).
116
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
342
117
 
343
118
  ## License
344
119