diff --git a/git_why.py b/git_why.py index 6d62fed..24aeda9 100755 --- a/git_why.py +++ b/git_why.py @@ -18,6 +18,8 @@ import sys from fnmatch import fnmatch +__version__ = "0.1.0" # single source of truth; keep in sync with pyproject.toml + KEYS = ["Why", "Why-Prompt", "Why-Rationale", "Why-Alternatives", "Why-Spec", "Why-Agent", "Why-Session", "Why-Confidence"] LABEL = {"Why-Prompt": "prompt", "Why-Rationale": "rationale", @@ -425,6 +427,9 @@ def cmd_init(args): def main(): argv = sys.argv[1:] + if argv and argv[0] in ("-V", "--version"): + print(f"git why {__version__}") + return 0 if not argv or argv[0] not in SUBCOMMANDS: if argv and argv[0] in ("-h", "--help"): return cmd_show("-h") diff --git a/test/smoke.sh b/test/smoke.sh index 5008f76..130e644 100755 --- a/test/smoke.sh +++ b/test/smoke.sh @@ -23,6 +23,9 @@ git config user.email t@example.com git config user.name Tester big() { printf '%s line %s\n' "$1" $(seq 1 40) > "$1"; git add "$1"; } +# --- version --------------------------------------------------------------- +gw --version | grep -qE "^git why [0-9]+\.[0-9]+" || fail "git why --version" + # ---- default: nudge (never blocks) ------------------------------------- gw init >/dev/null [ "$(git config --get why.strict)" = "nudge" ] || fail "default level is not nudge"