bkper 4.9.1 → 4.10.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.
@@ -0,0 +1,924 @@
1
+ [bkper.yaml reference]: #bkperyaml-reference
2
+ [Developer Docs]: https://bkper.com/docs
3
+ [App Template]: https://github.com/bkper/bkper-app-template
4
+ [Pi]: https://pi.dev/
5
+
6
+ A unified **interface for [Bkper](https://bkper.com)**. Use `bkper` in two complementary modes:
7
+
8
+ - **Interactive mode** — run `bkper` with no arguments to open the agent TUI
9
+ - **Command mode** — run `bkper <command>` for explicit CLI workflows, scripts, and automation
10
+
11
+ With one tool, you can build and deploy Bkper apps, and manage financial data -- books, accounts, transactions, and balances.
12
+
13
+ [![npm](https://img.shields.io/npm/v/bkper?color=%235889e4)](https://www.npmjs.com/package/bkper)
14
+
15
+ ## Quick Start
16
+
17
+ ### Prerequisites
18
+
19
+ - [Node.js](https://nodejs.org/) >= 18
20
+
21
+ ### Install (choose one)
22
+
23
+ ```bash tab="bun"
24
+ bun add -g bkper
25
+ ```
26
+
27
+ ```bash tab="npm"
28
+ npm i -g bkper
29
+ ```
30
+
31
+ ```bash tab="pnpm"
32
+ pnpm add -g bkper
33
+ ```
34
+
35
+ ```bash tab="yarn"
36
+ yarn global add bkper
37
+ ```
38
+
39
+ ### Authenticate
40
+
41
+ ```bash
42
+ bkper auth login
43
+ ```
44
+
45
+ ### Start using bkper
46
+
47
+ ```bash
48
+ # Interactive mode (agent TUI)
49
+ bkper
50
+ ```
51
+
52
+ ```bash
53
+ # Command mode (explicit command)
54
+ bkper book list
55
+ ```
56
+
57
+ Pick a book and create your first transaction:
58
+
59
+ ```bash
60
+ bkper transaction create -b <bookId> --description "Office supplies 123.78"
61
+ ```
62
+
63
+ > Run `bkper --help` or `bkper <command> --help` for built-in documentation on any command.
64
+ >
65
+ > To build and deploy Bkper Apps, see [App Management](#app-management).
66
+
67
+ ### Access Token
68
+
69
+ Use the access token for direct API calls from any tool:
70
+
71
+ ```bash
72
+ # Print the current access token
73
+ TOKEN=$(bkper auth token)
74
+
75
+ # Use it with curl, httpie, or any HTTP client
76
+ curl -s -H "Authorization: Bearer $TOKEN" \
77
+ https://api.bkper.app/v5/books | jq '.items[].name'
78
+ ```
79
+
80
+ ## Interactive Mode (powered by Pi)
81
+
82
+ When you run `bkper` with no arguments in an interactive terminal, bkper starts the embedded agent TUI.
83
+
84
+ Bkper's agent mode is intentionally a **thin wrapper** around [Pi][Pi]:
85
+
86
+ - Pi provides the core agent runtime and TUI
87
+ - bkper adds Bkper-specific domain context and startup maintenance behavior
88
+
89
+ ### Startup maintenance (non-blocking)
90
+
91
+ On each agent startup, bkper performs a background CLI auto-update check (same behavior as command mode).
92
+
93
+ ### Pi passthrough
94
+
95
+ Use Pi CLI features directly through bkper:
96
+
97
+ ```bash
98
+ bkper agent -- <pi-args>
99
+ ```
100
+
101
+ Examples:
102
+
103
+ ```bash
104
+ bkper agent -- -p "Summarize this repository"
105
+ bkper agent -- --model openai/gpt-4o -c
106
+ bkper agent -- install <pi-package-source>
107
+ ```
108
+
109
+ `bkper agent` keeps Bkper defaults (including Bkper system prompt) unless you explicitly pass `--system-prompt`.
110
+
111
+ For all available passthrough flags and commands, see the Pi CLI reference:
112
+ https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent#cli-reference
113
+
114
+ Pi-specific extensions are loaded from Pi extension folders (for example `.pi/extensions` and `~/.pi/agent/extensions`).
115
+
116
+ <!-- Suggested showcase media: add a short terminal GIF here (bkper -> "Bkper Agent ready." -> one prompt). -->
117
+
118
+ ---
119
+
120
+ ## Data Management
121
+
122
+ **Interact with books, accounts, transactions, and balances.**
123
+
124
+ All data commands that operate within a book use `-b, --book <bookId>` to specify the book context.
125
+
126
+ ### Books
127
+
128
+ Create and manage financial books with locale-specific settings.
129
+
130
+ ```bash
131
+ # List all books
132
+ bkper book list
133
+
134
+ # Get book details
135
+ bkper book get abc123
136
+
137
+ # Create a book with Brazilian settings
138
+ bkper book create --name "My Company" --fraction-digits 2 \
139
+ --date-pattern "dd/MM/yyyy" --decimal-separator COMMA \
140
+ --time-zone "America/Sao_Paulo"
141
+
142
+ # Create a book with custom properties
143
+ bkper book create --name "Project X" -p "code=PX001" -p "department=Engineering"
144
+
145
+ # Update a book
146
+ bkper book update abc123 --lock-date 2024-12-31
147
+ ```
148
+
149
+ <details>
150
+ <summary>Command reference</summary>
151
+
152
+ - `book list` - List all books
153
+ - `-q, --query <query>` - Search query
154
+ - `book get <bookId>` - Get a book's details
155
+ - `book create` - Create a new book
156
+ - `--name <name>` - Book name (required)
157
+ - `--fraction-digits <digits>` - Number of decimal places (`0`-`8`)
158
+ - `--date-pattern <pattern>` - Date format pattern (`dd/MM/yyyy`, `MM/dd/yyyy`, or `yyyy/MM/dd`)
159
+ - `--decimal-separator <separator>` - Decimal separator (`DOT` or `COMMA`)
160
+ - `--time-zone <timezone>` - IANA time zone (e.g. `America/New_York`, `UTC`)
161
+ - `--period <period>` - Period (`MONTH`, `QUARTER`, or `YEAR`)
162
+ - `-p, --property <key=value>` - Set a property (repeatable)
163
+ - `book update <bookId>` - Update a book
164
+ - `--name <name>` - Book name
165
+ - `--fraction-digits <digits>` - Number of decimal places (`0`-`8`)
166
+ - `--date-pattern <pattern>` - Date format pattern (`dd/MM/yyyy`, `MM/dd/yyyy`, or `yyyy/MM/dd`)
167
+ - `--decimal-separator <separator>` - Decimal separator (`DOT` or `COMMA`)
168
+ - `--time-zone <timezone>` - IANA time zone identifier (e.g. `America/New_York`, `Europe/London`, `UTC`)
169
+ - `--lock-date <date>` - Lock date in ISO format (`yyyy-MM-dd`, e.g. `2024-01-31`)
170
+ - `--closing-date <date>` - Closing date in ISO format (`yyyy-MM-dd`)
171
+ - `--period <period>` - Period (`MONTH`, `QUARTER`, or `YEAR`)
172
+ - `-p, --property <key=value>` - Set a property (repeatable, e.g. `-p code=1010 -p branch=NYC`; empty value deletes the property)
173
+
174
+ </details>
175
+
176
+ ### Accounts
177
+
178
+ Manage your chart of accounts within a book.
179
+
180
+ ```bash
181
+ # List all accounts
182
+ bkper account list -b abc123
183
+
184
+ # Get an account by name
185
+ bkper account get "Bank Account" -b abc123
186
+
187
+ # Create an asset account
188
+ bkper account create -b abc123 --name "Bank Account" --type ASSET --groups "Current Assets"
189
+
190
+ # Update an account
191
+ bkper account update "Bank Account" -b abc123 --type LIABILITY
192
+
193
+ # Archive an account
194
+ bkper account update "Old Account" -b abc123 --archived true
195
+
196
+ # Delete an account
197
+ bkper account delete "Old Account" -b abc123
198
+ ```
199
+
200
+ <details>
201
+ <summary>Command reference</summary>
202
+
203
+ - `account list -b <bookId>` - List accounts in a book
204
+ - `account get <nameOrId> -b <bookId>` - Get an account
205
+ - `account create -b <bookId>` - Create a new account
206
+ - `--name <name>` - Account name (required)
207
+ - `--type <type>` - Account type (`ASSET`, `LIABILITY`, `INCOMING`, `OUTGOING`)
208
+ - `--description <description>` - Account description
209
+ - `--groups <groups>` - Comma-separated group names
210
+ - `-p, --property <key=value>` - Set a property (repeatable)
211
+ - `account update <nameOrId> -b <bookId>` - Update an account
212
+ - `--name <name>` - Account name
213
+ - `--type <type>` - Account type (`ASSET`, `LIABILITY`, `INCOMING`, `OUTGOING`)
214
+ - `--archived <true|false>` - Archive status
215
+ - `-p, --property <key=value>` - Set a property (repeatable, merges with existing)
216
+ - `account delete <nameOrId> -b <bookId>` - Delete an account
217
+
218
+ </details>
219
+
220
+ ### Groups
221
+
222
+ Organize accounts into hierarchical groups for structured reporting.
223
+
224
+ ```bash
225
+ # List all groups (shows hierarchy)
226
+ bkper group list -b abc123
227
+
228
+ # Create a group
229
+ bkper group create -b abc123 --name "Current Assets"
230
+
231
+ # Create a child group
232
+ bkper group create -b abc123 --name "Cash" --parent "Current Assets"
233
+
234
+ # Update a group
235
+ bkper group update "Cash" -b abc123 --hidden true
236
+
237
+ # Delete a group
238
+ bkper group delete "Cash" -b abc123
239
+ ```
240
+
241
+ <details>
242
+ <summary>Command reference</summary>
243
+
244
+ - `group list -b <bookId>` - List groups in a book
245
+ - `group get <nameOrId> -b <bookId>` - Get a group
246
+ - `group create -b <bookId>` - Create a new group
247
+ - `--name <name>` - Group name (required)
248
+ - `--parent <parent>` - Parent group name or ID
249
+ - `--hidden` - Hide the group
250
+ - `-p, --property <key=value>` - Set a property (repeatable)
251
+ - `group update <nameOrId> -b <bookId>` - Update a group
252
+ - `--name <name>` - Group name
253
+ - `--hidden <true|false>` - Hide status
254
+ - `-p, --property <key=value>` - Set a property (repeatable, merges with existing)
255
+ - `group delete <nameOrId> -b <bookId>` - Delete a group
256
+
257
+ </details>
258
+
259
+ ### Transactions
260
+
261
+ Record, query, and manage financial transactions.
262
+
263
+ ```bash
264
+ # Create a draft transaction
265
+ bkper transaction create -b abc123 --description "Office supplies"
266
+
267
+ # Create a complete transaction
268
+ bkper transaction create -b abc123 --date 2025-01-15 --amount 100.50 \
269
+ --from "Bank Account" --to "Office Supplies" --description "Printer paper"
270
+
271
+ # List transactions for a full year (on:YYYY)
272
+ bkper transaction list -b abc123 -q "on:2025"
273
+
274
+ # List transactions for a month (on:YYYY-MM)
275
+ bkper transaction list -b abc123 -q "on:2025-01"
276
+
277
+ # List with custom properties included
278
+ bkper transaction list -b abc123 -q "account:Sales" -p
279
+
280
+ # Update a transaction
281
+ bkper transaction update tx_456 -b abc123 --amount 120.00 --description "Printer paper (corrected)"
282
+
283
+ # Post a draft transaction
284
+ bkper transaction post tx_456 -b abc123
285
+
286
+ # Check (reconcile) a transaction
287
+ bkper transaction check tx_456 -b abc123
288
+
289
+ # Trash a transaction
290
+ bkper transaction trash tx_456 -b abc123
291
+
292
+ # Merge two duplicate transactions
293
+ bkper transaction merge tx_123 tx_456 -b abc123
294
+ ```
295
+
296
+ <details>
297
+ <summary>Command reference</summary>
298
+
299
+ - `transaction list -b <bookId> -q <query>` - List transactions matching a query (auto-paginates through all results)
300
+ - `-p, --properties` - Include custom properties in the output
301
+ - `transaction create -b <bookId>` - Create a transaction
302
+ - `--date <date>` - Transaction date
303
+ - `--amount <amount>` - Transaction amount
304
+ - `--description <description>` - Transaction description
305
+ - `--from <from>` - Credit account (source)
306
+ - `--to <to>` - Debit account (destination)
307
+ - `--url <url>` - URL (repeatable)
308
+ - `--remote-id <remoteId>` - Remote ID (repeatable)
309
+ - `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
310
+ - `transaction update [transactionId] -b <bookId>` - Update a transaction (or batch update via stdin)
311
+ - `--date <date>` - Transaction date
312
+ - `--amount <amount>` - Transaction amount
313
+ - `--description <description>` - Transaction description
314
+ - `--from <from>` - Credit account (source)
315
+ - `--to <to>` - Debit account (destination)
316
+ - `--url <url>` - URL (repeatable, replaces all)
317
+ - `--update-checked` - Also update checked transactions
318
+ - `-p, --property <key=value>` - Set a property (repeatable, empty value deletes)
319
+ - `transaction post <id> -b <bookId>` - Post a draft transaction
320
+ - `transaction check <id> -b <bookId>` - Check a transaction
321
+ - `transaction trash <id> -b <bookId>` - Trash a transaction
322
+ - `transaction merge <id1> <id2> -b <bookId>` - Merge two transactions
323
+
324
+ </details>
325
+
326
+ ### Balances
327
+
328
+ Query account balances and group totals.
329
+
330
+ ```bash
331
+ # List balances for a specific date (point-in-time)
332
+ bkper balance list -b abc123 -q "on:2025-12-31"
333
+
334
+ # Monthly balance evolution of one account during 2025
335
+ bkper balance list -b abc123 -q "account:'<accountName>' after:2025-01-01 before:2026-01-01 by:m" --expanded 2
336
+ ```
337
+
338
+ <details>
339
+ <summary>Command reference</summary>
340
+
341
+ - `balance list -b <bookId> -q <query>` - List balances
342
+ - `--expanded <level>` - Expand groups to specified depth (`0`+)
343
+
344
+ </details>
345
+
346
+ ### Query semantics (transactions and balances)
347
+
348
+ Use the same query language across Bkper web app, CLI, and Google Sheets integrations.
349
+
350
+ - `on:` supports different granularities:
351
+ - `on:2025` → full year
352
+ - `on:2025-01` → full month
353
+ - `on:2025-01-31` → specific day
354
+ - `after:` is **inclusive** and `before:` is **exclusive**.
355
+ - Full year 2025: `after:2025-01-01 before:2026-01-01`
356
+ - For point-in-time statements (typically permanent accounts `ASSET`/`LIABILITY`), prefer `on:` or `before:`.
357
+ - For activity statements over a period (typically non-permanent accounts `INCOMING`/`OUTGOING`), prefer `after:` + `before:`.
358
+ - For statement-level analysis, prefer filtering by the report root group. Root names vary by book.
359
+
360
+ ```bash
361
+ # Balance Sheet snapshot (point-in-time)
362
+ bkper balance list -b abc123 -q "group:'<balanceSheetRootGroup>' before:2026-01-01"
363
+
364
+ # P&L activity over 2025
365
+ bkper balance list -b abc123 -q "group:'<profitAndLossRootGroup>' after:2025-01-01 before:2026-01-01"
366
+ ```
367
+
368
+ ### Collections
369
+
370
+ Organize books into collections.
371
+
372
+ ```bash
373
+ # Create a collection
374
+ bkper collection create --name "My Collection"
375
+
376
+ # Add books to a collection
377
+ bkper collection add-book col_789 -b abc123 -b def456
378
+
379
+ # List all collections
380
+ bkper collection list
381
+
382
+ # Remove a book from a collection
383
+ bkper collection remove-book col_789 -b abc123
384
+
385
+ # Delete a collection
386
+ bkper collection delete col_789
387
+ ```
388
+
389
+ <details>
390
+ <summary>Command reference</summary>
391
+
392
+ - `collection list` - List all collections
393
+ - `collection get <collectionId>` - Get a collection
394
+ - `collection create` - Create a new collection
395
+ - `--name <name>` - Collection name (required)
396
+ - `collection update <collectionId>` - Update a collection
397
+ - `--name <name>` - Collection name
398
+ - `collection delete <collectionId>` - Delete a collection
399
+ - `collection add-book <collectionId>` - Add books to a collection
400
+ - `-b, --book <bookId>` - Book ID (repeatable)
401
+ - `collection remove-book <collectionId>` - Remove books from a collection
402
+ - `-b, --book <bookId>` - Book ID (repeatable)
403
+
404
+ </details>
405
+
406
+ ### Output Format
407
+
408
+ All commands support three output formats via the `--format` global flag:
409
+
410
+ | Format | Flag | Best for |
411
+ | ------ | -------------------------- | ------------------------------------------- |
412
+ | Table | `--format table` (default) | Human reading in the terminal |
413
+ | JSON | `--format json` | Programmatic access, single-item detail |
414
+ | CSV | `--format csv` | LLM consumption, spreadsheets, list reports |
415
+
416
+ ```bash
417
+ # Table output (default)
418
+ bkper account list -b abc123
419
+
420
+ # JSON output
421
+ bkper account list -b abc123 --format json
422
+
423
+ # CSV output -- raw data, no truncation, RFC 4180
424
+ bkper account list -b abc123 --format csv
425
+ ```
426
+
427
+ **CSV output details:**
428
+
429
+ - **RFC 4180 compliant** -- proper quoting, CRLF line endings, no truncation
430
+ - **All metadata included** -- IDs, properties, hidden properties, URLs, and timestamps are enabled
431
+ - **Raw values** -- dates stay in ISO format, numbers are unformatted (no locale formatting)
432
+ - **Single-item commands** (e.g. `account get`, `transaction create`) fall back to JSON since CSV adds no value for non-tabular data
433
+
434
+ **LLM-first output guidance (important):**
435
+
436
+ When command output will be loaded into an LLM context (chat, prompt, memory, or agent reasoning), prefer:
437
+
438
+ - **`--format csv` for list commands** (`balance list`, `transaction list`, `account list`, etc.).
439
+ - **`--format json` for single-item commands** (`get`, `create`, `update`) and CLI-to-CLI pipelines.
440
+
441
+ CSV is significantly more token-efficient than JSON for tabular data, and for wide balance outputs it can reduce token usage by up to **95%**.
442
+
443
+ **Quick rule:**
444
+
445
+ - **LLM consumption of lists/reports** → CSV
446
+ - **Programmatic processing / pipelines** → JSON
447
+ - **Human terminal reading** → Table
448
+
449
+ ### Batch Operations & Piping
450
+
451
+ Write commands (`account create`, `group create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
452
+
453
+ ```bash
454
+ # Create transactions
455
+ echo '[{
456
+ "date": "2025-01-15",
457
+ "amount": "100.50",
458
+ "creditAccount": {"name": "Bank Account"},
459
+ "debitAccount": {"name": "Office Supplies"},
460
+ "description": "Printer paper",
461
+ "properties": {"invoice": "INV-001"}
462
+ }]' | bkper transaction create -b abc123
463
+
464
+ # Create accounts
465
+ echo '[{"name":"Cash","type":"ASSET"},{"name":"Revenue","type":"INCOMING"}]' | \
466
+ bkper account create -b abc123
467
+
468
+ # Create groups
469
+ echo '[{"name":"Fixed Costs","hidden":true}]' | \
470
+ bkper group create -b abc123
471
+
472
+ # Pipe from a script
473
+ python export_bank.py | bkper transaction create -b abc123
474
+ ```
475
+
476
+ The input follows the exact `bkper.Transaction`, `bkper.Account`, or `bkper.Group` type from the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts). Custom properties go inside the `properties` object.
477
+
478
+ The `--property` CLI flag can override or delete properties from the stdin payload:
479
+
480
+ ```bash
481
+ echo '[{"name":"Cash","type":"ASSET"}]' | \
482
+ bkper account create -b abc123 -p "region=LATAM"
483
+ ```
484
+
485
+ **Batch output:** results are output as a flat JSON array, matching the same format as list commands:
486
+
487
+ ```bash
488
+ bkper account create -b abc123 < accounts.json
489
+ # Output: [{"id":"acc-abc","name":"Cash",...}, {"id":"acc-def","name":"Revenue",...}]
490
+ ```
491
+
492
+ **Piping between commands:**
493
+
494
+ All JSON output is designed to be piped directly as stdin to other commands. The output of any list or batch create command can feed directly into a create or update command:
495
+
496
+ ```bash
497
+ # Copy all accounts from one book to another
498
+ bkper account list -b $BOOK_A --format json | bkper account create -b $BOOK_B
499
+
500
+ # Copy all groups from one book to another
501
+ bkper group list -b $BOOK_A --format json | bkper group create -b $BOOK_B
502
+
503
+ # Copy transactions matching a query
504
+ bkper transaction list -b $BOOK_A -q "after:2025-01-01" --format json | \
505
+ bkper transaction create -b $BOOK_B
506
+
507
+ # Clone a full chart of accounts: groups, then accounts, then transactions
508
+ bkper group list -b $SOURCE --format json | bkper group create -b $DEST
509
+ bkper account list -b $SOURCE --format json | bkper account create -b $DEST
510
+ bkper transaction list -b $SOURCE -q "after:2025-01-01" --format json | \
511
+ bkper transaction create -b $DEST
512
+
513
+ # Batch update: list transactions, modify, and pipe back to update
514
+ bkper transaction list -b $BOOK -q "after:2025-01-01" --format json | \
515
+ jq '[.[] | .description = "Updated: " + .description]' | \
516
+ bkper transaction update -b $BOOK
517
+
518
+ # Batch update: add a property to all matching transactions
519
+ bkper transaction list -b $BOOK -q "account:Expenses" --format json | \
520
+ bkper transaction update -b $BOOK -p "reviewed=true"
521
+
522
+ # Batch update checked transactions
523
+ bkper transaction list -b $BOOK -q "is:checked after:2025-01-01" --format json | \
524
+ bkper transaction update -b $BOOK --update-checked -p "migrated=true"
525
+ ```
526
+
527
+ <details>
528
+ <summary>Writable fields reference</summary>
529
+
530
+ Only the fields below are meaningful when creating or updating resources via stdin. For batch updates, items must include an `id` field. Other read-only fields (`createdAt`, `updatedAt`, etc.) are ignored.
531
+
532
+ **Transaction** (`bkper.Transaction`)
533
+
534
+ | Field | Type | Notes |
535
+ | --------------- | ---------------------------------- | --------------------------------------------- |
536
+ | `id` | `string` | Required for batch updates, ignored on create |
537
+ | `date` | `string` | ISO format `yyyy-MM-dd` |
538
+ | `amount` | `string` | Decimal format `####.##` (string, not number) |
539
+ | `creditAccount` | `{"name":"..."}` or `{"id":"..."}` | Reference to an existing account |
540
+ | `debitAccount` | `{"name":"..."}` or `{"id":"..."}` | Reference to an existing account |
541
+ | `description` | `string` | Free-text description |
542
+ | `urls` | `string[]` | Attached URLs (e.g. receipts) |
543
+ | `remoteIds` | `string[]` | External IDs to prevent duplicates |
544
+ | `properties` | `{"key": "value", ...}` | Custom key/value properties |
545
+
546
+ **Account** (`bkper.Account`)
547
+
548
+ | Field | Type | Notes |
549
+ | ------------ | ----------------------- | -------------------------------------------------- |
550
+ | `name` | `string` | Account name (required) |
551
+ | `type` | `string` | `ASSET`, `LIABILITY`, `INCOMING`, or `OUTGOING` |
552
+ | `credit` | `boolean` | Credit nature (`true`) or debit (`false`) |
553
+ | `archived` | `boolean` | Archive the account on creation |
554
+ | `permanent` | `boolean` | Permanent accounts (e.g. bank accounts, customers) |
555
+ | `groups` | `[{"name":"..."}, ...]` | Groups to assign by name or id |
556
+ | `properties` | `{"key": "value", ...}` | Custom key/value properties |
557
+
558
+ **Group** (`bkper.Group`)
559
+
560
+ | Field | Type | Notes |
561
+ | ------------ | ---------------------------------- | -------------------------------- |
562
+ | `name` | `string` | Group name (required) |
563
+ | `hidden` | `boolean` | Hide from transactions main menu |
564
+ | `parent` | `{"name":"..."}` or `{"id":"..."}` | Parent group for nesting |
565
+ | `properties` | `{"key": "value", ...}` | Custom key/value properties |
566
+
567
+ </details>
568
+
569
+ ---
570
+
571
+ ## App Management
572
+
573
+ **Build, deploy, and manage Bkper apps.**
574
+
575
+ ### Development Workflow
576
+
577
+ ```bash
578
+ # Scaffold a new app from the template
579
+ bkper app init my-app
580
+
581
+ # Start the worker runtime (Miniflare + tunnel + file watching)
582
+ # In your project, use "npm run dev" to run both Vite and workers concurrently
583
+ bkper app dev
584
+
585
+ # Build worker bundles (web server + events handler)
586
+ # In your project, use "npm run build" to build both client (Vite) and workers
587
+ bkper app build
588
+
589
+ # Sync configuration and deploy to production
590
+ bkper app sync && bkper app deploy
591
+
592
+ # Deploy to development environment
593
+ bkper app deploy --preview
594
+
595
+ # Deploy only the events handler
596
+ bkper app deploy --events
597
+
598
+ # Check deployment status
599
+ bkper app status
600
+ ```
601
+
602
+ > **Note:** `bkper app dev` runs the worker runtime only — Miniflare, file watching, and the Cloudflare tunnel. The Vite client dev server is configured in the project's `vite.config.ts` and run separately. The project template composes both via `npm run dev` using `concurrently`.
603
+
604
+ ### Install Apps on Books
605
+
606
+ ```bash
607
+ # Install an app on a book
608
+ bkper app install my-app -b abc123
609
+
610
+ # Uninstall an app from a book
611
+ bkper app uninstall my-app -b abc123
612
+ ```
613
+
614
+ ### Secrets
615
+
616
+ ```bash
617
+ # Store a secret (prompts for value)
618
+ bkper app secrets put API_KEY
619
+
620
+ # List all secrets
621
+ bkper app secrets list
622
+
623
+ # Delete a secret
624
+ bkper app secrets delete API_KEY
625
+ ```
626
+
627
+ ### Configuration
628
+
629
+ Apps are configured via a `bkper.yaml` file in the project root. See the complete **[bkper.yaml reference]** below.
630
+
631
+ <details>
632
+ <summary>bkper.yaml reference</summary>
633
+
634
+ ```yaml
635
+ # =============================================================================
636
+ # bkper.yaml Reference
637
+ # =============================================================================
638
+ # This file documents all available configuration options for Bkper Apps.
639
+ # Copy the fields you need to your app's bkper.yaml file.
640
+ #
641
+ # For a minimal working template, see:
642
+ # https://github.com/bkper/bkper-app-template
643
+ # =============================================================================
644
+
645
+ # -----------------------------------------------------------------------------
646
+ # APP IDENTITY
647
+ # -----------------------------------------------------------------------------
648
+ # The app id is permanent and cannot be changed after creation.
649
+ # Use lowercase letters, numbers, and hyphens only.
650
+ id: my-app
651
+
652
+ # Display name shown in the Bkper UI
653
+ name: My App
654
+
655
+ # Brief description of what the app does
656
+ description: A Bkper app that does something useful
657
+
658
+ # -----------------------------------------------------------------------------
659
+ # BRANDING
660
+ # -----------------------------------------------------------------------------
661
+ # App logo for light mode (SVG recommended, PNG/JPG supported)
662
+ logoUrl: https://example.com/logo.svg
663
+
664
+ # App logo for dark mode (required for proper theming)
665
+ logoUrlDark: https://example.com/logo-dark.svg
666
+
667
+ # App website or documentation URL
668
+ website: https://example.com
669
+
670
+ # -----------------------------------------------------------------------------
671
+ # OWNERSHIP
672
+ # -----------------------------------------------------------------------------
673
+ # Developer/company name
674
+ ownerName: Your Name
675
+
676
+ # Owner's logo/avatar URL
677
+ ownerLogoUrl: https://example.com/owner-logo.png
678
+
679
+ # Owner's website
680
+ ownerWebsite: https://yoursite.com
681
+
682
+ # Source code repository URL
683
+ repoUrl: https://github.com/you/my-app
684
+
685
+ # Whether the repository is private
686
+ repoPrivate: true
687
+
688
+ # Mark as deprecated (hides from app listings, existing installs continue working)
689
+ deprecated: false
690
+
691
+ # -----------------------------------------------------------------------------
692
+ # ACCESS CONTROL
693
+ # -----------------------------------------------------------------------------
694
+ # Who can update the app configuration and deploy new versions.
695
+ # Comma-separated list of Bkper usernames (not emails).
696
+ # Supports domain wildcards for registered custom domains: *@yourdomain.com
697
+ developers: victor, aldo, *@bkper.com
698
+
699
+ # Who can install and use the app.
700
+ # Same format as developers. Leave empty for public apps.
701
+ users: maria, *@acme.com
702
+
703
+ # -----------------------------------------------------------------------------
704
+ # MENU INTEGRATION (optional)
705
+ # -----------------------------------------------------------------------------
706
+ # When configured, adds a menu item to Bkper's "More" menu.
707
+ # Clicking opens a popup with the specified URL.
708
+
709
+ # Production menu URL (supports variable substitution)
710
+ menuUrl: https://${id}.bkper.app?bookId=${book.id}
711
+
712
+ # Development menu URL (used when developer runs the app)
713
+ menuUrlDev: http://localhost:8787?bookId=${book.id}
714
+
715
+ # Custom menu text (defaults to app name if not specified)
716
+ menuText: Open My App
717
+
718
+ # Popup dimensions in pixels
719
+ menuPopupWidth: 500
720
+ menuPopupHeight: 300
721
+
722
+ # -----------------------------------------------------------------------------
723
+ # Menu URL Variables
724
+ # -----------------------------------------------------------------------------
725
+ # The following variables can be used in menuUrl and menuUrlDev:
726
+ #
727
+ # ${book.id} - Current book ID
728
+ # ${book.properties.xxx} - Book property value (replace xxx with property key)
729
+ # ${account.id} - Selected account ID (in account context)
730
+ # ${account.properties.xxx} - Account property value
731
+ # ${group.id} - Selected group ID (in group context)
732
+ # ${group.properties.xxx} - Group property value
733
+ # ${transactions.ids} - Comma-separated selected transaction IDs
734
+ # ${transactions.query} - Current search query
735
+ # -----------------------------------------------------------------------------
736
+
737
+ # -----------------------------------------------------------------------------
738
+ # EVENT HANDLING (optional)
739
+ # -----------------------------------------------------------------------------
740
+ # When configured, Bkper calls your webhook URL when subscribed events occur.
741
+
742
+ # Production webhook URL
743
+ webhookUrl: https://${id}.bkper.app/events
744
+
745
+ # Development webhook URL (auto-updated by bkper app dev)
746
+ webhookUrlDev: https://<random>.trycloudflare.com/events
747
+
748
+ # API version for event payloads
749
+ apiVersion: v5
750
+
751
+ # Events to subscribe to (remove events you don't need)
752
+ events:
753
+ # Transaction
754
+ - TRANSACTION_CREATED
755
+ - TRANSACTION_POSTED
756
+ - TRANSACTION_CHECKED
757
+ - TRANSACTION_UNCHECKED
758
+ - TRANSACTION_UPDATED
759
+ - TRANSACTION_DELETED
760
+ - TRANSACTION_RESTORED
761
+ # Account
762
+ - ACCOUNT_CREATED
763
+ - ACCOUNT_UPDATED
764
+ - ACCOUNT_DELETED
765
+ # Group
766
+ - GROUP_CREATED
767
+ - GROUP_UPDATED
768
+ - GROUP_DELETED
769
+ # File
770
+ - FILE_CREATED
771
+ - FILE_UPDATED
772
+ # Query
773
+ - QUERY_CREATED
774
+ - QUERY_UPDATED
775
+ - QUERY_DELETED
776
+ # Comment
777
+ - COMMENT_CREATED
778
+ - COMMENT_DELETED
779
+ # Collaborator
780
+ - COLLABORATOR_ADDED
781
+ - COLLABORATOR_UPDATED
782
+ - COLLABORATOR_REMOVED
783
+ # Integration
784
+ - INTEGRATION_CREATED
785
+ - INTEGRATION_UPDATED
786
+ - INTEGRATION_DELETED
787
+ # Book
788
+ - BOOK_CREATED
789
+ - BOOK_UPDATED
790
+ - BOOK_DELETED
791
+ - BOOK_AUDITED
792
+
793
+ # -----------------------------------------------------------------------------
794
+ # FILE PATTERNS (optional)
795
+ # -----------------------------------------------------------------------------
796
+ # For file processing apps. When a file matching these patterns is uploaded,
797
+ # a FILE_CREATED event is triggered with the file content.
798
+ filePatterns:
799
+ - '*.ofx'
800
+ - '*.csv'
801
+
802
+ # -----------------------------------------------------------------------------
803
+ # PROPERTIES SCHEMA (optional)
804
+ # -----------------------------------------------------------------------------
805
+ # Defines autocomplete suggestions for custom properties in the Bkper UI.
806
+ # Helps users discover and use the correct property keys/values for your app.
807
+ propertiesSchema:
808
+ book:
809
+ keys:
810
+ - my_app_enabled
811
+ - my_app_config
812
+ values:
813
+ - 'true'
814
+ - 'false'
815
+ group:
816
+ keys:
817
+ - my_app_category
818
+ values:
819
+ - category_a
820
+ - category_b
821
+ account:
822
+ keys:
823
+ - my_app_sync_id
824
+ transaction:
825
+ keys:
826
+ - my_app_reference
827
+
828
+ # -----------------------------------------------------------------------------
829
+ # DEPLOYMENT CONFIGURATION (optional)
830
+ # -----------------------------------------------------------------------------
831
+ # For apps deployed to Bkper's Workers for Platforms infrastructure.
832
+ deployment:
833
+ # Web handler (serves UI and API)
834
+ web:
835
+ bundle: packages/web/server/dist
836
+ # assets: packages/web/client/dist # Static assets (when supported)
837
+
838
+ # Events handler (processes webhooks)
839
+ events:
840
+ bundle: packages/events/dist
841
+
842
+ # Platform services available to your app (one per type, auto-provisioned)
843
+ # See: https://developers.cloudflare.com/kv/
844
+ services:
845
+ - KV # Key-value storage
846
+ ```
847
+
848
+ </details>
849
+
850
+ **Environment variables:**
851
+
852
+ - `BKPER_API_KEY` -- Optional. If not set, uses the Bkper API proxy with a managed API key. Set it for direct API access with your own quotas. Follow [these steps](https://bkper.com/docs/#rest-api-enabling) to enable.
853
+
854
+ <details>
855
+ <summary>Command reference</summary>
856
+
857
+ #### Authentication
858
+
859
+ - `auth login` - Authenticate with Bkper, storing credentials locally
860
+ - `auth logout` - Remove stored credentials
861
+ - `auth token` - Print the current OAuth access token to stdout
862
+
863
+ #### Agent Bridge (Pi passthrough)
864
+
865
+ - `agent -- <pi-args...>` - Run Pi CLI with Bkper defaults (system prompt/resources)
866
+
867
+ #### App Lifecycle
868
+
869
+ - `app init <name>` - Scaffold a new app from the template
870
+ - `app list` - List all apps you have access to
871
+ - `app sync` - Sync [bkper.yaml][bkper.yaml reference] configuration (URLs, description) to Bkper API
872
+ - `app build` - Build worker bundles for deployment
873
+ - `app deploy` - Deploy built artifacts to Cloudflare Workers for Platforms
874
+ - `-p, --preview` - Deploy to preview environment
875
+ - `--events` - Deploy events handler instead of web handler
876
+ - `app status` - Show deployment status
877
+ - `app undeploy` - Remove app from platform
878
+ - `-p, --preview` - Remove from preview environment
879
+ - `--events` - Remove events handler instead of web handler
880
+ - `--delete-data` - Permanently delete all associated data (requires confirmation)
881
+ - `--force` - Skip confirmation prompts (use with `--delete-data` for automation)
882
+ - `app dev` - Start the worker runtime for local development
883
+ - `--sp, --server-port <port>` - Server simulation port (default: `8787`)
884
+ - `--ep, --events-port <port>` - Events handler port (default: `8791`)
885
+ - `-w, --web` - Run only the web handler
886
+ - `-e, --events` - Run only the events handler
887
+
888
+ > **Note:** `sync` and `deploy` are independent operations. Use `sync` to update your app's URLs in Bkper (required for webhooks and menu integration). Use `deploy` to push code to Cloudflare. For a typical deployment workflow, run both: `bkper app sync && bkper app deploy`
889
+
890
+ #### App Installation
891
+
892
+ - `app install <appId> -b <bookId>` - Install an app on a book
893
+ - `app uninstall <appId> -b <bookId>` - Uninstall an app from a book
894
+
895
+ #### Secrets Management
896
+
897
+ - `app secrets put <name>` - Store a secret
898
+ - `-p, --preview` - Set in preview environment
899
+ - `app secrets list` - List all secrets
900
+ - `-p, --preview` - List from preview environment
901
+ - `app secrets delete <name>` - Delete a secret
902
+ - `-p, --preview` - Delete from preview environment
903
+
904
+ </details>
905
+
906
+ ---
907
+
908
+ ## Library
909
+
910
+ The `getOAuthToken` function returns a Promise that resolves to a valid OAuth token, for use with the [`bkper-js`](https://github.com/bkper/bkper-js) library:
911
+
912
+ ```javascript
913
+ import { Bkper } from 'bkper-js';
914
+ import { getOAuthToken } from 'bkper';
915
+
916
+ Bkper.setConfig({
917
+ oauthTokenProvider: async () => getOAuthToken(),
918
+ });
919
+ ```
920
+
921
+ ## Documentation
922
+
923
+ - [Developer Docs]
924
+ - [App Template]