Skip to content

Commit a8294b7

Browse files
committed
Merge remote-tracking branch 'origin/staging' into worktree-shadcn-cn-migrate
2 parents 2c345bd + 17bfb0b commit a8294b7

203 files changed

Lines changed: 36530 additions & 1199 deletions

File tree

Some content is hidden

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

.agents/skills/ship/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ When the user runs `/ship`:
6666
# Runs every audit CI runs, concurrently, and replays the output of any that fail.
6767
# The audit list is derived in scripts/run-audits.ts — do not hand-list audits here.
6868
bun run check:audits || { echo "❌ audit(s) failed — do not ship"; exit 1; }
69+
# CI's "Verify docs manifest is in sync" step is not a `check:*` script, so the runner above
70+
# does not cover it. (CI's "Security audit" `bun audit` step is `continue-on-error` — advisory
71+
# only, not a gate — so it is deliberately not run here.)
72+
bun run docs-manifest:check || { echo "❌ docs manifest out of sync — do not ship"; exit 1; }
6973
```
7074
If Phase A regenerated a file, its matching `:check` in Phase B now passes trivially — that parity is the point. Do not ship with any generator or audit failing; fix the cause (never silence it) and re-run. `check:migrations` and `type-check` are covered by steps 5 and CI respectively and are not repeated here.
7175
7. **Stage and commit** the changes with the generated message — including any files Phase A regenerated in step 6

apps/docs/content/docs/cli/configuration.mdx

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,80 @@ shared profile cannot also set its own endpoint or API key.
114114
| `SIM_API_KEY` | API key — skips `sim login` entirely |
115115
| `SIM_WORKSPACE` | Workspace to target |
116116
| `SIM_OUTPUT` | Output format |
117-
| `SIM_CONFIG_DIR` | Relocate both files away from `~/.sim` |
117+
| `SIM_CONFIG_DIR` | Relocate the config directory and update cache; file-specific overrides below still win |
118118
| `SIM_CONFIG_FILE` | Relocate only the config file |
119119
| `SIM_CREDENTIALS_FILE` | Relocate only the credentials file |
120120
| `SIM_TIMEOUT_SECONDS` | Per-request timeout; `0` waits indefinitely. Defaults to `3600`, above every timeout the server itself applies |
121121
| `SIM_DEBUG` | Trace each request's method, URL, status and duration to stderr |
122+
| `SIM_NO_UPDATE_CHECK` | Turn off update checks |
122123

123-
Node ignores `HTTPS_PROXY` unless you also set `NODE_USE_ENV_PROXY=1`, and only
124-
from Node 22.21 and 24.5. The CLI warns when a proxy is configured but will not
125-
be used.
124+
## Update notices
125+
126+
On eligible invocations, the CLI uses a daily cache before asking
127+
`registry.npmjs.org` what is published under the `latest` tag. Prerelease
128+
installs are skipped entirely, so a `-preview` or `-dev` build is never told to
129+
upgrade. When a newer one exists, it prints a single line on stderr naming both
130+
versions and the command that upgrades:
131+
132+
```
133+
Update available: sim 2.1.2 → 2.1.5. Run: npm install -g sim@latest
134+
```
135+
136+
Apart from the configured registry URL, the request identifies only the CLI
137+
version — no Sim API key, workspace, or command — and it never follows a
138+
redirect away from the registry it asked.
139+
140+
One caveat worth stating plainly: if you point `npm_config_registry` at a
141+
private mirror, the check goes to that mirror instead of npm. Query-string
142+
credentials (an Artifactory or Nexus `?token=…`, for example) are preserved and
143+
sent as part of the configured registry request — they have to be, or the
144+
mirror would reject it. As with other registry traffic, configured proxies or
145+
TLS inspection can observe what that network setup permits. A registry URL
146+
containing username/password userinfo, such as
147+
`https://user:password@registry.example`, is rejected and no update check is
148+
made.
149+
150+
An empty or whitespace-only `npm_config_registry` is treated as unset, so the
151+
public registry remains the default. Non-empty malformed and non-HTTP(S) values
152+
disable the update check rather than making an unexpected public request.
153+
154+
The notice is skipped entirely when:
155+
156+
- `SIM_NO_UPDATE_CHECK` is set to anything but `0` or `false`
157+
- stderr is not a terminal, so redirected and piped output is never affected
158+
- a CI environment variable is present (`CI`, `GITHUB_ACTIONS`, `JENKINS_URL`,
159+
`TEAMCITY_VERSION`, `BUILDKITE`)
160+
- the CLI is running under `npm exec` or `npx`, which may use a project-local or
161+
ephemeral package where global-install advice is inappropriate
162+
- the CLI is running from a checkout of the sim repository, whose version
163+
deliberately trails the published one
164+
- the installed version is a prerelease
165+
166+
The daily pace comes from a timestamp in the config directory's
167+
`update-check.json`: `~/.sim/update-check.json` by default, or under
168+
`SIM_CONFIG_DIR` when that is set. `SIM_CONFIG_FILE` and
169+
`SIM_CREDENTIALS_FILE` do not move the cache, so it may not sit beside a file
170+
relocated with either of those variables.
171+
172+
This throttle is best-effort across processes. Two commands that start together
173+
can both see a stale cache and check. Cache replacement is atomic, so either
174+
complete write can win without leaving a partially interleaved file. If the
175+
cache cannot be written — for example, because the config directory is
176+
read-only — every eligible invocation attempts a check because there is no
177+
timestamp to reuse.
178+
179+
The registry check has a one-second deadline. On expiry, the CLI terminates its
180+
short-lived request process so stalled DNS, connection, or response work cannot
181+
remain active and delay the command. `SIM_NO_UPDATE_CHECK=1` still turns the
182+
check off.
183+
184+
The command the notice prints matches how Sim was installed — `npm install -g`,
185+
`pnpm add -g`, `bun add -g`, or `yarn global add` — so running it updates the
186+
executable already on your `PATH` rather than installing a second copy under a
187+
different package manager.
188+
189+
Node's `fetch` uses `HTTP(S)_PROXY` when opted in with `NODE_USE_ENV_PROXY=1`
190+
(Node 22.21+ or 24.0+) or `--use-env-proxy` (Node 22.21+ or 24.5+).
126191

