Compare commits

39 Commits
v0.1.0 ... main

Author SHA1 Message Date
64342f7258 fix: add system dependencies for git2 crate in CI
Some checks failed
CI / build (push) Failing after 2m23s
2026-02-01 12:56:06 +00:00
ecb386ebda fix: resolve AnalysisResult import issue in prompt.rs
Some checks failed
CI / build (push) Failing after 36s
2026-02-01 12:52:48 +00:00
570770cf48 fix: add missing AnalysisResult import in prompt.rs
Some checks failed
CI / build (push) Failing after 37s
2026-02-01 12:51:45 +00:00
0e167d7c94 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Failing after 45s
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:44 +00:00
21393833c3 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:44 +00:00
f474328f45 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:43 +00:00
43d4d99e25 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:41 +00:00
8a15c29a18 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:40 +00:00
3b7844976f fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:39 +00:00
469f0b93c0 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:38 +00:00
e27a9b93f5 fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:38 +00:00
c4e819bd2d fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:37 +00:00
a3c96fc9df fix: resolve module structure issues by separating CLI and git modules
Some checks failed
CI / build (push) Has been cancelled
- Removed duplicated git module code from cli.rs
- Created dedicated git.rs module with GitRepo, StagedChanges, ChangedFile, FileStatus definitions
- Updated all modules (analyzer, generator, prompt) to import from super::git
- Fixed module organization to resolve compilation errors
2026-02-01 12:48:37 +00:00
c1efcdc443 fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:44:50 +00:00
34e1f0acdf fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:44:50 +00:00
e5cade0ea6 fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:44:49 +00:00
b27f866c0e fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:44:49 +00:00
c0082b9095 fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:44:49 +00:00
4f5ecffabc fix: Separate modules properly - cli.rs and git.rs now independent
Some checks failed
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
CI / lint (push) Has been cancelled
2026-02-01 12:44:48 +00:00
e897a35e38 Check current project files
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:42:10 +00:00
f810e470c4 Check current project files
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:42:10 +00:00
087fd93def fix: Update analyzer.rs, generator.rs, and prompt.rs with proper imports
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:40:25 +00:00
92197cacae fix: Update analyzer.rs, generator.rs, and prompt.rs with proper imports
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:40:25 +00:00
228fd5f921 fix: Update analyzer.rs, generator.rs, and prompt.rs with proper imports
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:40:24 +00:00
f772fa4413 fix: Fix git.rs typos (is_enamed -> is_renamed)
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:38:46 +00:00
b5c381ab71 fix: Update main.rs with proper module declarations
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:37:39 +00:00
33beac0889 fix: Update git.rs with proper struct definitions
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:36:39 +00:00
1e4086d33c fix: Rewrite cli.rs with proper crate:: imports
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:35:52 +00:00
58ff331af3 fix: Simplify main.rs to ensure proper module integration
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:34:53 +00:00
77724aac7e fix: Update prompt.rs with proper super:: imports
Some checks failed
CI / lint (push) Failing after 4s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:34:21 +00:00
a1da8bb97d fix: Update generator.rs with proper super:: imports
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:34:02 +00:00
b0b9dfab9f fix: Update analyzer.rs with proper pub modifiers and super::git imports
Some checks failed
CI / lint (push) Failing after 4s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:33:34 +00:00
28ce772dff fix: Update main.rs with proper module structure and imports
Some checks failed
CI / lint (push) Failing after 4s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:32:32 +00:00
dec64839ce fix: Add missing analyze_changes, get_all_commit_types functions to analyzer.rs
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:29:11 +00:00
a204e6c900 fix: Add missing GitRepo, StagedChanges, ChangedFile structs to git.rs
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
2026-02-01 12:28:36 +00:00
614ea3ea35 fix: Add missing GitRepo, StagedChanges, ChangedFile structs to git.rs
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
2026-02-01 12:28:35 +00:00
53ddefdafd fix: add Gitea Actions CI workflow and fix logic bugs
Some checks failed
CI / lint (push) Failing after 3s
CI / build (push) Has been skipped
CI / test (push) Has been skipped
- Created .gitea/workflows/ci.yml with lint, build, and test jobs
- Fixed scope extraction bug in analyzer.rs (src/main.rs now returns "src")
- Fixed renamed file path assignment in git.rs (correct old_path/new_path)
2026-02-01 12:24:37 +00:00
5637b2e5ed fix: add Gitea Actions CI workflow and fix logic bugs
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
- Created .gitea/workflows/ci.yml with lint, build, and test jobs
- Fixed scope extraction bug in analyzer.rs (src/main.rs now returns "src")
- Fixed renamed file path assignment in git.rs (correct old_path/new_path)
2026-02-01 12:24:36 +00:00
361465a570 fix: add Gitea Actions CI workflow and fix logic bugs
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled
- Created .gitea/workflows/ci.yml with lint, build, and test jobs
- Fixed scope extraction bug in analyzer.rs (src/main.rs now returns "src")
- Fixed renamed file path assignment in git.rs (correct old_path/new_path)
2026-02-01 12:24:36 +00:00
3 changed files with 179 additions and 1 deletions

