Skip to content

Commit

Permalink
📝 Update README with new CLI option and features
Browse files Browse the repository at this point in the history
Add --no-verify option to README and expand interactive CLI instructions

- Include --no-verify option in the list of commit generation options
- Add new interactive CLI options for changing emoji, preset, and user info
- Remove detailed preset viewing instructions
- Fix typo in preset list
  • Loading branch information
hyperb1iss committed Aug 25, 2024
1 parent 43c8b56 commit 624ae9c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 29 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ log = "0.4.22"
futures = "0.3.30"
schemars = "0.8.21"

[dev-dependencies]
dotenv = "0.15.0"

[package.metadata.deb]
maintainer = "Stefanie Jane <[email protected]>"
copyright = "2024, Git-Iris Contributors <https://github.com/hyperb1iss/git-iris>"
Expand Down Expand Up @@ -84,4 +87,6 @@ path = "src/lib.rs"
name = "git-iris"
path = "src/main.rs"

[features]
integration = []

16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Options:
- `--no-gitmoji`: Disable Gitmoji for this commit
- `-l`, `--log`: Enable logging to file
- `-p`, `--print`: Print the generated message to stdout and exit
- `--no-verify`: Skip verification steps (pre/post commit hooks)

Example:
```bash
Expand All @@ -146,6 +147,9 @@ The interactive CLI allows you to refine and perfect your commit messages:
- Use arrow keys to navigate through suggestions
- Press 'e' to edit the current message
- Press 'i' to modify AI instructions
- Press 'g' to change the emoji
- Press 'p' to change the preset
- Press 'u' to edit user info
- Press 'r' to regenerate the message
- Press Enter to commit
- Press Esc to cancel
Expand Down Expand Up @@ -212,22 +216,14 @@ git-iris list-presets

This will display a list of all available presets with a brief description of each.

To view details of a specific preset:

```bash
git-iris show-preset conventional
```

This will show you the full instructions associated with the 'conventional' preset.

Some key presets include:

- `default`: Standard commit message style
- `conventional`: Follows the Conventional Commits specification
- `detailed`: Provides more context and explanation in commit messages
- `concise`: Short and to-the-point commit messages
- `cosmic`: Mystical, space-themed commit messages
- ..and lots more styles f
- ..and lots more styles

To use a preset for a single commit:

Expand Down Expand Up @@ -331,7 +327,7 @@ Distributed under the Apache 2.0 License. See `LICENSE` for more information.
Created by [Stefanie Jane 🌠](https://github.com/hyperb1iss)
If you find Git-Iris useful, consider [buying me a Monster Ultra Violet](https://ko-fi.com/hyperb1iss)! ⚡️
If you find Git-Iris useful, [buy me a Monster Ultra Violet](https://ko-fi.com/hyperb1iss)! ⚡️
</div>
Expand Down
51 changes: 32 additions & 19 deletions tests/changelog_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// tests/changelog_integration_tests.rs

#![cfg(feature = "integration")]

use anyhow::Result;
use dotenv::dotenv;
use git2::Repository;
use git_iris::changes::{ChangelogGenerator, ReleaseNotesGenerator};
use git_iris::changes::models::{ChangelogResponse, ReleaseNotesResponse};
use git_iris::common::DetailLevel;
use git_iris::config::Config;
use git_iris::llm_providers::LLMProviderType;
use git_iris::logger;
use std::env;
use tempfile::TempDir;
use std::path::Path;

// Reuse the setup_test_repo function from changelog_tests.rs
fn setup_test_repo() -> Result<(TempDir, Repository)> {

let _ = logger::init(); // Initialize the logger
logger::enable_logging(); // Enable logging
logger::set_log_to_stdout(true);

let temp_dir = TempDir::new()?;
let repo = Repository::init(temp_dir.path())?;

Expand Down Expand Up @@ -76,13 +86,19 @@ fn setup_test_repo() -> Result<(TempDir, Repository)> {
Ok((temp_dir, repo))
}

fn setup_config() -> Result<Config> {
dotenv().ok();
let mut config = Config::default();
config.default_provider = LLMProviderType::OpenAI.to_string();
let api_key = env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY not set");
config.providers.get_mut(&config.default_provider).unwrap().api_key = api_key;
Ok(config)
}

#[tokio::test]
#[ignore] // This test requires API keys and will be ignored by default
async fn test_changelog_generation() -> Result<()> {
let (temp_dir, _repo) = setup_test_repo()?;
let mut config = Config::default();
config.default_provider = LLMProviderType::OpenAI.to_string(); // Or whichever provider you want to test
config.providers.get_mut(&config.default_provider).unwrap().api_key = env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY not set");
let config = setup_config()?;

let changelog = ChangelogGenerator::generate(
temp_dir.path(),
Expand All @@ -95,22 +111,19 @@ async fn test_changelog_generation() -> Result<()> {

let changelog_response: ChangelogResponse = serde_json::from_str(&changelog)?;

assert!(changelog_response.version.is_some());
assert!(changelog_response.release_date.is_some());
assert!(!changelog_response.sections.is_empty());
assert!(changelog_response.metrics.total_commits > 0);
assert!(changelog_response.metrics.files_changed > 0);
assert!(changelog_response.version.is_some(), "Changelog should have a version");
assert!(changelog_response.release_date.is_some(), "Changelog should have a release date");
assert!(!changelog_response.sections.is_empty(), "Changelog should have sections");
assert!(changelog_response.metrics.total_commits > 0, "Changelog should have commits");
assert!(changelog_response.metrics.files_changed > 0, "Changelog should have file changes");

Ok(())
}

#[tokio::test]
#[ignore] // This test requires API keys and will be ignored by default
async fn test_release_notes_generation() -> Result<()> {
let (temp_dir, _repo) = setup_test_repo()?;
let mut config = Config::default();
config.default_provider = LLMProviderType::OpenAI.to_string(); // Or whichever provider you want to test
config.providers.get_mut(&config.default_provider).unwrap().api_key = env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY not set");
let config = setup_config()?;

let release_notes = ReleaseNotesGenerator::generate(
temp_dir.path(),
Expand All @@ -123,11 +136,11 @@ async fn test_release_notes_generation() -> Result<()> {

let release_notes_response: ReleaseNotesResponse = serde_json::from_str(&release_notes)?;

assert!(release_notes_response.version.is_some());
assert!(release_notes_response.release_date.is_some());
assert!(!release_notes_response.summary.is_empty());
assert!(release_notes_response.metrics.total_commits > 0);
assert!(release_notes_response.metrics.files_changed > 0);
assert!(release_notes_response.version.is_some(), "Release notes should have a version");
assert!(release_notes_response.release_date.is_some(), "Release notes should have a release date");
assert!(!release_notes_response.summary.is_empty(), "Release notes should have a summary");
assert!(release_notes_response.metrics.total_commits > 0, "Release notes should have commits");
assert!(release_notes_response.metrics.files_changed > 0, "Release notes should have file changes");

Ok(())
}

0 comments on commit 624ae9c

Please sign in to comment.