Skip to content

Conversation

@httpdss
Copy link
Owner

@httpdss httpdss commented Jul 27, 2025

🎯 Overview

This PR introduces automatic file protocol handling and improves the development container configuration for better developer experience.

✨ What's Changed

πŸ”§ File Protocol Enhancement

  • Automatic file:// prepending - YAML files without protocol automatically get file:// prefix
  • Simplified usage - Users can now specify YAML files directly without remembering protocol syntax
  • Backward compatibility - Existing file:// prefixed paths continue to work unchanged

🐳 DevContainer Improvements

  • Streamlined Python setup - Commented out redundant Python feature (base image already includes Python)
  • OpenAI API integration - Added environment variable for AI-powered features
  • Better development experience - Optimized container configuration for faster startup

πŸ“– Usage Examples

Before (Manual Protocol)

# Users had to remember the file:// protocol
struct generate file://my-config.yaml ./output

After (Automatic Protocol)

# Protocol is automatically added for .yaml files
struct generate my-config.yaml ./output

# Still works with explicit protocol
struct generate file://my-config.yaml ./output

πŸ”§ Technical Implementation

File Protocol Logic

  • Checks if file ends with .yaml and doesn't start with file://
  • Automatically prepends file:// protocol when conditions are met
  • Maintains existing behavior for all other cases

DevContainer Optimizations

  • Removed redundant Python feature installation
  • Added OpenAI API key environment variable for AI integrations
  • Preserved all existing extensions and settings

βœ… Benefits

For End Users

  • Simplified commands - No need to remember file protocol syntax
  • Reduced errors - Automatic protocol handling prevents common mistakes
  • Consistent experience - Works the same way regardless of protocol specification

For Developers

  • Faster container startup - Removed redundant Python installation
  • AI integration ready - OpenAI API key environment configured
  • Better DX - Streamlined development environment

πŸ§ͺ Testing

  • βœ… Verified automatic protocol prepending works correctly
  • βœ… Confirmed backward compatibility with explicit protocols
  • βœ… Tested devcontainer builds successfully with new configuration
  • βœ… Validated all existing functionality remains intact

πŸ“ Files Modified

  • struct_module/commands/generate.py - Added automatic file protocol handling
  • .devcontainer/devcontainer.json - Optimized container configuration

πŸ”— Compatibility

  • βœ… Backward Compatible - All existing commands continue to work
  • βœ… Protocol Agnostic - Supports both explicit and automatic protocol handling
  • βœ… Environment Ready - Enhanced development container setup

This enhancement improves user experience by removing the need to manually specify file protocols while maintaining full backward compatibility and improving the development environment.

@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 66.04%. Comparing base (0b53db6) to head (d7a37d0).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
- Coverage   66.47%   66.04%   -0.43%     
==========================================
  Files          22       22              
  Lines        1238     1240       +2     
  Branches      174      175       +1     
==========================================
- Hits          823      819       -4     
- Misses        376      384       +8     
+ Partials       39       37       -2     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… files

- Add notes explaining file:// protocol is automatically added for .yaml files
- Update all command examples to use simplified syntax
- Maintain backward compatibility information
- Cover usage, configuration, mappings, quickstart, file-handling, and development docs
@httpdss httpdss merged commit da51d5c into main Jul 27, 2025
3 checks passed
@httpdss httpdss deleted the patch-file-protocol branch July 27, 2025 16:18
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.

3 participants