Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/audit-a-repo/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The audit is the fleet's measurement procedure. The failure shapes it guards aga
- **Know what the runner does and does not prove.** `spec/audit.py` mechanizes the deterministic subset only: settings, rulesets, secret names, file and section presence, verbatim hashing, interface wiring, Dependabot coverage, branch facts. It evaluates no check under a type in `spec/project-types.json` (`AUDIT.md` section 4). So every per-type check is judged by hand, and a clean run is no evidence for them (`AUDIT.md` section 4). Silence from a tool that was never looking reads exactly like a pass.
- **Judge letter and intent per check** and keep the vocabulary. A letter miss with intent satisfied is a drift finding. Both missing is a defect. Operational is binary over the applicable set. That vocabulary is in `AUDIT.md` sections 4 and 7. Do not invent a parallel scheme.
- **Assert the Actions implement `WORKFLOW.md`** by outcome, not by matching catalog snippets byte for byte (`AUDIT.md` section 5). The method is the 5A static audit, each applicable guarantee cited in the form 5A sets out, then the 5B trace scenarios (`AUDIT.md` section 5). Read a workflow the repo only calls at the SHA it pins, throughout. The `workflow-ci-contract` skill summarizes that contract.
- **Check live settings, rulesets, and secrets from a hub checkout at `main`** with `AUDIT.md` section 6. Run `repo-config/configure.sh check` with the target repository and model for settings and rulesets, and `uv run --no-project --script spec/audit.py [RepoName]` for secrets, rather than constructing a local comparison. The hub payloads are the only repository-configuration source.
- **Check live settings, rulesets, and secrets from a hub checkout at `main`** with `AUDIT.md` section 6. Use a hub checkout at `develop` instead while the target's registry entry has merged there but not yet reached `main`. Run `repo-config/configure.sh check` with the target repository and model for settings and rulesets, and `uv run --no-project --script spec/audit.py [RepoName]` for secrets, rather than constructing a local comparison. The hub payloads are the only repository-configuration source.

## Reporting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ feature-branch PR, which the SKILL.md summary covers.

## Configuring branch protection: don't hand-build the rules

Delete **all** classic branch-protection rules and stray rulesets because rulesets are the only
protection mechanism. From a hub checkout at `main`, create **exactly two rulesets named `develop`
and `main`** from the hub's `repo-config/*.json` payloads. Run
From a hub checkout at `main`, create **exactly two rulesets named `develop` and `main`** from the
hub's `repo-config/*.json` payloads. Use a hub checkout at `develop` instead
while the repository's registry entry has merged there but not yet reached `main`. Run
`repo-config/configure.sh apply <owner>/<repo> release|operational` from that checkout. The names
are load-bearing because governance content and workflows reference them. The registry
`workflowModel` selects the `develop` payload for a registered repository. Pass the model
explicitly for a repository outside the registry.
`workflowModel` selects the `develop` payload for a registered repository. `apply` refuses a
repository outside the registry, writing nothing. Once `apply` has created both rulesets, delete
**all** classic branch-protection rules and stray rulesets, because rulesets are the only protection
mechanism. Deleted first, they would leave the branches unprotected wherever `apply` then refuses.

## Executing a `develop -> main` promotion safely

