[package]
name = "mermaid-cli"
version = "0.12.1"
edition = "2024"
default-run = "mermaid"
# `str::floor_char_boundary` (used in several places for UTF-8-safe slicing)
# stabilized in Rust 1.91.0 — confirmed by clippy::incompatible_msrv.
rust-version = "1.91"
authors = ["Noah Sabaj <noahsabaj@gmail.com>"]
description = "Open-source AI pair programmer with agentic capabilities. Local-first with Ollama, native tool calling, and beautiful TUI."
repository = "https://github.com/noahsabaj/mermaid-cli"
homepage = "https://github.com/noahsabaj/mermaid-cli"
documentation = "https://github.com/noahsabaj/mermaid-cli#readme"
readme = "README.md"
license = "MIT OR Apache-2.0"
keywords = ["ai", "coding-assistant", "ollama", "tui", "pair-programming"]
categories = ["command-line-utilities", "development-tools"]

[workspace]
members = [
    ".",
    "crates/mermaid-runtime",
]

[[bin]]
name = "mermaid"
path = "src/main.rs"

[[bin]]
name = "mermaidd"
path = "src/bin/mermaidd.rs"

[dependencies]
# Async runtime. 1.44 closes RUSTSEC-2025-0023 (broadcast channel unsoundness).
tokio = { version = "1.44", features = ["full"] }
tokio-stream = "0.1"
# `CancellationToken` for per-turn structured concurrency in
# `src/effect/`. The v0.7 architecture uses one token per `TurnScope`
# so cancelling a turn aborts every child task at its next await —
# replaces the polling-based check_interrupt pattern in the old agent
# loop. Minimum-viable feature set only (sync primitives).
tokio-util = { version = "0.7", default-features = false, features = ["rt"] }
futures = "0.3"

# TUI
ratatui = { version = "0.30", features = ["scrolling-regions"] }
# `event-stream` flips crossterm's event reader into a `Stream` so the
# v0.7 main loop can drive crossterm events + effect results off one
# `tokio::select!`. No more dual event loops.
crossterm = { version = "0.29", features = ["event-stream"] }

# Config & Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
toml = "1.1"

# CLI
clap = { version = "4.6", features = ["derive", "env"] }

# Markdown rendering
pulldown-cmark = "0.13"

# Utils
anyhow = "1.0"
thiserror = "2.0"
async-trait = "0.1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
chrono = { version = "0.4", features = ["serde"] }
directories = "6.0"
which = "8.0"  # Find executables
reqwest = { version = "0.13", default-features = false, features = ["json", "stream", "rustls"] }
bytes = "1.11"
rusqlite = { version = "0.40", features = ["bundled"] }
getrandom = "0.4"
sha2 = "0.11"
mermaid-runtime = { path = "crates/mermaid-runtime", version = "0.12.1" }

# Additional utilities
regex = "1.12"
rustc-hash = "2.0"  # Faster non-cryptographic hash for HashMap
base64 = "0.22"  # Base64 encoding for binary files (PDFs, images)
rpassword = "7.4.0"
unicode-width = "0.2"
sysinfo = { version = "0.38.4", default-features = false, features = ["system"] }

[dev-dependencies]
# Scoped env-var guards — replaces `unsafe { std::env::set_var / remove_var }`
# patterns in model + auth tests. Safer under `--test-threads > 1`.
# `async_closure` feature enables `async_with_vars` for tokio-test paths.
temp-env = { version = "0.3", features = ["async_closure"] }
# Real pseudo-terminal harness for exit/terminal-mode regression tests.
portable-pty = "0.9"

[profile.release]
lto = true
codegen-units = 1
strip = true
opt-level = 3

[package.metadata.deb]
name = "mermaid-cli"
maintainer = "Noah Sabaj <noahsabaj@gmail.com>"
copyright = "2026, Noah Sabaj"
license-file = ["LICENSE-MIT", "0"]
extended-description = "Mermaid is a local-first, multi-provider AI coding assistant with a TUI client, daemon runtime, durable task state, and agentic tool calling."
section = "utils"
priority = "optional"
assets = [
    ["target/release/mermaid", "usr/bin/", "755"],
    ["target/release/mermaidd", "usr/bin/", "755"],
    ["README.md", "usr/share/doc/mermaid-cli/README.md", "644"],
    ["LICENSE-MIT", "usr/share/doc/mermaid-cli/LICENSE-MIT", "644"],
    ["LICENSE-APACHE", "usr/share/doc/mermaid-cli/LICENSE-APACHE", "644"],
    ["packaging/systemd/mermaidd.service", "usr/lib/systemd/user/mermaidd.service", "644"],
]

[package.metadata.generate-rpm]
assets = [
    { source = "target/release/mermaid", dest = "/usr/bin/mermaid", mode = "755" },
    { source = "target/release/mermaidd", dest = "/usr/bin/mermaidd", mode = "755" },
    { source = "README.md", dest = "/usr/share/doc/mermaid-cli/README.md", mode = "644", doc = true },
    { source = "LICENSE-MIT", dest = "/usr/share/doc/mermaid-cli/LICENSE-MIT", mode = "644", doc = true },
    { source = "LICENSE-APACHE", dest = "/usr/share/doc/mermaid-cli/LICENSE-APACHE", mode = "644", doc = true },
    { source = "packaging/systemd/mermaidd.service", dest = "/usr/lib/systemd/user/mermaidd.service", mode = "644" },
]
