pi-revit 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -44,10 +44,24 @@ LLM provider, like any Pi session.
44
44
 
45
45
  ## Install
46
46
 
47
- ### Recommended: install from npm
47
+ ### One-command install
48
48
 
49
49
  Close Revit, then in PowerShell:
50
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
+
51
65
  ```powershell
52
66
  # 1. Install the Pi package from npm. This registers the pi-revit extension and skill.
53
67
  pi install npm:pi-revit
@@ -56,18 +70,18 @@ pi install npm:pi-revit
56
70
  cd "$env:USERPROFILE\.pi\agent\npm\node_modules\pi-revit"
57
71
 
58
72
  # 3. Build + deploy the Revit add-in (RevitBridge.dll + the Roslyn DLLs for execute_csharp).
59
- # Auto-detects every supported Revit (2025+) installed under Program Files and deploys to each.
60
- # Only need the .NET SDK for the versions you have (e.g. just .NET 8 if you only run 2025/2026).
61
- # For a non-default install location, pass -RevitVersion and -RevitApiPath, e.g.:
62
- # ... scripts\deploy.ps1 -RevitVersion 2027 -RevitApiPath "D:\Autodesk\Revit 2027"
63
- powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1
73
+ npm run deploy
64
74
 
65
75
  # 4. Create the workspace and global pi-revit command.
66
- powershell -ExecutionPolicy Bypass -File scripts\setup-workspace.ps1
76
+ npm run setup
67
77
  ```
68
78
 
69
- Start Revit (click **Always Load** on the unsigned add-in prompt once) and open any
70
- project. No panel or ribbon appears — the add-in is headless.
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
+ ```
71
85
 
72
86
  ### Source install
73
87
 
@@ -0,0 +1,95 @@
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 runCmd(title, commandLine) {
30
+ console.log(`\n==> ${title}`);
31
+ // On Windows, npm/pi are usually .cmd shims. Run them through cmd.exe so PATHEXT
32
+ // resolution works from npx's Node process just like it does in PowerShell/CMD.
33
+ const result = spawnSync("cmd.exe", ["/d", "/s", "/c", commandLine], { stdio: "inherit" });
34
+ if (result.error) fail(`${commandLine} could not be started: ${result.error.message}`);
35
+ if (result.status !== 0) process.exit(result.status ?? 1);
36
+ }
37
+
38
+ function runPowerShellScript(scriptName) {
39
+ const scriptPath = path.join(scriptsDir, scriptName);
40
+ if (!fs.existsSync(scriptPath)) fail(`missing script: ${scriptPath}`);
41
+ run(scriptName, "powershell.exe", ["-ExecutionPolicy", "Bypass", "-File", scriptPath]);
42
+ }
43
+
44
+ function revitIsRunning() {
45
+ const result = spawnSync(
46
+ "powershell.exe",
47
+ ["-NoProfile", "-Command", "if (Get-Process Revit -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"],
48
+ { stdio: "ignore" },
49
+ );
50
+ return result.status === 0;
51
+ }
52
+
53
+ function waitForEnter() {
54
+ console.log("\nRevit appears to be running. Close Revit now, then press Enter to continue (or Ctrl+C to cancel).");
55
+ try {
56
+ fs.readSync(0, Buffer.alloc(1), 0, 1);
57
+ } catch {
58
+ // Non-interactive shell: fall through to the second running check.
59
+ }
60
+ }
61
+
62
+ if (process.argv.includes("--help") || process.argv.includes("-h")) {
63
+ usage();
64
+ process.exit(0);
65
+ }
66
+
67
+ if (process.platform !== "win32") {
68
+ fail("pi-revit's Revit bridge installer supports Windows only.");
69
+ }
70
+
71
+ if (!commandExists("pi")) {
72
+ fail("the 'pi' command was not found on PATH. Install Pi first: npm install -g --ignore-scripts @earendil-works/pi-coding-agent");
73
+ }
74
+
75
+ if (!commandExists("dotnet")) {
76
+ fail("the 'dotnet' command was not found on PATH. Install the .NET SDK required by your Revit version.");
77
+ }
78
+
79
+ if (revitIsRunning()) {
80
+ waitForEnter();
81
+ if (revitIsRunning()) fail("Revit is still running. Close Revit and run 'npx -y pi-revit' again.");
82
+ }
83
+
84
+ console.log("pi-revit full installer");
85
+ console.log("This installs the Pi package, deploys the Revit add-in, and creates the workspace/global command.");
86
+
87
+ runCmd("Install the Pi package from npm", "pi install npm:pi-revit");
88
+ runPowerShellScript("deploy.ps1");
89
+ runPowerShellScript("setup-workspace.ps1");
90
+
91
+ console.log("\npi-revit installed.");
92
+ console.log("Next steps:");
93
+ console.log(" 1. Start Revit and click Always Load if prompted.");
94
+ console.log(" 2. Open a project.");
95
+ 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.1",
4
- "description": "Native Pi connector for Autodesk Revit through a headless bridge add-in.",
3
+ "version": "0.1.3",
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"