diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index eca9d2e..8562750 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,10 +46,34 @@ jobs: env: TAG: ${{ steps.tag.outputs.value }} + - name: Skip if version already on crates.io + id: crates_io + env: + TAG: ${{ steps.tag.outputs.value }} + run: | + tag="${TAG#v}" + status=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "User-Agent: commitor-cli-publish" \ + "https://crates.io/api/v1/crates/commitor-cli/$tag") + echo "status=$status" >> "$GITHUB_OUTPUT" + - name: Publish commitor-cli + if: steps.crates_io.outputs.status != '200' env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - run: cargo publish -p commitor-cli + run: | + set +e + out=$(cargo publish -p commitor-cli 2>&1) + rc=$? + echo "$out" + # Tolerate a version that slipped through (e.g. a prior partial + # run already published it) so the workflow doesn't fail on a + # re-run of the same release. + if echo "$out" | grep -qi "already uploaded"; then + echo "Version already published — treating as success." + exit 0 + fi + exit $rc npm: name: Publish to npm @@ -83,9 +107,32 @@ jobs: env: TAG: ${{ steps.tag.outputs.value }} + - name: Skip if version already on npm + id: npm_check + env: + TAG: ${{ steps.tag.outputs.value }} + run: | + tag="${TAG#v}" + if npm view "commitor-cli@$tag" version >/dev/null 2>&1; then + echo "published=true" >> "$GITHUB_OUTPUT" + else + echo "published=false" >> "$GITHUB_OUTPUT" + fi + - name: Configure npm auth + if: steps.npm_check.outputs.published != 'true' run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > npm/.npmrc - name: Publish commitor-cli - run: npm publish --access public + if: steps.npm_check.outputs.published != 'true' + run: | + set +e + out=$(npm publish --access public 2>&1) + rc=$? + echo "$out" + if echo "$out" | grep -qi "previously published\|cannot publish over"; then + echo "Version already published — treating as success." + exit 0 + fi + exit $rc working-directory: npm diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d2f57d..3736a48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project is in 0.x, minor versions may add, change, or remove functionality freely; 1.0.0 marks a stable command surface. +## [0.5.0] — 2026-08-29 + +### Added +- `commitor revert` — undo commits produced by `commitor commit`. Unpushed + commits are rolled back with a hard reset; already-pushed commits are + reverted with `git revert`, respecting the safety of shared history. +- `commitor scan --diff-range ` — analyze a fixed git range + (e.g. `origin/main...HEAD`) instead of the working tree, plus `--markdown` + output suited to a PR comment. +- `commitor scan --context ""` — forward a PR's stated + intent to the model so it can weigh it against the files actually touched. +- Post-commit push in `commitor commit` — after committing, offers to push + the new branch, auto-detecting the upstream. +- Per-repo session history of `commitor commit` runs, stored at + `~/.commitor/history/<repo-id>.jsonl`. +- GitHub Action (`./action`) that runs `commitor scan --diff-range` on pull + requests and posts an updatable Markdown comment. + +### Changed +- `commitor commit` gains interactive branch selection, base-branch tracking, + and an offline mode. + +### Improved +- PR-scale analysis: `--diff-range` scans now always consult the backend + (the local heuristic is advisory only at PR scale), so unrelated changes + bundled in a large diff are no longer missed. + +### Fixed +- Release workflow (`publish.yml`) is now idempotent — re-running a release + no longer fails on an already-published crates.io / npm version. + ## [0.4.0] — 2026-08-29 ### Added @@ -157,5 +188,11 @@ not of the full tool. - `commitor scan` and `commitor commit` — in active development, coming in future 0.x releases. +[0.5.0]: https://github.com/Commitor-AI/commitor/releases/tag/v0.5.0 +[0.4.0]: https://github.com/Commitor-AI/commitor/releases/tag/v0.4.0 +[0.3.3]: https://github.com/Commitor-AI/commitor/releases/tag/v0.3.3 +[0.3.2]: https://github.com/Commitor-AI/commitor/releases/tag/v0.3.2 +[0.3.1]: https://github.com/Commitor-AI/commitor/releases/tag/v0.3.1 +[0.3.0]: https://github.com/Commitor-AI/commitor/releases/tag/v0.3.0 [0.2.0]: https://github.com/Commitor-AI/commitor/releases/tag/v0.2.0 [0.1.0]: https://github.com/Commitor-AI/commitor/releases/tag/v0.1.0 diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index dd63773..04a28de 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "commitor-cli" -version = "0.4.0" +version = "0.5.0" edition = "2021" description = "Catches unrelated changes bundled into commits and splits them cleanly — whole-file or hunk-level, guided by AI analysis" license = "MIT OR Apache-2.0" diff --git a/npm/package.json b/npm/package.json index 13efcc0..a20bf21 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "commitor-cli", - "version": "0.4.0", + "version": "0.5.0", "description": "Catches unrelated changes bundled into commits and splits them cleanly — whole-file or hunk-level, guided by AI analysis", "bin": { "commitor": "bin/commitor.js"