Debian Codegraph @

.claude/commands/release.md

raw
1 Pre-release check and preparation for version $ARGUMENTS.
2
3 Run ALL of the following checks in order. For each check, report PASS or FAIL. Fix issues automatically where possible, and ask before making changes that need judgment.
4
5 ## 1. Validate version argument
6
7 The user must provide a version in `X.Y.Z` format (e.g. `3.4.9`). If `$ARGUMENTS` is empty or not in the right format, stop and ask for the version number.
8
9 ## 2. Check git state
10
11 - Run `git status` — warn about uncommitted changes
12 - Run `git tag -l "v$ARGUMENTS"` — verify the tag `v$ARGUMENTS` does not already exist
13 - If the tag exists, warn and ask whether to continue
14
15 ## 3. Check & fix version numbers
16
17 All four files must contain the version `$ARGUMENTS`. Check each one and fix any that don't match:
18
19 - **pyproject.toml**: `version = "$ARGUMENTS"`
20 - **CMakeLists.txt**: `KALIGN_LIBRARY_VERSION_MAJOR`, `KALIGN_LIBRARY_VERSION_MINOR`, `KALIGN_LIBRARY_VERSION_PATCH` must match the three parts of `$ARGUMENTS`
21 - **build.zig**: `kalignPackageVersion` string and the `KALIGN_PACKAGE_VERSION` in the cflags array must both be `"$ARGUMENTS"`
22 - **CITATION.cff**: `version:` field must be `$ARGUMENTS`
23
24 For any mismatches, fix them directly using the Edit tool and report what was changed.
25
26 ## 4. Run linting (mirrors CI)
27
28 Run these commands in sequence. If `black` or `isort` report formatting issues, auto-fix by running without `--check`:
29
30 ```
31 uv run black --check python-kalign/
32 uv run isort --check-only python-kalign/
33 uv run flake8 python-kalign --select=E9,F63,F7,F82
34 ```
35
36 If black or isort fail the check, run the fix commands:
37 ```
38 uv run black python-kalign/
39 uv run isort python-kalign/
40 ```
41
42 Then re-run the checks to confirm they pass.
43
44 ## 5. Run Python tests
45
46 ```
47 uv run pytest tests/python/ -v --no-header -q
48 ```
49
50 Report the results. Note: there are some known pre-existing test failures in test_parameters.py and test_ecosystem_integration.py — flag any NEW failures beyond those.
51
52 ## 6. Audit documentation — package name
53
54 Search all files for bare `pip install kalign` that should be `pip install kalign-python`. Use grep to find:
55 - Any `pip install kalign` NOT followed by `-python`
56 - Specifically check: README files, python-docs/, python-examples/, python-kalign/
57
58 If any incorrect references are found, fix them.
59
60 ## 7. Audit emails
61
62 Extract the author email from `pyproject.toml` (the `authors` field). Then search all project files for email addresses and verify they are consistent. Check at minimum:
63 - `python-kalign/__init__.py` (`__email__`)
64 - `CITATION.cff`
65 - `ChangeLog` (most recent entry)
66
67 Report any mismatches. Do not hardcode any email — always extract the canonical email from pyproject.toml dynamically.
68
69 ## 8. Check ChangeLog
70
71 Read the `ChangeLog` file and check whether it contains an entry for `version $ARGUMENTS`.
72
73 If an entry exists, report PASS.
74
75 If NO entry exists:
76 1. Run `git log $(git describe --tags --abbrev=0)..HEAD --oneline` to get commits since the last tag
77 2. Read the existing ChangeLog to understand the format (date, author, email, version line, bullet points with changes)
78 3. Draft a new ChangeLog entry matching the existing format, using today's date and the author name and email from pyproject.toml
79 4. Present the draft to the user for approval or edits
80 5. Only after user approval, insert the entry at the top of the ChangeLog file
81
82 ## 9. Build & verify
83
84 Reinstall the package and verify the version:
85
86 ```
87 uv pip install -e .
88 uv run python -c "import kalign; print(kalign.__version__)"
89 ```
90
91 Confirm the printed version matches `$ARGUMENTS`. If not, investigate and fix.
92
93 ## 10. Summary
94
95 Print a results table like this:
96
97 ```
98 ## Release $ARGUMENTS — Pre-release Check Results
99
100 | Check | Status |
101 |------------------------|--------|
102 | Git state | ... |
103 | Version consistency | ... |
104 | Linting (black) | ... |
105 | Linting (isort) | ... |
106 | Linting (flake8) | ... |
107 | Python tests | ... |
108 | Package name audit | ... |
109 | Email consistency | ... |
110 | ChangeLog | ... |
111 | Build & version verify | ... |
112 ```
113
114 Then, if all checks pass (or only known failures remain), ask the user:
115
116 > All checks passed. Would you like me to:
117 > 1. Commit all changes with message "Release vX.Y.Z"
118 > 2. Create tag `vX.Y.Z`
119 > 3. Push to remote
120 >
121 > Or pick individual steps?
122
123 Wait for the user's response before taking any of those actions.