feat: dir and file updates to support working dir#591
Merged
jakobmoellerdev merged 26 commits intoAug 22, 2025
Merged
Conversation
Fix: broken build On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com> On-behalf-of: SAP <matthias.bruns@sap.com>
06b15fe to
8d0cd26
Compare
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
matthiasbruns
commented
Aug 20, 2025
matthiasbruns
commented
Aug 20, 2025
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
matthiasbruns
commented
Aug 20, 2025
matthiasbruns
commented
Aug 20, 2025
matthiasbruns
commented
Aug 20, 2025
matthiasbruns
commented
Aug 20, 2025
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
…m:matthiasbruns/open-component-model into feat/565_relative_file_pointers_dir_input
jakobmoellerdev
left a comment
Member
There was a problem hiding this comment.
approach is generally sound but have quite a few style findings. also missing a test where you actually run the command with this workin dir override
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces working directory support for file and directory input methods, allowing paths to be resolved relative to a configurable working directory while providing path escape protection.
- Adds
WorkingDirectoryconfiguration to filesystem config and wire it through input method registration - Updates CLI flag handling to support both temp folder and working directory configuration
- Refactors setup code into a modular hook system with options pattern for better extensibility
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/internal/plugin/builtin/input/file/method.go | Adds filesystem config parameter to register working directory with file input method |
| cli/internal/plugin/builtin/input/dir/method.go | Adds filesystem config parameter to register working directory with dir input method |
| cli/internal/plugin/builtin/builtin.go | Updates builtin plugin registration to pass filesystem config |
| cli/go.mod | Updates dependency versions for input methods and moves dag dependency |
| cli/cmd/setup/setup_test.go | Adds comprehensive tests for working directory setup and updates existing tests |
| cli/cmd/setup/setup_filesystem_config.go | Refactors filesystem config setup with options pattern and working directory support |
| cli/cmd/setup/setup.go | Renames functions to be public and updates flag references |
| cli/cmd/setup/hooks/pre_run.go | Introduces new hook system with options pattern for setup configuration |
| cli/cmd/internal/cmd/flags.go | Centralizes flag name constants including new working directory flag |
| cli/cmd/cmd.go | Migrates to new hook system and adds working directory flag |
| cli/cmd/add/component-version/cmd.go | Implements smart working directory defaulting based on constructor file location |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
AOn-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
jakobmoellerdev
approved these changes
Aug 21, 2025
jakobmoellerdev
added a commit
that referenced
this pull request
Aug 25, 2025
<!-- markdownlint-disable MD041 --> #### What this PR does / why we need it - Refactored working directory handling - Improved CLI flag precedence logic to ensure CLI flag values override other configurations effectively. - Removed hooks and builder logic to reduce complexity and redundancy. - Enhanced unit test to validate new working directory and filesystem setup logic is actually set in filesystem context These changes improve reliability and simplify the implementation of filesystem configuration while ensuring proper value precedence and behavior. They also fixed a bug in the filesystem config defaulting not applying to the context. #### Which issue(s) this PR fixes <!-- Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> follow up to #591 --------- Signed-off-by: Jakob Möller <jakob.moeller@sap.com>
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.
What this PR does / why we need it
Resolve file/dir inputs relative to the constructor file by wiring a filesystem working directory through input methods; default-deny path escapes with an explicit opt-out.
Changes (high level):
Which issue(s) this PR fixes
Fixes #565