Skip to content

feat: #565 relative file pointers#540

Closed
matthiasbruns wants to merge 15 commits into
open-component-model:mainfrom
matthiasbruns:feat/565_relative_file_pointers
Closed

feat: #565 relative file pointers#540
matthiasbruns wants to merge 15 commits into
open-component-model:mainfrom
matthiasbruns:feat/565_relative_file_pointers

Conversation

@matthiasbruns

@matthiasbruns matthiasbruns commented Aug 12, 2025

Copy link
Copy Markdown
Contributor

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):

  • Added WorkingDirectory to FS config and flag plumbing in CLI.
  • Updated file/dir input methods to use the working dir + path utils; tests updated for path handling.

Which issue(s) this PR fixes

Fixes #565

Copilot AI review requested due to automatic review settings August 12, 2025 14:59
@matthiasbruns matthiasbruns requested a review from a team as a code owner August 12, 2025 14:59
@github-actions github-actions Bot added kind/feature new feature, enhancement, improvement, extension size/m Medium labels Aug 12, 2025
@matthiasbruns matthiasbruns changed the title feat: 565 relative file pointers [WIP ]feat: 565 relative file pointers Aug 12, 2025
@matthiasbruns matthiasbruns changed the title [WIP ]feat: 565 relative file pointers [WIP] feat: 565 relative file pointers Aug 12, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for relative file pointers by introducing working directory configuration to the filesystem. The changes enable relative paths to be resolved against a configurable working directory instead of the current working directory.

  • Adds WorkingDirectory field to filesystem configuration
  • Implements path resolution utilities to handle absolute vs relative paths
  • Updates file input method to use the configured working directory for path resolution

Reviewed Changes

Copilot reviewed 8 out of 8 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 Updates registration functions to accept filesystem configuration
cli/internal/plugin/builtin/builtin.go Passes filesystem configuration to file input registration
cli/cmd/setup_filesystem_config.go Refactors configuration setup and adds working directory flag support
cli/cmd/cmd.go Adds working directory flag constant
bindings/go/input/file/path_test.go Adds comprehensive tests for path utilities
bindings/go/input/file/path.go Implements path resolution utilities
bindings/go/input/file/method.go Updates InputMethod to use working directory for path resolution
bindings/go/configuration/filesystem/v1alpha1/spec/config.go Adds WorkingDirectory field to filesystem configuration

Comment thread cli/internal/plugin/builtin/input/file/method.go Outdated
Comment thread bindings/go/input/file/path.go Outdated
Comment thread cli/cmd/setup_filesystem_config.go Outdated
@jakobmoellerdev jakobmoellerdev marked this pull request as draft August 12, 2025 15:08
@jakobmoellerdev jakobmoellerdev changed the title [WIP] feat: 565 relative file pointers feat: 565 relative file pointers Aug 12, 2025
@matthiasbruns matthiasbruns changed the title feat: 565 relative file pointers feat: #565 relative file pointers Aug 12, 2025
@github-actions github-actions Bot added the size/l Large label Aug 12, 2025
@matthiasbruns

matthiasbruns commented Aug 12, 2025

Copy link
Copy Markdown
Contributor Author

Still missing

open-component-model/ocm-project#565 (comment)

Additionally for add cv:

--workingdir / -c should be able to define a custom working directory. If not defined, it should default to the folder in which the component-constructor.yaml is contained. This is to replicate v1 CLI behavior.

@jakobmoellerdev jakobmoellerdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember that when actually opening the PR you shouldn't push the go workspace but separate your changes into the individual modules as single PRs so we can version them separately too!

Comment thread bindings/go/input/dir/method.go Outdated
Comment thread bindings/go/input/dir/method.go Outdated
Comment thread bindings/go/input/dir/method.go Outdated
Comment thread bindings/go/input/dir/method.go Outdated
Comment thread bindings/go/input/dir/method_test.go Outdated
Comment thread cli/cmd/setup_filesystem_config.go Outdated
jakobmoellerdev pushed a commit that referenced this pull request Aug 13, 2025
Cherry picking filesystem changes from
#540

#### 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):

- Added WorkingDirectory to FS config

#### Which issue(s) this PR fixes
Fixes
[#565](open-component-model/ocm-project#565)

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
jakobmoellerdev added a commit that referenced this pull request Aug 18, 2025
Cherry picking constructor changes from
#540

#### 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):

- Added WorkingDirectory handling to the input bindings

#### Which issue(s) this PR fixes
Fixes
[#565](open-component-model/ocm-project#565)

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Co-authored-by: Jakob Möller <jakob.moeller@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@matthiasbruns matthiasbruns force-pushed the feat/565_relative_file_pointers branch from 322d864 to 7a5a232 Compare August 19, 2025 09:19
@matthiasbruns

Copy link
Copy Markdown
Contributor Author

#591

@matthiasbruns matthiasbruns deleted the feat/565_relative_file_pointers branch August 19, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature new feature, enhancement, improvement, extension size/l Large size/m Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make file and dir inputs support relative paths

3 participants