Skip to content

feat: propagate HCL inline comments on attributes to YAML output#10

Merged
jccguimaraes merged 2 commits intomainfrom
feat/keep-permissions-comments
Apr 10, 2026
Merged

feat: propagate HCL inline comments on attributes to YAML output#10
jccguimaraes merged 2 commits intomainfrom
feat/keep-permissions-comments

Conversation

@jccguimaraes
Copy link
Copy Markdown
Contributor

Introduces an annotated wrapper type that threads trailing # comments from HCL attributes through the map[string]any pipeline. toYAMLNode unwraps it and attaches the comment as a LineComment on the YAML node, so any attribute-level comment in HCL appears inline in the generated YAML.

Validators that type-assert map values use unwrapAnnotatedMap to strip the wrapper before checking. The permissions-specific parsePermissionsBlock and permissionsMapNode helpers are removed — the general mechanism covers that case automatically.

Introduces an `annotated` wrapper type that threads trailing `# comments`
from HCL attributes through the `map[string]any` pipeline. `toYAMLNode`
unwraps it and attaches the comment as a `LineComment` on the YAML node,
so any attribute-level comment in HCL appears inline in the generated YAML.

Validators that type-assert map values use `unwrapAnnotatedMap` to strip
the wrapper before checking. The permissions-specific `parsePermissionsBlock`
and `permissionsMapNode` helpers are removed — the general mechanism
covers that case automatically.
@github-actions
Copy link
Copy Markdown

Go test coverage: 65.1% for commit e6bb071
⚠️ 1 of 19 packages have zero coverage.
  • github.com/yldio/cinzel/internal/test
View coverage for all packages
# Package Name                                     | Coverage
+ github.com/yldio/cinzel                          |    80.0%
+ github.com/yldio/cinzel/internal/ai              |    46.8%
+ github.com/yldio/cinzel/internal/cinzelerror     |    18.2%
+ github.com/yldio/cinzel/internal/command         |    39.5%
+ github.com/yldio/cinzel/internal/filereader      |    50.0%
+ github.com/yldio/cinzel/internal/filewriter      |    88.9%
+ github.com/yldio/cinzel/internal/fsutil          |    68.0%
+ github.com/yldio/cinzel/internal/hclparser       |    62.7%
+ github.com/yldio/cinzel/internal/maputil         |    93.3%
+ github.com/yldio/cinzel/internal/naming          |    93.1%
+ github.com/yldio/cinzel/internal/pin             |    54.8%
- github.com/yldio/cinzel/internal/test            |     0.0%
+ github.com/yldio/cinzel/internal/yamlwriter      |    88.9%
+ github.com/yldio/cinzel/provider/github          |    69.9%
+ github.com/yldio/cinzel/provider/github/action   |    82.1%
+ github.com/yldio/cinzel/provider/github/job      |    92.6%
+ github.com/yldio/cinzel/provider/github/step     |    69.3%
+ github.com/yldio/cinzel/provider/github/workflow |    85.6%
+ github.com/yldio/cinzel/provider/gitlab          |    63.5%

@jccguimaraes jccguimaraes merged commit 90ea5d5 into main Apr 10, 2026
5 checks passed
@jccguimaraes jccguimaraes deleted the feat/keep-permissions-comments branch April 10, 2026 17:04
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.

1 participant