@agentrhq/webcmd 0.2.4 → 0.2.5
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.
package/README.md
CHANGED
|
@@ -258,7 +258,7 @@ webcmd plugin uninstall <name>
|
|
|
258
258
|
webcmd plugin create <name>
|
|
259
259
|
```
|
|
260
260
|
|
|
261
|
-
Use plugins for private company workflows, community adapters, or experiments that are not ready for the built-in registry.
|
|
261
|
+
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 CLIs promoted here live under [`plugins/`](./plugins/) and are advertised through [`webcmd-plugin.json`](./webcmd-plugin.json).
|
|
262
262
|
|
|
263
263
|
## Writing Adapters
|
|
264
264
|
|
|
@@ -278,7 +278,7 @@ import { cli, Strategy } from '@agentrhq/webcmd/registry';
|
|
|
278
278
|
import { CommandExecutionError } from '@agentrhq/webcmd/errors';
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
Private adapters can live in `~/.webcmd/clis/<site>/<command>.js`; upstream adapters live in [`clis/`](./clis/). For the full authoring workflow, install and use [`webcmd-adapter-author`](./skills/webcmd-adapter-author/SKILL.md).
|
|
281
|
+
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).
|
|
282
282
|
|
|
283
283
|
## Configuration
|
|
284
284
|
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@ Continue only when all three answers are yes.
|
|
|
28
28
|
|
|
29
29
|
## Top-Level Decision Tree
|
|
30
30
|
|
|
31
|
-
**Choose the strategy before writing the adapter.** Every time you reach Step 3 or Step 4, and before writing code, produce a strategy note. Without that note, do not start
|
|
31
|
+
**Choose the strategy before writing the adapter.** Every time you reach Step 3 or Step 4, and before writing code, produce a strategy note. Without that note, do not start an adapter file.
|
|
32
32
|
|
|
33
33
|
The core question is not whether an API is more elegant than DOM work. The core question is whether the data source has an external contract. Public or official interfaces are usually the most stable. UI/DOM semantics often have a user-visible contract too. Undocumented in-site XHR, GraphQL, or signature endpoints drift the most. Do not move a stable UI/DOM implementation to an uncontracted internal endpoint just to be "API-first."
|
|
34
34
|
|
|
@@ -253,7 +253,7 @@ Check these off step by step:
|
|
|
253
253
|
- **The `browser:` field determines the `func` signature:** `browser:false -> (args)`, `browser:true -> (page, args)`. If this is reversed, `args` may actually be a debug flag and all external parameters can silently fall back to defaults.
|
|
254
254
|
- Throw the correct typed error for known failures according to [`references/typed-errors.md`](./references/typed-errors.md). **Do not** silently `return []`, **do not** silently `return [{sentinel}]`, and **do not** silently clamp external parameters with `Math.max/min`.
|
|
255
255
|
- **Persistent sessions keep stale DOM between commands.** `siteSession: 'persistent'` shares one tab per site; leftover modals/drawers from the previous command leak into the next one. State-sensitive write commands (checkout flows) should add `freshPage: true` (new tab, same lease — cookies/login/location survive). Verify session-scoped context (login, selected city/date) *before* side effects, and embed such context in URLs/IDs your command emits for sibling commands. See `references/adapter-template.md` and "Persistent Sessions and State Hygiene" in `docs/authoring.mdx`.
|
|
256
|
-
- For private
|
|
256
|
+
- For private iteration, write `~/.webcmd/clis/<site>/<name>.js` to avoid a build. When the user says to promote a CLI, create a main-repo plugin with `webcmd plugin create <site> --dir plugins/<site>`, copy the real command files into it, delete scaffold sample commands, register it in root `webcmd-plugin.json`, remove the local `~/.webcmd/clis/<site>` shadow, install the plugin, then run `webcmd validate <site>` and smoke commands. See `references/adapter-template.md` for details.
|
|
257
257
|
- Write site memory every round: no memory -> use skill -> produce memory -> next time becomes a five-minute task.
|
|
258
258
|
- **After a site's first command passes verify, stop and ask the user for their use cases before recommending next set of commands.** See Runbook Step 13.
|
|
259
259
|
- **Raw dumps, packet captures, and HTML samples from debugging may only be written to `~/.webcmd/sites/<site>/fixtures/` or `/tmp/`. Never leave `.dbg-*.html`, `raw-*.json`, `sample.*`, or similar temporary files in the repo root, `clis/<site>/`, or the current working directory.**
|
|
@@ -16,10 +16,32 @@ Write the working file at:
|
|
|
16
16
|
~/.webcmd/clis/<site>/<name>.js
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Promote a community CLI to the main repo as a plugin:
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
|
|
21
|
+
```bash
|
|
22
|
+
webcmd plugin create <site> --dir plugins/<site> --description "<site> commands for Webcmd"
|
|
23
|
+
cp ~/.webcmd/clis/<site>/*.js plugins/<site>/
|
|
24
|
+
rm plugins/<site>/hello.ts plugins/<site>/greet.ts 2>/dev/null || true
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then add `<site>` to the root `webcmd-plugin.json` `plugins` map:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
"<site>": {
|
|
31
|
+
"path": "plugins/<site>",
|
|
32
|
+
"version": "0.1.0",
|
|
33
|
+
"description": "<site> commands for Webcmd",
|
|
34
|
+
"webcmd": ">=0.2.0"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Before handing off, remove the private shadow and prove the plugin path works:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
rm -rf ~/.webcmd/clis/<site>
|
|
42
|
+
webcmd plugin install file://$PWD/plugins/<site>
|
|
43
|
+
webcmd validate <site>
|
|
44
|
+
webcmd <site> <command> --help
|
|
23
45
|
```
|
|
24
46
|
|
|
25
47
|
## Minimal Registry Shape
|
|
@@ -18,7 +18,7 @@ Hard stops before any code change:
|
|
|
18
18
|
|
|
19
19
|
Scope constraint:
|
|
20
20
|
|
|
21
|
-
- Modify only the file at `adapterSourcePath` in the trace `summary.md` front matter. That path is authoritative and may be `clis/<site>/...` in the repo or `~/.webcmd/clis/<site>/...` for user-local installs.
|
|
21
|
+
- Modify only the file at `adapterSourcePath` in the trace `summary.md` front matter. That path is authoritative and may be `clis/<site>/...` in the repo or `plugins/<site>/...` in a plugin repo or `~/.webcmd/clis/<site>/...` for user-local installs.
|
|
22
22
|
- Never modify `src/`, `extension/`, `tests/`, `package.json`, or `tsconfig.json` during autofix.
|
|
23
23
|
|
|
24
24
|
Retry budget: maximum **3 repair rounds** per failure. A round is diagnose -> patch -> retry. If 3 rounds do not resolve it, stop and report what was tried.
|
|
@@ -10,7 +10,7 @@ Webcmd turns websites, Electron desktop apps, and external CLIs into a uniform `
|
|
|
10
10
|
|
|
11
11
|
## The Three Pillars
|
|
12
12
|
|
|
13
|
-
- **Adapter commands:** `webcmd <site> <command> [...]`. Built-in adapters live in `clis/`;
|
|
13
|
+
- **Adapter commands:** `webcmd <site> <command> [...]`. Built-in adapters live in `clis/`; community adapters promoted to the main repo live as plugins under `plugins/`; private iteration adapters live in `~/.webcmd/clis/`. Each command has a strategy such as `PUBLIC`, `COOKIE`, `INTERCEPT`, `UI`, or `LOCAL`.
|
|
14
14
|
- **Browser driving:** `webcmd browser *` subcommands (`open`, `state`, `click`, `type`, `select`, `find`, `extract`, `network`) for ad-hoc interaction when no adapter covers the task. See `webcmd-browser`.
|
|
15
15
|
- **External CLI passthrough:** `webcmd gh`, `webcmd docker`, `webcmd vercel`, and similar wrappers. Manage them with `webcmd external install <name>` or `webcmd external register <name>`.
|
|
16
16
|
|
|
@@ -102,10 +102,13 @@ The error envelope includes a `trace` block pointing at `summary.md`. Patch only
|
|
|
102
102
|
|
|
103
103
|
## Writing An Adapter
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Storage paths:
|
|
106
106
|
|
|
107
107
|
- Private: `~/.webcmd/clis/<site>/<command>.js`
|
|
108
|
-
- Public
|
|
108
|
+
- Public (official bundle): `clis/<site>/<command>.js`
|
|
109
|
+
- Public (community PRs): `plugins/<site>/` plus root `webcmd-plugin.json` registration
|
|
110
|
+
|
|
111
|
+
The main Webcmd repo is itself a plugin monorepo: promoted community CLIs belong under `plugins/<site>/` and must be registered in the root `webcmd-plugin.json`.
|
|
109
112
|
|
|
110
113
|
Scaffolding and checks:
|
|
111
114
|
|
|
@@ -126,9 +129,12 @@ webcmd plugin list [-f json]
|
|
|
126
129
|
webcmd plugin update [name] | --all
|
|
127
130
|
webcmd plugin uninstall <name>
|
|
128
131
|
webcmd plugin create <name>
|
|
132
|
+
webcmd plugin search [query]
|
|
129
133
|
```
|
|
130
134
|
|
|
131
|
-
Plugins are
|
|
135
|
+
Plugins are installable extensions pulled from git or local paths. Main-repo community CLIs are exposed through the root plugin catalog manifest, not bundled into npm's `clis/` set.
|
|
136
|
+
|
|
137
|
+
> **Note:** The repository's `plugins/` directory is not shipped in the npm package. Find the required plugin with `webcmd plugin search`, then install its `installSource` with `webcmd plugin install <installSource>`.
|
|
132
138
|
|
|
133
139
|
## External CLI Passthrough
|
|
134
140
|
|