22name : objectstack-ui
33description : >
44 Author ObjectStack UI metadata — Views (list/form/kanban/calendar/gantt),
5- Apps (navigation), Pages, Dashboards, Reports, Charts, Actions. Use when
5+ Apps (navigation), Pages, Dashboards, Reports, Charts, Actions, and
6+ package Docs (`src/docs/*.md`). Use when
67 the user is adding `*.view.ts` / `*.app.ts` / `*.dashboard.ts` /
7- `*.action.ts` files or designing a Studio-rendered UI surface, including
8+ `*.action.ts` / `src/docs/*.md` files or designing a Studio-rendered UI
9+ surface, including
810 dataset-bound dashboard/report widgets. Do not use for: data schema (see
911 objectstack-data), interactive screen flows /
1012 wizards (those are `*.flow.ts` with `type: 'screen'` — see
@@ -18,7 +20,7 @@ metadata:
1820 author : objectstack-ai
1921 version : " 1.1"
2022 domain : ui
21- tags : view, app, page, dashboard, report, chart, action, widget
23+ tags : view, app, page, dashboard, report, chart, action, widget, doc
2224---
2325
2426# UI Design — ObjectStack UI Protocol
@@ -37,6 +39,8 @@ App navigation, Dashboards, Reports, and Actions.
3739- You need a ** dashboard** with widget grids.
3840- You are adding ** reports** (tabular, summary, matrix, chart).
3941- You are configuring ** actions** (buttons, URL jumps, screen flows).
42+ - You are writing ** package documentation** (` src/docs/*.md ` ) that ships
43+ with the package and renders at ` /docs/<name> ` .
4044
4145---
4246
@@ -616,6 +620,90 @@ export const LeadDetailPage: Page = {
616620
617621---
618622
623+ ## Docs — Package Documentation (ADR-0046)
624+
625+ A ** Doc** is a page of package documentation shipped * as metadata* . You
626+ author plain Markdown in a flat ` src/docs/ ` directory; ` os build `
627+ compiles each ` *.md ` into a ` doc ` item that travels inside the package
628+ artifact and renders in the console at ` /docs/<name> ` . Docs are also the
629+ grounding the AI assistant reads about a package.
630+
631+ ```
632+ src/docs/
633+ crm_index.md → doc "crm_index" → /docs/crm_index
634+ crm_user_guide.md → doc "crm_user_guide" → /docs/crm_user_guide
635+ ```
636+
637+ ### Authoring rules (each enforced by ` os build ` )
638+
639+ 1 . ** Flat directory.** Every ` .md ` lives directly in ` src/docs/ ` ;
640+ subdirectories are a build error. Flatness is what keeps links stable
641+ — a reference resolves by basename, never by path.
642+ 2 . ** Namespace-prefixed filename.** The filename stem becomes the doc
643+ ` name ` (` ^[a-z][a-z0-9_]*$ ` ) and must start with the package namespace
644+ (` crm_… ` ). Names share one flat, instance-global space with the URL, so
645+ a bare ` user_guide ` would collide across packages and fail at install
646+ (ADR-0048).
647+ 3 . ** Title** resolves: frontmatter ` title: ` → first ` # ` heading → ` name ` .
648+ 4 . ** Pure Markdown.** CommonMark + GFM only, plus heading anchors, fenced
649+ code highlighting, and GitHub alerts (` > [!NOTE] ` , ` > [!WARNING] ` , …).
650+ ** MDX and image references are rejected at build time** — docs are
651+ publisher content rendered inside the platform (no authored code across
652+ the trust boundary; images await a content-addressed asset service).
653+ 5 . ** Cross-references** use plain relative links — ` [overview](./crm_index.md) ` .
654+ The console rewrites ` *.md ` → ` /docs/<target> ` (anchors preserved);
655+ broken same-package links fail the build.
656+
657+ ### Routing model — platform-level viewer, opt-in entry
658+
659+ The viewer is ** platform-level** : one global ` /docs/<name> ` route
660+ resolves any doc regardless of which app you came from. The URL is
661+ ** single-coordinate** — no package or app prefix — so a doc has exactly
662+ one URL. Do ** not** design per-app or per-package doc URLs; that gives one
663+ doc many addresses and breaks cross-references.
664+
665+ To surface a doc inside an app, add a navigation item that ** links into**
666+ that global URL. There is no dedicated ` doc ` nav-item type yet, so use a
667+ ` url ` item pointing at ` /docs/<name> ` :
668+
669+ ``` typescript
670+ navigation : [
671+ { id: ' nav_help' , type: ' url' , url: ' /docs/crm_user_guide' ,
672+ label: ' User Guide' , icon: ' book-open' },
673+ ]
674+ ```
675+
676+ A platform-level "Documentation" portal (browse/search all docs by
677+ package) is a later, additive concern — author-side, nothing to model now.
678+
679+ > ** Dynamic content.** Don't try to embed a live component (a flow
680+ > diagram, a record table) in a doc — there is no inline SDUI. Link to the
681+ > metadata by URL; the platform renders the live view, the doc points at it.
682+
683+ ### Example
684+
685+ ``` md
686+ ---
687+ title: CRM Overview
688+ ---
689+
690+ # CRM
691+
692+ Manages accounts, contacts, and opportunities.
693+
694+ > [ !TIP]
695+ > New here? Start with the [ user guide] ( ./crm_user_guide.md ) .
696+
697+ | Object | Purpose |
698+ | :--- | :--- |
699+ | ` crm_account ` | Companies and organizations |
700+ | ` crm_contact ` | People at an account |
701+ ```
702+
703+ In-repo reference: ` examples/app-showcase/src/docs/showcase_docs_guide.md ` .
704+
705+ ---
706+
619707## CRM UI Blueprint (Metadata-First)
620708
621709Use this CRM-style structure as the canonical UI assembly reference:
0 commit comments