CELL-PATCH(1)                    Cell Manual                    CELL-PATCH(1)

NAME
       cell patch - Create a patch file for local modifications

SYNOPSIS
       cell patch <alias>

DESCRIPTION
       The patch command creates a patch file capturing local modifications
       made to a dependency. This allows you to maintain custom changes to
       upstream modules that persist across updates.

       Patches are stored in .cell/patches/ and automatically applied when
       modules are fetched or updated.

ARGUMENTS
       alias
              The dependency alias to create a patch for

OPERATION
       1. Compares the current module state with the original
       2. Generates a unified diff of all changes
       3. Saves the patch to .cell/patches/alias.patch
       4. Updates cell.toml to reference the patch

PATCH APPLICATION
       Patches are automatically applied:
       - After 'cell get' fetches a module
       - After 'cell update' downloads a new version
       - During 'cell vendor' operations
       
       Application order matches the order in cell.toml [patches] section.

EXAMPLES
       Create a patch after modifying a dependency:
              # Edit files in .cell/modules/chess@v1.0.0/
              cell patch chess
       
       This creates:
              .cell/patches/chess.patch
       
       And updates cell.toml:
              [patches]
              chess = "./patches/chess.patch"

PATCH FORMAT
       Patches use unified diff format:
              --- a/main.js
              +++ b/main.js
              @@ -10,3 +10,4 @@
               function init() {
                 console.log("Starting chess engine");
              +  console.log("With custom modifications");
               }

NOTES
       - Keep patches small and focused
       - Document why each patch is needed
       - Test patches with new versions during updates
       - Patches may fail to apply if upstream changes conflict
       - TODO: Actual implementation pending

FILES
       .cell/patches/
              Directory containing all patch files
       
       .cell/cell.toml
              Updated with patch references

WORKFLOW
       1. cell get git.world/jj/chess@v1.0.0
       2. Modify files in .cell/modules/chess@v1.0.0/
       3. cell patch chess
       4. Commit .cell/patches/chess.patch to version control
       5. Future 'cell get' commands will apply the patch

SEE ALSO
       cell(1), cell-get(1), cell-update(1)