Skip to content

fix: Resolve import paths and working dirs relative to config file location#118

Merged
YuKitsune merged 5 commits intomainfrom
fix/117-relative-imports-and-working-dirs
Mar 27, 2026
Merged

fix: Resolve import paths and working dirs relative to config file location#118
YuKitsune merged 5 commits intomainfrom
fix/117-relative-imports-and-working-dirs

Conversation

@YuKitsune
Copy link
Copy Markdown
Owner

Summary

Fixes #117

  • Relative source: paths in imports are now resolved relative to the config file containing the import, not the current working directory
  • Executions in imported configs default their working directory to the imported config file's directory
  • Explicit workdir: values that are relative paths are resolved against the imported config file's directory
  • Absolute workdir: values are left unchanged
  • All of the above apply recursively to nested imports

How it works

parse_config now accepts an optional base_dir derived from the config file's path. When an import is processed, its source path is resolved against base_dir. After loading the imported config, resolve_command_working_dirs walks all commands (and variables) recursively, setting each execution's working directory relative to the imported file's location. Inner imports set absolute paths during their own resolution pass, so the outer pass leaves them unchanged.

A normalize_path helper removes . and .. components from joined paths without touching the filesystem, ensuring consistent path strings across assertions and comparisons.

…cation

Relative import source paths were previously resolved from the current
working directory rather than the directory containing the config file,
making it impossible to use relative imports in sub-configs.

Additionally, executions in imported configs now default their working
directory to the imported config file's directory. Any explicit relative
working directory is also resolved against that location. This allows
commands in sub-configs to reference sibling files (e.g. ./install.sh)
without needing to know where they will be invoked from.

Fixes #117
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plz Ignored Ignored Mar 27, 2026 4:48am

@YuKitsune YuKitsune merged commit 2ed9d3f into main Mar 27, 2026
10 checks passed
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.

Relative import paths in sub-configs resolve from CWD instead of config file location

1 participant