Skip to content

Commit 3977d4a

Browse files
agviegasclaude
andcommitted
feat(template): thin app template to UIManager built-ins + AI quickstart + beta-only gate
Re-sync the `app` scaffold to the current thin bim-viewer: the side panels (tree, properties, files/models-list, data-table, objects, settings) and the viewer toolbar are now platform built-ins composed via `<top-*>` web components, so the scaffold drops their in-repo setups (−8.3k lines). Loaders stay app-side (the .3tz reality-capture loader is registered into <top-models-list>). - main.ts: compose built-ins; strip the dev-only :4100 local-bundle block. - create: require --beta for every template; scaffolding without it errors "Non-beta projects are not available yet" (public engine lands in October). - docs: add docs/ai-quickstart.md — a single URL that lets an AI go from nothing to a running app using only a platform token (no npm token); link it from the README; update create.md for the beta-only requirement. Validated end-to-end: `create --beta` → `vite build` (87 modules, clean). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eeb39ed commit 3977d4a

25 files changed

Lines changed: 208 additions & 8304 deletions

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
Client library and CLI for building BIM apps and cloud components on [That Open Platform](https://platform.thatopen.com). Apps run inside the platform's browser environment; cloud components run server-side and can be triggered from any app.
44

5+
> **Using an AI assistant?** Point it at this single file and it can take you from nothing to a running app:
6+
> [`docs/ai-quickstart.md`](https://raw.githubusercontent.com/ThatOpen/engine_services/main/docs/ai-quickstart.md)
7+
58
## Quick Start
69

710
### 1. Install the CLI

docs/ai-quickstart.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# That Open Platform — AI Quick Start (zero to a running app)
2+
3+
You are an AI assistant. A user pointed you at this URL so you can scaffold and run a
4+
**BIM app** on the [That Open Platform](https://platform.thatopen.com) from scratch, using
5+
`@thatopen/services` (the `thatopen` CLI + client library). Follow the steps below in order.
6+
7+
> The only secret you need is a **platform API token****not** an npm token. The CLI
8+
> derives private beta-registry access from the platform token automatically.
9+
10+
---
11+
12+
## 0. Prerequisites (check, don't assume)
13+
14+
- **Node.js ≥ 18** and **npm** — verify with `node -v`.
15+
- A **That Open Platform API token**. The user creates it themselves:
16+
**https://platform.thatopen.com/dashboard/data → API Tokens → create → copy.**
17+
Ask the user to paste it. **Never print it back, never write it into a file, never commit it.**
18+
19+
## 1. Install the CLI
20+
21+
```bash
22+
npm install -g @thatopen/services@latest
23+
```
24+
25+
## 2. Log in (do this BEFORE creating the project)
26+
27+
```bash
28+
thatopen login --token <platform-token>
29+
```
30+
31+
This validates the token and stores it in `~/.thatopen/config.json`. Login **must** come
32+
first: the next step's install pulls the private `@thatopen-platform/*-beta` packages, and
33+
`create` uses your logged-in token to write an authenticated `.npmrc` so that install can
34+
resolve them. No npm account or manual npm token is involved.
35+
36+
## 3. Scaffold a beta app
37+
38+
```bash
39+
thatopen create my-app --beta
40+
cd my-app
41+
```
42+
43+
`--beta` is required for now: the bundled viewer uses engine APIs that currently live only
44+
in the beta libraries (public engine support lands with the October release). `create`
45+
configures private beta access from your platform token and runs `npm install` for you.
46+
47+
## 4. Run it
48+
49+
```bash
50+
npm run dev
51+
```
52+
53+
This serves the app and opens it inside the platform. **You now have a complete, working
54+
viewer** — model loading, spatial tree, properties, measurement, sectioning, and more.
55+
56+
## 5. Then build — read the in-project agent guide
57+
58+
The scaffold is a real app, not a blank page. **Before changing anything**, open and follow:
59+
60+
```
61+
node_modules/@thatopen/services/resources/AGENTS.md
62+
```
63+
64+
(The scaffolded project's own `AGENTS.md` points here too.) It is the canonical guide: it
65+
indexes every platform built-in, the client API, the CLI, and the engine / UI example sets.
66+
Load those indexes before writing code. **All UI must be built with Lit + `@thatopen/ui`
67+
(`BUI`)** — consult the design system before writing any UI. Run the app first, then extend
68+
it; don't rebuild a viewer from scratch.
69+
70+
## 6. Publish (when ready)
71+
72+
```bash
73+
npm run publish
74+
```
75+
76+
Builds the app, zips it (`dist/bundle.zip`), and uploads a new version to the platform.
77+
78+
---
79+
80+
## Rules for you, the assistant
81+
82+
- **Platform token only.** Never introduce, request, or store an npm token.
83+
- **Never echo or persist the user's token.** It belongs only in `~/.thatopen/config.json` /
84+
`.npmrc`, both of which the CLI manages and git-ignores.
85+
- **Propose a short plan and get the user's OK** before changing files.
86+
- The scaffold already works — **extend it, don't replace it.**

docs/cli/create.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ thatopen create . # scaffold into the current directory
1717
- `--template <template>`, `-t` — Template to use. Default: `app`.
1818
- `app` — Browser BIM app running inside the platform iframe.
1919
- `cloud-component` — Server-side component executed by the platform's cloud engine and consumed in apps and/or automations.
20-
- `--beta` — Use private beta engine libraries (`@thatopen-platform/*-beta`) instead of the public ones. Sets `beta: true` in `.thatopen` so `serve`, `local-server`, and `vite build` all resolve to beta packages automatically. Requires beta npm access configured.
20+
- `--beta` — Use private beta engine libraries (`@thatopen-platform/*-beta`) instead of the public ones. Sets `beta: true` in `.thatopen` so `serve`, `local-server`, and `vite build` all resolve to beta packages automatically. Requires beta npm access configured (handled automatically once you `thatopen login`).
21+
22+
> **`--beta` is currently required.** The templates depend on engine APIs that only exist in the beta libraries, so scaffolding without `--beta` errors out for now. Public (non-beta) support is coming with the October release.
2123
2224
**Examples:**
2325
```bash
24-
thatopen create my-app
25-
thatopen create my-app -t cloud-component
2626
thatopen create my-app --beta
27+
thatopen create my-app -t cloud-component --beta
2728
thatopen create . --beta
2829
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"access": "public"
1616
},
1717
"private": false,
18-
"version": "0.3.1",
18+
"version": "0.3.2",
1919
"main": "dist/index.cjs.js",
2020
"module": "dist/index.es.js",
2121
"types": "dist/index.d.ts",

src/cli/commands/create.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ export const createCommand = new Command('create')
3434
process.exit(1);
3535
}
3636

37-
// The app template (the full BIM viewer) currently depends on engine APIs
38-
// that only exist in the beta libraries. Until the public engine catches up
39-
// (October release), scaffolding the app without --beta would produce a
40-
// project that doesn't type-check or run — so require --beta explicitly.
41-
if (template === 'app' && !opts.beta) {
37+
// The templates currently depend on engine APIs that only exist in the beta
38+
// libraries. Until the public engine catches up (October release),
39+
// scaffolding without --beta would produce a project that doesn't type-check
40+
// or run — so require --beta explicitly for every template.
41+
if (!opts.beta) {
4242
console.error(
43-
'The "app" template currently requires the beta engine libraries.\n\n' +
43+
'Non-beta projects are not available yet.\n\n' +
4444
` thatopen create ${projectName} --beta\n\n` +
45-
'Public (non-beta) engine support is coming with the October release.',
45+
'The templates currently require the beta engine libraries. Public ' +
46+
'(non-beta) engine support is coming with the October release.',
4647
);
4748
process.exit(1);
4849
}

0 commit comments

Comments
 (0)