Skip to content

feat(install): add curl installer script and fix homebrew formula publish#65

Merged
amondnet merged 3 commits into
mainfrom
amondnet/install-script
Jul 1, 2026
Merged

feat(install): add curl installer script and fix homebrew formula publish#65
amondnet merged 3 commits into
mainfrom
amondnet/install-script

Conversation

@amondnet

@amondnet amondnet commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

요약

패키지 매니저 없이 csp를 설치하는 curl 설치 스크립트를 추가하고, Homebrew formula가 tap에 한 번도 발행되지 않던 버그를 수정합니다.

변경 사항

1. scripts/install.sh (신규)

GitHub 릴리스에서 플랫폼별 독립 실행 바이너리를 내려받아 체크섬 검증 후 설치하는 auth-free 설치 스크립트입니다. pleaseai/gh-pleasescripts/install.sh 컨벤션을 따릅니다.

curl -fsSL https://raw.githubusercontent.com/pleaseai/code-search/main/scripts/install.sh | bash
  • OS/아키텍처 감지: darwin/linux × x64/arm64
  • musl(Alpine) 감지 → csp-linux-x64-musl 선택 (arm64+musl은 미발행이므로 명확히 실패)
  • releases/latest 리다이렉트로 최신 태그 해석 (GitHub API 레이트 리밋 회피)
  • 자산별 .sha256 파일로 체크섬 검증 (fail-closed)
  • ~/.local/bin 설치 (CSP_INSTALL_DIR로 변경, --version으로 버전 고정)
  • Windows는 brew/npm/.exe로 안내
  • 실제 v0.1.7 릴리스로 다운로드→검증→설치→실행 전 과정 검증 완료

2. release-please.yml — Homebrew formula 발행 버그 수정

brew install pleaseai/tap/cspNo available formula 오류로 실패하던 근본 원인입니다.

update-homebrew-formula 잡이 git diff --quiet csp.rb로 변경 여부를 판정했는데, untracked 파일(최초에 tap에 csp.rb가 없던 상태)은 git diff가 무시하므로 항상 "No changes"로 판정되어 커밋을 건너뛰었습니다. 결과적으로 formula가 한 번도 tap에 발행되지 않았습니다. git addgit diff --cached로 스테이징된 diff를 판정하도록 수정했습니다.

3. README.md / README.ko.md

curl 설치 방법을 문서화 (양쪽 동기화).

즉시 조치 (이 PR과 별개로 완료)

v0.1.7용 csp.rb를 실제 체크섬으로 생성해 pleaseai/homebrew-tap에 직접 발행했습니다. brew install pleaseai/tap/csp (0.1.7) 설치·실행을 로컬에서 검증했습니다. 워크플로 수정은 다음 릴리스부터 자동 적용됩니다.

테스트

  • bash -n scripts/install.sh 통과
  • 실 릴리스(v0.1.7) 대상 설치 스크립트 E2E 검증
  • brew install pleaseai/tap/cspcsp 0.1.7 검증

Summary by cubic

Adds a curl-based installer for csp so users can install without a package manager, and fixes the Homebrew workflow so the formula publishes to the tap on first run. Installer messages now go to stderr to keep stdout clean for piping.

  • New Features

    • Added scripts/install.sh to download the standalone csp binary from GitHub Releases, verify SHA-256, and install to ~/.local/bin (override with CSP_INSTALL_DIR; pin with --version).
    • Detects darwin/linux on x64/arm64, handles musl (Alpine) via csp-linux-x64-musl, and resolves the latest tag via releases/latest; documented in README.md and README.ko.md.
  • Bug Fixes

    • Homebrew: stage csp.rb and use git diff --cached in release-please.yml so untracked files are committed, publishing the formula to pleaseai/homebrew-tap on first run.
    • Installer: adjust PATH hint quoting to satisfy ShellCheck SC2016 while keeping a literal $PATH in the message (no behavior change).

Written for commit 62c7cd3. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Added a standalone curl | bash installer for downloading the platform-specific binary from release artifacts.
    • Includes checksum verification and installs to ~/.local/bin by default, with CSP_INSTALL_DIR for a custom install path.
    • Supports installing a pinned release via --version and provides helpful --help/argument handling.
  • Documentation

    • Updated Quickstart instructions in both English and Korean to describe the new standalone installer option and clarify runtime/path expectations.

…lish

- scripts/install.sh: 패키지 매니저 없이 GitHub 릴리스에서 플랫폼별 독립 실행
  바이너리를 내려받아 체크섬 검증 후 설치 (musl/Alpine 감지, 버전 고정 지원)
- release-please.yml: homebrew formula 발행 버그 수정. csp.rb가 tap에 없던
  최초 실행에서 'git diff --quiet'가 untracked 파일을 무시해 커밋을 건너뛰어
  formula가 한 번도 발행되지 않았음. 스테이징 후 --cached 로 판정하도록 수정
- README.md / README.ko.md: curl 설치 방법 문서화
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Bash installer for the csp binary, updates English and Korean install docs, and changes the Homebrew formula workflow to check staged diffs before committing.

Changes

Standalone Installer Script and Docs

Layer / File(s) Summary
Script scaffolding, output helpers, and platform detection
scripts/install.sh
Adds shell strict mode, color/output helpers, temp directory lifecycle, musl detection, and OS/arch-to-asset mapping with Windows rejection.
Release resolution, checksum verification, and install flow
scripts/install.sh
Resolves the latest release tag via redirect, downloads binary and checksum file, verifies SHA-256, installs to CSP_INSTALL_DIR, warns if not on PATH, parses --version/--help, and cleans up via an EXIT trap.
README install documentation updates
README.md, README.ko.md
Documents the new curl | bash standalone install path alongside existing package manager commands, with CSP_INSTALL_DIR and version pinning details.

Homebrew Formula Change Detection Fix

Layer / File(s) Summary
Stage csp.rb before diff check
.github/workflows/release-please.yml
Stages csp.rb with git add and checks git diff --cached --quiet before deciding whether to exit early.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • pleaseai/code-search#46: Also changes update-homebrew-formula logic in .github/workflows/release-please.yml, so it touches the same workflow path and release automation.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: adding the curl installer script and fixing Homebrew formula publishing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch amondnet/install-script

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist

Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a curl | bash installer script for the csp binary and fixes the bug that prevented the Homebrew formula from ever being published to the tap.

  • scripts/install.sh: New auth-free installer that detects OS/arch (darwin/linux × x64/arm64, musl/Alpine), resolves the latest release via the releases/latest redirect, downloads the platform binary with SHA-256 checksum verification, installs to ~/.local/bin (overridable via CSP_INSTALL_DIR), and routes all human-readable output to stderr so stdout stays clean for piping.
  • release-please.yml: Fixes the first-run Homebrew publish bug — git diff --quiet csp.rb silently ignored untracked files, so the formula was never committed. Moving git add csp.rb before the check and switching to git diff --cached --quiet correctly detects the new file on first run while still no-op-ing on unchanged re-runs.

Confidence Score: 5/5

Safe to merge — the installer script is well-guarded and the workflow fix is a targeted, correct one-line-order change.

The Homebrew fix is minimal and correct: staging before diffing is the right approach, and it no-ops cleanly on unchanged re-runs. The installer script follows standard conventions — HTTPS downloads, SHA-256 verification, stderr-only output, proper cleanup via EXIT trap, and explicit platform/musl guards. No pre-existing behavior is broken.

No files require special attention.

Important Files Changed

Filename Overview
scripts/install.sh New installer script; well-structured with proper error handling, SHA-256 verification, musl detection, and stderr-only human output. No bugs found.
.github/workflows/release-please.yml Fixes the Homebrew first-run publish bug by staging csp.rb before the diff check; logic is correct and no-ops cleanly on unchanged re-runs.
README.md Adds curl installer to the quickstart section; documentation is accurate and consistent with the script's actual behavior.
README.ko.md Korean README updated in sync with README.md; no issues.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant Script as install.sh
    participant GH as GitHub (releases/latest)
    participant CDN as GitHub Release CDN

    User->>Script: "curl -fsSL .../install.sh | bash"
    Script->>Script: detect OS/arch (uname, musl check)
    Script->>GH: GET /releases/latest (no -L, captures redirect_url)
    GH-->>Script: 302 → /releases/tag/vX.Y.Z
    Script->>Script: resolve tag from redirect_url
    Script->>CDN: "GET /download/{tag}/{asset}"
    CDN-->>Script: binary
    Script->>CDN: "GET /download/{tag}/{asset}.sha256"
    CDN-->>Script: checksum file
    Script->>Script: "sha256_of(binary) == expected?"
    alt checksum OK
        Script->>Script: install -m 0755 binary → ~/.local/bin/csp
        Script-->>User: ✓ Installed (stderr)
    else checksum mismatch
        Script-->>User: ✗ Checksum mismatch — abort (stderr)
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant Script as install.sh
    participant GH as GitHub (releases/latest)
    participant CDN as GitHub Release CDN

    User->>Script: "curl -fsSL .../install.sh | bash"
    Script->>Script: detect OS/arch (uname, musl check)
    Script->>GH: GET /releases/latest (no -L, captures redirect_url)
    GH-->>Script: 302 → /releases/tag/vX.Y.Z
    Script->>Script: resolve tag from redirect_url
    Script->>CDN: "GET /download/{tag}/{asset}"
    CDN-->>Script: binary
    Script->>CDN: "GET /download/{tag}/{asset}.sha256"
    CDN-->>Script: checksum file
    Script->>Script: "sha256_of(binary) == expected?"
    alt checksum OK
        Script->>Script: install -m 0755 binary → ~/.local/bin/csp
        Script-->>User: ✓ Installed (stderr)
    else checksum mismatch
        Script-->>User: ✗ Checksum mismatch — abort (stderr)
    end
Loading

Reviews (3): Last reviewed commit: "chore: apply AI code review suggestions" | Re-trigger Greptile

Comment thread scripts/install.sh
@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 5 untouched benchmarks


Comparing amondnet/install-script (62c7cd3) with main (a226b05)

Open in CodSpeed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/install.sh (1)

108-110: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add basic retry/timeout flags to the curl calls.

Line 110 and Lines 194-197 still fail on transient GitHub/CDN hiccups with no retry/backoff or connection timeout, which makes Docker builds and first-run installs needlessly flaky.

Suggested patch
+readonly CURL_RETRY_OPTS=(--retry 3 --retry-delay 1 --connect-timeout 10)
+
 resolve_latest_tag() {
   local redirect
-  redirect="$(curl -fsS -o /dev/null -w '%{redirect_url}' "${RELEASES_URL}/latest" || true)"
+  redirect="$(curl -fsS "${CURL_RETRY_OPTS[@]}" -o /dev/null -w '%{redirect_url}' "${RELEASES_URL}/latest" || true)"
   [[ -n "$redirect" ]] || die "Could not resolve the latest release tag from ${RELEASES_URL}/latest"
   printf '%s' "${redirect##*/tag/}"
 }
@@
-  curl -fsSL -o "$binary" "${base}/${asset}" \
+  curl -fsSL "${CURL_RETRY_OPTS[@]}" -o "$binary" "${base}/${asset}" \
     || die "Failed to download ${base}/${asset} (does release ${tag} have a ${asset} binary?)."
-  curl -fsSL -o "$checksum" "${base}/${asset}.sha256" \
+  curl -fsSL "${CURL_RETRY_OPTS[@]}" -o "$checksum" "${base}/${asset}.sha256" \
     || die "Failed to download checksum from ${base}/${asset}.sha256"

Also applies to: 194-197

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 108 - 110, The curl calls in
resolve_latest_tag and the later download/checksum paths still have no retry,
backoff, or connection timeout, which makes transient network failures break
installs. Update the curl invocations in these scripts to include basic retry
and timeout flags consistently, using the existing resolve_latest_tag function
and the download logic around the later curl calls as the fix points. Keep the
behavior the same otherwise, just make the network requests more resilient to
temporary GitHub/CDN hiccups.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/install.sh`:
- Around line 108-110: The curl calls in resolve_latest_tag and the later
download/checksum paths still have no retry, backoff, or connection timeout,
which makes transient network failures break installs. Update the curl
invocations in these scripts to include basic retry and timeout flags
consistently, using the existing resolve_latest_tag function and the download
logic around the later curl calls as the fix points. Keep the behavior the same
otherwise, just make the network requests more resilient to temporary GitHub/CDN
hiccups.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c76b5413-d42d-441e-9961-7555d10b4113

📥 Commits

Reviewing files that changed from the base of the PR and between 57fb53c and 16fe2f5.

📒 Files selected for processing (4)
  • .github/workflows/release-please.yml
  • README.ko.md
  • README.md
  • scripts/install.sh

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Architecture diagram
sequenceDiagram
    participant User as User Terminal
    participant Curl as curl
    participant InstallScript as install.sh Script
    participant GitHub as GitHub Releases
    participant LocalFS as Local Filesystem (~/.local/bin)
    participant Brew as Homebrew (system)
    participant BrewTap as pleaseai/homebrew-tap Repo
    participant CI as GitHub Actions (release-please.yml)

    Note over User,Brew: Two independent install paths

    rect rgb(240, 240, 240)
        Note over User,LocalFS: Path A: curl installer (scripts/install.sh)
        User->>Curl: curl -fsSL .../install.sh | bash
        Curl-->>InstallScript: pipe script to bash
        InstallScript->>InstallScript: detect_asset() → os/arch/musl
        InstallScript->>GitHub: GET /releases/latest (redirect)
        GitHub-->>InstallScript: redirect_url → latest tag
        InstallScript->>GitHub: GET /download/{tag}/{asset}
        GitHub-->>InstallScript: binary blob
        InstallScript->>GitHub: GET /download/{tag}/{asset}.sha256
        GitHub-->>InstallScript: checksum file
        InstallScript->>InstallScript: sha256_of(binary) vs expected
        alt Checksum mismatch
            InstallScript-->>User: die: checksum mismatch
        else Checksum valid
            InstallScript->>LocalFS: install -m 0755 binary → ~/.local/bin/csp
            InstallScript->>InstallScript: warn_if_not_on_path()
            InstallScript-->>User: ✓ Installed csp
        end
    end

    rect rgb(240, 240, 240)
        Note over CI,BrewTap: Path B: Homebrew formula publish (release-please.yml)
        CI->>CI: git add csp.rb
        CI->>CI: git diff --cached --quiet
        alt No staged changes
            CI->>CI: exit 0 (no commit)
        else Staged changes exist
            CI->>CI: git commit -m "chore: update csp to {VERSION}"
            CI->>BrewTap: git push origin main
            BrewTap-->>CI: formula published
            Note over BrewTap,Brew: Later, user runs:
            User->>Brew: brew install pleaseai/tap/csp
            Brew->>BrewTap: fetch csp.rb formula
            BrewTap-->>Brew: formula content
            Brew->>GitHub: download binary from release
            GitHub-->>Brew: binary
            Brew-->>User: csp 0.1.7 installed
        end
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/install.sh
install.sh: route info/ok 메시지도 stderr로 보내 stdout을 깨끗하게 유지하고,
색상 가드(-t 2)가 실제 출력 스트림(stderr)과 일치하도록 정리
(greptile/cubic 리뷰 반영)

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/install.sh`:
- Line 149: The install script’s PATH export message is triggering ShellCheck
SC2016 because the format string is single-quoted while intentionally containing
a literal $PATH. Update the printf call in the install script’s PATH-printing
block to use a double-quoted format with an escaped $PATH so the user still sees
the same export command and the lint warning is avoided.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 27f9fc2b-625f-45cf-809a-9c243dd797bc

📥 Commits

Reviewing files that changed from the base of the PR and between 16fe2f5 and b4ec663.

📒 Files selected for processing (1)
  • scripts/install.sh

Comment thread scripts/install.sh Outdated
install.sh: PATH 안내 printf를 이스케이프된 이중 따옴표 포맷으로 바꿔
ShellCheck SC2016 경고 제거 (출력은 동일, 리터럴 $PATH 유지) — coderabbit 반영
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@amondnet
amondnet merged commit e232d71 into main Jul 1, 2026
12 checks passed
@amondnet
amondnet deleted the amondnet/install-script branch July 1, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant