Skip to content

Commit ae21476

Browse files
authored
fix(cli): resolve findings from a full command-surface audit (#6788)
* fix(cli): resolve findings from a full command-surface audit Exercised all 147 commands against a live deployment. Fixes the defects that surfaced, plus the docs and generator drift they exposed. Transport - Stop following redirects. A bare domain that 301s to www silently converted POST to GET and dropped the body, so reads worked while every write failed with a misleading validation error and login returned 405. Both the client and the device flow now explain the redirect and name the endpoint to configure, rather than carrying credentials off-origin. - Report a non-JSON response as one instead of printing the HTML page. - Name the personal-API-key remedy on a workspace-key refusal, reading the machine-readable code the API actually sends. - Drop union-branch noise from validation errors that contradicted itself. - Show paging progress on stderr for multi-page fetches. Output - Clamp record values for table only. text is the format built for pipes, and it was truncating signed URLs and tool source mid-value. - Infer timestamp, duration, bytes and boolean formatting for API-owned keys so undeclared commands stop printing raw ISO and float ms. Skips user-defined table cells and leaves json/yaml on the raw payload. - Render a declared-but-absent field as an em dash; billing credits were vanishing silently. Paths, naming and validation - Percent-encode folder paths per segment and decode them for display, so a folder reads and types as the name shown in the app. - Reject a malformed endpoint where it is set and where it resolves, instead of crashing with a URL parse trace. - Request the detail level logs list's own columns need; its workflow column could never populate. - Rename three commands that described themselves wrongly and align two flags with their siblings. Old spellings still work: hidden, warned on stderr, and kept out of help and docs. - Verify whoami against the API, separating a bad key from an unreachable endpoint, and report the workspace by name. - Correct the --yes help text, which advertised skipping a prompt that does not exist. Docs - Teach the docs generator that a flag required by the runtime is required, and that hidden commands are not documented. * fix(cli): clear the paging progress line when a page fails Progress is written without a trailing newline so it can be overwritten in place, and both paging loops cleaned it up only on success. A page that threw part-way through left `fetched 1200…` on the line the error was then printed onto, so the two ran together. * fix(cli): name a working API root when an endpoint redirects The suggested endpoint was the redirect target's origin, which drops a path prefix. A self-hosted deployment reached at https://host/sim was told to set https://www.host — not an API root, so following the advice replaced one broken endpoint with another. Derive it by stripping the request's own path from the target instead, so a prefix survives, and say nothing about --set-endpoint when the target resolves to the endpoint already configured: a trailing-slash or path normalization redirect keeps the origin, and naming the value the caller already has explains nothing. The login poll shared both faults and now shares the helper.
1 parent ef225f9 commit ae21476

48 files changed

Lines changed: 2877 additions & 370 deletions

Some content is hidden

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

apps/docs/content/docs/en/cli/authentication.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,18 @@ re-logging into an existing profile preselects the one already configured.
5656
## Checking who you are
5757

5858
```bash
59-
sim whoami
59+
sim whoami # resolved settings, plus a live check that they work
60+
sim whoami --no-verify # resolved settings only, no request
6061
```
6162

62-
Prints the resolved endpoint, workspace, output format, and account, and which
63-
source each value came from.
63+
Prints the resolved endpoint, workspace, and output format, and which source each
64+
value came from, then reads the configured workspace to prove the key is accepted
65+
and can reach it.
66+
67+
It exits `0` when the check passes, `1` when the credentials are wrong, and `2`
68+
when the check could not be made at all — no workspace to check against, or an
69+
endpoint that did not answer. The split matters in CI: only `1` is fixed by
70+
logging in again.
6471

6572
## Signing out
6673

apps/docs/content/docs/en/cli/commands.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,22 @@ sim logout [options]
7878

7979
</CommandTable>
8080

81-
## Show the resolved profile and where each setting came from
81+
## Show the resolved profile, where each setting came from, and whether it works
8282

8383
```bash
84-
sim whoami
84+
sim whoami [options]
8585
```
8686

87+
**Options**
88+
89+
<CommandTable>
90+
91+
| Option | Required | Description |
92+
| --- | --- | --- |
93+
| `--no-verify` | No | Skip the API check and only print the resolved settings. |
94+
95+
</CommandTable>
96+
8797
## List the profiles defined in the config and credentials files
8898

8999
```bash

apps/docs/content/docs/en/cli/credentials.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ sim credentials delete <credentialId> [options]
3131

3232
| Option | Required | Description |
3333
| --- | --- | --- |
34-
| `-y, --yes` | No | Skip the confirmation. |
34+
| `-y, --yes` | Yes | Confirm this destructive operation. |
3535

3636
</CommandTable>
3737

apps/docs/content/docs/en/cli/custom-tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ sim custom-tools delete <id> [options]
4949

5050
| Option | Required | Description |
5151
| --- | --- | --- |
52-
| `-y, --yes` | No | Skip the confirmation. |
52+
| `-y, --yes` | Yes | Confirm this destructive operation. |
5353

5454
</CommandTable>
5555

apps/docs/content/docs/en/cli/files.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ sim files batch-delete [options]
2222
| Option | Required | Description |
2323
| --- | --- | --- |
2424
| `--file-ids <value...>` | Yes | File identifiers to update. (space-separated, or @path / @- with one value per line). |
25-
| `-y, --yes` | No | Skip the confirmation. |
25+
| `-y, --yes` | Yes | Confirm this destructive operation. |
2626

2727
</CommandTable>
2828

@@ -40,7 +40,7 @@ sim files create [options]
4040
| --- | --- | --- |
4141
| `--name <value>` | Yes | File name, including its extension. Path separators and dot segments are rejected. |
4242
| `--content-type <value>` | No | MIME type. When omitted, it is inferred from the file extension. |
43-
| `--folder <value>` | No | Folder path; the leading / is optional. |
43+
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |
4444
| `--content <value>` | No | Initial file content. Omit or send an empty string for a zero-byte file. The 70,000,000-character bound guards the JSON envelope; the decoded bytes must be at most 50 MiB, and a longer base64 payload is rejected with `413`. Use an upload session for anything larger. |
4545
| `--encoding <value>` | No | Encoding of the content field. Accepted values: `utf-8`, `base64`. |
4646

@@ -58,7 +58,7 @@ sim files folders create <path>
5858

5959
| Argument | Required | Description |
6060
| --- | --- | --- |
61-
| `path` | Yes | Folder path; the leading / is optional |
61+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
6262

6363
</CommandTable>
6464

@@ -74,7 +74,7 @@ sim files folders delete <path> [options]
7474

7575
| Argument | Required | Description |
7676
| --- | --- | --- |
77-
| `path` | Yes | Folder path; the leading / is optional |
77+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
7878

7979
</CommandTable>
8080

@@ -85,7 +85,7 @@ sim files folders delete <path> [options]
8585
| Option | Required | Description |
8686
| --- | --- | --- |
8787
| `--recursive` | No | Delete the folder and its descendants. |
88-
| `-y, --yes` | No | Skip the confirmation. |
88+
| `-y, --yes` | Yes | Confirm this destructive operation. |
8989

9090
</CommandTable>
9191

@@ -124,8 +124,8 @@ Also available as `sim files folders mv`.
124124

125125
| Argument | Required | Description |
126126
| --- | --- | --- |
127-
| `path` | Yes | Folder path; the leading / is optional |
128-
| `destination` | Yes | Folder path; the leading / is optional |
127+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
128+
| `destination` | Yes | Folder path as shown in the app; the leading / is optional |
129129

130130
</CommandTable>
131131

@@ -151,7 +151,7 @@ sim files delete <fileId> [options]
151151

152152
| Option | Required | Description |
153153
| --- | --- | --- |
154-
| `-y, --yes` | No | Skip the confirmation. |
154+
| `-y, --yes` | Yes | Confirm this destructive operation. |
155155

156156
</CommandTable>
157157

@@ -238,7 +238,7 @@ sim files list [options]
238238

239239
| Option | Required | Description |
240240
| --- | --- | --- |
241-
| `--folder <value>` | No | Folder path; the leading / is optional. |
241+
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |
242242
| `--scope <value>` | No | Which lifecycle set to list: `active` (default) for live files, `archived` for files a `DELETE` soft-deleted. `folderPath` resolves against active folders only, so pairing it with `scope=archived` returns an empty page when the containing folder was archived too. Accepted values: `active`, `archived`. |
243243
| `--search <value>` | No | Case-insensitive substring match against the file name. |
244244
| `--sort-by <value>` | No | Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order. Accepted values: `name`, `size`, `uploadedAt`, `updatedAt`. |
@@ -292,10 +292,10 @@ sim files rename <fileId> [options]
292292

293293
</CommandTable>
294294

295-
## Restore file
295+
## Restore an archived file
296296

297297
```bash
298-
sim files restore create <fileId>
298+
sim files restore <fileId>
299299
```
300300

301301
**Arguments**
@@ -357,7 +357,7 @@ sim files upload <path> [options]
357357

358358
| Option | Required | Description |
359359
| --- | --- | --- |
360-
| `--folder <path>` | No | Destination folder path (defaults to /). |
360+
| `--folder <path>` | No | Folder path as shown in the app; defaults to the root folder. |
361361
| `--name <name>` | No | Store it under a different name. |
362362

363363
</CommandTable>

apps/docs/content/docs/en/cli/knowledge.mdx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ sim knowledge documents delete <knowledgeBaseId> <documentId> [options]
6161

6262
| Option | Required | Description |
6363
| --- | --- | --- |
64-
| `-y, --yes` | No | Skip the confirmation. |
64+
| `-y, --yes` | Yes | Confirm this destructive operation. |
6565

6666
</CommandTable>
6767

@@ -116,7 +116,7 @@ sim knowledge documents list <knowledgeBaseId> [options]
116116
## Update document
117117

118118
```bash
119-
sim knowledge documents update <id> <documentId> [options]
119+
sim knowledge documents update <knowledgeBaseId> <documentId> [options]
120120
```
121121

122122
**Arguments**
@@ -125,7 +125,7 @@ sim knowledge documents update <id> <documentId> [options]
125125

126126
| Argument | Required | Description |
127127
| --- | --- | --- |
128-
| `id` | Yes | Unique knowledge base identifier. |
128+
| `knowledgeBaseId` | Yes | Unique knowledge base identifier. |
129129
| `documentId` | Yes | Unique knowledge document identifier. |
130130

131131
</CommandTable>
@@ -209,7 +209,7 @@ sim knowledge create [options]
209209
| `--name <value>` | Yes | Human-readable knowledge base name. |
210210
| `--description <value>` | No | Optional knowledge base description. |
211211
| `--chunking-config <json\|@file>` | No | Chunking configuration; defaults are applied when omitted. (JSON, or @path / @- to read a file or stdin). |
212-
| `--folder <value>` | No | Folder path; the leading / is optional. |
212+
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |
213213

214214
</CommandTable>
215215

@@ -225,7 +225,7 @@ sim knowledge folders create <path>
225225

226226
| Argument | Required | Description |
227227
| --- | --- | --- |
228-
| `path` | Yes | Folder path; the leading / is optional |
228+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
229229

230230
</CommandTable>
231231

@@ -241,7 +241,7 @@ sim knowledge folders delete <path> [options]
241241

242242
| Argument | Required | Description |
243243
| --- | --- | --- |
244-
| `path` | Yes | Folder path; the leading / is optional |
244+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
245245

246246
</CommandTable>
247247

@@ -252,7 +252,7 @@ sim knowledge folders delete <path> [options]
252252
| Option | Required | Description |
253253
| --- | --- | --- |
254254
| `--recursive` | No | Delete the folder and its descendants. |
255-
| `-y, --yes` | No | Skip the confirmation. |
255+
| `-y, --yes` | Yes | Confirm this destructive operation. |
256256

257257
</CommandTable>
258258

@@ -291,8 +291,8 @@ Also available as `sim knowledge folders mv`.
291291

292292
| Argument | Required | Description |
293293
| --- | --- | --- |
294-
| `path` | Yes | Folder path; the leading / is optional |
295-
| `destination` | Yes | Folder path; the leading / is optional |
294+
| `path` | Yes | Folder path as shown in the app; the leading / is optional |
295+
| `destination` | Yes | Folder path as shown in the app; the leading / is optional |
296296

297297
</CommandTable>
298298

@@ -318,7 +318,7 @@ sim knowledge delete <id> [options]
318318

319319
| Option | Required | Description |
320320
| --- | --- | --- |
321-
| `-y, --yes` | No | Skip the confirmation. |
321+
| `-y, --yes` | Yes | Confirm this destructive operation. |
322322

323323
</CommandTable>
324324

@@ -350,7 +350,7 @@ sim knowledge list [options]
350350

351351
| Option | Required | Description |
352352
| --- | --- | --- |
353-
| `--folder <value>` | No | Folder path; the leading / is optional. |
353+
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |
354354
| `--search <value>` | No | Case-insensitive substring match against the resource name. |
355355
| `--sort-by <value>` | No | Field used to sort the result. Sorting by `name` is case-sensitive and follows the storage collation, so do not rely on a case-insensitive order. Accepted values: `name`, `createdAt`, `updatedAt`. |
356356
| `--sort-order <value>` | No | Sort direction. Accepted values: `asc`, `desc`. |
@@ -361,7 +361,7 @@ sim knowledge list [options]
361361
## List tags
362362

363363
```bash
364-
sim knowledge tags list <id>
364+
sim knowledge tags list <knowledgeBaseId>
365365
```
366366

367367
**Arguments**
@@ -370,7 +370,7 @@ sim knowledge tags list <id>
370370

371371
| Argument | Required | Description |
372372
| --- | --- | --- |
373-
| `id` | Yes | Unique knowledge base identifier. |
373+
| `knowledgeBaseId` | Yes | Unique knowledge base identifier. |
374374

375375
</CommandTable>
376376

@@ -423,7 +423,7 @@ sim knowledge update <id> [options]
423423
| `--name <value>` | No | New knowledge base name. |
424424
| `--description <value>` | No | New knowledge base description. |
425425
| `--chunking-config <json\|@file>` | No | New document chunking configuration. (JSON, or @path / @- to read a file or stdin). |
426-
| `--folder <value>` | No | Folder path; the leading / is optional. |
426+
| `--folder <value>` | No | Folder path as shown in the app; the leading / is optional. |
427427

428428
</CommandTable>
429429

@@ -440,7 +440,7 @@ sim knowledge mv <id> <folder>
440440
| Argument | Required | Description |
441441
| --- | --- | --- |
442442
| `id` | Yes | Unique knowledge base identifier. |
443-
| `folder` | Yes | Folder path; the leading / is optional |
443+
| `folder` | Yes | Folder path as shown in the app; the leading / is optional |
444444

445445
</CommandTable>
446446

apps/docs/content/docs/en/cli/logs.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ sim logs list [options]
5757
| `--min-cost <value>` | No | Minimum execution cost in USD, from 0 to 1000000. A run is never charged a negative amount, so a negative bound is rejected rather than treated as a filter that matches every run. |
5858
| `--max-cost <value>` | No | Maximum execution cost in USD, from 0 to 1000000. A run is never charged a negative amount, so a negative bound is rejected rather than treated as a filter that matches every run. |
5959
| `--model <value>` | No | AI model used during execution. |
60-
| `--details <value>` | No | Response detail level. Accepted values: `basic`, `full`. |
60+
| `--details <value>` | No | Response detail level; full is requested by default to name each run’s workflow. Accepted values: `basic`, `full`. |
6161
| `--include-trace-spans` | No | Include trace spans in JSON or YAML output (implies full detail). |
6262
| `--include-final-output` | No | Include final output in JSON or YAML output (implies full detail). |
6363
| `--limit <n>` | No | Maximum items to return (0 for everything). Defaults to `100`. |
6464
| `--order <value>` | No | Sort direction by execution start time. This list is sortable only by execution start time, so it takes `order` in place of `sortBy`/`sortOrder`, which it rejects. Accepted values: `asc`, `desc`. |
6565
| `--run-id <value>` | No | Exact run identifier to match. |
66-
| `--folder <value...>` | No | Folder path; the leading / is optional (space-separated, or @path / @- with one value per line). |
66+
| `--folder <value...>` | No | Folder path as shown in the app; the leading / is optional (space-separated, or @path / @- with one value per line). |
6767

6868
</CommandTable>

apps/docs/content/docs/en/cli/mcp-servers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ sim mcp-servers delete <id> [options]
5858

5959
| Option | Required | Description |
6060
| --- | --- | --- |
61-
| `-y, --yes` | No | Skip the confirmation. |
61+
| `-y, --yes` | Yes | Confirm this destructive operation. |
6262

6363
</CommandTable>
6464

0 commit comments

Comments
 (0)