fj/scripts/e2e-smoke.sh
Stephen Way 191d941c78
expand: repo auto-detect, --web, editor, PR diff/checks/ready/review/status, repo lifecycle, api headers/paginate
* CI: pre-push hook (fmt, clippy -D warnings, test, release build) plus
  opt-in FJ_E2E=1 smoke. Install via scripts/install-hooks.sh.
* Repo auto-detection from git remote: -R/--repo becomes optional on all
  repo-scoped subcommands. Detection prefers `upstream` then `origin`,
  honors --host, and parses https/ssh/scp-style URLs.
* `--web` flag wired to every list/view command (open in default browser).
* `$EDITOR` integration for issue/pr create + comment + edit (omit
  `--body` to launch your editor; `-` keeps stdin).
* PR: new `diff`, `commits`, `files`, `checks`, `ready`, `review`,
  `edit`, `status`, `reopen` subcommands. `view --comments` now shows
  reviews too.
* Issue: `edit` and `develop` (creates a branch for the issue).
* Repo: `fork`, `sync`, `edit`, `rename`, `archive`, `unarchive`,
  `delete` (with slug-confirmation), `branches`, `topics`.
* `fj api` gains `-H` headers, `--paginate` (follows Link rel=next),
  `--include` (response headers), `--silent`. The jq-ish projector now
  supports `[N]`/`[-N]` brackets and `|` pipes.
* MSRV bumped to 1.82 (uses `is_none_or`).
* 46 unit tests covering pure logic: hosts CRUD, remote URL parsing,
  link header parser, jq projection, branch label fallback, slugify.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 08:22:40 -07:00

45 lines
1,009 B
Bash
Executable file

#!/usr/bin/env bash
# Live-API smoke: hit a curated set of read-only endpoints via the just-built
# binary. Requires the user to be logged in (`fj auth login`). Designed for
# the pre-push hook when FJ_E2E=1.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
FJ="${FJ_BIN:-./target/release/fj}"
TEST_REPO="${FJ_E2E_REPO:-stephen/fj-cli-test}"
run() {
printf ' • %s\n' "$*"
"$@" >/dev/null
}
if [[ ! -x "$FJ" ]]; then
echo "missing $FJ; run cargo build --release first" >&2
exit 1
fi
echo "== auth =="
run "$FJ" auth status
run "$FJ" auth list
echo "== api =="
run "$FJ" api /version
run "$FJ" api /user
echo "== repo =="
run "$FJ" repo list -L 5
run "$FJ" repo view "$TEST_REPO"
run "$FJ" repo view "$TEST_REPO" --json
echo "== issue =="
run "$FJ" issue list -R "$TEST_REPO" --state all
run "$FJ" issue list -R "$TEST_REPO" --json
echo "== pr =="
run "$FJ" pr list -R "$TEST_REPO" --state all
run "$FJ" pr list -R "$TEST_REPO" --json
echo "✓ e2e smoke passed against $TEST_REPO"