30 lines
1.7 KiB
Python
30 lines
1.7 KiB
Python
import re
|
|
import unittest
|
|
|
|
from git_cli.git_repo import git
|
|
from repo_checks import ROOT
|
|
|
|
# A file of the setup spelled by a place in the person's own Claude home, where no release lies: a tool, or an instruction file. A session the loop starts has the release's tools on PATH, so prose names a tool bare. It names any other file as the setup's: `CLAUDE.md` → "Vocabulary", "setup". Both hold wherever the release is cloned.
|
|
BY_ITS_FOLDER = re.compile(r"(?:~|\$HOME)/\.claude/(?:CLAUDE\.md|(?:agents|bin|principles|rules|skills)\b[\w.<>*/-]*)")
|
|
# The plan, the changelog and the records, then the dated benches and trials: their text names a file as it was spelled when the line was written, and nobody rewrites it.
|
|
HISTORY = ("CHANGELOG.md", "docs/", "todo.md", "reviewer-merge-trials/", "workflow-bench/")
|
|
|
|
|
|
class SetupFilesNamedWhereverTheCloneLies(unittest.TestCase):
|
|
def test_no_tracked_file_names_a_file_of_the_setup_by_the_persons_own_claude_home(self) -> None:
|
|
tracked = git("ls-files", cwd=str(ROOT))
|
|
self.assertIsInstance(tracked, str, tracked)
|
|
found = []
|
|
for name in str(tracked).splitlines():
|
|
path = ROOT / name
|
|
if name.startswith(HISTORY) or name == "bin/repo_checks/test_setup_files_named.py" or not path.is_file():
|
|
continue
|
|
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), 1):
|
|
found += [f"{name}:{number}: {spelled}" for spelled in BY_ITS_FOLDER.findall(line)]
|
|
|
|
self.assertEqual(found, [], "name a tool bare, as in `todo-item`, and any other file as the setup's: the setup's `rules/todo-items.md`, never a path into `~/.claude`; in a line a person types, name the clone as the README does, `~/build-release/bin/<tool>`")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|