Repository navigation
Accept a path as the template value - #7
Merged
Merged
Conversation
`template` only ever took a bare name resolved against user/bundled dirs, so
a repo could not ship its own template: teammates cloning a project with
`template = my-custom` got "template not found" unless they hand-copied the
YAML into ~/.orbx/templates or exported ORBX_TEMPLATE_DIR.
Let the value be a path instead. A path-shaped value — an explicit ./ ../ /
or ~/ prefix, or a .yaml/.yml extension — skips the search path and is used
as given, resolved against $PWD, the same anchor as ./.orbxrc:
# ./.orbxrc, committed
template = .orbx/rails-e2e.yaml
The two forms are disjoint, so bare names keep their meaning — including an
undocumented `sub/nested` that resolves to ~/.orbx/templates/sub/nested.yaml.
`--template ./experiment.yaml` works for free, since the flag feeds the same
function.
Chosen over a separate `template_dir` key: no new config key, no precedence
rules to define, and a repo almost always ships one file rather than a
directory.
Closes #1
Claude-Session: https://claude.ai/code/session_01QHfJqUbdwdcGfbkvP3XJja
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
Problem
.orbxrcis meant to be committed, buttemplateonly took a bare name resolved against per-user and bundled dirs (orbx::resolve_template). So a repo couldn't ship its own template — teammates cloning a project withtemplate = my-customgottemplate "my-custom" not foundunless they hand-copied the YAML into~/.orbx/templatesor exportedORBX_TEMPLATE_DIR. The one lever that worked lived outside the repo, so the repo still wasn't self-contained.Change
1.
templateaccepts a path. A path-shaped value — an explicit./,../,/or~/prefix, or a.yaml/.ymlextension — skips the search path and is used as given, resolved against$PWD(the same anchor./.orbxrcitself is read from):Commit
.orbx/rails-e2e.yamlnext to it and everyone who clones gets the same machine.--template ./experiment.yamlworks for free, since the flag feeds the same function.2.
orbx templatesnow agrees with resolution. It scanned three dirs and omitted$ORBX_TEMPLATE_DIR, so a templateorbx upwould actually pick never appeared in the listing — a pre-existing bug, and one the path form would have made worse by hiding the active template entirely. It now walks the same four locations in the same order, labels the source distinctly, and gives a path-valued template its own row:(active, missing)when the committed path points at a file that isn't there.Why not a
template_dirkeyThe issue proposed one. This is smaller and buys the same thing: no new config key, no
effective_config/resolve_contextchanges, no precedence rules or missing-dir errors to define, and no anchor question to settle (the issue says "repo root", but orbx never walks up —.orbxrcis read from$PWDonly). A repo almost always ships one template file, not a directory.Backward compatible by construction. The trigger is an extension or an explicit path prefix, so every bare name keeps its meaning — including an undocumented
sub/nestedthat resolves to~/.orbx/templates/sub/nested.yaml. There's a regression test for exactly that, and another pinning the existing(active)marker on bare names.Testing
13 new tests, each written first and watched fail before implementing:
test/template.bats(8) — relative,./-prefixed, absolute and~/paths;.ymlextension; the missing-path error; the bare-name regression guard; and an integration test drivingorb createfrom a committed.orbxrc.test/meta.bats(5) —$ORBX_TEMPLATE_DIRlisted and labeledenv; env shadowing a same-named user template; theprojectrow and its(active)marker;(active, missing); and the bare-name marker guard.Verification:
shellcheck bin/orbx test/helpers/orb-stub script/releasecleanorbx: template file /…/nope.yaml not found(exit 1),--template defaultstill hitting the bundled dir, and all five listing states aboveNote for review
A committed template is provisioning code —
orbx upruns it as root in the VM. That's inherent to project-local templates under any design, and the machine is--isolated, but it does mount$PWD. Called out in the README rather than gated in code.https://claude.ai/code/session_01QHfJqUbdwdcGfbkvP3XJja