@getfrontline/cli 1.0.0 → 1.0.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 (2) hide show
  1. package/README.md +52 -125
  2. package/package.json +6 -2
package/README.md CHANGED
@@ -1,28 +1,25 @@
1
- # @frontline/cli
1
+ # @getfrontline/cli
2
2
 
3
3
  Unified Frontline command-line toolbox. Ships two binaries:
4
4
 
5
5
  - **`frontline`** — public REST API: agents, workflows, billing, tables, objects, raw GET, Claude Code skills setup.
6
- - **`max`** — Max chat & admin REST (Firebase ID token auth, interactive chat).
7
-
8
- > **Note (dev):** the default base URL is `http://localhost:7010/public/v1`.
9
- > When deploying to production, update it manually (per-profile, flag, or env var).
6
+ - **`max`** — Max chat & admin REST (per-user API key as Bearer, interactive chat).
10
7
 
11
8
  ## Installation
12
9
 
13
10
  ```bash
14
- npm install -g @frontline/cli
11
+ npm install -g @getfrontline/cli
15
12
  ```
16
13
 
17
14
  Or run without installing:
18
15
 
19
16
  ```bash
20
- npx @frontline/cli --help
17
+ npx @getfrontline/cli --help
21
18
  ```
22
19
 
23
20
  ## Output format
24
21
 
25
- All `frontline` commands print **JSON to stdout by default** so you can pipe them into `jq`, scripts, or CI. Opt into human-readable output with:
22
+ All `frontline` commands print **JSON to stdout by default** (scripting-friendly). Opt into human-readable output with:
26
23
 
27
24
  - `--pretty` — key/value blocks, spinners, icons (to stderr-safe channels)
28
25
  - `--table` — tabular rendering for list endpoints
@@ -33,22 +30,13 @@ Errors always go to `stderr` in human form and to `stdout` as structured JSON wh
33
30
 
34
31
  # `frontline` binary
35
32
 
36
- ## Authentication
37
-
38
- API keys are sent via `Authorization: Bearer`.
39
-
40
33
  ### Login
41
34
 
42
35
  ```bash
43
- # Default profile, default base URL (localhost in dev)
44
36
  frontline auth login <api-key>
45
-
46
- # Multiple environments via named profiles
47
- frontline auth login <key> --profile production --base-url https://api.getfrontline.ai/public/v1
48
- frontline auth login <key> --profile staging --base-url https://staging-api.example.com/public/v1
49
37
  ```
50
38
 
51
- The key is stored locally in your OS config dir (via `conf`). No `/me`/`/billing` verification is performed at login time — the key is saved as-is and validated on first real call.
39
+ The API key is shared between `frontline` and `max` automatically.
52
40
 
53
41
  ### Switch / inspect profiles
54
42
 
@@ -60,10 +48,6 @@ frontline auth logout # remove active profile
60
48
  frontline auth logout --profile staging
61
49
  ```
62
50
 
63
- ### Resolution priority
64
-
65
- `--api-key` / `--base-url` flags → `FRONTLINE_API_KEY` / `FRONTLINE_BASE_URL` env → active profile → default (`http://localhost:7010/public/v1`).
66
-
67
51
  ## Commands
68
52
 
69
53
  ### Agents
@@ -146,15 +130,14 @@ Run `frontline <resource> <subcommand> --help` for details and examples.
146
130
  Every `frontline` command accepts:
147
131
 
148
132
  - `--api-key <key>` — override stored API key for a single call
149
- - `--base-url <url>` — override stored base URL for a single call
150
133
  - `--profile <name>` — use a specific saved profile
151
- - `--debug` — verbose request/response logs (token is redacted)
134
+ - `--debug` — verbose request/response logs
152
135
  - `--pretty` — human-readable output
153
136
  - `--table` — tabular output for list endpoints
154
137
 
155
138
  ## Claude Code Skills
156
139
 
157
- Install Frontline skills into Claude Code (auto-detected on `npm install`):
140
+ Optional: install Frontline skills into Claude Code (auto-detected on `npm install`):
158
141
 
159
142
  ```bash
160
143
  frontline setup --claude-skills # install new skills
@@ -175,31 +158,59 @@ frontline agents list --debug
175
158
 
176
159
  ## Troubleshooting
177
160
 
178
- - **"No API key found"** — run `frontline auth login <key>` or set `FRONTLINE_API_KEY`.
161
+ - **"No API key found"** — run `frontline auth login <key>`.
162
+ - **"No Max API key found"** (Max CLI) — run `max auth login <key>` or `frontline auth login <key>` on the same profile.
179
163
  - **"Missing or invalid API key"** — key expired / revoked. Generate a new one.
180
- - **"Request timed out"** — check network; if using a custom base URL, verify with `frontline auth profiles list`.
164
+ - **"Request timed out"** — check network.
181
165
  - **Rate limit** — public API allows 100 req/min.
182
166
 
183
167
  ---
184
168
 
185
169
  # `max` binary
186
170
 
187
- Browser-based sign-in (Firebase ID token flow). Same npm package exposes the `max` command after install.
171
+ Authentication uses the **same API key** as `frontline`. Logging in with either CLI keeps them in sync.
188
172
 
189
173
  ```bash
190
174
  max --help
191
- max auth login
192
- max auth login --google
193
- max auth login --microsoft
194
- max auth login --email
195
- max auth login --otp
175
+ max auth login <api-key>
196
176
  max auth whoami
197
- max auth logout
177
+ max auth logout # clears Max + matching Frontline profile
178
+ max auth logout --keep-frontline # only clears the Max store
179
+ ```
180
+
181
+ ### Response shape and stdout
182
+
183
+ Max Public API responses are typically `{ "ok": true|false, "data": ... }`. HTTP errors still use 4xx/5xx; logical failures may return `200` with `ok: false` (the CLI treats those as errors).
184
+
185
+ - **`max "…"`** (root) and **`max chat send`**: default stdout is **one-line JSON** (`JSON.stringify` of the last response: POST, or last GET after polling). Use **`--pretty`** for assistant **plain text** from `data`. Use **`--json`** to print only the POST body and **skip polling**.
186
+ - **`max conversations …`**: same idea — default one-line JSON; **`--pretty`** for plain text when the CLI can infer it.
187
+ - **`max chat` / REPL**: stdout is assistant **plain text** from `data` when possible (interactive UX); otherwise one-line JSON. No progress spinners on stdout.
188
+
189
+ ### Public API — Max conversations
190
+
191
+ | Method | Path (after base) |
192
+ | ------- | ------------------------------------------------- |
193
+ | `POST` | `/max/conversations/message` |
194
+ | `GET` | `/max/conversations/:conversationId` |
195
+ | `PATCH` | `/max/conversations/:conversationId` |
196
+ | `POST` | `/max/conversations/:conversationId/abortMessage` |
197
+ | `GET` | `/max/conversations/` |
198
+
199
+ CLI:
200
+
201
+ ```bash
202
+ max conversations list
203
+ max conversations get 123
204
+ max conversations update 123 --data '{"title":"Renamed"}'
205
+ max conversations abort 123
206
+ # alias: max conv list
198
207
  ```
199
208
 
209
+ Global flags: `--profile`, `--api-key`, `--pretty`, `--debug` (same resolution as `max chat send`).
210
+
200
211
  ## Chat with Max
201
212
 
202
- After signing in, you can send messages:
213
+ After `max auth login`, you can send messages:
203
214
 
204
215
  ```bash
205
216
  # Send message (uses last conversation by default)
@@ -211,6 +222,12 @@ max --new "Hola"
211
222
  # Explicit conversation id
212
223
  max --conversation 123 "Hola"
213
224
 
225
+ # Default: one-line JSON from the API; human reply with --pretty
226
+ max "Hola" --pretty
227
+
228
+ # Override API key for one run
229
+ max "Hola" --api-key flk_...
230
+
214
231
  # Alternative explicit command form
215
232
  max chat send "Hola"
