From b1263755706ad3b56ecd9a5f0cc370b2f95a92e5 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Wed, 24 Jun 2026 14:21:44 +0000 Subject: [PATCH] enhanced skeleton diff more robust RT-Style deploy --- .../tool/deploy_RT-Style_indirect_locators | 89 ++++++++++++------- administrator/tool/skeleton_diff | 21 ++++- 2 files changed, 75 insertions(+), 35 deletions(-) diff --git a/administrator/tool/deploy_RT-Style_indirect_locators b/administrator/tool/deploy_RT-Style_indirect_locators index 0f98eae..e162ebf 100755 --- a/administrator/tool/deploy_RT-Style_indirect_locators +++ b/administrator/tool/deploy_RT-Style_indirect_locators @@ -6,38 +6,61 @@ import shutil from pathlib import Path def deploy_RT_Style_indirect_locators(locator_dir_path): - locator_dir = Path(locator_dir_path) - if not locator_dir.is_dir(): - print(f"Error: Locator directory not found at {locator_dir_path}") - sys.exit(1) - - indirect_js = locator_dir / "indirect.js" - if not indirect_js.exists(): - print("Error: indirect.js missing in the specified directory.") - sys.exit(1) - - repo_home = Path(os.environ.get("REPO_HOME", ".")) - IGNORED_DIRS = {".git"} - - for root, dirs, files in os.walk(repo_home): - # Prune ignored directories in place - dirs[:] = [d for d in dirs if d not in IGNORED_DIRS] - - current_path = Path(root) - if current_path.name.lower() == "document": - target_file = current_path / "RT-Style_locator.js" - - # Eliminate permission denial on read-only artifacts - if target_file.exists(): - target_file.chmod(target_file.stat().st_mode | stat.S_IWUSR) - - shutil.copyfile(indirect_js, target_file) - print(f"Copied indirect.js -> {target_file}") + locator_dir = Path(locator_dir_path) + if not locator_dir.is_dir(): + print(f"Error: Locator directory not found at {locator_dir_path}") + sys.exit(1) -if __name__ == "__main__": - if len(sys.argv) != 2: - print("Usage: python3 deploy_RT_Style_indirect_locators.py ") - sys.exit(1) - - deploy_RT_Style_indirect_locators(sys.argv[1]) + indirect_js = locator_dir / "indirect.js" + if not indirect_js.exists(): + print("Error: indirect.js missing in the specified directory.") + sys.exit(1) + + repo_home = Path(os.environ.get("REPO_HOME", ".")) + IGNORED_DIRS = {".git"} + updated_dirs = set() + + for root, dirs, files in os.walk(repo_home): + # Prune ignored directories in place + dirs[:] = [d for d in dirs if d not in IGNORED_DIRS] + current_path = Path(root) + + # Skip if the directory has already received a locator during this run + if current_path in updated_dirs: + continue + needs_locator = False + for file_name in files: + if file_name.endswith(".html"): + file_path = current_path / file_name + try: + with open(file_path, "r", encoding="utf-8") as f: + for line in f: + if "RT-Style_locator.js" in line: + needs_locator = True + break + if "" in line.lower(): + break + if needs_locator: + break + except Exception as e: + print(f"Warning: Could not read {file_path}: {e}") + + if needs_locator: + target_file = current_path / "RT-Style_locator.js" + + # Eliminate permission denial on read-only artifacts + if target_file.exists(): + target_file.chmod(target_file.stat().st_mode | stat.S_IWUSR) + + shutil.copyfile(indirect_js, target_file) + print(f"Copied indirect.js -> {target_file}") + + updated_dirs.add(current_path) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python3 deploy_RT_Style_indirect_locators.py ") + sys.exit(1) + + deploy_RT_Style_indirect_locators(sys.argv[1]) diff --git a/administrator/tool/skeleton_diff b/administrator/tool/skeleton_diff index 3bac840..973c4ae 100755 --- a/administrator/tool/skeleton_diff +++ b/administrator/tool/skeleton_diff @@ -1,12 +1,23 @@ #!/usr/bin/env python3 # -*- mode: python; coding: utf-8; python-indent-offset: 2; indent-tabs-mode: nil -*- -import sys ,os ,filecmp ,stat +import sys ,os ,filecmp ,stat ,subprocess from pathlib import Path def get_project_name(repo_path: Path) -> str: return repo_path.resolve().name +def get_git_branch(repo_path: Path) -> str: + try: + result = subprocess.run( + ["git" ,"-C" ,str(repo_path) ,"branch" ,"--show-current"], + capture_output=True ,text=True ,check=True + ) + branch = result.stdout.strip() + return branch if branch else "unknown_branch" + except (subprocess.CalledProcessError ,FileNotFoundError): + return "unknown_branch" + def format_perms(mode: int) -> str: # Extract the 9-character permission string (e.g., rwxr-xr-x), dropping the leading file type char return stat.filemode(mode)[1:] @@ -27,6 +38,8 @@ def CLI(argv=None) -> int: return 1 project_name = get_project_name(project_dir) + harmony_branch = get_git_branch(harmony_dir) + project_branch = get_git_branch(project_dir) # Data structures for the output sections opus_warnings = [] @@ -133,7 +146,10 @@ def CLI(argv=None) -> int: perms_only_changes.append(display_str) # --- Output Generation --- - print(f"\nSkeleton Audit: Harmony vs {project_name}") + print("Skeleton Audit:") + print(f" Harmony {harmony_branch}") + print(" vs") + print(f" {project_name} {project_branch}") print("=" * 60) print("\n1. 0pus File Audit") @@ -197,3 +213,4 @@ def CLI(argv=None) -> int: if __name__ == "__main__": sys.exit(CLI()) + -- 2.20.1