@ramp / cli
CLI用于Ramp的开发者API。通过OAuth认证,管理费用,批准账单,预订旅行等-从您的终端或人工智能代理。
安装
npm install -g @ramp/cli
或者直接运行而不进行全局安装:
npx @ramp/cli --help
需要Node.js 22+和npm 10+(不需要Python)。支持的平台:macOS (Apple Silicon & Intel), Linux (glibc x64 & arm64)和Windows (x64)。
关于单命令匝道路由器设置,请参见 @ramp/router (npx @ramp/router)。
快速入门
ramp auth login # OAuth via browser
ramp users me # Current user details
ramp bills search --query "Acme" # Search bills by vendor name
ramp cards list # List your cards (card_state shows ACTIVE)
ramp transactions list --transactions_to_retrieve my_transactions
ramp transactions list --transactions_to_retrieve my_transactions --from_date 2025-01-01
ramp transactions list --transactions_to_retrieve my_transactions --rationale "Monthly review" --agent # JSON output for scripting
ramp router # Open the Router workspace
ramp update # Update to the latest release
命令
| 命令 | 描述 |
|---|---|
auth | 登录,注销,检查状态 |
config | 获取/设置CLI配置 |
env | 显示或设置默认环境(沙箱/生产) |
profile | 显示、列出或切换凭证配置文件 |
router | 连接编码代理,管理密钥和策略 |
applications | 申请一个Ramp帐户 |
skills | 浏览并安装代理技能说明 |
update | 更新CLI到最新版本 |
feedback | 提交对CLI的反馈 |
资源
12种资源,每种资源都有自己的工具:
| 资源 | 工具 |
|---|---|
accounting | categories, category-options |
bills | search, get, draft, pending, approve, attachments |
cards | list, activate, lock (别名也下 funds) |
funds | list, activate, creds, lock |
general | comment, explain, help-center |
purchase-orders | search, get |
receipts | upload, attach |
reimbursements | list, pending, submit, approve, edit |
requests | pending, approve |
transactions | list, get, approve, edit, missing, flag-missing, explain-missing, memo-suggestions, trips |
travel | list, create, bookings, locations |
users | list, me, org-chart |
用法: ramp <resource> <tool> [OPTIONS]
全球旗帜
| 国旗 | 描述 |
|---|---|
--env, -e | production (默认)或 sandbox |
--output, -o | 输出格式: json 或者 table |
--agent | 机器可读JSON输出(管道时的默认值) |
--human | 人类可读的表输出(终端中的默认值) |
--wide | 在表输出中显示所有列 |
--quiet, -q | 抑制进度输出 |
--no-input | 禁用交互式提示(用于CI/脚本) |
工具旗帜
| 国旗 | 描述 |
|---|---|
--json TEXT | 原始JSON请求体(绕过标志) |
--dry_run, -n | 未发送打印请求 |
--page_size N | 每页结果 |
--next_page_cursor | 从以前的响应恢复分页 |
运行 ramp <resource> <tool> --help 查看某个工具的所有可用标志。
代理模式
--agent 输出用于脚本和AI代理使用的JSON。管 jq 处理:
ramp transactions list --transactions_to_retrieve my_transactions --rationale "Monthly review" --agent | jq '.data[0]'
ramp users me --rationale "Look up my user ID" --agent | jq '.data[0].user_id'
许可证
MIT -见 https://github.com/ramp-public/ramp-cli 获取完整的文档和源代码。