@nestica/cli 0.4.0 → 0.5.1

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.
Files changed (3) hide show
  1. package/README.md +29 -94
  2. package/dist/cli.js +10 -1
  3. package/package.json +10 -1
package/README.md CHANGED
@@ -1,54 +1,44 @@
1
- # nestica-cli
1
+ # nestica
2
2
 
3
- Command-line client for the Nestica REST API (`nestica-api`): full CRUD
4
- over `profiles`, `accounts`, `contacts`, `transactions` and `yields`,
5
- plus session management (`login`, `logout`, `whoami`, `set-profile`).
3
+ Command-line client for the Nestica REST API: full CRUD over `profiles`,
4
+ `accounts`, `contacts`, `transactions` and `yields`, plus session
5
+ management (`login`, `logout`, `whoami`, `set-profile`).
6
6
 
7
7
  ## Install
8
8
 
9
- Published package: `npm install -g @nestica/cli` (zero runtime
10
- dependencies — everything is bundled into the `nestica` binary).
11
-
12
- From this repository:
13
-
14
9
  ```sh
15
- pnpm install
16
- pnpm --filter @nestica/cli build
17
- pnpm exec nestica --help
10
+ npm install -g @nestica/cli
18
11
  ```
19
12
 
20
- The CLI talks to the deployed API by default
21
- (`https://api-tjnuhxmzkq-uc.a.run.app/api/v1.0`); point it elsewhere
22
- with `--base-url` or `NESTICA_BASE_URL`.
13
+ Zero runtime dependencies everything is bundled into the `nestica`
14
+ binary. Requires Node.js >= 22.12. The CLI talks to the deployed API
15
+ by default.
23
16
 
24
17
  ## Sessions
25
18
 
26
- State lives in one JSON file with owner-only permissions:
27
- `${XDG_CONFIG_HOME:-~/.config}/nestica/config.json` (override the whole
28
- path with `NESTICA_CONFIG`). It stores the connection settings, the
29
- Firebase tokens and the default profile. Precedence for every setting:
30
- **flag > environment > session file > default**.
19
+ ```sh
20
+ nestica login --email dev@example.com # prompts for the password
21
+ nestica login --google --google-client-id <id> # in the browser
31
22
 
32
- | Setting | Flag | Environment | Default |
33
- | --- | --- | --- | --- |
34
- | API base URL | `-H, --base-url` | `NESTICA_BASE_URL` | deployed API |
35
- | Firebase web API key | `--api-key` | `FIREBASE_API_KEY` | the Nestica project's web key |
36
- | Google OAuth client id | `--google-client-id` | `GOOGLE_CLIENT_ID` | — |
37
- | Google OAuth client secret | `--google-client-secret` | `GOOGLE_CLIENT_SECRET` | — |
38
- | Auth emulator | — | `FIREBASE_AUTH_EMULATOR_HOST` | inferred from a localhost base URL |
23
+ nestica whoami
24
+ nestica set-profile
25
+ nestica logout
26
+ ```
39
27
 
40
- Expired ID tokens refresh automatically before requests; when the
41
- refresh token itself is rejected the CLI says so and asks for a new
42
- `login`.
28
+ The session (connection settings, Firebase tokens, default profile)
29
+ lives in one JSON file with owner-only permissions:
30
+ `${XDG_CONFIG_HOME:-~/.config}/nestica/config.json`.
31
+
32
+ `set-profile` lists the profiles and asks which one to make the
33
+ default; `nestica set-profile <uuid>` stores a specific one and
34
+ `--clear` removes it. The API would otherwise default to the first
35
+ profile created. `logout` deletes the session file; running `login`
36
+ while already signed in just reports the current session — `logout`
37
+ first to switch accounts.
43
38
 
44
39
  ## Commands
45
40
 
46
41
  ```
47
- nestica login [--email <email>] [--password <pw>] [--google] ...
48
- nestica logout
49
- nestica whoami
50
- nestica set-profile [<id>] [--clear]
51
-
52
42
  nestica <resource> list [--page <n>] [--page-size <n>] [--profile <uuid>]
53
43
  nestica <resource> get <id>
54
44
  nestica <resource> create [field flags] [--data <json|->]
@@ -61,35 +51,14 @@ yields`. Scoped resources send the stored default profile (or an
61
51
  explicit `--profile`) as the `profileId` query parameter; `transactions
62
52
  list` also takes `--type expense|income`.
63
53
 
