Symptom
"src": "assets/dot.png" in a scenario resolves relative to wherever the process was launched, not to the scenario file. The same file renders or fails depending on the shell's directory.
cd /tmp/rmchk && rustmotion render -f rel.json -o a.png --frame 0 # ok
cd / && rustmotion render -f /tmp/rmchk/rel.json -o b.png --frame 0
# Error: views[0].scenes[0].children[0].src: file not found 'assets/dot.png'
This is the single cause behind a whole family of "component X does not render" reports: authoring a scenario from its own directory works, then the studio — launched from the repo root — resolves nothing.
Why it is surprising
include already resolves relative to the including file. Two path-like fields in the same document following two different rules is the trap. Every asset field is affected: image.src, video.src, gif.src, audio.src, lottie.src, svg.src, mockup…
The consequence is also inconsistent per component: a hard validation error for image and gif, a warning for video ("could not be decoded"), and nothing at all for an audio track feeding waveform before #181.
Proposed fix
Resolve asset paths against the scenario file's directory, like include, with the CWD as a fallback for compatibility:
- Thread the scenario's own directory (already known to the loader —
included_paths proves it is tracked) into resolution.
- Add one helper,
resolve_asset(base_dir, src), that returns src unchanged when absolute, tries base_dir/src, then falls back to cwd/src.
- Warn once when the CWD fallback is what matched, so existing scenarios keep working but the ambiguity is visible.
- Stdin scenarios (no file) keep the current behaviour.
Document the rule in SKILL.md next to include.
Symptom
"src": "assets/dot.png"in a scenario resolves relative to wherever the process was launched, not to the scenario file. The same file renders or fails depending on the shell's directory.This is the single cause behind a whole family of "component X does not render" reports: authoring a scenario from its own directory works, then the studio — launched from the repo root — resolves nothing.
Why it is surprising
includealready resolves relative to the including file. Two path-like fields in the same document following two different rules is the trap. Every asset field is affected:image.src,video.src,gif.src,audio.src,lottie.src,svg.src,mockup…The consequence is also inconsistent per component: a hard validation error for
imageandgif, a warning forvideo("could not be decoded"), and nothing at all for anaudiotrack feedingwaveformbefore #181.Proposed fix
Resolve asset paths against the scenario file's directory, like
include, with the CWD as a fallback for compatibility:included_pathsproves it is tracked) into resolution.resolve_asset(base_dir, src), that returnssrcunchanged when absolute, triesbase_dir/src, then falls back tocwd/src.Document the rule in
SKILL.mdnext toinclude.