返回顶部
t

twexapi-clitwexapi命令行工具

Use this skill when the task should be done through the twexapi command-line client, including installing the CLI, configuring app or profile auth, previewing requests, and calling twexapi endpoints through convenience commands or raw paths.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.1
安全检测
已通过
149
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

twexapi-cli

twexapi-cli

当任务应通过运行 twexapi 命令完成,而非手动重新实现请求逻辑时,使用此技能。

使用此技能的场景

  • - 用户想要安装或运行 twexapi CLI
  • 用户想要配置 API 密钥、cookie 或 auth_token
  • 用户想要使用 --dry-run 测试或检查请求
  • 用户想要调用支持的 twexapi 命令,用于用户、推文、搜索、关注者、关注、列表或关注操作
  • 用户知道端点路径,并希望通过通用 twexapi 形式调用它

当任务是编辑 CLI 源代码本身时,不要将此技能视为主接口。

默认方法

  1. 1. 确认 CLI 可用。
  2. 确保有可用的应用配置或 API 密钥用于读取请求。
  3. 确保有已保存的配置文件或显式 cookie 用于写入请求。
  4. 优先使用便捷命令。
  5. 仅在没有便捷命令适用时,回退到 twexapi
  6. 在实际写入操作前使用 --dry-run,除非用户明确要求执行。

安装与运行

对于普通用户,优先使用已发布的 npm 包:

bash
npm install -g twexapi-cli
twexapi --help

在此仓库中工作时:

bash
node ./bin/twexapi.js --help

开发过程中如果需要本地可执行文件:

bash
npm link
twexapi --help

需要 Node.js 18 或更高版本。

认证规则

  • - API 密钥来自 https://twexapi.io/dashboard。
  • 对于一次性命令,TWEXAPIKEY 或 --api-key 是可接受的。
  • CLI 也支持 TWEXAPIBASEURL 和 TWEXAPICONFIGDIR。
  • 对于重复使用,优先使用 auth apps add 保存的应用配置。
  • 对于写入操作,需要 --cookie 或已保存的配置文件。
  • 如果请求写入操作但没有可用的配置文件或 cookie,则停止并请求认证详情,而不是猜测。
  • 默认情况下,CLI 在 ~/.twexapi/config.json 中读写持久配置。
  • 保存的应用配置可能包含 API 密钥,保存的配置文件可能包含 cookie、authtoken 或 ct0,以纯 JSON 格式存储。
  • 在共享机器或 CI 上,优先使用 --config-dir 或 TWEXAPICONFIGDIR 来隔离凭据。

应用设置:

bash
twexapi auth apps add --name prod --api-key twitterx_...
twexapi auth apps use prod

从 cookie 设置配置文件:

bash
twexapi auth profiles add --name founder --cookie ct0=...; auth_token=...
twexapi auth profiles use founder

从认证令牌设置配置文件:

bash
twexapi auth cookie --auth-token yourauthtoken --save-as founder

检查配置:

bash
twexapi config show
twexapi config path

命令选择

优先使用便捷命令,例如:

bash
twexapi --app prod about elonmusk
twexapi --app prod users elonmusk sama
twexapi --app prod search users openai --count 20
twexapi --app prod tweet lookup 1900000000000000000

当端点已知但未封装时,使用通用路径形式:

bash
twexapi /twitter/elonmusk/about
twexapi -X POST -d [elonmusk,sama] /twitter/users

安全与执行规则

  • - 将全局选项如 --app、--profile、--api-key 和 --dry-run 放在命令之前。
  • 对于写入操作,如 tweet create、tweet like、user follow 和 list create,优先使用 --dry-run。
  • 仅在用户明确希望执行后才发送真实的写入请求。
  • CLI 会在配置输出和 dry-run 预览中屏蔽密钥,但仍避免将原始凭据回显给用户。
  • auth cookie 使用的请求路径包含 auth_token,因此要注意日志和追踪。
  • 未实现本地媒体文件上传;推文创建支持 --media-url。
  • 不包含 DM 命令。

推荐的测试流程

为本地测试使用隔离的配置目录:

bash
twexapi --config-dir ./.twexapi-local config show

推荐顺序:

  1. 1. 使用 twexapi --help 或 node ./bin/twexapi.js --help 验证 CLI 启动。
  2. 验证读取命令,如 about 或 users。
  3. 如果需要,验证原始路径请求。
  4. 在任何真实写入操作之前,使用 --dry-run 验证写入命令的请求构建。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 twexapi-cli-1776113524 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 twexapi-cli-1776113524 技能

通过命令行安装

skillhub install twexapi-cli-1776113524

下载

⬇ 下载 twexapi-cli v0.1.1(免费)

文件大小: 15.2 KB | 发布时间: 2026-4-17 16:25

v0.1.1 最新 2026-4-17 16:25
twexapi-cli 0.1.1

- Expanded authentication docs: now documents support for `TWEXAPI_BASE_URL`, `TWEXAPI_CONFIG_DIR`, persistent config in `~/.twexapi/config.json`, and credential isolation on shared machines.
- Clarified config and credential storage, including how saved apps and profiles are handled.
- Noted that `auth cookie` includes the `auth_token` in request paths and should be treated carefully in logs.
- Documentation improvements throughout for clarity and explicit safety recommendations.
- No changes to CLI command behavior—documentation updates only.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部