64
- Global flags: `-H/--base-url`, `--api-key`, `--profile`,
65
- `-F/--format pretty|json|table` (default `pretty`), `--no-color`
66
- (or `NO_COLOR`; color is also off when stdout is not a TTY).
67
-
68
- ### login
69
-
70
- - Email/password (prompted when omitted; the password is not echoed):
71
- `nestica login --email dev@example.com` (the Firebase web API key
72
- defaults to the Nestica project's own key)
73
- - Google, in the browser (OAuth + PKCE against a loopback redirect;
74
- needs the Firebase project's web OAuth client id):
75
- `nestica login --google --google-client-id <id> --api-key <key>`
76
-
77
- `logout` deletes the session file. Running `login` while already
78
- signed in just reports the current session — `logout` first to switch
79
- accounts (ID tokens refresh automatically, so re-login is never needed
80
- to renew them).
81
-
82
- ### set-profile
83
-
84
- `nestica set-profile` lists the profiles and asks which one to make the
85
- default; `nestica set-profile <uuid>` stores a specific one and
86
- `--clear` removes it. The API would otherwise default to the first
87
- profile created.
54
+ Global flags: `--profile`, `-F/--format pretty|json|table` (default
55
+ `pretty`), `--no-color` (or `NO_COLOR`; color is also off when stdout
56
+ is not a TTY).
88
57
 
89
58
  ### Field flags
90
59
 
91
60
  Create/update bodies come from typed flags — identical rules to the
92
- API, validated locally with `@nestica/models` — plus `--data` (or
61
+ API, validated locally before the request is sent — plus `--data` (or
93
62
  `--json`) to merge a raw JSON body over them (`-` reads stdin):
94
63
 
95
64
  ```sh
@@ -124,37 +93,3 @@ print nothing at all.
124
93
  ### Exit codes
125
94
 
126
95
  `0` success · `1` API/runtime errors · `2` usage errors.
127
-
128
- ## Smoke test against the emulators
129
-
130
- ```sh
131
- pnpm --filter nestica-api serve # functions :5001, firestore :8080, auth :9099
132
- # create a user once in the Auth UI at http://localhost:4000
133
-
134
- export FIREBASE_AUTH_EMULATOR_HOST=localhost:9099
135
- pnpm exec nestica login \
136
- --base-url http://localhost:5001/nestica-finances/us-central1/api/api/v1.0 \
137
- --api-key demo --email dev@example.com
138
-
139
- pnpm exec nestica profiles create --name Gary --country CO \
140
- --timezone America/Bogota --currency COP --default-currency COP
141
- pnpm exec nestica set-profile
142
- pnpm exec nestica accounts create --name Bancolombia --label bank
143
- pnpm exec nestica transactions create --type expense --amount 42.5 \
144
- --currency COP --date 2026-08-22T12:00:00Z --status settled --label groceries
145
- pnpm exec nestica transactions list --type expense --format table
146
- pnpm exec nestica whoami
147
- pnpm exec nestica logout
148
- ```
149
-
150
- Note: the Google flow always talks to the real Google endpoints — use
151
- email/password with the emulators.
152
-
153
- ## Tests
154
-
155
- ```sh
156
- pnpm --filter @nestica/cli test
157
- ```
158
-
159
- Unit tests only (mocked `fetch`, temporary session files); the
160
- repository-wide `pnpm test` runs them through Nx.
package/dist/cli.js CHANGED
@@ -3380,10 +3380,19 @@ var program = new Command();
3380
3380
  // package.json
3381
3381
  var package_default = {
3382
3382
  name: "@nestica/cli",
3383
- version: "0.4.0",
3383
+ version: "0.5.1",
3384
3384
  type: "module",
3385
3385
  description: "Command-line client for the Nestica REST API",
3386
3386
  license: "MIT",
3387
+ keywords: [
3388
+ "nestica",
3389
+ "cli",
3390
+ "command-line",
3391
+ "finance",
3392
+ "personal-finance",
3393
+ "expense-tracker",
3394
+ "firebase"
3395
+ ],
3387
3396
  engines: {
3388
3397
  node: ">=22.12"
3389
3398
  },
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@nestica/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "description": "Command-line client for the Nestica REST API",
6
6
  "license": "MIT",
7
+ "keywords": [
8
+ "nestica",
9
+ "cli",
10
+ "command-line",
11
+ "finance",
12
+ "personal-finance",
13
+ "expense-tracker",
14
+ "firebase"
15
+ ],
7
16
  "engines": {
8
17
  "node": ">=22.12"
9
18
  },