From bf898b2172449dfc4ddf56ec0b452a5d042557bf Mon Sep 17 00:00:00 2001 From: benwu95 Date: Wed, 8 Jul 2026 01:35:39 +0800 Subject: [PATCH 1/2] feat: compress standalone release binaries and update installer scripts - Package Linux and macOS binaries in .tar.gz archives via release pipeline - Package Windows binary in .zip archive via release pipeline - Update install.sh to download and extract .tar.gz assets - Update install.ps1 to download and extract .zip assets - Sync standalone-binary spec and README installation guides --- .github/workflows/release.yml | 22 +++++++++++++++++-- README.md | 10 ++++----- README.zh-TW.md | 10 ++++----- install.ps1 | 24 ++++++++++++++++++--- install.sh | 13 ++++++++--- prospec/specs/features/standalone-binary.md | 8 +++---- 6 files changed, 65 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2809449..828375e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,17 +16,21 @@ jobs: - os: ubuntu-latest target: bun-linux-x64 output: prospec-linux-x64 + archive: prospec-linux-x64.tar.gz - os: macos-latest target: bun-darwin-arm64 output: prospec-macos-arm64 sign: true + archive: prospec-macos-arm64.tar.gz - os: macos-latest target: bun-darwin-x64 output: prospec-macos-x64 sign: true + archive: prospec-macos-x64.tar.gz - os: windows-latest target: bun-windows-x64 output: prospec-windows-x64.exe + archive: prospec-windows-x64.zip runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 @@ -63,11 +67,25 @@ jobs: if: matrix.os == 'windows-latest' run: .\dist\${{ matrix.output }} --version + - name: Package Binary (Non-Windows) + if: matrix.os != 'windows-latest' + run: | + cp dist/${{ matrix.output }} dist/prospec + tar -czf dist/${{ matrix.archive }} -C dist prospec + rm dist/prospec + + - name: Package Binary (Windows) + if: matrix.os == 'windows-latest' + run: | + Copy-Item dist\${{ matrix.output }} dist\prospec.exe + Compress-Archive -Path dist\prospec.exe -DestinationPath dist\${{ matrix.archive }} + Remove-Item dist\prospec.exe + - name: Upload Artifact uses: actions/upload-artifact@v7 with: - name: ${{ matrix.output }} - path: dist/${{ matrix.output }} + name: ${{ matrix.archive }} + path: dist/${{ matrix.archive }} publish: needs: build diff --git a/README.md b/README.md index 98889c6..034f8b7 100644 --- a/README.md +++ b/README.md @@ -88,12 +88,12 @@ powershell -c "irm https://raw.githubusercontent.com/benwu95/prospec/main/instal Alternatively, download the precompiled binary manually from the [GitHub Releases](https://github.com/benwu95/prospec/releases) page: -- **Linux (x64)**: `prospec-linux-x64` -- **macOS (Apple Silicon)**: `prospec-macos-arm64` -- **macOS (Intel)**: `prospec-macos-x64` -- **Windows (x64)**: `prospec-windows-x64.exe` +- **Linux (x64)**: `prospec-linux-x64.tar.gz` +- **macOS (Apple Silicon)**: `prospec-macos-arm64.tar.gz` +- **macOS (Intel)**: `prospec-macos-x64.tar.gz` +- **Windows (x64)**: `prospec-windows-x64.zip` -(For manual macOS/Linux installation, run `chmod +x prospec--` and move the file to `/usr/local/bin/prospec`). +(For manual installation, extract the `prospec` or `prospec.exe` file from the archive and move it to your executable PATH). **Option B: Run on demand with npx (Node.js environments)** diff --git a/README.zh-TW.md b/README.zh-TW.md index 7d5160b..d12ad54 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -88,12 +88,12 @@ powershell -c "irm https://raw.githubusercontent.com/benwu95/prospec/main/instal 或者,您也可以手動自 [GitHub Releases](https://github.com/benwu95/prospec/releases) 頁面下載適用您平台的二進位檔: -- **Linux (x64)**: `prospec-linux-x64` -- **macOS (Apple Silicon)**: `prospec-macos-arm64` -- **macOS (Intel)**: `prospec-macos-x64` -- **Windows (x64)**: `prospec-windows-x64.exe` +- **Linux (x64)**: `prospec-linux-x64.tar.gz` +- **macOS (Apple Silicon)**: `prospec-macos-arm64.tar.gz` +- **macOS (Intel)**: `prospec-macos-x64.tar.gz` +- **Windows (x64)**: `prospec-windows-x64.zip` -(手動安裝 macOS/Linux 版本時,請執行 `chmod +x prospec--` 並將檔案移動至 `/usr/local/bin/prospec`)。 +(手動安裝時,請自壓縮包中解壓出 `prospec` 或 `prospec.exe` 檔案,並將其移動至您的執行檔 `PATH` 目錄下)。 **選項 B:使用 npx 按需執行(Node.js 環境)** diff --git a/install.ps1 b/install.ps1 index 93fe6e7..6b7c4ef 100644 --- a/install.ps1 +++ b/install.ps1 @@ -2,7 +2,7 @@ $ErrorActionPreference = 'Stop' $Owner = "benwu95" $Repo = "prospec" -$AssetName = "prospec-windows-x64.exe" +$AssetName = "prospec-windows-x64.zip" $InstallDir = "$Home\.prospec\bin" $TargetPath = "$InstallDir\prospec.exe" @@ -13,15 +13,33 @@ if (-not (Test-Path $InstallDir)) { $DownloadUrl = "https://github.com/$Owner/$Repo/releases/latest/download/$AssetName" +# Temporary path for the downloaded zip file +$TempZipPath = Join-Path $env:TEMP "prospec-windows-x64.zip" + Write-Host "Downloading $AssetName from latest release..." try { - # Download the binary file following redirects - Invoke-WebRequest -Uri $DownloadUrl -OutFile $TargetPath -UseBasicParsing + # Download the zip file following redirects + Invoke-WebRequest -Uri $DownloadUrl -OutFile $TempZipPath -UseBasicParsing } catch { Write-Error "Failed to download $AssetName from $DownloadUrl" exit 1 } +Write-Host "Extracting prospec.exe to $InstallDir..." +try { + # Extract the binary from the zip file, forcing overwrite of existing files + Expand-Archive -Path $TempZipPath -DestinationPath $InstallDir -Force +} catch { + Write-Error "Failed to extract prospec.exe from zip file" + Remove-Item $TempZipPath -ErrorAction SilentlyContinue + exit 1 +} finally { + # Clean up temporary zip file + if (Test-Path $TempZipPath) { + Remove-Item $TempZipPath + } +} + Write-Host "Successfully installed prospec.exe to $TargetPath" # Check and update PATH if not present diff --git a/install.sh b/install.sh index 93d19e6..40a81b8 100755 --- a/install.sh +++ b/install.sh @@ -23,13 +23,13 @@ esac # Determine correct asset name if [ "${OS_NAME}" = "macos" ]; then - ASSET_NAME="prospec-macos-${ARCH_NAME}" + ASSET_NAME="prospec-macos-${ARCH_NAME}.tar.gz" else if [ "${ARCH_NAME}" != "x64" ]; then echo "Unsupported Linux architecture: ${ARCH_NAME}. Only x64 is supported." >&2; exit 1 fi - ASSET_NAME="prospec-linux-x64" + ASSET_NAME="prospec-linux-x64.tar.gz" fi DOWNLOAD_URL="https://github.com/${OWNER}/${REPO}/releases/latest/download/${ASSET_NAME}" @@ -53,7 +53,14 @@ fi # Install binary echo "Installing to ${TARGET_PATH}..." -mv "${TEMP_FILE}" "${TARGET_PATH}" +# Extract the binary named "prospec" from the tar.gz into the INSTALL_DIR +if ! tar -xzf "${TEMP_FILE}" -C "${INSTALL_DIR}" prospec; then + echo "Error: Failed to extract binary from ${TEMP_FILE}" >&2 + rm -f "${TEMP_FILE}" + exit 1 +fi + +rm -f "${TEMP_FILE}" chmod +x "${TARGET_PATH}" echo "Successfully installed prospec to ${TARGET_PATH}!" diff --git a/prospec/specs/features/standalone-binary.md b/prospec/specs/features/standalone-binary.md index 6215e81..07dbd4f 100644 --- a/prospec/specs/features/standalone-binary.md +++ b/prospec/specs/features/standalone-binary.md @@ -28,11 +28,11 @@ So that 我不需要在機器上另外安裝 Node.js 就能直接使用 prospec - WHEN 在乾淨無 Node.js 環境的 Linux/macOS/Windows 下執行下載的 `prospec --version`,THEN 成功印出當前版本。 - WHEN 在下游專案目錄下執行 `prospec check`,THEN 可以正常進行漂移稽核並輸出稽核結果。 -#### REQ-CLI-001: Standalone Binary Compilation for Multi-Platform -在 GitHub 發布 Release 時,自動觸發建置管線編譯出 Linux x64、macOS arm64/x64、Windows x64 的 Standalone Binary 獨立執行檔,並完成 macOS 的 codesign。 +#### REQ-CLI-001: Standalone Binary Compilation and Packaging for Multi-Platform +在 GitHub 發布 Release 時,自動觸發建置管線編譯出 Linux x64、macOS arm64/x64、Windows x64 的 Standalone Binary 獨立執行檔,完成 macOS codesign,並將其自動打包壓縮為 `.zip` 或 `.tar.gz` 壓縮包。 **Scenarios:** -- WHEN 發布 Release 後,THEN assets 中包含 prospec-linux-x64、prospec-macos-arm64、prospec-macos-x64、prospec-windows-x64.exe。 +- WHEN 發布 Release 後,THEN assets 中包含 prospec-linux-x64.tar.gz、prospec-macos-arm64.tar.gz、prospec-macos-x64.tar.gz、prospec-windows-x64.zip。 - WHEN 執行 macOS 二進位檔,THEN 已完成 codesign ad-hoc 簽署,能在 macOS 系統下執行。 - WHEN 執行任何二進位檔,THEN 無須外部 Node.js 執行期環境即可單獨執行。 @@ -91,7 +91,7 @@ So that 我不需要在機器上另外安裝 Node.js 就能直接使用 prospec ## Success Criteria -- **SC-1**: GitHub Release 的 assets 中包含 `prospec-linux-x64`、`prospec-macos-arm64`、`prospec-macos-x64`、`prospec-windows-x64.exe` 等獨立執行檔。 +- **SC-1**: GitHub Release 的 assets 中包含 `prospec-linux-x64.tar.gz`、`prospec-macos-arm64.tar.gz`、`prospec-macos-x64.tar.gz`、`prospec-windows-x64.zip` 等壓縮包,解壓後可直接執行。 - **SC-2**: 所有二進位檔無須安裝 any 外部 Node.js 執行期環境即可正常運作。 - **SC-3**: 二進位檔支援呼叫包括 `prospec init`、`prospec check`、`prospec serve` 等現有完整指令,且範本載入運作正常。 From e9616c0ade7fc1931529c12feaa57556a93f2eb0 Mon Sep 17 00:00:00 2001 From: benwu95 Date: Wed, 8 Jul 2026 01:36:31 +0800 Subject: [PATCH 2/2] docs(archive): archive compress-release-binaries and update specs history --- prospec/ai-knowledge/raw-scan.md | 2 +- .../2026-07-08-compress-release-binaries.md | 38 +++++++++++++++++++ prospec/specs/features/standalone-binary.md | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 prospec/specs/_archived-history/2026-07-08-compress-release-binaries.md diff --git a/prospec/ai-knowledge/raw-scan.md b/prospec/ai-knowledge/raw-scan.md index 1da8c7d..c1d6e48 100644 --- a/prospec/ai-knowledge/raw-scan.md +++ b/prospec/ai-knowledge/raw-scan.md @@ -106,5 +106,5 @@ tests/ | Metric | Value | |--------|-------| -| Total files | 395 | +| Total files | 396 | | Scan depth | 10 | diff --git a/prospec/specs/_archived-history/2026-07-08-compress-release-binaries.md b/prospec/specs/_archived-history/2026-07-08-compress-release-binaries.md new file mode 100644 index 0000000..aa982bf --- /dev/null +++ b/prospec/specs/_archived-history/2026-07-08-compress-release-binaries.md @@ -0,0 +1,38 @@ +# compress-release-binaries — Archive Summary + +- **Archived**: 2026-07-08 +- **Original Created**: 2026-07-08T01:02:00+08:00 +- **Quality Grade**: S + +## User Story + +As a Prospec 發行維護者, +I want 在 GitHub Release 時自動將二進位檔進行壓縮打包後再行上傳, +So that 能夠降低分發時的網路資源開銷。 + +As a 下游專案開發者, +I want 使用一鍵安裝腳本,讓系統自動下載適用於我平台的壓縮包並解壓安裝, +So that 我能以最少的時間與頻寬完成 prospec 的安裝。 + +## Affected Modules + +| Module | Impact | Description | +|--------|--------|-------------| +| (none) | - | CI/CD 與安裝腳本等 Tooling 變更,不影響 TypeScript 模組原始碼。 | + +## Requirements + +| REQ ID | Status | Description | +|--------|--------|-------------| +| REQ-CLI-001 | MODIFIED | Standalone Binary 編譯並封裝成壓縮檔 (.zip / .tar.gz) | + +## Completion + +- **Tasks**: 6/6 (100%) +- **Acceptance Criteria**: 4/4 + +## Review & Verify + +- **Review**: 1 round, 0 critical / 0 major — review-clean +- **Verify**: Grade S, Tasks PASS, Spec not-applicable, Constitution PASS, Knowledge PASS, Tests PASS; Vitest suite green (2096/2096 passed) +- **Quality Log**: no WARN/FAIL diff --git a/prospec/specs/features/standalone-binary.md b/prospec/specs/features/standalone-binary.md index 07dbd4f..381a1b2 100644 --- a/prospec/specs/features/standalone-binary.md +++ b/prospec/specs/features/standalone-binary.md @@ -112,3 +112,4 @@ _(None)_ |------|--------|--------|-------------| | 2026-07-07 | compile-standalone-binary | Implement standalone binary compilation and publish pipeline | US-1, REQ-CLI-001, REQ-LIB-001, REQ-TYPES-001, REQ-DOCS-001 | | 2026-07-08 | cli-print-template | Add print-template CLI subcommand and service to support Node.js-free template resolution in prospec-upgrade skill | US-1, REQ-CLI-020, REQ-SERVICES-015, REQ-TEMPLATES-005, REQ-LIB-008 | +| 2026-07-08 | compress-release-binaries | Package binaries in .zip and .tar.gz archives and update installers | REQ-CLI-001 |