pi-revit 0.1.0 → 0.1.2

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 (3) hide show
  1. package/README.md +60 -19
  2. package/bin/pi-revit.js +86 -0
  3. package/package.json +33 -6
package/README.md CHANGED
@@ -44,29 +44,57 @@ LLM provider, like any Pi session.
44
44
 
45
45
  ## Install
46
46
 
47
+ ### One-command install
48
+
47
49
  Close Revit, then in PowerShell:
48
50
 
51
+ ```powershell
52
+ npx -y pi-revit
53
+ ```
54
+
55
+ This installs the Pi package, builds and deploys the Revit bridge add-in, creates the
56
+ `Documents\pi-revit` workspace, and installs the global `pi-revit` command.
57
+
58
+ Start Revit (click **Always Load** on the unsigned add-in prompt once) and open any
59
+ project. No panel or ribbon appears — the add-in is headless.
60
+
61
+ ### Manual npm install
62
+
63
+ Use this if you prefer to run each step yourself:
64
+
65
+ ```powershell
66
+ # 1. Install the Pi package from npm. This registers the pi-revit extension and skill.
67
+ pi install npm:pi-revit
68
+
69
+ # 2. Go to the installed package folder.
70
+ cd "$env:USERPROFILE\.pi\agent\npm\node_modules\pi-revit"
71
+
72
+ # 3. Build + deploy the Revit add-in (RevitBridge.dll + the Roslyn DLLs for execute_csharp).
73
+ npm run deploy
74
+
75
+ # 4. Create the workspace and global pi-revit command.
76
+ npm run setup
77
+ ```
78
+
79
+ For a non-default Revit install location, use the PowerShell deploy script directly and pass
80
+ `-RevitVersion` / `-RevitApiPath`, e.g.:
81
+
82
+ ```powershell
83
+ powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1 -RevitVersion 2027 -RevitApiPath "D:\Autodesk\Revit 2027"
84
+ ```
85
+
86
+ ### Source install
87
+
88
+ Use this if you want to run directly from the GitHub checkout instead of the npm package:
89
+
49
90
  ```powershell
50
91
  git clone https://github.com/Triavision-ai/pi-revit.git
51
92
  cd pi-revit
52
-
53
- # 1. Build + deploy the Revit add-in (RevitBridge.dll + the Roslyn DLLs for execute_csharp)
54
- # Auto-detects every supported Revit (2025+) installed under Program Files and deploys to each.
55
- # Only need the .NET SDK for the versions you have (e.g. just .NET 8 if you only run 2025/2026).
56
- # For a non-default install location, pass -RevitVersion and -RevitApiPath, e.g.:
57
- # ... scripts\deploy.ps1 -RevitVersion 2027 -RevitApiPath "D:\Autodesk\Revit 2027"
58
93
  powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1
59
-
60
- # 2. Install the Pi package
61
94
  pi install ./
62
-
63
- # 3. Workspace + global pi-revit command
64
95
  powershell -ExecutionPolicy Bypass -File scripts\setup-workspace.ps1
65
96
  ```
66
97
 
67
- Start Revit (click **Always Load** on the unsigned add-in prompt once) and open any
68
- project. No panel or ribbon appears — the add-in is headless.
69
-
70
98
  ## Use it
71
99
 
72
100
  Open **any terminal** — PowerShell, CMD, or Windows Terminal — and type:
@@ -135,15 +163,28 @@ Plain `pi` from any folder also works; `pi-revit` just adds the right working fo
135
163
 
136
164
  ## Uninstall
137
165
 
138
- Close Revit, then in PowerShell from the repo:
166
+ ### npm install
167
+
168
+ Close Revit, then in PowerShell:
169
+
170
+ ```powershell
171
+ cd "$env:USERPROFILE\.pi\agent\npm\node_modules\pi-revit"
172
+ powershell -ExecutionPolicy Bypass -File scripts\uninstall.ps1
173
+ pi remove npm:pi-revit
174
+ ```
175
+
176
+ ### Source install
177
+
178
+ Close Revit, then in PowerShell from the GitHub checkout:
139
179
 
140
180
  ```powershell
141
181
  powershell -ExecutionPolicy Bypass -File scripts\uninstall.ps1
142
182
  ```
143
183
 
144
184
  This removes the Revit bridge add-in (every installed Revit version), the global `pi-revit`
