twitter-cli 0.8.3__tar.gz → 0.8.4__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.
- twitter_cli-0.8.4/AGENTS.md +70 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/PKG-INFO +13 -1
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/README.md +12 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/SKILL.md +1 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/pyproject.toml +1 -1
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_auth.py +1 -1
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_cli.py +22 -32
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/auth.py +38 -16
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/cli.py +12 -23
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/constants.py +0 -2
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/uv.lock +1 -1
- twitter_cli-0.8.3/.github/workflows/publish-clawhub.yml +0 -127
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/.github/workflows/ci.yml +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/.github/workflows/publish.yml +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/.gitignore +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/LICENSE +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/SCHEMA.md +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/config.yaml +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/conftest.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/fixtures/followers_page.json +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/fixtures/home_timeline.json +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/fixtures/list_timeline.json +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/fixtures/search_timeline.json +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/fixtures/tweet_detail.json +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_client.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_config.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_config_normalization.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_filter.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_parser_fixtures.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_search.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_serialization.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/tests/test_smoke.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/__init__.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/cache.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/client.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/config.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/exceptions.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/filter.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/formatter.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/graphql.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/models.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/output.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/parser.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/search.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/serialization.py +0 -0
- {twitter_cli-0.8.3 → twitter_cli-0.8.4}/twitter_cli/timeutil.py +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# AGENTS.md — Agent Developer Guide for twitter-cli
|
|
2
|
+
|
|
3
|
+
This file provides context for AI agents working in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
- **Project**: twitter-cli — A CLI for Twitter/X (read timelines, bookmarks, search, post, reply, etc.)
|
|
8
|
+
- **Language**: Python 3.10+
|
|
9
|
+
- **Package Manager**: uv (recommended) / pip
|
|
10
|
+
- **Repository**: https://github.com/jackwener/twitter-cli
|
|
11
|
+
|
|
12
|
+
## Build, Lint, and Test Commands
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install all dependencies (including dev)
|
|
16
|
+
uv sync --extra dev
|
|
17
|
+
|
|
18
|
+
# Run ruff linter
|
|
19
|
+
uv run ruff check .
|
|
20
|
+
|
|
21
|
+
# Run mypy type checker
|
|
22
|
+
uv run mypy twitter_cli
|
|
23
|
+
|
|
24
|
+
# Run all tests (excludes smoke tests by default)
|
|
25
|
+
uv run pytest -q
|
|
26
|
+
|
|
27
|
+
# Run a single test
|
|
28
|
+
uv run pytest tests/test_cli.py::test_feed_command -v
|
|
29
|
+
|
|
30
|
+
# Run tests matching pattern
|
|
31
|
+
uv run pytest -k "test_parse" -v
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Code Style
|
|
35
|
+
|
|
36
|
+
- **Line length**: 100 characters
|
|
37
|
+
- **Python version**: 3.10+
|
|
38
|
+
- Use `from __future__ import annotations` at top of all .py files
|
|
39
|
+
- **Functions/variables**: `snake_case`, **Classes**: `PascalCase`, **Constants**: `UPPER_SNAKE_CASE`
|
|
40
|
+
- Private functions: prefix with `_`
|
|
41
|
+
- Use `@dataclass` for data models (in `models.py`)
|
|
42
|
+
- Use Click framework for CLI commands
|
|
43
|
+
- Custom exceptions in `exceptions.py`, base: `TwitterError(RuntimeError)`
|
|
44
|
+
|
|
45
|
+
## Project Structure
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
twitter_cli/
|
|
49
|
+
├── cli.py # Click CLI entry point
|
|
50
|
+
├── client.py # Twitter API client (HTTP)
|
|
51
|
+
├── auth.py # Cookie extraction & auth
|
|
52
|
+
├── graphql.py # GraphQL query IDs
|
|
53
|
+
├── parser.py # Tweet/User parsing
|
|
54
|
+
├── models.py # Dataclass models
|
|
55
|
+
├── formatter.py # Rich table formatting
|
|
56
|
+
├── serialization.py # YAML/JSON output
|
|
57
|
+
├── output.py # Structured output helpers
|
|
58
|
+
├── config.py # Config loading
|
|
59
|
+
├── filter.py # Tweet ranking/scoring
|
|
60
|
+
├── constants.py # Constants
|
|
61
|
+
├── exceptions.py # Custom exceptions
|
|
62
|
+
├── cache.py # Tweet caching
|
|
63
|
+
├── search.py # Search utilities
|
|
64
|
+
└── timeutil.py # Time utilities
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## CI
|
|
68
|
+
|
|
69
|
+
- GitHub Actions: Python 3.10, 3.11, 3.12
|
|
70
|
+
- CI validates: ruff check + mypy + pytest
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: twitter-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.4
|
|
4
4
|
Summary: A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal
|
|
5
5
|
Project-URL: Homepage, https://github.com/jackwener/twitter-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/jackwener/twitter-cli
|
|
@@ -214,6 +214,12 @@ Browser extraction is recommended — it forwards ALL Twitter cookies (not just
|
|
|
214
214
|
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
+
**Browser priority:** If you have multiple browsers, set `TWITTER_BROWSER` to try a specific browser first:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
TWITTER_BROWSER=chrome twitter feed # Supported: arc, chrome, edge, firefox, brave
|
|
221
|
+
```
|
|
222
|
+
|
|
217
223
|
After loading cookies, the CLI performs lightweight verification. Commands that require account access fail fast on clear auth errors (`401/403`).
|
|
218
224
|
|
|
219
225
|
### Proxy Support
|
|
@@ -523,6 +529,12 @@ twitter follow elonmusk --json
|
|
|
523
529
|
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
|
|
524
530
|
```
|
|
525
531
|
|
|
532
|
+
**浏览器优先级**:如果有多个浏览器,可通过 `TWITTER_BROWSER` 指定优先尝试的浏览器:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
TWITTER_BROWSER=chrome twitter feed # 支持: arc, chrome, edge, firefox, brave
|
|
536
|
+
```
|
|
537
|
+
|
|
526
538
|
### 代理支持
|
|
527
539
|
|
|
528
540
|
设置 `TWITTER_PROXY` 环境变量即可:
|
|
@@ -182,6 +182,12 @@ Browser extraction is recommended — it forwards ALL Twitter cookies (not just
|
|
|
182
182
|
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
|
|
183
183
|
```
|
|
184
184
|
|
|
185
|
+
**Browser priority:** If you have multiple browsers, set `TWITTER_BROWSER` to try a specific browser first:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
TWITTER_BROWSER=chrome twitter feed # Supported: arc, chrome, edge, firefox, brave
|
|
189
|
+
```
|
|
190
|
+
|
|
185
191
|
After loading cookies, the CLI performs lightweight verification. Commands that require account access fail fast on clear auth errors (`401/403`).
|
|
186
192
|
|
|
187
193
|
### Proxy Support
|
|
@@ -491,6 +497,12 @@ twitter follow elonmusk --json
|
|
|
491
497
|
TWITTER_CHROME_PROFILE="Profile 2" twitter feed
|
|
492
498
|
```
|
|
493
499
|
|
|
500
|
+
**浏览器优先级**:如果有多个浏览器,可通过 `TWITTER_BROWSER` 指定优先尝试的浏览器:
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
TWITTER_BROWSER=chrome twitter feed # 支持: arc, chrome, edge, firefox, brave
|
|
504
|
+
```
|
|
505
|
+
|
|
494
506
|
### 代理支持
|
|
495
507
|
|
|
496
508
|
设置 `TWITTER_PROXY` 环境变量即可:
|
|
@@ -49,6 +49,7 @@ If `AUTH_NEEDED`, proceed to guide the user:
|
|
|
49
49
|
|
|
50
50
|
Ensure user is logged into x.com in one of: Arc, Chrome, Edge, Firefox, Brave. twitter-cli auto-extracts cookies.
|
|
51
51
|
All Chrome profiles are scanned automatically. To specify a profile: `TWITTER_CHROME_PROFILE="Profile 2" twitter feed`.
|
|
52
|
+
To prioritize a specific browser: `TWITTER_BROWSER=chrome twitter feed` (supported: arc, chrome, edge, firefox, brave).
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
55
|
twitter whoami
|
|
@@ -135,7 +135,7 @@ def test_extract_via_subprocess_script_includes_arc(monkeypatch) -> None:
|
|
|
135
135
|
cookies, diagnostics = auth._extract_via_subprocess()
|
|
136
136
|
|
|
137
137
|
assert cookies is None
|
|
138
|
-
assert '
|
|
138
|
+
assert '"arc": browser_cookie3.arc' in seen["script"]
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
def test_extract_via_subprocess_retries_uv_when_current_env_has_no_output(monkeypatch) -> None:
|
|
@@ -19,22 +19,12 @@ def test_cli_user_command_works_with_client_factory(monkeypatch) -> None:
|
|
|
19
19
|
def fetch_user(self, screen_name: str) -> UserProfile:
|
|
20
20
|
return UserProfile(id="1", name="Alice", screen_name=screen_name)
|
|
21
21
|
|
|
22
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
22
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
23
23
|
runner = CliRunner()
|
|
24
24
|
result = runner.invoke(cli, ["user", "alice"])
|
|
25
25
|
assert result.exit_code == 0
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
def test_get_client_for_output_does_not_swallow_real_type_error(monkeypatch) -> None:
|
|
29
|
-
def _broken_get_client(config=None, quiet=False):
|
|
30
|
-
raise TypeError("real bug")
|
|
31
|
-
|
|
32
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", _broken_get_client)
|
|
33
|
-
|
|
34
|
-
with pytest.raises(TypeError, match="real bug"):
|
|
35
|
-
from twitter_cli.cli import _get_client_for_output
|
|
36
|
-
|
|
37
|
-
_get_client_for_output({})
|
|
38
28
|
|
|
39
29
|
|
|
40
30
|
def test_cli_feed_json_input_path(tmp_path, tweet_factory) -> None:
|
|
@@ -102,7 +92,7 @@ def test_print_tweet_table_full_text_shows_untruncated_text(tweet_factory) -> No
|
|
|
102
92
|
def test_cli_commands_wrap_client_creation_errors(monkeypatch, args) -> None:
|
|
103
93
|
monkeypatch.setattr(
|
|
104
94
|
"twitter_cli.cli._get_client",
|
|
105
|
-
lambda config=None: (_ for _ in ()).throw(RuntimeError("boom")),
|
|
95
|
+
lambda config=None, quiet=False: (_ for _ in ()).throw(RuntimeError("boom")),
|
|
106
96
|
)
|
|
107
97
|
runner = CliRunner()
|
|
108
98
|
|
|
@@ -117,7 +107,7 @@ def test_cli_user_error_yaml(monkeypatch) -> None:
|
|
|
117
107
|
monkeypatch.setenv("OUTPUT", "auto")
|
|
118
108
|
monkeypatch.setattr(
|
|
119
109
|
"twitter_cli.cli._get_client",
|
|
120
|
-
lambda config=None: (_ for _ in ()).throw(RuntimeError("User not found")),
|
|
110
|
+
lambda config=None, quiet=False: (_ for _ in ()).throw(RuntimeError("User not found")),
|
|
121
111
|
)
|
|
122
112
|
runner = CliRunner()
|
|
123
113
|
|
|
@@ -136,7 +126,7 @@ def test_cli_tweet_accepts_shared_url_with_query(monkeypatch) -> None:
|
|
|
136
126
|
assert max_count == 50
|
|
137
127
|
return []
|
|
138
128
|
|
|
139
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
129
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
140
130
|
monkeypatch.setattr(
|
|
141
131
|
"twitter_cli.cli.load_config",
|
|
142
132
|
lambda: {"fetch": {"count": 50}, "filter": {}, "rateLimit": {}},
|
|
@@ -162,7 +152,7 @@ def test_cli_article_accepts_article_url_and_json(monkeypatch) -> None:
|
|
|
162
152
|
article_text="Hello\n\n## Section",
|
|
163
153
|
)
|
|
164
154
|
|
|
165
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
155
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
166
156
|
monkeypatch.setattr(
|
|
167
157
|
"twitter_cli.cli.load_config",
|
|
168
158
|
lambda: {"fetch": {"count": 50}, "filter": {}, "rateLimit": {}},
|
|
@@ -195,7 +185,7 @@ def test_cli_article_markdown_output_and_save(monkeypatch, tmp_path) -> None:
|
|
|
195
185
|
assert tweet_id == "12345"
|
|
196
186
|
return article
|
|
197
187
|
|
|
198
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
188
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
199
189
|
monkeypatch.setattr("twitter_cli.cli.load_config", lambda: {})
|
|
200
190
|
output_path = tmp_path / "article.md"
|
|
201
191
|
runner = CliRunner()
|
|
@@ -227,7 +217,7 @@ def test_cli_article_markdown_overrides_auto_structured_output(monkeypatch) -> N
|
|
|
227
217
|
return article
|
|
228
218
|
|
|
229
219
|
monkeypatch.setenv("OUTPUT", "auto")
|
|
230
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
220
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
231
221
|
monkeypatch.setattr("twitter_cli.cli.load_config", lambda: {})
|
|
232
222
|
runner = CliRunner()
|
|
233
223
|
|
|
@@ -254,7 +244,7 @@ def test_cli_bookmark_alias_works(monkeypatch) -> None:
|
|
|
254
244
|
calls.append(tweet_id)
|
|
255
245
|
return True
|
|
256
246
|
|
|
257
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
247
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
258
248
|
runner = CliRunner()
|
|
259
249
|
|
|
260
250
|
result = runner.invoke(cli, ["bookmark", "123"])
|
|
@@ -270,7 +260,7 @@ def test_cli_whoami_command(monkeypatch) -> None:
|
|
|
270
260
|
def fetch_me(self) -> UserProfile:
|
|
271
261
|
return UserProfile(id="42", name="Test User", screen_name="testuser")
|
|
272
262
|
|
|
273
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
263
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
274
264
|
runner = CliRunner()
|
|
275
265
|
|
|
276
266
|
result = runner.invoke(cli, ["whoami"])
|
|
@@ -289,7 +279,7 @@ def test_cli_whoami_auto_yaml(monkeypatch) -> None:
|
|
|
289
279
|
return UserProfile(id="42", name="Test User", screen_name="testuser")
|
|
290
280
|
|
|
291
281
|
monkeypatch.setenv("OUTPUT", "auto")
|
|
292
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
282
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
293
283
|
runner = CliRunner()
|
|
294
284
|
|
|
295
285
|
result = runner.invoke(cli, ["whoami"])
|
|
@@ -307,7 +297,7 @@ def test_cli_status_auto_yaml(monkeypatch) -> None:
|
|
|
307
297
|
return UserProfile(id="42", name="Test User", screen_name="testuser")
|
|
308
298
|
|
|
309
299
|
monkeypatch.setenv("OUTPUT", "auto")
|
|
310
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
300
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
311
301
|
runner = CliRunner()
|
|
312
302
|
|
|
313
303
|
result = runner.invoke(cli, ["status"])
|
|
@@ -328,7 +318,7 @@ def test_cli_reply_command(monkeypatch) -> None:
|
|
|
328
318
|
calls.append({"text": text, "reply_to_id": reply_to_id})
|
|
329
319
|
return "999"
|
|
330
320
|
|
|
331
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
321
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
332
322
|
runner = CliRunner()
|
|
333
323
|
|
|
334
324
|
result = runner.invoke(cli, ["reply", "12345", "Nice tweet!"])
|
|
@@ -345,7 +335,7 @@ def test_cli_quote_command(monkeypatch) -> None:
|
|
|
345
335
|
calls.append({"tweet_id": tweet_id, "text": text})
|
|
346
336
|
return "888"
|
|
347
337
|
|
|
348
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
338
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
349
339
|
runner = CliRunner()
|
|
350
340
|
|
|
351
341
|
result = runner.invoke(cli, ["quote", "12345", "Interesting!"])
|
|
@@ -361,7 +351,7 @@ def test_cli_post_json_output(monkeypatch) -> None:
|
|
|
361
351
|
assert reply_to_id is None
|
|
362
352
|
return "999"
|
|
363
353
|
|
|
364
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
354
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
365
355
|
runner = CliRunner()
|
|
366
356
|
|
|
367
357
|
result = runner.invoke(cli, ["post", "hello", "--json"])
|
|
@@ -378,7 +368,7 @@ def test_cli_like_yaml_output(monkeypatch) -> None:
|
|
|
378
368
|
assert tweet_id == "123"
|
|
379
369
|
return True
|
|
380
370
|
|
|
381
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
371
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
382
372
|
runner = CliRunner()
|
|
383
373
|
|
|
384
374
|
result = runner.invoke(cli, ["like", "123", "--yaml"])
|
|
@@ -399,7 +389,7 @@ def test_cli_follow_json_output(monkeypatch) -> None:
|
|
|
399
389
|
assert user_id == "42"
|
|
400
390
|
return True
|
|
401
391
|
|
|
402
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
392
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
403
393
|
runner = CliRunner()
|
|
404
394
|
|
|
405
395
|
result = runner.invoke(cli, ["follow", "alice", "--json"])
|
|
@@ -421,7 +411,7 @@ def test_cli_follow_command(monkeypatch) -> None:
|
|
|
421
411
|
actions.append(("follow", user_id))
|
|
422
412
|
return True
|
|
423
413
|
|
|
424
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
414
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
425
415
|
runner = CliRunner()
|
|
426
416
|
|
|
427
417
|
result = runner.invoke(cli, ["follow", "alice"])
|
|
@@ -440,7 +430,7 @@ def test_cli_unfollow_command(monkeypatch) -> None:
|
|
|
440
430
|
actions.append(("unfollow", user_id))
|
|
441
431
|
return True
|
|
442
432
|
|
|
443
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
433
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
444
434
|
runner = CliRunner()
|
|
445
435
|
|
|
446
436
|
result = runner.invoke(cli, ["unfollow", "alice"])
|
|
@@ -457,7 +447,7 @@ def test_cli_search_advanced_options(monkeypatch) -> None:
|
|
|
457
447
|
captured["product"] = product
|
|
458
448
|
return []
|
|
459
449
|
|
|
460
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
450
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
461
451
|
monkeypatch.setattr(
|
|
462
452
|
"twitter_cli.cli.load_config",
|
|
463
453
|
lambda: {"fetch": {"count": 50}, "filter": {}, "rateLimit": {}},
|
|
@@ -492,7 +482,7 @@ def test_cli_search_operators_only_no_query(monkeypatch) -> None:
|
|
|
492
482
|
captured["query"] = query
|
|
493
483
|
return []
|
|
494
484
|
|
|
495
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: FakeClient())
|
|
485
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: FakeClient())
|
|
496
486
|
monkeypatch.setattr(
|
|
497
487
|
"twitter_cli.cli.load_config",
|
|
498
488
|
lambda: {"fetch": {"count": 50}, "filter": {}, "rateLimit": {}},
|
|
@@ -513,7 +503,7 @@ def test_cli_search_empty_query_no_options() -> None:
|
|
|
513
503
|
|
|
514
504
|
|
|
515
505
|
def test_cli_search_invalid_date_rejected(monkeypatch) -> None:
|
|
516
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: None)
|
|
506
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: None)
|
|
517
507
|
runner = CliRunner()
|
|
518
508
|
|
|
519
509
|
result = runner.invoke(cli, ["search", "python", "--since", "not-a-date"])
|
|
@@ -522,7 +512,7 @@ def test_cli_search_invalid_date_rejected(monkeypatch) -> None:
|
|
|
522
512
|
|
|
523
513
|
|
|
524
514
|
def test_cli_search_rejects_reversed_date_range(monkeypatch) -> None:
|
|
525
|
-
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None: None)
|
|
515
|
+
monkeypatch.setattr("twitter_cli.cli._get_client", lambda config=None, quiet=False: None)
|
|
526
516
|
runner = CliRunner()
|
|
527
517
|
|
|
528
518
|
result = runner.invoke(cli, ["search", "python", "--since", "2026-03-02", "--until", "2026-03-01"])
|
|
@@ -193,6 +193,20 @@ _CHROMIUM_BASE_DIRS: Dict[str, str] = {
|
|
|
193
193
|
"brave": os.path.join("BraveSoftware", "Brave-Browser"),
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
# Default browser order for cookie extraction
|
|
197
|
+
_DEFAULT_BROWSER_ORDER = ["arc", "chrome", "edge", "firefox", "brave"]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def _get_browser_order() -> List[str]:
|
|
201
|
+
"""Return browser extraction order, respecting TWITTER_BROWSER env var."""
|
|
202
|
+
env = os.environ.get("TWITTER_BROWSER", "").strip().lower()
|
|
203
|
+
if not env:
|
|
204
|
+
return _DEFAULT_BROWSER_ORDER
|
|
205
|
+
if env not in {"arc", "chrome", "edge", "firefox", "brave"}:
|
|
206
|
+
logger.warning("TWITTER_BROWSER='%s' is invalid, using default order", env)
|
|
207
|
+
return _DEFAULT_BROWSER_ORDER
|
|
208
|
+
return [env] + [b for b in _DEFAULT_BROWSER_ORDER if b != env]
|
|
209
|
+
|
|
196
210
|
|
|
197
211
|
def _iter_chrome_cookie_files(browser_name: str) -> List[str]:
|
|
198
212
|
"""Return cookie file paths for all Chrome profiles.
|
|
@@ -262,17 +276,18 @@ def _extract_in_process() -> Tuple[Optional[Dict[str, str]], List[str]]:
|
|
|
262
276
|
logger.debug("browser_cookie3 not installed, skipping in-process extraction")
|
|
263
277
|
return None, ["browser-cookie3 not installed"]
|
|
264
278
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
279
|
+
browser_fns = {
|
|
280
|
+
"arc": browser_cookie3.arc,
|
|
281
|
+
"chrome": browser_cookie3.chrome,
|
|
282
|
+
"edge": browser_cookie3.edge,
|
|
283
|
+
"firefox": browser_cookie3.firefox,
|
|
284
|
+
"brave": browser_cookie3.brave,
|
|
285
|
+
}
|
|
272
286
|
attempts: List[str] = []
|
|
273
287
|
diagnostics: List[str] = []
|
|
274
288
|
|
|
275
|
-
for name
|
|
289
|
+
for name in _get_browser_order():
|
|
290
|
+
fn = browser_fns[name]
|
|
276
291
|
if name in _CHROMIUM_BASE_DIRS:
|
|
277
292
|
# Chromium-based: iterate all profiles
|
|
278
293
|
cookie_files = _iter_chrome_cookie_files(name)
|
|
@@ -398,16 +413,23 @@ def extract_from_jar(jar, name, profile=""):
|
|
|
398
413
|
return result
|
|
399
414
|
return None
|
|
400
415
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
DEFAULT_ORDER = ["arc", "chrome", "edge", "firefox", "brave"]
|
|
417
|
+
env_browser = os.environ.get("TWITTER_BROWSER", "").strip().lower()
|
|
418
|
+
if env_browser in {"arc", "chrome", "edge", "firefox", "brave"}:
|
|
419
|
+
browser_order = [env_browser] + [b for b in DEFAULT_ORDER if b != env_browser]
|
|
420
|
+
else:
|
|
421
|
+
browser_order = DEFAULT_ORDER
|
|
422
|
+
browser_fns = {
|
|
423
|
+
"arc": browser_cookie3.arc,
|
|
424
|
+
"chrome": browser_cookie3.chrome,
|
|
425
|
+
"edge": browser_cookie3.edge,
|
|
426
|
+
"firefox": browser_cookie3.firefox,
|
|
427
|
+
"brave": browser_cookie3.brave,
|
|
428
|
+
}
|
|
408
429
|
attempts = []
|
|
409
430
|
|
|
410
|
-
for name
|
|
431
|
+
for name in browser_order:
|
|
432
|
+
fn = browser_fns[name]
|
|
411
433
|
if name in CHROMIUM_BASE_DIRS:
|
|
412
434
|
cookie_files = iter_cookie_files(name)
|
|
413
435
|
if not cookie_files:
|
|
@@ -32,7 +32,6 @@ from __future__ import annotations
|
|
|
32
32
|
|
|
33
33
|
import logging
|
|
34
34
|
import re
|
|
35
|
-
import inspect
|
|
36
35
|
import sys
|
|
37
36
|
import time
|
|
38
37
|
import urllib.parse
|
|
@@ -153,17 +152,7 @@ def _get_client(config=None, quiet=False):
|
|
|
153
152
|
)
|
|
154
153
|
|
|
155
154
|
|
|
156
|
-
def _get_client_for_output(config=None, quiet=False):
|
|
157
|
-
# type: (Optional[Dict[str, Any]], bool) -> TwitterClient
|
|
158
|
-
"""Call _get_client while staying compatible with monkeypatched legacy signatures."""
|
|
159
|
-
try:
|
|
160
|
-
signature = inspect.signature(_get_client)
|
|
161
|
-
except (TypeError, ValueError):
|
|
162
|
-
signature = None
|
|
163
155
|
|
|
164
|
-
if signature and "quiet" in signature.parameters:
|
|
165
|
-
return _get_client(config, quiet=quiet)
|
|
166
|
-
return _get_client(config)
|
|
167
156
|
|
|
168
157
|
|
|
169
158
|
def _exit_with_error(exc):
|
|
@@ -417,7 +406,7 @@ def feed(ctx, feed_type, max_count, as_json, as_yaml, input_file, output_file, d
|
|
|
417
406
|
console.print(" Loaded %d tweets" % len(tweets))
|
|
418
407
|
else:
|
|
419
408
|
fetch_count = _resolve_configured_count(config, max_count)
|
|
420
|
-
client =
|
|
409
|
+
client = _get_client(config, quiet=not rich_output)
|
|
421
410
|
label = "following feed" if feed_type == "following" else "home timeline"
|
|
422
411
|
if rich_output:
|
|
423
412
|
console.print("📡 Fetching %s (%d tweets)...\n" % (label, fetch_count))
|
|
@@ -507,7 +496,7 @@ def user(screen_name, as_json, as_yaml):
|
|
|
507
496
|
config = load_config()
|
|
508
497
|
try:
|
|
509
498
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml)
|
|
510
|
-
client =
|
|
499
|
+
client = _get_client(config, quiet=not rich_output)
|
|
511
500
|
if rich_output:
|
|
512
501
|
console.print("👤 Fetching user @%s..." % screen_name)
|
|
513
502
|
profile = client.fetch_user(screen_name)
|
|
@@ -534,7 +523,7 @@ def user_posts(ctx, screen_name, max_count, as_json, as_yaml, output_file, full_
|
|
|
534
523
|
config = load_config()
|
|
535
524
|
def _run():
|
|
536
525
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=compact)
|
|
537
|
-
client =
|
|
526
|
+
client = _get_client(config, quiet=not rich_output)
|
|
538
527
|
if rich_output:
|
|
539
528
|
console.print("👤 Fetching @%s's profile..." % screen_name)
|
|
540
529
|
profile = client.fetch_user(screen_name)
|
|
@@ -619,7 +608,7 @@ def search(ctx, query, product, from_user, to_user, lang, since, until, has, exc
|
|
|
619
608
|
config = load_config()
|
|
620
609
|
def _run():
|
|
621
610
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=compact)
|
|
622
|
-
client =
|
|
611
|
+
client = _get_client(config, quiet=not rich_output)
|
|
623
612
|
_fetch_and_display(
|
|
624
613
|
lambda count: client.fetch_search(composed_query, count, product),
|
|
625
614
|
"'%s' (%s)" % (composed_query, product), "🔍", max_count, as_json, as_yaml, output_file, do_filter, config,
|
|
@@ -648,7 +637,7 @@ def likes(ctx, screen_name, max_count, as_json, as_yaml, output_file, do_filter,
|
|
|
648
637
|
config = load_config()
|
|
649
638
|
def _run():
|
|
650
639
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=compact)
|
|
651
|
-
client =
|
|
640
|
+
client = _get_client(config, quiet=not rich_output)
|
|
652
641
|
if rich_output:
|
|
653
642
|
console.print("👤 Fetching @%s's profile..." % screen_name)
|
|
654
643
|
profile = client.fetch_user(screen_name)
|
|
@@ -694,7 +683,7 @@ def tweet(ctx, tweet_id, max_count, full_text, as_json, as_yaml):
|
|
|
694
683
|
config = load_config()
|
|
695
684
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=compact)
|
|
696
685
|
try:
|
|
697
|
-
client =
|
|
686
|
+
client = _get_client(config, quiet=not rich_output)
|
|
698
687
|
if rich_output:
|
|
699
688
|
console.print("🐦 Fetching tweet %s...\n" % tweet_id)
|
|
700
689
|
start = time.time()
|
|
@@ -758,7 +747,7 @@ def show(ctx, index, max_count, full_text, output_file, as_json, as_yaml):
|
|
|
758
747
|
config = load_config()
|
|
759
748
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=compact)
|
|
760
749
|
try:
|
|
761
|
-
client =
|
|
750
|
+
client = _get_client(config, quiet=not rich_output)
|
|
762
751
|
if rich_output:
|
|
763
752
|
console.print("🐦 Fetching tweet #%d (id: %s)...\n" % (index, tweet_id))
|
|
764
753
|
start = time.time()
|
|
@@ -796,7 +785,7 @@ def article(ctx, tweet_id, as_json, as_yaml, as_markdown, output_file):
|
|
|
796
785
|
config = load_config()
|
|
797
786
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml, compact=False) and not as_markdown
|
|
798
787
|
try:
|
|
799
|
-
client =
|
|
788
|
+
client = _get_client(config, quiet=not rich_output)
|
|
800
789
|
if rich_output:
|
|
801
790
|
console.print("📰 Fetching article %s...\n" % tweet_id)
|
|
802
791
|
start = time.time()
|
|
@@ -856,7 +845,7 @@ def followers(screen_name, max_count, as_json, as_yaml):
|
|
|
856
845
|
config = load_config()
|
|
857
846
|
try:
|
|
858
847
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml)
|
|
859
|
-
client =
|
|
848
|
+
client = _get_client(config, quiet=not rich_output)
|
|
860
849
|
if rich_output:
|
|
861
850
|
console.print("👤 Fetching @%s's profile..." % screen_name)
|
|
862
851
|
profile = client.fetch_user(screen_name)
|
|
@@ -889,7 +878,7 @@ def following(screen_name, max_count, as_json, as_yaml):
|
|
|
889
878
|
config = load_config()
|
|
890
879
|
try:
|
|
891
880
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml)
|
|
892
|
-
client =
|
|
881
|
+
client = _get_client(config, quiet=not rich_output)
|
|
893
882
|
if rich_output:
|
|
894
883
|
console.print("👤 Fetching @%s's profile..." % screen_name)
|
|
895
884
|
profile = client.fetch_user(screen_name)
|
|
@@ -1062,7 +1051,7 @@ def status(as_json, as_yaml):
|
|
|
1062
1051
|
config = load_config()
|
|
1063
1052
|
try:
|
|
1064
1053
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml)
|
|
1065
|
-
client =
|
|
1054
|
+
client = _get_client(config, quiet=not rich_output)
|
|
1066
1055
|
profile = client.fetch_me()
|
|
1067
1056
|
except RuntimeError as exc:
|
|
1068
1057
|
payload = error_payload("not_authenticated", str(exc))
|
|
@@ -1087,7 +1076,7 @@ def whoami(as_json, as_yaml):
|
|
|
1087
1076
|
config = load_config()
|
|
1088
1077
|
try:
|
|
1089
1078
|
rich_output = use_rich_output(as_json=as_json, as_yaml=as_yaml)
|
|
1090
|
-
client =
|
|
1079
|
+
client = _get_client(config, quiet=not rich_output)
|
|
1091
1080
|
if rich_output:
|
|
1092
1081
|
console.print("👤 Fetching current user...")
|
|
1093
1082
|
profile = client.fetch_me()
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
name: Publish to ClawHub
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*"
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
publish:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
permissions:
|
|
13
|
-
contents: read
|
|
14
|
-
env:
|
|
15
|
-
CLAWHUB_SLUG: twitter-cli
|
|
16
|
-
CLAWHUB_NAME: twitter-cli
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v4
|
|
20
|
-
|
|
21
|
-
- uses: actions/setup-node@v4
|
|
22
|
-
with:
|
|
23
|
-
node-version: "20"
|
|
24
|
-
|
|
25
|
-
- name: Install ClawHub CLI
|
|
26
|
-
run: npm install -g clawhub@0.7.0
|
|
27
|
-
|
|
28
|
-
- name: Publish to ClawHub
|
|
29
|
-
env:
|
|
30
|
-
CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
|
|
31
|
-
run: |
|
|
32
|
-
if [ -z "${CLAWHUB_TOKEN:-}" ]; then
|
|
33
|
-
echo "Missing required secret: CLAWHUB_TOKEN"
|
|
34
|
-
exit 1
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
if [ "${GITHUB_REF_TYPE:-}" = "tag" ] && [ -n "${GITHUB_REF_NAME:-}" ]; then
|
|
38
|
-
VERSION="${GITHUB_REF_NAME#v}"
|
|
39
|
-
else
|
|
40
|
-
VERSION="$(sed -n 's/^version = \"\([^\"]*\)\"/\1/p' pyproject.toml | head -n 1)"
|
|
41
|
-
fi
|
|
42
|
-
if [ -z "${VERSION:-}" ]; then
|
|
43
|
-
echo "Unable to resolve version"
|
|
44
|
-
exit 1
|
|
45
|
-
fi
|
|
46
|
-
echo "Publishing ${CLAWHUB_SLUG}@${VERSION}"
|
|
47
|
-
|
|
48
|
-
if clawhub --no-input inspect "${CLAWHUB_SLUG}" --version "${VERSION}" >/dev/null 2>&1; then
|
|
49
|
-
echo "Version ${VERSION} already exists on ClawHub, skipping publish."
|
|
50
|
-
exit 0
|
|
51
|
-
fi
|
|
52
|
-
|
|
53
|
-
clawhub --no-input login --token "${CLAWHUB_TOKEN}" --no-browser
|
|
54
|
-
export VERSION
|
|
55
|
-
|
|
56
|
-
# Workaround: clawhub@0.7.0 publish doesn't send acceptLicenseTerms,
|
|
57
|
-
# which the server now requires. Use a Node.js script to publish with
|
|
58
|
-
# the corrected payload.
|
|
59
|
-
# Note: NODE_TLS_REJECT_UNAUTHORIZED=0 is needed because api.clawhub.io
|
|
60
|
-
# has an expired SSL certificate. Remove once ClawHub renews their cert.
|
|
61
|
-
NODE_TLS_REJECT_UNAUTHORIZED=0 node - <<'PUBLISH_SCRIPT'
|
|
62
|
-
const { resolve } = require("path");
|
|
63
|
-
const { readFileSync, statSync, readdirSync } = require("fs");
|
|
64
|
-
const folder = resolve(".");
|
|
65
|
-
const slug = process.env.CLAWHUB_SLUG;
|
|
66
|
-
const version = process.env.VERSION;
|
|
67
|
-
|
|
68
|
-
// Collect text files (same logic as clawhub CLI)
|
|
69
|
-
function walk(dir, base = "") {
|
|
70
|
-
let files = [];
|
|
71
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
72
|
-
const rel = base ? base + "/" + entry.name : entry.name;
|
|
73
|
-
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
74
|
-
if (entry.isDirectory()) { files.push(...walk(dir + "/" + entry.name, rel)); }
|
|
75
|
-
else { files.push({ rel, abs: dir + "/" + entry.name }); }
|
|
76
|
-
}
|
|
77
|
-
return files;
|
|
78
|
-
}
|
|
79
|
-
const files = walk(folder).filter(f => {
|
|
80
|
-
const ext = f.rel.split(".").pop().toLowerCase();
|
|
81
|
-
return ["md","txt","py","toml","yml","yaml","json","cfg","ini","sh","bat"].includes(ext);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const payload = JSON.stringify({
|
|
85
|
-
slug,
|
|
86
|
-
displayName: slug,
|
|
87
|
-
version,
|
|
88
|
-
changelog: "Release " + version,
|
|
89
|
-
tags: ["latest"],
|
|
90
|
-
acceptLicenseTerms: true,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const form = new FormData();
|
|
94
|
-
form.set("payload", payload);
|
|
95
|
-
for (const file of files) {
|
|
96
|
-
const bytes = readFileSync(file.abs);
|
|
97
|
-
const blob = new Blob([bytes], { type: "text/plain" });
|
|
98
|
-
form.append("files", blob, file.rel);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Read registry and token from clawhub config
|
|
102
|
-
const os = require("os");
|
|
103
|
-
const configPath = resolve(os.homedir(), ".config", "clawhub", "config.json");
|
|
104
|
-
let token = "";
|
|
105
|
-
try {
|
|
106
|
-
const cfg = JSON.parse(readFileSync(configPath, "utf8"));
|
|
107
|
-
token = cfg.token || "";
|
|
108
|
-
} catch {}
|
|
109
|
-
if (!token) { console.error("No token found"); process.exit(1); }
|
|
110
|
-
|
|
111
|
-
const registry = "https://clawhub.ai";
|
|
112
|
-
fetch(registry + "/api/v1/skills", {
|
|
113
|
-
method: "POST",
|
|
114
|
-
headers: { Authorization: "Bearer " + token },
|
|
115
|
-
body: form,
|
|
116
|
-
}).then(async (r) => {
|
|
117
|
-
const text = await r.text();
|
|
118
|
-
if (!r.ok) {
|
|
119
|
-
console.error("Publish failed:", r.status, text);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
console.log("✔ Published", slug + "@" + version);
|
|
123
|
-
}).catch((e) => {
|
|
124
|
-
console.error(e);
|
|
125
|
-
process.exit(1);
|
|
126
|
-
});
|
|
127
|
-
PUBLISH_SCRIPT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|