@ucascn/datahub-cli
v0.1.3
Published
DataHub Open API 与 API Hub 通用命令行客户端
Downloads
309
Readme
@ucascn/datahub-cli
DataHub 开放接口与 API Hub 的通用 TypeScript CLI,安装后的命令为 datahub。
使用
npm install -g @ucascn/datahub-cli
datahub auth init
datahub api list open --format json
datahub api list hub --format json
datahub api call open /material/query --data @request.json --format json
datahub api call hub /ncc/wu_liao_cha_xun --data @request.json --format jsonauth init 在交互式终端中会询问 Base URL(默认 https://work.ucas.com.cn:4011)并隐藏输入
API Key;非交互环境请提供 --base-url、--api-key 或对应环境变量。
接口按 source + HTTP method + path 定位;同一路径有多个方法时增加 --method GET 或
--method POST。
输出默认是 JSON,也可以显式传入 --format json;当前不支持其他输出格式,缺少格式值也会报错。
CLI 由远端 /api/open/docs.json 和 /api/hub/docs.json 动态发现接口,不维护业务接口
固定代码。API Key 只通过 X-API-Key 请求头发送。
Agent Skill
Skill 由独立仓库统一维护,不随 CLI 包发布。标准安装方式:
npx skills add ucas-cn/datahub-cli-skill -y -g仓库地址:https://github.com/ucas-cn/datahub-cli-skill(skill 内容以 npx skills add
安装,CLI 不提供 skill 子命令)。
