Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@yoichiro
Copy link
Collaborator

@yoichiro yoichiro commented Jul 3, 2025

Summary

• Add comprehensive file generation wizard for QMK keyboard.json and keymap.c files
• Implement keyboard.json template generation with matrix calculation and MCU configuration
• Add keymap.c template fetching from QMK GitHub repository
• Create MCU constants and bootloader mapping for automatic configuration
• Add comprehensive test coverage with mocking and async patterns

Key Features

  • Keyboard.json Generation: Automatically generates keyboard.json files with proper matrix configuration, USB VID/PID formatting, and MCU-specific settings
  • Keymap.c Generation: Fetches keymap.c templates directly from QMK's official layouts directory
  • MCU Support: Extensive support for both development boards and integrated MCUs with automatic bootloader selection
  • Layout Support: Support for 65+ QMK community layouts including ortholinear, split, and standard keyboard layouts
  • Template System: Modular template system for easy extension and maintenance

Technical Improvements

  • Async Architecture: Full async/await implementation for GitHub API integration
  • Type Safety: Comprehensive TypeScript typing for all file generation configurations
  • Error Handling: Robust error handling for network requests and template processing
  • Test Coverage: Extensive unit and integration tests with proper mocking
  • Code Organization: Clean separation of concerns with dedicated constants and template files

Files Changed

  • Core Logic: FileGenerator service with async template processing
  • Templates: KeyboardJsonTemplate and KeymapCTemplate for file generation
  • Constants: MCU definitions and layout constants
  • UI: Enhanced file generation dialog with layout selection
  • Tests: Comprehensive test suite with mocking and async patterns

Test Plan

  • Unit tests for all template generation logic
  • Integration tests for complete file generation flow
  • Mock testing for GitHub API integration
  • Error handling tests for network failures
  • Type checking and linting validation

🤖 Generated with Claude Code

yoichiro and others added 15 commits July 2, 2025 11:53
Add new file generation feature to Workbench that allows users to generate
keyboard.json and keymap.c files for QMK Firmware through a guided wizard interface.

Changes:
- Add FileGenerationDialog component with comprehensive form fields
- Add "File Generation" button to Workbench header with AutoFixHigh icon
- Support for MCU type selection (development board vs integrated)
- Dynamic MCU selection based on type (18 dev boards, 44 integrated MCUs)
- Form fields for manufacturer, maintainer, keyboard name, vendor/product IDs
- Japanese localization for all new UI elements
- Small-sized UI components for compact dialog layout

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add FileGenerationDialog with comprehensive form validation
  - Manufacturer/maintainer name validation (single-byte, 256 chars max)
  - Keyboard name validation (filename-safe characters)
  - MCU type selection (development board vs integrated)
  - Vendor/Product ID validation (4-digit hex)
  - Dynamic MCU selection based on type
- Add file existence checking with overwrite confirmation
- Implement service layer architecture for file generation
  - FileGenerator service with IResult return types
  - KeyboardJsonTemplate and KeymapCTemplate placeholders
  - Type-safe FileGenerationTypes with IBuildableFirmwareFileType
- Add Japanese localization for all validation messages
- Integrate Firebase Auth for auto-populating user information
- Add form reset functionality when dialog opens

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive KeyboardJsonTemplate with layout-based generation
- Implement KeymapCTemplate with default keycode mapping
- Extend FileGenerationTypes with layout interfaces and MCUType
- Support both development board and integrated MCU configurations
- Generate matrix pins and layout definitions automatically

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Define AVAILABLE_LAYOUTS with various keyboard layouts
- Include ortho, numpad, traditional layouts with specifications
- Add DEFAULT_LAYOUT and getLayoutOption utility function
- Support layout-specific key counts and dimensions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add keyboard layout selection dropdown to dialog
- Improve MCU type handling with proper type definitions
- Add Japanese translation for "Keyboard Layout"
- Integrate layout constants for dynamic layout options
- Refactor MCU type display names for better UX

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add FileGenerator unit and integration tests
- Implement KeyboardJsonTemplate tests with various layouts
- Add KeymapCTemplate tests for keycode generation
- Test error handling and edge cases
- Cover MCU type variations and layout options

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Update test expectations to match the [y,x] matrix coordinate order used in the implementation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…fetching

- Make generateKeyboardJson, generateKeymapC, and generateFiles async
- Update workbench action to handle async file generation
- Add proper typing for file mapping

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add McuConstants.ts with development board and integrated MCU lists
- Add MCU to bootloader mapping for automatic bootloader selection
- Add template_keyboard_json.json as base template for file generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…rate file

- Convert AVAILABLE_LAYOUTS from complex objects to simple string array
- Extract MCU lists from FileGenerationDialog to McuConstants.ts
- Update layout selection UI to use simplified layout names
- Change default layout to split_3x6_3

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add proper mocking for KeyboardJsonTemplate and KeymapCTemplate
- Convert all test methods to async to match implementation
- Update integration tests with correct bootloader expectations
- Fix type annotations for file filtering
- Remove outdated test expectations for removed content

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace complex keycode generation logic with direct GitHub fetch
- Fetch keymap.c templates from QMK layouts/default directory
- Simplify template to return content as-is from GitHub repository
- Update tests to use mocking and async patterns
- Remove layout-specific keycode generation logic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add --run flag examples for single-run test execution
- Make layout field required in IFileGenerationConfig
- Update test command documentation for better developer experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@yoichiro yoichiro merged commit ba7ea44 into main Jul 3, 2025
1 check passed
@yoichiro yoichiro deleted the feature/add-file-generation-wizard branch July 3, 2025 07:40
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