Skip to content

Commit d7578f3

Browse files
committed
docs(cli): source-verify every command; fix os start auth story
Every command/subcommand/flag on the page is now verified against packages/cli/src/commands/; validate, info, compile, build, lint --score and --help were executed in a real 16.0.0-rc.1 consumer app and the printed samples updated to match actual output. - os start: the page claimed auth is silently skipped without a secret — reality is --auth-secret > OS_AUTH_SECRET > an auto-generated secret persisted at <home>/auth-secret, so auth works out of the box (start.ts readOrCreateAuthSecret); documented the full artifact resolution chain incl. config auto-compile and the empty-kernel fallback, and the missing --home flag. - Replaced the monorepo-internal '../objectui Vite server' Console note with the consumer reality (prebuilt bundle served at /_console/). - os compile / os info samples regenerated from real runs; os dev gains --fresh/--seed-admin rows + the persistent dev-DB note and the seeded admin / MCP endpoint mention; added the missing os build alias and an os lint section (--score/--fix/--json); serve auth tier note gains the dev-fallback-secret parenthetical. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Kj2MJEPXoUXC4LiC3XYJc
1 parent fd00ad9 commit d7578f3

1 file changed

Lines changed: 60 additions & 26 deletions

File tree

  • content/docs/getting-started

content/docs/getting-started/cli.mdx

