[package]
name = "alcove"
version = "0.11.3"
edition = "2024"
description = "A quiet place for your project docs. MCP server that gives AI agents scoped access to private documentation."
license = "Apache-2.0"
repository = "https://github.com/epicsagas/alcove"
homepage = "https://github.com/epicsagas/alcove"
keywords = ["mcp", "documentation", "ai", "cli"]
categories = ["command-line-utilities", "development-tools"]

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

[lib]
name = "alcove"
path = "src/lib.rs"

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.tar.xz"
pkg-fmt = "txz"
bin-dir = "{ name }-{ target }/{ bin }"

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
bin-dir = "{ bin }.exe"

[dependencies]
anyhow = "1"
indexmap = "2"
clap = { version = "4", features = ["derive"] }
dialoguer = { version = "0.12", features = ["fuzzy-select"] }
console = "0.16"
dirs = "6"
indicatif = "0.18"
rand = "0.10"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
toml = "1"
walkdir = "2"
regex = "1"
libc = "0.2"
rayon = "1"
rust-i18n = "4"
sys-locale = "0.3.2"
tantivy = "0.26"
chrono = { version = "0.4", features = ["clock"] }

# Embedding backends (mutually exclusive in practice)
candle-transformers = { version = "0.10", optional = true }
candle-nn = { version = "0.10", optional = true }
candle-core = { version = "0.10", optional = true }
hf-hub = { version = "0.4", default-features = false, features = ["ureq"], optional = true }
tokenizers = { version = "0.22", optional = true }

# Storage & indexing
rusqlite = { version = "0.39", features = ["bundled"], optional = true }
hnsw_rs = { version = "0.3", optional = true }

# Document parsers
pdf-extract = { version = "0.10", optional = true }  # Unix-only
zip = { version = "8.5", optional = true }
quick-xml = { version = "0.39", optional = true }
calamine = { version = "0.34", optional = true }

# Lightweight sync HTTP client for MCP proxy mode
ureq = "3"

# Token-optimized document transpiler (optional, transpile feature)
llm-transpile = { version = "0.2.4", optional = true }

# Code structure indexing (core always present; grammars are feature-gated)
tree-sitter = "0.26"
tree-sitter-rust = { version = "0.24", optional = true }

# Additional grammar crates (Phase 2+)
tree-sitter-python = { version = "0.25", optional = true }
tree-sitter-typescript = { version = "0.23", optional = true }
tree-sitter-javascript = { version = "0.25", optional = true }
tree-sitter-go = { version = "0.25", optional = true }
tree-sitter-java = { version = "0.23", optional = true }
tree-sitter-kotlin-ng = { version = "1.1", optional = true }
tree-sitter-c = { version = "0.24", optional = true }
tree-sitter-cpp = { version = "0.23", optional = true }
tree-sitter-swift = { version = "0.7", optional = true }
tree-sitter-ruby = { version = "0.23", optional = true }
tree-sitter-c-sharp = { version = "0.23", optional = true }

# HTTP server dependencies
axum = { version = "0.8", optional = true }
tokio = { version = "1", features = ["rt-multi-thread", "macros"], optional = true }
socket2 = { version = "0.5", optional = true }
tower-http = { version = "0.6", features = ["cors"], optional = true }

[features]
default = ["core"]
core = ["rusqlite", "alcove-server", "lang-rust"]
embed-candle = ["candle-transformers", "candle-nn", "candle-core", "hf-hub", "tokenizers"]
vector = ["hnsw_rs"]
pdf = ["pdf-extract"]
office = ["zip", "quick-xml", "calamine"]
alcove-server = ["axum", "tokio", "tower-http", "socket2"]
transpile = ["dep:llm-transpile"]

# Language parsers (feature-gated for compile time control)
lang-rust = ["dep:tree-sitter-rust"]
lang-python = ["dep:tree-sitter-python"]
lang-typescript = ["dep:tree-sitter-typescript"]
lang-javascript = ["dep:tree-sitter-javascript"]
lang-go = ["dep:tree-sitter-go"]
lang-java = ["dep:tree-sitter-java"]
lang-kotlin = ["dep:tree-sitter-kotlin-ng"]
lang-c = ["dep:tree-sitter-c"]
lang-cpp = ["dep:tree-sitter-cpp"]
lang-swift = ["dep:tree-sitter-swift"]
lang-ruby = ["dep:tree-sitter-ruby"]
lang-csharp = ["dep:tree-sitter-c-sharp"]
lang-all = [
    "lang-rust", "lang-python", "lang-typescript", "lang-javascript",
    "lang-go", "lang-java", "lang-kotlin", "lang-c", "lang-cpp",
    "lang-swift", "lang-ruby", "lang-csharp",
]

# Preset feature groups
full-macos = ["core", "embed-candle", "vector", "pdf", "office", "alcove-server", "lang-all"]
full-cross = ["core", "embed-candle", "vector", "office", "alcove-server", "lang-all"]
# Backward compat: full = full-macos on existing macOS ARM builds
full = ["full-cross"]

[dev-dependencies]
tempfile = "3.26.0"
serial_test = "3"

# ---------------------------------------------------------------------------
# Build optimizations
# ---------------------------------------------------------------------------

[profile.dev]
opt-level = 0
debug = 1              # line numbers only, skip full debuginfo (saves link time)

[profile.release]
opt-level = 3
lto = "thin"           # faster than full LTO, still good dead-code elimination
codegen-units = 1      # single unit for best optimization
strip = "symbols"      # smaller binary, faster install copy
panic = "abort"        # drop unwind table — 5-15% smaller binary

[profile.release.package."*"]
opt-level = 3
codegen-units = 4      # dependencies can parallelize more aggressively

# The profile that 'dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"

# ---------------------------------------------------------------------------
# cargo-dist distribution config
# ---------------------------------------------------------------------------

[workspace]
members = []
