housekeeping and fiona skill overhaul

This commit is contained in:
nvaldez
2026-09-30 21:24:29 +02:00
parent da01b3fe4a
commit a1fccbe641
+13 -13
View File
@@ -114,7 +114,7 @@ SETTINGS_FILE = "fiona-settings.json"
# Read-only zones that should never be modified
READ_ONLY_ZONES = ["personal/", "raw/"]
# CURSOR: stem suffix of the file that carries a newer template (SPEC 7.2.11.1)
# AI/LLM: stem suffix of the file that carries a newer template (SPEC 7.2.11.1)
UPDATE_SUFFIX = "-update"
@@ -136,7 +136,7 @@ def get_llm_wiki_source_path() -> Path:
def update_file_path(file_path: Path) -> Path:
"""Return the sibling update file for a core file (SPEC 7.2.11.1).
Generated by CURSOR: 2026-09-30 - `AGENTS.md` gives `AGENTS-update.md`.
Generated by AI/LLM: 2026-09-30 - `AGENTS.md` gives `AGENTS-update.md`.
Args:
file_path: The owner's core file.
@@ -254,7 +254,7 @@ def is_version_newer(candidate: str, baseline: str) -> bool:
def template_sha256(template_path: Path) -> str:
"""Hash the text wiki init would write for a template file (SPEC 7.2.12).
Generated by CURSOR: 2026-09-30 - DATE_PLACEHOLDER expanded, endings kept.
Generated by AI/LLM: 2026-09-30 - DATE_PLACEHOLDER expanded, endings kept.
Args:
template_path: Path to the template file.
@@ -308,7 +308,7 @@ def compare_md_file(file_path: Path, template_path: Path) -> FileComparisonResul
- files without version frontmatter compare SHA-256 and are a conflict
when the hashes differ (SPEC 7.2.12)
Modified by CURSOR: 2026-09-30 - SHA-256 compare when a version is missing.
Modified by AI/LLM: 2026-09-30 - SHA-256 compare when a version is missing.
Args:
file_path: Path to the current wiki file.
@@ -348,7 +348,7 @@ def compare_non_md_file(file_path: Path, template_path: Path) -> FileComparisonR
This is used for files without version tagging (e.g., JSON files).
Modified by CURSOR: 2026-09-30 - template side hashes init's text (7.2.12).
Modified by AI/LLM: 2026-09-30 - template side hashes init's text (7.2.12).
Args:
file_path: Path to the current wiki file.
@@ -409,7 +409,7 @@ def get_all_template_files(template_dir: Path) -> list[Path]:
relative_posix = relative.as_posix()
if any(path_matches(pattern, relative_posix) for pattern in ignore_patterns):
continue
# CURSOR: byte-code caches and other repository-ignored paths are not updates.
# AI/LLM: byte-code caches and other repository-ignored paths are not updates.
if path_is_ignored(relative_posix, git_patterns):
continue
files.append(relative)
@@ -419,7 +419,7 @@ def get_all_template_files(template_dir: Path) -> list[Path]:
def _patterns_for_update(wiki_root: Path) -> list[str]:
"""Return repository and wiki gitignore patterns for an update check.
Generated by CURSOR: 2026-09-30 - honor both ignore files during update.
Generated by AI/LLM: 2026-09-30 - honor both ignore files during update.
"""
patterns = gitignore_patterns_from_text(repository_gitignore_text())
gitignore = wiki_root / ".gitignore"
@@ -431,7 +431,7 @@ def _patterns_for_update(wiki_root: Path) -> list[str]:
def _excluded_from_update(relative: Path, wiki_root: Path, patterns: list[str]) -> bool:
"""Return whether update must leave this template-relative path alone.
Generated by CURSOR: 2026-09-30 - wiki/ is LLM-owned; gitignored paths stay.
Generated by AI/LLM: 2026-09-30 - wiki/ is LLM-owned; gitignored paths stay.
Paths under ``wiki/`` are seeded only by wiki init. Read-only zones and
gitignore matches are never written or reported.
@@ -442,7 +442,7 @@ def _excluded_from_update(relative: Path, wiki_root: Path, patterns: list[str])
def _is_wiki_page_path(relative: Path) -> bool:
"""Return whether a template-relative path is ``wiki/`` or under it.
Generated by CURSOR: 2026-09-30 - wiki/ pages only ever get conflicts.
Generated by AI/LLM: 2026-09-30 - wiki/ pages only ever get conflicts.
"""
rel = relative.as_posix()
return rel == "wiki" or rel.startswith("wiki/")
@@ -451,7 +451,7 @@ def _is_wiki_page_path(relative: Path) -> bool:
def _is_protected(relative: Path, wiki_root: Path, patterns: list[str]) -> bool:
"""Return whether a path is in a read-only zone or gitignored.
Generated by CURSOR: 2026-09-30 - split out of _excluded_from_update.
Generated by AI/LLM: 2026-09-30 - split out of _excluded_from_update.
"""
if is_read_only_file(wiki_root / relative, wiki_root):
return True
@@ -558,7 +558,7 @@ def check_wiki_updates(directory: str | Path = ".") -> UpdateSummary:
wiki_file = wiki_root / relative
if _is_protected(relative, wiki_root, patterns):
continue
# CURSOR: under wiki/ only an existing markdown page can conflict (SPEC 7.2.9)
# AI/LLM: under wiki/ only an existing markdown page can conflict (SPEC 7.2.9)
wiki_page = _is_wiki_page_path(relative)
if wiki_page and (relative.suffix != ".md" or not wiki_file.exists()):
continue
@@ -598,7 +598,7 @@ SHORT_HASH_LENGTH = 8
def _change_detail(result: FileComparisonResult) -> str:
"""Return the ` (current -> template)` detail for one report line.
Generated by CURSOR: 2026-09-30 - versions, else short SHA-256 (7.2.12.2).
Generated by AI/LLM: 2026-09-30 - versions, else short SHA-256 (7.2.12.2).
"""
if result.current_version and result.template_version:
return f" ({result.current_version} -> {result.template_version})"
@@ -692,7 +692,7 @@ def update_core_files(directory: str | Path = ".", force: bool = False, yes: boo
- Settings files are updated with user customizations preserved.
- Returns summary of all updated files.
Modified by CURSOR: 2026-09-30 - write update files for conflicts.
Modified by AI/LLM: 2026-09-30 - write update files for conflicts.
"""
wiki_root = Path(directory).resolve()