@thatopen/services 0.3.16 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +62 -62
  2. package/dist/cli.js +4 -1
  3. package/dist/core/client.d.ts +1 -0
  4. package/dist/core/platform-client.d.ts +7 -0
  5. package/dist/index.cjs.js +2 -2
  6. package/dist/index.es.js +382 -370
  7. package/dist/vite-env.d.ts +1 -1
  8. package/docs/ai-quickstart.md +130 -130
  9. package/docs/cli/create.md +29 -29
  10. package/docs/cli/local-server.md +38 -38
  11. package/docs/cli/login.md +32 -32
  12. package/docs/cli/publish.md +31 -31
  13. package/docs/cli/run.md +26 -26
  14. package/docs/cli/serve.md +43 -43
  15. package/docs/cli/swap.md +30 -30
  16. package/docs/cloud/GaussianSplatConverter.md +43 -43
  17. package/docs/cloud/PointCloudConverter.md +53 -53
  18. package/docs/revit-collab-quickstart.md +256 -256
  19. package/package.json +95 -95
  20. package/resources/AGENTS.md +40 -40
  21. package/src/built-in/CDEManager/example.ts +214 -214
  22. package/src/built-in/CDEManager/examples/FileEditing/example.ts +226 -226
  23. package/src/built-in/CDEManager/examples/FileMoves/example.ts +186 -186
  24. package/src/built-in/CDEManager/examples/FileOperations/example.ts +295 -295
  25. package/src/built-in/CDEManager/examples/FileTransfers/example.ts +210 -210
  26. package/src/built-in/CDEManager/examples/FolderManagement/example.ts +230 -230
  27. package/src/built-in/CDEManager/examples/MetadataSchema/example.ts +230 -230
  28. package/src/built-in/CDEManager/examples/MetadataViews/example.ts +166 -166
  29. package/src/built-in/CDEManager/examples/ProjectConfig/example.ts +177 -177
  30. package/src/built-in/ClashesManager/example.ts +283 -283
  31. package/src/built-in/UIManager/src/app/example.ts +97 -97
  32. package/src/built-in/UIManager/src/app/examples/AppState/example.ts +140 -140
  33. package/src/built-in/UIManager/src/app/examples/Banner/example.ts +159 -159
  34. package/src/built-in/UIManager/src/app/examples/Contexts/example.ts +123 -123
  35. package/src/built-in/UIManager/src/app/examples/FileDrop/example.ts +124 -124
  36. package/src/built-in/UIManager/src/app/examples/FloatingLayout/example.ts +90 -90
  37. package/src/built-in/UIManager/src/app/examples/Modal/example.ts +163 -163
  38. package/src/built-in/UIManager/src/app/examples/Notifications/example.ts +133 -133
  39. package/src/built-in/UIManager/src/app/examples/Sidebar/example.ts +102 -102
  40. package/src/cli/templates/app/README.md +217 -217
  41. package/src/cli/templates/app/index.html +35 -35
  42. package/src/cli/templates/app/package.json +32 -32
  43. package/src/cli/templates/app/src/app.ts +37 -37
  44. package/src/cli/templates/app/src/assets/tool-placeholder.ts +50 -50
  45. package/src/cli/templates/app/src/bim-components/CloudRunner/index.ts +95 -95
  46. package/src/cli/templates/app/src/bim-components/CloudRunner/src/index.ts +1 -1
  47. package/src/cli/templates/app/src/bim-components/CloudRunner/src/types.ts +5 -5
  48. package/src/cli/templates/app/src/bim-components/index.ts +1 -1
  49. package/src/cli/templates/app/src/globals.ts +1 -1
  50. package/src/cli/templates/app/src/main.ts +199 -199
  51. package/src/cli/templates/app/src/setups/reality-capture/lib/hidden-tiles-plugin.ts +88 -88
  52. package/src/cli/templates/app/src/setups/reality-capture/lib/point-tile-plugin.ts +166 -166
  53. package/src/cli/templates/app/src/setups/reality-capture/lib/render-frame.ts +31 -31
  54. package/src/cli/templates/app/src/setups/reality-capture/lib/splat-tile-plugin.ts +51 -51
  55. package/src/cli/templates/app/src/setups/reality-capture-viewer.ts +1383 -1383
  56. package/src/cli/templates/app/src/ui-components/app-info-section/index.ts +26 -26
  57. package/src/cli/templates/app/src/ui-components/app-info-section/src/index.ts +1 -1
  58. package/src/cli/templates/app/src/ui-components/app-info-section/src/types.ts +15 -15
  59. package/src/cli/templates/app/src/ui-components/cloud-runner-section/index.ts +37 -37
  60. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/index.ts +1 -1
  61. package/src/cli/templates/app/src/ui-components/cloud-runner-section/src/types.ts +14 -14
  62. package/src/cli/templates/app/src/ui-components/index.ts +2 -2
  63. package/src/cli/templates/app/tsconfig.json +16 -16
  64. package/src/cli/templates/app/vite.config.js +57 -57
  65. package/src/cli/templates/cloud-component/README.md +205 -205
  66. package/src/cli/templates/cloud-component/_thatopen +5 -5
  67. package/src/cli/templates/cloud-component/declarations.json +4 -4
  68. package/src/cli/templates/cloud-component/package.json +21 -21
  69. package/src/cli/templates/cloud-component/src/main.ts +70 -70
  70. package/src/cli/templates/cloud-component/tsconfig.json +16 -16
  71. package/src/cli/templates/cloud-component/vite.config.js +46 -46
  72. package/src/cli/templates/shared/AGENTS.md +8 -8
  73. package/src/cli/templates/shared/CLAUDE.md +1 -1
  74. package/src/cli/templates/shared/_gitignore +5 -5
