This commit is contained in:
@@ -130,6 +130,11 @@ HISTORY_PATTERNS = [
|
||||
("finding number with its chosen option (03-11 (b))",
|
||||
re.compile(r"(?<![\w./:-])\d{2}-\d{2} \([a-e]\)", re.ASCII)),
|
||||
("review README section (review README §15)", re.compile(r"review README §", re.ASCII)),
|
||||
# The 2026-11 program ran in work streams W1~W6, and the red team named findings BE-OBS-A,
|
||||
# BE-CONFIG-001. "(W4 BE-OBS-A)" told only a reader of that week's notes where a rule came from.
|
||||
("program work stream (W4)", re.compile(r"(?<![\w-])W\d(?![\w-])", re.ASCII)),
|
||||
("red team finding (BE-OBS-A, BE-CONFIG-001)",
|
||||
re.compile(r"(?<![\w-])(?:BE|FE)-[A-Z]{2,}-(?:\d{3}|[A-Z])(?![\w-])", re.ASCII)),
|
||||
("commit sha", re.compile(r"\b(?=[0-9a-f]*\d)(?=[0-9a-f]*[a-f])[0-9a-f]{7,40}\b", re.ASCII)),
|
||||
]
|
||||
|
||||
|
||||
@@ -136,6 +136,16 @@ class CheckWorkDocsTest(unittest.TestCase):
|
||||
self.assertFailsWith(f"{path}:3")
|
||||
(self.repo.root / path).unlink()
|
||||
|
||||
def test_a_work_stream_or_red_team_id_in_a_playbook_fails(self) -> None:
|
||||
for line in ("- 자세는 rate-limiting.md다(W4 BE-OBS-A).", "- BE-CONFIG-001로 고쳤다.", "- W4에서 정했다."):
|
||||
with self.subTest(line=line):
|
||||
self.repo.write("docs/work/operate.md", f"# operate.md\n\n{PLAYBOOK}{line}\n")
|
||||
self.assertFailsWith("docs/work/operate.md:")
|
||||
|
||||
def test_words_that_only_look_like_a_work_stream_pass(self) -> None:
|
||||
self.repo.write("docs/work/operate.md", f"# operate.md\n\n{PLAYBOOK}- W3C 표준과 HTTP-W1-x는 이름이 아니다.\n")
|
||||
self.assertEqual(self.repo.run()[0], 0)
|
||||
|
||||
def test_local_claude_state_is_not_checked(self) -> None:
|
||||
self.repo.write(".claude/worktrees/other/AGENTS.md", "# 다른 worktree\n\n- 리뷰 05-18.\n")
|
||||
self.assertEqual(self.repo.run()[0], 0)
|
||||
|
||||
@@ -61,6 +61,29 @@ def skill_paths(path: Path) -> list[str]:
|
||||
return re.findall(r'-\s+"([^"]+)"', block.group(1)) if block else []
|
||||
|
||||
|
||||
def expand_braces(pattern: str) -> list[str]:
|
||||
"""`a/{b,c}/d` → [`a/b/d`, `a/c/d`]. One brace group is enough for the patterns in experts.md."""
|
||||
match = re.search(r"\{([^}]*)\}", pattern)
|
||||
if not match:
|
||||
return [pattern]
|
||||
return [pattern[:match.start()] + part + pattern[match.end():] for part in match.group(1).split(",")]
|
||||
|
||||
|
||||
def experts_lens_paths() -> dict[str, set[str]]:
|
||||
"""experts.md 3절 표: 1열의 glob을 2열(1차 렌즈)이 이름 대는 지식 스킬마다 모은다."""
|
||||
text = EXPERTS.read_text(encoding="utf-8")
|
||||
section = text.split("## 3. ", 1)[1].split("\n## ", 1)[0]
|
||||
lenses: dict[str, set[str]] = {}
|
||||
for line in section.splitlines():
|
||||
cells = [cell.strip() for cell in line.strip().strip("|").split("|")]
|
||||
if len(cells) < 2 or not cells[0].startswith("`"):
|
||||
continue
|
||||
globs = [g for raw in re.findall(r"`([^`]+)`", cells[0]) for g in expand_braces(raw)]
|
||||
for lens in re.findall(r"\bbe-[a-z-]+[a-z]", cells[1]):
|
||||
lenses.setdefault(lens, set()).update(globs)
|
||||
return lenses
|
||||
|
||||
|
||||
def front_matter(path: Path) -> dict[str, str]:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
match = re.match(r"^---\n(.*?)\n---\n", text, re.S)
|
||||
@@ -117,9 +140,13 @@ class SubagentTest(unittest.TestCase):
|
||||
|
||||
def test_verify_api_runs_the_app_on_the_desktop_under_the_shared_lock(self) -> None:
|
||||
text = (AGENTS / "verify-api.md").read_text(encoding="utf-8")
|
||||
for fragment in ("docs/work/operate.md", "flock /tmp/claude-gates/heavy.lock", "scripts/bootstrap-local.sh",
|
||||
"stash@{0}", "down"):
|
||||
# verify.sh takes the shared lock and turns the Gradle daemon off; a bare flock around the bootstrap script
|
||||
# left a daemon behind on the desktop, and the cleanup it pointed at was in no manual.
|
||||
for fragment in ("docs/work/operate.md", "scripts/verify.sh app --on here", "scripts/bootstrap-local.sh",
|
||||
"stash@{0}", "down", "git worktree remove"):
|
||||
self.assertIn(fragment, text)
|
||||
self.assertNotIn("heavy.lock scripts/bootstrap-local.sh", text)
|
||||
self.assertNotIn("정리법", text)
|
||||
|
||||
|
||||
class SkillTest(unittest.TestCase):
|
||||
@@ -155,6 +182,24 @@ class SkillTest(unittest.TestCase):
|
||||
rx = glob_regex(pattern)
|
||||
self.assertTrue(any(rx.fullmatch(f) for f in files), f"{name}: {pattern} matches no tracked file")
|
||||
|
||||
def test_no_instruction_runs_gradle_from_the_old_src_root(self) -> None:
|
||||
# The Gradle root moved from src/ to the repository root (2026-11-11). An instruction that still says
|
||||
# "run it in src/" sends a session to a folder with no gradlew.
|
||||
stale = re.compile(r"명령은 `src/`에서|cd [^`'&;|]*?/src(?=[ `'&;]|$)", re.M)
|
||||
roots = [REPO / ".claude", REPO / "docs/work"]
|
||||
files = [REPO / "AGENTS.md", REPO / "CLAUDE.md"] + [f for root in roots for f in root.rglob("*.md")]
|
||||
hits = [f"{f.relative_to(REPO)}:{n}" for f in files if "worktrees" not in f.relative_to(REPO).parts
|
||||
for n, line in enumerate(f.read_text(encoding="utf-8").splitlines(), 1) if stale.search(line)]
|
||||
self.assertEqual(hits, [])
|
||||
|
||||
def test_the_experts_path_table_lists_exactly_each_skill_paths(self) -> None:
|
||||
# The lead picks lenses from this table; a glob the skill has but the table lacks is a lens never picked.
|
||||
table = experts_lens_paths()
|
||||
for name in self.KNOWLEDGE:
|
||||
with self.subTest(skill=name):
|
||||
self.assertEqual(table.get(name, set()), set(skill_paths(SKILLS / name / "SKILL.md")),
|
||||
"docs/work/experts.md 3절 1열 vs .claude/skills/<name>/SKILL.md paths")
|
||||
|
||||
def test_the_experts_manual_names_every_expert_and_the_rule_points_at_it(self) -> None:
|
||||
manual = EXPERTS.read_text(encoding="utf-8")
|
||||
for name in self.KNOWLEDGE + [path.stem for path in AGENTS.glob("*.md")]:
|
||||
|
||||
Reference in New Issue
Block a user