codeline-cli
Setup
If codeline-cli is not installed, install it from GitHub:
CODEBLOCK0
If codeline-cli is not found, install and build it:
CODEBLOCK1
INLINECODE2 adds ~/.local/bin to PATH automatically. The CLI is available in the next command.
Always use --json flag when calling commands programmatically.
Authentication
CODEBLOCK2
Resources
tools
| Command | Description |
|---|
| INLINECODE5 | List all available tools |
| INLINECODE6 |
Run tool by name |
|
codeline-cli tools run --tool get_user --params '{"email":"test@example.com"}' --json | Run tool with JSON parameters |
|
codeline-cli tools run --tool list_orders --params '{"limit":10}' --fields id,status --json | Run tool with custom field output |
products
| Command | Description |
|---|
| INLINECODE9 | List all products |
| INLINECODE10 |
List with specific columns |
|
codeline-cli products get --id abc123 --json | Get product by ID |
orders
| Command | Description |
|---|
| INLINECODE12 | List all orders |
| INLINECODE13 |
List orders with max results |
|
codeline-cli orders list --fields id,status,total --json | List with custom columns |
|
codeline-cli orders get --id abc123 --json | Get order by ID |
users
| Command | Description |
|---|
| INLINECODE16 | List all users |
| INLINECODE17 |
List users with columns |
|
codeline-cli users get --id abc123 --json | Get user by ID |
|
codeline-cli users get --id "test@example.com" --json | Get user by email address |
coupons
| Command | Description |
|---|
| INLINECODE20 | List all coupons |
| INLINECODE21 |
List with specific columns |
|
codeline-cli coupons create --code SAVE20 --discount 20 --json | Create percentage discount (20%) |
|
codeline-cli coupons create --code FLAT10 --discount 10 --type fixed --json | Create fixed amount coupon |
|
codeline-cli coupons create --code LAUNCH --discount 50 --max-uses 100 --json | Create with usage limit |
|
codeline-cli coupons create --code SPECIAL --discount 15 --expires-at "2026-12-31" --json | Create with expiration |
|
codeline-cli coupons create --code PRODUCT5 --discount 5 --product-id xyz789 --json | Create for specific product |
Global Flags
All commands support: --json, --format <text|json|csv|yaml>, --verbose, --no-color, INLINECODE31
codeline-cli
设置
如果 codeline-cli 未安装,请从 GitHub 安装:
bash
npx api2cli install Melvynx/codeline-cli
如果找不到 codeline-cli,请安装并构建:
bash
bun --version || curl -fsSL https://bun.sh/install | bash
npx api2cli bundle codeline
npx api2cli link codeline
api2cli link 会自动将 ~/.local/bin 添加到 PATH 环境变量中。CLI 可在下一个命令中使用。
以编程方式调用命令时,请始终使用 --json 标志。
身份验证
bash
codeline-cli auth set your-token
codeline-cli auth test
资源
工具
| 命令 | 描述 |
|---|
| codeline-cli tools list --json | 列出所有可用工具 |
| codeline-cli tools run --tool list_products --json |
按名称运行工具 |
| codeline-cli tools run --tool get_user --params {email:test@example.com} --json | 使用 JSON 参数运行工具 |
| codeline-cli tools run --tool list_orders --params {limit:10} --fields id,status --json | 使用自定义字段输出运行工具 |
产品
| 命令 | 描述 |
|---|
| codeline-cli products list --json | 列出所有产品 |
| codeline-cli products list --fields id,name,price --json |
按指定列列出产品 |
| codeline-cli products get --id abc123 --json | 按 ID 获取产品 |
订单
| 命令 | 描述 |
|---|
| codeline-cli orders list --json | 列出所有订单 |
| codeline-cli orders list --limit 10 --json |
列出订单并限制最大结果数 |
| codeline-cli orders list --fields id,status,total --json | 按自定义列列出订单 |
| codeline-cli orders get --id abc123 --json | 按 ID 获取订单 |
用户
| 命令 | 描述 |
|---|
| codeline-cli users list --json | 列出所有用户 |
| codeline-cli users list --fields id,email,name --json |
按列列出用户 |
| codeline-cli users get --id abc123 --json | 按 ID 获取用户 |
| codeline-cli users get --id test@example.com --json | 按电子邮件地址获取用户 |
优惠券
| 命令 | 描述 |
|---|
| codeline-cli coupons list --json | 列出所有优惠券 |
| codeline-cli coupons list --fields code,discount,type --json |
按指定列列出优惠券 |
| codeline-cli coupons create --code SAVE20 --discount 20 --json | 创建百分比折扣(20%) |
| codeline-cli coupons create --code FLAT10 --discount 10 --type fixed --json | 创建固定金额优惠券 |
| odeline-cli coupons create --code LAUNCH --discount 50 --max-uses 100 --json | 创建带使用限制的优惠券 |
| codeline-cli coupons create --code SPECIAL --discount 15 --expires-at 2026-12-31 --json | 创建带过期时间的优惠券 |
| codeline-cli coupons create --code PRODUCT5 --discount 5 --product-id xyz789 --json | 为特定产品创建优惠券 |
全局标志
所有命令均支持:--json、--format 、--verbose、--no-color、--no-header