Expand Down
43 changes: 34 additions & 9 deletions .agents/skills/python-codestyle/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: python-codestyle
description: >-
Governs Python code style for ptr727/ProjectTemplate fleet repos: the build-versus-lint-only
profile split, the uv/ruff/pyright/mypy/pytest toolchain, src layout, comment and docstring
conventions, type hints, naming, imports, patterns to avoid, test conventions, versioning, and the
--help and unknown-argument rule for a script. Use this whenever writing, reviewing, or editing a
.py file, a pyproject.toml, or a uv.lock, whenever running or choosing a Python formatting, lint,
type-check, or test command, pyright versus mypy included, whenever deciding whether a Python
subtree is a shippable project or a lint-only scripts tree, or whenever writing or reviewing a
Python test. Triggers even when the task looks like a small local fix ("just add a helper
function", "add a dependency") or a verification step ("run the tests"), because choosing pytest
before reading the profile turns an intentional unittest suite into a false missing-dependency
diagnosis. Applies only to a repo's Python side.
conventions, type hints, naming, imports, patterns to avoid, test conventions, versioning, the
--help and unknown-argument rule, and the SIGINT/SIGTERM rule for a script. Use this whenever
writing, reviewing, or editing a .py file, a pyproject.toml, or a uv.lock, whenever running or
choosing a Python formatting, lint, type-check, or test command, pyright versus mypy included,
whenever deciding whether a Python subtree is a shippable project or a lint-only scripts tree, or
whenever writing or reviewing a Python test. Triggers even when the task looks like a small local
fix ("just add a helper function", "add a dependency") or a verification step ("run the tests"),
because choosing pytest before reading the profile turns an intentional unittest suite into a
false missing-dependency diagnosis. Applies only to a repo's Python side.
---

# Python Codestyle
Expand Down Expand Up @@ -290,6 +290,31 @@ A command-line script is one a person or an agent runs by name. A hook its host

<!-- /include -->

## Interrupts

<!-- include: CODESTYLE.md > Interrupts -->

This applies to every Bash and Python script. `CODESTYLE.md` "Interrupts in Python" and "Interrupts in Shell" state each language's mechanics.

- **On SIGINT or SIGTERM, a script releases what it holds before it exits.** It removes the temporary paths it created, releases the locks it took, and stops the child processes it started. A path, lock, or child left behind can stop the next run from starting, or feed it a half-written input.
- **A write to persistent state goes to a temporary path beside the target, then is renamed over it.** An interrupt then leaves the old content or the new, never a mix of both. A store with transactions of its own, such as an SQLite database, is written through those instead. A rename over an open database can corrupt it.
- **An interrupted script prints one line naming the signal, with no traceback, and exits 130 for SIGINT or 143 for SIGTERM.** Each status is 128 plus the signal number, the status a shell reports for a process that signal ended.
- **A script takes this rule when it is created or next edited.** An existing script is not edited for this rule alone.
- **A script that holds a lock, temporary state, or a child process owes a test that signals it mid-run.** The test sends SIGINT or SIGTERM, then asserts the matching exit status and that nothing the script held remains. It is skipped on Windows, which cannot deliver either signal for a script to handle. A script holding none of these owes no such test.

<!-- /include -->

## Interrupts in Python

<!-- include: CODESTYLE.md > Interrupts in Python -->

- **SIGINT and SIGTERM take one path.** Python raises `KeyboardInterrupt` on SIGINT. The entry point installs a SIGTERM handler with `signal.signal` that records the signal and raises `KeyboardInterrupt`.
- **The entry point catches `KeyboardInterrupt` once, and any handler below it that catches the exception re-raises it.** It prints the line `CODESTYLE.md` "Interrupts" requires, then exits 143 where the SIGTERM handler recorded a signal and 130 otherwise.
- **What the script holds is released by `with` blocks and `finally` clauses as the exception unwinds.** A `subprocess.Popen` child is stopped in a `finally` clause with `terminate()`, then `wait()`, since leaving its `with` block does not stop it. That child runs without `shell=True`, so `terminate()` reaches the command rather than a shell around it.
- **The rename over persistent state uses `os.replace`.** `os.rename` and `Path.rename` fail on Windows when the target exists.

<!-- /include -->

<!-- External -->

[docs-link]: https://docs.pytest.org/
Expand Down
40 changes: 32 additions & 8 deletions .agents/skills/shell-codestyle/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ description: >-
Governs Bash/shell script style for ptr727/ProjectTemplate fleet repos: when a bootstrap or
host-tool script may be shell instead of Python, the mandatory set -Eeuo pipefail header, the
pipefail-versus-early-reader pitfall, self-recursive command shims, self-locating scripts, the
shellcheck-plus-shfmt clean-compile, the --help and unknown-argument rule, and the why-not-what
comment rule. Use this whenever writing, reviewing, or editing a shell script (`.sh`, or an
extensionless bash/sh shebang script), whenever deciding whether a new script should be Bash or
Python, whenever a `curl`/`grep`/`jq`-style pipeline looks like it silently swallowed a failure,
or whenever a script or probe writes a wrapper or shim named after a command it also calls.
Triggers even when the task looks like a one-line tweak, because a missing `-e`/`pipefail` or a
pipe its producer closes early stays invisible until it fails. Applies in any repo holding a shell
script.
shellcheck-plus-shfmt clean-compile, the --help and unknown-argument rule, the SIGINT/SIGTERM
rule, and the why-not-what comment rule. Use this whenever writing, reviewing, or editing a shell
script (`.sh`, or an extensionless bash/sh shebang script), whenever deciding whether a new script
should be Bash or Python, whenever a `curl`/`grep`/`jq`-style pipeline looks like it silently
swallowed a failure, or whenever a script or probe writes a wrapper or shim named after a command
it also calls. Triggers even when the task looks like a one-line tweak, because a missing
`-e`/`pipefail` or a pipe its producer closes early stays invisible until it fails. Applies in any
repo holding a shell script.
---

# Shell Codestyle
Expand Down Expand Up @@ -92,3 +92,27 @@ A command-line script is one a person or an agent runs by name. A hook its host
- **An argument the script does not recognize is refused**, with a non-zero exit before any read or write. The refusal names it as an unknown or unrecognized option, argument, flag, or parameter, and PowerShell's own refusal of a parameter it cannot bind counts. So a PowerShell script declaring its own parameters refuses a literal `--help` like any other unrecognized argument. Where no parameter takes the remaining arguments, the binder's refusal does that. A script with such a parameter refuses a dash-prefixed leftover itself. An unrecognized first argument is never taken as a default mode or as a target.

<!-- /include -->

## Interrupts

<!-- include: CODESTYLE.md > Interrupts -->

This applies to every Bash and Python script. `CODESTYLE.md` "Interrupts in Python" and "Interrupts in Shell" state each language's mechanics.

- **On SIGINT or SIGTERM, a script releases what it holds before it exits.** It removes the temporary paths it created, releases the locks it took, and stops the child processes it started. A path, lock, or child left behind can stop the next run from starting, or feed it a half-written input.
- **A write to persistent state goes to a temporary path beside the target, then is renamed over it.** An interrupt then leaves the old content or the new, never a mix of both. A store with transactions of its own, such as an SQLite database, is written through those instead. A rename over an open database can corrupt it.
- **An interrupted script prints one line naming the signal, with no traceback, and exits 130 for SIGINT or 143 for SIGTERM.** Each status is 128 plus the signal number, the status a shell reports for a process that signal ended.
- **A script takes this rule when it is created or next edited.** An existing script is not edited for this rule alone.
- **A script that holds a lock, temporary state, or a child process owes a test that signals it mid-run.** The test sends SIGINT or SIGTERM, then asserts the matching exit status and that nothing the script held remains. It is skipped on Windows, which cannot deliver either signal for a script to handle. A script holding none of these owes no such test.

<!-- /include -->

## Interrupts in Shell

<!-- include: CODESTYLE.md > Interrupts in Shell -->

- **Cleanup of temporary paths and locks runs in the script's `EXIT` trap.** Bash runs that trap when SIGINT or SIGTERM ends the script, as well as on a normal exit.
- **Every script sets an `INT` trap and a `TERM` trap, which stop its children and keep the status.** Each one sends SIGTERM with `kill` to the children the script started, then waits for them with `wait`. It then prints the line `CODESTYLE.md` "Interrupts" requires and exits 130 or 143. The children's process IDs are held in an array, such as `pids`, set to `()` before the traps are set. A trap skips the `kill` and the `wait` while `${#pids[@]}` is 0, a test `set -u` allows on an empty array in every Bash version. Under `set -u`, an unset one would end the trap before the line prints. The `kill` takes `2>/dev/null`, since a child that already exited makes it print an error. Both take `|| :`, since under `set -e` a non-zero status from either ends the trap before the line prints. SIGTERM is the signal sent because a background child ignores SIGINT. Other cleanup stays in the `EXIT` trap.
- **A long-running external command runs in the background, and the script waits for it with `wait "$pid"`, so its exit status reaches `set -e`.** Bash runs a trap only after a foreground command returns, while a trapped signal ends a `wait` at once. Only the script's own shell starts such a child. One that a subshell or a pipeline element starts never reaches the script's array or its `wait`. A background child that reads standard input takes `<&0`, since bash otherwise gives it `/dev/null`. The trap's `kill` reaches only the process `$!` names. So a function, a group, a subshell, a pipeline, or `sh -c` runs in the foreground instead. There the trap runs once the command it interrupted returns, so nothing the script started is orphaned.

<!-- /include -->
5 changes: 3 additions & 2 deletions .agents/skills/standup-a-repo/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ maintainer can supply what section 0A lists.
8. **Settings, rulesets, and secrets.** STANDUP.md section 4: confirm the remote and the GitHub
repository agree before running anything else here. Then run
`repo-config/configure.sh check owner/repo release` (substitute `operational` for an
operational repo) from the hub at `main`. A non-zero exit there means drift was found, not a
command failure. Review what it reports. Then run the same command's `apply` subcommand, never from a hand-built or carried copy. It
operational repo) from the hub at `main`. Use the hub at `develop` instead while the repo's
registry entry has merged there but not yet reached `main`. A non-zero exit there means drift
was found, not a command failure. Review what it reports. Then run the same command's `apply` subcommand, never from a hand-built or carried copy. It
idempotently reconciles the repo to the full committed configuration regardless of what `check`
reported.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ flowchart LR
develop -->|merge commit, enforced lint CI| main
```

The direct commit is an **allowance, not a substitute for review**. The ruleset drops the pull-request *requirement*, which permits a direct push without withdrawing the pull request. So a change worth reviewing still takes one, and both paths reach `develop` legally. Which changes those are is stated as a shape rather than a line count in `GOVERNANCE.md` "Operational Repositories". That section owns the test and is the one place it is written, since nothing in a ruleset can apply it. What differs is when validation lands. On the direct-commit path the commit is already on the branch, so CI can only be advisory after the fact. That is the accepted cost of the model. On the pull-request path the change has not landed, so validation is pre-merge and actionable, the moment it is worth the most. The lint workflow's `pull_request` trigger therefore names `develop` alongside `main` (`WORKFLOW.md` section 6). That is what makes **D1.2** hold here, since its input is *any* PR and the operational model is no exception. The check is reported on a `develop` PR rather than required. That is because a required status check on `develop` binds the direct push too, and would dissolve the allowance the model is built on.
The direct commit is an **allowance, not a substitute for review**. The ruleset drops the pull-request *requirement*, which permits a direct push without withdrawing the pull request. So a change worth reviewing still takes one, and both paths reach `develop` legally. Which changes those are is stated as a shape rather than a line count in `GOVERNANCE.md` "Operational Repositories". That section owns the test and is the one place it is written, since nothing in a ruleset can apply it. What differs is when validation lands. On the direct-commit path the commit is already on the branch, so CI can only be advisory after the fact. That is the accepted cost of the model. On the pull-request path the change has not landed, so validation is pre-merge and actionable, the moment it is worth the most. The lint workflow's `pull_request` trigger therefore filters no base branch (`WORKFLOW.md` section 6). That is what makes **D1.2** hold here, since its input is *any* PR and the operational model is no exception. The check is reported on a `develop` PR rather than required. That is because a required status check on `develop` binds the direct push too, and would dissolve the allowance the model is built on.

Their CI is lint/validation only: editorconfig/EOL plus domain linters such as Home Assistant or ESPHome config validation or a firmware build, but **no unit tests**. So the D-guarantees in `WORKFLOW.md` section 4 that assume a build/test pipeline are **N/A** exactly as for `source-only` (`WORKFLOW.md` section 6). What binds is the promotion gate and the source-only release on manual dispatch (`releaseTrigger: dispatch-only`, tag + source zip). At the promotion gate, the `develop -> main` PR must pass the required `Check pull request workflow status job`. Branch-model rulesets are specified in `GOVERNANCE.md` "Branching Model" rather than in `WORKFLOW.md`.

Expand Down
Loading
Loading