web2cli 0.2.0__tar.gz

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 (49) hide show
  1. web2cli-0.2.0/LICENSE +202 -0
  2. web2cli-0.2.0/PKG-INFO +467 -0
  3. web2cli-0.2.0/README.md +431 -0
  4. web2cli-0.2.0/pyproject.toml +59 -0
  5. web2cli-0.2.0/setup.cfg +4 -0
  6. web2cli-0.2.0/src/web2cli/__init__.py +3 -0
  7. web2cli-0.2.0/src/web2cli/__main__.py +5 -0
  8. web2cli-0.2.0/src/web2cli/adapter/__init__.py +0 -0
  9. web2cli-0.2.0/src/web2cli/adapter/lint.py +667 -0
  10. web2cli-0.2.0/src/web2cli/adapter/loader.py +157 -0
  11. web2cli-0.2.0/src/web2cli/adapter/validator.py +127 -0
  12. web2cli-0.2.0/src/web2cli/adapters/discord.com/web2cli.yaml +476 -0
  13. web2cli-0.2.0/src/web2cli/adapters/mail.google.com/parsers/inbox.py +200 -0
  14. web2cli-0.2.0/src/web2cli/adapters/mail.google.com/web2cli.yaml +52 -0
  15. web2cli-0.2.0/src/web2cli/adapters/news.ycombinator.com/web2cli.yaml +356 -0
  16. web2cli-0.2.0/src/web2cli/adapters/reddit.com/web2cli.yaml +233 -0
  17. web2cli-0.2.0/src/web2cli/adapters/slack.com/web2cli.yaml +445 -0
  18. web2cli-0.2.0/src/web2cli/adapters/stackoverflow.com/web2cli.yaml +257 -0
  19. web2cli-0.2.0/src/web2cli/adapters/x.com/providers/x_graphql.py +299 -0
  20. web2cli-0.2.0/src/web2cli/adapters/x.com/web2cli.yaml +449 -0
  21. web2cli-0.2.0/src/web2cli/auth/__init__.py +0 -0
  22. web2cli-0.2.0/src/web2cli/auth/browser_login.py +820 -0
  23. web2cli-0.2.0/src/web2cli/auth/manager.py +166 -0
  24. web2cli-0.2.0/src/web2cli/auth/store.py +68 -0
  25. web2cli-0.2.0/src/web2cli/cli.py +1286 -0
  26. web2cli-0.2.0/src/web2cli/executor/__init__.py +0 -0
  27. web2cli-0.2.0/src/web2cli/executor/http.py +113 -0
  28. web2cli-0.2.0/src/web2cli/output/__init__.py +0 -0
  29. web2cli-0.2.0/src/web2cli/output/formatter.py +116 -0
  30. web2cli-0.2.0/src/web2cli/parser/__init__.py +0 -0
  31. web2cli-0.2.0/src/web2cli/parser/custom.py +21 -0
  32. web2cli-0.2.0/src/web2cli/parser/html_parser.py +111 -0
  33. web2cli-0.2.0/src/web2cli/parser/transforms.py +127 -0
  34. web2cli-0.2.0/src/web2cli/pipe.py +10 -0
  35. web2cli-0.2.0/src/web2cli/providers/__init__.py +6 -0
  36. web2cli-0.2.0/src/web2cli/providers/base.py +22 -0
  37. web2cli-0.2.0/src/web2cli/providers/registry.py +86 -0
  38. web2cli-0.2.0/src/web2cli/runtime/__init__.py +1 -0
  39. web2cli-0.2.0/src/web2cli/runtime/cache.py +42 -0
  40. web2cli-0.2.0/src/web2cli/runtime/engine.py +743 -0
  41. web2cli-0.2.0/src/web2cli/runtime/parser.py +398 -0
  42. web2cli-0.2.0/src/web2cli/runtime/template.py +52 -0
  43. web2cli-0.2.0/src/web2cli/types.py +71 -0
  44. web2cli-0.2.0/src/web2cli.egg-info/PKG-INFO +467 -0
  45. web2cli-0.2.0/src/web2cli.egg-info/SOURCES.txt +47 -0
  46. web2cli-0.2.0/src/web2cli.egg-info/dependency_links.txt +1 -0
  47. web2cli-0.2.0/src/web2cli.egg-info/entry_points.txt +2 -0
  48. web2cli-0.2.0/src/web2cli.egg-info/requires.txt +13 -0
  49. web2cli-0.2.0/src/web2cli.egg-info/top_level.txt +1 -0
