bd93ae8894
Initial scaffolding for the library extracted from cleveragents-core
at commit 20ad9a46. This commit lays the empty package shell and the
quality-gate machinery; subsequent commits move actual source.
- pyproject.toml: Hatchling build; Python 3.13; pinned runtime
deps trimmed to what the library actually needs (pydantic,
structlog, langchain-core, langgraph, jinja2, pyyaml, jsonschema,
python-ulid). Dev/tests/docs extras mirror the parent.
- noxfile.py: 8 sessions matching cleveragents-core by name
(format, lint, typecheck, unit_tests, coverage_report,
security_scan, dead_code, complexity, build, docs); slimmed of
the parent's pabot / template-DB / worker plumbing because the
library is pure-domain.
- LICENSE, NOTICE, CODE_OF_CONDUCT.md, ATTRIBUTIONS.md,
.editorconfig, .gitattributes, .gitignore, .pre-commit-config.yaml,
.semgrep.yml, .bumpversion.cfg, behave.ini, pyrightconfig.json,
.python-version: copied verbatim from cleveragents-core so org-
wide policy stays in lockstep.
- README.md: tailored to the library's role; explains the
boundary with cleveragents-core and what's NOT in scope.
- src/cleveractors/__init__.py + py.typed: empty package marker
with module-level docstring listing the eventual sub-packages.
- features/steps/__init__.py: Behave test tree placeholder.
No source code is moved in this commit. The next two commits add the
CI workflow and the minimal shared types, after which the actor /
langgraph / templates / lsp / acms / agents subpackages land one
commit at a time.
124 lines
3.6 KiB
Python
124 lines
3.6 KiB
Python
"""Quality gates for cleveractors-core.
|
|
|
|
A slimmer noxfile than its parent cleveragents-core repo, because:
|
|
|
|
- The library has no database, no HTTP server, no CLI, and no Robot
|
|
integration suite — so all the parallel-pabot, template-database, and
|
|
worker-bootstrap plumbing the parent needs is dead weight here.
|
|
- The library is pure-domain: lint, typecheck, Behave BDD, and coverage
|
|
are the meaningful gates.
|
|
|
|
Sessions intentionally mirror cleveragents-core's names so contributors
|
|
who move between projects see the same `nox -s lint` / `nox -s
|
|
typecheck` / etc.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import nox
|
|
|
|
DEFAULT_PYTHON = "3.13"
|
|
SUPPORTED_PYTHONS = ["3.13"]
|
|
nox.options.reuse_existing_virtualenvs = True
|
|
nox.options.error_on_external_run = True
|
|
|
|
|
|
# --- Quick-feedback gates --------------------------------------------------
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def format(session: nox.Session) -> None:
|
|
"""Auto-format source with ruff. Pass `-- --check` for CI mode."""
|
|
session.install(".[dev]")
|
|
extra = session.posargs or ["src", "features"]
|
|
if "--check" in session.posargs:
|
|
session.run("ruff", "format", "--check", *(p for p in extra if p != "--check"))
|
|
else:
|
|
session.run("ruff", "format", *extra)
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def lint(session: nox.Session) -> None:
|
|
"""Lint with ruff."""
|
|
session.install(".[dev]")
|
|
session.run("ruff", "check", "src", "features", *session.posargs)
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def typecheck(session: nox.Session) -> None:
|
|
"""Strict type-check with pyright. NO `# type: ignore` directives allowed."""
|
|
session.install(".[dev]")
|
|
session.run("pyright")
|
|
|
|
|
|
# --- Tests -----------------------------------------------------------------
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def unit_tests(session: nox.Session) -> None:
|
|
"""Run Behave BDD unit tests."""
|
|
session.install(".[dev,tests]")
|
|
session.run("behave", "features", *session.posargs)
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def coverage_report(session: nox.Session) -> None:
|
|
"""Run Behave wrapped in Slipcover; fail under 97% coverage."""
|
|
session.install(".[dev,tests]")
|
|
session.run(
|
|
"python",
|
|
"-m",
|
|
"slipcover",
|
|
"--source",
|
|
"src",
|
|
"--threshold",
|
|
"97",
|
|
"-m",
|
|
"behave",
|
|
"features",
|
|
*session.posargs,
|
|
)
|
|
|
|
|
|
# --- Quality scans ---------------------------------------------------------
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def security_scan(session: nox.Session) -> None:
|
|
"""Bandit + Semgrep static security scans."""
|
|
session.install(".[dev]")
|
|
session.run("bandit", "-r", "src/cleveractors")
|
|
session.run("semgrep", "scan", "--config", ".semgrep.yml", "src")
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def dead_code(session: nox.Session) -> None:
|
|
"""Vulture dead-code detection."""
|
|
session.install(".[dev]")
|
|
session.run("vulture", "src/cleveractors")
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def complexity(session: nox.Session) -> None:
|
|
"""Radon cyclomatic complexity + maintainability."""
|
|
session.install(".[dev]")
|
|
session.run("radon", "cc", "src/cleveractors", "-a")
|
|
session.run("radon", "mi", "src/cleveractors")
|
|
|
|
|
|
# --- Build + docs ----------------------------------------------------------
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def build(session: nox.Session) -> None:
|
|
"""Build the wheel + sdist."""
|
|
session.install("build")
|
|
session.run("python", "-m", "build")
|
|
|
|
|
|
@nox.session(python=DEFAULT_PYTHON)
|
|
def docs(session: nox.Session) -> None:
|
|
"""Build the MkDocs site."""
|
|
session.install(".[docs]")
|
|
session.run("mkdocs", "build", "--strict")
|