@letterapp/cli 0.2.0 → 0.3.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 CHANGED
@@ -52,10 +52,12 @@ What happens:
52
52
 
53
53
  1. The CLI prints a short confirmation code and (after you press Enter) opens your browser to the Letter dashboard.
54
54
  2. You confirm the code matches and pick the project to connect.
55
- 3. Letter mints a project API key and sends it to the CLI over a secure back channel. The CLI writes `LETTER_API_KEY` to `.env.local` and stores a copy in `~/.letter/credentials.json` for tooling (such as `@letterapp/mcp`).
55
+ 3. Letter mints **two** credentials and sends them to the CLI over a secure back channel:
56
+ - a project **ingestion key** (`lt_live_*`) written to `.env.local` as `LETTER_API_KEY` for the SDK / ingestion API, and
57
+ - a workspace **Personal Access Token** (`lt_pat_*`) stored in `~/.letter/credentials.json` for the CLI's management commands and `@letterapp/mcp`.
56
58
  4. It detects your package manager and installs `@letterapp/node`.
57
59
 
58
- The API key is never printed to the terminal or chat.
60
+ Neither secret is printed to the terminal or chat. You never pass a token by hand: each command picks the right credential automatically.
59
61
 
60
62
  ---
61
63
 
@@ -99,8 +101,8 @@ letter auth logout
99
101
  ### Config
100
102
 
101
103
  ```bash
102
- # Point the CLI at a self-hosted / local Letter instance.
103
- letter config set base-url http://localhost:3001
104
+ # Set the API origin (defaults to https://api.letter.app).
105
+ letter config set base-url https://api.letter.app
104
106
 
105
107
  # Show current configuration.
106
108
  letter config get
@@ -109,6 +111,42 @@ letter config get
109
111
  letter config reset
110
112
  ```
111
113
 
114
+ ### Manage your workspace
115
+
116
+ The same things the dashboard does are available as resource commands, backed by
117
+ the workspace PAT from `letter login`. Each group has `list` / `get` / `create` /
118
+ `update` / `delete` plus verb subcommands; run `letter <group> --help` for the
119
+ exact flags. Project-scoped groups default to the connected project and accept
120
+ `--project <slug>`.
121
+
122
+ ```bash
123
+ letter me # identity, workspace, role
124
+ letter projects list --json
125
+ letter contacts list --limit 20
126
+ letter segments preview --filter @paid.json
127
+ letter sequences draft seq_123 --graph @graph.json --trigger @trigger.json --expected-revision 7
128
+ letter sequences publish seq_123
129
+ letter broadcasts preflight bc_42
130
+ letter broadcasts schedule bc_42 --scheduled-at 2026-06-01T09:00:00Z
131
+ letter domains create --domain mail.acme.com
132
+ letter sender-identity --from-email hi@mail.acme.com --from-name "Acme"
133
+ ```
134
+
135
+ Groups: `projects`, `members`, `invitations`, `api-keys`, `contacts`,
136
+ `accounts`, `events`, `suppressions`, `segments`, `sequences`, `broadcasts`,
137
+ `templates`, `domains`, `project-tokens`, `sender-identity`, `sending-mode`,
138
+ `me`. Full reference: [letter.app/docs/cli](https://letter.app/docs/cli) and the
139
+ [Management API](https://letter.app/docs/management-api).
140
+
141
+ ### Two credentials, one login
142
+
143
+ | Purpose | Format | Dashboard | CLI group | Stored as |
144
+ | --- | --- | --- | --- | --- |
145
+ | Send events (SDK / ingestion) | `lt_live_*` | Project tokens | `project-tokens` | `LETTER_API_KEY` in `.env.local` |
146
+ | Run the CLI / Management API | `lt_pat_*` | API keys | `api-keys` | `~/.letter/credentials.json` |
147
+
148
+ (The older group names `keys` and `tokens` still work as aliases.)
149
+
112
150
  ---
113
151
 
114
152
  ## Output Modes
@@ -127,7 +165,9 @@ letter --json status | jq '.events'
127
165
 
128
166
  | Variable | Default | Purpose |
129
167
  | --- | --- | --- |
130
- | `LETTER_API_KEY` | (from credential store) | Overrides the stored key (CI). |
168
+ | `LETTER_API_KEY` | (from credential store) | Project ingestion key (`lt_live_*`) for the SDK / `letter status`. Overrides the stored key (CI). |
169
+ | `LETTER_PAT` | (from credential store) | Workspace PAT (`lt_pat_*`) for management commands. Set it to run them without `letter login` (CI). |
170
+ | `LETTER_PROJECT` | (connected project) | Default project slug for project-scoped management commands. |
131
171
  | `LETTER_BASE_URL` | `https://api.letter.app` | API origin for self-host / local dev. |
132
172
 
133
173
  ---
@@ -174,18 +214,6 @@ node dist/index.js --help
174
214
 
175
215
  ---
176
216
 
177
- ## Roadmap
178
-
179
- v1 ships the secure setup/login flow plus connection helpers. The command
180
- structure is built to extend: future authenticated areas register the same way
181
- and reuse the credential store + API client, for example:
182
-
183
- - `letter sequences` — list / create / configure automation sequences
184
- - `letter broadcast` — create and send broadcasts
185
- - `letter contacts`, `letter events`, `letter keys`
186
-
187
- ---
188
-
189
217
  ## See Also
190
218
 
191
219
  - [`@letterapp/mcp`](https://www.npmjs.com/package/@letterapp/mcp) — MCP server for AI agents.