web2cli-0.2.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [2026] [Michał Obłąk]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
web2cli-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,467 @@
1
+ Metadata-Version: 2.4
2
+ Name: web2cli
3
+ Version: 0.2.0
4
+ Summary: Every website is a command
5
+ Author-email: Michal Oblak <oblak.michal@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/jb41/web2cli
8
+ Project-URL: Repository, https://github.com/jb41/web2cli
9
+ Project-URL: Issues, https://github.com/jb41/web2cli/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Internet :: WWW/HTTP
19
+ Classifier: Topic :: Utilities
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: typer>=0.24.0
24
+ Requires-Dist: httpx>=0.28.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=14.0
27
+ Requires-Dist: selectolax>=0.3.0
28
+ Requires-Dist: jmespath>=1.1.0
29
+ Requires-Dist: cryptography>=46.0
30
+ Requires-Dist: curl_cffi>=0.7.0
31
+ Requires-Dist: beautifulsoup4>=4.12
32
+ Requires-Dist: XClientTransaction>=1.0
33
+ Provides-Extra: browser
34
+ Requires-Dist: playwright>=1.40; extra == "browser"
35
+ Dynamic: license-file
36
+
37
+ # web2cli
38
+
39
+ **Every website is a Unix command.**
40
+
41
+ Browse Hacker News, search X.com, write Discord messages, read Reddit — all from your terminal. No browser, no API keys, no $100/mo plans.
42
+
43
+ ![DEMO](demo.gif)
44
+
45
+ ```bash
46
+ $ web2cli hn top --limit 3
47
+ ┌──────┬──────────────────────────────────────────┬───────┬──────────┐
48
+ │ RANK │ TITLE │ SCORE │ COMMENTS │
49
+ ├──────┼──────────────────────────────────────────┼───────┼──────────┤
50
+ │ 1 │ Show HN: I built a CLI for every website │ 313 │ 37 │
51
+ │ 2 │ Why agents don't need browsers │ 271 │ 89 │
52
+ │ 3 │ The Unix philosophy, 50 years later │ 198 │ 64 │
53
+ └──────┴──────────────────────────────────────────┴───────┴──────────┘
54
+ ```
55
+
56
+ ```bash
57
+ $ web2cli login x --browser
58
+ $ web2cli x search --query "build for agents" --limit 1 --format json
59
+ [
60
+ {
61
+ "author": "@karpathy",
62
+ "text": "CLIs are super exciting precisely because they are a \"legacy\" technology, which means AI agents can natively and easily use them, combine them, interact with them via the entire terminal toolkit.\n\nE.g ask your Claude/Codex agent to install this new Polymarket CLI and ask for any https://t.co/gzrpg0erGz",
63
+ "date": "2026-02-24 18:17",
64
+ "retweets": 1085,
65
+ "likes": 11481,
66
+ "replies": 610,
67
+ "views": "1923316"
68
+ }
69
+ ]
70
+ ```
71
+
72
+ ```bash
73
+ $ web2cli login discord --browser
74
+ $ web2cli discord send --server "My Server" --channel general --message "deployed 🚀" > /dev/null
75
+ ```
76
+
77
+ ## Why?
78
+ - **For agents**: HTTP GET, not Chromium. 50ms not 5s. \$0.000001 not \$0.10.
79
+ - **For humans**: `curl` for the modern web. Pipe, grep, script anything.
80
+ - **For both**: One interface. `web2cli <site> <command>`. That's it.
81
+
82
+ ```bash
83
+ pip install web2cli
84
+ ```
85
+
86
+ ## Performance
87
+
88
+ web2cli makes direct HTTP requests. No browser, no DOM, no screenshots.
89
+
90
+ | Metric | Browser automation | web2cli |
91
+ |---------------------------|:---:|:---:|
92
+ | Fetch 10 top news from HN | ~20s (launch + render) | 0.5s |
93
+ | Memory per request | ~821.3MB (Chromium) | ~5MB (HTTP) |
94
+ | Cost at 10k req/day | \$20/day (just LLM)<br>~\$23.3/day (LLM + remote browser) | ~\$0 (HTTP) |
95
+ | Tokens to parse | ~8647 (HTML/DOM estimate) | ~300 (Markdown table) |
96
+
97
+ ### Real-world benchmarks
98
+
99
+ | Task | Official API | Browser | web2cli | Speedup |
100
+ |-----------------------|:------------:|:-------:|:-------:|--------:|
101
+ | Read Discord messages | ✓ has API | 26s | 0.63s | 41x |
102
+ | Send a Slack message | ✓ has API | 35s | 0.60s | 58x |
103
+ | Search X | $100/mo API | 75s | 1.54s | 50x |
104
+ | Search Stack Overflow | 300 req/day | 41s | 0.65s | 63x |
105
+ | Fetch HN submissions | partial API | 36s | 1.42s | 25x |
106
+
107
+ > Some sites have great APIs. Some have expensive ones. Some have none.
108
+ > web2cli gives you one interface for all of them
109
+
110
+ ### What this means for agents
111
+
112
+ | Scenario | Browser automation | web2cli |
113
+ |------------------------------------|:------------------:|:-----------:|
114
+ | Monitor Discord (1 check/min) | $2.88/day | $0.0015/day |
115
+ | Scan X every 5 min, 24/7 | $1.58/day | $0.0003/day |
116
+ | 10k daily actions (typical bot) | ~$50/day | ~$0.01/day |
117
+ | **Monthly infra for active agent** | **$50+/mo** | **$4/mo** |
118
+
119
+ > Browser automation is the right choice for sites that require JS rendering
120
+ > or complex interaction flows. web2cli is for the 80% of tasks that don't.
121
+
122
+ ## More code examples
123
+ ### Daily HN top stories summary
124
+ ```bash
125
+ web2cli hn top --limit 3 --fields title,url --format md | \
126
+ claude -p "For each story, fetch the URL and write a 1-sentence summary. Output as a bullet list." --allowedTools "WebFetch" | \
127
+ web2cli discord send --server "ZENO.blue" --channel "testy-mo" > /dev/null
128
+ ```
129
+
130
+ ### Minimal Discord answering bot
131
+ ```python
132
+ import json, subprocess, time, anthropic
133
+
134
+ NICK = "your_nickname"
135
+ SERVER = "YOUR_SERVER_NAME"
136
+ CHANNEL = "channel_name_here"
137
+ SYSTEM = "You are a bot on Discord. Respond briefly, in user language, without markdown."
138
+
139
+ seen = set()
140
+
141
+
142
+ def web2cli(*args):
143
+ result = subprocess.run(["web2cli", "discord", *args, "--format", "json"], capture_output=True, text=True)
144
+ return json.loads(result.stdout or "[]")
145
+
146
+
147
+ def fetch():
148
+ return web2cli("messages", "--server", SERVER, "--channel", CHANNEL, "--limit", "20")
149
+
150
+
151
+ def send(text):
152
+ web2cli("send", "--server", SERVER, "--channel", CHANNEL, "--message", text)
153
+
154
+
155
+ def fmt(msgs):
156
+ return "\n".join(f'{m["author"]}: {m["content"]}' for m in msgs)
157
+
158
+
159
+ def ask(context, new_msgs):
160
+ resp = anthropic.Anthropic().messages.create(
161
+ model="claude-sonnet-4-6", max_tokens=512, system=SYSTEM,
162
+ messages=[{"role": "user", "content": f"Last messages:\n{context}\n\nNew for you:\n{new_msgs}"}],
163
+ )
164
+ return resp.content[0].text
165
+
166
+
167
+ # Seed seen IDs
168
+ for m in fetch():
169
+ seen.add(m["id"])
170
+
171
+ print(f"Watching #{CHANNEL} for @{NICK}...")
172
+
173
+ while True:
174
+ time.sleep(30)
175
+ msgs = fetch()
176
+ new = [m for m in msgs if m["id"] not in seen and NICK in m.get("content", "").lower()]
177
+ for m in msgs:
178
+ seen.add(m["id"])
179
+ if not new:
180
+ continue
181
+ reply = ask(fmt(msgs), fmt(new))
182
+ print(f"→ {reply}")
183
+ send(reply)
184
+ ```
185
+
186
+ ## Built-in Adapters
187
+ Current built-in adapters and actions:
188
+
189
+ ### discord.com (`dc`, `discord`)
190
+ - `me` - Show current user info
191
+ - `servers` - List your Discord servers (guilds)
192
+ - `channels` - List channels in a server
193
+ - `messages` - Get messages from a channel
194
+ - `send` - Send a message to a channel
195
+ - `dm` - List DM conversations
196
+ - `dm-messages` - Get messages from a DM conversation
197
+ - `dm-send` - Send a DM to a user
198
+
199
+ ### news.ycombinator.com (`hn`)
200
+ - `top` - Get top stories from Hacker News
201
+ - `new` - Get newest stories
202
+ - `item` - Get a single HN item (story, comment, job)
203
+ - `search` - Search HN stories (via Algolia)
204
+ - `saved` - Get saved stories (requires login)
205
+ - `upvoted` - Get upvoted stories (requires login)
206
+ - `submissions` - Get a user's submissions
207
+
208
+ ### reddit.com (`reddit`)
209
+ - `posts` - List posts from a subreddit
210
+ - `thread` - Get a thread with comments
211
+ - `search` - Search posts in a subreddit
212
+
213
+ ### slack.com (`slack`)
214
+ - `me` - Show current user and workspace info
215
+ - `channels` - List channels in workspace
216
+ - `messages` - Get messages from a channel
217
+ - `send` - Send a message to a channel
218
+ - `dm` - List DM conversations
219
+ - `dm-messages` - Get messages from a DM conversation
220
+ - `dm-send` - Send a DM to a user
221
+
222
+ ### stackoverflow.com (`so`)
223
+ - `search` - Search Stack Overflow questions
224
+ - `question` - Read a specific question and its top answers
225
+ - `tagged` - Browse questions by tag
226
+
227
+ ### x.com (`x`, `twitter`)
228
+ - `tweet` - Get a single tweet by ID or URL
229
+ - `profile` - Get user profile info
230
+ - `search` - Search tweets
231
+ - `timeline` - Home timeline (For you tab)
232
+ - `following` - Following timeline
233
+
234
+ To inspect adapter details from CLI:
235
+
236
+ ```bash
237
+ web2cli adapters list
238
+ web2cli adapters info <domain-or-alias>
239
+ ```
240
+
241
+ ## Documentation
242
+ Key docs for contributors:
243
+
244
+ - `docs/adapter-spec.md` - canonical adapter specification (current: `0.2`)
245
+ - `docs/llm-adapter-playbook.md` - adapter authoring workflow for LLM agents
246
+ - `docs/adapter-spec.schema.json` - machine-readable schema for quick structural checks
247
+
248
+ ## Custom Adapters Quickstart
249
+ Create a minimal custom adapter end-to-end using `httpbin.org` (global, simple, auth-friendly test target).
250
+
251
+ 1. Create adapter directory:
252
+ ```bash
253
+ mkdir -p ~/.web2cli/adapters/httpbin.org
254
+ ```
255
+
256
+ 2. Create `~/.web2cli/adapters/httpbin.org/web2cli.yaml`:
257
+ ```yaml
258
+ meta:
259
+ spec_version: "0.2"
260
+ name: httpbin
261
+ domain: httpbin.org
262
+ base_url: https://httpbin.org
263
+ version: 0.2.0
264
+ description: "HTTPBin demo adapter"
265
+ author: custom
266
+ aliases: [hb]
267
+ transport: http
268
+ impersonate: chrome
269
+ default_headers:
270
+ Accept: "application/json"
271
+
272
+ auth:
273
+ methods:
274
+ - type: token
275
+ env_var: WEB2CLI_HTTPBIN_TOKEN
276
+ inject:
277
+ target: header
278
+ key: Authorization
279
+ prefix: "Bearer "
280
+ - type: cookies
281
+ keys: [session]
282
+ env_var: WEB2CLI_HTTPBIN_COOKIES
283
+
284
+ commands:
285
+ ip:
286
+ description: "Show IP seen by server"
287
+ pipeline:
288
+ - request:
289
+ name: fetch
290
+ method: GET
291
+ url: /ip
292
+ - parse:
293
+ name: parsed
294
+ from: fetch
295
+ format: json
296
+ extract: "$"
297
+ fields:
298
+ - name: origin
299
+ from: "$.origin"
300
+ output:
301
+ from_step: parsed
302
+ default_fields: [origin]
303
+ default_format: table
304
+
305
+ bearer-check:
306
+ description: "Check bearer auth"
307
+ pipeline:
308
+ - request:
309
+ name: fetch
310
+ method: GET
311
+ url: /bearer
312
+ - parse:
313
+ name: parsed
314
+ from: fetch
315
+ format: json
316
+ extract: "$"
317
+ fields:
318
+ - name: authenticated
319
+ from: "$.authenticated"
320
+ default: false
321
+ - name: token
322
+ from: "$.token"
323
+ default: ""
324
+ output:
325
+ from_step: parsed
326
+ default_fields: [authenticated, token]
327
+ default_format: table
328
+
329
+ cookies:
330
+ description: "Echo cookies seen by server"
331
+ pipeline:
332
+ - request:
333
+ name: fetch
334
+ method: GET
335
+ url: /cookies
336
+ - parse:
337
+ name: parsed
338
+ from: fetch
339
+ format: json
340
+ extract: "$.cookies"
341
+ output:
342
+ from_step: parsed
343
+ default_format: json
344
+ ```
345
+
346
+ 3. Validate and lint:
347
+ ```bash
348
+ web2cli adapters validate
349
+ web2cli adapters lint httpbin.org
350
+ ```
351
+
352
+ 4. Inspect and run:
353
+ ```bash
354
+ web2cli adapters info hb
355
+ web2cli hb ip
356
+ ```
357
+
358
+ 5. Test token auth (session-based):
359
+ ```bash
360
+ web2cli login hb --token "abc123"
361
+ web2cli hb bearer-check --trace --verbose
362
+ ```
363
+
364
+ 6. Test cookie auth:
365
+ ```bash
366
+ web2cli login hb --cookies "session=my-session"
367
+ web2cli hb cookies --format json
368
+ ```
369
+
370
+ If you prefer env vars instead of stored sessions:
371
+ ```bash
372
+ export WEB2CLI_HTTPBIN_TOKEN="abc123"
373
+ export WEB2CLI_HTTPBIN_COOKIES="session=my-session"
374
+ web2cli hb bearer-check
375
+ web2cli hb cookies
376
+ ```
377
+
378
+ ## Debugging and Quality
379
+
380
+ ```bash
381
+ # Validate + semantic lint all adapters
382
+ web2cli adapters validate
383
+ web2cli adapters lint
384
+
385
+ # Inspect step-by-step runtime trace for a command
386
+ web2cli reddit posts --sub python --limit 3 --trace
387
+
388
+ # Disable adapter/parser truncation (full text fields)
389
+ web2cli so question --id 79861629 --format json --no-truncate
390
+
391
+ # Diagnose browser stack used by `login --browser`
392
+ web2cli doctor browser
393
+ web2cli doctor browser --deep
394
+ ```
395
+
396
+ ## Browser Login
397
+
398
+ For sites that use cookies and/or runtime tokens, you can capture a session directly from a real browser:
399
+
400
+ ```bash
401
+ web2cli login x.com --browser
402
+ ```
403
+
404
+ `web2cli` opens Chromium and waits until all required auth values are available:
405
+
406
+ - required cookie keys from `auth.methods[].keys`
407
+ - token values defined by `auth.methods[].capture` (for `type: token`)
408
+
409
+ Then it encrypts and stores the session in `~/.web2cli/sessions/<domain>.json.enc`.
410
+
411
+ Token capture example in adapter YAML:
412
+
413
+ ```yaml
414
+ auth:
415
+ methods:
416
+ - type: token
417
+ env_var: WEB2CLI_DISCORD_TOKEN
418
+ inject:
419
+ target: header
420
+ key: Authorization
421
+ capture:
422
+ from: request.header
423
+ key: Authorization
424
+ match:
425
+ host: discord.com
426
+ path_regex: "^/api/"
427
+ ```
428
+
429
+ Inspect current login state:
430
+
431
+ ```bash
432
+ web2cli login x.com --status
433
+ ```
434
+
435
+ Troubleshoot browser capture flow:
436
+
437
+ ```bash
438
+ web2cli login slack --browser --browser-debug
439
+ ```
440
+
441
+ This prints live capture state (have/missing cookies, token status, tracked tabs in browser context).
442
+
443
+ `--browser` automatically picks the best browser strategy (including local Chrome fallback for stricter sites) so users typically don't need extra setup.
444
+
445
+ ## For LLMs
446
+ If you are using an LLM/agent to generate a new adapter, use this flow:
447
+
448
+ 1. Start from `docs/llm-adapter-playbook.md` and the minimal adapter template.
449
+ 2. Prefer declarative steps (`resolve`, `request`, `fanout`, `parse`, `transform`).
450
+ 3. Avoid custom parser scripts unless declarative parsing is truly insufficient.
451
+ 4. Always run `web2cli adapters validate`, `web2cli adapters lint`, and at least one command with `--trace`.
452
+ 5. Do not stop until all three checks pass and output fields look correct.
453
+
454
+ ### web2cli Cloud (coming soon)
455
+
456
+ Building an agent for other people? Cloud handles auth so you don't have to.
457
+
458
+ Your users click a link, log in to any site in a sandboxed browser,
459
+ and your agent gets an opaque session token. No cookies touch your server.
460
+
461
+ Think "OAuth for websites that don't have OAuth."
462
+
463
+ → [Join the waitlist](https://web2cli.com#cloud)
464
+
465
+ ---
466
+
467
+ Created by [@michaloblak](https://x.com/michaloblak).