@getfrontline/cli 1.0.0 → 1.0.3

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 (69) hide show
  1. package/README.md +246 -319
  2. package/dist/commands/auth/login.d.ts.map +1 -1
  3. package/dist/commands/auth/login.js +29 -4
  4. package/dist/commands/auth/login.js.map +1 -1
  5. package/dist/commands/auth/profiles.d.ts.map +1 -1
  6. package/dist/commands/auth/profiles.js +7 -11
  7. package/dist/commands/auth/profiles.js.map +1 -1
  8. package/dist/commands/object/export.js +3 -3
  9. package/dist/commands/object/field.js +5 -5
  10. package/dist/commands/object/index.js +8 -8
  11. package/dist/commands/object/index.js.map +1 -1
  12. package/dist/commands/object/option.js +4 -4
  13. package/dist/commands/object/record-type.js +4 -4
  14. package/dist/commands/object/record.js +8 -8
  15. package/dist/commands/object/relation.js +4 -4
  16. package/dist/commands/object/view.js +9 -9
  17. package/dist/lib/cliVersion.d.ts +8 -0
  18. package/dist/lib/cliVersion.d.ts.map +1 -0
  19. package/dist/lib/cliVersion.js +26 -0
  20. package/dist/lib/cliVersion.js.map +1 -0
  21. package/dist/lib/config.js +1 -1
  22. package/dist/lib/config.js.map +1 -1
  23. package/dist/lib/errors.d.ts +3 -0
  24. package/dist/lib/errors.d.ts.map +1 -1
  25. package/dist/lib/errors.js +10 -1
  26. package/dist/lib/errors.js.map +1 -1
  27. package/dist/lib/helpEpilog.d.ts.map +1 -1
  28. package/dist/lib/helpEpilog.js +35 -35
  29. package/dist/lib/helpEpilog.js.map +1 -1
  30. package/dist/lib/httpClient.d.ts.map +1 -1
  31. package/dist/lib/httpClient.js +35 -16
  32. package/dist/lib/httpClient.js.map +1 -1
  33. package/dist/lib/output.d.ts +10 -0
  34. package/dist/lib/output.d.ts.map +1 -1
  35. package/dist/lib/output.js +28 -12
  36. package/dist/lib/output.js.map +1 -1
  37. package/dist/max/commands/auth/login.d.ts.map +1 -1
  38. package/dist/max/commands/auth/login.js +22 -5
  39. package/dist/max/commands/auth/login.js.map +1 -1
  40. package/dist/max/commands/chat/repl.d.ts +9 -0
  41. package/dist/max/commands/chat/repl.d.ts.map +1 -1
  42. package/dist/max/commands/chat/repl.js +15 -11
  43. package/dist/max/commands/chat/repl.js.map +1 -1
  44. package/dist/max/commands/chat/send.d.ts.map +1 -1
  45. package/dist/max/commands/chat/send.js +17 -0
  46. package/dist/max/commands/chat/send.js.map +1 -1
  47. package/dist/max/lib/httpClient.d.ts.map +1 -1
  48. package/dist/max/lib/httpClient.js +11 -4
  49. package/dist/max/lib/httpClient.js.map +1 -1
  50. package/dist/max/ui/banner.d.ts.map +1 -1
  51. package/dist/max/ui/banner.js +21 -21
  52. package/dist/max/ui/banner.js.map +1 -1
  53. package/dist/max.js +15 -3
  54. package/dist/max.js.map +1 -1
  55. package/dist/skills/aggregations/SKILL.md +7 -7
  56. package/dist/skills/auth-and-profiles/SKILL.md +1 -1
  57. package/dist/skills/crm-setup/SKILL.md +58 -48
  58. package/dist/skills/crud-operations/SKILL.md +2 -2
  59. package/dist/skills/export-and-delete/SKILL.md +5 -5
  60. package/dist/skills/files/SKILL.md +4 -4
  61. package/dist/skills/filter-and-query/SKILL.md +7 -7
  62. package/dist/skills/frontline-internals/SKILL.md +209 -0
  63. package/dist/skills/max-auth/SKILL.md +76 -76
  64. package/dist/skills/max-chat/SKILL.md +111 -111
  65. package/dist/skills/notes-and-tasks/SKILL.md +4 -4
  66. package/dist/skills/pipeline-setup/SKILL.md +13 -13
  67. package/dist/skills/relations/SKILL.md +20 -15
  68. package/dist/skills/schema-design/SKILL.md +13 -13
  69. package/package.json +51 -47
