[package]
name = "prx"
version = "0.5.15"
edition = "2024"
rust-version = "1.85"
description = "Praxis — agent-native Unix tools. Single binary replacing grep, cat, find, sed, diff for AI coding agents."
license = "Apache-2.0"
repository = "https://github.com/civitas-io/prx"
keywords = ["cli", "ai", "agent", "search", "tools"]
categories = ["command-line-utilities", "development-tools"]
readme = "README.md"
exclude = [
    "models/",
    "benchmarks/",
    "book/",
    "docs/",
    ".prx/",
    ".github/",
]

[dependencies]
# CLI framework — derive API with multicall for busybox-style dispatch
clap = { version = "4.6", features = ["derive"] }

# AST parsing — 0.26 confirmed compatible with all grammar crates via tree-sitter-language bridge
tree-sitter = "0.26"
# Structural search patterns (fn $NAME($$$))
ast-grep-core = "0.42"

# Embedding model weights — zero-copy deserialization from include_bytes!
safetensors = "0.7"
# Dense matrix ops — embedding lookup, mean pool, L2 normalize, cosine similarity
ndarray = "0.17"
# Sparse matrices — pre-computed BM25 scores in CSC format
sprs = "0.11"

# Token counting — cl100k_base tokenizer for --budget enforcement
tokenizers = "0.23"

# Diff computation — TextDiff for ag diff, ChangeTag iteration
similar = "3.1"

# Bloom filter — O(1) existence checks for ag exists
bloomfilter = "3.0"

# JSON serialization — output envelope, structured errors
serde = { version = "1", features = ["derive"] }
serde_json = "1"

# Content hashing — xxh3 128-bit for change detection
xxhash-rust = { version = "0.8", features = ["xxh3"] }

# .gitignore-aware file walking — from ripgrep
ignore = "0.4"

# Error handling
thiserror = "2"                    # Typed errors for library code (AgError enum)
anyhow = "1"                      # Ergonomic errors for CLI main()

# Regex for literal search and identifier extraction
regex = "1"

# Home directory resolution for stats file
dirs-next = "2"

# Parallel iteration — embarrassingly parallel indexing (chunking, embedding, import extraction)
rayon = "1"

# Memory-mapped files — zero-copy embedding index access, OS page cache keeps index warm across queries
memmap2 = "0.9"
# Safe byte-to-float casting — reinterpret mmap'd &[u8] as &[f32] with alignment validation
bytemuck = { version = "1", features = ["extern_crate_alloc"] }

# Binary serialization for persistent index
# postcard: compact serde serialization for index files (replaces unmaintained bincode, RUSTSEC-2025-0141)
postcard = { version = "1", features = ["alloc"] }

# f16 support for loading float16 model weights
half = "2"

# Continuation token encoding for paginated search
base64 = "0.22"

# MCP server (optional, enabled by default)
rmcp = { version = "1", features = ["server", "transport-io", "schemars"], optional = true }
tokio = { version = "1", features = ["full"], optional = true }
schemars = { version = "1", optional = true }

# File watching (optional, for ag index --watch)
notify = { version = "8", optional = true }

# Tree-sitter language grammars — all confirmed working with tree-sitter 0.26
tree-sitter-rust = "0.24"
tree-sitter-python = "0.25"
tree-sitter-javascript = "0.25"
tree-sitter-typescript = "0.23"
tree-sitter-go = "0.25"
tree-sitter-java = "0.23"
tree-sitter-c = "0.24"
tree-sitter-cpp = "0.23"
tree-sitter-ruby = "0.23"
tree-sitter-bash = "0.25"
tree-sitter-json = "0.24"
tree-sitter-html = "0.23"
tree-sitter-css = "0.25"
# v0.5.10 — additional language grammars
tree-sitter-kotlin = { package = "tree-sitter-kotlin-sg", version = "0.4" }  # Kotlin grammar — -sg fork for tree-sitter 0.26 compat
tree-sitter-swift = "0.7"              # Swift grammar (iOS/macOS development)
tree-sitter-c-sharp = "0.23"           # C# grammar (.NET ecosystem)
tree-sitter-php = "0.24"               # PHP grammar (web backends, Laravel/Symfony)
tree-sitter-elixir = "0.3"             # Elixir grammar (BEAM/OTP ecosystem)
# v0.5.10 — config/scripting language grammars
tree-sitter-yaml = "0.7"              # YAML grammar (CI/CD configs, Kubernetes manifests, Docker Compose)
tree-sitter-toml = { package = "tree-sitter-toml-ng", version = "0.7" }  # TOML grammar — -ng fork for tree-sitter 0.26 compat
tree-sitter-markdown = { package = "tree-sitter-md", version = "0.5" }  # Markdown grammar — tree-sitter-md with LanguageFn API
tree-sitter-dockerfile = { package = "tree-sitter-containerfile", version = "0.8" }  # Dockerfile grammar — containerfile crate with LanguageFn API
tree-sitter-hcl = "1.1"               # HCL/Terraform grammar (infrastructure as code)
tree-sitter-sql = { package = "tree-sitter-sequel", version = "0.3" }  # SQL grammar — sequel fork with LanguageFn API
tree-sitter-make = "1.1"              # Makefile grammar (build systems)

[features]
default = ["mcp"]
mcp = ["rmcp", "tokio", "schemars"]
watch = ["notify", "tokio"]

[profile.release]
lto = true
strip = true
codegen-units = 1
opt-level = "z"                    # Optimize for size (model weights dominate binary)

[dev-dependencies]
assert_cmd = "2"                   # CLI integration testing
predicates = "3"                   # Assertion helpers for CLI output
tempfile = "3"                     # Temp dirs for test fixtures
criterion = "0.8"                  # Benchmarking

[[bench]]
name = "search"
harness = false

[[bench]]
name = "chunking"
harness = false

[build-dependencies]
# HTTP downloads for model weights — minimal blocking client, no async runtime
ureq = "3"
# SHA-256 verification of downloaded artifacts (pinned hashes)
sha2 = "0.10"
# F32 -> F16 conversion for safetensors embeddings (reuses regular dependency)
half = "2"
# Parse/rewrite the safetensors JSON header during F32 -> F16 conversion
serde_json = "1"
