The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(profiles): exported archives open in Finder (GNU tar, not PAX)
Brooklyn Nicholson1d6606d2cff6
diff --git a/hermes_cli/profiles.py b/hermes_cli/profiles.pyindex 10aa296d917..71acde626c2 100644--- a/hermes_cli/profiles.py+++ b/hermes_cli/profiles.py@@ -1901,6 +1901,23 @@ def _default_export_ignore(root_dir: Path):return _ignore+def _make_profile_archive(base: str, root_dir: str, base_dir: str) -> str:+ """Create ``<base>.tar.gz`` of ``root_dir/base_dir`` — GNU tar format.++ Not :func:`shutil.make_archive`: that writes PAX (Python's tarfile default+ since 3.8), whose fractional-mtime records macOS Archive Utility rejects —+ double-clicking an exported profile threw "Error 94 - Bad message." GNU+ format keeps long paths working (longlink extensions) and stays integer-+ mtime, so Finder, bsdtar, and gnutar all extract it.+ """+ import tarfile++ archive_path = f"{base}.tar.gz"+ with tarfile.open(archive_path, "w:gz", format=tarfile.GNU_FORMAT) as tf:+ tf.add(str(Path(root_dir) / base_dir), arcname=base_dir)+ return archive_path++def export_profile(name: str, output_path: str, extra_files: Optional[Dict[str, str]] = None) -> Path:"""Export a profile to a tar.gz archive.@@ -1918,7 +1935,7 @@ def export_profile(name: str, output_path: str, extra_files: Optional[Dict[str,raise FileNotFoundError(f"Profile '{canon}' does not exist.")output = Path(output_path)- # shutil.make_archive wants the base name without extension+ # Archive base name without extension (.tar.gz appended by the writer).base = str(output).removesuffix(".tar.gz").removesuffix(".tgz")def _stage_extras(staged: Path) -> None:@@ -1941,7 +1958,7 @@ def export_profile(name: str, output_path: str, extra_files: Optional[Dict[str,ignore=_default_export_ignore(profile_dir),)_stage_extras(staged)- result = shutil.make_archive(base, "gztar", tmpdir, "default")+ result = _make_profile_archive(base, tmpdir, "default")return Path(result)# Named profiles — stage a filtered copy to exclude credentials@@ -1955,7 +1972,7 @@ def export_profile(name: str, output_path: str, extra_files: Optional[Dict[str,ignore=lambda d, contents: _CREDENTIAL_FILES & set(contents),)_stage_extras(staged)- result = shutil.make_archive(base, "gztar", tmpdir, canon)+ result = _make_profile_archive(base, tmpdir, canon)return Path(result)