@thatopen/services 0.3.12 → 0.3.13

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.
package/dist/cli.js CHANGED
@@ -11745,27 +11745,54 @@ revitCommand.command("status").description("Show the add-in status and the curre
11745
11745
  const r = await callAddin("status");
11746
11746
  console.log(JSON.stringify(r, null, 2));
11747
11747
  });
11748
- revitCommand.command("publish-central").description("Turn a .rvt into a shared central and upload it to a project").requiredOption("--project <id>", "Platform project id").requiredOption("--doc <name>", "A short name for this central (e.g. tower-central)").requiredOption("--file <path>", "Absolute path to the source .rvt on this machine").action(async (opts) => {
11748
+ revitCommand.command("inspect").description("Check whether a .rvt is already a workshared central (before sharing)").requiredOption("--file <path>", "Absolute path to the .rvt to inspect").action(async (opts) => {
11749
+ await connect();
11750
+ const r = await callAddin("inspect", { file: opts.file });
11751
+ console.log(JSON.stringify(r, null, 2));
11752
+ if (r.isCentral) {
11753
+ console.log("\nThis file is already a central — you can share it as-is (a copy is uploaded; your original is untouched).");
11754
+ } else {
11755
+ console.log("\nThis file is NOT a central yet. To share it, it must be converted into one.");
11756
+ console.log("Publishing works on a COPY, so your original file is never modified.");
11757
+ console.log("Ask the user for consent, then run publish-central with --convert.");
11758
+ }
11759
+ });
11760
+ revitCommand.command("publish-central").description("Turn a .rvt into a shared central and upload it to a project").requiredOption("--project <id>", "Platform project id").requiredOption("--doc <name>", "A short name for this central (e.g. tower-central)").requiredOption("--file <path>", "Absolute path to the source .rvt on this machine").option("--convert", "Allow converting a non-central .rvt into one (on a copy; original untouched)").action(async (opts) => {
11749
11761
  await connect();
11750
11762
  console.log(`Publishing "${opts.file}" as central "${opts.doc}"...`);
11751
11763
  console.log("(Revit is enabling worksharing and saving the central — this can take a bit.)");
11752
11764
  const r = await callAddin("publish-central", {
11753
11765
  project: opts.project,
11754
11766
  doc: opts.doc,
11755
- file: opts.file
11767
+ file: opts.file,
11768
+ convert: !!opts.convert
11756
11769
  });
11757
- console.log(`Published. Central: ${r.central} (version ${r.version}).`);
11758
- console.log(`Collaborators can now join with:`);
11770
+ const how = r.wasCentral ? "copied the existing central" : "converted a copy into a central";
11771
+ console.log(`Published (${how}). Central: ${r.central} (version ${r.version}).`);
11772
+ console.log(`Your original file was not modified. Collaborators can now join with:`);
11759
11773
  console.log(` thatopen revit join --project ${opts.project} --doc ${opts.doc}`);
11760
11774
  });
11761
- revitCommand.command("join").description("Download a shared central and create + open your local in Revit").requiredOption("--project <id>", "Platform project id").requiredOption("--doc <name>", "The central name to join (from whoever published it)").action(async (opts) => {
11762
- await connect();
11763
- console.log(`Joining "${opts.doc}"...`);
11764
- const r = await callAddin("join", { project: opts.project, doc: opts.doc });
11765
- console.log(`Joined. Your local was created and opened in Revit:`);
11766
- console.log(` ${r.local}`);
11767
- console.log(`Model as usual, then run "thatopen revit sync" (or the "Sync to team" button).`);
11768
- });
11775
+ revitCommand.command("join").description("Download a shared central and create + open your local in Revit").option("--folder-id <id>", "The central's project folder id (the revit-<doc> folder in That Open)").option("--path <path>", "Local path to the shared central (C:\\ThatOpenShared\\<proj>\\<doc>\\<name>.rvt)").option("--project <id>", "Platform project id (use together with --doc)").option("--doc <name>", "The central name to join (use together with --project)").action(
11776
+ async (opts) => {
11777
+ await connect();
11778
+ if (!opts.folderId && !opts.path && !(opts.project && opts.doc)) {
11779
+ console.error(
11780
+ "Identify the central to join with one of: --folder-id, --path, or --project + --doc."
11781
+ );
11782
+ process.exit(1);
11783
+ }
11784
+ console.log("Joining...");
11785
+ const r = await callAddin("join", {
11786
+ folderId: opts.folderId,
11787
+ path: opts.path,
11788
+ project: opts.project,
11789
+ doc: opts.doc
11790
+ });
11791
+ console.log(`Joined. Your local was created and opened in Revit:`);
11792
+ console.log(` ${r.local}`);
11793
+ console.log(`Model as usual, then run "thatopen revit sync" (or the "Sync to team" button).`);
11794
+ }
11795
+ );
11769
11796
  revitCommand.command("sync").description("Synchronize your local with the team (queued, no divergence)").action(async () => {
11770
11797
  await connect();
11771
11798
  console.log("Syncing with the team...");
@@ -1,151 +1,205 @@
1
1
  # That Open — Revit Collaboration Quickstart (for AI assistants)
2
2
 
3
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
5
- **in order**. Ask the user for anything you don't already have. Do **exactly** what each
6
- step says — don't improvise, don't skip the verification lines, and don't call platform
7
- APIs directly. Everything is done with the `thatopen` CLI.
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.
8
9
 
9
10
  ## What this does
10
11
  Multiple people work on **one shared Revit central model** using Revit's native
11
- worksharing. The central lives on the That Open platform. Each person has their own
12
- local; when they **sync**, their changes go up and their teammates' changes come down.
13
- All syncs are automatically **queued**, so the central never conflicts or diverges.
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.
14
15
 
15
- ## Rules (read first, follow throughout)
16
+ ## Rules (follow throughout)
16
17
  - **Never** print, echo, store, or commit the user's access token.
17
- - **Ask, don't assume.** If you're missing a value (project id, file path, central name),
18
- ask the user for it before running a command.
19
- - **Use only the `thatopen` CLI** commands in this guide. Don't hand‑edit files or call
20
- HTTP APIs.
21
- - Revit‑specific work (enable worksharing, create local, sync) happens **inside the That
22
- Open Revit add‑in**; the CLI drives it. The user must have Revit open with the add‑in.
23
- - After each command, **check the output** matches what this guide says before moving on.
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.
24
23
 
25
24
  ---
26
25
 
27
- ## Step 0 — Prerequisites (check, don't assume)
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."
28
32
 
29
- 1. **Node.js 18+** — run `node -v`. If missing, ask the user to install Node.js, then continue.
30
- 2. **The CLI** — install/upgrade it:
31
- ```
32
- npm install -g @thatopen/services@latest
33
- ```
34
- Verify with `thatopen --version`.
35
- 3. **Revit 2026 is open** on this machine. Ask the user to confirm.
36
- 4. **The That Open Revit add‑in is installed.** Ask the user:
37
- *"Do you already have the That Open Revit add‑in installed?"*
38
- - **If no / not sure — the plugin files ship in the SAME folder as this guide**
39
- (this guide travels inside the plugin zip). Install it:
40
- 1. In this folder, right‑click `install.ps1` → **Run with PowerShell**
41
- (or run `powershell -ExecutionPolicy Bypass -File .\install.ps1`).
42
- 2. **Restart Revit 2026.** If Revit warns the add‑in is from an unknown publisher,
43
- choose **"Always Load"**.
44
- - *If you have only this guide and not the plugin files, download the plugin zip here,
45
- unzip it, and run `install.ps1`:*
46
- **https://drive.google.com/file/d/1HL_Ti7N_qN0Q-X7vNYOQst3yEgIY-xXO/view?usp=drive_link**
47
- 5. **Verify the add‑in is running** — run:
48
- ```
49
- thatopen revit status
50
- ```
51
- It should print JSON containing `"loaded": true`. If instead you see
52
- *"The That Open Revit add‑in is not running"*, the user must open Revit 2026 (with the
53
- add‑in installed) and — if they just installed it — **restart Revit**. Then retry.
33
+ Then collect the inputs for their choice (ask now — you'll need them below):
54
34
 
55
- ---
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).
56
39
 
57
- ## Step 1 — Log in
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`).
58
45
 
59
- Ask the user for their **platform access token**:
60
- *"Please paste your That Open access token (dashboard → Data → API Tokens → Create → copy)."*
61
- **Never echo the token back.** Then run:
62
- ```
63
- thatopen login --token <TOKEN>
64
- ```
65
- - For the **dev** environment, add: `--api-url https://dev.platform.thatopen.com`
66
- - Success looks like: `Logged in successfully. Config saved to ~/.thatopen/config.json`.
46
+ (If they already have their local *open* in Revit, that's really case **(C)** — just sync.)
67
47
 
68
- ---
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.
69
53
 
70
- ## Step 2 — Which project?
54
+ - **(C):** nothing extra — Revit must have their local open.
71
55
 
72
- Ask the user for the **platform Project ID** they want to collaborate in
73
- (they can find it in the platform dashboard / project settings / project URL).
74
- Remember it as `<PROJECT>` for the commands below.
56
+ Do **not** ask for the access token yet (that's Step 2).
75
57
 
76
58
  ---
77
59
 
78
- ## Step 3 — Publish or Join?
79
-
80
- Ask the user:
81
- *"Do you want to **(A) share a Revit model** with your team for the first time, or
82
- **(B) join a shared model** a teammate already uploaded?"*
83
-
84
- ### 3A — Share a model (publisher)
85
- Use this when the user has a Revit file on their machine they want the team to work on.
86
- It works whether the file is a **normal (non‑workshared) model** or already a **central** —
87
- both are fine.
88
-
89
- 1. Ask for the **absolute path** to the `.rvt` on this machine → `<FILE>`.
90
- 2. Ask for a **short name** for this shared central, e.g. `tower-central` → `<DOC>`.
91
- (This is how teammates will refer to it when they join. Keep it lowercase, no spaces.)
92
- 3. Run:
60
+ ## Step 1 — Make sure the tools are ready (do this yourself)
61
+ 1. **CLI.** Run:
93
62
  ```
94
- thatopen revit publish-central --project <PROJECT> --doc <DOC> --file "<FILE>"
63
+ npm install -g @thatopen/services@latest
95
64
  ```
96
- This enables worksharing, saves it as a central, uploads it, and opens **your** local in
97
- Revit. It can take a bit (Revit is doing the worksharing conversion).
98
- 4. Success prints `Published. Central: ... (version N).` Tell the user their teammates can
99
- now join with:
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:
100
69
  ```
101
- thatopen revit join --project <PROJECT> --doc <DOC>
70
+ thatopen revit status
102
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):
103
74
 
104
- ### 3B — Join a shared model (collaborator)
105
- Use this when a teammate has already published a central to this project.
106
-
107
- 1. Ask for the **central name** the publisher gave them → `<DOC>`.
108
- 2. Run:
75
+ **(a) Is Revit 2026 open?** If not, launch it (Windows):
109
76
  ```
110
- thatopen revit join --project <PROJECT> --doc <DOC>
77
+ powershell -Command "Start-Process 'C:\Program Files\Autodesk\Revit 2026\Revit.exe'"
111
78
  ```
112
- This downloads the central, creates the user's **local**, and opens it in Revit.
113
- Success prints `Joined. Your local was created and opened in Revit: ...`.
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
+ `Bt3Addin.dll`, `Bt3Core.dll`, `bt3.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`.
114
96
 
115
97
  ---
116
98
 
117
- ## Step 4 — Work, then sync
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."
118
109
 
119
- Tell the user: **model normally** in the local that Revit just opened.
120
- When they want to **send their changes to the team and pull the team's changes**, run:
110
+ **Never print, echo, or store the token.** Once the user pastes it, run:
121
111
  ```
122
- thatopen revit sync
112
+ thatopen login --token <TOKEN>
123
113
  ```
124
- …or click **"Sync to team"** in the **"That Open"** panel of Revit's **Add‑Ins** tab.
125
- Success prints `Synced. vN → vM.` Everyone's syncs are queued automatically — no conflicts.
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
+ ---
126
121
 
127
- They can keep working and sync as often as they like. Repeat this step.
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.
128
167
 
129
168
  ---
130
169
 
131
- ## Special case — the user already has their local open
132
- If the user **already has their local `.rvt` open in Revit** from a previous session, they
133
- do **not** need to log in / join again. The open file already knows its project and central.
134
- Just tell them to run `thatopen revit sync` (or click **"Sync to team"**) — it reads
135
- everything it needs from the open local.
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.
136
178
 
137
179
  ---
138
180
 
139
181
  ## Troubleshooting
140
- - **"The That Open Revit add‑in is not running"** → open Revit 2026 with the add‑in
141
- installed; if just installed, restart Revit; then retry.
142
- - **"Not logged in"** → do Step 1.
143
- - **publish/join says a value is missing** → you omitted an `--option`. Re‑run with all of
144
- `--project`, `--doc`, and (for publish) `--file`.
145
- - **"Could not reach the Revit add‑in"** → Revit was closed. Reopen it and retry.
182
+ - **`thatopen login` fails with "Unauthorized"** → the token is invalid/expired, or it's
183
+ for a different environment than `--api-url`. Ask the user to generate a fresh token in
184
+ the dashboard (Data → API Tokens) for the SAME environment: production tokens use **no**
185
+ `--api-url`; dev tokens use `--api-url https://dev.platform.thatopen.com`. Then retry.
186
+ - **publish/join fails with HTTP 403** on `item/folder?projectId=…` → login worked but the
187
+ user's account is **not authorized for that Project ID** (wrong project, wrong
188
+ environment, or no access). Confirm the Project ID with the user and that their token
189
+ (Step 2) belongs to an account with access to it, then retry.
190
+ - **"add‑in not running"** after Revit is open → the add‑in isn't installed; do Step 1(b).
191
+ - **"Could not reach the Revit add‑in"** → Revit was closed; reopen it and retry.
192
+ - **"Not logged in"** → do Step 2.
193
+ - **publish says a value is missing** → re‑run with `--project`, `--doc`, and `--file`.
194
+ - **publish refuses: "not a workshared central … re-run with convert=true"** → the file is a
195
+ plain model. Ask the user for consent to convert a **copy** (original untouched), then add
196
+ `--convert`.
197
+ - **`join` says "Identify the central … with one of …"** → provide `--folder-id`, or
198
+ `--path`, or both `--project` and `--doc`.
146
199
 
147
200
  ## Rules recap (for the AI)
148
201
  - Ask for every value you don't have — never guess a project id, file path, or central name.
149
202
  - Never echo or store the user's token.
150
- - Only use the `thatopen` CLI commands shown here; verify each command's output before
151
- proceeding.
203
+ - You may install the CLI/add‑in and launch Revit yourself; only the "Always Load" prompt
204
+ needs the user.
205
+ - Use only the `thatopen` CLI commands above; verify each command's output before proceeding.
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "access": "public"
16
16
  },
17
17
  "private": false,
18
- "version": "0.3.12",
18
+ "version": "0.3.13",
19
19
  "main": "dist/index.cjs.js",
20
20
  "module": "dist/index.es.js",
21
21
  "types": "dist/index.d.ts",