145
- command, the bridge runtime folder (`%APPDATA%\RevitBridge\`), and the Pi package registration.
146
- Your workspace at `Documents\pi-revit` (notes + session history) is **preserved** — add
147
- `-RemoveWorkspace` to delete it too, or `-RevitVersion 2026` to target a single Revit version.
148
- Pi itself is left installed; remove it with `npm uninstall -g @earendil-works/pi-coding-agent` if
149
- you want.
185
+ command, and the bridge runtime folder (`%APPDATA%\RevitBridge\`). It also removes the Pi
186
+ package registration for source installs; npm installs should additionally run
187
+ `pi remove npm:pi-revit` as shown above. Your workspace at `Documents\pi-revit` (notes + session
188
+ history) is **preserved** — add `-RemoveWorkspace` to delete it too, or `-RevitVersion 2026` to
189
+ target a single Revit version. Pi itself is left installed; remove it with
190
+ `npm uninstall -g @earendil-works/pi-coding-agent` if you want.
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+
6
+ const root = path.resolve(__dirname, "..");
7
+ const scriptsDir = path.join(root, "scripts");
8
+
9
+ function usage() {
10
+ console.log(`pi-revit installer\n\nUsage:\n npx -y pi-revit\n\nWhat it does on Windows:\n 1. Runs: pi install npm:pi-revit\n 2. Builds and deploys the Revit bridge add-in\n 3. Creates the Documents\\pi-revit workspace and global pi-revit command\n\nClose Revit before running. Revit 2025, 2026, or 2027 and the matching .NET SDK are required.`);
11
+ }
12
+
13
+ function fail(message) {
14
+ console.error(`\npi-revit install failed: ${message}`);
15
+ process.exit(1);
16
+ }
17
+
18
+ function commandExists(command) {
19
+ return spawnSync("where.exe", [command], { stdio: "ignore" }).status === 0;
20
+ }
21
+
22
+ function run(title, command, args) {
23
+ console.log(`\n==> ${title}`);
24
+ const result = spawnSync(command, args, { stdio: "inherit", shell: false });
25
+ if (result.error) fail(`${command} could not be started: ${result.error.message}`);
26
+ if (result.status !== 0) process.exit(result.status ?? 1);
27
+ }
28
+
29
+ function runPowerShellScript(scriptName) {
30
+ const scriptPath = path.join(scriptsDir, scriptName);
31
+ if (!fs.existsSync(scriptPath)) fail(`missing script: ${scriptPath}`);
32
+ run(scriptName, "powershell.exe", ["-ExecutionPolicy", "Bypass", "-File", scriptPath]);
33
+ }
34
+
35
+ function revitIsRunning() {
36
+ const result = spawnSync(
37
+ "powershell.exe",
38
+ ["-NoProfile", "-Command", "if (Get-Process Revit -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"],
39
+ { stdio: "ignore" },
40
+ );
41
+ return result.status === 0;
42
+ }
43
+
44
+ function waitForEnter() {
45
+ console.log("\nRevit appears to be running. Close Revit now, then press Enter to continue (or Ctrl+C to cancel).");
46
+ try {
47
+ fs.readSync(0, Buffer.alloc(1), 0, 1);
48
+ } catch {
49
+ // Non-interactive shell: fall through to the second running check.
50
+ }
51
+ }
52
+
53
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
54
+ usage();
55
+ process.exit(0);
56
+ }
57
+
58
+ if (process.platform !== "win32") {
59
+ fail("pi-revit's Revit bridge installer supports Windows only.");
60
+ }
61
+
62
+ if (!commandExists("pi")) {
63
+ fail("the 'pi' command was not found on PATH. Install Pi first: npm install -g --ignore-scripts @earendil-works/pi-coding-agent");
64
+ }
65
+
66
+ if (!commandExists("dotnet")) {
67
+ fail("the 'dotnet' command was not found on PATH. Install the .NET SDK required by your Revit version.");
68
+ }
69
+
70
+ if (revitIsRunning()) {
71
+ waitForEnter();
72
+ if (revitIsRunning()) fail("Revit is still running. Close Revit and run 'npx -y pi-revit' again.");
73
+ }
74
+
75
+ console.log("pi-revit full installer");
76
+ console.log("This installs the Pi package, deploys the Revit add-in, and creates the workspace/global command.");
77
+
78
+ run("Install the Pi package from npm", "pi", ["install", "npm:pi-revit"]);
79
+ runPowerShellScript("deploy.ps1");
80
+ runPowerShellScript("setup-workspace.ps1");
81
+
82
+ console.log("\npi-revit installed.");
83
+ console.log("Next steps:");
84
+ console.log(" 1. Start Revit and click Always Load if prompted.");
85
+ console.log(" 2. Open a project.");
86
+ console.log(" 3. Run: pi-revit");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-revit",
3
- "version": "0.1.0",
4
- "description": "Native Pi connector for Autodesk Revit through a headless bridge add-in.",
3
+ "version": "0.1.2",
4
+ "description": "Native Pi connector for Autodesk Revit. Run npx -y pi-revit for the full Windows install.",
5
5
  "author": "Ahmad Altahlawi",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -12,11 +12,38 @@
12
12
  "url": "https://github.com/Triavision-ai/pi-revit/issues"
13
13
  },
14
14
  "homepage": "https://github.com/Triavision-ai/pi-revit#readme",
15
- "keywords": ["pi-package", "pi-extension", "revit", "bim", "autodesk", "revit-api"],
16
- "files": ["extensions/", "skills/", "scripts/", "src/", "workspace/", "README.md"],
15
+ "keywords": [
16
+ "pi-package",
17
+ "pi-extension",
18
+ "revit",
19
+ "bim",
20
+ "autodesk",
21
+ "revit-api"
22
+ ],
23
+ "bin": {
24
+ "pi-revit": "bin/pi-revit.js"
25
+ },
26
+ "scripts": {
27
+ "deploy": "powershell -ExecutionPolicy Bypass -File scripts/deploy.ps1",
28
+ "setup": "powershell -ExecutionPolicy Bypass -File scripts/setup-workspace.ps1",
29
+ "uninstall:revit": "powershell -ExecutionPolicy Bypass -File scripts/uninstall.ps1"
30
+ },
31
+ "files": [
32
+ "bin/",
33
+ "extensions/",
34
+ "skills/",
35
+ "scripts/",
36
+ "src/",
37
+ "workspace/",
38
+ "README.md"
39
+ ],
17
40
  "pi": {
18
- "extensions": ["./extensions/pi-revit/index.ts"],
19
- "skills": ["./skills"]
41
+ "extensions": [
42
+ "./extensions/pi-revit/index.ts"
43
+ ],
44
+ "skills": [
45
+ "./skills"
46
+ ]
20
47
  },
21
48
  "engines": {
22
49
  "node": ">=20.3"