Skip to content

feat: one-command install with eager bundle priming#75

Merged
manojp99 merged 4 commits into
mainfrom
feat/install-script-and-eager-prime
Jun 24, 2026
Merged

feat: one-command install with eager bundle priming#75
manojp99 merged 4 commits into
mainfrom
feat/install-script-and-eager-prime

Conversation

@manojp99

Copy link
Copy Markdown
Collaborator

Summary

Closes the 30-60s "lazy bundle load on first run" gap by:

  1. Adding install.sh — a curl-piped installer that runs uv tool install then primes the bundle cache (amplifier-agent-post-install) in one command.
  2. Wiring amplifier-agent-post-install into the existing amplifier-agent update command so updates re-prime the cache automatically.
  3. Updating the README to document both the one-liner install and the review-first variant.
  4. Adding a CI workflow that shellchecks install.sh and smoke-tests it in a clean container.

The eager-priming infrastructure already existed (amplifier-agent-post-install binary in pyproject.toml, idempotent, always exits 0). This PR just surfaces it where users actually install and update.

Motivation

On a fresh install, amplifier-agent run lazily clones and pip-installs every module in bundle.md on first use. That's 30-60s of opaque waiting on first run. This is a poor first impression — and unnecessary, since amplifier-agent-post-install already exists for exactly this purpose. It was documented in code but not exposed in the install or update flow.

What changes for users

Path Before After
First install uv tool install ... → first run pauses 30-60s curl -fsSL .../install.sh | bash → first run is instant
Update amplifier-agent update → next run pauses 30-60s amplifier-agent update → next run is instant
Manual install Same as before Same as before, plus documented amplifier-agent-post-install step

The --no-prime flag preserves the old behavior for users who want it (CI environments, offline installs).

What's in the PR

install.sh (new)

  • Follows the rustup/deno/bun/fly curl -fsSL ... | bash -s -- convention
  • Resolves latest release via GitHub /releases/latest API — same approach as update.py:50
  • Flags: --tag <ref>, --no-prime, --yes, --help
  • set -euo pipefail, bash 3.2 compatible (macOS floor)
  • Detects uv and prints the official install command if missing — does not silently bootstrap uv
  • Idempotent via uv tool install --reinstall --force
  • Prints install location and uninstall command at end
  • Shellcheck-clean

README.md (updated)

Install section now leads with the one-liner, shows the review-first variant prominently, documents all flags, and includes update + uninstall.

src/amplifier_agent_cli/admin/update.py (3 lines)

After successful uv tool install --reinstall --force, calls amplifier-agent-post-install (idempotent, non-blocking). Echo message guarded to non-JSON output path so --output=json stays clean.

.github/workflows/install-script.yml (new)

  • Shellcheck job
  • Smoke test job: clean python:3.12-slim container → install uv + git + curl → run bash install.sh --no-prime --yes --tag v0.9.0 → verify amplifier-agent --help exits 0
  • Triggers only on changes to install.sh or this workflow

Decisions made (worth review)

  • Default install resolves latest release (not main). Matches update.py behavior. Prereleases (wrapper-v*) are excluded automatically by the /releases/latest endpoint.
  • No --no-prime flag on amplifier-agent update. Keeping the update change to literally 3 lines. Users who really need to skip can set AMPLIFIER_AGENT_HOME or just accept the priming cost.
  • Smoke test uses --no-prime so CI stays fast. The shellcheck job catches portability regressions; the smoke test verifies the install path works end-to-end.
  • Installer refuses to bootstrap uv. Per the one-line-installer-patterns guidance: detect and direct, don't silently install someone else's package manager.
  • Smoke test installs git in the container. uv tool install --from git+... requires git; python:3.12-slim doesn't ship with it.

