Skip to content

Commit 1a4f079

Browse files
xuyushun441-sysos-zhuangclaude
authored
feat(ADR-0046): seed Setup & Studio package docs so the docs hub isn't empty (#1845)
A bare install shipped no first-party `doc` metadata, so `/_console/docs` opened empty and ADR-0046 had no reference implementation. Seed one short overview per built-in app, registered inline on each app package's `manifest.register({ docs })` (the TS-first path DocSchema blesses) so they group under Setup and Studio in the hub. - @objectstack/setup: setup_overview (users/auth, roles & permissions, sharing) - @objectstack/studio: studio_overview (metadata-first, draft/overlay precedence per ADR-0005/0033, publish vs deploy) Documents the invisible concepts only (HotCRM principle), links to https://docs.objectstack.ai for depth. No framework change needed — code packages register docs inline, not via os build flat-file collection. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c71d0c4 commit 1a4f079

5 files changed

Lines changed: 155 additions & 1 deletion

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
"@objectstack/setup": patch
3+
"@objectstack/studio": patch
4+
---
5+
6+
feat(ADR-0046): seed first-party package docs for the Setup and Studio apps
7+
8+
A fresh platform install shipped **no** first-party `doc` metadata, so the
9+
in-product documentation hub (`/_console/docs`) opened completely empty and the
10+
ADR-0046 feature had zero reference implementation. This seeds a deliberately
11+
minimal first version — one short overview per built-in app — so the hub is
12+
non-empty out of the box and there is a worked example to copy.
13+
14+
- `@objectstack/setup` registers `setup_overview` (for administrators: users &
15+
authentication, the roles & permissions model, and record visibility/sharing).
16+
- `@objectstack/studio` registers `studio_overview` (for builders: the
17+
metadata-first model, the invisible draft/overlay precedence rule per
18+
ADR-0005/ADR-0033, and publish vs deploy).
19+
20+
Both follow the HotCRM principle — document the *invisible* business logic, not
21+
what the UI already shows — and link to <https://docs.objectstack.ai> for depth.
22+
23+
Mechanism note: these are TS-first code packages built by `tsup`, not user apps
24+
built by `os build`, so they do **not** go through the flat `src/docs/*.md`
25+
collection + lint. The docs are declared inline as `Doc` items on each package's
26+
`manifest.register({ docs })` call — the path `DocSchema` explicitly blesses for
27+
TS-first stacks. They register under their owning package id, so the docs hub
28+
groups them under Setup and Studio respectively. No framework change was needed.

packages/apps/setup/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import { SETUP_APP, SETUP_NAV_CONTRIBUTIONS } from '@objectstack/platform-objects/apps';
1919

20+
import { SETUP_OVERVIEW_DOC } from './setup-overview.doc.js';
21+
2022
export const SETUP_APP_PACKAGE_ID = 'com.objectstack.setup';
2123
export const SETUP_APP_NAMESPACE = 'setup';
2224
export const SETUP_APP_VERSION = '9.3.0';
@@ -56,6 +58,8 @@ export class SetupAppPlugin {
5658
...setupAppManifestHeader,
5759
apps: [SETUP_APP],
5860
navigationContributions: SETUP_NAV_CONTRIBUTIONS,
61+
// ADR-0046 package docs — grouped under "Setup" at /_console/docs.
62+
docs: [SETUP_OVERVIEW_DOC],
5963
});
6064
}
6165
}
@@ -66,3 +70,4 @@ export function createSetupAppPlugin(): SetupAppPlugin {
6670
}
6771

6872
export { SETUP_APP, SETUP_NAV_CONTRIBUTIONS };
73+
export { SETUP_OVERVIEW_DOC };
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { Doc } from '@objectstack/spec/system';
4+
5+
/**
6+
* Setup app overview doc (ADR-0046), registered in this package's manifest so
7+
* it groups under "Setup" in the `/_console/docs` index.
8+
*
9+
* Authored inline rather than as a flat `src/docs/*.md` file because this is a
10+
* TS-first code package built by tsup, not a user app built by `os build` —
11+
* `defineStack({ docs })` / manifest `docs[]` is the supported path for those
12+
* (see `DocSchema` in `@objectstack/spec/system`). The `content` below is plain
13+
* CommonMark + GFM with no images/MDX, per ADR-0046 §3.4.
14+
*
15+
* Principle (from the HotCRM reference docs): document the *invisible* concepts,
16+
* not what the Setup UI already shows on screen.
17+
*/
18+
export const SETUP_OVERVIEW_DOC: Doc = {
19+
name: 'setup_overview',
20+
label: 'Setup overview',
21+
description: 'Orientation for administrators: users, roles & permissions, and record visibility.',
22+
content: `# Setup overview
23+
24+
Setup is the administrator app for the platform. Its screens are mostly
25+
self-explanatory — this page covers the concepts behind them that the UI does
26+
not make obvious. For the full reference, see <https://docs.objectstack.ai>.
27+
28+
## Users & authentication
29+
30+
Every person who signs in is a \`sys_user\` record. Authentication (passwords,
31+
SSO, API keys, sessions) is handled by the platform's auth layer, so creating a
32+
user here grants *identity*, not access — what they can do is decided entirely
33+
by the roles and permissions assigned to them. Deactivating a user revokes
34+
sign-in without deleting their records, preserving ownership and history.
35+
36+
## Roles & permissions
37+
38+
Permission sets define *what* a user can do (which objects and fields they can
39+
read or write, which apps they can open); roles place a user in the
40+
organization hierarchy and drive *which records* they can reach. A user's
41+
effective access is the union of all permission sets granted to them — access is
42+
additive, so you grant capability rather than taking it away.
43+
44+
## Record visibility (sharing)
45+
46+
Object-level permissions decide whether a user can touch a *kind* of record;
47+
sharing decides *which* rows of that kind they actually see. Visibility starts
48+
from an org-wide default (private or public) and is then widened by the role
49+
hierarchy and explicit sharing rules — it is never silently narrowed. When a
50+
user "can't see a record they should," the cause is almost always sharing, not
51+
object permissions.
52+
53+
See <https://docs.objectstack.ai> for the full security model.
54+
`,
55+
};

