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

[project]
name = "mcp-vector-search"
dynamic = ["version"]
description = "CLI-first semantic code search with MCP integration and interactive D3.js visualization for exploring code relationships"
readme = "README.md"
license = {file = "LICENSE"}
authors = [
    {name = "Robert Matsuoka", email = "bob@matsuoka.com"},
]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Topic :: Software Development :: Libraries :: Python Modules",
    "Topic :: Software Development :: Code Generators",
    "Topic :: Software Development :: Quality Assurance",
    "Topic :: Scientific/Engineering :: Visualization",
]
keywords = ["semantic-search", "code-search", "mcp", "vector-database", "visualization", "d3js", "code-graph", "interactive-graph", "force-layout"]
requires-python = ">=3.11"
dependencies = [
    "chromadb>=0.5.0",
    "sentence-transformers>=2.2.2",
    "tree-sitter>=0.20.1",
    "tree-sitter-language-pack>=0.9.0",
    "typer>=0.9.0",
    "rich>=13.0.0",
    "pydantic>=2.5.0",
    "pydantic-settings>=2.1.0",
    "watchdog>=3.0.0",
    "aiofiles>=23.0.0",
    "loguru>=0.7.0",
    "httpx>=0.25.0",
    "mcp>=1.12.4",
    "click-didyoumean>=0.3.0",
    "packaging>=23.0",
    "authlib>=1.6.4",
    "starlette>=0.49.1",
    "fastapi>=0.104.0",
    "uvicorn>=0.24.0",
    "py-mcp-installer>=0.1.4",
]

[dependency-groups]
dev = [
    "pytest>=7.4.0",
    "pytest-asyncio>=0.21.0",
    "pytest-benchmark>=4.0.0",
    "pytest-cov>=4.1.0",
    "pytest-mock>=3.11.0",
    "pytest-xdist>=3.3.0",
    "pytest-watch>=4.2.0",
    "hypothesis>=6.88.0",
    "black>=23.0.0",
    "ruff>=0.1.0",
    "mypy>=1.7.0",
    "pre-commit>=3.5.0",
    "coverage[toml]>=7.3.0",
    "build>=1.3.0",
    "twine>=6.1.0",
    "safety>=3.0.0",
    "bandit>=1.7.0",
]
docs = [
    "sphinx>=7.0.0",
    "sphinx-rtd-theme>=1.3.0",
    "sphinx-autodoc-typehints>=1.25.0",
]

[project.urls]
Homepage = "https://github.com/bobmatnyc/mcp-vector-search"
Documentation = "https://mcp-vector-search.readthedocs.io"
Repository = "https://github.com/bobmatnyc/mcp-vector-search"
"Bug Tracker" = "https://github.com/bobmatnyc/mcp-vector-search/issues"

[project.scripts]
mcp-vector-search = "mcp_vector_search.cli.main:cli_with_suggestions"
mcp-vector-search-mcp = "mcp_vector_search.mcp.__main__:main"

[tool.hatch.version]
path = "src/mcp_vector_search/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/mcp_vector_search"]

# UV-specific configuration
# Note: dev-dependencies moved to [dependency-groups] section above

[tool.uv.sources]
py-mcp-installer = { path = "vendor/py-mcp-installer-service", editable = true }

# Development tools configuration
[tool.black]
line-length = 88
target-version = ['py311']
include = '\.pyi?$'
extend-exclude = '''
/(
  # directories
  \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | build
  | dist
)/
'''

[tool.ruff]
target-version = "py311"
line-length = 88

[tool.ruff.lint]
select = [
    "E",   # pycodestyle errors
    "W",   # pycodestyle warnings
    "F",   # pyflakes
    "I",   # isort
    "B",   # flake8-bugbear
    "C4",  # flake8-comprehensions
    "UP",  # pyupgrade
    "N",   # pep8-naming
]
ignore = [
    "E501",  # line too long, handled by formatter
    "B008",  # do not perform function calls in argument defaults
    "C901",  # too complex
    "B904",  # raise from within except (too strict for CLI)
    "F821",  # undefined name (handled by mypy)
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**/*" = ["B011", "B017", "B018", "B023", "E402", "E722"]  # Allow test-specific patterns
"tests/unit/test_state_manager.py" = ["E402"]  # Required path manipulation before imports
"tests/manual/*" = ["E402", "E722"]  # Allow path manipulation and broad exceptions in manual tests
"scripts/**/*" = ["F401", "B023", "E402"]  # Scripts may import for availability checks
"src/mcp_vector_search/cli/commands/*.py" = ["F821"]  # CLI commands may have undefined names

[tool.mypy]
python_version = "3.11"
check_untyped_defs = true
disallow_any_generics = false
disallow_incomplete_defs = false
disallow_untyped_defs = false
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = false
warn_return_any = false
strict_equality = true
show_error_codes = true
ignore_errors = true

[[tool.mypy.overrides]]
module = [
    "tree_sitter",
    "tree_sitter_languages",
    "watchdog.*",
    "chromadb.*",
]
ignore_missing_imports = true

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
addopts = [
    "--strict-markers",
    "--strict-config",
    "--cov=mcp_vector_search",
    "--cov-report=term-missing",
    "--cov-report=html",
    "--cov-report=xml",
    "--ignore=tests/manual",
    "--ignore=tests/e2e",
]
asyncio_mode = "auto"
markers = [
    "slow: marks tests as slow (deselect with '-m \"not slow\"')",
    "benchmark: marks tests as benchmarks",
    "integration: marks tests as integration tests",
]

[tool.coverage.run]
source = ["src"]
branch = true

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "def __repr__",
    "if self.debug:",
    "if settings.DEBUG",
    "raise AssertionError",
    "raise NotImplementedError",
    "if 0:",
    "if __name__ == .__main__.:",
    "class .*\\bProtocol\\):",
    "@(abc\\.)?abstractmethod",
]

[tool.bandit]
exclude_dirs = ["tests", ".venv", "build", "dist"]
skips = ["B404", "B603", "B110", "B608"]  # Skip subprocess warnings (B404, B603), try/except/pass (B110), SQL injection false positives in HTML templates (B608)
