Self-documenting Makefile and read-only query CLI

`make` now lists targets grouped by use with examples. New read-only
tools/risk.py backs list/all/show/waits/escalations/policies; checked accepts
ID/OUTCOME/NOTE (ARGS still works). Adds CLI tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 6903@bnt-lap001
Assistant-Session: 8319e8a8-ffa6-4eb3-b8bf-b29945628f89
This commit is contained in:
tegwick 2026-09-22 10:19:49 +02:00
parent 228116926b
commit 2d60312bd1
4 changed files with 220 additions and 21 deletions

View file

@ -1,35 +1,72 @@
PY := python3
TOOLS := tools
.PHONY: help register check checked due fixes coverage test
# Parameters for the query and write targets (see `make help` for examples).
ID ?=
SEV ?=
SYSTEM ?=
OUTCOME ?=
NOTE ?=
help:
@echo "make register - rebuild REGISTER.md from findings/"
@echo "make check - verify the index, report what is going quiet, and read the inbox"
@echo "make due - just the work list: what needs a check right now"
@echo "make fixes - the state of every fix this register claims to track"
@echo "make coverage - what the register has never heard from"
@echo "make checked - record a check outcome: make checked ARGS=\"RISK-F-0002 clean\""
.DEFAULT_GOAL := help
.PHONY: help list all show waits escalations policies check due fixes coverage \
register checked test
register:
@$(PY) $(TOOLS)/register_index.py
##@ Inspect the register (read-only)
check:
list: ## Live findings, most severe first. Filters: make list SEV=high | make list SYSTEM=qonto-assistant
@$(PY) $(TOOLS)/risk.py list $(if $(SEV),--severity $(SEV)) $(if $(SYSTEM),--system $(SYSTEM))
all: ## Every finding, including fixed and withdrawn
@$(PY) $(TOOLS)/risk.py list --all $(if $(SEV),--severity $(SEV)) $(if $(SYSTEM),--system $(SYSTEM))
show: ## One finding or regulatory record: make show ID=RISK-F-0012
@test -n "$(ID)" || { echo 'usage: make show ID=RISK-F-0012'; exit 2; }
@$(PY) $(TOOLS)/risk.py show $(ID)
waits: ## What the register waits on, or owes, ordered by default date
@$(PY) $(TOOLS)/risk.py waits
escalations: ## Escalations and their delivery state
@$(PY) $(TOOLS)/risk.py escalations
policies: ## Regulatory records and full legal policies with next review
@$(PY) $(TOOLS)/risk.py policies
##@ Run the register
check: ## Full sweep: verify the index, report due and quiet work, read the inbox
@$(PY) $(TOOLS)/check_all.py
checked:
@$(PY) $(TOOLS)/record_check.py $(ARGS)
@$(PY) $(TOOLS)/register_index.py
due:
due: ## Just the work list: what needs a check right now
@$(PY) $(TOOLS)/register_check.py
@$(PY) $(TOOLS)/inbox_check.py
fixes:
fixes: ## State of every fix the register tracks, read from owner workplans
@$(PY) $(TOOLS)/fix_tracker.py
coverage:
coverage: ## Which estate repos the register has never heard from
@$(PY) $(TOOLS)/coverage.py
test:
##@ Record and maintain
checked: ## Record a check: make checked ID=RISK-F-0012 OUTCOME=clean|moved NOTE="what was seen"
@if [ -n "$(ARGS)" ]; then $(PY) $(TOOLS)/record_check.py $(ARGS); \
else test -n "$(ID)" -a -n "$(OUTCOME)" || { echo 'usage: make checked ID=RISK-F-0012 OUTCOME=clean NOTE="..."'; exit 2; }; \
$(PY) $(TOOLS)/record_check.py $(ID) $(OUTCOME) $(if $(NOTE),"$(NOTE)"); fi
@$(PY) $(TOOLS)/register_index.py
register: ## Rebuild REGISTER.md from findings/
@$(PY) $(TOOLS)/register_index.py
test: ## Run the tool test suite
@PYTHONDONTWRITEBYTECODE=1 $(PY) -m unittest discover -s tests -v
##@ Help
help: ## List targets with examples (the default)
@awk 'BEGIN {FS = ":.*## "} \
/^##@/ {printf "\n\033[1m%s\033[0m\n", substr($$0, 5); next} \
/^[a-z][a-zA-Z_-]*:.*## / {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo
@echo "Defer a check (operator decision): make checked ARGS='RISK-F-0012 defer 2026-10-15 \"reason\"'"