Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions hermes_cli/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,23 @@ def create_profile(
)

if clone_all and source_dir:
# Full copy of source profile
shutil.copytree(source_dir, profile_dir)
# Full copy of source profile, excluding infrastructure but keeping credentials
def _clone_all_ignore(directory: str, contents: list) -> set:
ignored = set()
for entry in contents:
if entry == "__pycache__" or entry.endswith((".sock", ".tmp")):
ignored.add(entry)
elif entry in ("package.json", "package-lock.json"):
ignored.add(entry)

# Root-level exclusions: use export list but KEEP .env and auth.json
if Path(directory) == source_dir:
exclude_root = set(_DEFAULT_EXPORT_EXCLUDE_ROOT) - {".env", "auth.json"}
ignored.update(c for c in contents if c in exclude_root)
return ignored

shutil.copytree(source_dir, profile_dir, ignore=_clone_all_ignore)

# Strip runtime files
for stale in _CLONE_ALL_STRIP:
(profile_dir / stale).unlink(missing_ok=True)
Expand Down