Skip to content

Support project-local (committed) templates #1

Description

@MarekUrzon

Support project-local (committed) templates

Problem

.orbxrc is meant to be committed and shared (the orbx init scaffold says so),
but template = <name> resolves only against per-user/bundled dirs
(orbx::resolve_template, bin/orbx:95). So a repo can't ship its own template:

  • template = default → works for everyone (bundled). ✅
  • template = my-custom → teammates who clone get template "my-custom" not found
    unless they manually copy the YAML into ~/.orbx/templates or export
    ORBX_TEMPLATE_DIR. ❌

There's no config key for a template directory, and a path value isn't accepted
(it's concatenated as "$dir/$name.yaml"). The only lever, ORBX_TEMPLATE_DIR,
lives outside orbx, so the repo still isn't self-contained.

Proposed solution

Add a template_dir key to .orbxrc, resolved relative to the repo root and
prepended to the search path:

template_dir = .orbx/templates
template     = rails-e2e        # → ./.orbx/templates/rails-e2e.yaml

Search order becomes:
$ORBX_TEMPLATE_DIR → <template_dir> → ~/.orbx/templates → bundled → <script>/../templates

Keeps template = <name> working, lets a repo carry its own template, and stays
within the security model (config is parsed, never sourced; template_dir is
just a path).

Acceptance criteria

- [ ] template_dir (relative to .orbxrc, or absolute) is honored in
resolve_template/resolve_context.
- [ ] User/bundled shadowing behavior stays defined; missing dir errors clearly.
- [ ] bats coverage + docs (AGENTS.md "Template resolution", orbx init scaffold).

Workaround until then

Commit the template to the repo and set
export ORBX_TEMPLATE_DIR="$PWD/.orbx/templates" via direnv/CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions