Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/docs/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { defineI18nUI } from 'fumadocs-ui/i18n'
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
import { RootProvider } from 'fumadocs-ui/provider/next'
import { Geist_Mono, Inter } from 'next/font/google'
import Script from 'next/script'
import { ThemeProvider } from 'next-themes'
import {
SidebarFolder,
Expand Down Expand Up @@ -92,10 +91,9 @@ export default async function Layout({ children, params }: LayoutProps) {
suppressHydrationWarning
>
<head>
<Script
<script
id='website-json-ld'
type='application/ld+json'
strategy='beforeInteractive'
dangerouslySetInnerHTML={{ __html: serializeJsonLd(structuredData) }}
/>
</head>
Expand Down
6 changes: 0 additions & 6 deletions apps/docs/app/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,6 @@ html #nd-sidebar button:not([aria-label*="ollapse"]):not([aria-label*="xpand"])
padding: 0 !important;
}

/* The first group sits flush against the top padding — it has nothing to be
separated from. */
[data-separator]:not([data-separator] ~ [data-separator]) {
margin-top: 0;
}

/* Active state — aligned with platform --surface-active */
#nd-sidebar a[data-active="true"]:not(:has(span.font-mono)),
#nd-sidebar button[data-active="true"] {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/docs-layout/sidebar-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function SidebarFolder({ item, children }: { item: Folder; children: Reac
*/
export function SidebarSeparator({ item }: { item: Separator }) {
return (
<div data-separator className='mt-4 mb-1.5 px-2'>
<div data-separator className='mt-4 mb-1.5 px-2 first:mt-0'>
<p className='text-[var(--text-muted)] text-caption'>{item.name}</p>
</div>
)
Expand Down
7 changes: 3 additions & 4 deletions apps/docs/components/structured-data.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Script from 'next/script'
import { serializeJsonLd } from '@/lib/json-ld'
import { DOCS_BASE_URL } from '@/lib/urls'

Expand Down Expand Up @@ -103,15 +102,15 @@ export function StructuredData({

return (
<>
<Script
<script
id={`article-json-ld-${structuredDataId}`}
type='application/ld+json'
dangerouslySetInnerHTML={{
__html: serializeJsonLd(articleStructuredData),
}}
/>
{breadcrumbStructuredData && (
<Script
<script
id={`breadcrumb-json-ld-${structuredDataId}`}
type='application/ld+json'
dangerouslySetInnerHTML={{
Expand All @@ -120,7 +119,7 @@ export function StructuredData({
/>
)}
{(url === baseUrl || url === `${baseUrl}/`) && (
<Script
<script
id={`software-json-ld-${structuredDataId}`}
type='application/ld+json'
dangerouslySetInnerHTML={{
Expand Down
48 changes: 19 additions & 29 deletions apps/docs/content/docs/en/cli/authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ description: Sign in from the terminal, authenticate CI with an API key, and kee

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

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

## Signing in

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

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

<Callout type="warn">
Confirm the pairing code in your terminal matches the one the browser shows
before you approve. That check is what binds the approval to *your* terminal.
Confirm the pairing code in the browser matches the one in your terminal before
approving. That check is what binds the approval to your terminal.
</Callout>

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

### Picking a workspace

The approval page is where you choose the workspace — the terminal has no key
yet, so it cannot list them for you.

`sim login` issues a **personal** key. The workspace you pick becomes the
You choose the workspace on the approval page. `sim login` issues a **personal** key. The workspace you pick becomes the
profile's default `workspace`; it does **not** restrict the key to that
workspace. Target another workspace the key can reach with `--workspace`:

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

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

## Signing out

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

## Authenticating CI

Skip `sim login` entirely. Set the key and workspace in the environment and the
CLI never reads or writes a config file:
Set the key and workspace in the environment; the CLI never reads or writes a
config file:

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

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

### GitHub Actions

Expand All @@ -111,7 +102,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install --global sim
- run: npm install -g sim
- run: sim workflows run wf_7Yb2 --output json
env:
SIM_API_KEY: ${{ secrets.SIM_API_KEY }}
Expand All @@ -120,8 +111,7 @@ jobs:

## Several accounts at once

Each profile holds one identity and one set of defaults, so a production account
and a local stack can coexist without re-authenticating:
Each profile holds one identity and one set of defaults:

```bash
sim login --profile dev --endpoint http://localhost:3000
Expand All @@ -135,23 +125,23 @@ See [Configuration](/cli/configuration) for how profiles are stored and resolved

## Self-hosted and non-production deployments

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

```bash
sim login --profile local --endpoint http://localhost:3000
```

Save it so you do not have to repeat the flag:
Save it to avoid repeating the flag:

```bash
sim configure --set-endpoint http://localhost:3000 --profile local
```

## Where the key is stored

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

```ini title="~/.sim/credentials"
[default]
Expand Down
45 changes: 14 additions & 31 deletions apps/docs/content/docs/en/cli/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ title: Configuration
description: Profiles, config files, environment variables, and how each setting is resolved
---

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

The CLI has four settings: which **endpoint** to talk to, which **API key** to
use, which **workspace** to target, and which **output format** to print. Each
one resolves independently, so you can save a default and still override it for
a single command.
The CLI has four settings: **endpoint**, **API key**, **workspace**, and **output
format**. Each resolves independently, so a saved default can still be overridden
for a single command.

## Profiles

A profile is one identity plus one set of defaults. Profiles work like the AWS
CLI, which is what lets a production account and a local stack sit side by side
without re-authenticating.

A profile is one identity plus one set of defaults, in the style of the AWS CLI.
Select one with `-P`, `--profile`, or `SIM_PROFILE`:

```bash
Expand Down Expand Up @@ -46,10 +40,8 @@ sim configure --set-output json

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

<Callout type="info">
API keys are deliberately **not** settable through `sim configure`. Use
[`sim login`](/cli/authentication), or `SIM_API_KEY` for CI.
</Callout>
API keys are not settable here. Use [`sim login`](/cli/authentication), or
`SIM_API_KEY` for CI.

## Where settings come from

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

Because they resolve independently, a saved profile still supplies the workspace
when you override only the output format.

`sim whoami` prints the winning source for each setting, which is usually the
fastest way to explain a surprising result:
`sim whoami` prints the winning source for each setting:

```bash
sim whoami
Expand Down Expand Up @@ -98,11 +86,8 @@ api_key = sim_…
api_key = sim_…
```

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

## Environment variables

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

## Choosing a workspace

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

```bash
sim tables list --workspace ws_other
sim configure --set-workspace ws_abc123
export SIM_WORKSPACE=ws_abc123
```

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

## Repairing a bad setting

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

```bash
sim --output table configure --set-output json
Expand Down
33 changes: 12 additions & 21 deletions apps/docs/content/docs/en/cli/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: Sim CLI
description: Drive workflows, tables, files, knowledge bases, and logs from your shell
---

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

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

## Install

<Tabs items={['npm', 'pnpm', 'bun', 'yarn']}>
<Tabs items={['npm', 'pnpm', 'bun']}>
<Tab value="npm">
```bash
npm install --global sim
npm install -g sim
```
</Tab>
<Tab value="pnpm">
```bash
pnpm add --global sim
pnpm add -g sim
```
</Tab>
<Tab value="bun">
```bash
bun add --global sim
```
</Tab>
<Tab value="yarn">
```bash
yarn global add sim
bun add -g sim
```
</Tab>
</Tabs>

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

```bash
sim --version
```
To run it without installing, use `npx sim <command>`.

Prefer using Sim as a library? See the [TypeScript](/api-reference/typescript)
and [Python](/api-reference/python) SDKs, or call the
[HTTP API](/api-reference/getting-started) directly.
Using Sim as a library instead? See the [TypeScript](/api-reference/typescript)
Comment thread
waleedlatif1 marked this conversation as resolved.
and [Python](/api-reference/python) SDKs, or the
[HTTP API](/api-reference/getting-started).

## Your first command

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

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

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