phoebus_os/scripts/agent-commit.sh
Phoebus 875278b9a9 ci: make the Rust suite the only quality gate
Remove the Bash test suite and shellcheck from CI, the pre-commit hook, the
Makefile, agent-commit and publish. CI now runs cargo fmt, clippy and test.
2026-09-20 03:57:01 -07:00

49 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Commit all working-tree changes with a conventional message.
#
# Intended for AI work sessions so that every session leaves a trace in git.
# It stages everything, runs the safety checks, then commits. It does not push;
# use scripts/publish.sh for that.
#
# Usage: scripts/agent-commit.sh "<conventional commit message>"
#
# Environment:
# PHOEBUS_COMMIT_TEST=0 skip the fast test run before committing
set -euo pipefail
message="${1:-}"
if [[ -z "$message" ]]; then
echo "usage: scripts/agent-commit.sh \"<conventional commit message>\"" >&2
exit 2
fi
root="$(git rev-parse --show-toplevel)"
cd "$root"
if [[ -z "$(git status --porcelain)" ]]; then
echo "nothing to commit (working tree clean)"
exit 0
fi
git add -A
scripts/check-secrets.sh
if [[ "${PHOEBUS_COMMIT_TEST:-1}" == "1" ]] && command -v cargo >/dev/null 2>&1; then
echo "running Rust test suite..."
(cd installer-rs && cargo test --workspace) >/tmp/phoebus-agent-commit-tests.log 2>&1 || {
echo "tests failed; see /tmp/phoebus-agent-commit-tests.log" >&2
exit 1
}
fi
echo "staged changes:"
git diff --cached --stat | tail -n 40
# The checks above already ran; skip the hook's duplicate work.
SKIP_PHOEBUS_HOOKS=1 git commit -m "$message"
echo
echo "committed: $(git log -1 --oneline)"
echo "push with: scripts/publish.sh"