@stephendolan/ynab-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/cli.js +1202 -0
- package/dist/cli.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Stephen Dolan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# YNAB CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@stephendolan/ynab-cli)
|
|
4
|
+
[](https://www.npmjs.com/package/@stephendolan/ynab-cli)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
|
|
8
|
+
A command-line interface for You Need a Budget (YNAB) designed to enable LLMs (Claude, ChatGPT, etc.) and developers to quickly interface with YNAB budgets, make changes, and audit financial data.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **LLM-First Design**: JSON output by default for easy parsing and integration with AI assistants
|
|
13
|
+
- **Advanced Filtering**: Built-in filters reduce need for external tools like `jq` - filter by approval status, amount ranges, field selection, and search capabilities
|
|
14
|
+
- **Comprehensive Coverage**: Support for all major YNAB API endpoints
|
|
15
|
+
- **Type Safety**: Built with TypeScript for robust error handling
|
|
16
|
+
- **Raw API Access**: Fallback command for any operation not covered by convenience commands
|
|
17
|
+
- **Simple Authentication**: Uses personal access tokens stored securely in OS keychain
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install globally
|
|
23
|
+
npm install -g @stephendolan/ynab-cli
|
|
24
|
+
|
|
25
|
+
# Or run directly without installing
|
|
26
|
+
npx @stephendolan/ynab-cli budgets list
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### From Source
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/stephendolan/ynab-cli.git
|
|
33
|
+
cd ynab-cli
|
|
34
|
+
npm install
|
|
35
|
+
npm run link # Build and link globally
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Authentication
|
|
39
|
+
|
|
40
|
+
Set your YNAB personal access token using the CLI or environment variables:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ynab auth login # Interactive token entry, stored in OS keychain
|
|
44
|
+
ynab auth status # Check authentication status
|
|
45
|
+
ynab auth logout # Remove stored credentials
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or use environment variables (recommended for development):
|
|
49
|
+
|
|
50
|
+
```env
|
|
51
|
+
YNAB_API_KEY=your_personal_access_token
|
|
52
|
+
YNAB_BUDGET_ID=your_default_budget_id # Optional
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Global Flags
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
--compact, -c # Minified JSON output (single line)
|
|
61
|
+
--output, -o <file> # Write output to file instead of stdout
|
|
62
|
+
--budget, -b <id> # Specify budget ID (uses default/env if not specified)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Commands
|
|
66
|
+
|
|
67
|
+
#### User
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
ynab user info # Get authenticated user information
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Budgets
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
ynab budgets list # List all budgets
|
|
77
|
+
ynab budgets view [id] # View budget details
|
|
78
|
+
ynab budgets settings [id] # View budget settings
|
|
79
|
+
ynab budgets set-default <id> # Set default budget
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Accounts
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
ynab accounts list # List all accounts
|
|
86
|
+
ynab accounts view <id> # View account details
|
|
87
|
+
ynab accounts transactions <id> # List transactions for account
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Categories
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
ynab categories list # List all categories
|
|
94
|
+
ynab categories view <id> # View category details
|
|
95
|
+
ynab categories budget <id> --month <YYYY-MM> --amount <amount>
|
|
96
|
+
ynab categories transactions <id> # List transactions for category
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### Transactions
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# List and filter
|
|
103
|
+
ynab transactions list
|
|
104
|
+
ynab transactions list --account <id>
|
|
105
|
+
ynab transactions list --category <id>
|
|
106
|
+
ynab transactions list --payee <id>
|
|
107
|
+
ynab transactions list --since <YYYY-MM-DD> --until <YYYY-MM-DD>
|
|
108
|
+
ynab transactions list --approved=false
|
|
109
|
+
ynab transactions list --min-amount 100 --max-amount 500
|
|
110
|
+
ynab transactions list --status=cleared,reconciled
|
|
111
|
+
ynab transactions list --fields id,date,amount,memo
|
|
112
|
+
|
|
113
|
+
# Search
|
|
114
|
+
ynab transactions search --memo "coffee"
|
|
115
|
+
ynab transactions search --payee-name "Amazon"
|
|
116
|
+
ynab transactions search --amount 42.50
|
|
117
|
+
|
|
118
|
+
# CRUD operations
|
|
119
|
+
ynab transactions view <id>
|
|
120
|
+
ynab transactions create
|
|
121
|
+
ynab transactions create --account <id> --amount <amount> --date <YYYY-MM-DD>
|
|
122
|
+
ynab transactions update <id> --amount <amount>
|
|
123
|
+
ynab transactions delete <id>
|
|
124
|
+
ynab transactions import
|
|
125
|
+
ynab transactions split <id> --splits '[{"amount": -50.00, "category_id": "xxx", "memo": "..."}]'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Scheduled Transactions
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
ynab scheduled list # List all scheduled transactions
|
|
132
|
+
ynab scheduled view <id> # View scheduled transaction
|
|
133
|
+
ynab scheduled delete <id> # Delete scheduled transaction
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Payees
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
ynab payees list # List all payees
|
|
140
|
+
ynab payees view <id> # View payee details
|
|
141
|
+
ynab payees update <id> --name <name> # Rename payee
|
|
142
|
+
ynab payees locations <id> # List locations for payee
|
|
143
|
+
ynab payees transactions <id> # List transactions for payee
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Months
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
ynab months list # List all budget months
|
|
150
|
+
ynab months view <YYYY-MM> # View specific month details
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Raw API Access
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
ynab api <method> <path> [--data <json>]
|
|
157
|
+
|
|
158
|
+
# Examples:
|
|
159
|
+
ynab api GET /budgets
|
|
160
|
+
ynab api GET /budgets/{budget_id}/transactions
|
|
161
|
+
ynab api POST /budgets/{budget_id}/transactions --data '{"transaction": {...}}'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Output Format
|
|
165
|
+
|
|
166
|
+
All commands return JSON by default:
|
|
167
|
+
|
|
168
|
+
- **Lists**: Arrays of objects (not wrapped)
|
|
169
|
+
- **Single items**: Objects directly
|
|
170
|
+
- **Errors**: `{"error": {"name": "...", "detail": "...", "statusCode": 400}}`
|
|
171
|
+
|
|
172
|
+
## Currency Format
|
|
173
|
+
|
|
174
|
+
**All amounts are in dollars.** The CLI automatically converts YNAB's internal milliunit format (1000 = $1.00) in both input and output.
|
|
175
|
+
|
|
176
|
+
- Input: `--min-amount 100` means $100
|
|
177
|
+
- Output: `"amount": -555.28` means -$555.28
|
|
178
|
+
|
|
179
|
+
## API Limitations
|
|
180
|
+
|
|
181
|
+
The YNAB API does not support:
|
|
182
|
+
|
|
183
|
+
- Creating categories, category groups, or payees
|
|
184
|
+
- Updating accounts (beyond initial creation)
|
|
185
|
+
|
|
186
|
+
Use the YNAB web or mobile app for these operations.
|
|
187
|
+
|
|
188
|
+
## API Rate Limits
|
|
189
|
+
|
|
190
|
+
- 200 requests per hour per access token
|
|
191
|
+
- Rolling window
|
|
192
|
+
- Returns HTTP 429 when exceeded
|
|
193
|
+
|
|
194
|
+
## References
|
|
195
|
+
|
|
196
|
+
- [YNAB API Documentation](https://api.ynab.com/)
|
|
197
|
+
- [YNAB JavaScript SDK](https://github.com/ynab/ynab-sdk-js)
|
|
198
|
+
- [Specification](./SPEC.md)
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|