Skip to content

Commit 025ea4d

Browse files
authored
fix(docs): serve JSON-LD in the HTML, fix sidebar spacing, and tighten the CLI guides (#6763)
* docs(cli): use -g for the install, and cut the prose that was not pulling weight `--global` is valid but `-g` is what every comparable CLI documents, and the long form only came from the package README. Also drops the yarn tab: it read `yarn global add sim`, which works on Yarn 1 only — Yarn 2 removed global installs, so that command fails for anyone on a modern Yarn. Adds `npx sim` for running without installing. The guides had accumulated design rationale that belongs in code comments rather than user docs — why the filter grammar is JSON, why the config section naming is asymmetric, why an unexpected error keeps its stack trace. Surveying how gh, Vercel, Turborepo, Deno, Bun and Supabase write theirs, none carry that kind of justification, and callouts are reserved for content whose absence produces a wrong result rather than for general asides. So: 1016 lines to 763, and 12 callouts to 3. The three that remain are the pairing-code check, that `sim logout` does not revoke the key, and the `--limit 100` default on `batch-delete`/`batch-update`, which silently truncates a larger match. Troubleshooting drops the entries whose error message already contained its own fix and keeps the seven whose cause is not obvious. * fix(docs): render JSON-LD as native script tags so it reaches the HTML All four structured-data blocks — WebSite, TechArticle, BreadcrumbList, SoftwareApplication — were rendered with `next/script`, which never emitted a script tag. Measured on a production build, `/api-reference/getting-started` contained zero `<script type="application/ld+json">` elements; the payload existed only in the `__next_s` client-injection queue and the RSC flight data, so anything reading the served HTML saw no structured data at all. React was also logging "Encountered a script tag while rendering React component" on every page. `next/script` is for loading and executing JavaScript. JSON-LD is data, and Next's own guidance is a native `<script>` in the component. `serializeJsonLd` already escapes the `<` character to its unicode form, which is the sanitization that guidance calls for, so only the element changes. Same build, after: three valid tags per page with `WebSite` in `<head>`, and the injection queue gone entirely. * fix(docs): scope the flush-separator rule to a container's first separator `[data-separator]:not([data-separator] ~ [data-separator])` was meant to keep the first sidebar group flush against the top padding, but `~` only reaches siblings, so it also matched the first separator inside every expanded folder. Under Self-Hosting, "Install" lost its top margin and crowded the "Architecture" link above it — 25px of gap where "Configure" and "Operate" below it had 40px. `:first-child` expresses the intent directly. Only the four sidebar roots open with a separator; every nested folder starts with a page, so the intended case still goes flush and nothing else changes. * fix(docs): move the flush-separator rule onto the separator component Keeps the styling with the component that owns it, per the repo standard, and lets the global rule be deleted outright rather than corrected — `global.css` now only loses a rule in this PR. Tailwind's `first:` variant compiles to the same `:first-child` selector, so behavior is unchanged: the build emits `.first\:mt-0:first-child{margin-top:0}` and the prerendered HTML carries the class on the separator.
1 parent 257029a commit 025ea4d

13 files changed

Lines changed: 139 additions & 398 deletions

File tree

apps/docs/app/[lang]/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { defineI18nUI } from 'fumadocs-ui/i18n'
33
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
44
import { RootProvider } from 'fumadocs-ui/provider/next'
55
import { Geist_Mono, Inter } from 'next/font/google'
6-
import Script from 'next/script'
76
import { ThemeProvider } from 'next-themes'
87
import {
98
SidebarFolder,
@@ -92,10 +91,9 @@ export default async function Layout({ children, params }: LayoutProps) {
9291
suppressHydrationWarning
9392
>
9493
<head>
95-
<Script
94+
<script
9695
id='website-json-ld'
9796
type='application/ld+json'
98-
strategy='beforeInteractive'
9997
dangerouslySetInnerHTML={{ __html: serializeJsonLd(structuredData) }}
10098
/>
10199
</head>

apps/docs/app/global.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,6 @@ html #nd-sidebar button:not([aria-label*="ollapse"]):not([aria-label*="xpand"])
489489
padding: 0 !important;
490490
}
491491

492-
/* The first group sits flush against the top padding — it has nothing to be
493-
separated from. */
494-
[data-separator]:not([data-separator] ~ [data-separator]) {
495-
margin-top: 0;
496-
}
497-
498492
/* Active state — aligned with platform --surface-active */
499493
#nd-sidebar a[data-active="true"]:not(:has(span.font-mono)),
500494
#nd-sidebar button[data-active="true"] {

apps/docs/components/docs-layout/sidebar-components.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export function SidebarFolder({ item, children }: { item: Folder; children: Reac
193193
*/
194194
export function SidebarSeparator({ item }: { item: Separator }) {
195195
return (
196-
<div data-separator className='mt-4 mb-1.5 px-2'>
196+
<div data-separator className='mt-4 mb-1.5 px-2 first:mt-0'>
197197
<p className='text-[var(--text-muted)] text-caption'>{item.name}</p>
198198
</div>
199199
)

apps/docs/components/structured-data.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Script from 'next/script'
21
import { serializeJsonLd } from '@/lib/json-ld'
32
import { DOCS_BASE_URL } from '@/lib/urls'
43

@@ -103,15 +102,15 @@ export function StructuredData({
103102

104103
return (
105104
<>
106-
<Script
105+
<script
107106
id={`article-json-ld-${structuredDataId}`}
108107
type='application/ld+json'
109108
dangerouslySetInnerHTML={{
110109
__html: serializeJsonLd(articleStructuredData),
111110
}}
112111
/>
113112
{breadcrumbStructuredData && (
114-
<Script
113+
<script
115114
id={`breadcrumb-json-ld-${structuredDataId}`}
116115
type='application/ld+json'
117116
dangerouslySetInnerHTML={{
@@ -120,7 +119,7 @@ export function StructuredData({
120119
/>
121120
)}
122121
{(url === baseUrl || url === `${baseUrl}/`) && (
123-
<Script
122+
<script
124123
id={`software-json-ld-${structuredDataId}`}
125124
type='application/ld+json'
126125
dangerouslySetInnerHTML={{

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

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ description: Sign in from the terminal, authenticate CI with an API key, and kee
55

66
import { Callout } from 'fumadocs-ui/components/callout'
77

8-
The CLI authenticates with a Sim API key. On a workstation, `sim login` mints and
9-
stores one for you. In CI, you supply one through the environment and nothing
10-
touches the filesystem.
8+
The CLI authenticates with a Sim API key. `sim login` mints and stores one; in CI
9+
you supply one through the environment instead.
1110

1211
## Signing in
1312

@@ -28,13 +27,11 @@ Waiting for approval…
2827
Personal key, defaulting to ws_abc123. Override per command with --workspace.
2928
```
3029

31-
This is the same browser handoff shape as `gh auth login`. Nothing redeemable
32-
crosses the browser leg, and there is no loopback listener — so it works over
33-
SSH and inside containers.
30+
There is no loopback listener, so this works over SSH and inside containers.
3431

3532
<Callout type="warn">
36-
Confirm the pairing code in your terminal matches the one the browser shows
37-
before you approve. That check is what binds the approval to *your* terminal.
33+
Confirm the pairing code in the browser matches the one in your terminal before
34+
approving. That check is what binds the approval to your terminal.
3835
</Callout>
3936

4037
| Option | What it does |
@@ -45,10 +42,7 @@ before you approve. That check is what binds the approval to *your* terminal.
4542

4643
### Picking a workspace
4744

48-
The approval page is where you choose the workspace — the terminal has no key
49-
yet, so it cannot list them for you.
50-
51-
`sim login` issues a **personal** key. The workspace you pick becomes the
45+
You choose the workspace on the approval page. `sim login` issues a **personal** key. The workspace you pick becomes the
5246
profile's default `workspace`; it does **not** restrict the key to that
5347
workspace. Target another workspace the key can reach with `--workspace`:
5448

@@ -65,9 +59,8 @@ re-logging into an existing profile preselects the one already configured.
6559
sim whoami
6660
```
6761

68-
This prints the resolved endpoint, workspace, output format, and account — and
69-
which source each value came from. Reach for it first whenever a command targets
70-
something you did not expect.
62+
Prints the resolved endpoint, workspace, output format, and account, and which
63+
source each value came from.
7164

7265
## Signing out
7366

@@ -83,8 +76,8 @@ Sim under **Settings → API keys**.
8376

8477
## Authenticating CI
8578

86-
Skip `sim login` entirely. Set the key and workspace in the environment and the
87-
CLI never reads or writes a config file:
79+
Set the key and workspace in the environment; the CLI never reads or writes a
80+
config file:
8881

8982
```bash
9083
export SIM_API_KEY="sim_…"
@@ -96,10 +89,8 @@ sim workflows run wf_7Yb2 --input '{"source":"nightly"}' --output json
9689
Create the key in Sim under **Settings → API keys**. Store it as a secret in your
9790
CI provider — never commit it.
9891

99-
<Callout type="info">
100-
`SIM_CONFIG_DIR` relocates both files if you do need them somewhere other than
101-
`~/.sim` — a container image, or a runner with no writable home directory.
102-
</Callout>
92+
`SIM_CONFIG_DIR` relocates both files if you need them somewhere other than
93+
`~/.sim`, such as a runner with no writable home directory.
10394

10495
### GitHub Actions
10596

@@ -111,7 +102,7 @@ jobs:
111102
- uses: actions/setup-node@v4
112103
with:
113104
node-version: '20'
114-
- run: npm install --global sim
105+
- run: npm install -g sim
115106
- run: sim workflows run wf_7Yb2 --output json
116107
env:
117108
SIM_API_KEY: ${{ secrets.SIM_API_KEY }}
@@ -120,8 +111,7 @@ jobs:
120111
121112
## Several accounts at once
122113
123-
Each profile holds one identity and one set of defaults, so a production account
124-
and a local stack can coexist without re-authenticating:
114+
Each profile holds one identity and one set of defaults:
125115
126116
```bash
127117
sim login --profile dev --endpoint http://localhost:3000
@@ -135,23 +125,23 @@ See [Configuration](/cli/configuration) for how profiles are stored and resolved
135125

136126
## Self-hosted and non-production deployments
137127

138-
Point the CLI at any Sim deployment with `--endpoint`, then sign in against it:
128+
Point the CLI at any deployment with `--endpoint`, then sign in against it:
139129

140130
```bash
141131
sim login --profile local --endpoint http://localhost:3000
142132
```
143133

144-
Save it so you do not have to repeat the flag:
134+
Save it to avoid repeating the flag:
145135

146136
```bash
147137
sim configure --set-endpoint http://localhost:3000 --profile local
148138
```
149139

150140
## Where the key is stored
151141

152-
Keys live in `~/.sim/credentials`, written with `0600` permissions, kept apart
153-
from the non-secret `~/.sim/config` so the two can be handled differently — you
154-
can commit `config` to a dotfiles repo, and never `credentials`.
142+
Keys live in `~/.sim/credentials`, written `0600`, separate from the non-secret
143+
`~/.sim/config`. Commit `config` to a dotfiles repo if you like; never
144+
`credentials`.
155145

156146
```ini title="~/.sim/credentials"
157147
[default]

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

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ title: Configuration
33
description: Profiles, config files, environment variables, and how each setting is resolved
44
---
55

6-
import { Callout } from 'fumadocs-ui/components/callout'
7-
8-
The CLI has four settings: which **endpoint** to talk to, which **API key** to
9-
use, which **workspace** to target, and which **output format** to print. Each
10-
one resolves independently, so you can save a default and still override it for
11-
a single command.
6+
The CLI has four settings: **endpoint**, **API key**, **workspace**, and **output
7+
format**. Each resolves independently, so a saved default can still be overridden
8+
for a single command.
129

1310
## Profiles
1411

15-
A profile is one identity plus one set of defaults. Profiles work like the AWS
16-
CLI, which is what lets a production account and a local stack sit side by side
17-
without re-authenticating.
18-
12+
A profile is one identity plus one set of defaults, in the style of the AWS CLI.
1913
Select one with `-P`, `--profile`, or `SIM_PROFILE`:
2014

2115
```bash
@@ -46,10 +40,8 @@ sim configure --set-output json
4640

4741
Run `sim configure` with no flags to print the profile's stored settings.
4842

49-
<Callout type="info">
50-
API keys are deliberately **not** settable through `sim configure`. Use
51-
[`sim login`](/cli/authentication), or `SIM_API_KEY` for CI.
52-
</Callout>
43+
API keys are not settable here. Use [`sim login`](/cli/authentication), or
44+
`SIM_API_KEY` for CI.
5345

5446
## Where settings come from
5547

@@ -62,11 +54,7 @@ Each setting resolves independently, and the first match wins:
6254
| 3 | `~/.sim/config` and `~/.sim/credentials`, for the selected profile |
6355
| 4 | Built-in default — `https://sim.ai` and `table` |
6456

65-
Because they resolve independently, a saved profile still supplies the workspace
66-
when you override only the output format.
67-
68-
`sim whoami` prints the winning source for each setting, which is usually the
69-
fastest way to explain a surprising result:
57+
`sim whoami` prints the winning source for each setting:
7058

7159
```bash
7260
sim whoami
@@ -98,11 +86,8 @@ api_key = sim_…
9886
api_key = sim_…
9987
```
10088

101-
<Callout type="info">
102-
The section-naming asymmetry — `[profile dev]` in config, `[dev]` in credentials
103-
— is the AWS convention, kept so existing habits and tooling carry over. The
104-
`default` profile is spelled `[default]` in both.
105-
</Callout>
89+
Section naming follows the AWS convention: `[profile dev]` in config, `[dev]` in
90+
credentials. The `default` profile is `[default]` in both.
10691

10792
## Environment variables
10893

@@ -122,25 +107,23 @@ filesystem at all.
122107

123108
## Choosing a workspace
124109

125-
Workspace-scoped commands need a workspace. Supply it per command, save it to
126-
the profile, or set it in the environment:
110+
Workspace-scoped commands need a workspace:
127111

128112
```bash
129113
sim tables list --workspace ws_other
130114
sim configure --set-workspace ws_abc123
131115
export SIM_WORKSPACE=ws_abc123
132116
```
133117

134-
Without one, the command fails and tells you how to set it. A few commands —
135-
`sim billing status`, `sim billing logs`, and `sim audit-logs list` — accept
118+
`sim billing status`, `sim billing logs`, and `sim audit-logs list` accept
136119
`--all-workspaces` to drop the filter instead. It cannot be combined with
137120
`--workspace`.
138121

139122
## Repairing a bad setting
140123

141-
An invalid `output` value fails with the list of accepted formats. Because a
142-
higher-priority source still wins, you can repair a profile without editing the
143-
file by hand:
124+
An invalid `output` value fails with the list of accepted formats. A
125+
higher-priority source still wins, so you can repair a profile without editing
126+
the file:
144127

145128
```bash
146129
sim --output table configure --set-output json

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

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ title: Sim CLI
33
description: Drive workflows, tables, files, knowledge bases, and logs from your shell
44
---
55

6-
import { Callout } from 'fumadocs-ui/components/callout'
76
import { Step, Steps } from 'fumadocs-ui/components/steps'
87
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
98

@@ -14,38 +13,31 @@ CI pipelines, and any other tool you already use.
1413

1514
## Install
1615

17-
<Tabs items={['npm', 'pnpm', 'bun', 'yarn']}>
16+
<Tabs items={['npm', 'pnpm', 'bun']}>
1817
<Tab value="npm">
1918
```bash
20-
npm install --global sim
19+
npm install -g sim
2120
```
2221
</Tab>
2322
<Tab value="pnpm">
2423
```bash
25-
pnpm add --global sim
24+
pnpm add -g sim
2625
```
2726
</Tab>
2827
<Tab value="bun">
2928
```bash
30-
bun add --global sim
31-
```
32-
</Tab>
33-
<Tab value="yarn">
34-
```bash
35-
yarn global add sim
29+
bun add -g sim
3630
```
3731
</Tab>
3832
</Tabs>
3933

40-
The CLI needs **Node.js 20 or newer**. Verify the install:
34+
Requires Node.js 20 or newer. Verify with `sim --version`.
4135

42-
```bash
43-
sim --version
44-
```
36+
To run it without installing, use `npx sim <command>`.
4537

46-
Prefer using Sim as a library? See the [TypeScript](/api-reference/typescript)
47-
and [Python](/api-reference/python) SDKs, or call the
48-
[HTTP API](/api-reference/getting-started) directly.
38+
Using Sim as a library instead? See the [TypeScript](/api-reference/typescript)
39+
and [Python](/api-reference/python) SDKs, or the
40+
[HTTP API](/api-reference/getting-started).
4941

5042
## Your first command
5143

@@ -58,10 +50,9 @@ and [Python](/api-reference/python) SDKs, or call the
5850
sim login
5951
```
6052

61-
The terminal prints a pairing code and a URL. Approve it in the browser, pick a
62-
workspace, and the key comes back over the CLI's own connection. Nothing
63-
redeemable crosses the browser leg and there is no loopback listener, so this
64-
works over SSH and inside containers.
53+
The terminal prints a pairing code and a URL. Approve it in the browser and pick
54+
a workspace. There is no loopback listener, so this works over SSH and in
55+
containers.
6556

6657
See [Authentication](/cli/authentication) for CI keys, multiple accounts, and
6758
self-hosted deployments.

0 commit comments

Comments
 (0)