216
233
  ```
@@ -227,93 +244,3 @@ Inside the interactive prompt, use:
227
244
  - `:new` to start a new conversation
228
245
  - `:conv <id>` to switch conversations
229
246
  - `:exit` to quit
230
-
231
- ## Configuration
232
-
233
- The Max API base defaults to `https://prod-api.getfrontline.ai/api/v2`.
234
- Override with `--api-base-url` or set `MAX_API_BASE_URL`:
235
-
236
- ```bash
237
- export MAX_API_BASE_URL="https://localhost:7010/api/v2"
238
- max --new "Hola" --debug
239
- ```
240
-
241
- ### Terminal logo (optional)
242
-
243
- The package ships a bundled logo at `packages/cli/assets/logo3.png` (included in the published npm package via `package.json` → `files`). The CLI looks for it automatically.
244
-
245
- Override the path:
246
-
247
- ```bash
248
- export MAX_CLI_LOGO_PATH="/absolute/path/to/logo3.png"
249
- ```
250
-
251
- If the logo can't be rendered (many Windows terminals), the CLI still shows the text welcome banner.
252
-
253
- ### Configure the hosted login page
254
-
255
- The CLI opens a **URL you host** (web app). Set:
256
-
257
- - `MAX_CLI_AUTH_URL` (preferred), or `FRONTLINE_MAX_CLI_AUTH_URL`, or `FRONTLINE_CLI_AUTH_URL`
258
-
259
- Example:
260
-
261
- ```bash
262
- export MAX_CLI_AUTH_URL="https://app.getfrontline.ai/max-cli/login"
263
- max auth login
264
- ```
265
- Optional override per run:
266
-
267
- ```bash
268
- max auth login --google --auth-url "https://localhost:3000/max-cli/login"
269
- ```
270
-
271
- ### Contract for the web app (backend + frontend)
272
-
273
- The CLI appends query parameters to `MAX_CLI_AUTH_URL`:
274
-
275
- | Parameter | Meaning |
276
- | --------------- | ------------------------------------------------------------------------- |
277
- | `provider` | `google`, `microsoft`, or `otp` |
278
- | `redirect_uri` | `http://127.0.0.1:<port>/callback` (local HTTP server started by the CLI) |
279
- | `state` | Random anti-CSRF value; **must** be returned unchanged |
280
- | `response_mode` | `query` (callback uses query string) |
281
-
282
- After the user signs in with Firebase (Google / Microsoft / email OTP), redirect the browser to:
283
-
284
- **Success:** `redirect_uri` + `?token=<Firebase_ID_token>&state=<same_state>`
285
- Optional: `&refresh_token=<refresh_if_you_have_it>` (only if your app can expose it safely).
286
-
287
- **Error:** `redirect_uri` + `?error=access_denied&state=<same_state>&error_description=<url-encoded message>`
288
-
289
- The token should be the same **Firebase ID token** your API already accepts in `Authorization: Bearer` with `verifyIdToken` (see `src/api/middlewares/authMiddleware.ts`).
290
-
291
- ### Config file location
292
-
293
- ```bash
294
- max config-path
295
- ```
296
-
297
- ---
298
-
299
- ## Development
300
-
301
- This package lives inside the monorepo at `packages/cli`.
302
-
303
- ```bash
304
- cd packages/cli
305
- npm install
306
- npm run dev:frontline -- agents list # run frontline without building
307
- npm run dev:max -- "Hola" # run max without building
308
- npm run build # compile TypeScript to dist/
309
- node dist/index.js --help # run compiled frontline
310
- node dist/max.js --help # run compiled max
311
- ```
312
-
313
- Config is persisted via `conf`:
314
-
315
- - `frontline` binary → project name `frontline-cli`
316
- - `max` binary → project name `max-cli`
317
-
318
- They do **not** share credentials.
319
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getfrontline/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Frontline CLI — Public API (agents, workflows, billing, tables, objects) + Max chat/admin REST from your terminal",
5
5
  "private": false,
6
6
  "type": "commonjs",
@@ -25,7 +25,11 @@
25
25
  "frontline",
26
26
  "cli",
27
27
  "api",
28
- "max"
28
+ "max",
29
+ "agents",
30
+ "getfrontline",
31
+ "workflows",
32
+ "crm"
29
33
  ],
30
34
  "license": "MIT",
31
35
  "dependencies": {