-
Notifications
You must be signed in to change notification settings - Fork 0
Add Windows PowerShell installer #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $GitHubRepo = "cloneisyou/clone-loop" | ||
| $MarketplaceName = "clone-loop" | ||
| $PluginRef = "clone-labs@clone-loop" | ||
|
|
||
| $ClaudeCommand = Get-Command claude.exe -ErrorAction SilentlyContinue | ||
| if (-not $ClaudeCommand) { | ||
| $ClaudeCommand = Get-Command claude -ErrorAction SilentlyContinue | ||
| } | ||
|
|
||
| if (-not $ClaudeCommand) { | ||
| Write-Error "Clone install failed: Claude Code CLI was not found on PATH. Install Claude Code, then rerun this installer." | ||
| exit 1 | ||
| } | ||
|
|
||
| $ClaudeBin = $ClaudeCommand.Source | ||
| Write-Host "Installing Clone with $ClaudeBin..." | ||
|
|
||
| & $ClaudeBin plugin marketplace add "$GitHubRepo@main" | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Host "Marketplace add did not complete; refreshing $MarketplaceName if it already exists." | ||
| & $ClaudeBin plugin marketplace update $MarketplaceName | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Clone install failed: could not add or update the $MarketplaceName marketplace." | ||
| exit 1 | ||
| } | ||
| } | ||
|
|
||
| & $ClaudeBin plugin install $PluginRef --scope user | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Host "Install did not complete; trying plugin update for an existing install." | ||
| & $ClaudeBin plugin update $PluginRef | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Error "Clone install failed: could not install or update $PluginRef." | ||
| exit 1 | ||
| } | ||
| } | ||
|
Comment on lines
+17
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In PowerShell, executing a We can execute |
||
|
|
||
| Write-Host "" | ||
| $GhCommand = Get-Command gh -ErrorAction SilentlyContinue | ||
| if ($GhCommand) { | ||
| $PreviousErrorActionPreference = $ErrorActionPreference | ||
| $ErrorActionPreference = "Continue" | ||
| try { | ||
| & $GhCommand.Source repo star $GitHubRepo *> $null | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| $StarExitCode = $LASTEXITCODE | ||
| } catch { | ||
| $StarExitCode = 1 | ||
| } finally { | ||
| $ErrorActionPreference = $PreviousErrorActionPreference | ||
| } | ||
|
|
||
| if ($StarExitCode -eq 0) { | ||
| Write-Host "Starred $GitHubRepo." | ||
| } else { | ||
| Write-Host "Could not star automatically. Check GitHub CLI authentication with: gh auth status" | ||
| } | ||
| } else { | ||
| Write-Host "Skipping GitHub star because GitHub CLI is not installed." | ||
| } | ||
|
|
||
| Write-Host "" | ||
| Write-Host "Clone is installed." | ||
| Write-Host "" | ||
| Write-Host "Open your agent and paste:" | ||
| Write-Host '/clone:loop "Run tests and fix any failures" --max-iterations 5' | ||
| Write-Host "" | ||
| Write-Host "Optional API key setup:" | ||
| Write-Host "/clone:api-key status" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
exitin a script executed viaInvoke-Expression(iex) or dot-sourcing will terminate the entire PowerShell process, closing the user's terminal window. This is a poor user experience if the CLI is not found.Additionally, since
$ErrorActionPreference = "Stop"is set, callingWrite-Errorwill throw a terminating exception with a noisy stack trace. UsingWrite-Hostwith-ForegroundColor Redfollowed byreturnprovides a much cleaner, user-friendly error message and exits the script gracefully without closing the terminal.