Repository navigation
Expand file tree
/
Copy pathdoctor.sh
More file actions
executable file
·61 lines (47 loc) · 1.49 KB
/
Copy pathdoctor.sh
File metadata and controls
executable file
·61 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=./health_common.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/health_common.sh"
run_doctor_fix_phase() {
local pre_commit_exit_code=0
local repo_state_before
local repo_state_after
echo "[doctor] run fix phase"
repo_state_before="$(repo_state_fingerprint)"
if uv run pre-commit run --all-files; then
pre_commit_exit_code=0
else
pre_commit_exit_code=$?
fi
repo_state_after="$(repo_state_fingerprint)"
if [[ "$repo_state_before" != "$repo_state_after" ]]; then
echo "[doctor] pre-commit modified files; review the changes and rerun doctor" >&2
exit 1
fi
if (( pre_commit_exit_code != 0 )); then
exit "$pre_commit_exit_code"
fi
}
run_doctor_verify_phase() {
echo "[doctor] run verify phase"
echo "[doctor] run type checks"
uv run mypy src/opencode_a2a
echo "[doctor] run tests"
uv run pytest
echo "[doctor] enforce coverage policy"
uv run python ./scripts/check_coverage.py
}
run_doctor_package_phase() {
echo "[doctor] run package phase"
echo "[doctor] build release artifacts"
rm -f dist/opencode_a2a-*.whl dist/opencode_a2a-*.tar.gz
uv build --no-sources --force-pep517 \
--build-constraints build-requirements/requirements.txt \
--require-hashes
echo "[doctor] smoke test built wheel"
bash ./scripts/smoke_test_built_cli.sh dist/opencode_a2a-*.whl
}
run_shared_repo_health_prerequisites "doctor"
run_doctor_fix_phase
run_doctor_verify_phase
run_doctor_package_phase