Lines changed: 60 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ os generate flow onboarding # Add an automation flow
4242
os dev --ui
4343
```
4444

45-
Open [http://localhost:3000/_console/](http://localhost:3000/_console/) — you'll see the Console UI with a data browser, metadata explorer, and API documentation.
45+
Open [http://localhost:3000/_console/](http://localhost:3000/_console/) — you'll see the Console UI with a data browser, metadata explorer, and API documentation. Sign in with the seeded dev admin (`admin@objectos.ai` / `admin123`) — `os dev` provisions it automatically on an empty database. The boot banner also prints the app's MCP endpoint (`/api/v1/mcp`) so a coding agent can connect to the running app.
4646

4747
### Validate & Build
4848

@@ -138,8 +138,14 @@ os dev --database file:./data/test.db --auth-secret $(openssl rand -hex 32)
138138
| `-p, --port <n>` | `OS_PORT` / `PORT` | Listen port (default `3000`). In dev a busy port auto-hops to the next free one; the banner shows the actual port. |
139139
| `--ui` || Force Console UI on (already on by default in dev) |
140140
| `--compile` || Force compiling `objectstack.config.ts``dist/objectstack.json` before starting (auto when the artifact is missing; ignored with `--artifact`) |
141+
| `--fresh` || Ephemeral `OS_HOME` in the OS tempdir (clean DB, uploads, storage), auto-deleted on exit; implies `--seed-admin` |
142+
| `--seed-admin` / `--no-seed-admin` || Seed a dev admin (`admin@objectos.ai` / `admin123`) on an empty DB — default on; override with `--admin-email` / `--admin-password` |
141143
| `-v, --verbose` || Verbose output |
142144

145+
By default `os dev` keeps your data between restarts in a project-local SQLite
146+
file at `.objectstack/data/dev.db` (created on first run). Pass `--database`,
147+
set `OS_DATABASE_URL`, or use `--fresh` for a throwaway run.
148+
143149
With a file-backed SQLite database, dev also provisions a sibling
144150
`<db>.telemetry.<ext>` file registered as the `telemetry` datasource —
145151
lifecycle-classed system data (activity streams, job runs, notifications,
@@ -194,7 +200,8 @@ only gate the **automatic** registration of optional plugins.
194200

195201
The `auth` tier requires `OS_AUTH_SECRET` to be set; otherwise `AuthPlugin`
196202
is skipped with a yellow warning and the `/api/v1/auth/*` endpoints will
197-
return 404. To take full control, set `tiers` on the stack config:
203+
return 404. (In `--dev` mode the CLI falls back to an insecure local secret so
204+
login works out of the box.) To take full control, set `tiers` on the stack config:
198205

199206
```typescript
200207
import { defineStack } from '@objectstack/spec';
@@ -250,17 +257,19 @@ exploration, package management, and runtime metadata diagnostics.
250257
└─────────────────────────────────────────┘
251258
```
252259

253-
In this framework repo the prebuilt console bundle is served at `/_console/`.
254-
For source-level Console UI work, run the sibling `../objectui` Vite server and
255-
point it at a backend on port 3000.
260+
The prebuilt Console bundle ships with the framework packages and is served at
261+
`/_console/` — no separate frontend install or build step is needed.
256262

257263
### Production
258264

259265
#### `os start`
260266

261267
Boots a production server **directly from a compiled `objectstack.json` artifact** — no
262268
`objectstack.config.ts` required. This is the canonical "deploy a built ObjectStack app"
263-
command: hand a server one JSON file (or a URL pointing at one) and it runs.
269+
command: hand a server one JSON file (or a URL pointing at one) and it runs. When the cwd
270+
*does* contain an `objectstack.config.ts` and no artifact exists yet, `os start`
271+
auto-compiles it first; with no config and no artifact at all it boots an **empty kernel**
272+
with the Console + marketplace, so you can install apps interactively.
264273

265274
```bash
266275
# Quick start — load ./dist/objectstack.json with sqlite at file:<home>/data/objectstack.db
@@ -297,7 +306,8 @@ os start
297306
| `-d, --database <url>` | `OS_DATABASE_URL` | `file:…` / `libsql://` / `postgres://` / `mongodb://` / `memory://` |
298307
| `--database-driver <kind>` | `OS_DATABASE_DRIVER` | Force `sqlite` \| `turso` \| `postgres` \| `mongodb` \| `memory` when the URL is ambiguous |
299308
| `--database-auth-token <token>` | `OS_DATABASE_AUTH_TOKEN` | Auth token for libsql/Turso |
300-
| `--auth-secret <secret>` | `OS_AUTH_SECRET` | Secret for `@objectstack/plugin-auth`; without it `/api/v1/auth/*` is skipped (server still runs) |
309+
| `--auth-secret <secret>` | `OS_AUTH_SECRET` / `AUTH_SECRET` | Secret for `@objectstack/plugin-auth`. If neither the flag nor the env var is set, `os start` **auto-generates one** and persists it at `<home>/auth-secret` |
310+
| `--home <dir>` | `OS_HOME` | Home directory for persistent state (default `<cwd>/.objectstack` when an `objectstack.config.ts` is present, otherwise `~/.objectstack`) |
301311
| `--environment-id <id>` | `OS_ENVIRONMENT_ID` | Environment identifier (default `env_local`) |
302312
| `-p, --port <port>` | `OS_PORT` / `PORT` | Listen port (default `3000`). **Production fails loudly if the port is busy** — see note below. |
303313
| `--ui` / `--no-ui` || Mount the Console portal at `/_console/`. Enabled by default (so you can install marketplace apps); pass `--no-ui` to disable it. |
@@ -310,7 +320,7 @@ os start
310320
> (CORS). **Pin the port explicitly** (`OS_PORT=8080 os start`) and keep
311321
> `OS_AUTH_URL` / `OS_TRUSTED_ORIGINS` in sync when you change it.
312322
313-
**Resolution priority (artifact):** `--artifact` > `OS_ARTIFACT_PATH` > `<cwd>/dist/objectstack.json`.
323+
**Resolution priority (artifact):** `--artifact` > `OS_ARTIFACT_PATH` > `<cwd>/dist/objectstack.json` > `<home>/dist/objectstack.json` > auto-compile from `objectstack.config.ts` (when present) > empty kernel.
314324
**Resolution priority (database):** `--database` > `OS_DATABASE_URL` > `DATABASE_URL` (legacy) > `file:<home>/data/objectstack.db`.
315325

316326
**What it boots:**
@@ -320,7 +330,11 @@ os start
320330
- Runs standalone boot mode with one active environment.
321331

322332
**Authentication:**
323-
The `auth` capability is auto-loaded only when both (1) the artifact declares `requires: [..., 'auth']` **and** (2) a secret is provided via `--auth-secret` or `OS_AUTH_SECRET`. Without a secret, `AuthPlugin` is **silently skipped with a warning** — the server still boots and serves data/REST routes, only `/api/v1/auth/*` (login/register) is omitted. This is intentional: `os start` is happy to run an unauthenticated, internal-network deployment.
333+
`os start` always resolves an auth secret — `--auth-secret` > `OS_AUTH_SECRET` /
334+
`AUTH_SECRET` env > a secret **auto-generated and persisted** at `<home>/auth-secret`
335+
on first run — so `/api/v1/auth/*` (login/register) and the Console's login flow work
336+
out of the box, without any manual secret provisioning. Set the env var (or flag)
337+
explicitly when you deploy across multiple nodes or want to rotate the secret.
324338

325339
<Callout type="info">
326340
**`os start` vs `os serve`:** `os serve` boots from `objectstack.config.ts` (TypeScript source).
@@ -335,6 +349,7 @@ shape they accept. See [Source vs Artifact](#source-vs-artifact) below.
335349
| Command | Description |
336350
|---------|-------------|
337351
| `os compile [config]` | Compile configuration to a JSON artifact (`dist/objectstack.json`) |
352+
| `os build [config]` | Alias for `os compile` (scaffolded projects wire it as `npm run build`) |
338353
| `os validate [config]` | Validate schema, CEL predicates, and widget bindings — the same gates as `os compile`/`os build`, no artifact emitted |
339354
| `os info [config]` | Display metadata summary (objects, fields, apps, agents, etc.) |
340355

@@ -358,17 +373,24 @@ os compile --json # JSON output for CI pipelines
358373
────────────────────────────────────────
359374
→ Loading configuration...
360375
Config: objectstack.config.ts
361-
Load time: 104ms
376+
Load time: 57ms
377+
→ Normalizing stack definition...
378+
→ Lowering inline handlers...
362379
→ Validating protocol compliance...
380+
→ Validating expressions (ADR-0032)...
381+
→ Checking dashboard widget bindings (ADR-0021)...
382+
→ Checking SDUI styling (ADR-0065)...
383+
→ Checking security posture (ADR-0090 D7)...
384+
→ Collecting package docs (ADR-0046)...
363385
→ Writing artifact...
364386
365-
✓ Build complete (312ms)
387+
✓ Build complete (74ms)
366388
367-
Data: 10 Objects 217 Fields
368-
UI: 1 Apps 3 Dashboards 8 Reports 10 Actions
369-
Logic: 5 Flows 5 Agents 2 APIs
389+
Data: 2 Objects 6 Fields
390+
UI: 1 Views 1 Actions
391+
Runtime: 3 plugins
370392
371-
Artifact: dist/objectstack.json (48.2 KB)
393+
Artifact: dist/objectstack.json (7.6 KB)
372394
```
373395

374396
The resulting `dist/objectstack.json` is a **portable, self-describing deployment unit**
@@ -434,21 +456,21 @@ os info --json # JSON output for tooling
434456
◆ Info
435457
────────────────────────────────────────
436458
437-
Enterprise CRM v3.0.0
438-
com.example.crm
439-
Namespace: crm
440-
Type: app
459+
My App v0.1.0
460+
my-app
461+
Minimal ObjectStack environment — a clean slate for building.
462+
Namespace: my_app
463+
Type: app
441464
442-
Data: 10 Objects 217 Fields
443-
UI: 1 Apps 3 Dashboards 8 Reports 10 Actions
444-
Logic: 5 Flows 5 Agents 2 APIs
465+
Data: 2 Objects 6 Fields
466+
UI: 1 Views 1 Actions
467+
Runtime: 3 plugins
445468
446469
Objects:
447-
account (16 fields, user) — Account
448-
contact (24 fields, user) — Contact
449-
...
470+
my_app_note (2 fields, user) — Note
471+
my_app_ticket (4 fields, user) — Ticket
450472
451-
Loaded in 90ms
473+
Loaded in 59ms
452474
```
453475

454476
### Schema migrations
@@ -552,9 +574,21 @@ os create example my-app # Create examples/my-app
552574

553575
| Command | Description |
554576
|---------|-------------|
577+
| `os lint [config]` | Check metadata for style and convention issues (beyond `validate`'s hard gates) |
555578
| `os test [files]` | Run Quality Protocol test scenarios against a running server |
556579
| `os doctor` | Check development environment health |
557580

581+
#### `os lint`
582+
583+
Style and convention checks on top of `os validate` — naming, labels, translation coverage — with a 0-100 quality score:
584+
585+
```bash
586+
os lint # Style / convention checks
587+
os lint --score # Append a 0-100 metadata quality score (letter-graded)
588+
os lint --fix # Show what would be fixed (dry-run)
589+
os lint --json # JSON output for CI
590+
```
591+
558592
#### `os test`
559593

560594
Runs Quality Protocol test scenarios (JSON-based BDD) against a running ObjectStack server.

0 commit comments

Comments
 (0)