finance-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesefinance-cli
finance-cli
Personal finance management from the terminal. Track accounts, transactions, budgets, savings goals, and generate reports. Designed for both human use and AI agent operation.
一款可在终端使用的个人财务管理工具。支持追踪账户、交易记录、预算、储蓄目标,并生成报表。同时适配人工操作与AI Agent运行。
Quick Start
快速开始
bash
undefinedbash
undefinedInstall and verify
安装并验证版本
npx finance-cli --version
npx finance-cli --version
Check database status
检查数据库状态
npx finance-cli status --json
undefinednpx finance-cli status --json
undefinedGlobal Flags
全局参数
| Flag | Description |
|---|---|
| Output structured JSON instead of human-readable tables |
| Use a specific SQLite database file (default: |
Environment variable can also set the database path.
FINANCE_CLI_DB| 参数 | 说明 |
|---|---|
| 输出结构化JSON数据,而非易读的表格形式 |
| 使用指定的SQLite数据库文件(默认路径: |
也可通过环境变量设置数据库路径。
FINANCE_CLI_DBJSON Response Envelope
JSON响应格式
All responses follow this structure:
--jsonjson
{
"status": "success",
"data": { ... },
"message": "Human-readable description"
}On error:
json
{
"status": "error",
"message": "What went wrong"
}Important: All monetary amounts in JSON are stored as integer cents (e.g., = $1,500.00). Divide by 100 for display.
150000所有带参数的响应均遵循以下结构:
--jsonjson
{
"status": "success",
"data": { ... },
"message": "Human-readable description"
}错误时的响应:
json
{
"status": "error",
"message": "What went wrong"
}重要提示:JSON中的所有金额均以整数分存储(例如: = 1500.00美元)。如需显示为元,需除以100。
150000Commands Overview
命令概览
| Command | Alias | Description |
|---|---|---|
| | Create a new account (bank, cash, credit) |
| | List all accounts with balances |
| | Edit account name or type |
| | Delete an account |
| | Show computed balance for an account |
| | Transfer between accounts |
| | Create a spending category |
| | List all categories |
| | Edit a category name |
| | Delete a category |
| | Add income or expense transaction |
| | List transactions with filters |
| | Edit a transaction |
| | Delete a transaction |
| Set monthly budget for a category | |
| Show budget vs actual spending | |
| Compare budget vs actual (detailed) | |
| List all budgets | |
| Delete a budget | |
| Create a savings goal | |
| List all goals with progress | |
| Detailed goal status | |
| Contribute to a goal (creates real transaction) | |
| Edit a savings goal | |
| Delete a savings goal | |
| | Create a recurring transaction |
| | List recurring transactions |
| | Edit a recurring transaction |
| | Delete a recurring transaction |
| | Process all due recurring transactions |
| Monthly financial summary | |
| Category spending breakdown | |
| All account balances overview | |
| Import transactions from CSV file | |
| Export transactions to CSV | |
| Export all data as structured JSON | |
| Create SQLite database backup | |
| Restore database from backup | |
| Show CLI and database status |
| 命令 | 别名 | 说明 |
|---|---|---|
| | 创建新账户(银行账户、现金账户、信用卡账户) |
| | 列出所有账户及余额 |
| | 编辑账户名称或类型 |
| | 删除账户 |
| | 显示指定账户的结算余额 |
| | 账户间转账 |
| | 创建支出分类 |
| | 列出所有分类 |
| | 编辑分类名称 |
| | 删除分类 |
| | 添加收入或支出交易记录 |
| | 按筛选条件列出交易记录 |
| | 编辑交易记录 |
| | 删除交易记录 |
| 设置分类月度预算 | |
| 显示预算与实际支出对比 | |
| 详细对比预算与实际支出 | |
| 列出所有预算 | |
| 删除预算 | |
| 创建储蓄目标 | |
| 列出所有储蓄目标及进度 | |
| 查看储蓄目标的详细状态 | |
| 向储蓄目标缴款(会创建真实交易记录) | |
| 编辑储蓄目标 | |
| 删除储蓄目标 | |
| | 创建定期交易记录 |
| | 列出所有定期交易记录 |
| | 编辑定期交易记录 |
| | 删除定期交易记录 |
| | 处理所有到期的定期交易记录 |
| 月度财务汇总报表 | |
| 支出分类明细报表 | |
| 全账户余额概览 | |
| 从CSV文件导入交易记录 | |
| 将交易记录导出为CSV文件 | |
| 将所有数据导出为结构化JSON | |
| 创建SQLite数据库备份 | |
| 从备份恢复数据库 | |
| 查看CLI及数据库状态 |
Common Workflows
常见工作流
1. Set Up Accounts and Track First Expense
1. 创建账户并记录首笔支出
bash
undefinedbash
undefinedCreate a checking account
创建支票账户
npx finance-cli account create --name "Checking" --type bank --balance 2500.00 --json
npx finance-cli account create --name "Checking" --type bank --balance 2500.00 --json
Create a spending category
创建支出分类
npx finance-cli category create --name "Groceries" --json
npx finance-cli category create --name "Groceries" --json
Record an expense (use account ID and category ID from above)
记录一笔支出(使用上述步骤得到的账户ID和分类ID)
npx finance-cli transaction add --type expense --amount 45.50 --account 1 --category 1 --note "Weekly groceries" --json
undefinednpx finance-cli transaction add --type expense --amount 45.50 --account 1 --category 1 --note "Weekly groceries" --json
undefined2. Monthly Budget Check
2. 月度预算检查
bash
undefinedbash
undefinedSet a budget for a category
设置分类预算
npx finance-cli budget set --category 1 --limit 500.00 --month 2026-03 --json
npx finance-cli budget set --category 1 --limit 500.00 --month 2026-03 --json
Check budget status
查看预算状态
npx finance-cli budget status --month 2026-03 --json
npx finance-cli budget status --month 2026-03 --json
Get full monthly summary
获取完整月度汇总
npx finance-cli report summary --month 2026-03 --json
undefinednpx finance-cli report summary --month 2026-03 --json
undefined3. Import Bank Data
3. 导入银行数据
bash
undefinedbash
undefinedPreview import (dry run)
预览导入(试运行)
npx finance-cli import csv --file bank-export.csv --date-col 0 --amount-col 2 --note-col 1 --default-account 1 --dry-run --json
npx finance-cli import csv --file bank-export.csv --date-col 0 --amount-col 2 --note-col 1 --default-account 1 --dry-run --json
Execute import
执行导入
npx finance-cli import csv --file bank-export.csv --date-col 0 --amount-col 2 --note-col 1 --default-account 1 --json
undefinednpx finance-cli import csv --file bank-export.csv --date-col 0 --amount-col 2 --note-col 1 --default-account 1 --json
undefined4. Savings Goal Tracking
4. 储蓄目标追踪
bash
undefinedbash
undefinedCreate a savings goal linked to an account
创建关联账户的储蓄目标
npx finance-cli goal create --name "Emergency Fund" --target 10000.00 --deadline 2026-12-31 --account 2 --json
npx finance-cli goal create --name "Emergency Fund" --target 10000.00 --deadline 2026-12-31 --account 2 --json
Contribute to goal (creates a real expense transaction)
向储蓄目标缴款(创建真实支出交易记录)
npx finance-cli goal contribute 1 --amount 500.00 --json
npx finance-cli goal contribute 1 --amount 500.00 --json
Check progress
查看进度
npx finance-cli goal status 1 --json
undefinednpx finance-cli goal status 1 --json
undefinedReference
参考文档
For full parameter details, JSON response schemas, and all flag options for every command, see references/commands.md.
如需了解所有命令的完整参数说明、JSON响应格式及全部参数选项,请查看references/commands.md。