@@ -1,256 +1,256 @@
1
- # That Open — Revit Collaboration Quickstart (for AI assistants)
2
-
3
- You are an AI assistant. A user pointed you at this guide so you can set up or join
4
- **real‑time Revit collaboration** through the That Open platform. Follow the steps **in
5
- order**. Ask the user for anything you don't already have. **You may run the setup commands
6
- yourself** (install the CLI, install the add‑in, launch Revit) — do it, don't just tell the
7
- user to, *except* where a step says only the user can. Everything is driven by the
8
- `thatopen` CLI.
9
-
10
- ## What this does
11
- Multiple people work on **one shared Revit central model** using Revit's native
12
- worksharing. The central lives on the That Open platform. Each person has their own local;
13
- when they **sync**, their changes go up and their teammates' come down. All syncs are
14
- **queued**, so the central never conflicts or diverges.
15
-
16
- ## Rules (follow throughout)
17
- - **Never** print, echo, store, or commit the user's access token.
18
- - **Ask, don't assume.** Missing a project id, file path, or central name? Ask first.
19
- - **Use only the `thatopen` CLI** for platform actions. Don't call HTTP APIs by hand.
20
- - You may **install software and launch Revit** on the user's machine — briefly tell the
21
- user what you're about to run before you run it.
22
- - After each command, **check the output** before moving on.
23
-
24
- ---
25
-
26
- ## Step 0 — Ask what the user wants to do
27
- Ask the user:
28
- > "What would you like to do?
29
- > (A) **Share** a Revit model with my team for the first time.
30
- > (B) **Connect** to a shared central a teammate already uploaded.
31
- > (C) I **already have my local open** in Revit — just sync it."
32
-
33
- Then collect the inputs for their choice (ask now — you'll need them below):
34
-
35
- - **(A) Share:** the **absolute path** to the `.rvt` to share, and a short lowercase
36
- **name** for the shared central (e.g. `tower-central`). Also the platform **Project ID**
37
- (see below). The file may or may not already be a workshared central — you'll check that
38
- in Step 3; either way **the user's original file is never modified** (a copy is uploaded).
39
-
40
- - **(B) Connect:** ask the user to identify the existing central by **one** of:
41
- - the **project folder id** of the central — the `revit-<name>` folder inside the
42
- project's `bimterop` folder in the That Open dashboard (copy its id from the folder), **or**
43
- - the **local path** to the shared central on their PC, if they already have it
44
- (looks like `C:\ThatOpenShared\<project>\<name>\<file>.rvt`).
45
-
46
- (If they already have their local *open* in Revit, that's really case **(C)** — just sync.)
47
-
48
- - **(A) — Project ID:** find it in the That Open dashboard — open the project; the ID is in
49
- the project settings and the project URL. The user's token (Step 2) must belong to an
50
- account with access to this project, or platform calls fail with **403** (see
51
- Troubleshooting). For **(B)** the folder id / local path already encodes the project, so
52
- you don't need to ask the Project ID separately.
53
-
54
- - **(C):** nothing extra — Revit must have their local open.
55
-
56
- Do **not** ask for the access token yet (that's Step 2).
57
-
58
- ---
59
-
60
- ## Step 1 — Make sure the tools are ready (do this yourself)
61
- 1. **CLI.** Run:
62
- ```
63
- npm install -g @thatopen/services@latest
64
- ```
65
- Verify `thatopen --version` prints a version. (Needs Node.js 18+; if `node -v` fails,
66
- ask the user to install Node.js, then continue.)
67
-
68
- 2. **Revit + add‑in.** Run:
69
- ```
70
- thatopen revit status
71
- ```
72
- - Prints `"loaded": true` → the add‑in is running. Go to **Step 2**.
73
- - Errors **"The That Open Revit add‑in is not running"** → work through (a) then (b):
74
-
75
- **(a) Is Revit 2026 open?** If not, launch it (Windows):
76
- ```
77
- powershell -Command "Start-Process 'C:\Program Files\Autodesk\Revit 2026\Revit.exe'"
78
- ```
79
- Cold start can take 1–3 minutes. Wait, then re‑run `thatopen revit status`. If it now
80
- says `"loaded": true`, go to Step 2.
81
-
82
- **(b) Revit is open but status still errors → the add‑in isn't installed. Install it:**
83
- - The add‑in files ship in **this same folder** as this guide (`install.ps1`,
84
- `RevitFlowAddin.dll`, `RevitFlowCore.dll`, `revitflow.addin`). From this folder, run:
85
- ```
86
- powershell -ExecutionPolicy Bypass -File install.ps1
87
- ```
88
- *(If you don't have those files, download the plugin zip here, unzip it, then run
89
- `install.ps1` from the unzipped folder:
90
- https://drive.google.com/file/d/1HL_Ti7N_qN0Q-X7vNYOQst3yEgIY-xXO/view?usp=drive_link )*
91
- - **Restart Revit** so it loads the add‑in: close Revit, then launch it again with the
92
- `Start-Process` command above.
93
- - On the first launch after installing, Revit shows an **"unsigned add‑in"** prompt.
94
- **Only the user can click it — ask them to choose "Always Load".**
95
- - Re‑run `thatopen revit status` every ~10s until it prints `"loaded": true`.
96
-
97
- ---
98
-
99
- ## Step 2 — Log in
100
- The user needs a personal **access token** from the That Open platform. Ask them for it and
101
- tell them exactly where to get it:
102
-
103
- > "To log in I need your That Open **access token**. To create one:
104
- > 1. Open your That Open dashboard in a browser — **production:** https://platform.thatopen.com
105
- > · **dev:** https://dev.platform.thatopen.com (use the one that matches your team).
106
- > 2. Go to **Data → API Tokens**.
107
- > 3. Click **Create a new token** and **copy** it.
108
- > 4. Paste it here."
109
-
110
- **Never print, echo, or store the token.** Once the user pastes it, run:
111
- ```
112
- thatopen login --token <TOKEN>
113
- ```
114
- - **Production is the default.** For the **dev** environment, also add:
115
- `--api-url https://dev.platform.thatopen.com`
116
- - Success prints `Logged in successfully…`. If it fails with **"Unauthorized"**, the token
117
- is invalid or for the other environment — see **Troubleshooting**, then ask for a fresh
118
- token and retry.
119
-
120
- ---
121
-
122
- ## Step 3 — Do the action
123
-
124
- ### (A) Share a model — `inspect`, then `publish-central`
125
- First check whether the file is already a workshared central:
126
- ```
127
- thatopen revit inspect --file "<FILE>"
128
- ```
129
- - **`"isCentral": true`** → it's already a central. Tell the user: *"This is already a
130
- central; I'll upload a copy to the shared location — your original file won't be touched."*
131
- Then publish (no `--convert` needed):
132
- ```
133
- thatopen revit publish-central --project <PROJECT> --doc <DOC> --file "<FILE>"
134
- ```
135
- - **`"isCentral": false`** → it's a plain model. **Tell the user and ask for consent:**
136
- *"This file isn't a shared central yet. To share it I need to turn it into one. I'll do
137
- that on a COPY, so your original file stays exactly as it is. Shall I go ahead?"*
138
- Only after the user agrees, publish **with `--convert`**:
139
- ```
140
- thatopen revit publish-central --project <PROJECT> --doc <DOC> --file "<FILE>" --convert
141
- ```
142
-
143
- `<DOC>` is the short central name from Step 0; `<FILE>` is the `.rvt` path. Publishing saves
144
- the central at the shared canonical location, uploads it, and opens **your** local in Revit
145
- (takes a bit). Success: `Published (…). Central: … (version N). Your original file was not
146
- modified.` Tell teammates to connect with the **project folder id** shown in the dashboard,
147
- or with `thatopen revit join --project <PROJECT> --doc <DOC>`.
148
-
149
- > If you skip `inspect` and the file isn't a central, `publish-central` will refuse with a
150
- > message telling you to re-run with `--convert` — still ask the user first.
151
-
152
- ### (B) Connect to a central — `join`
153
- Use whichever identifier the user gave you in Step 0:
154
- ```
155
- thatopen revit join --folder-id <FOLDER_ID> # the revit-<name> folder id in the project
156
- thatopen revit join --path "<C:\ThatOpenShared\...\central.rvt>" # a local shared-central path
157
- ```
158
- (Advanced: `--project <PROJECT> --doc <DOC>` also works if the user knows both.)
159
- This downloads the central, creates the user's **local**, and opens it in Revit.
160
- Success: `Joined. Your local was created and opened in Revit: …`.
161
-
162
- ### (C) Already have a local open — `sync`
163
- ```
164
- thatopen revit sync
165
- ```
166
- Reads everything from the open local. Nothing else needed.
167
-
168
- ---
169
-
170
- ## Step 4 — Work, then sync
171
- Tell the user to **model normally** in the local Revit opened. To send their changes to the
172
- team and pull the team's changes, run:
173
- ```
174
- thatopen revit sync
175
- ```
176
- …or click **"Sync to team"** in the **"That Open"** panel of Revit's **Add‑Ins** tab.
177
- Success: `Synced. vN → vM.` Repeat as often as they like; syncs are queued, no conflicts.
178
-
179
- ---
180
-
181
- ## Step 5 — Worksets (so two people don't edit the same thing)
182
- Syncs never corrupt the central, but if **two people edit the SAME element** without
183
- coordinating, the second one's sync is rejected and their local can get stuck. To avoid
184
- that, claim the part of the model you're about to edit using **worksets** — the unit of
185
- ownership. Typically one workset per area or per person (this central already has one per
186
- floor/level).
187
-
188
- **See the worksets and who owns each:**
189
- ```
190
- thatopen revit worksets
191
- ```
192
-
193
- **Claim a workset before editing it — two equivalent ways:**
194
- - **Ribbon (easiest):** in Revit's **Add-Ins → That Open** panel, select any element that
195
- belongs to the workset you want, then click **"Take workset"**.
196
- - **CLI:**
197
- ```
198
- thatopen revit take --workset "<NAME>"
199
- ```
200
- Only **one person at a time** can own a workset. If someone else already holds it, you get
201
- `✗ held by <user>` — coordinate or pick another. If two people click Take at the same
202
- instant, the platform lock gives it to exactly one and denies the other (no corruption).
203
-
204
- **⚠️ Ownership only protects you AFTER a sync round.** Taking a workset is instant for the
205
- *claim* (nobody else can take it), but Revit only **blocks teammates' edits** once the
206
- ownership reaches their copy: **you Sync (push your ownership), then each teammate Syncs
207
- (pulls it).** So the reliable sequence is:
208
- 1. `thatopen revit take --workset "<NAME>"` (or the Take workset button)
209
- 2. `thatopen revit sync` ← you push the ownership
210
- 3. teammates `thatopen revit sync` ← now Revit blocks them from editing your workset
211
-
212
- Until teammates have synced, they could still auto-borrow an element in that workset by
213
- editing it directly. After the round, they'll see it as owned by you and be blocked.
214
-
215
- **Release when you're done** so teammates can take it:
216
- - **Ribbon:** click **"Release worksets"** (frees everything you own).
217
- - **CLI:** `thatopen revit untake --workset "<NAME>"`
218
- Then `sync` so the release propagates.
219
-
220
- > Note: simply editing an element makes you its **borrower** automatically (element-level);
221
- > **taking a workset** makes you the **owner** (workset-level). Revit only blocks editing
222
- > worksets owned by **someone else** — so the Take→Sync→Sync round above is what creates the
223
- > protection.
224
-
225
- ---
226
-
227
- ## Troubleshooting
228
- - **`thatopen login` fails with "Unauthorized"** → the token is invalid/expired, or it's
229
- for a different environment than `--api-url`. Ask the user to generate a fresh token in
230
- the dashboard (Data → API Tokens) for the SAME environment: production tokens use **no**
231
- `--api-url`; dev tokens use `--api-url https://dev.platform.thatopen.com`. Then retry.
232
- - **publish/join fails with HTTP 403** on `item/folder?projectId=…` → login worked but the
233
- user's account is **not authorized for that Project ID** (wrong project, wrong
234
- environment, or no access). Confirm the Project ID with the user and that their token
235
- (Step 2) belongs to an account with access to it, then retry.
236
- - **"add‑in not running"** after Revit is open → the add‑in isn't installed; do Step 1(b).
237
- - **"Could not reach the Revit add‑in"** → Revit was closed; reopen it and retry.
238
- - **"Not logged in"** → do Step 2.
239
- - **publish says a value is missing** → re‑run with `--project`, `--doc`, and `--file`.
240
- - **publish refuses: "not a workshared central … re-run with convert=true"** → the file is a
241
- plain model. Ask the user for consent to convert a **copy** (original untouched), then add
242
- `--convert`.
243
- - **`join` says "Identify the central … with one of …"** → provide `--folder-id`, or
244
- `--path`, or both `--project` and `--doc`.
245
- - **`take` returns `✗ held by <user>`** → someone else owns that workset. Ask them to
246
- Release + sync, or claim a different workset. This is expected, not an error.
247
- - **A teammate can still edit "my" workset** → ownership hasn't reached them yet. Make sure
248
- **you synced after taking it, and they synced afterwards** (Step 5). Until both sync
249
- rounds happen, Revit on their side doesn't know you own it.
250
-
251
- ## Rules recap (for the AI)
252
- - Ask for every value you don't have — never guess a project id, file path, or central name.
253
- - Never echo or store the user's token.
254
- - You may install the CLI/add‑in and launch Revit yourself; only the "Always Load" prompt
255
- needs the user.
256
- - Use only the `thatopen` CLI commands above; verify each command's output before proceeding.
1
+ # That Open — Revit Collaboration Quickstart (for AI assistants)
2
+
3
+ You are an AI assistant. A user pointed you at this guide so you can set up or join
4
+ **real‑time Revit collaboration** through the That Open platform. Follow the steps **in
5
+ order**. Ask the user for anything you don't already have. **You may run the setup commands
6
+ yourself** (install the CLI, install the add‑in, launch Revit) — do it, don't just tell the
7
+ user to, *except* where a step says only the user can. Everything is driven by the
8
+ `thatopen` CLI.
9
+
10
+ ## What this does
11
+ Multiple people work on **one shared Revit central model** using Revit's native
12
+ worksharing. The central lives on the That Open platform. Each person has their own local;
13
+ when they **sync**, their changes go up and their teammates' come down. All syncs are
14
+ **queued**, so the central never conflicts or diverges.
15
+
16
+ ## Rules (follow throughout)
17
+ - **Never** print, echo, store, or commit the user's access token.
18
+ - **Ask, don't assume.** Missing a project id, file path, or central name? Ask first.
19
+ - **Use only the `thatopen` CLI** for platform actions. Don't call HTTP APIs by hand.
20
+ - You may **install software and launch Revit** on the user's machine — briefly tell the
21
+ user what you're about to run before you run it.
22
+ - After each command, **check the output** before moving on.
23
+
24
+ ---
25
+
26
+ ## Step 0 — Ask what the user wants to do
27
+ Ask the user:
28
+ > "What would you like to do?
29
+ > (A) **Share** a Revit model with my team for the first time.
30
+ > (B) **Connect** to a shared central a teammate already uploaded.
31
+ > (C) I **already have my local open** in Revit — just sync it."
32
+
33
+ Then collect the inputs for their choice (ask now — you'll need them below):
34
+
35
+ - **(A) Share:** the **absolute path** to the `.rvt` to share, and a short lowercase
36
+ **name** for the shared central (e.g. `tower-central`). Also the platform **Project ID**
37
+ (see below). The file may or may not already be a workshared central — you'll check that
38
+ in Step 3; either way **the user's original file is never modified** (a copy is uploaded).
39
+
40
+ - **(B) Connect:** ask the user to identify the existing central by **one** of:
41
+ - the **project folder id** of the central — the `revit-<name>` folder inside the
42
+ project's `bimterop` folder in the That Open dashboard (copy its id from the folder), **or**
43
+ - the **local path** to the shared central on their PC, if they already have it
44
+ (looks like `C:\ThatOpenShared\<project>\<name>\<file>.rvt`).
45
+
46
+ (If they already have their local *open* in Revit, that's really case **(C)** — just sync.)
47
+
48
+ - **(A) — Project ID:** find it in the That Open dashboard — open the project; the ID is in
49
+ the project settings and the project URL. The user's token (Step 2) must belong to an
50
+ account with access to this project, or platform calls fail with **403** (see
51
+ Troubleshooting). For **(B)** the folder id / local path already encodes the project, so
52
+ you don't need to ask the Project ID separately.
53
+
54
+ - **(C):** nothing extra — Revit must have their local open.
55
+
56
+ Do **not** ask for the access token yet (that's Step 2).
57
+
58
+ ---
59
+
60
+ ## Step 1 — Make sure the tools are ready (do this yourself)
61
+ 1. **CLI.** Run:
62
+ ```
63
+ npm install -g @thatopen/services@latest
64
+ ```
65
+ Verify `thatopen --version` prints a version. (Needs Node.js 18+; if `node -v` fails,
66
+ ask the user to install Node.js, then continue.)
67
+
68
+ 2. **Revit + add‑in.** Run:
69
+ ```
70
+ thatopen revit status
71
+ ```
72
+ - Prints `"loaded": true` → the add‑in is running. Go to **Step 2**.
73
+ - Errors **"The That Open Revit add‑in is not running"** → work through (a) then (b):
74
+
75
+ **(a) Is Revit 2026 open?** If not, launch it (Windows):
76
+ ```
77
+ powershell -Command "Start-Process 'C:\Program Files\Autodesk\Revit 2026\Revit.exe'"
78
+ ```
79
+ Cold start can take 1–3 minutes. Wait, then re‑run `thatopen revit status`. If it now
80
+ says `"loaded": true`, go to Step 2.
81
+
82
+ **(b) Revit is open but status still errors → the add‑in isn't installed. Install it:**
83
+ - The add‑in files ship in **this same folder** as this guide (`install.ps1`,
84
+ `RevitFlowAddin.dll`, `RevitFlowCore.dll`, `revitflow.addin`). From this folder, run:
85
+ ```
86
+ powershell -ExecutionPolicy Bypass -File install.ps1
87
+ ```
88
+ *(If you don't have those files, download the plugin zip here, unzip it, then run
89
+ `install.ps1` from the unzipped folder:
90
+ https://drive.google.com/file/d/1HL_Ti7N_qN0Q-X7vNYOQst3yEgIY-xXO/view?usp=drive_link )*
91
+ - **Restart Revit** so it loads the add‑in: close Revit, then launch it again with the
92
+ `Start-Process` command above.
93
+ - On the first launch after installing, Revit shows an **"unsigned add‑in"** prompt.
94
+ **Only the user can click it — ask them to choose "Always Load".**
95
+ - Re‑run `thatopen revit status` every ~10s until it prints `"loaded": true`.
96
+
97
+ ---
98
+
99
+ ## Step 2 — Log in
100
+ The user needs a personal **access token** from the That Open platform. Ask them for it and
101
+ tell them exactly where to get it:
102
+
103
+ > "To log in I need your That Open **access token**. To create one:
104
+ > 1. Open your That Open dashboard in a browser — **production:** https://platform.thatopen.com
105
+ > · **dev:** https://dev.platform.thatopen.com (use the one that matches your team).
106
+ > 2. Go to **Data → API Tokens**.
107
+ > 3. Click **Create a new token** and **copy** it.
108
+ > 4. Paste it here."
109
+
110
+ **Never print, echo, or store the token.** Once the user pastes it, run:
111
+ ```
112
+ thatopen login --token <TOKEN>
113
+ ```
114
+ - **Production is the default.** For the **dev** environment, also add:
115
+ `--api-url https://dev.platform.thatopen.com`
116
+ - Success prints `Logged in successfully…`. If it fails with **"Unauthorized"**, the token
117
+ is invalid or for the other environment — see **Troubleshooting**, then ask for a fresh
118
+ token and retry.
119
+
120
+ ---
121
+
122
+ ## Step 3 — Do the action
123
+
124
+ ### (A) Share a model — `inspect`, then `publish-central`
125
+ First check whether the file is already a workshared central:
126
+ ```
127
+ thatopen revit inspect --file "<FILE>"
128
+ ```
129
+ - **`"isCentral": true`** → it's already a central. Tell the user: *"This is already a
130
+ central; I'll upload a copy to the shared location — your original file won't be touched."*
131
+ Then publish (no `--convert` needed):
132
+ ```
133
+ thatopen revit publish-central --project <PROJECT> --doc <DOC> --file "<FILE>"
134
+ ```
135
+ - **`"isCentral": false`** → it's a plain model. **Tell the user and ask for consent:**
136
+ *"This file isn't a shared central yet. To share it I need to turn it into one. I'll do
137
+ that on a COPY, so your original file stays exactly as it is. Shall I go ahead?"*
138
+ Only after the user agrees, publish **with `--convert`**:
139
+ ```
140
+ thatopen revit publish-central --project <PROJECT> --doc <DOC> --file "<FILE>" --convert
141
+ ```
142
+
143
+ `<DOC>` is the short central name from Step 0; `<FILE>` is the `.rvt` path. Publishing saves
144
+ the central at the shared canonical location, uploads it, and opens **your** local in Revit
145
+ (takes a bit). Success: `Published (…). Central: … (version N). Your original file was not
146
+ modified.` Tell teammates to connect with the **project folder id** shown in the dashboard,
147
+ or with `thatopen revit join --project <PROJECT> --doc <DOC>`.
148
+
149
+ > If you skip `inspect` and the file isn't a central, `publish-central` will refuse with a
150
+ > message telling you to re-run with `--convert` — still ask the user first.
151
+
152
+ ### (B) Connect to a central — `join`
153
+ Use whichever identifier the user gave you in Step 0:
154
+ ```
155
+ thatopen revit join --folder-id <FOLDER_ID> # the revit-<name> folder id in the project
156
+ thatopen revit join --path "<C:\ThatOpenShared\...\central.rvt>" # a local shared-central path
157
+ ```
158
+ (Advanced: `--project <PROJECT> --doc <DOC>` also works if the user knows both.)
159
+ This downloads the central, creates the user's **local**, and opens it in Revit.
160
+ Success: `Joined. Your local was created and opened in Revit: …`.
161
+
162
+ ### (C) Already have a local open — `sync`
163
+ ```
164
+ thatopen revit sync
165
+ ```
166
+ Reads everything from the open local. Nothing else needed.
167
+
168
+ ---
169
+
170
+ ## Step 4 — Work, then sync
171
+ Tell the user to **model normally** in the local Revit opened. To send their changes to the
172
+ team and pull the team's changes, run:
173
+ ```
174
+ thatopen revit sync
175
+ ```
176
+ …or click **"Sync to team"** in the **"That Open"** panel of Revit's **Add‑Ins** tab.
177
+ Success: `Synced. vN → vM.` Repeat as often as they like; syncs are queued, no conflicts.
178
+
179
+ ---
180
+
181
+ ## Step 5 — Worksets (so two people don't edit the same thing)
182
+ Syncs never corrupt the central, but if **two people edit the SAME element** without
183
+ coordinating, the second one's sync is rejected and their local can get stuck. To avoid
184
+ that, claim the part of the model you're about to edit using **worksets** — the unit of
185
+ ownership. Typically one workset per area or per person (this central already has one per
186
+ floor/level).
187
+
188
+ **See the worksets and who owns each:**
189
+ ```
190
+ thatopen revit worksets
191
+ ```
192
+
193
+ **Claim a workset before editing it — two equivalent ways:**
194
+ - **Ribbon (easiest):** in Revit's **Add-Ins → That Open** panel, select any element that
195
+ belongs to the workset you want, then click **"Take workset"**.
196
+ - **CLI:**
197
+ ```
198
+ thatopen revit take --workset "<NAME>"
199
+ ```
200
+ Only **one person at a time** can own a workset. If someone else already holds it, you get
201
+ `✗ held by <user>` — coordinate or pick another. If two people click Take at the same
202
+ instant, the platform lock gives it to exactly one and denies the other (no corruption).
203
+
204
+ **⚠️ Ownership only protects you AFTER a sync round.** Taking a workset is instant for the
205
+ *claim* (nobody else can take it), but Revit only **blocks teammates' edits** once the
206
+ ownership reaches their copy: **you Sync (push your ownership), then each teammate Syncs
207
+ (pulls it).** So the reliable sequence is:
208
+ 1. `thatopen revit take --workset "<NAME>"` (or the Take workset button)
209
+ 2. `thatopen revit sync` ← you push the ownership
210
+ 3. teammates `thatopen revit sync` ← now Revit blocks them from editing your workset
211
+
212
+ Until teammates have synced, they could still auto-borrow an element in that workset by
213
+ editing it directly. After the round, they'll see it as owned by you and be blocked.
214
+
215
+ **Release when you're done** so teammates can take it:
216
+ - **Ribbon:** click **"Release worksets"** (frees everything you own).
217
+ - **CLI:** `thatopen revit untake --workset "<NAME>"`
218
+ Then `sync` so the release propagates.
219
+
220
+ > Note: simply editing an element makes you its **borrower** automatically (element-level);
221
+ > **taking a workset** makes you the **owner** (workset-level). Revit only blocks editing
222
+ > worksets owned by **someone else** — so the Take→Sync→Sync round above is what creates the
223
+ > protection.
224
+
225
+ ---
226
+
227
+ ## Troubleshooting
228
+ - **`thatopen login` fails with "Unauthorized"** → the token is invalid/expired, or it's
229
+ for a different environment than `--api-url`. Ask the user to generate a fresh token in
230
+ the dashboard (Data → API Tokens) for the SAME environment: production tokens use **no**
231
+ `--api-url`; dev tokens use `--api-url https://dev.platform.thatopen.com`. Then retry.
232
+ - **publish/join fails with HTTP 403** on `item/folder?projectId=…` → login worked but the
233
+ user's account is **not authorized for that Project ID** (wrong project, wrong
234
+ environment, or no access). Confirm the Project ID with the user and that their token
235
+ (Step 2) belongs to an account with access to it, then retry.
236
+ - **"add‑in not running"** after Revit is open → the add‑in isn't installed; do Step 1(b).
237
+ - **"Could not reach the Revit add‑in"** → Revit was closed; reopen it and retry.
238
+ - **"Not logged in"** → do Step 2.
239
+ - **publish says a value is missing** → re‑run with `--project`, `--doc`, and `--file`.
240
+ - **publish refuses: "not a workshared central … re-run with convert=true"** → the file is a
241
+ plain model. Ask the user for consent to convert a **copy** (original untouched), then add
242
+ `--convert`.
243
+ - **`join` says "Identify the central … with one of …"** → provide `--folder-id`, or
244
+ `--path`, or both `--project` and `--doc`.
245
+ - **`take` returns `✗ held by <user>`** → someone else owns that workset. Ask them to
246
+ Release + sync, or claim a different workset. This is expected, not an error.
247
+ - **A teammate can still edit "my" workset** → ownership hasn't reached them yet. Make sure
248
+ **you synced after taking it, and they synced afterwards** (Step 5). Until both sync
249
+ rounds happen, Revit on their side doesn't know you own it.
250
+
251
+ ## Rules recap (for the AI)
252
+ - Ask for every value you don't have — never guess a project id, file path, or central name.
253
+ - Never echo or store the user's token.
254
+ - You may install the CLI/add‑in and launch Revit yourself; only the "Always Load" prompt
255
+ needs the user.
256
+ - Use only the `thatopen` CLI commands above; verify each command's output before proceeding.