load("@crates//:defs.bzl", "aliases", "all_crate_deps")

load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_proc_macro", "rust_test")



filegroup(

    name = "cargo_manifest",

    srcs = ["Cargo.toml"],

    visibility = ["//visibility:public"],

)



filegroup(

    name = "package_runfiles",

    srcs = glob(["Cargo.toml", "**/*"], exclude = ["BUILD", "BUILD.bazel"], allow_empty = True),

    visibility = ["//visibility:public"],

)



rust_library(
    name = "meerkat_mcp",
    aliases = aliases(package_name = "meerkat-mcp"),
    crate_name = "meerkat_mcp",
    crate_root = "src/lib.rs",
    crate_features = [],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mcp-server-setup/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.6.32",
        "CARGO_MANIFEST_DIR": "./meerkat-mcp",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-mcp",
        proc_macro = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-mcp",
        normal = True,
    ),
)

rust_library(
    name = "meerkat_mcp_agent_factory_build",
    aliases = aliases(package_name = "meerkat-mcp"),
    crate_name = "meerkat_mcp",
    crate_root = "src/lib.rs",
    crate_features = [],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mcp-server-setup/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = [
        "//meerkat:__pkg__",
    ],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.6.32",
        "CARGO_MANIFEST_DIR": "./meerkat-mcp",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-mcp",
        proc_macro = True,
    ),
    deps = [
        "//meerkat:meerkat_capabilities_agent_factory_build",
        "//meerkat:meerkat_contracts_agent_factory_build",
        "//meerkat:meerkat_core_agent_factory_build",
        "//meerkat:meerkat_skills_agent_factory_build",
    ] + all_crate_deps(
        package_name = "meerkat-mcp",
        normal = True,
    ),
)

rust_test(
    name = "meerkat_mcp_unit_test",
    aliases = aliases(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "meerkat_mcp",
    crate_root = "src/lib.rs",
    crate_features = [],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mcp-server-setup/SKILL.md",
    ],
    srcs = glob(["src/**/*.rs"]),
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.6.32",
        "CARGO_MANIFEST_DIR": "./meerkat-mcp",
    },
    tags = [
        "fast",
        "unit",
    ],
    size = "small",
    data = [
        ":package_runfiles",
    ],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-mcp",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-runtime:meerkat_runtime",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "external_tool_integration_test",
    aliases = aliases(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "external_tool_integration",
    crate_root = "tests/external_tool_integration.rs",
    crate_features = [],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mcp-server-setup/SKILL.md",
    ],
    srcs = [
        "tests/external_tool_integration.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.6.32",
        "CARGO_BIN_NAME": "external_tool_integration",
        "CARGO_MANIFEST_DIR": "./meerkat-mcp",
    },
    tags = [
        "integration",
    ],
    data = [],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-mcp",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-mcp:meerkat_mcp",
        "//meerkat-runtime:meerkat_runtime",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
    ),
)

rust_test(
    name = "lifecycle_contract_test",
    aliases = aliases(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
        proc_macro = True,
        proc_macro_dev = True,
    ),
    crate_name = "lifecycle_contract",
    crate_root = "tests/lifecycle_contract.rs",
    crate_features = [],
    edition = "2024",
    compile_data = [
        "Cargo.toml",
        "skills/mcp-server-setup/SKILL.md",
    ],
    srcs = [
        "tests/lifecycle_contract.rs",
    ],
    visibility = ["//visibility:public"],
    rustc_env = {
        "CARGO_PKG_VERSION": "0.6.32",
        "CARGO_BIN_NAME": "lifecycle_contract",
        "CARGO_MANIFEST_DIR": "./meerkat-mcp",
    },
    tags = [
        "fast",
    ],
    size = "small",
    data = [
        ":package_runfiles",
    ],
    env = {
        "RUST_MIN_STACK": "16777216",
    },
    proc_macro_deps = all_crate_deps(
        package_name = "meerkat-mcp",
        proc_macro = True,
        proc_macro_dev = True,
    ),
    deps = [
        "//meerkat-capabilities:meerkat_capabilities",
        "//meerkat-contracts:meerkat_contracts",
        "//meerkat-core:meerkat_core",
        "//meerkat-mcp:meerkat_mcp",
        "//meerkat-runtime:meerkat_runtime",
        "//meerkat-skills:meerkat_skills",
    ] + all_crate_deps(
        package_name = "meerkat-mcp",
        normal = True,
        normal_dev = True,
    ),
)

test_suite(
    name = "fast_tests",
    tests = [
        ":lifecycle_contract_test",
        ":meerkat_mcp_unit_test",
    ],
)
