Skip to content

feat(sync): custom bundle path + hybrid mode merge#440

Merged
HarryCampion merged 4 commits intomainfrom
copilot/allow-template-location-configuration
Mar 13, 2026
Merged

feat(sync): custom bundle path + hybrid mode merge#440
HarryCampion merged 4 commits intomainfrom
copilot/allow-template-location-configuration

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

template-bundles.yml was hardcoded to .rhiza/template-bundles.yml in the upstream repo, and hybrid mode (templates: + include:) silently dropped explicit include: paths by overwriting them with resolved bundle paths.

Changes

RhizaTemplate model

  • New template_bundles_path field (default: .rhiza/template-bundles.yml) — reads from template-bundles-path in YAML; omitted from serialisation when default to keep configs clean

_clone_template() in sync.py

  • Uses template.template_bundles_path instead of the hardcoded string
  • Hybrid mode fix: merges resolved bundle paths with explicit include: paths (deduplicated) rather than overwriting
# downstream template.yml — bundle definitions at a non-standard upstream location
template-bundles-path: tooling/my-bundles.yml
templates:
  - core
include:
  - extra/custom-file.txt   # now correctly synced alongside bundle files

Tests

  • test_hybrid_mode_merges_bundle_and_include_pathsupdate_sparse_checkout receives both resolved bundle paths and explicit include: paths
  • test_custom_template_bundles_path_is_used — custom path propagates to both clone_repository and RhizaBundles.from_yaml
  • Model-level tests for default value, round-trip serialisation, and default suppression
Original prompt

This section details on the original issue you should resolve

<issue_title>Allow users to point to a location for template</issue_title>
<issue_description>Allow users to point to a location for the template.yml file location and also where the template lock file will be produced. Write a clear e2e test for this.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: HarryCampion <40582604+HarryCampion@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option for users to specify template file location feat(sync): allow custom paths for template.yml and template.lock Mar 13, 2026
Copilot AI requested a review from HarryCampion March 13, 2026 08:31
@HarryCampion
Copy link
Copy Markdown
Collaborator

@copilot perhaps we have path to template, e.g. --path-to-template . would be the root, and would look for both template.yml, and template.lock. E.g. all template related files are expected to be under the same path.

…te option

Per code review feedback: a single --path-to-template directory option is
cleaner than two separate --config and --lock-file options. Both template.yml
and template.lock are resolved as <dir>/template.yml and <dir>/template.lock.

- cli.py: removed --config/-c and --lock-file; added --path-to-template
- test_sync_e2e.py: rewrote TestSyncE2ECustomPaths around the new option

Co-authored-by: HarryCampion <40582604+HarryCampion@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 13, 2026

@copilot perhaps we have path to template, e.g. --path-to-template . would be the root, and would look for both template.yml, and template.lock. E.g. all template related files are e...

Done in d0733b9. Replaced the two separate --config/--lock-file options with a single --path-to-template option. Both template.yml and template.lock are resolved from the same directory:

rhiza sync --path-to-template /custom/rhiza   # reads /custom/rhiza/template.yml, writes /custom/rhiza/template.lock
rhiza sync --path-to-template .               # uses project root for both files

The default behaviour (no flag → .rhiza/) is unchanged. E2e tests cover the custom directory, project-root (--path-to-template .), subsequent incremental syncs, and CLI wiring.

@HarryCampion
Copy link
Copy Markdown
Collaborator

@copilot perhaps we have path to template, e.g. --path-to-template . would be the root, and would look for both template.yml, and template.lock. E.g. all template related files are e...

Done in d0733b9. Replaced the two separate --config/--lock-file options with a single --path-to-template option. Both template.yml and template.lock are resolved from the same directory:

rhiza sync --path-to-template /custom/rhiza   # reads /custom/rhiza/template.yml, writes /custom/rhiza/template.lock
rhiza sync --path-to-template .               # uses project root for both files

The default behaviour (no flag → .rhiza/) is unchanged. E2e tests cover the custom directory, project-root (--path-to-template .), subsequent incremental syncs, and CLI wiring.

@copilot great. What about custom bundles?

Copilot AI changed the title feat(sync): allow custom paths for template.yml and template.lock feat(sync): allow custom template directory via --path-to-template Mar 13, 2026
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 13, 2026

@copilot perhaps we have path to template, e.g. --path-to-template . would be the root, and would look for both template.yml, and template.lock. E.g. all template related files a...

Bundle definitions (template-bundles.yml) live inside the upstream template repository — they're fetched during sync via sparse checkout and aren't a local file. The --path-to-template option covers the local side: template.yml (which lists which bundles to use via templates:) and template.lock. So if you want to use a non-standard set of bundles, you'd point --path-to-template at a directory containing a template.yml with your chosen templates: list, and that's already supported.

If the ask is to support a locally-overridden template-bundles.yml (i.e. bundle definitions that don't come from the upstream repo), that would be a separate feature. Let me know if that's what you have in mind.

Co-authored-by: HarryCampion <40582604+HarryCampion@users.noreply.github.com>
Copilot AI changed the title feat(sync): allow custom template directory via --path-to-template feat(sync): custom bundle path + hybrid mode merge Mar 13, 2026
@HarryCampion HarryCampion marked this pull request as ready for review March 13, 2026 09:19
@HarryCampion HarryCampion merged commit ad7a331 into main Mar 13, 2026
15 checks passed
@HarryCampion HarryCampion deleted the copilot/allow-template-location-configuration branch March 13, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to point to a location for template

2 participants