packages/apps/studio/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
import { STUDIO_APP } from '@objectstack/platform-objects/apps';
2323

24+
import { STUDIO_OVERVIEW_DOC } from './studio-overview.doc.js';
25+
2426
export const STUDIO_APP_PACKAGE_ID = 'com.objectstack.studio';
2527
export const STUDIO_APP_NAMESPACE = 'studio';
2628
export const STUDIO_APP_VERSION = '9.3.0';
@@ -59,7 +61,12 @@ export class StudioAppPlugin {
5961
async start(ctx: any): Promise<void> {
6062
const manifest = ctx?.getService?.('manifest');
6163
if (!manifest || typeof manifest.register !== 'function') return;
62-
manifest.register({ ...studioAppManifestHeader, apps: [STUDIO_APP] });
64+
manifest.register({
65+
...studioAppManifestHeader,
66+
apps: [STUDIO_APP],
67+
// ADR-0046 package docs — grouped under "Studio" at /_console/docs.
68+
docs: [STUDIO_OVERVIEW_DOC],
69+
});
6370
}
6471
}
6572

@@ -69,3 +76,4 @@ export function createStudioAppPlugin(): StudioAppPlugin {
6976
}
7077

7178
export { STUDIO_APP };
79+
export { STUDIO_OVERVIEW_DOC };
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { Doc } from '@objectstack/spec/system';
4+
5+
/**
6+
* Studio app overview doc (ADR-0046), registered in this package's manifest so
7+
* it groups under "Studio" in the `/_console/docs` index.
8+
*
9+
* Authored inline rather than as a flat `src/docs/*.md` file because this is a
10+
* TS-first code package built by tsup, not a user app built by `os build` —
11+
* `defineStack({ docs })` / manifest `docs[]` is the supported path for those
12+
* (see `DocSchema` in `@objectstack/spec/system`). The `content` below is plain
13+
* CommonMark + GFM with no images/MDX, per ADR-0046 §3.4.
14+
*
15+
* Principle (from the HotCRM reference docs): document the *invisible*
16+
* business logic, not what the Studio UI already shows on screen.
17+
*/
18+
export const STUDIO_OVERVIEW_DOC: Doc = {
19+
name: 'studio_overview',
20+
label: 'Studio overview',
21+
description: 'Orientation for builders: the metadata-first model, overlay precedence, and publishing.',
22+
content: `# Studio overview
23+
24+
Studio is the builder app — the workbench for shaping the platform's
25+
*metadata*: objects, fields, views, flows, agents, and the rest. Most of its
26+
screens are self-explanatory; this page covers the one rule that is not visible
27+
on screen but governs everything you do here. For the full reference, see
28+
<https://docs.objectstack.ai>.
29+
30+
## Metadata-first
31+
32+
In Studio you do not edit a running database — you edit *definitions*. Every
33+
object, field, and view is a metadata record, and the live application is
34+
generated from that metadata. This is why a change in Studio can reshape the UI
35+
and the API at once: you are changing the model, not patching a screen.
36+
37+
## Edits are overlays (the invisible rule)
38+
39+
Your changes do not mutate the metadata shipped by a package in place. Studio
40+
writes an **overlay** on top of the base definition, and the runtime resolves
41+
the two by precedence: an unpublished **draft** wins for you while you work, a
42+
published **tenant overlay** wins over the package's baseline, and the package
43+
baseline is the fallback (ADR-0005, ADR-0033). The practical consequence: the
44+
base definition is never destroyed, so an overlay can always be reverted to
45+
recover the original — and a field that "won't change" is usually being shadowed
46+
by a higher-precedence layer.
47+
48+
## Publishing & deploying
49+
50+
A draft is visible only to you until you **publish** it, which promotes the
51+
overlay so the rest of the tenant sees it. Moving changes between environments
52+
(for example dev → production) is a separate **deploy** step, not an automatic
53+
side effect of publishing — keeping the two distinct is what lets you build
54+
safely in one environment before shipping.
55+
56+
See <https://docs.objectstack.ai> for drafts, overlays, and deployment in depth.
57+
`,
58+
};

0 commit comments

Comments
 (0)