feat: allow generated files to have custom permissions set via YAML#163
Merged
Conversation
cbrgm
enabled auto-merge
January 27, 2026 15:40
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.
This pull request adds support for specifying file permissions (such as
0755for executables) in theFileStructureconfiguration, allowing generated files to have custom permissions set via YAML. It introduces a newFileModetype to handle octal permissions, updates the file creation logic to respect these permissions, and provides comprehensive tests for the new functionality.File permissions support and propagation:
FileModetype for file permissions, supporting YAML unmarshaling from octal strings (e.g.,"0755","0644") or integers, and added aPermissionsfield toFileStructureto allow specifying file permissions per file. [1] [2]cmd/structuresmith/app.goto apply the specified permissions when writing files, defaulting to0644if none are provided. [1] [2] [3]processDirectory) propagates thePermissionsfield to all files within the directory.YAML configuration and validation:
anvil.ymlto demonstrate how to specify permissions for scripts, making them executable by default.config_test.goto validate correct parsing, stringification, and propagation of permissions in YAML, including handling invalid values. [1] [2]Testing and correctness:
app_test.goto verify that files are created with the correct permissions, that templated and copied files respect permissions, and that permission propagation and merging logic work as expected.