Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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.1] — 2026-08-30

### Fixed
- Running `commitor scan` outside a git repository now stops with a clear
"not a git repository" message instead of git's raw diff usage dump.

## [0.5.0] — 2026-08-29

### Added
Expand Down Expand Up @@ -188,6 +194,7 @@ not of the full tool.
- `commitor scan` and `commitor commit` — in active development,
coming in future 0.x releases.

[0.5.1]: https://github.com/Commitor-AI/commitor/releases/tag/v0.5.1
[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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "commitor-cli"
version = "0.5.0"
version = "0.5.1"
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"
Expand Down
11 changes: 11 additions & 0 deletions crates/cli/src/engine/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ pub fn get_branch_diff(base: &str) -> Result<String> {
run_git(&["diff", &format!("{base}...HEAD")])
}

/// True when the current directory is inside a git work tree (bare
/// repos and `.git` directories report `false`). Checks `rev-parse
/// --is-inside-work-tree` because `git diff` outside a repo falls into
/// `--no-index` mode and prints an unrelated usage dump instead of the
/// usual "not a git repository" error.
pub fn is_work_tree() -> bool {
run_git(&["rev-parse", "--is-inside-work-tree"])
.map(|out| out.trim() == "true")
.unwrap_or(false)
}

/// The full patch text of one diff flavor: staged when `staged`,
/// unstaged (working tree) otherwise.
pub fn diff_patch(staged: bool) -> Result<String> {
Expand Down
5 changes: 5 additions & 0 deletions crates/cli/src/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::process::ExitCode;
use anyhow::{bail, Result};

use crate::analysis;
use crate::engine::git;
use crate::heuristics::{self, Verdict};

#[derive(Debug, Default)]
Expand Down Expand Up @@ -46,6 +47,10 @@ fn scan_escalates(verdict: &Verdict, diff_range: bool) -> bool {
}

pub fn run(flags: ScanFlags) -> Result<ExitCode> {
if !git::is_work_tree() {
bail!("this doesn't look like a git repository — run `commitor scan` from inside a git repository");
}

// Machine-readable output modes suppress the human progress lines.
let quiet = flags.json || flags.markdown;

Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "commitor-cli",
"version": "0.5.0",
"version": "0.5.1",
"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"
Expand Down
Loading