@@ -81,15 +81,40 @@ function Install-Node {
8181 exit 1
8282}
8383
84+ # Check for existing Clawdbot installation
85+ function Check-ExistingClawdbot {
86+ try {
87+ $null = Get-Command clawdbot - ErrorAction Stop
88+ Write-Host " → Existing Clawdbot installation detected" - ForegroundColor Yellow
89+ return $true
90+ } catch {
91+ return $false
92+ }
93+ }
94+
8495# Install Clawdbot
8596function Install-Clawdbot {
8697 Write-Host " → Installing Clawdbot..." - ForegroundColor Yellow
8798 npm install - g clawdbot@latest
8899 Write-Host " ✓ Clawdbot installed" - ForegroundColor Green
89100}
90101
102+ # Run doctor for migrations (safe, non-interactive)
103+ function Run-Doctor {
104+ Write-Host " → Running doctor to migrate settings..." - ForegroundColor Yellow
105+ try {
106+ clawdbot doctor -- non- interactive
107+ } catch {
108+ # Ignore errors from doctor
109+ }
110+ Write-Host " ✓ Migration complete" - ForegroundColor Green
111+ }
112+
91113# Main installation flow
92114function Main {
115+ # Check for existing installation
116+ $isUpgrade = Check- ExistingClawdbot
117+
93118 # Step 1: Node.js
94119 if (-not (Check- Node)) {
95120 Install-Node
@@ -106,18 +131,30 @@ function Main {
106131 # Step 2: Clawdbot
107132 Install-Clawdbot
108133
134+ # Step 3: Run doctor for migrations if upgrading
135+ if ($isUpgrade ) {
136+ Run- Doctor
137+ }
138+
109139 Write-Host " "
110140 Write-Host " 🦞 Clawdbot installed successfully!" - ForegroundColor Green
111141 Write-Host " "
112- Write-Host " Run " - NoNewline
113- Write-Host " clawdbot onboard" - ForegroundColor Cyan - NoNewline
114- Write-Host " to set up your assistant."
115- Write-Host " "
116142
117- # Ask to run onboard
118- $response = Read-Host " Start setup now? [Y/n]"
119- if ($response -eq " " -or $response -eq " Y" -or $response -eq " y" ) {
120- clawdbot onboard
143+ if ($isUpgrade ) {
144+ Write-Host " Upgrade complete. Run " - NoNewline
145+ Write-Host " clawdbot doctor" - ForegroundColor Cyan - NoNewline
146+ Write-Host " to check for additional migrations."
147+ } else {
148+ Write-Host " Run " - NoNewline
149+ Write-Host " clawdbot onboard" - ForegroundColor Cyan - NoNewline
150+ Write-Host " to set up your assistant."
151+ Write-Host " "
152+
153+ # Ask to run onboard (new installs only)
154+ $response = Read-Host " Start setup now? [Y/n]"
155+ if ($response -eq " " -or $response -eq " Y" -or $response -eq " y" ) {
156+ clawdbot onboard
157+ }
121158 }
122159}
123160
0 commit comments