Syntropy.Receipts.Detect (syntropy v0.3.0)

Copy Markdown

Detects which checks a code-review run should execute for a repository.

Detection reads the repository's own manifests — mix.exs, pyproject.toml/setup.py, package.json, Cargo.toml, go.mod — and derives the project's test, typecheck, and lint commands. Security scanners (semgrep, osv-scanner) are added when their preconditions exist in the repo. A .syntropy/review.toml file replaces detection entirely:

[[check]]
name = "unit-tests"
command = ["mix", "test"]
kind = "tests"        # tests | typecheck | lint | security | custom
timeout_ms = 600000   # optional

Every check resolves its executable to an absolute path (ports do no PATH search); a check whose tool cannot be resolved is kept with available: false so the run records an honest skipped receipt instead of silently narrowing coverage. Check order is deterministic: by kind (tests, typecheck, lint, security, custom), then name.

Summary

Functions

Returns the checks for repo_path and where they came from.

Check kinds in their deterministic execution order.

Types

check()

@type check() :: %{
  name: String.t(),
  kind: String.t(),
  argv: [String.t()],
  timeout_ms: pos_integer(),
  available: boolean(),
  reason: String.t() | nil
}

Functions

checks(repo_path, opts \\ [])

@spec checks(
  String.t(),
  keyword()
) :: {:ok, %{checks: [check()], config_source: String.t()}} | {:error, map()}

Returns the checks for repo_path and where they came from.

opts[:finder] overrides executable resolution (defaults to System.find_executable/1); opts[:only] filters to the given check names after detection (the request-level checks allowlist).

kinds()

@spec kinds() :: [String.t()]

Check kinds in their deterministic execution order.