Skip to content

Commit 3e116d8

Browse files
committed
feat: migrate to hey-api SDK, upgrade prompt UX, code fixes
- Replace hand-written API client with hey-api generated SDK (client-fetch + byTags) - Add response interceptor for RFC 7807 error parsing - Use hey-api auth config for token injection - Upgrade org selection from readline to @inquirer/select - Extract resolveExpiry, fix formatter UsageError, add chmod to config - Rewrite README for v1 - Add biome overrides for generated files and test any
1 parent 904c1fe commit 3e116d8

71 files changed

Lines changed: 8008 additions & 3810 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,85 @@ npx @talkvalue/cli --help
1616

1717
## Requirements
1818

19-
- Node.js >= 22
19+
- Node.js >= 24
2020

2121
## Authentication
2222

2323
```bash
24-
talkvalue auth login
24+
talkvalue auth login # device code flow + org selection
25+
talkvalue auth login --org "Acme" # skip interactive org selection
2526
```
2627

27-
The CLI prints a one-time code and opens a verification URL in your browser. Complete the login to authenticate.
28+
The CLI prints a one-time code and opens a verification URL in your browser. After login, select an organization to scope your session.
29+
30+
### Managing sessions
2831

2932
```bash
30-
talkvalue auth status # check current session
31-
talkvalue auth logout # clear session
32-
talkvalue auth switch <profile> # switch org profile
33+
talkvalue auth status # current session info
34+
talkvalue auth switch [org] # switch organization (interactive or by name/id)
35+
talkvalue auth list # list all profiles
36+
talkvalue auth logout # clear session
3337
```
3438

35-
For CI/CD, set `TALKVALUE_TOKEN` to skip interactive login:
39+
### CI/CD
40+
41+
Set `TALKVALUE_TOKEN` to skip interactive login:
3642

3743
```bash
3844
TALKVALUE_TOKEN="eyJ..." talkvalue path person list
3945
```
4046

41-
## Common Commands
47+
## Commands
4248

4349
```bash
50+
# Overview
4451
talkvalue path overview # dashboard summary
52+
53+
# People
4554
talkvalue path person list --page-size 20 # list people
4655
talkvalue path person get <id> # person details
56+
talkvalue path person update <id> --name "" # update person
57+
talkvalue path person delete <id> # delete person
58+
talkvalue path person export # CSV export
59+
60+
# Channels
4761
talkvalue path channel list # list channels
4862
talkvalue path channel create --name "VIP" # create channel
49-
talkvalue path person export # CSV export
63+
talkvalue path channel update <id> --name "" # update channel
64+
talkvalue path channel delete <id> # delete channel
65+
66+
# Config
5067
talkvalue config list # show config
68+
talkvalue config get <key> # get value
69+
talkvalue config set <key> <value> # set value
70+
71+
# Version
5172
talkvalue version # version info
5273
```
5374

5475
## Global Flags
5576

5677
```
5778
--format <json|table|csv> output format (default: table for TTY, json for pipe)
58-
--profile <name> use specific org profile
79+
--profile <name> use specific profile
80+
--api-url <url> API base URL override
5981
--no-color disable colored output
60-
-q, --quiet suppress non-essential output
61-
-v, --verbose enable verbose logging
6282
--page <n> page number
6383
--page-size <n> page size
6484
```
6585

86+
## Environment Variables
87+
88+
| Variable | Description |
89+
|----------|-------------|
90+
| `TALKVALUE_TOKEN` | Bearer token (skips interactive auth) |
91+
| `TALKVALUE_API_URL` | API base URL override |
92+
| `TALKVALUE_AUTH_API_URL` | Auth API base URL override |
93+
| `TALKVALUE_PROFILE` | Active profile override |
94+
| `NO_COLOR` | Disable colored output |
95+
| `FORCE_COLOR` | Force colored output |
96+
| `XDG_CONFIG_HOME` | Config directory base (default: `~/.config`) |
97+
6698
## Output Contract
6799

68100
Machine-readable output is intentionally lean.
@@ -96,7 +128,7 @@ Exit codes: `0` success, `1` error, `2` usage, `3` auth, `4` not-found, `5` forb
96128

97129
## Configuration
98130

99-
Config is stored at `~/.talkvalue/config.yml` (or `$XDG_CONFIG_HOME/talkvalue/`).
131+
Config is stored at `~/.talkvalue/config.yml` (or `$XDG_CONFIG_HOME/talkvalue/`). File permissions are `0o600` (owner-only).
100132

101133
```bash
102134
talkvalue config list

biome.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"noDefaultExport": {
1515
"level": "off"
1616
},
17+
"noNonNullAssertion": "warn",
1718
"useImportType": "error"
1819
},
1920
"suspicious": {
@@ -35,6 +36,18 @@
3536
}
3637
},
3738
"files": {
38-
"ignore": ["node_modules", "dist", "coverage", "*.json"]
39-
}
39+
"ignore": ["node_modules", "dist", "coverage", "*.json", "src/api/generated"]
40+
},
41+
"overrides": [
42+
{
43+
"include": ["test/**"],
44+
"linter": {
45+
"rules": {
46+
"suspicious": {
47+
"noExplicitAny": "off"
48+
}
49+
}
50+
}
51+
}
52+
]
4053
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
]
5353
},
5454
"dependencies": {
55+
"@inquirer/select": "^5.1.2",
5556
"@napi-rs/keyring": "^1.2.0",
5657
"chalk": "^5.6.2",
5758
"commander": "^14.0.3",

pnpm-lock.yaml

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/auth.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)