init: llm-wiki-haness 하네스 설계

This commit is contained in:
DongHyeonka
2026-07-24 14:21:35 +09:00
parent 42bf3db4fd
commit 6c53ded9cb
2436 changed files with 194486 additions and 1 deletions
@@ -0,0 +1,71 @@
from __future__ import annotations
from pathlib import Path
import sys
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
RUNTIME = ROOT / "harness/runtime"
sys.path.insert(0, str(RUNTIME))
import active_structure_check # noqa: E402
class ActiveStructureCheckTest(unittest.TestCase):
def test_repository_active_documents_pass(self) -> None:
result = active_structure_check.check(ROOT)
self.assertEqual(result["status"], "PASS")
expected = len(list((ROOT / "raw/branch-notes").glob("*.md"))) + len(
list((ROOT / "raw/project-notes").glob("*.md"))
)
self.assertEqual(result["checked"], expected)
def test_missing_checker_is_environment_error(self) -> None:
with tempfile.TemporaryDirectory() as directory:
with self.assertRaises((active_structure_check.ActiveStructureError, FileNotFoundError)):
active_structure_check.check(Path(directory))
def test_canonical_mode_selects_manifest_owner_not_legacy_stub(self) -> None:
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
canonical = root / "vault/10-projects/demo/branch-notes/feature-x.md"
canonical.parent.mkdir(parents=True)
canonical.write_text("canonical", encoding="utf-8")
stub = root / "raw/branch-notes/feature-x.md"
stub.parent.mkdir(parents=True)
stub.write_text("stub", encoding="utf-8")
checker = root / ".claude/hooks/wiki_structure_lint.py"
checker.parent.mkdir(parents=True)
checker.write_text(
"""
def authority_mapping(root):
return {
'mode': 'canonical',
'legacy_to_canonical': {
'raw/branch-notes/feature-x.md':
'vault/10-projects/demo/branch-notes/feature-x.md'
},
}
def build_template_index(root): return {}, {}
def build_vault_index(root): return set(), {}
def classify(relative, root): return 'full'
def lint_file(path, root, *args, **kwargs):
expected = root / 'vault/10-projects/demo/branch-notes/feature-x.md'
if path != expected:
return [('WRONG_AUTHORITY', 0, str(path))], 'branch-note'
return [], 'branch-note'
""",
encoding="utf-8",
)
result = active_structure_check.check(root)
self.assertEqual(result["status"], "PASS")
self.assertEqual(result["mode"], "canonical")
self.assertEqual(result["namespace"], "canonical")
self.assertEqual(result["checked"], 1)
if __name__ == "__main__":
unittest.main()