Skip to content

Instantly share code, notes, and snippets.

@baaamn
Created April 3, 2026 01:03
Show Gist options
  • Select an option

  • Save baaamn/a325708d22efad31ea7338d7cb9346e9 to your computer and use it in GitHub Desktop.

Select an option

Save baaamn/a325708d22efad31ea7338d7cb9346e9 to your computer and use it in GitHub Desktop.
promptext-install-robust.ps1: A safer “download then run” wrapper for the upstream scripts/install.ps1 installer. Avoids irm ... | iex, downloads the installer from raw.githubusercontent.com, then runs it with -ExecutionPolicy Bypass in a child PowerShell process.
# Filename: Promptext-Install.ps1
<#
.SYNOPSIS
Robust installer for the promptext CLI on Windows (PowerShell) using a download-then-run workflow.
.DESCRIPTION
This script installs the promptext CLI by downloading the official installer script directly from the
promptext GitHub repository (via raw.githubusercontent.com) into a temporary file, then executing it.
Why this exists:
- Avoids piping remote content directly into iex ("irm ... | iex"), which many users/orgs disallow.
- Makes the install process easier to audit and troubleshoot (the downloaded script is a real file).
- Uses dynamic paths ($env:TEMP, $env:USERPROFILE) rather than hard-coded locations.
The upstream installer performs the actual work:
- Detects architecture
- Fetches the latest GitHub release
- Downloads the appropriate asset
- Updates PATH and adds the 'prx' alias (per upstream script behavior)
.PARAMETER Branch
Git branch name to fetch the installer from (default: "main").
Change this to "master" if the repo uses that as the default branch.
.PARAMETER Version
Version selector passed through to the upstream installer (default: "latest").
Note: This parameter is accepted for forward-compatibility; the upstream installer may or may not honor it.
.EXAMPLE
# Install from the default branch ("main") using the upstream defaults
powershell -ExecutionPolicy Bypass -File .\promptext-install-robust.ps1
.EXAMPLE
# Install from a different branch (e.g., master)
powershell -ExecutionPolicy Bypass -File .\promptext-install-robust.ps1 -Branch master
.NOTES
v1.0
- Robust "download then execute" wrapper around the upstream installer:
https://raw.githubusercontent.com/1broseidon/promptext/<branch>/scripts/install.ps1
Security note:
- Always review scripts before running them in sensitive environments.
#>
#Requires -Version 5.1
[CmdletBinding()]
param(
[Parameter()]
[string]$Branch = "main",
[Parameter()]
[string]$Version = "latest"
)
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
# --- Configuration (kept explicit for clarity) ---
$Owner = "1broseidon"
$Repo = "promptext"
$PathInRepo = "scripts/install.ps1"
# Build raw GitHub URL dynamically (no promptext.sh dependency)
$InstallerUrl = "https://raw.githubusercontent.com/$Owner/$Repo/$Branch/$PathInRepo"
# Create a temp file path for the downloaded installer
$TempInstaller = Join-Path $env:TEMP "promptext-install.ps1"
Write-Host "→ Downloading upstream installer..." -ForegroundColor Blue
Write-Host " URL: $InstallerUrl" -ForegroundColor DarkGray
Write-Host " File: $TempInstaller" -ForegroundColor DarkGray
# Download upstream installer to disk
Invoke-WebRequest -Uri $InstallerUrl -OutFile $TempInstaller -UseBasicParsing
Write-Host "→ Executing upstream installer..." -ForegroundColor Blue
# Execute the downloaded installer.
# Pass -Version through (if/when upstream supports it).
& powershell -NoProfile -ExecutionPolicy Bypass -File $TempInstaller -Version $Version
Write-Host "→ Done." -ForegroundColor Green
@baaamn

baaamn commented Apr 3, 2026

Copy link
Copy Markdown
Author

Verify Installation

promptext --version

# or use the alias

prx --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment