[project]
name = "tecjustica"
version = "0.1.0"
description = "CLI para consulta de processos judiciais via MCP - TecJustica"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
authors = [{name = "Marcos Fonseca", email = "marcosmarf27@gmail.com"}]
keywords = ["mcp", "juridico", "processos", "cli", "tecjustica"]
classifiers = [
    "Development Status :: 4 - Beta",
    "Environment :: Console",
    "Intended Audience :: Legal Industry",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
]
dependencies = [
    "httpx>=0.27.0",
    "typer>=0.12.0",
    "tomli-w>=1.0.0",
    "rich>=13.0.0",
]

[project.scripts]
tecjustica = "tecjustica_cli.main:_error_handler"

[project.urls]
Homepage = "https://tecjustica.com"

[project.optional-dependencies]
dev = [
    "ruff>=0.8.0",
    "mypy>=1.13.0",
    "types-python-jose>=3.3.0",
    "pytest>=8.0.0",
    "pytest-asyncio>=0.24.0",
    "pytest-cov>=6.0.0",
    "requests>=2.31.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["tecjustica_cli"]

# ==================== RUFF ====================
[tool.ruff]
target-version = "py311"
line-length = 100
exclude = [
    ".venv",
    "__pycache__",
    ".git",
    "build",
    "dist",
]

[tool.ruff.lint]
select = [
    "E",      # pycodestyle errors
    "W",      # pycodestyle warnings
    "F",      # pyflakes
    "I",      # isort
    "B",      # flake8-bugbear
    "C4",     # flake8-comprehensions
    "UP",     # pyupgrade
    "ARG",    # flake8-unused-arguments
    "SIM",    # flake8-simplify
    "TCH",    # flake8-type-checking
    "PTH",    # flake8-use-pathlib
    "RUF",    # ruff-specific
]
ignore = [
    "E501",   # line too long (handled by formatter)
    "B008",   # function call in default argument (FastMCP uses this)
    "ARG001", # unused function argument (common in tools)
    "SIM105", # contextlib.suppress vs try/except/pass (logging blocks)
]

[tool.ruff.lint.isort]
known-first-party = ["tools", "services", "models", "auth", "tecjustica_cli"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false

# ==================== MYPY ====================
[tool.mypy]
python_version = "3.11"
warn_return_any = false
warn_unused_ignores = true
disallow_untyped_defs = false
disallow_incomplete_defs = false
check_untyped_defs = true
strict_optional = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_configs = true
show_error_codes = true
exclude = [
    ".venv",
    "tests",
]

[[tool.mypy.overrides]]
module = [
    "supabase.*",
    "openrouter.*",
    "fastmcp.*",
    "jose.*",
    "mcp.*",
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = [
    "services.*",
    "tools.*",
    "auth",
    "tecjustica_cli.*",
]
ignore_errors = true

# ==================== PYTEST ====================
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
addopts = [
    "-v",
    "--tb=short",
    "--strict-markers",
]
markers = [
    "integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
    "e2e: marks tests as end-to-end against production (deselect with '-m \"not e2e\"')",
]

# ==================== COVERAGE ====================
[tool.coverage.run]
source = ["."]
omit = [
    ".venv/*",
    "tests/*",
    "*/__pycache__/*",
]

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
    "if __name__ == .__main__.:",
]