Not in scope (reviewer can decide if needed)

  • CHANGELOG.md entry — AGENTS.md mentions updating CHANGELOG for user-visible changes. This PR doesn't add one; happy to squash one in if the team enforces it.
  • docs/designs/YYYY-MM-DD-*.md — AGENTS.md mentions design docs for non-trivial changes. This was small and well-discussed in advance; can add a retrospective design doc if preferred.
  • Custom install URL host (e.g., install.amplifier.dev) — using raw.githubusercontent.com/... for now. Custom domain is a separate ops concern.

Verification

  • shellcheck install.sh — clean
  • bash -n install.sh — clean
  • bash install.sh --help — exits 0 with usage
  • python -c "import ast; ast.parse(open('src/amplifier_agent_cli/admin/update.py').read())" — clean
  • CI workflow YAML parses

Test plan post-merge

  1. From a clean machine: curl -fsSL https://raw.githubusercontent.com/microsoft/amplifier-agent/main/install.sh | bash and verify first amplifier-agent run is instant.
  2. From an older version: amplifier-agent update and verify next run is instant.
  3. CI workflow runs green on the PR itself (the workflow triggers on PRs touching install.sh).

Manoj Prabhakar Paidiparthy and others added 4 commits June 23, 2026 17:38
Adds a curl-piped install script that:
- Resolves the latest GitHub release tag via the API (mirrors update.py)
- Runs uv tool install --reinstall --force from the resolved tag
- Primes the bundle cache via amplifier-agent-post-install so first run
  is instant rather than 30-60s slow
- Detects and directs the user to install missing prereqs (curl, uv);
  never silently bootstraps uv
- Supports --tag <ref>, --no-prime, --yes (CI/non-TTY), --help flags
- Bash 3.2 compatible (macOS floor); passes shellcheck with no errors

Follows the one-line-installer-patterns skill conventions (rustup/deno/bun
style): set -euo pipefail, IFS, mktemp-free, idempotent re-run, prints
install location and uninstall command on success.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Rewrites the ## Install section to lead with the one-line curl installer
and surfaces all supported install paths:

- Recommended: curl | bash (installs latest tag, primes bundle cache)
- Review-first: download then inspect before running
- Pin a specific version: --tag v0.9.0
- Manual install: raw uv tool install + amplifier-agent-post-install
- Installer flags table: --tag, --no-prime, --yes, --help
- Update: amplifier-agent update (now also primes cache automatically)
- Uninstall: uv tool uninstall + rm -rf ~/.amplifier-agent

Preserves the note about first-run priming and the amplifier-agent update
command, now cross-referenced to the new install script.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
After a successful uv tool install, runs amplifier-agent-post-install to
prime the bundle cache. This closes the same gap as install.sh for existing
users who upgrade: the first run after an update is now instant rather than
pausing 30-60s on lazy bundle load.

Changes:
- Calls subprocess.run(["amplifier-agent-post-install"], check=False) after
  the install succeeds (subprocess already imported at line 21)
- Prints "Priming bundle cache..." in the human-readable path only, so
  --output json stays machine-readable
- Uses check=False: post-install is idempotent and always exits 0; failures
  log to stderr and never block the update from reporting success

No new flags added; the priming step is intentionally always-on for update
(there is no cost-benefit case for a --no-prime toggle here).

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Adds a dedicated workflow that triggers on changes to install.sh or the
workflow file itself (paths filter on both PR and main push).

Jobs:
  shellcheck — installs shellcheck via apt and validates install.sh; any
    SC warning or error fails the job, ensuring the script stays clean as
    it evolves.

  smoke-test — runs in a clean python:3.12-slim container with no
    pre-installed uv. Installs prereqs (curl, ca-certificates, git) and
    uv via the official astral.sh script, then exercises install.sh with
    --no-prime --yes --tag v0.9.0 (pinned tag keeps test reproducible and
    avoids GitHub API rate limits). Verifies the installed binary by
    running amplifier-agent --help.

Workflow style matches ci.yml: actions/checkout@v4, concurrency cancel
group, timeout-minutes on each job.

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@manojp99 manojp99 merged commit e99c795 into main Jun 24, 2026
4 of 5 checks 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.

1 participant