# governor-core

Core domain library for cargo-governor, providing fundamental entities and
traits for release automation.

## Overview

This library contains the pure domain layer and core abstractions used
throughout the cargo-governor ecosystem. It follows Domain-Driven Design
(DDD) principles with Clean Architecture.

## Features

- **Domain Entities**: Pure data structures for Version, Commit, Release,
  Crate, Workspace, etc.
- **Core Traits**: Abstractions for SourceControl, VersionStrategy,
  WorkflowStep, CheckpointStore
- **Zero Unsafe Code**: Entirely safe Rust with `forbid(unsafe_code)`
- **Semantic Versioning**: Full support for semantic version parsing and
  bumping
- **Conventional Commits**: Parse and analyze conventional commit messages

## Modules

### Domain (`domain`)

Core domain entities following DDD principles:

- [`version`] - Semantic versioning with bump types (major, minor, patch,
  none)
- [`commit`] - Git commit with conventional commit parsing
- [`changelog`] - Changelog generation and management
- [`release`] - Release planning and execution
- [`crate_entity`] - Crate metadata and dependencies
- [`workspace`] - Workspace metadata and status
- [`dependency`] - Dependency information

### Traits (`traits`)

Core abstractions for infrastructure implementations:

- [`version_strategy`] - Strategy pattern for version analysis
- [`source_control`] - Git/VCS operations abstraction
- [`workflow_step`] - Workflow execution step abstraction
- [`checkpoint_store`] - State persistence for resume capability
- [`reversible_operation`] - Operations with rollback support

## Usage

```rust
use governor_core::{
    domain::{
        version::{SemanticVersion, BumpType},
        commit::{Commit, CommitType}
    },
    traits::version_strategy::{VersionStrategy, ConventionalStrategy},
};

// Parse a version
let version = SemanticVersion::parse("1.0.0").unwrap();
let new_version = version.bump(BumpType::Minor);

// Create a commit
let commit = Commit::new(
    "abc123".to_string(),
    "feat: add new feature".to_string(),
    "Author".to_string(),
    "author@example.com".to_string(),
    chrono::Utc::now(),
);

// Analyze commits for version bump
let strategy = ConventionalStrategy::new();
let recommendation = strategy.analyze(&context).await?;
```

## Design Principles

1. **Pure Domain**: Domain entities have no external dependencies
2. **Trait-Based Abstractions**: All external interactions through traits
3. **Serialization Support**: All entities support serde serialization
4. **Error Handling**: Comprehensive error types with thiserror

## License

MIT OR Apache-2.0
