#!/usr/bin/env bash # Print a one-screen briefing for a new work session. # # scripts/context.sh (or: make context) # # Intended to be the first command run in a fresh session: it gathers the # repository state, the roadmap's immediate next steps, the rolling handoff and # any open markers, so an agent does not have to rediscover them. set -uo pipefail root="$(git rev-parse --show-toplevel 2>/dev/null)" || { echo "not inside a git repository" >&2 exit 1 } cd "$root" line() { printf '\n===== %s =====\n' "$1"; } printf 'Phoebus OS session briefing %s\n' "$(date -u '+%Y-%m-%d %H:%M UTC')" line "repository" printf 'branch : %s\n' "$(git rev-parse --abbrev-ref HEAD)" printf 'head : %s\n' "$(git log -1 --format='%h %s (%ad)' --date=short)" printf 'describe: %s\n' "$(git describe --tags --always 2>/dev/null || echo none)" if upstream="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null)"; then ahead_behind="$(git rev-list --left-right --count "$upstream"...HEAD 2>/dev/null)" printf 'tracking: %s (behind/ahead: %s)\n' "$upstream" "${ahead_behind:-?}" fi status="$(git status --porcelain)" if [[ -z "$status" ]]; then printf 'tree : clean\n' else printf 'tree : %s changed path(s)\n' "$(wc -l <<<"$status")" sed 's/^/ /' <<<"$status" | head -n 12 fi line "recent commits" git log --oneline -10 line "roadmap: immediate next steps" if [[ -r docs/ROADMAP.md ]]; then awk '/^## Immediate next steps/{f=1;next} /^## /{f=0} f' docs/ROADMAP.md else echo "(docs/ROADMAP.md missing)" fi line "handoff (docs/HANDOFF.md)" if [[ -r docs/HANDOFF.md ]]; then cat docs/HANDOFF.md else echo "(docs/HANDOFF.md missing)" fi line "last VM verification evidence" git log -1 --format='%h %ad %s' --date=short -- docs/VM-BOOT-VERIFICATION.md 2>/dev/null \ || echo "(none)" line "open markers (TODO/FIXME/XXX)" grep -rInE 'TODO|FIXME|XXX' installer installer-rs/crates docs 2>/dev/null \ | grep -v 'installer-rs/target' | head -n 20 || echo "(none)" line "next" cat <<'EOF' - Read AGENTS.md if you have not, then docs/OBJECTIVES.md and docs/ROADMAP.md. - Run `scripts/doctor.sh` before VM work and `make test` before committing. - Update docs/HANDOFF.md and docs/CHANGELOG.md, then `scripts/agent-commit.sh` and `scripts/publish.sh`. EOF