MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / compute_skill_diff

Function compute_skill_diff

openspace/skill_engine/patch.py:920–935  ·  view source on GitHub ↗

Compare all files in two skill directories, return combined diff.

(old_dir: Path, new_dir: Path)

Source from the content-addressed store, hash-verified

918 return "".join(diff_lines)
919
920def compute_skill_diff(old_dir: Path, new_dir: Path) -> str:
921 """Compare all files in two skill directories, return combined diff."""
922 old_files = _collect_files(old_dir) if old_dir.is_dir() else {}
923 new_files = _collect_files(new_dir) if new_dir.is_dir() else {}
924
925 all_names = sorted(set(old_files) | set(new_files))
926 parts: list[str] = []
927 for name in all_names:
928 d = compute_unified_diff(
929 old_files.get(name, ""),
930 new_files.get(name, ""),
931 filename=name,
932 )
933 if d:
934 parts.append(d)
935 return "\n".join(parts)
936
937def collect_skill_snapshot(skill_dir: Path) -> Dict[str, str]:
938 """Collect all text files in a skill directory.

Callers 1

derive_skillFunction · 0.85

Calls 3

_collect_filesFunction · 0.85
compute_unified_diffFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected