Skip to content

feat: one-command setup scripts for macOS/Linux and Windows - #27

Open
jcartagenamartinez-legaltech wants to merge 3 commits into
amadad:mainfrom
jcartagenamartinez-legaltech:feat/cross-platform-setup
Open

feat: one-command setup scripts for macOS/Linux and Windows#27
jcartagenamartinez-legaltech wants to merge 3 commits into
amadad:mainfrom
jcartagenamartinez-legaltech:feat/cross-platform-setup

Conversation

@jcartagenamartinez-legaltech

Copy link
Copy Markdown

Summary

Adds scripts/setup.sh (macOS/Linux) and scripts/setup.ps1 (Windows) so a
first-time user gets from git clone to a passing mirofish doctor with a
single command, plus a short "one-command setup" block in the README (the
existing manual steps are unchanged).

Each script:

  1. Verifies uv, offering to install it from astral.sh if missing
    (interactive by default; --yes / -Yes for scripted installs)
  2. Creates .env from .env.example and sets LLM_PROVIDER
    (--provider / -Provider; claude-cli by default, codex-cli supported)
  3. Runs uv sync
  4. Verifies the chosen provider CLI is on PATH, with a login hint for
    first-time claude-cli users (headless -p calls fail before /login)
  5. Runs mirofish doctor as a final health check

The Windows script additionally sets PYTHONUTF8=1 for the session, since
Windows' legacy default code page (cp1252) breaks reading UTF-8 input files.

Relationship to #26

Independent and mergeable in any order. Note that full Windows runtime
support for the claude-cli provider needs the fixes proposed in #26; this
PR covers the install/bootstrap path (and is where a Windows user would first
land).

Testing

  • bash -n clean; script logic mirrors the README's manual steps exactly.
  • setup.ps1 parses clean under Windows PowerShell 5.1 and follows its
    constraints (no && chaining, explicit $LASTEXITCODE checks, BOM-less
    UTF-8 writes).
  • Flow exercised on Windows 11 against a real working tree (uv present,
    .env rewrite, provider detection paths).

🤖 Generated with Claude Code

Adds scripts/setup.sh (macOS/Linux) and scripts/setup.ps1 (Windows)
covering the full first-run path in one command:

1. Verify uv, offering to install it from astral.sh if missing
   (interactive by default; --yes / -Yes for CI or scripted installs)
2. Create .env from .env.example and set LLM_PROVIDER
   (--provider / -Provider, claude-cli by default, codex-cli supported)
3. uv sync
4. Verify the chosen provider CLI is on PATH, with a login hint for
   first-time claude-cli users (headless -p calls fail before /login)
5. Run `mirofish doctor` as a final health check

The Windows script additionally sets PYTHONUTF8=1 for the session,
since Windows' legacy default code page (cp1252) breaks reading
UTF-8 input files; full Windows runtime support for the claude-cli
provider also needs the fixes proposed separately in amadad#26.

README gains a short "one-command setup" block ahead of the existing
manual steps, which remain unchanged.
- Document the ExecutionPolicy Bypass invocation (stock Windows blocks
  .ps1 execution outright — it is the first command the target user
  will run) in both the script header and the README.
- Fail fast with a clear message when stdin is not interactive and
  --yes/-Yes was not passed, instead of dying on EOF at the uv prompt.
- On Windows, explain the known uv sync failure mode (rapidfuzz >=3.14
  without cp312 wheels, fix proposed in amadad#26) and its workaround
  (uv python pin 3.11) instead of a bare "failed".
- Read .env back with the same BOM-less UTF-8 used to write it
  (Get-Content -Raw on PS 5.1 decodes BOM-less files as ANSI and would
  corrupt non-ASCII values on the read-modify-write cycle).
- Gate ANSI colors on a real TTY and honor NO_COLOR; replace the
  fragile grep-the-header --help with an explicit usage() heredoc.
- Show the claude CLI version on Windows too (parity with setup.sh).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@jcartagenamartinez-legaltech

Copy link
Copy Markdown
Author

Pushed a follow-up commit addressing first-run edge cases found in a self-review pass:

  • Documented the powershell -ExecutionPolicy Bypass -File scripts\setup.ps1 invocation (stock Windows blocks .ps1 outright) in the header and README.
  • Non-interactive stdin now fails fast with a hint to use --yes / -Yes instead of dying on EOF at the uv prompt.
  • The Windows uv sync failure path explains the known rapidfuzz cp312 wheel gap (fix proposed in fix: Windows compatibility (claude-cli provider, rapidfuzz wheel) and interview batch timeout #26) and the uv python pin 3.11 workaround.
  • .env is read back with the same BOM-less UTF-8 it is written with (PS 5.1 Get-Content -Raw decodes BOM-less files as ANSI).
  • ANSI colors gated on a TTY + NO_COLOR; --help uses an explicit usage() heredoc; claude version shown on Windows too.

One reviewer note I chose not to adopt: the script intentionally leaves you at the repo root (it is a bootstrap; the printed next step assumes you are there).

Replaces curl|sh and irm|iex with download-to-temp-file-then-execute:
avoids running a partially received stream on connection drops, keeps
an inspectable artifact, and (PowerShell) avoids Invoke-Expression
scope pollution from the installer script.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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