Phase 1: XMD Init Command Implementation
Phase 1: XMD Init Command Implementation
Objective
Implement xmd init command that creates .xmd directory structure and xmd.yaml configuration file.
Tasks
1. Update CLI Interface
- Add
initcommand to main CLI parser - Handle
xmd initargument parsing - Create help text for init command
2. Configuration System
- Add libyaml dependency to CMakeLists.txt
- Create YAML configuration parser
- Define xmd.yaml structure
- Implement configuration reader
3. Init Command Logic
- Create .xmd directory if not exists
- Generate default xmd.yaml file
- Handle existing configuration files
- Provide user feedback
4. Project Configuration Support
- Modify existing commands to read xmd.yaml
- Support multiple project configurations
- Default project selection logic
- Error handling for missing configs
File Structure
src/
โโโ cli/
โ โโโ init/
โ โโโ init.c # Main init command
โโโ config/
โ โโโ read_config/
โ โ โโโ read_config.c # Read xmd.yaml
โ โโโ create_config/
โ โ โโโ create_config.c # Create default config
โ โโโ yaml_parser/
โ โโโ yaml_parser.c # YAML parsing wrapper
โโโ utils/
โ โโโ create_directory/
โ โ โโโ create_directory.c # Directory creation
โ โโโ file_exists/
โ โโโ file_exists.c # File existence check
Tests
- test/cli/test_init.c
- test/config/test_read_config.c
- test/config/test_create_config.c
- test/config/test_yaml_parser.c
Dependencies
- libyaml for YAML parsing
- Existing file system utilities
Acceptance Criteria
xmd initcreates .xmd directory- Default xmd.yaml is generated with proper structure
- Existing files are not overwritten without confirmation
xmdcommand reads configuration when available- Error messages are clear and helpful
- All functions follow one-function-per-file rule
- Complete test coverage