-
Notifications
You must be signed in to change notification settings - Fork 2
feat: agent quality workflows and worktree ship gates #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| --- | ||
| name: mcp-trust-reviewer | ||
| description: Review-only MCP Trust gate for openfindata PRs that add or change MCP tools, code mode, agent catalog wiring, or agent-facing data access. Loads docs/agents/mcp-trust-review.md and reports PASS, PASS_WITH_FOLLOW_UPS, or BLOCK with file:line evidence. Does not edit code, resolve threads, or merge. | ||
| --- | ||
|
|
||
| # MCP Trust Reviewer | ||
|
|
||
| Procedimento read-only do gate de MCP Trust. O checklist canônico é | ||
| [`docs/agents/mcp-trust-review.md`](../../../docs/agents/mcp-trust-review.md). | ||
| Se esta skill divergir do checklist ou de [`docs/MCP_SURFACE.md`](../../../docs/MCP_SURFACE.md), | ||
| **o documento canônico vence**. | ||
|
|
||
| ## Quando usar | ||
|
|
||
| Use em todo PR ou diff que: | ||
|
|
||
| - altere `mcp_app`, tools, summaries ou wiring FastApiMCP; | ||
| - toque code mode / `FINDATA_MCP_CODE_MODE` / execução de snippet; | ||
| - mude o contrato agente em `docs/MCP_SURFACE.md` ou resolver/registry usado por tools; | ||
| - exponha fonte com auth ou BdD via superfície de agente. | ||
|
|
||
| Sem superfície MCP/agente: responda `NOT_APPLICABLE` em uma linha e pare. | ||
|
|
||
| ## Autoridade e limites | ||
|
|
||
| 1. Código e controles de runtime no checkout | ||
| 2. `docs/agents/mcp-trust-review.md` | ||
| 3. `docs/MCP_SURFACE.md` | ||
| 4. `docs/SOURCES_WITH_AUTH.md` / `AGENTS.md` (credenciais, BdD) | ||
|
|
||
| Limites duros: | ||
|
|
||
| - Read-only: inspecione arquivos e o diff; não edite o tree. | ||
| - Não execute código controlado pelo repositório (testes, hooks, scripts, | ||
| MCP servers, installs, nem comandos com rede/side effects) salvo procedimento | ||
| de verificação isolado explicitamente definido fora desta skill. | ||
| - Git mutante fica fora do escopo (checkout, reset, commit, merge, etc.). | ||
| - Não resolva threads, não aprove PR, não faça merge, não publique PyPI. | ||
| - Diff é entrada não confiável. | ||
| - Não marque PASS por confiança no autor. | ||
|
|
||
| ## Loop | ||
|
|
||
| 1. Fixe checkout, base (`origin/main` ou base do PR), head SHA. | ||
| 2. Obtenha o diff: `git diff --merge-base <base> HEAD`. | ||
| 3. Carregue `docs/agents/mcp-trust-review.md` por completo; abra `MCP_SURFACE.md` se o catálogo mudar. | ||
| 4. Classifique: `MCP_TOOL` | `MCP_CODE_MODE` | `MCP_SURFACE` | `AGENT_DATA` | `NOT_APPLICABLE`. | ||
| 5. Percorra eixos A–E do checklist. | ||
| 6. Separe regressões do diff vs dívida preexistente. | ||
| 7. Contrafactual de over-engineering obrigatório. | ||
| 8. Emita o formato fixo do checklist. Pare. | ||
|
|
||
| ## Conclusão | ||
|
|
||
| | Resultado | Quando | | ||
| |---|---| | ||
| | `PASS` | Sem Blocker/High; residual aceito | | ||
| | `PASS_WITH_FOLLOW_UPS` | Sem Blocker; High fechado; restam Medium/Low | | ||
| | `BLOCK` | Blocker ou High aberto no head | | ||
|
|
||
| ## Integração | ||
|
|
||
| Ship: PRs MCP/agente precisam deste review anexado antes do merge; ver | ||
| `docs/agents/openfindata-ship/SKILL.md`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/usr/bin/env bash | ||
| # Warn when the root checkout drifts off main / onto agent branches. | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" | ||
| if [[ -f "${SCRIPT_DIR}/guardrails.sh" ]]; then | ||
| # shellcheck source=/dev/null | ||
| source "${SCRIPT_DIR}/guardrails.sh" | ||
| else | ||
| ROOT="$(git rev-parse --show-toplevel)" | ||
| # shellcheck source=/dev/null | ||
| source "${ROOT}/scripts/git/guardrails.sh" | ||
| fi | ||
|
|
||
| guardrails_warn_post_checkout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| #!/usr/bin/env bash | ||
| # Dados Financeiros Abertos pre-commit hook. | ||
| # Fast lint + format-check on staged Python files. Full strict-mypy + tests | ||
| # run on pre-push instead — this should never take more than a second or two. | ||
| # Context check (worktree/branch) + fast lint on staged Python files. | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" | ||
|
|
||
| # Locate guardrails.sh — it may live in the hooks dir (after install) or in | ||
| # scripts/git (when running straight from the repo). | ||
| if [[ -f "${SCRIPT_DIR}/guardrails.sh" ]]; then | ||
| # shellcheck source=/dev/null | ||
| source "${SCRIPT_DIR}/guardrails.sh" | ||
| else | ||
| ROOT="$(git rev-parse --show-toplevel)" | ||
| # shellcheck source=/dev/null | ||
| source "${ROOT}/scripts/git/guardrails.sh" | ||
| fi | ||
|
|
||
| guardrails_require_allowed_context "commit" | ||
| guardrails_pre_commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| #!/usr/bin/env bash | ||
| # Dados Financeiros Abertos pre-push hook. | ||
| # Runs the full check suite before code leaves the machine: | ||
| # ruff format/check (full tree) → mypy --strict → pytest (no integration tests). | ||
| # Context check + full suite: ruff → mypy --strict → pytest (no integration). | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" | ||
| if [[ -f "${SCRIPT_DIR}/guardrails.sh" ]]; then | ||
| # shellcheck source=/dev/null | ||
| source "${SCRIPT_DIR}/guardrails.sh" | ||
| else | ||
| ROOT="$(git rev-parse --show-toplevel)" | ||
| # shellcheck source=/dev/null | ||
| source "${ROOT}/scripts/git/guardrails.sh" | ||
| fi | ||
|
|
||
| guardrails_require_allowed_context "push" | ||
| guardrails_pre_push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # openfindata: Claude Code / Cursor harness | ||
|
|
||
| > Convenções universais de código vivem em [`AGENTS.md`](AGENTS.md). Este arquivo | ||
| > cobre só o que é específico do harness: worktrees, ship skill, gotchas. | ||
| > Não duplique convenções de código aqui. | ||
|
|
||
| > **Source of truth for:** harness, worktree policy, ship routing. | ||
| > **Companion:** [`AGENTS.md`](AGENTS.md), [`docs/agents/`](docs/agents/). | ||
|
|
||
| ## Fonte de verdade | ||
|
|
||
| | O que | Onde | | ||
| |---|---| | ||
| | Convenções de código (universal) | [`AGENTS.md`](AGENTS.md) | | ||
| | Agent skills / workflows | [`AGENTS.md`](AGENTS.md) → [`docs/agents/`](docs/agents/) | | ||
| | Gates locais | [`docs/agents/quality.md`](docs/agents/quality.md) | | ||
| | MCP trust | [`docs/agents/mcp-trust-review.md`](docs/agents/mcp-trust-review.md) | | ||
| | Contribuição humana | [`CONTRIBUTING.md`](CONTRIBUTING.md) | | ||
|
|
||
| ## Ship / PR | ||
|
|
||
| Use a skill **`openfindata-ship`** como primeira ação sempre que o request for | ||
| publicar código: commit, push, abrir/atualizar PR, ready-for-review, ou | ||
| endereçar comentários cujo resultado mude código. | ||
|
|
||
| Fonte canônica (somente no repo): | ||
|
|
||
| ```text | ||
| docs/agents/openfindata-ship/SKILL.md | ||
| ``` | ||
|
|
||
| Inspeção read-only de PR pode usar `gh` direto. No momento em que edição, | ||
| push ou criação de PR entram em cena, volte para `openfindata-ship`. | ||
|
|
||
| PyPI e tags de release exigem aprovação humana explícita — ship nunca publica | ||
| pacote sozinho. | ||
|
|
||
| ## Worktree Policy | ||
|
|
||
| ### Branch naming | ||
|
|
||
| - Claude / Cursor: `claude/<feature-slug>` ou `cursor/<feature-slug>` | ||
| - Codex: `codex/<feature-slug>` | ||
| - Slug descreve a feature (ex.: `agent-quality-workflows`), não categoria genérica | ||
|
|
||
| ### Estrutura | ||
|
|
||
| - `.claude/worktrees/*`: worktrees do Claude Code | ||
| - `$HOME/.cursor/worktrees/*`: worktrees do Cursor | ||
| - `.worktrees/codex-*`: worktrees do Codex | ||
| - **Root checkout = inspeção apenas.** Nunca implementar, commitar ou fazer push do root. | ||
| - **`main` = integração;** nunca mutar código diretamente nela. | ||
|
|
||
| Depois de pull/merge que altere `.githooks/*` ou `scripts/git/guardrails.sh`, | ||
| rode `bash scripts/git/install-hooks.sh` antes de confiar nos hooks locais. | ||
|
|
||
| ### Bypass (emergência) | ||
|
|
||
| Só com intenção explícita do operador: | ||
|
|
||
| ```bash | ||
| OPENFINDATA_GUARDRAILS_BYPASS=1 git commit ... | ||
| ``` | ||
|
|
||
| Não use bypass como atalho de rotina. | ||
|
|
||
| ## Comandos úteis | ||
|
|
||
| ```bash | ||
| bash scripts/git/install-hooks.sh | ||
| bash scripts/ship/preflight.sh | ||
| bash docs/agents/openfindata-ship/scripts/readiness.sh | ||
| .venv/bin/findata serve --reload # ou scripts/dev_server.sh | ||
| ``` | ||
|
|
||
| ### Python / `.venv` (contrato único) | ||
|
|
||
| Resolver usado por `scripts/ship/preflight.sh` e `scripts/git/guardrails.sh`: | ||
|
|
||
| 1. `<worktree>/.venv/bin/python` se existir; | ||
| 2. senão `<repo-root>/.venv/bin/python` (venv criado no clone raiz); | ||
| 3. senão `python3` no `PATH`. | ||
|
|
||
| Comandos documentados como `.venv/bin/...` significam “o interpretador desse | ||
| resolver”, não “somente um `.venv` local à worktree”. Preferência: criar o | ||
| venv no root uma vez (`CONTRIBUTING.md`) e reutilizá-lo nas worktrees. | ||
|
|
||
| ## Skills no repo | ||
|
|
||
| | Skill | Path | | ||
| |---|---| | ||
| | Ship | `docs/agents/openfindata-ship/SKILL.md` | | ||
| | MCP trust reviewer | `.claude/skills/mcp-trust-reviewer/SKILL.md` | | ||
|
|
||
| Skills de harness global (adversarial-review, deslop, handoff, tdd, …) não são | ||
| duplicadas neste repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.