127192
For CI, set `SIM_API_KEY` and `SIM_WORKSPACE` and nothing needs to touch the
128193
filesystem at all.

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ Also available as `sim files folders ls`.
108108
| `--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`. |
109109
| `--sort-order <value>` | No | Sort direction. Accepted values: `asc`, `desc`. |
110110
| `--scope <value>` | No | Which lifecycle set to list: `active` (default) returns live folders only; `archived` returns folders a recursive delete soft-deleted, which is how a caller finds a path to hand to the folder restore. Authorization is identical for both. Accepted values: `active`, `archived`. |
111+
| `--recursive <value>` | No | Whether parentPath includes every descendant instead of direct children only. Accepted values: `true`, `1`, `yes`, `on`, `y`, `enabled`, `false`, `0`, `no`, `off`, `n`, `disabled`. |
112+
| `--depth <value>` | No | Deepest level below parentPath to include when recursive is true. |
111113

112114
</CommandTable>
113115

@@ -172,6 +174,32 @@ sim files delete <fileId> [options]
172174

173175
</CommandTable>
174176

177+
## Apply one exact or anchor-based edit to a text file
178+
179+
```bash
180+
sim files edit <fileId> [options]
181+
```
182+
183+
**Arguments**
184+
185+
<CommandTable>
186+
187+
| Argument | Required | Description |
188+
| --- | --- | --- |
189+
| `fileId` | Yes | File identifier. |
190+
191+
</CommandTable>
192+
193+
**Options**
194+
195+
<CommandTable>
196+
197+
| Option | Required | Description |
198+
| --- | --- | --- |
199+
| `--edit <json\|@file>` | Yes | One edit object: &#123;"mode":"search_replace","search":"old","content":"new","replaceAll":false&#125;, &#123;"mode":"replace_between","beforeAnchor":"start line","afterAnchor":"end line","content":"new"&#125;, &#123;"mode":"insert_after","anchor":"line","content":"new"&#125;, or &#123;"mode":"delete_between","startAnchor":"first line deleted","endAnchor":"ending line kept"&#125;. Anchored modes also accept occurrence starting at 1 (JSON, or @path / @- to read a file or stdin). |
200+
201+
</CommandTable>
202+
175203
## Show file metadata and sharing status
176204

