bonbox 0.1.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/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # bonbox CLI
2
+
3
+ The bonbox command line interface. It talks to the public bonbox REST API
4
+ (`https://app.bonbox.io/api/v1`) with your normal bonbox account — no direct
5
+ database access, no separate credentials.
6
+
7
+ ```bash
8
+ pnpm -C packages/cli build
9
+ node packages/cli/dist/cli.js --help
10
+ ```
11
+
12
+ ## Commands
13
+
14
+ | Command | What it does |
15
+ | --- | --- |
16
+ | `bonbox login [--provider google\|apple]` | Sign in through the browser and store the session |
17
+ | `bonbox logout` | Remove the stored session |
18
+ | `bonbox whoami` | Show the signed-in account and plan |
19
+ | `bonbox customers ls [--archived]` | List customers |
20
+ | `bonbox invoices ls [--status created\|paid] [--quotes]` | List invoices or quotes |
21
+ | `bonbox invoices create --customer <name-or-id> --item "…"` | Create an invoice or quote |
22
+ | `bonbox invoices pdf <number-or-id> [-o file]` | Download the PDF |
23
+ | `bonbox invoices paid <number-or-id> [--date] [--no-receipt]` | Mark an invoice as paid |
24
+ | `bonbox invoices unpaid <number-or-id>` | Undo a payment |
25
+ | `bonbox receipts ls [--month YYYY-MM] [--from] [--to] [--project]` | List receipts |
26
+ | `bonbox receipts add --seller <s> --price <n> […]` | Add a receipt by hand |
27
+ | `bonbox receipts scan <file…> [--project]` | Upload a receipt and have it read out |
28
+
29
+ Every command takes `--json` (raw API response, no decoration) and `--lang`.
30
+
31
+ ### Line items
32
+
33
+ `--item` is repeatable and takes `description:quantity:unitPrice[:discount%]`:
34
+
35
+ ```bash
36
+ bonbox invoices create \
37
+ --customer "Velo GmbH" \
38
+ --item "Design work:8:145" \
39
+ --item "Retainer:1:2000:10%" \
40
+ --pdf invoice.pdf
41
+ ```
42
+
43
+ `--customer` accepts an ID, an exact name, or a unique name prefix. If a prefix
44
+ matches several customers the CLI lists them and stops.
45
+
46
+ ### Marking an invoice paid
47
+
48
+ ```bash
49
+ bonbox invoices paid 260830-001 # also books the income as a receipt
50
+ bonbox invoices paid 260830-001 --no-receipt
51
+ ```
52
+
53
+ ## Sign-in and session
54
+
55
+ `bonbox login` opens a Supabase OAuth flow (PKCE) in your browser and listens on
56
+ `localhost:51823` (falling back to 51824 and 51825) for the redirect. The
57
+ session is stored in `~/.config/bonbox/session.json` with mode `0600`
58
+ (`XDG_CONFIG_HOME` is honoured) and refreshed automatically.
59
+
60
+ ## Exit codes
61
+
62
+ | Code | Meaning |
63
+ | --- | --- |
64
+ | `0` | Success |
65
+ | `1` | API or runtime error (including 401 and 402) |
66
+ | `2` | Usage error: unknown command, missing or malformed flags |
67
+
68
+ ## Environment
69
+
70
+ | Variable | Effect |
71
+ | --- | --- |
72
+ | `BONBOX_API_URL` | Point the CLI at another API base, e.g. the Supabase functions URL |
73
+ | `BONBOX_LANG` | Output language (`en`, `de`, `fr`, `it`); `--lang` wins, `LANG` is the fallback |
74
+ | `XDG_CONFIG_HOME` | Where the session file lives |
75
+
76
+ ## Translations
77
+
78
+ Strings live in `lang/cli/{en,de,fr,it}.json` at the repository root. Run
79
+ `./scripts/sync-strings.sh` to copy them into `src/i18n/`, which is checked in so
80
+ the package builds on its own. The script fails if the four files disagree on
81
+ keys.
82
+
83
+ ## Development
84
+
85
+ ```bash
86
+ pnpm -C packages/cli test # vitest, no network
87
+ pnpm -C packages/cli check # tsc --noEmit
88
+ pnpm -C packages/cli build # tsup → dist/cli.js
89
+ ```