From 2c19a8fd23fd0dacd292dfd4c9c8b1a78d079101 Mon Sep 17 00:00:00 2001 From: Exe Zulliger Date: Thu, 9 Jul 2026 00:24:54 +0200 Subject: [PATCH] add install.sh and one-line curl installer; refresh README - add install.sh: detects OS/arch, downloads the matching prebuilt binary from the latest GitHub release, installs to BINDIR (default /usr/local/bin, falls back to ~/.local/bin), then runs `mail-cli install-skill` - README: replace the multi-line curl|grep|mv snippet with a single `curl -fsSL .../install.sh | sh`; add an agent copy-paste one-liner - README: drop dead PLAN.md link (point at AGENTS.md), fix License to MIT Co-authored by PeakBot! --- README.md | 37 +++++++++++++++++++++--- install.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ memory.md | 36 ++++++++++++++++++++++++ 3 files changed, 151 insertions(+), 4 deletions(-) create mode 100755 install.sh diff --git a/README.md b/README.md index a05f737..12bd54d 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,42 @@ Configuration comes **entirely from environment variables**; everything else is a CLI flag. **No config file, no cache, no stored state of any kind.** Human-friendly by default, script-friendly with `--json`. -See [`PLAN.md`](PLAN.md) for the full design and rationale. +See [`AGENTS.md`](AGENTS.md) for the design rationale and contributor guide. + +## Quick install (for agents) + +Copy-paste this one-liner into your coding agent (or your own shell) to install +the binary **and** the bundled skill: + +> Install mail-cli by running: `curl -fsSL https://raw.githubusercontent.com/patch-notes/mail-cli/master/install.sh | sh` ## Install +One line — downloads the right prebuilt binary for your OS/arch from the +[latest release](https://github.com/patch-notes/mail-cli/releases/latest) and +installs the bundled agent skill: + +```sh +curl -fsSL https://raw.githubusercontent.com/patch-notes/mail-cli/master/install.sh | sh +``` + +The script auto-detects your platform (`linux-amd64`, `macos-amd64`, +`macos-arm64`), installs to `/usr/local/bin` (falling back to `~/.local/bin`), +and runs `mail-cli install-skill`. Override the target with `BINDIR=...` or skip +the skill with `INSTALL_SKILL=0`: + +```sh +curl -fsSL .../install.sh | BINDIR="$HOME/.local/bin" INSTALL_SKILL=0 sh +``` + +On **Windows**, download `mail-cli-*-windows-amd64.exe` from the release page. + +### Build from source (optional) + ```sh -cargo build --release -# binary at target/release/mail-cli +cargo install --path . # installs `mail-cli` into ~/.cargo/bin +# or +cargo build --release # binary at target/release/mail-cli ``` ## Configuration (environment only) @@ -172,4 +201,4 @@ MAILCLI_IT=1 cargo test --test search_integration ## License -See repository. +MIT — see [`LICENSE`](LICENSE). diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..60d03cc --- /dev/null +++ b/install.sh @@ -0,0 +1,82 @@ +#!/bin/sh +# mail-cli installer — downloads the latest prebuilt release binary. +# +# curl -fsSL https://raw.githubusercontent.com/patch-notes/mail-cli/master/install.sh | sh +# +# Options (env vars): +# BINDIR=/path install directory (default: /usr/local/bin, or +# ~/.local/bin when /usr/local/bin is not writable) +# INSTALL_SKILL=0 skip running `mail-cli install-skill` afterwards +set -eu + +REPO="patch-notes/mail-cli" +API="https://api.github.com/repos/${REPO}/releases/latest" + +err() { printf 'error: %s\n' "$1" >&2; exit 1; } +info() { printf '%s\n' "$1" >&2; } + +# --- detect OS/arch and map to the release asset suffix ------------------- +os=$(uname -s) +arch=$(uname -m) +case "$os" in + Linux) os_tag=linux ;; + Darwin) os_tag=macos ;; + *) err "unsupported OS '$os' (grab a binary from https://github.com/${REPO}/releases/latest)" ;; +esac +case "$arch" in + x86_64|amd64) arch_tag=amd64 ;; + arm64|aarch64) arch_tag=arm64 ;; + *) err "unsupported arch '$arch'" ;; +esac +# Linux ships amd64 only. +if [ "$os_tag" = linux ] && [ "$arch_tag" != amd64 ]; then + err "no linux-$arch_tag build published (only linux-amd64)" +fi +suffix="${os_tag}-${arch_tag}" + +# --- resolve the download URL for the latest release ---------------------- +command -v curl >/dev/null 2>&1 || err "curl is required" +info "resolving latest mail-cli release for ${suffix}..." +url=$(curl -fsSL "$API" | grep -o "https://[^\"]*${suffix}\(\.exe\)\?" | head -n1) +[ -n "$url" ] || err "could not find a '${suffix}' asset in the latest release" + +# --- download ------------------------------------------------------------- +tmp=$(mktemp) +trap 'rm -f "$tmp"' EXIT +info "downloading $url" +curl -fSL "$url" -o "$tmp" +chmod +x "$tmp" + +# --- install -------------------------------------------------------------- +bindir=${BINDIR:-/usr/local/bin} +if [ ! -d "$bindir" ] || [ ! -w "$bindir" ]; then + if [ -z "${BINDIR:-}" ]; then + bindir="$HOME/.local/bin" # fall back to a user dir when no write access + fi +fi +mkdir -p "$bindir" + +dest="$bindir/mail-cli" +if [ -w "$bindir" ]; then + mv "$tmp" "$dest" +elif command -v sudo >/dev/null 2>&1; then + info "installing to $dest (needs sudo)" + sudo mv "$tmp" "$dest" +else + err "cannot write to $bindir and sudo is unavailable; set BINDIR to a writable path" +fi +trap - EXIT +info "installed mail-cli -> $dest" + +case ":$PATH:" in + *":$bindir:"*) : ;; + *) info "note: $bindir is not on your PATH — add it to use 'mail-cli' directly" ;; +esac + +# --- bundled agent skill -------------------------------------------------- +if [ "${INSTALL_SKILL:-1}" != 0 ]; then + info "installing bundled agent skill..." + "$dest" install-skill || info "skipped skill install (run 'mail-cli install-skill' later)" +fi + +info "done. Run 'mail-cli --help' to get started." diff --git a/memory.md b/memory.md index ec5847f..be16f5e 100644 --- a/memory.md +++ b/memory.md @@ -79,6 +79,42 @@ installed output is BYTE-IDENTICAL to the source skill. Updated README (install-skill section) + AGENTS.md (skill.rs + skill/ in project structure). +- 2026-07-08 (rev 9): README refresh. Removed dead `PLAN.md` link (file no longer + exists) -> pointed design/rationale link at AGENTS.md instead. Verified README + usage still matches code: Command enum (Folders/List/Search/Read/Attachments/ + Download/Send/InstallSkill) + all MAILCLI_* env vars in config.rs -> already + current, no drift. Added a "Quick install (for agents)" section with a + copy-paste one-line prompt (clone repo -> `cargo install --path .` -> + `mail-cli install-skill`). Repo origin = github.com/patch-notes/mail-cli. + Expanded Install block (cargo install vs build) and fixed License section + ("See repository" -> "MIT — see LICENSE"; LICENSE is MIT, (c) 2026 Exe Zulliger). + grep confirms no stale refs to plan.md/zoe-review/search-plan/model.rs remain. + +- 2026-07-08 (rev 10): Reworked README install to DOWNLOAD PREBUILT BINARIES from + the latest GitHub release instead of building from source. Latest release = + v0.1.0 (github-actions bot); 4 assets: mail-cli-0.1.0-{linux-amd64,macos-amd64, + macos-arm64,windows-amd64.exe}. Asset names are version-pinned, so the + version-agnostic trick = hit /releases/latest API and + `grep -o 'https://[^"]*linux-amd64'` -> resolves the browser_download_url + (verified: yields exactly the v0.1.0 linux-amd64 URL, one line). Agent one-liner + now tells the agent to fetch /releases/latest, pick the OS/arch asset, save as + `mail-cli` on PATH, chmod +x, run install-skill. cargo build/install demoted to + an optional "Build from source" subsection. GH releases created by CI + (PR #1 by @thepeak99: "Add GitHub Actions CI + release pipelines"). + +- 2026-07-08 (rev 11): Added `install.sh` (repo root, POSIX sh, chmod +x, + `sh -n` clean) and swapped the README's ugly multi-line curl|grep|mv snippet + for a single `curl -fsSL .../master/install.sh | sh`. Script: detects OS + (Linux->linux, Darwin->macos) + arch (x86_64->amd64, arm64/aarch64->arm64), + guards linux=amd64-only, resolves the asset via /releases/latest API + + `grep -o "https://[^\"]*${suffix}\(\.exe\)\?" | head -n1` (verified on this box: + suffix=linux-amd64 -> correct v0.1.0 URL), downloads to mktemp w/ EXIT trap, + installs to BINDIR (default /usr/local/bin, sudo if needed, else falls back to + ~/.local/bin), warns if bindir not on PATH, then runs `install-skill` unless + INSTALL_SKILL=0. Raw URL uses master branch (release target_commitish=master). + Agent one-liner is now just the curl|sh command. Left AGENTS.md untouched (it + documents src/ internals, not top-level scripts). + ## Semantic (facts learned) - Rust email crate landscape (mid-2026): - `imap` (jonhoo) = sync, simple, but stuck on 3.0.0-alpha, seeking maintainers.