Skip to main content

Module patch

Module patch 

Source

Constants§

PATCHES_DIR

Functions§

apply_patch_pure
Apply a unified diff to original text, returning modified content. Pure implementation — no subprocess, no patch binary required. Only handles patches produced by generate_patch() (unified diff format). Returns an error if the patch does not apply cleanly.
dir_patch_path
Path to a per-file patch within a directory entry. e.g. .skillfile/patches/skills/architecture-patterns/SKILL.md.patch
generate_patch
Generate a unified diff of original → modified. Empty string if identical. All output lines are guaranteed to end with ‘\n’. Format: --- a/{label} / +++ b/{label}, 3 lines of context.
has_dir_patch
has_patch
patch_path
Path to the patch file for a single-file entry. e.g. .skillfile/patches/agents/my-agent.patch
patches_root
read_patch
remove_all_dir_patches
remove_dir_patch
remove_patch
Remove the patch file for a single-file entry. No-op if it doesn’t exist.
walkdir
Recursively list all files under a directory, sorted.
write_dir_patch
write_patch