177205
```bash
@@ -310,6 +338,8 @@ sim files read <fileId> [options]
310338
| Option | Required | Description |
311339
| --- | --- | --- |
312340
| `--max-bytes <value>` | No | Optional ceiling on the source bytes fed to the parser, lowering but never raising the server limit. |
341+
| `--offset <value>` | No | First line to return, 1-based. Absent starts at the first line. |
342+
| `--limit <value>` | No | How many lines to return from `offset`. Absent reads to the end. |
313343

314344
</CommandTable>
315345

@@ -355,6 +385,27 @@ sim files restore <fileId>
355385

356386
</CommandTable>
357387

388+
## Search file content
389+
390+
```bash
391+
sim files search [options]
392+
```
393+
394+
**Options**
395+
396+
<CommandTable>
397+
398+
| Option | Required | Description |
399+
| --- | --- | --- |
400+
| `--query <value>` | Yes | Regular expression, or exact text when `mode` is `exact`. |
401+
| `--mode <value>` | No | How `query` is read. Accepted values: `exact`, `regex`. |
402+
| `--max-results <value>` | No | Maximum matching lines to return. |
403+
| `--folder <value...>` | No | Folders to search, by path as shown in the app; omit to search the whole workspace (space-separated, or @path / @- with one value per line; @@value for a literal leading @). |
404+
| `--include-subfolders` | No | Whether each folder scope includes nested folders; on by default. |
405+
| `--no-include-subfolders` | No | Send --include-subfolders as false. |
406+
407+
</CommandTable>
408+
358409
## Unzip an archive into a new folder beside it
359410

360411
```bash

apps/docs/content/docs/cli/reference.mdx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ Also available as `sim files folders ls`.
788788
| `--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`. |
789789
| `--sort-order <value>` | No | Sort direction. Accepted values: `asc`, `desc`. |
790790
| `--scope <value>` | No | Which lifecycle set to list: `active` (default) returns live folders only; `archived` returns folders a recursive delete soft-deleted, which is how a caller finds a path to hand to the folder restore. Authorization is identical for both. Accepted values: `active`, `archived`. |
791+
| `--recursive <value>` | No | Whether parentPath includes every descendant instead of direct children only. Accepted values: `true`, `1`, `yes`, `on`, `y`, `enabled`, `false`, `0`, `no`, `off`, `n`, `disabled`. |
792+
| `--depth <value>` | No | Deepest level below parentPath to include when recursive is true. |
791793

792794
</CommandTable>
793795

@@ -858,6 +860,34 @@ sim files delete <fileId> [options]
858860

859861
</CommandTable>
860862

863+
### sim files edit
864+
865+
Apply one exact or anchor-based edit to a text file
866+
867+
```bash
868+
sim files edit <fileId> [options]
869+
```
870+
871+
**Arguments**
872+
873+
<CommandTable>
874+
875+
| Argument | Required | Description |
876+
| --- | --- | --- |
877+
| `fileId` | Yes | File identifier. |
878+
879+
</CommandTable>
880+
881+
**Options**
882+
883+
<CommandTable>
884+
885+
| Option | Required | Description |
886+
| --- | --- | --- |
887+
| `--edit <json\|@file>` | Yes | One edit object: &#123;"mode":"search_replace","search":"old","content":"new","replaceAll":false&#125;, &#123;"mode":"replace_between","beforeAnchor":"start line","afterAnchor":"end line","content":"new"&#125;, &#123;"mode":"insert_after","anchor":"line","content":"new"&#125;, or &#123;"mode":"delete_between","startAnchor":"first line deleted","endAnchor":"ending line kept"&#125;. Anchored modes also accept occurrence starting at 1 (JSON, or @path / @- to read a file or stdin). |
888+
889+
</CommandTable>
890+
861891
### sim files describe
862892

