[workspace]
members = [
    ".",
]
exclude = ["fuzz"]
resolver = "2"

[workspace.lints.rust]
unsafe_code = "forbid"
missing_docs = "allow"  # TODO: Add comprehensive documentation

[workspace.lints.clippy]
# Correctness
correctness = { level = "deny", priority = -1 }
suspicious = { level = "deny", priority = -1 }
complexity = { level = "warn", priority = -1 }
perf = { level = "warn", priority = -1 }
style = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }

# Specific lints to deny  
enum_glob_use = "deny"
unimplemented = "warn"
todo = "warn"
dbg_macro = "deny"

# Additional pedantic lints
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_precision_loss = "allow"  # Tests can cast for demonstration
cast_sign_loss = "warn"
checked_conversions = "warn"
cloned_instead_of_copied = "warn"
cognitive_complexity = "allow"  # Test functions can be complex
default_trait_access = "allow"  # Tests can use Default::default() explicitly
doc_markdown = "warn"
empty_enum = "warn"
enum_variant_names = "warn"
expl_impl_clone_on_copy = "warn"
explicit_deref_methods = "warn"
explicit_into_iter_loop = "warn"
explicit_iter_loop = "warn"
filter_map_next = "warn"
flat_map_option = "warn"
float_cmp = "allow"  # Tests can compare floats for exact values
float_cmp_const = "warn"
fn_params_excessive_bools = "warn"
from_iter_instead_of_collect = "warn"
if_not_else = "warn"
implicit_clone = "warn"
implicit_hasher = "warn"
implicit_saturating_sub = "warn"
inconsistent_struct_constructor = "warn"
inefficient_to_string = "warn"
inline_always = "warn"
invalid_upcast_comparisons = "warn"
items_after_statements = "warn"
large_digit_groups = "warn"
large_stack_arrays = "warn"
large_types_passed_by_value = "warn"
let_unit_value = "warn"
linkedlist = "warn"
macro_use_imports = "warn"
manual_assert = "warn"
manual_instant_elapsed = "warn"
manual_let_else = "warn"
manual_ok_or = "warn"
manual_string_new = "warn"
map_flatten = "warn"
map_unwrap_or = "warn"
match_bool = "warn"
match_same_arms = "warn"
match_wild_err_arm = "warn"
match_wildcard_for_single_variants = "warn"
maybe_infinite_iter = "warn"
mismatching_type_param_order = "warn"
missing_errors_doc = "warn"
missing_fields_in_debug = "warn"
missing_panics_doc = "warn"
module_name_repetitions = "warn"
must_use_candidate = "warn"
mut_mut = "warn"
naive_bytecount = "warn"
needless_bitwise_bool = "warn"
needless_continue = "warn"
needless_for_each = "warn"
needless_pass_by_value = "warn"
needless_raw_string_hashes = "warn"
negative_feature_names = "warn"
no_effect_underscore_binding = "warn"
no_mangle_with_rust_abi = "warn"
option_option = "warn"
pub_without_shorthand = "warn"
range_minus_one = "warn"
range_plus_one = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
redundant_clone = "warn"
redundant_closure_for_method_calls = "warn"
redundant_else = "warn"
redundant_feature_names = "warn"
redundant_pub_crate = "warn"
ref_binding_to_reference = "warn"
ref_option_ref = "warn"
return_self_not_must_use = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
should_panic_without_expect = "warn"
similar_names = "warn"
single_match_else = "warn"
stable_sort_primitive = "warn"
string_add = "warn"
string_add_assign = "warn"
struct_excessive_bools = "warn"
struct_field_names = "warn"
too_many_lines = "warn"
trait_duplication_in_bounds = "warn"
transmute_ptr_to_ptr = "warn"
trivially_copy_pass_by_ref = "warn"
type_repetition_in_bounds = "warn"
unchecked_duration_subtraction = "warn"
unicode_not_nfc = "warn"
uninlined_format_args = "warn"
unnecessary_box_returns = "warn"
unnecessary_join = "warn"
unnecessary_wraps = "warn"
unnested_or_patterns = "warn"
unreadable_literal = "warn"
unused_async = "warn"
unused_self = "warn"
used_underscore_binding = "warn"
verbose_bit_mask = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"

# Cargo lints
cargo_common_metadata = "warn"

# Allow some things that are too strict
module_inception = "allow"
# Allow test-related patterns as specified in CLAUDE.md
unwrap_used = "allow"  # Tests can use unwrap for clarity
expect_used = "allow"  # Tests can use expect for clarity  
panic = "allow"        # Tests can panic
print_stdout = "allow" # Examples and tests can print
print_stderr = "allow" # Examples and tests can print
empty_line_after_doc_comments = "allow"  # Documentation formatting flexibility
format_push_string = "allow"  # Tests can use format! for clarity
absurd_extreme_comparisons = "allow"  # Tests can check edge cases
approx_constant = "allow"  # Tests can use literal values
unnecessary_to_owned = "allow"  # Tests can be explicit

[workspace.package]
version = "1.31.0"
edition = "2021"
authors = ["Noah Gift"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/paiml/ruchy"
homepage = "https://github.com/paiml/ruchy"
documentation = "https://docs.rs/ruchy"
rust-version = "1.75"

[workspace.dependencies]
anyhow = "1.0"
thiserror = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tracing = "0.1"
tracing-subscriber = "0.3"

# Parsing
logos = "0.14"
pest = "2.7"
pest_derive = "2.7"

# Code generation
syn = { version = "2.0", features = ["full", "extra-traits", "visit-mut"] }
quote = "1.0"
proc-macro2 = "1.0"
prettyplease = "0.2"

# REPL
rustyline = "14.0"
rustyline-derive = "0.10"

# Testing
proptest = "1.4"
criterion = "0.5"
insta = { version = "1.40", features = ["yaml"] }
quickcheck = "1.0"
quickcheck_macros = "1.0"

[package]
name = "ruchy"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "A systems scripting language that transpiles to idiomatic Rust with extreme quality engineering"
readme = "README.md"
keywords = ["language", "compiler", "transpiler", "rust", "scripting"]
categories = ["compilers", "development-tools", "parser-implementations"]
exclude = ["src/bin/ruchy-lsp.rs", "src/bin/ruchy-coverage.rs"]

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

[lib]
crate-type = ["cdylib", "rlib"]

[lints]
workspace = true

[features]
default = []
dataframe = ["polars"]
testing = ["proptest"]
mcp = ["tokio", "tokio-util", "pmcp", "async-trait", "tower-lsp"]

[dependencies]
anyhow = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tracing = { workspace = true }
logos = { workspace = true }
pest = { workspace = true }
pest_derive = { workspace = true }
syn = { workspace = true }
quote = { workspace = true }
im = "15.1"
quickcheck = "1.0"
smallvec = "1.13"
proc-macro2 = { workspace = true }
prettyplease = { workspace = true }
rustyline = { workspace = true }
colored = "2.1"
walkdir = "2.4"
clap = { version = "4.5", features = ["derive"] }
regex = "1.10"
# DataFrame support
polars = { version = "0.35", features = ["lazy"], optional = true }
# WebAssembly support
uuid = { version = "1.6", features = ["v4"] }
wasm-bindgen = "0.2"
serde-wasm-bindgen = "0.6"
js-sys = "0.3"
web-sys = { version = "0.3", features = ["console"] }
console_error_panic_hook = "0.1"
# Hardware detection
num_cpus = "1.16"
# MCP Integration (optional for WASM compatibility)
pmcp = { version = "1.2.2", features = ["full"], optional = true }
tokio = { version = "1.46", features = ["full"], optional = true }
tokio-util = { version = "0.7", features = ["rt"], optional = true }
async-trait = { version = "0.1", optional = true }
# Snapshot testing
sha2 = "0.10"
toml = "0.8"
chrono = "0.4"
notify = "4.0"
# LSP support (optional for WASM compatibility)
tower-lsp = { version = "0.20", optional = true }
once_cell = "1.19"
# Compilation support
tempfile = "3.8"
proptest = { version = "1.4", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }

[dev-dependencies]
proptest = { workspace = true }
criterion = { workspace = true }
insta = { workspace = true }
tracing-subscriber = { workspace = true }
quickcheck = { workspace = true }
assert_cmd = "2.0"
predicates = "3.0"
tempfile = "3.8"
quickcheck_macros = { workspace = true }
walkdir = "2.4"

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

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

[profile.dev]
opt-level = 0

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

[profile.release-dist]
inherits = "release"
strip = true           # Remove debug symbols
lto = "fat"           # Maximum link-time optimization
codegen-units = 1     # Single codegen unit for better optimization
panic = "abort"       # Smaller panic handler
opt-level = "z"       # Optimize for binary size
