Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s

This commit is contained in:
2026-12-03 18:56:28 +01:00
parent 20c83f861f
commit 1ca2c8efe0
142 changed files with 1095 additions and 933 deletions
+9 -9
View File
@@ -99,18 +99,18 @@ def breaches_of(call: Call, home: str, environ: typing.Mapping[str, str]) -> tup
return text(call.given, "args"), text(call.given, "skill"), skill_breaches(call, environ, home)
if call.tool in COMMAND_TOOLS:
command = text(call.given, "command")
return command, command.split("\n", 1)[0], bash_breaches(command, call.cwd, home, call.tool == "Monitor") + read_breaches(call, home) + env_file_breaches(call, home)
return command, command.split("\n", 1)[0], bash_breaches(command, call.cwd, home, environ, call.tool == "Monitor") + read_breaches(call, home) + env_file_breaches(call, home, environ)
if call.tool == "Read":
return "", text(call.given, "file_path"), read_breaches(call, home) + env_file_breaches(call, home) + transcript_breaches(call, home)
return "", text(call.given, "file_path"), read_breaches(call, home) + env_file_breaches(call, home, environ) + transcript_breaches(call, home)
if call.tool == "Grep":
# Only env-file-read checks a Grep, and it takes no override, so no marker or log line concerns the call.
return "", "", env_file_breaches(call, home)
return "", "", env_file_breaches(call, home, environ)
path = text(call.given, "file_path")
if call.tool not in FILE_TOOLS or not path:
return None
before = read(path)
added, after = applied(call, before)
return added, path, report_breaches(call, path, home) + file_breaches(path, before, added, after)
return added, path, report_breaches(call, path, home, environ) + file_breaches(path, before, added, after)
def answer(checked: Checked, what: str, now: float) -> int:
@@ -130,25 +130,25 @@ def answer(checked: Checked, what: str, now: float) -> int:
return 2 if unloggable else 0
def bash_breaches(command: str, cwd: str, home: str, monitor: bool = False) -> list[Breach]:
def bash_breaches(command: str, cwd: str, home: str, env: typing.Mapping[str, str], monitor: bool = False) -> list[Breach]:
"""The breaches of the command's own words, then of each commit it makes, then of the files those commits may take."""
simples = simple_commands(command, cwd, home)
found = commits(simples, home)
in_commits = [breach for commit in found for breach in commit_breaches(commit, pathlib.Path(home))]
in_commits = [breach for commit in found for breach in commit_breaches(commit, pathlib.Path(home), env)]
in_files = [breach for directory in dict.fromkeys(commit.directory for commit in found) for breach in committed_file_breaches(directory)]
return command_breaches(command, simples, monitor) + in_commits + in_files
def commit_breaches(commit: CommitCall, home: pathlib.Path) -> list[Breach]:
def commit_breaches(commit: CommitCall, home: pathlib.Path, env: typing.Mapping[str, str]) -> list[Breach]:
"""The breaches of one commit: its title's and its round's, read through the title templates of the project's config, and its plan's. A config that cannot be read is a breach itself, since no title can then be checked."""
config = located(commit.directory, home, functools.partial(git, guarded=True))
config = located(commit.directory, home, env, functools.partial(git, guarded=True))
unread = []
if isinstance(config, Failure) and not isinstance(config, Unnamed):
unread = [Breach("commit-title", f"the project's config cannot be read, so the title is not checked against its template: {config.reason}", commit.directory)]
titles = config.titles if isinstance(config, ProjectConfig) else templates.BARE
# A checkout no config names has no branch template, so no title of its must fit one.
branch = checkout_branch(commit.directory) if isinstance(config, ProjectConfig) else None
return unread + title_breaches(commit, titles, config.branch if isinstance(config, ProjectConfig) else templates.BRANCH, branch) + round_cap_breaches(commit, titles) + round_report_breaches(commit, titles, home) + todo_breaches(commit.directory, home)
return unread + title_breaches(commit, titles, config.branch if isinstance(config, ProjectConfig) else templates.BRANCH, branch) + round_cap_breaches(commit, titles) + round_report_breaches(commit, titles, home, env) + todo_breaches(commit.directory, home, env)
def checkout_branch(directory: str) -> str | None: