feat: enhance Pkl evaluator consolidation and add multiple headers support #57
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.
�� Overview
This PR introduces comprehensive improvements to the kdeps Pkl evaluation system and adds support for multiple headers in Pkl files. The changes ensure better code organization, enhanced validation, and improved user experience when working with complex Pkl configurations.
✨ Key Features
🔧 Pkl Evaluator Consolidation
pkg/evaluator/evaluator.goNewConfiguredEvaluatorfunction with standardized options�� Multiple Headers Support
amendsstatements in Pkl files��️ File Protection
�� Detailed Changes
Files Modified:
pkg/evaluator/evaluator.goNewConfiguredEvaluatorfunction for centralized evaluator creationpkg/resolver/resolver.gogetResourceReaders()helper methodpkg/resolver/resource_response.goevaluator.NewConfiguredEvaluatoranddr.getResourceReaders()pkg/resolver/resources.gopkg/archiver/resource_compiler.goEvaluatePklResourcesfunction for comprehensive Pkl validationpkg/archiver/workflow_handler.goCompileWorkflowfunctionEvaluateAllPklFilesfor comprehensive validationpkg/enforcer/enforcer.goEnforcePklTemplateAmendsRulesto validate all amends statementspkg/resolver/imports.goPrependDynamicImportsto handle multiple amends statementsNew Test Files:
pkg/archiver/workflow_handler_test.goTestCompileProjectDoesNotModifyOriginalFiles- verifies file protectionpkg/enforcer/enforcer_test.goTestEnforcePklTemplateAmendsRules_MultipleAmends- validates multiple headersTestEnforcePklTemplateAmendsRules_InvalidAmends- tests error handlingTestEnforcePklTemplateAmendsRules_NoAmends- edge case testingUpdated Test Files:
cmd/package_test.gopkg/archiver/archiver_test.gologging.NewTestLogger()🧪 Testing
Test Coverage:
Manual Testing:
🔄 Backward Compatibility
🚀 Benefits
📋 Commit History
4662c0b- feat: add support for multiple headers in Pkl files7c14b9d- fix: ensure kdeps package command doesn't modify original project filesdf276a9- refactor: consolidate Pkl evaluator usage across resolver components2de0e48- feat: implement comprehensive Pkl evaluation during kdeps package command