@zenalexa/unicli 0.217.3 → 0.218.1

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 (149) hide show
  1. package/AGENTS.md +51 -194
  2. package/README.md +2 -2
  3. package/README.zh-CN.md +2 -2
  4. package/dist/bin/unicli-mcp.d.ts +10 -0
  5. package/dist/bin/unicli-mcp.d.ts.map +1 -0
  6. package/dist/bin/unicli-mcp.js +10 -0
  7. package/dist/bin/unicli-mcp.js.map +1 -0
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +12 -1
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands/auth.d.ts +1 -0
  12. package/dist/commands/auth.d.ts.map +1 -1
  13. package/dist/commands/auth.js +250 -0
  14. package/dist/commands/auth.js.map +1 -1
  15. package/dist/commands/dev.js +1 -0
  16. package/dist/commands/dev.js.map +1 -1
  17. package/dist/commands/health.d.ts.map +1 -1
  18. package/dist/commands/health.js +1 -0
  19. package/dist/commands/health.js.map +1 -1
  20. package/dist/commands/lint.d.ts.map +1 -1
  21. package/dist/commands/lint.js +15 -6
  22. package/dist/commands/lint.js.map +1 -1
  23. package/dist/commands/repair.d.ts +1 -0
  24. package/dist/commands/repair.d.ts.map +1 -1
  25. package/dist/commands/repair.js +103 -61
  26. package/dist/commands/repair.js.map +1 -1
  27. package/dist/engine/chromium-cookies-platform.d.ts +69 -0
  28. package/dist/engine/chromium-cookies-platform.d.ts.map +1 -0
  29. package/dist/engine/chromium-cookies-platform.js +315 -0
  30. package/dist/engine/chromium-cookies-platform.js.map +1 -0
  31. package/dist/engine/chromium-cookies-types.d.ts +26 -0
  32. package/dist/engine/chromium-cookies-types.d.ts.map +1 -0
  33. package/dist/engine/chromium-cookies-types.js +16 -0
  34. package/dist/engine/chromium-cookies-types.js.map +1 -0
  35. package/dist/engine/chromium-cookies.d.ts +56 -0
  36. package/dist/engine/chromium-cookies.d.ts.map +1 -0
  37. package/dist/engine/chromium-cookies.js +361 -0
  38. package/dist/engine/chromium-cookies.js.map +1 -0
  39. package/dist/engine/cookies.d.ts +13 -5
  40. package/dist/engine/cookies.d.ts.map +1 -1
  41. package/dist/engine/cookies.js +55 -9
  42. package/dist/engine/cookies.js.map +1 -1
  43. package/dist/engine/executor.d.ts +8 -0
  44. package/dist/engine/executor.d.ts.map +1 -1
  45. package/dist/engine/executor.js +1 -1
  46. package/dist/engine/executor.js.map +1 -1
  47. package/dist/engine/kernel/execute.d.ts.map +1 -1
  48. package/dist/engine/kernel/execute.js +1 -0
  49. package/dist/engine/kernel/execute.js.map +1 -1
  50. package/dist/engine/repair/quarantine-discovery.d.ts +25 -0
  51. package/dist/engine/repair/quarantine-discovery.d.ts.map +1 -0
  52. package/dist/engine/repair/quarantine-discovery.js +78 -0
  53. package/dist/engine/repair/quarantine-discovery.js.map +1 -0
  54. package/dist/engine/steps/navigate.d.ts +1 -1
  55. package/dist/engine/steps/navigate.d.ts.map +1 -1
  56. package/dist/engine/steps/navigate.js +5 -1
  57. package/dist/engine/steps/navigate.js.map +1 -1
  58. package/dist/engine/template.d.ts +14 -4
  59. package/dist/engine/template.d.ts.map +1 -1
  60. package/dist/engine/template.js +93 -65
  61. package/dist/engine/template.js.map +1 -1
  62. package/dist/engine/verify-row-shape.d.ts +17 -0
  63. package/dist/engine/verify-row-shape.d.ts.map +1 -0
  64. package/dist/engine/verify-row-shape.js +36 -0
  65. package/dist/engine/verify-row-shape.js.map +1 -0
  66. package/dist/fast-path/handlers/adapter.d.ts +15 -0
  67. package/dist/fast-path/handlers/adapter.d.ts.map +1 -0
  68. package/dist/fast-path/handlers/adapter.js +169 -0
  69. package/dist/fast-path/handlers/adapter.js.map +1 -0
  70. package/dist/fast-path/handlers/discovery.d.ts +14 -0
  71. package/dist/fast-path/handlers/discovery.d.ts.map +1 -0
  72. package/dist/fast-path/handlers/discovery.js +280 -0
  73. package/dist/fast-path/handlers/discovery.js.map +1 -0
  74. package/dist/fast-path/manifest.d.ts +47 -0
  75. package/dist/fast-path/manifest.d.ts.map +1 -0
  76. package/dist/fast-path/manifest.js +32 -0
  77. package/dist/fast-path/manifest.js.map +1 -0
  78. package/dist/fast-path/parsed-argv.d.ts +16 -0
  79. package/dist/fast-path/parsed-argv.d.ts.map +1 -0
  80. package/dist/fast-path/parsed-argv.js +6 -0
  81. package/dist/fast-path/parsed-argv.js.map +1 -0
  82. package/dist/fast-path/policy.d.ts +25 -0
  83. package/dist/fast-path/policy.d.ts.map +1 -0
  84. package/dist/fast-path/policy.js +96 -0
  85. package/dist/fast-path/policy.js.map +1 -0
  86. package/dist/fast-path/render.d.ts +26 -0
  87. package/dist/fast-path/render.d.ts.map +1 -0
  88. package/dist/fast-path/render.js +200 -0
  89. package/dist/fast-path/render.js.map +1 -0
  90. package/dist/fast-path.d.ts +8 -10
  91. package/dist/fast-path.d.ts.map +1 -1
  92. package/dist/fast-path.js +66 -810
  93. package/dist/fast-path.js.map +1 -1
  94. package/dist/manifest.json +7 -6
  95. package/dist/transport/adapters/cdp-browser.d.ts +6 -6
  96. package/dist/transport/adapters/cdp-browser.js +7 -7
  97. package/dist/transport/adapters/cdp-browser.js.map +1 -1
  98. package/dist/transport/adapters/subprocess.d.ts +4 -4
  99. package/dist/transport/adapters/subprocess.js +4 -4
  100. package/package.json +22 -8
  101. package/server.json +44 -0
  102. package/skills/README.md +39 -0
  103. package/skills/talk-normal/SKILL.md +25 -0
  104. package/skills/talk-normal/prompt.md +35 -0
  105. package/skills/unicli/SKILL.md +389 -0
  106. package/skills/unicli/references/auth.md +188 -0
  107. package/skills/unicli/references/output.md +238 -0
  108. package/skills/unicli/references/sites.md +259 -0
  109. package/skills/unicli-browser/SKILL.md +99 -0
  110. package/skills/unicli-claude-code/SKILL.md +172 -0
  111. package/skills/unicli-explorer/SKILL.md +90 -0
  112. package/skills/unicli-hermes/SKILL.md +83 -0
  113. package/skills/unicli-oneshot/SKILL.md +59 -0
  114. package/skills/unicli-operate/SKILL.md +113 -0
  115. package/skills/unicli-repair/SKILL.md +209 -0
  116. package/skills/unicli-repair/references/error-codes.md +149 -0
  117. package/skills/unicli-repair/references/yaml-patches.md +321 -0
  118. package/skills/unicli-smart-search/SKILL.md +80 -0
  119. package/skills/unicli-usage/SKILL.md +65 -0
  120. package/src/adapters/adguardhome/rules.yaml +1 -1
  121. package/src/adapters/adguardhome/stats.yaml +1 -1
  122. package/src/adapters/adguardhome/status.yaml +1 -1
  123. package/src/adapters/apple-music/rate-album.yaml +1 -2
  124. package/src/adapters/arxiv/trending.yaml +1 -1
  125. package/src/adapters/az/account.yaml +1 -1
  126. package/src/adapters/coupang/hot.yaml +2 -1
  127. package/src/adapters/ctrip/hot.yaml +2 -1
  128. package/src/adapters/ctrip/search.yaml +2 -1
  129. package/src/adapters/douban/top250.yaml +1 -1
  130. package/src/adapters/figma/export-selected.yaml +1 -2
  131. package/src/adapters/gcloud/projects.yaml +1 -1
  132. package/src/adapters/github-trending/developers.yaml +1 -1
  133. package/src/adapters/github-trending/weekly.yaml +1 -1
  134. package/src/adapters/homebrew/search.yaml +1 -1
  135. package/src/adapters/imdb/top.yaml +1 -1
  136. package/src/adapters/itch-io/popular.yaml +1 -1
  137. package/src/adapters/itch-io/top.yaml +1 -1
  138. package/src/adapters/mastodon/timeline.yaml +1 -1
  139. package/src/adapters/openrouter/search.yaml +1 -1
  140. package/src/adapters/pypi/search.yaml +2 -1
  141. package/src/adapters/sspai/hot.yaml +4 -1
  142. package/src/adapters/sspai/latest.yaml +3 -3
  143. package/src/adapters/tieba/hot.yaml +1 -1
  144. package/src/adapters/wikipedia/today.yaml +1 -1
  145. package/src/adapters/zoom/toggle-mute.yaml +1 -2
  146. package/dist/engine/yaml-runner.d.ts +0 -11
  147. package/dist/engine/yaml-runner.d.ts.map +0 -1
  148. package/dist/engine/yaml-runner.js +0 -18
  149. package/dist/engine/yaml-runner.js.map +0 -1
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: unicli-claude-code
3
+ description: >
4
+ Make Uni-CLI reliable when invoked from Claude Code. MANDATES JSON-in
5
+ channels (stdin / --args-file) for any payload containing quotes, emoji,
6
+ newlines, or inline JSON — shell-quoted invocations hit TC0 circuit
7
+ limits and drop to <50% success above ICS=4. Also covers --describe
8
+ introspection and next_actions-driven navigation.
9
+ version: 0.218.0
10
+ depends-on:
11
+ - talk-normal
12
+ triggers:
13
+ - "unicli"
14
+ - "ics"
15
+ - "args-file"
16
+ - "stdin-json"
17
+ - "quoted payload"
18
+ - "emoji in query"
19
+ ---
20
+
21
+ # Uni-CLI × Claude Code — Reliable Invocation
22
+
23
+ > **TL;DR** — If the payload contains ANY of: quotes, emoji, newlines, JSON,
24
+ > non-ASCII, or is longer than ~60 chars, PIPE IT. Never inline.
25
+
26
+ ## Why this skill exists
27
+
28
+ Transformers live in TC0. Matching balanced `"` and `'` pairs with arbitrary
29
+ nesting is a mod-2 state-tracking problem that TC0 cannot solve in constant
30
+ decode depth. Empirically, top LLMs land <43% on 0→1 CLI generation
31
+ (CLI-Tool-Bench arXiv:2604.06742) and 62% of agent-tool bugs cluster at the
32
+ tool-invocation / execution stages (arXiv:2603.20847).
33
+
34
+ Uni-CLI gives you THREE invocation channels. One of them (shell-args) inherits
35
+ the TC0 bottleneck. The other two do not.
36
+
37
+ ## The decision rule
38
+
39
+ | If the payload has … | Use channel |
40
+ | ---------------------------------------- | --------------- |
41
+ | Only ASCII, no quotes, <60 chars | `shell` OK |
42
+ | Any quote or backslash | **stdin-JSON** |
43
+ | Emoji / CJK / non-ASCII | **stdin-JSON** |
44
+ | Newlines or inline JSON | **stdin-JSON** |
45
+ | Being reused across multiple invocations | **--args-file** |
46
+
47
+ When unsure → stdin-JSON. It never makes things worse.
48
+
49
+ ## The three channels
50
+
51
+ ### 1 — stdin-JSON (preferred for complex payloads)
52
+
53
+ ```bash
54
+ echo '{"query": "she said \"hi\" 🎉", "limit": 10}' | unicli twitter search
55
+ ```
56
+
57
+ - Uni-CLI auto-detects non-TTY stdin whose body starts with `{`
58
+ - Precedence: stdin-JSON > `--args-file` > shell flags > defaults
59
+ - Works for EVERY command — no per-adapter opt-in needed
60
+
61
+ ### 2 — --args-file (preferred when payload is reused)
62
+
63
+ ```bash
64
+ cat > /tmp/q.json <<'EOF'
65
+ { "query": "machine learning", "limit": 20, "locale": "en_US" }
66
+ EOF
67
+ unicli arxiv search --args-file /tmp/q.json
68
+ ```
69
+
70
+ - Absolute paths recommended
71
+ - JSON only (YAML and TOML deliberately not supported — minimize format ambiguity)
72
+
73
+ ### 3 — shell args (only for trivial payloads)
74
+
75
+ ```bash
76
+ unicli hackernews top --limit 5
77
+ ```
78
+
79
+ Fine when every value is ASCII, no quotes, no emoji.
80
+
81
+ ## Runtime introspection — `unicli describe`
82
+
83
+ Before invoking any unfamiliar command, run:
84
+
85
+ ```bash
86
+ unicli describe <site> <command>
87
+ ```
88
+
89
+ You get back a JSON object containing:
90
+
91
+ - `args_schema` — JSON Schema draft-2020-12 for the argument bag
92
+ - `example_stdin` — a realistic JSON body you can modify and pipe
93
+ - `channels` — the three invocation templates
94
+ - `next_actions` — hints for what to run next
95
+
96
+ This replaces reading docs. The CLI is the documentation.
97
+
98
+ ## The response envelope (v2)
99
+
100
+ Every successful call returns:
101
+
102
+ ```json
103
+ {
104
+ "ok": true,
105
+ "schema_version": "2",
106
+ "command": "twitter.search",
107
+ "meta": { "duration_ms": 847, "count": 10, "surface": "web" },
108
+ "data": [ ... ],
109
+ "error": null,
110
+ "next_actions": [
111
+ { "command": "unicli describe twitter search", "description": "…" },
112
+ { "command": "unicli twitter search --args-file <path.json>", "description": "…" }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ Errors return `ok: false` with a structured `error` object (`adapter_path`,
118
+ `step`, `suggestion`) and `next_actions` biased toward `unicli repair`. If
119
+ you see `invalid_input` from the hardening layer, that means the arg bag
120
+ tripped a safety check — read `error.suggestion` for the exact fix.
121
+
122
+ ## --dry-run — preview before committing
123
+
124
+ ```bash
125
+ echo '{"query": "🎉", "limit": 5}' | unicli twitter search --dry-run
126
+ ```
127
+
128
+ Prints the resolved ArgBag, the source channel, and the pipeline step count
129
+ without touching the network / filesystem. Use this whenever you want to
130
+ confirm the agent built the payload correctly.
131
+
132
+ ## Common failure modes → fixes
133
+
134
+ | Symptom | Root cause | Fix |
135
+ | --------------------------------------------- | -------------------------------------- | ----------------------------------------- |
136
+ | `invalid_input: control characters` | Embedded 0x01..0x1F in a string arg | Strip control chars; use \\t \\n \\r only |
137
+ | `invalid_input: path escapes CWD` | `../` or absolute path outside $HOME | Keep outputs inside cwd or $HOME/.unicli |
138
+ | `invalid_input: id contains URL punctuation` | You pasted a full URL as a resource id | Strip the `?`, `#`, or `%XX` sequences |
139
+ | Command appears to run but gets wrong args | Shell ate your quotes | Switch to stdin-JSON |
140
+ | Unexpected shell expansion (`$HOME`, `` ` ``) | Bash interpolated your payload | Single-quote, or better, use stdin-JSON |
141
+
142
+ ## Recipes
143
+
144
+ ### Search with a complex query
145
+
146
+ ```bash
147
+ printf '%s\n' '{"query": "large language models \"emergent\" behaviour", "limit": 25}' \
148
+ | unicli arxiv search
149
+ ```
150
+
151
+ ### Multi-arg desktop command
152
+
153
+ ```bash
154
+ cat > /tmp/render.json <<'EOF'
155
+ { "scene": "/Users/me/project/main.blend", "output_dir": "~/renders", "frame_start": 1, "frame_end": 240 }
156
+ EOF
157
+ unicli blender render --args-file /tmp/render.json
158
+ ```
159
+
160
+ ### Debug-first workflow
161
+
162
+ ```bash
163
+ unicli describe youtube transcript # 1. understand the contract
164
+ echo '{"url": "https://…"}' | unicli youtube transcript --dry-run # 2. preview
165
+ echo '{"url": "https://…"}' | unicli youtube transcript # 3. run
166
+ ```
167
+
168
+ ## Version contract
169
+
170
+ - v0.214.0+ required for stdin-JSON auto-detect, `--describe`, and consistent MCP tool discovery metadata
171
+ - v0.213.1 or earlier agents should fall back to `unicli schema <site> <cmd>`
172
+ and explicit `--` flag args
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: unicli-explorer
3
+ description: >
4
+ Create new Uni-CLI adapters by exploring websites and APIs. Use when adding
5
+ support for a new site, desktop app, or service that unicli doesn't cover yet.
6
+ version: 1.0.0
7
+ triggers:
8
+ - "create adapter"
9
+ - "new adapter"
10
+ - "add site"
11
+ - "explore site"
12
+ allowed-tools: [Bash, Read, Write]
13
+ protocol: 2.0
14
+ ---
15
+
16
+ ## When to Use
17
+
18
+ Adding a new website, API, or local app to Uni-CLI's adapter catalog (~20-line YAML files).
19
+
20
+ ## Workflow
21
+
22
+ ### 1. Discover the API
23
+
24
+ ```bash
25
+ unicli browser start # Ensure Chrome is running
26
+ unicli operate open <target-url> # Navigate to target page
27
+ unicli operate state # Inspect DOM structure
28
+ unicli operate network # List captured JSON API requests
29
+ unicli operate click <ref> # Trigger lazy-loaded APIs
30
+ unicli operate network # Check for new requests
31
+ ```
32
+
33
+ ### 2. Choose Strategy
34
+
35
+ | Condition | Strategy | Browser? |
36
+ | ------------------------- | ----------- | -------- |
37
+ | `fetch(url)` returns data | `public` | No |
38
+ | Needs login cookies | `cookie` | Yes |
39
+ | Needs CSRF/Bearer token | `header` | Yes |
40
+ | Complex signed requests | `intercept` | Yes |
41
+ | No API, DOM only | `ui` | Yes |
42
+
43
+ ### 3. Write YAML Adapter
44
+
45
+ Create `src/adapters/<site>/<command>.yaml`:
46
+
47
+ ```yaml
48
+ site: mysite
49
+ name: mycommand
50
+ description: What this command does
51
+ type: web-api
52
+ strategy: public
53
+ args:
54
+ query: { type: str, required: true, positional: true }
55
+ limit: { type: int, default: 20 }
56
+ pipeline:
57
+ - fetch:
58
+ {
59
+ url: "https://api.example.com/search",
60
+ params: { q: "${{ args.query }}" },
61
+ }
62
+ - select: data.results
63
+ - map: { title: "${{ item.title }}", url: "${{ item.url }}" }
64
+ - limit: ${{ args.limit }}
65
+ columns: [title, url]
66
+ ```
67
+
68
+ ### 4. Test
69
+
70
+ ```bash
71
+ npm run dev -- mysite mycommand "test" --limit 3
72
+ npm run verify
73
+ ```
74
+
75
+ ### 5. Self-Repair
76
+
77
+ When adapters break: read error JSON `adapter_path` -> fix the ~20-line YAML ->
78
+ save to `~/.unicli/adapters/<site>/<cmd>.yaml` -> `unicli test <site>`.
79
+
80
+ ## Key Pipeline Steps
81
+
82
+ `fetch`, `fetch_text`, `parse_rss`, `html_to_md`, `select`, `map`, `filter`, `sort`,
83
+ `limit`, `exec`, `navigate`, `evaluate`, `intercept`, `click`, `type`, `wait`,
84
+ `press`, `scroll`, `snapshot`, `download`, `set`, `if`, `each`, `parallel`
85
+
86
+ ## Pipe Filters
87
+
88
+ `${{ item.field | join(', ') | truncate(100) }}` -- available: `join`, `urlencode`,
89
+ `slice`, `replace`, `lowercase`, `uppercase`, `trim`, `default`, `split`, `first`,
90
+ `last`, `length`, `strip_html`, `truncate`
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: unicli-hermes
3
+ description: >
4
+ Use Uni-CLI to interact with 237 websites, desktop apps, and system tools.
5
+ Trigger when: user asks to check a website, fetch data, control a desktop app,
6
+ or interact with social media, news, finance, or AI platforms.
7
+ version: 0.218.1
8
+ depends-on:
9
+ - talk-normal
10
+ triggers:
11
+ - "unicli"
12
+ - "website"
13
+ - "fetch from"
14
+ - "check twitter"
15
+ - "bilibili"
16
+ - "hackernews"
17
+ ---
18
+
19
+ # Uni-CLI Agent Skill
20
+
21
+ Universal CLI for AI agents — 237 sites, 3,319 commands.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install -g @zenalexa/unicli
27
+ ```
28
+
29
+ ## Quick Reference
30
+
31
+ ```bash
32
+ unicli <site> <command> [--limit N] [-f json] # Run any command
33
+ unicli list [--site <name>] # Discover commands
34
+ unicli schema <site> <command> # Get input/output schema
35
+ unicli repair <site> <command> # Fix broken adapter
36
+ unicli test <site> # Validate adapter
37
+ ```
38
+
39
+ ## When to Use
40
+
41
+ - **Web data**: `unicli twitter search "query"`, `unicli hackernews top`
42
+ - **Chinese platforms**: `unicli bilibili hot`, `unicli zhihu trending`
43
+ - **Finance**: `unicli bloomberg latest`, `unicli xueqiu hot`
44
+ - **Desktop apps**: `unicli blender render scene.blend`, `unicli ffmpeg compress video.mp4`
45
+ - **macOS system**: `unicli macos volume 50`, `unicli macos screenshot`
46
+
47
+ ## Output
48
+
49
+ - Default: v2 AgentEnvelope rendered as Markdown
50
+ - JSON: pass `-f json` or set `UNICLI_OUTPUT=json`
51
+ - Errors: structured envelope to stderr with `adapter_path`, `step`, `suggestion`
52
+
53
+ ## Self-Repair
54
+
55
+ When a command fails:
56
+
57
+ 1. Read the error JSON — it includes the adapter file path
58
+ 2. Read the YAML adapter (~20 lines)
59
+ 3. Fix the issue (selector changed? API versioned? auth needed?)
60
+ 4. Save to `~/.unicli/adapters/<site>/<command>.yaml`
61
+ 5. Verify: `unicli repair <site> <command>`
62
+
63
+ ## MCP Server (Hermes / agentskills.io)
64
+
65
+ Add to your Hermes agent configuration:
66
+
67
+ ```yaml
68
+ mcp_servers:
69
+ unicli:
70
+ command: "npx"
71
+ args: ["-y", "@zenalexa/unicli", "mcp", "serve"]
72
+ tools:
73
+ include: [unicli_run, unicli_list, unicli_search, unicli_explore]
74
+ ```
75
+
76
+ Or run the expanded server to expose all 3,319 commands as individual tools:
77
+
78
+ ```yaml
79
+ mcp_servers:
80
+ unicli:
81
+ command: "npx"
82
+ args: ["-y", "@zenalexa/unicli", "mcp", "serve", "--expanded"]
83
+ ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: unicli-oneshot
3
+ description: >
4
+ Quick single-command adapter generation for unicli. Use when you need to
5
+ create a one-off command for a specific URL and goal — 4 steps done.
6
+ ---
7
+
8
+ # unicli One-Shot Adapter
9
+
10
+ Generate a single unicli command from a URL + goal in 4 steps.
11
+
12
+ ## Process
13
+
14
+ ### Step 1: Open the Page
15
+
16
+ ```bash
17
+ unicli operate open "<URL>"
18
+ unicli operate state
19
+ ```
20
+
21
+ ### Step 2: Discover the API
22
+
23
+ Open browser DevTools Network tab. Look for XHR/Fetch requests that return JSON data matching your goal.
24
+
25
+ Key signals:
26
+
27
+ - `/api/` or `/v1/` in URL → REST endpoint
28
+ - JSON response with array of items → listable data
29
+ - Query parameters → filterable
30
+
31
+ ### Step 3: Write the YAML
32
+
33
+ Create `src/adapters/<site>/<command>.yaml`:
34
+
35
+ ```yaml
36
+ site: <site-name>
37
+ name: <command>
38
+ description: <what it does>
39
+ type: web-api
40
+ strategy: public # or cookie if auth needed
41
+ pipeline:
42
+ - fetch:
43
+ url: <discovered-api-url>
44
+ params: <query-params>
45
+ - select: <path.to.data>
46
+ - map:
47
+ title: ${{ item.title }}
48
+ # ... map fields
49
+ columns: [title, ...]
50
+ ```
51
+
52
+ ### Step 4: Test
53
+
54
+ ```bash
55
+ npm run dev -- <site> <command>
56
+ npm run dev -- <site> <command> -f json
57
+ ```
58
+
59
+ Done. One YAML file, one command, zero code.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: unicli-operate
3
+ description: >
4
+ Compatibility guide for `unicli operate`. Prefer `unicli browser`, which now
5
+ exposes the same operator surface plus daemon/session diagnostics.
6
+ version: 1.0.0
7
+ triggers:
8
+ - "operate browser"
9
+ - "click element"
10
+ - "fill form"
11
+ - "extract page data"
12
+ - "unicli operate"
13
+ allowed-tools: [Bash]
14
+ protocol: 2.0
15
+ ---
16
+
17
+ ## When to Use
18
+
19
+ Prefer `unicli browser` for new work:
20
+
21
+ ```bash
22
+ unicli browser open <url>
23
+ unicli browser state
24
+ unicli browser click <ref>
25
+ unicli browser type <ref> <text>
26
+ unicli browser find --css <selector>
27
+ unicli browser extract
28
+ unicli browser tabs
29
+ unicli browser frames
30
+ ```
31
+
32
+ `unicli operate ...` still works, but it is now the compatibility path over the same implementation.
33
+
34
+ ## Core Workflow
35
+
36
+ 1. `open` -> navigate to URL
37
+ 2. `state` -> inspect DOM, get `[ref]` numbers for interactive elements
38
+ 3. interact -> `click`, `type`, `select`, `keys` using ref numbers
39
+ 4. verify -> `state` again or `get value <ref>` to confirm
40
+ 5. extract -> `eval` for structured data
41
+
42
+ **Always `state` before interacting. Never guess ref numbers.**
43
+
44
+ ## All Operate Subcommands
45
+
46
+ ```bash
47
+ # Navigation
48
+ unicli operate open <url> # Navigate to URL
49
+ unicli operate back # Go back in history
50
+ unicli operate scroll [direction] # down, up, bottom, top
51
+ unicli operate close # Close automation window
52
+
53
+ # Inspection
54
+ unicli operate state # DOM tree with [ref] indices
55
+ unicli operate screenshot [path] # Save visual capture
56
+
57
+ # Get data
58
+ unicli operate get title|url # Page title or URL
59
+ unicli operate get text <ref> # Element text by ref
60
+ unicli operate get value <ref> # Input value (verify after type)
61
+ unicli operate get html [selector] # Page or scoped HTML
62
+ unicli operate get attributes <ref> # Element attributes
63
+
64
+ # Interaction
65
+ unicli operate click <ref> # Click element
66
+ unicli operate type <ref> <text> # Type into element
67
+ unicli operate select <ref> <option> # Select dropdown
68
+ unicli operate keys <key> # Press key (Enter, Escape, Control+a)
69
+ unicli operate upload <ref> <path> # Upload file
70
+ unicli operate hover <ref> # Hover over element
71
+
72
+ # Wait
73
+ unicli operate wait time <ms> # Fixed delay
74
+ unicli operate wait selector <sel> # Until element appears
75
+ unicli operate wait text <str> # Until text appears
76
+
77
+ # Advanced
78
+ unicli operate eval <js> # Execute JS in page
79
+ unicli operate network [pattern] # Captured network requests
80
+ unicli operate observe <query> # Natural language observation
81
+ ```
82
+
83
+ ## Patterns
84
+
85
+ ```bash
86
+ # Browse + extract
87
+ unicli operate open "https://news.ycombinator.com" && unicli operate state
88
+ unicli operate eval "JSON.stringify([...document.querySelectorAll('.titleline a')].slice(0,5).map(a=>({title:a.textContent,url:a.href})))"
89
+
90
+ # Fill form (chain to reduce round trips)
91
+ unicli operate type 3 "user@example.com" && unicli operate type 5 "pass" && unicli operate click 7
92
+
93
+ # API discovery
94
+ unicli operate open "https://example.com/feed" && unicli operate wait time 3000
95
+ unicli operate network # See captured JSON APIs
96
+ ```
97
+
98
+ ## Rules
99
+
100
+ 1. Always `state` first -- never guess refs
101
+ 2. `eval` is read-only -- never `eval "el.click()"`, use `click <ref>`
102
+ 3. Verify inputs with `get value <ref>` after `type`
103
+ 4. Re-inspect after navigation -- run `state` after `open` or link clicks
104
+ 5. Prefer API over DOM -- if `network` reveals JSON APIs, use YAML adapters
105
+
106
+ ## Troubleshooting
107
+
108
+ | Problem | Fix |
109
+ | ---------------------- | --------------------------------------- |
110
+ | Browser not connected | `unicli browser start` |
111
+ | Element not found | `scroll down` then `state` |
112
+ | Stale refs after click | `state` to refresh |
113
+ | eval returns undefined | Wrap: `"(function(){ return ...; })()"` |