generated from coulomb/repo-seed
WP-0016 finished: interactive registry maintain with llm-connect automation
Some checks failed
ci / validate-registry (push) Has been cancelled
Some checks failed
ci / validate-registry (push) Has been cancelled
Closes the registry maintenance loop from inside each domain repo: interactive prompting for judgment calls, full automation for safe and high-confidence changes, both backed by the llm-connect HTTP bridge. - New modules: maintain.py, maintain_llm.py, patches.py, interactive.py - Schema: schemas/registry-patch.schema.json - CLI: reuse-surface maintain; establish --scaffold --hook - Sibling templates: Makefile fragment, pre-commit hook - Deterministic signal collectors extended; validate cwd auto-detect - Docs, gap priority 28, SCOPE update - Tests: test_maintain.py, test_interactive.py (59 pytest total) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,9 @@ from typing import Any
|
||||
import yaml
|
||||
|
||||
from reuse_surface.llm_bridge import request_registry_draft
|
||||
from reuse_surface.registry import load_index_at, registry_paths
|
||||
from reuse_surface.registry import ROOT, load_index_at, registry_paths
|
||||
|
||||
HOOK_TEMPLATE = ROOT / "templates" / "git-hook.pre-commit.registry"
|
||||
|
||||
SCAFFOLD_README = """# Capability Registry
|
||||
|
||||
@@ -80,6 +82,18 @@ def scaffold_registry(
|
||||
return created
|
||||
|
||||
|
||||
def install_registry_hook(repo_root: Path, *, force: bool = False) -> Path:
|
||||
hook_path = repo_root / ".git" / "hooks" / "pre-commit"
|
||||
if not (repo_root / ".git").is_dir():
|
||||
raise ValueError(f"not a git repository: {repo_root}")
|
||||
if hook_path.exists() and not force:
|
||||
raise ValueError(f"hook already exists: {hook_path}; use --force to overwrite")
|
||||
hook_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
hook_path.write_text(HOOK_TEMPLATE.read_text(encoding="utf-8"), encoding="utf-8")
|
||||
hook_path.chmod(0o755)
|
||||
return hook_path
|
||||
|
||||
|
||||
def scaffold_next_steps(repo_root: Path) -> str:
|
||||
return textwrap.dedent(
|
||||
f"""
|
||||
|
||||
Reference in New Issue
Block a user