Skip to content

Commit 26e9375

Browse files
committed
docs/config: sync gate docs to check.sh; expand agent allowlist
The `check` skill and AGENTS.md described an older, shorter gate (ruff + mypy + markdownlint + shellcheck + pytest + build) and omitted the stages that most often surprise an otherwise-clean change: pyright, vulture, deptry, import-linter, xenon, prettier, diff-cover, and the escape-hatch diff gate. Both now mirror scripts/check.sh in order, with a short note on what the non-obvious gates enforce. Also: - AGENTS.md: document the syrupy snapshot tests + `pytest --snapshot-update` regen flow (the auto-format hook only touches *.py). - settings.json: allowlist the gate tools an agent may run bare (pyright, vulture, deptry, lint-imports, xenon, diff-cover, prettier, swiftlint) and the read-only GitHub MCP tools used in web sessions; keep the `gh` entries for local contributors. - check.sh: give prettier the same skip-if-missing guard shellcheck/swiftlint already have, so the full gate no longer hard-fails on a container without prettier on PATH.
1 parent ab3c0b3 commit 26e9375

4 files changed

Lines changed: 37 additions & 5 deletions

File tree

.claude/settings.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
"Bash(ruff check *)",
1111
"Bash(ruff format *)",
1212
"Bash(mypy *)",
13+
"Bash(pyright *)",
14+
"Bash(vulture *)",
15+
"Bash(deptry *)",
16+
"Bash(lint-imports *)",
17+
"Bash(xenon *)",
18+
"Bash(diff-cover *)",
19+
"Bash(prettier *)",
20+
"Bash(swiftlint *)",
1321
"Bash(pytest *)",
1422
"Bash(pre-commit run *)",
1523
"Bash(./scripts/check.sh)",
@@ -36,7 +44,18 @@
3644
"mcp__assemblyai-docs__search_docs",
3745
"mcp__assemblyai-docs__get_pages",
3846
"mcp__assemblyai-docs__get_api_reference",
39-
"mcp__assemblyai-docs__list_sections"
47+
"mcp__assemblyai-docs__list_sections",
48+
"mcp__github__pull_request_read",
49+
"mcp__github__list_pull_requests",
50+
"mcp__github__search_pull_requests",
51+
"mcp__github__get_commit",
52+
"mcp__github__list_commits",
53+
"mcp__github__get_file_contents",
54+
"mcp__github__actions_list",
55+
"mcp__github__actions_get",
56+
"mcp__github__get_job_logs",
57+
"mcp__github__issue_read",
58+
"mcp__github__list_issues"
4059
],
4160
"deny": [
4261
"Read(.env)",

.claude/skills/check/SKILL.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Run the project's canonical verification gate and report the result.
1616
./scripts/check.sh
1717
```
1818

19-
This runs, in order: `ruff check``ruff format --check``mypy` (src + tests) → `markdownlint` (excludes generated `docs/`) → `shellcheck install.sh``pytest` with a **90% branch-coverage gate** (`--cov-fail-under=90`, excluding `e2e` and `install_script` markers) → `uv build` + `twine check --strict`. Everything runs through `uv run` against the locked environment.
19+
This runs, in order: `uv lock --check``ruff check``ruff format --check``mypy` (src + tests) → `pyright` (src strict, then tests) → `vulture` (dead code) → `deptry` (dependency hygiene) → `lint-imports` (architecture contracts) → `xenon` (cyclomatic complexity, max grade B / project avg A) → `swiftlint` + swift compile (macOS only) → `markdownlint` (excludes generated `docs/`) → `prettier` (init template JS/CSS) → `shellcheck install.sh scripts/check.sh` → generated `--show-code` compile gate → init template contract gate → `pytest` with a **90% branch-coverage gate** (`--cov-fail-under=90`, excluding `e2e`/`install`/`install_script` markers) → `diff-cover` (100% patch coverage vs `origin/main`) → a "no new escape hatches" diff gate → `uv build` + `twine check --strict`. Everything Python runs through `uv run` against the locked environment.
20+
21+
Heads-up on the stages `ruff`+`mypy` don't cover: `vulture` flags unused code, `deptry` flags unused/missing/misplaced dependencies, `lint-imports` enforces the import-architecture contracts in `.importlinter`, and `xenon` fails any function over cyclomatic-complexity grade B (CC > 10). These are the ones that most often surprise an otherwise-clean change.
2022

2123
2. If anything fails, fix it and re-run `./scripts/check.sh` until it passes. Do not claim success until the script prints `All checks passed.`
2224

@@ -31,5 +33,6 @@ uv run pytest -m install_script # builds a wheel and runs install.sh for real;
3133

3234
## Notes
3335

34-
- If `shellcheck` isn't installed locally, `check.sh` skips it with a notice (CI still runs it) — that's expected, not a failure.
36+
- External linters that aren't Python deps — `shellcheck`, `prettier`, `swiftlint`/`swiftc` — self-skip with a notice when not installed (CI still runs them); that's expected, not a failure. `swiftlint`/`swiftc` also no-op off macOS.
37+
- `diff-cover` and the escape-hatch gate self-skip when `origin/main` isn't present (e.g. a shallow branch-only clone); CI provides the base ref.
3538
- Report the final outcome with the actual tail of the output, not a summary from memory.

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ This project uses [uv](https://docs.astral.sh/uv/). **Run every Python tool thro
1111
```sh
1212
uv sync --extra dev # create/refresh the venv with dev dependencies
1313
uv run aai --help # run the CLI from the locked environment
14-
./scripts/check.sh # the full gate CI runs: ruff + mypy + markdownlint + prettier + shellcheck + pytest(+coverage) + build/twine
14+
./scripts/check.sh # the full gate CI runs (scripts/check.sh is the source of truth)
1515
```
1616

17+
`scripts/check.sh` is the authoritative gate; keep this list in sync with it. It runs, in order: `uv lock --check` → `ruff check` → `ruff format --check` → `mypy` → `pyright` (src strict) → `pyright` (tests) → `vulture` (dead code) → `deptry` (dependency hygiene) → `lint-imports` (import-linter architecture contracts) → `xenon` (cyclomatic complexity, max grade B / project avg A) → `swiftlint` + swift compile (macOS only, skipped elsewhere) → `markdownlint` → `prettier` (init template JS/CSS) → `shellcheck` → generated `--show-code` compile gate → init template contract gate → `pytest` (90% branch coverage) → `diff-cover` (100% patch coverage vs `origin/main`) → a "no new escape hatches" diff gate (`# type: ignore` / `# noqa` / `pragma: no cover` / net-new `Any` / `cast(`) → `uv build` + `twine check --strict`. The `vulture`/`deptry`/`lint-imports`/`xenon` and patch-coverage stages catch the failures that `ruff`+`mypy` alone won't — don't claim the gate is green until the script prints `All checks passed.`
18+
1719
Individual tools (all via `uv run`):
1820

1921
```sh
@@ -37,6 +39,8 @@ uv run pytest -m install_script # builds a wheel and runs install.sh for real;
3739

3840
`check.sh` runs `-m "not e2e and not install_script"` with a **90% branch-coverage gate** (`--cov-fail-under=90`). New code generally needs tests to clear that gate.
3941

42+
CLI output is pinned by **syrupy snapshot tests** (`tests/__snapshots__/*.ambr`). Changing help text, tables, or rendered output will fail those tests until you regenerate them with `uv run pytest --snapshot-update` and commit the updated `.ambr` files. The auto-format hook only touches `*.py`, and pre-commit's whitespace fixers deliberately skip `tests/__snapshots__/` (syrupy's indentation must stay byte-for-byte), so never hand-edit a snapshot — always regenerate.
43+
4044
## Naming & packaging gotchas
4145

4246
- The **package/module** is `aai_cli`; the **distribution** name is `aai-cli`; the **console command** is `aai` (`[project.scripts] aai = "aai_cli.main:run"`).

scripts/check.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ echo "==> markdownlint (docs/ is generated, so excluded)"
9393
markdownlint "**/*.md" --ignore docs --ignore node_modules --ignore .pytest_cache
9494

9595
echo "==> prettier (init template JS/CSS)"
96-
prettier --check "aai_cli/init/templates/**/*.{js,css}"
96+
# CI's runner has prettier on PATH; locally it's skipped with a notice if not
97+
# installed, matching how shellcheck/swiftlint self-skip above.
98+
if command -v prettier >/dev/null 2>&1; then
99+
prettier --check "aai_cli/init/templates/**/*.{js,css}"
100+
else
101+
echo " prettier not found; skipping (CI runs it)"
102+
fi
97103

98104
echo "==> shellcheck (install.sh)"
99105
# Static-lint the public install script and this gate script. CI's ubuntu runner ships shellcheck;

0 commit comments

Comments
 (0)