# thegent-subprocess
Subprocess management for thegent with hexagonal architecture.
## Architecture
**Hexagonal Architecture** (Ports & Adapters) with **Clean Architecture** layers.
### Domain Layer
- `Process` entity - subprocess with lifecycle
- `ProcessState` value object - process states
- `ProcessEvent` domain events
### Application Layer (CQRS)
- Commands: SpawnProcess, KillProcess, SetTimeout
- Queries: ListProcesses, GetProcess
- Use cases with event publishing
### Ports Layer
- `ProcessRunnerPort` - subprocess execution
- `ProcessRegistryPort` - process storage
- `ResourceLimiterPort` - resource constraints
### Adapters
- `InMemoryProcessRunner` - mock implementation
- `NativeProcessRunner` - real subprocess execution
## xDD Methodologies
- TDD, BDD, DDD, SOLID, CQRS, EDA, GRASP, LoD, SoC
## Usage
```rust
use thegent_subprocess::{Process, ProcessRunner, SpawnProcessCommand};
let runner = NativeProcessRunner::new();
let cmd = SpawnProcessCommand {
command: "echo hello".to_string(),
args: vec![],
cwd: None,
env: vec![],
};
let process = runner.spawn(cmd)?;
```
## License
MIT