tofusoup 2025-06-06
Added HCL test, convert file, lint, and generate-random commands with enhanced Go generator
18 files · 1,703+ · 890-

New cty lint and generate-random commands

2 files changed
  • CTY_GENERATE_ENHANCEMENTS.md Design document for bi-directional testing workflow using generate and lint commands across Go and Python
  • go_cty_generator.go Added lint mode with ctyjson.UnmarshalType fallback, random value generation with seed support, and improved type parsing
  • Added cty lint command design for validating values against type definitions across implementations instantiate architectural
    1 file
    • CTY_GENERATE_ENHANCEMENTS.md
  • Implemented generateRandomCtyValue in Go for producing valid random instances of any cty type instantiate behavioral
    1 file
    • go_cty_generator.go
  • Added ctyjson.UnmarshalType as fallback parser when custom type string parser fails harden behavioral
    1 file
    • go_cty_generator.go

HCL test command with rich output

1 file changed
  • cli.py Added cty hcl test subcommand that parses Terraform files and displays structure as a rich tree; restructured command groups
  • Implemented cty hcl test using python-hcl2 parser with rich tree output showing HCL structure instantiate behavioral
    1 file
    • cli.py
  • Restructured CLI into cty convert, cty generate, and cty hcl command groups streamline architectural
    1 file
    • cli.py

Convert file command implementation

2 files changed
  • convert_logic.py Format conversion logic with HCL/JSON/Msgpack loaders and JSON/Msgpack dumpers
  • test_convert_commands.py Tests for convert file including format detection, round-trips, and HCL-output not-implemented error
  • Implemented file format conversion between HCL, JSON, and Msgpack via Python dict intermediate instantiate behavioral
    1 file
    • convert_logic.py

Go interaction layer enhancements

1 file changed
  • go_interaction.py Extended Go interaction to support lint mode and random generation flags
  • Added parameters for lint mode, random generation, and seed to the Go subprocess interface interface behavioral
    1 file
    • go_interaction.py

Terraform example fixtures

3 files changed
  • simple_for_convert.mpk Msgpack fixture for conversion testing
  • simple_for_hcl_view.tf HCL fixture for tree view testing
  • simple_resource_for_convert.tf Terraform resource for conversion testing
  • Added Terraform and Msgpack fixtures for new convert and HCL test commands qualify internal
    2 files
    • simple_for_convert.mpk
    • simple_for_hcl_view.tf