863893
Show file metadata and sharing status
@@ -1006,6 +1036,8 @@ sim files read <fileId> [options]
10061036
| Option | Required | Description |
10071037
| --- | --- | --- |
10081038
| `--max-bytes <value>` | No | Optional ceiling on the source bytes fed to the parser, lowering but never raising the server limit. |
1039+
| `--offset <value>` | No | First line to return, 1-based. Absent starts at the first line. |
1040+
| `--limit <value>` | No | How many lines to return from `offset`. Absent reads to the end. |
10091041

10101042
</CommandTable>
10111043

@@ -1055,6 +1087,29 @@ sim files restore <fileId>
10551087

10561088
</CommandTable>
10571089

1090+
### sim files search
1091+
1092+
Search File Content
1093+
1094+
```bash
1095+
sim files search [options]
1096+
```
1097+
1098+
**Options**
1099+
1100+
<CommandTable>
1101+
1102+
| Option | Required | Description |
1103+
| --- | --- | --- |
1104+
| `--query <value>` | Yes | Regular expression, or exact text when `mode` is `exact`. |
1105+
| `--mode <value>` | No | How `query` is read. Accepted values: `exact`, `regex`. |
1106+
| `--max-results <value>` | No | Maximum matching lines to return. |
1107+
| `--folder <value...>` | No | Folders to search, by path as shown in the app; omit to search the whole workspace (space-separated, or @path / @- with one value per line; @@value for a literal leading @). |
1108+
| `--include-subfolders` | No | Whether each folder scope includes nested folders; on by default. |
1109+
| `--no-include-subfolders` | No | Send --include-subfolders as false. |
1110+
1111+
</CommandTable>
1112+
10581113
### sim files unzip
10591114

10601115
Unzip an archive into a new folder beside it

apps/docs/content/docs/cli/troubleshooting.mdx

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Troubleshooting
33
description: The failures whose cause is not obvious from the error message
44
---
55

6+
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
7+
68
Errors print one line to stderr, prefixed `Error:`, and exit `1` — except
79
`sim whoami`, which exits `2` when it could not reach the API to check at all.
810
Most say what to do next; the cases below are the ones that do not.
@@ -85,6 +87,50 @@ editing the file by hand:
8587
sim --output table configure --set-output json
8688
```
8789

90+
## A command is missing that the documentation describes
91+
92+
The docs track the current release, so a command that exists here and not in
93+
`sim --help` usually means the installed CLI is older than the feature. Compare
94+
`sim --version` against the published version and upgrade:
95+
96+
```bash
97+
sim --version
98+
```
99+
100+
Then upgrade with the package manager you installed it with — using a different
101+
one installs a second copy instead of replacing the executable on your `PATH`:
102+
103+
<Tabs items={['npm', 'pnpm', 'bun']}>
104+
<Tab value="npm">
105+
```bash
106+
npm install -g sim@latest
107+
```
108+
</Tab>
109+
<Tab value="pnpm">
110+
```bash
111+
pnpm add -g sim@latest
112+
```
113+
</Tab>
114+
<Tab value="bun">
115+
```bash
116+
bun add -g sim@latest
117+
```
118+
</Tab>
119+
</Tabs>
120+
121+
The CLI can also tell you this through a cached daily check on eligible
122+
invocations, and the command it prints already matches your installation. It
123+
stays quiet when stderr is redirected, in CI, and under `npm exec` or `npx`.
124+
125+
## An update notice appears in output I am parsing
126+
127+
It should not: the notice is written to stderr, never stdout, so `--output json`
128+
piped to `jq` is unaffected. If something merges the two streams, silence it:
129+
130+
```bash
131+
export SIM_NO_UPDATE_CHECK=1
132+
```
133+
88134
## Anything else
89135

90136
An unexpected error prints a stack trace. That is a bug in the CLI — please

0 commit comments

Comments
 (0)