package/README.md CHANGED
@@ -1,319 +1,246 @@
1
- # @frontline/cli
2
-
3
- Unified Frontline command-line toolbox. Ships two binaries:
4
-
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).
10
-
11
- ## Installation
12
-
13
- ```bash
14
- npm install -g @frontline/cli
15
- ```
16
-
17
- Or run without installing:
18
-
19
- ```bash
20
- npx @frontline/cli --help
21
- ```
22
-
23
- ## Output format
24
-
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:
26
-
27
- - `--pretty` key/value blocks, spinners, icons (to stderr-safe channels)
28
- - `--table` — tabular rendering for list endpoints
29
-
30
- Errors always go to `stderr` in human form and to `stdout` as structured JSON when the command was invoked in its default (non-pretty) mode.
31
-
32
- ---
33
-
34
- # `frontline` binary
35
-
36
- ## Authentication
37
-
38
- API keys are sent via `Authorization: Bearer`.
39
-
40
- ### Login
41
-
42
- ```bash
43
- # Default profile, default base URL (localhost in dev)
44
- 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
- ```
50
-
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.
52
-
53
- ### Switch / inspect profiles
54
-
55
- ```bash
56
- frontline auth profiles list # all saved profiles + active one
57
- frontline auth profiles use prod # change active profile
58
- frontline auth whoami # hits /me with current profile
59
- frontline auth logout # remove active profile
60
- frontline auth logout --profile staging
61
- ```
62
-
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
- ## Commands
68
-
69
- ### Agents
70
-
71
- ```bash
72
- frontline agents list
73
- frontline agents list --status active
74
- frontline agents flows <agentId>
75
- frontline agents flows <agentId> --status active
76
- frontline agents analytics <agentId> --start-date 2025-01-01 --end-date 2025-12-31
77
- ```
78
-
79
- ### Workflows
80
-
81
- ```bash
82
- frontline workflows list
83
- frontline workflows list --status active
84
- frontline workflows analytics <workflowId> --start-date 2025-01-01 --end-date 2025-12-31
85
- ```
86
-
87
- ### Billing
88
-
89
- ```bash
90
- frontline billing get
91
- ```
92
-
93
- ### Raw API requests
94
-
95
- For endpoints not yet mapped to a command:
96
-
97
- ```bash
98
- frontline api get /agents
99
- frontline api get /agents --query status=active
100
- frontline api get /workflows/123/analytics --query startDate=2025-01-01 endDate=2025-12-31
101
- ```
102
-
103
- ### Objects (CRM entities)
104
-
105
- ```bash
106
- frontline object list
107
- frontline object get sor__people
108
- frontline object schema sor__deals
109
- frontline object create --data '{"name":"custom_obj","displayName":"Custom","fields":[...]}'
110
- frontline object update sor__deals --data '{"displayName":"Deals v2"}'
111
- frontline object count sor__deals
112
- frontline object delete sor__custom_object
113
- ```
114
-
115
- ### Tables (spreadsheet-like)
116
-
117
- ```bash
118
- frontline table list
119
- frontline table get my_table
120
- frontline table create my_table --data '{"displayName":"My Table","columns":[{"name":"Name","type":"string","metadata":{"format":"text"}}]}'
121
- frontline table delete my_table
122
- ```
123
-
124
- ### Shared sub-commands (object & table)
125
-
126
- Both `object` and `table` expose the same set of sub-commands:
127
-
128
- | Command | Description |
129
- | ---------------- | ----------------------------------------------- |
130
- | `field` | Manage fields (columns) — CRUD |
131
- | `option` | Manage select-field options — CRUD |
132
- | `record` / `row` | Manage rows list, get, create, update, delete |
133
- | `relation` | Link / unlink related records |
134
- | `view` | Manage views (object only) — CRUD |
135
- | `record-type` | Manage record types (object only) |
136
- | `note` | Notes on rows CRUD |
137
- | `task` | Tasks on rows — CRUD + complete / uncomplete |
138
- | `file` | Files on rows — list, get, download, delete |
139
- | `aggregation` | Aggregations — CRUD + compute |
140
- | `export` | Export data as XLSX or CSV |
141
-
142
- Run `frontline <resource> <subcommand> --help` for details and examples.
143
-
144
- ### Global flags
145
-
146
- Every `frontline` command accepts:
147
-
148
- - `--api-key <key>` — override stored API key for a single call
149
- - `--base-url <url>` override stored base URL for a single call
150
- - `--profile <name>` — use a specific saved profile
151
- - `--debug` verbose request/response logs (token is redacted)
152
- - `--pretty` — human-readable output
153
- - `--table` — tabular output for list endpoints
154
-
155
- ## Claude Code Skills
156
-
157
- Install Frontline skills into Claude Code (auto-detected on `npm install`):
158
-
159
- ```bash
160
- frontline setup --claude-skills # install new skills
161
- frontline setup --claude-skills --force # overwrite existing
162
- ```
163
-
164
- Skills currently shipped:
165
-
166
- - **Public API:** `frontline-agents`, `frontline-workflows`, `frontline-billing`, `frontline-api`
167
- - **Max:** `max-chat`, `max-auth`
168
- - **Table / Object CRUD:** `auth-and-profiles`, `crm-setup`, `crud-operations`, `pipeline-setup`, `schema-design`, `resource-creation`, `record-type-management`, `relations`, `filter-and-query`, `files`, `notes-and-tasks`, `export-and-delete`, `aggregations`
169
-
170
- ## Debugging
171
-
172
- ```bash
173
- frontline agents list --debug
174
- ```
175
-
176
- ## Troubleshooting
177
-
178
- - **"No API key found"** — run `frontline auth login <key>` or set `FRONTLINE_API_KEY`.
179
- - **"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`.
181
- - **Rate limit** public API allows 100 req/min.
182
-
183
- ---
184
-
185
- # `max` binary
186
-
187
- Browser-based sign-in (Firebase ID token flow). Same npm package exposes the `max` command after install.
188
-
189
- ```bash
190
- 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
196
- max auth whoami
197
- max auth logout
198
- ```
199
-
200
- ## Chat with Max
201
-
202
- After signing in, you can send messages:
203
-
204
- ```bash
205
- # Send message (uses last conversation by default)
206
- max "Hola"
207
-
208
- # Start a new conversation
209
- max --new "Hola"
210
-
211
- # Explicit conversation id
212
- max --conversation 123 "Hola"
213
-
214
- # Alternative explicit command form
215
- max chat send "Hola"
216
- ```
217
-
218
- You can also start an interactive session (so you don't have to type `max` every time):
219
-
220
- ```bash
221
- max chat
222
- ```
223
-
224
- Inside the interactive prompt, use:
225
-
226
- - `:help` for commands
227
- - `:new` to start a new conversation
228
- - `:conv <id>` to switch conversations
229
- - `: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
-
1
+ # @getfrontline/cli
2
+
3
+ Unified Frontline command-line toolbox. Ships two binaries:
4
+
5
+ - **`frontline`** — public REST API: agents, workflows, billing, tables, objects, raw GET, Claude Code skills setup.
6
+ - **`max`** — Max chat & admin REST (per-user API key as Bearer, interactive chat).
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install -g @getfrontline/cli
12
+ ```
13
+
14
+ Or run without installing:
15
+
16
+ ```bash
17
+ npx @getfrontline/cli --help
18
+ ```
19
+
20
+ ## Output format
21
+
22
+ All `frontline` commands print **JSON to stdout by default** (scripting-friendly). Opt into human-readable output with:
23
+
24
+ - `--pretty` — key/value blocks, spinners, icons (to stderr-safe channels)
25
+ - `--table` tabular rendering for list endpoints
26
+
27
+ Errors always go to `stderr` in human form and to `stdout` as structured JSON when the command was invoked in its default (non-pretty) mode.
28
+
29
+ ---
30
+
31
+ # `frontline` binary
32
+
33
+ ### Login
34
+
35
+ ```bash
36
+ frontline auth login <api-key>
37
+ ```
38
+
39
+ The API key is shared between `frontline` and `max` automatically.
40
+
41
+ ### Switch / inspect profiles
42
+
43
+ ```bash
44
+ frontline auth profiles list # all saved profiles + active one
45
+ frontline auth profiles use prod # change active profile
46
+ frontline auth whoami # hits /me with current profile
47
+ frontline auth logout # remove active profile
48
+ frontline auth logout --profile staging
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ ### Agents
54
+
55
+ ```bash
56
+ frontline agents list
57
+ frontline agents list --status active
58
+ frontline agents flows <agentId>
59
+ frontline agents flows <agentId> --status active
60
+ frontline agents analytics <agentId> --start-date 2025-01-01 --end-date 2025-12-31
61
+ ```
62
+
63
+ ### Workflows
64
+
65
+ ```bash
66
+ frontline workflows list
67
+ frontline workflows list --status active
68
+ frontline workflows analytics <workflowId> --start-date 2025-01-01 --end-date 2025-12-31
69
+ ```
70
+
71
+ ### Billing
72
+
73
+ ```bash
74
+ frontline billing get
75
+ ```
76
+
77
+ ### Raw API requests
78
+
79
+ For endpoints not yet mapped to a command:
80
+
81
+ ```bash
82
+ frontline api get /agents
83
+ frontline api get /agents --query status=active
84
+ frontline api get /workflows/123/analytics --query startDate=2025-01-01 endDate=2025-12-31
85
+ ```
86
+
87
+ ### Objects (CRM entities)
88
+
89
+ ```bash
90
+ frontline object list
91
+ frontline object get standard__people
92
+ frontline object schema standard__deals
93
+ frontline object create --data '{"name":"custom_obj","displayName":"Custom","fields":[...]}'
94
+ frontline object update standard__deals --data '{"displayName":"Deals v2"}'
95
+ frontline object count standard__deals
96
+ frontline object delete standard__custom_object
97
+ ```
98
+
99
+ ### Tables (spreadsheet-like)
100
+
101
+ ```bash
102
+ frontline table list
103
+ frontline table get my_table
104
+ frontline table create my_table --data '{"displayName":"My Table","columns":[{"name":"Name","type":"string","metadata":{"format":"text"}}]}'
105
+ frontline table delete my_table
106
+ ```
107
+
108
+ ### Shared sub-commands (object & table)
109
+
110
+ Both `object` and `table` expose the same set of sub-commands:
111
+
112
+ | Command | Description |
113
+ | ---------------- | ----------------------------------------------- |
114
+ | `field` | Manage fields (columns) — CRUD |
115
+ | `option` | Manage select-field options — CRUD |
116
+ | `record` / `row` | Manage rows — list, get, create, update, delete |
117
+ | `relation` | Link / unlink related records |
118
+ | `view` | Manage views (object only) — CRUD |
119
+ | `record-type` | Manage record types (object only) |
120
+ | `note` | Notes on rows CRUD |
121
+ | `task` | Tasks on rows — CRUD + complete / uncomplete |
122
+ | `file` | Files on rows — list, get, download, delete |
123
+ | `aggregation` | Aggregations — CRUD + compute |
124
+ | `export` | Export data as XLSX or CSV |
125
+
126
+ Run `frontline <resource> <subcommand> --help` for details and examples.
127
+
128
+ ### Global flags
129
+
130
+ Every `frontline` command accepts:
131
+
132
+ - `--api-key <key>` override stored API key for a single call
133
+ - `--profile <name>` use a specific saved profile
134
+ - `--debug` verbose request/response logs
135
+ - `--pretty` human-readable output
136
+ - `--table` tabular output for list endpoints
137
+
138
+ ## Claude Code Skills
139
+
140
+ Optional: install Frontline skills into Claude Code (auto-detected on `npm install`):
141
+
142
+ ```bash
143
+ frontline setup --claude-skills # install new skills
144
+ frontline setup --claude-skills --force # overwrite existing
145
+ ```
146
+
147
+ Skills currently shipped:
148
+
149
+ - **Public API:** `frontline-agents`, `frontline-workflows`, `frontline-billing`, `frontline-api`
150
+ - **Max:** `max-chat`, `max-auth`
151
+ - **Table / Object CRUD:** `auth-and-profiles`, `crm-setup`, `crud-operations`, `pipeline-setup`, `schema-design`, `resource-creation`, `record-type-management`, `relations`, `filter-and-query`, `files`, `notes-and-tasks`, `export-and-delete`, `aggregations`
152
+
153
+ ## Debugging
154
+
155
+ ```bash
156
+ frontline agents list --debug
157
+ ```
158
+
159
+ ## Troubleshooting
160
+
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.
163
+ - **"Missing or invalid API key"** — key expired / revoked. Generate a new one.
164
+ - **"Request timed out"** — check network.
165
+ - **Rate limit** — public API allows 100 req/min.
166
+
167
+ ---
168
+
169
+ # `max` binary
170
+
171
+ Authentication uses the **same API key** as `frontline`. Logging in with either CLI keeps them in sync.
172
+
173
+ ```bash
174
+ max --help
175
+ max auth login <api-key>
176
+ max auth whoami
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
207
+ ```
208
+
209
+ Global flags: `--profile`, `--api-key`, `--pretty`, `--debug` (same resolution as `max chat send`).
210
+
211
+ ## Chat with Max
212
+
213
+ After `max auth login`, you can send messages:
214
+
215
+ ```bash
216
+ # Send message (uses last conversation by default)
217
+ max "Hola"
218
+
219
+ # Start a new conversation
220
+ max --new "Hola"
221
+
222
+ # Explicit conversation id
223
+ max --conversation 123 "Hola"
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
+
231
+ # Alternative explicit command form
232
+ max chat send "Hola"
233
+ ```
234
+
235
+ You can also start an interactive session (so you don't have to type `max` every time):
236
+
237
+ ```bash
238
+ max chat
239
+ ```
240
+
241
+ Inside the interactive prompt, use:
242
+
243
+ - `:help` for commands
244
+ - `:new` to start a new conversation
245
+ - `:conv <id>` to switch conversations
246
+ - `:exit` to quit
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,eAAO,MAAM,YAAY,SAmCnB,CAAC"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsCpC,eAAO,MAAM,YAAY,SAoDnB,CAAC"}
@@ -4,17 +4,28 @@ exports.loginCommand = void 0;
4
4
  const commander_1 = require("commander");
5
5
  const config_1 = require("../../lib/config");
6
6
  const output_1 = require("../../lib/output");
7
+ const auth_1 = require("../../lib/auth");
7
8
  const helpEpilog_1 = require("../../lib/helpEpilog");
8
9
  const maxConfig_1 = require("../../max/maxConfig");
9
10
  const banner_1 = require("../../max/ui/banner");
11
+ function printNextSteps() {
12
+ console.log();
13
+ console.log(output_1.brand.primary.bold("Start here"));
14
+ console.log(` ${output_1.brand.primary("frontline auth whoami")} ${output_1.brand.muted("Verify your API key")}`);
15
+ console.log(` ${output_1.brand.primary("frontline agents list")} ${output_1.brand.muted("List your agents")}`);
16
+ console.log(` ${output_1.brand.primary("frontline workflows list")} ${output_1.brand.muted("List your workflows")}`);
17
+ console.log(` ${output_1.brand.primary("max chat")} ${output_1.brand.muted("Open Max in your terminal")}`);
18
+ }
10
19
  exports.loginCommand = new commander_1.Command("login")
11
20
  .description("Store an API key for the current (or specified) profile. Does NOT verify the key.")
12
21
  .argument("<api-key>", "Your Frontline API key")
13
22
  .option("--base-url <url>", `Advanced: Public API base URL (default: ${(0, config_1.getDefaultBaseUrl)()})`)
14
23
  .option("--profile <name>", "Profile name (default: current profile)")
24
+ .option("--json", "Output the saved profile as JSON")
15
25
  .addHelpText("after", `\n${helpEpilog_1.FRONTLINE_AUTH_LOGIN_EPILOG}\n`)
16
26
  .action(async (apiKey, opts) => {
17
- await (0, banner_1.printFrontlineLogo)();
27
+ if (!opts.json)
28
+ await (0, banner_1.printFrontlineLogo)();
18
29
  const profileName = opts.profile ?? (0, config_1.getCurrentProfile)();
19
30
  const existing = (0, config_1.getProfile)(profileName);
20
31
  const baseUrl = opts.baseUrl ?? existing?.baseUrl ?? (0, config_1.getDefaultBaseUrl)();
@@ -28,12 +39,26 @@ exports.loginCommand = new commander_1.Command("login")
28
39
  (0, config_1.setCurrentProfile)(profileName);
29
40
  (0, maxConfig_1.setMaxCurrentProfile)(profileName);
30
41
  }
31
- (0, output_1.info)(`API key saved to profile "${profileName}"`);
32
- (0, output_1.success)({
42
+ const output = {
33
43
  authenticated: true,
34
44
  profile: profileName,
35
- key_preview: apiKey.substring(0, 5) + "...",
45
+ key_preview: (0, auth_1.redactToken)(apiKey),
46
+ base_url: baseUrl,
36
47
  config_path: (0, config_1.getConfigPath)(),
48
+ };
49
+ if (opts.json) {
50
+ (0, output_1.printJson)(output);
51
+ return;
52
+ }
53
+ console.log(`${output_1.brand.primary.bold("Welcome to Frontline CLI")}`);
54
+ console.log(output_1.brand.muted("You're signed in and ready to use Frontline from your terminal."));
55
+ console.log();
56
+ (0, output_1.printSuccess)(`Profile "${profileName}" is ready.`);
57
+ (0, output_1.printKeyValue)({
58
+ profile: output.profile,
59
+ baseUrl: output.base_url,
60
+ keyPreview: output.key_preview,
37
61
  });
62
+ printNextSteps();
38
63
  });
39
64
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],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AA,sBAAa,GAAE;KAC/B,CAAC;IAEF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAC;QAClB,OAAO;IACX,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,GAAG,cAAK,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,CAAC,cAAK,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC,CAAC;IAC5F,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,IAAA,qBAAY,EAAC,YAAY,WAAW,aAAa,CAAC,CAAC;IACnD,IAAA,sBAAa,EAAC;QACV,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,QAAQ;QACxB,UAAU,EAAE,MAAM,CAAC,WAAW;KACjC,CAAC,CAAC;IACH,cAAc,EAAE,CAAC;AACrB,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4FpC,eAAO,MAAM,eAAe,SAGO,CAAC"}
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2FpC,eAAO,MAAM,eAAe,SAGO,CAAC"}