Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); name the file prepare-scoring cannot read, and say a scoring run's means only once it is recorded
This commit is contained in:
@@ -94,6 +94,14 @@ def file_globs(paths: list[str], forbidden_files: list[str]) -> str:
|
||||
return listed(globs + sorted(f"`{path}`" for path in read if "/" not in path), "and") + (f", {TEST_FILES}" if tested & set(folders) else "")
|
||||
|
||||
|
||||
def read(path: pathlib.Path) -> str:
|
||||
"""path's text. Raises OSError where it cannot be read, and where it is not UTF-8, naming path as that error alone would not."""
|
||||
try:
|
||||
return path.read_text()
|
||||
except UnicodeDecodeError as failure:
|
||||
raise OSError(f"{path}: {failure}") from failure
|
||||
|
||||
|
||||
def preloaded_files(main: pathlib.Path, home: pathlib.Path) -> str:
|
||||
"""The files Claude Code loads into a seat started in main before its first tool call: each CLAUDE.md, the files it imports, and each rule file without `paths:`, leaving out those `claudeMdExcludes` names."""
|
||||
excludes = claude_md_excludes(main, home)
|
||||
@@ -105,8 +113,8 @@ def preloaded_files(main: pathlib.Path, home: pathlib.Path) -> str:
|
||||
for shown, claude_md, rules in (("~/.claude/", home / ".claude" / CLAUDE_MD, home / ".claude" / "rules"), ("", main / CLAUDE_MD, main / ".claude" / "rules")):
|
||||
if claude_md.is_file() and kept(claude_md):
|
||||
found.append(f"`{shown}{CLAUDE_MD}`")
|
||||
found += [f"`{shown}{name}`, which it imports" for name in re.findall(r"^@(\S+)", claude_md.read_text(), re.M)]
|
||||
found += [f"`{shown}{rule.relative_to(claude_md.parent)}`" for rule in sorted(rules.glob("*.md")) if kept(rule) and not re.search(r"^paths:", rule.read_text(), re.M)]
|
||||
found += [f"`{shown}{name}`, which it imports" for name in re.findall(r"^@(\S+)", read(claude_md), re.M)]
|
||||
found += [f"`{shown}{rule.relative_to(claude_md.parent)}`" for rule in sorted(rules.glob("*.md")) if kept(rule) and not re.search(r"^paths:", read(rule), re.M)]
|
||||
return listed(found, "and") if found else "none"
|
||||
|
||||
|
||||
@@ -129,7 +137,7 @@ def prompt_parts() -> dict[str, str] | Failure:
|
||||
"""seat-prompts.md's opening, shared brief and each report as their fenced text, and each seat's background, keyed by heading or label."""
|
||||
path = PANEL / "seat-prompts.md"
|
||||
try:
|
||||
text = path.read_text()
|
||||
text = read(path)
|
||||
except OSError as failure:
|
||||
return Failure(f"cannot read {path}: {failure}")
|
||||
parts = {}
|
||||
@@ -166,8 +174,8 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) ->
|
||||
if not source.is_file() and (own := pathlib.Path(worktree) / "skills" / "comprehension-panel" / "seat-prompts.md").is_file():
|
||||
source = own
|
||||
try:
|
||||
rules, skill = source.read_text() if source.is_file() else "", (PANEL / "SKILL.md").read_text()
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
rules, skill = read(source) if source.is_file() else "", read(PANEL / "SKILL.md")
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read what the seats' prompts quote: {failure}")
|
||||
values = project_values(rules, source.name)
|
||||
if isinstance(values, Failure):
|
||||
@@ -188,7 +196,7 @@ def prepare_scoring(worktree: str, preloaded: str | None, home: pathlib.Path) ->
|
||||
main = listing.splitlines()[0].removeprefix("worktree ")
|
||||
try:
|
||||
loaded = preloaded if preloaded is not None else preloaded_files(pathlib.Path(main), home)
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read a file Claude Code loads into a seat: {failure}")
|
||||
made = made_review_folder(worktree, home)
|
||||
if isinstance(made, Failure):
|
||||
|
||||
Reference in New Issue
Block a user