Skip to content

Enterprise agent platform for building, deploying, and operating AI teammates.

4.2 KB
Raw Blame
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.12.3
    hooks:
      # Run the linter.
      - id: ruff-check
        types_or: [python, pyi]
      # Run the formatter.
      - id: ruff-format
        types_or: [python, pyi]

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: "v1.19.0"
    hooks:
      - id: mypy
        args: ["--package", "xagent"]
        exclude: ^src/xagent/migrations/
        pass_filenames: false
        additional_dependencies:
          - PyJWT>=2.15.1,<3
          - zai-sdk==0.2.3
          - "pydantic[mypy]"
          - aiohttp
          - redis==6.4.0
          # Match uv.lock: the isolated hook otherwise resolves SQLAlchemy 2.1,
          # whose ORM typing changes break inference for legacy Column models.
          - sqlalchemy==2.0.47
          - types-PyYAML
          - types-beautifulsoup4
          - types-requests
          - types-python-dateutil
          - httpx
          - fastapi
          # Keep the mypy hook aligned with the project's uv.lock. SQLAlchemy
          # 2.1 changes the ORM stubs enough to surface hundreds of unrelated
          # errors across the existing codebase.
          - sqlalchemy==2.0.47
          - uvicorn
          - langchain-core
          - langchain-openai
          - langchain-community
          - numexpr
          # Type-check with numpy 1.x for Python 3.11 parsing. Unpinned, the mypy
          # hook env pulls the latest numpy, whose newer stubs use PEP 695
          # `type` syntax that fails under python_version = 3.11 and aborts the
          # whole mypy run before it reaches project code.
          - numpy==1.26.4
          - html2text
          - rich
          - prompt_toolkit
          - langfuse
          - python-dotenv
          - chromadb
          - openpyxl
          - types-openpyxl
          # Pin to the project's resolved mcp (uv.lock). Unpinned, the mypy
          # hook env resolves the latest release, and mcp 2.0.0 moved
          # `mcp.server.fastmcp`, renamed `streamablehttp_client` and
          # dropped `Server.list_tools`/`call_tool`, which fails the whole
          # run against code written for the locked 1.x API.
          - mcp==1.30.0
          - pandas-stubs
          - matplotlib-stubs
          - docker
          - types-docker
          - playwright
          - nest-asyncio
          - anthropic
          - openai>=2.26.0,<3
          - python-pptx
          - cloudpickle
          - exa-py
          - slack-sdk==3.43.0
          - limits
          # Pin limits' `deprecated` dependency to the project's resolved
          # version (uv.lock). Unpinned, the mypy hook env pulls deprecated
          # 3.0.0, which uses PEP 695 `type` syntax that fails under
          # python_version = 3.11 and aborts the whole mypy run.
          - deprecated==1.3.1
          - google-genai==1.66.0
          - elevenlabs==2.56.0
          # Pin google-auth/google-api-core to versions that ship py.typed;
          # older releases resolved transitively lack the marker and fail
          # import-untyped under disallow_any_unimported.
          - google-auth==2.48.0
          - google-api-core==2.25.2

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v5.0.0
    hooks:
      - id: end-of-file-fixer
        exclude: ^docs/|^CLAUDE\.md$
      - id: trailing-whitespace
        exclude: ^CLAUDE\.md$

  - repo: https://github.com/pycqa/isort
    rev: 6.0.1
    hooks:
      - id: isort

  - repo: https://github.com/codespell-project/codespell
    rev: v2.4.1
    hooks:
      - id: codespell
        args: [--config, ".codespellrc"]

  - repo: local
    hooks:
      - id: alembic-check
        name: alembic-check
        entry: scripts/check_alembic_heads.sh
        language: script
        pass_filenames: false
        files: ^src/xagent/migrations/versions/

      - id: npm-lint
        name: npm lint
        entry: npm run --prefix frontend lint
        language: system
        pass_filenames: false
        types_or: [javascript, jsx, ts, tsx, json]

      - id: npm-type-check
        name: npm type-check
        entry: npm run --prefix frontend type-check
        language: system
        pass_filenames: false
        types_or: [javascript, jsx, ts, tsx]
        exclude: ^frontend/\.next/