# Repository API
Fluent, chainable API for repository operations.
## Pattern
```rust
repo.operation() // Start
.option(value) // Configure
.option(value) // Configure more
.execute()? // Run
```
## Commits
```rust
// Initial commit
let hash = repo.commit()
.message("Initial commit")
.author("admin")
.initial()
.execute()?;
// Add files
let hash = repo.commit()
.message("Add feature")
.author("developer")
.parent(&previous_hash)
.file("README.md", b"# Project")
.file("src/lib.rs", b"pub fn hello() {}")
.execute()?;
```
## Branches
```rust
// List
let branches = repo.branches().list()?;
// Create
repo.branches()
.create("feature-x")
.from_branch("trunk")
.author("developer")
.execute()?;
// Get tip
let checkin = repo.branches().get("feature-x")?.tip()?;
```
## Tags
```rust
// At branch
repo.tags()
.create("v1.0.0")
.at_branch("trunk")
.author("developer")
.execute()?;
// At commit
repo.tags()
.create("v1.0.1")
.at_commit(&hash)
.author("developer")
.execute()?;
```
## Reading Files
```rust
// From trunk
let content = repo.files().on_trunk().read("README.md")?;
let text = repo.files().on_trunk().read_string("config.json")?;
// From branch
let content = repo.files().on_branch("feature").read("src/lib.rs")?;
// From tag
let content = repo.files().at_tag("v1.0.0").read("Cargo.toml")?;
// List/find
let files = repo.files().on_trunk().list()?;
let rust_files = repo.files().on_trunk().find("**/*.rs")?;
```
## Filesystem Operations
```rust
// Modify (atomic commit)
repo.fs().modify()
.message("Reorganize project")
.author("developer")
.copy_file("README.md", "docs/README.md")
.copy_dir("src", "backup/src")
.move_file("old.txt", "archive/old.txt")
.delete_file("temp.log")
.delete_dir("cache")
.chmod("scripts/run.sh", 0o755)
.make_executable("bin/app")
.symlink("lib/latest", "lib/v2.0")
.execute()?;
// Find files
let files = repo.fs().find()
.pattern("**/*.rs")
.ignore("target/**")
.ignore_hidden(true)
.paths()?;
// Quick checks (no commit)
let exists = repo.fs().exists("README.md")?;
let is_dir = repo.fs().is_dir("src")?;
let size = repo.fs().du("**/*.rs")?;
let count = repo.fs().count("**/*.rs")?;
```
## History
```rust
// Recent commits
let commits = repo.history().limit(10).list()?;
// Specific commit
let commit = repo.history().get("abc123")?;
```
## Users
```rust
// List
let users = repo.users().list()?;
// Create
repo.users()
.create("developer")
.password("secret")
.capabilities("ei")
.execute()?;
```