You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The patch flow in `check_for_updates()` and `patch_category()` uses `clone_template(url, temp_path)` to fetch the latest template for comparison. This works for standalone template repos (MCP server, gateway, UI, sandbox) but not for agent or workflow templates, which live in subdirectories of a monorepo (`templates/agent-loop/` and `templates/workflow/`).
Cloning the full agent-template repo and comparing against the project root would match against monorepo-level files (top-level Makefile, packages/, etc.) instead of the actual template subdirectory.
Proposed change
When patching a monorepo-based project, the patch flow needs to:
Resolve the subdirectory within the clone (`temp_path / subdir`)
Use that subdirectory as the comparison root (instead of `temp_path` itself)
This is essentially what `clone_template_subdir()` already does during `create`, but the patch code needs to replicate the subdir-extraction logic without calling `clone_template_subdir` directly (since that function copies to the target, which isn't what patch wants — patch needs the template files in-place for comparison).
For standalone repos, template_root == temp_dir_path.
For monorepo subdirs, template_root == temp_dir_path / subdir.
Caller must clean up temp_dir_path.
"""
```
Then `check_for_updates()` and `patch_category()` use `template_root` for glob/compare instead of `temp_path`.
Part of
Tracking issue: #12
Depends on: #13 (needs `template.subdir` in `.template-info`)
Problem
The patch flow in `check_for_updates()` and `patch_category()` uses `clone_template(url, temp_path)` to fetch the latest template for comparison. This works for standalone template repos (MCP server, gateway, UI, sandbox) but not for agent or workflow templates, which live in subdirectories of a monorepo (`templates/agent-loop/` and `templates/workflow/`).
Cloning the full agent-template repo and comparing against the project root would match against monorepo-level files (top-level Makefile, packages/, etc.) instead of the actual template subdirectory.
Proposed change
When patching a monorepo-based project, the patch flow needs to:
This is essentially what `clone_template_subdir()` already does during `create`, but the patch code needs to replicate the subdir-extraction logic without calling `clone_template_subdir` directly (since that function copies to the target, which isn't what patch wants — patch needs the template files in-place for comparison).
Approach
Add a helper in `tools/patching.py`:
```python
def _clone_template_for_patch(template_info: dict) -> tuple[Path, Path]:
"""Clone template and return (temp_dir_path, template_root).
```
Then `check_for_updates()` and `patch_category()` use `template_root` for glob/compare instead of `temp_path`.
Part of
Tracking issue: #12
Depends on: #13 (needs `template.subdir` in `.template-info`)