42
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,42 @@
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends pkg-config libssl-dev
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Check code formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build project
run: cargo build --release
- name: Run tests
run: cargo test
- name: Show binary info
run: ls -la target/release/auto-commit

View File

@@ -0,0 +1,136 @@
use anyhow::Result;
use colored::Colorize;
use dialoguer::{Confirm, Select};
use crate::analyzer::{analyze_changes, get_all_commit_types, AnalysisResult, CommitType};
use crate::generator::{generate_alternative_messages, generate_message};
use crate::git::{GitRepo, StagedChanges};
pub fn select_commit_type(suggested: CommitType) -> Result<CommitType> {
let all_types = get_all_commit_types();
let type_names: Vec<String> = all_types.iter().map(|t| format!("{}", t)).collect();
let suggested_idx = all_types.iter().position(|t| *t == suggested).unwrap_or(0);
println!("{}", "\nSuggested commit type:".bold().green());
println!(" {}", format!("{}", suggested).green().bold());
let selection = Select::with_theme(&dialoguer::theme::ColorfulTheme::default())
.with_prompt("Select commit type (use ↑/↓ to navigate, Enter to confirm)")
.items(&type_names)
.default(suggested_idx)
.interact()?;
Ok(all_types[selection])
}
pub fn confirm_message(message: &str, alternatives: &[String]) -> Result<(bool, Option<String>)> {
println!("\n{}", "Generated commit message:".bold().green());
println!("\n{}\n", message.bright_white().on_blue());
if !alternatives.is_empty() {
println!("{}", "Alternative messages:".bold().yellow());
for (i, alt) in alternatives.iter().enumerate() {
println!(" {}: {}", (i + 1).to_string().yellow(), alt);
}
}
let confirm = Confirm::with_theme(&dialoguer::theme::ColorfulTheme::default())
.with_prompt("Do you want to use this commit message?")
.default(true)
.interact()?;
if confirm {
Ok((true, None))
} else {
let edit_prompt = Confirm::with_theme(&dialoguer::theme::ColorfulTheme::default())
.with_prompt("Would you like to edit the message manually?")
.default(false)
.interact()?;
if edit_prompt {
let edited = dialoguer::Editor::new()
.edit(&format!("\n# Edit your commit message below:\n{}\n", message))
.map_err(|e| anyhow::anyhow!("Failed to open editor: {}", e))?;
match edited {
Some(content) => {
let cleaned = content
.lines()
.filter(|l| !l.starts_with('#'))
.collect::<Vec<_>>()
.join("\n")
.trim()
.to_string();
if cleaned.is_empty() {
Ok((false, None))
} else {
Ok((true, Some(cleaned)))
}
}
None => Ok((false, None)),
}
} else {
Ok((false, None))
}
}
}
pub fn interactive_commit(
git_repo: &GitRepo,
suggested_type: CommitType,
staged: &StagedChanges,
) -> Result<Option<String>> {
let selected_type = if git_repo.has_config()? {
select_commit_type(suggested_type)?
} else {
suggested_type
};
let analysis = analyze_changes(staged);
let analysis = AnalysisResult {
commit_type: selected_type,
..analysis
};
let message = generate_message(&analysis, staged);
let alternatives = generate_alternative_messages(&analysis, staged);
let (confirmed, edited_message) = confirm_message(&message, &alternatives)?;
if !confirmed {
println!("{}", "\nCommit aborted by user.".yellow());
return Ok(None);
}
Ok(edited_message.or(Some(message)))
}
pub fn print_staged_summary(staged: &StagedChanges) {
if staged.files.is_empty() {
println!("{}", "No staged changes found.".yellow());
return;
}
println!("{}", "\nStaged changes:".bold().green());
for file in &staged.files {
let status_str = match file.status {
crate::git::FileStatus::Added => "A".green(),
crate::git::FileStatus::Deleted => "D".red(),
crate::git::FileStatus::Modified => "M".yellow(),
crate::git::FileStatus::Renamed => "R".cyan(),
crate::git::FileStatus::Unknown => "?".white(),
};
println!(
" {} {:>6} {:>6} {}",
status_str,
format!("+{}", file.additions).green(),
format!("-{}", file.deletions).red(),
file.path
);
}
println!();
}

View File

@@ -25,7 +25,7 @@ pub fn select_commit_type(suggested: CommitType) -> Result<CommitType> {
}
pub fn confirm_message(message: &str, alternatives: &[String]) -> Result<(bool, Option<String>)> {
println!("\n{}", "Generated commit message:".bold().green());
println!("{}", "\nGenerated commit message:".bold().green());
println!("\n{}\n", message.bright_white().on_blue());
if !alternatives.is_empty() {