Skip to content

fix: #7 — feat(install): one-line install.sh#18

Merged
MiaoDX merged 1 commit into
mainfrom
claude-issue-7
May 2, 2026
Merged

fix: #7 — feat(install): one-line install.sh#18
MiaoDX merged 1 commit into
mainfrom
claude-issue-7

Conversation

@MiaoDX

@MiaoDX MiaoDX commented May 2, 2026

Copy link
Copy Markdown
Owner

Closes #7.

Adds the install.sh one-shot installer plus an end-to-end Go test
harness that exercises it against a fake release tarball — no network
required in CI.

What's in this PR

  • install.sh — POSIX bash. Detects OS (darwin/linux) and arch
    (arm64/x86_64), downloads the matching scripture-mcp release
    tarball from https://github.com/MiaoDX/verse-driven/releases/download/<tag>/scripture-mcp-<tag>-<os>-<arch>.tar.gz,
    unpacks it, and installs to ~/.local/bin/scripture-mcp (overridable
    with --prefix). Re-running overwrites the binary in place — that's
    the upgrade path. After install, it detects claude and codex on
    $PATH and runs scripture-mcp init --target=<agent> for each (which
    is already idempotent on configs via PR fix: #4 — feat(core): stdio MCP server + CLI subcommands #14's marker-fenced splice).
  • --uninstall reverses both halves: init --uninstall for each
    detected agent, then removes the binary.
  • Convenience flags: --no-wire installs the binary only;
    --yes/-y auto-confirms; --version <tag> pins a release;
    --from-archive <path> bypasses the network and unpacks a local
    tarball — used by the test harness, also handy for air-gapped
    installs or behind a corporate proxy. Env overrides
    RELEASE_BASE_URL / LATEST_RELEASE_URL exist for advanced cases.
  • Prompting under curl | bash: prompt_yes reads from /dev/tty
    when stdin is the curl pipe, so the y/n confirmation actually reaches
    the user. When neither stdin nor /dev/tty is a terminal (CI, fully
    automated runs), it defaults to yes — --yes makes that explicit.
  • internal/installer/install_test.go — Go tests that build the
    real scripture-mcp binary, pack it into a .tar.gz, then drive
    install.sh against a sandboxed HOME and a stubbed PATH.
    Covered:
    • --help surface lists all the documented flags.
    • Unknown flag → exit 2.
    • End-to-end three-phase cycle: fresh install + wire (asserts binary
      is executable, both ~/.claude/settings.json and
      ~/.codex/config.toml gain the >>> verse-driven block) → re-run
      (asserts "already up to date" for both configs and binary still
      present, i.e. idempotent) → --uninstall (asserts binary removed
      and snippets stripped).
    • No-agents case: missing claude/codex still installs the binary
      and reports "no supported agents detected".
    • --no-wire skips agent wiring even when both are on $PATH.
    • Missing --from-archive file fails fast with a clear diagnostic.
  • README — replaces the prior "Install (planned)" section with a
    real one centered on install.sh, drops the speculative brew
    line per the issue's note.

Acceptance-criteria mapping

  • install.sh detects OS/arch, downloads the right binary release, places it on PATH (warns when $PREFIX isn't on $PATH)
  • Detects which agents are installed (claude / codex on PATH) and offers to wire each
  • Calls scripture-mcp init --target=... per detected agent
  • Re-running upgrades the binary and is idempotent on configs (asserted by TestInstallEndToEnd phase 2)
  • Uninstall path: scripture-mcp init --uninstall --target=... removes the snippets — both surfaced directly via init and bundled into install.sh --uninstall

Verification

  • go test ./... — green across all 9 packages, including 6 new installer tests
  • go vet ./... — clean
  • bash install.sh --help — prints flag table
  • bash install.sh --bogus — exits 2 with "unknown flag" diagnostic
  • End-to-end smoke (replicated by TestInstallEndToEnd):
    1. Build scripture-mcp and pack into /tmp/scripture-mcp.tar.gz.
    2. HOME=/tmp/h PATH=/tmp/agents:... bash install.sh --from-archive /tmp/scripture-mcp.tar.gz --prefix /tmp/bin --yes
      → installs /tmp/bin/scripture-mcp, splices the verse-driven block into both ~/.claude/settings.json and ~/.codex/config.toml.
    3. Re-running prints "already up to date" for both configs.
    4. bash install.sh --prefix /tmp/bin --uninstall strips the snippets and removes the binary.

Generated by Claude Code

…iring

Closes #7.

- install.sh detects OS (darwin/linux) and arch (arm64/x86_64),
  downloads the matching scripture-mcp release tarball, and installs
  the binary to ~/.local/bin (overridable with --prefix). Re-running
  overwrites the binary in place — that's the upgrade path.
- After install, it detects which coding agents are on $PATH (claude,
  codex), prompts (via /dev/tty so the prompt still works under
  curl|bash), and calls 'scripture-mcp init --target=<agent>' for
  each. init is already idempotent on configs (PR #14's marker-fenced
  splice).
- --uninstall reverses both halves: 'init --uninstall' for each
  detected agent, then removes the binary.
- --no-wire installs the binary only; --yes auto-confirms; --version
  pins a release tag; --from-archive bypasses the network and unpacks
  a local tarball (used by the test harness, also handy for air-
  gapped installs).

Tests live in internal/installer/install_test.go: they build the real
scripture-mcp, pack it into a tarball, then drive install.sh through
fresh-install, idempotent re-run, and uninstall against a sandboxed
HOME and a stubbed PATH. Covered: --help surface, unknown-flag exit,
no-agents case, --no-wire, missing archive.

README's Install section is rewritten around install.sh (was
'planned'); the brew line is removed per the issue's note.
@MiaoDX MiaoDX marked this pull request as ready for review May 2, 2026 04:25
@MiaoDX MiaoDX merged commit 05377d7 into main May 2, 2026
1 check passed
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.

feat(install): one-line install.sh

2 participants