Skip to content

Initial release - Terminal UI for Spring Boot project generation#1

Merged
punixcorn merged 6 commits intomainfrom
dev
Feb 1, 2026
Merged

Initial release - Terminal UI for Spring Boot project generation#1
punixcorn merged 6 commits intomainfrom
dev

Conversation

@punixcorn
Copy link
Owner

Implemented Features - spring-tui

Core Application Features

1. Terminal User Interface (TUI)

  • Interactive Configuration Panel

    • Real-time project configuration with visual feedback
    • Dual-pane layout separating configuration from dependencies
    • Keyboard-driven navigation (Tab, Arrow keys, Enter)
    • Spring-themed color scheme with accent highlighting for active fields
    • Focused field indicators with color transitions
    • Radio button UI for single-select options (Project Type, Language, Boot Version, Packaging, Java Version, Config Format)
    • Text input fields with inline editing and cursor visualization
    • Auto-generated package name based on groupId and artifactId
  • Project Metadata Configuration

    • Group ID (editable text field)
    • Artifact ID (editable text field)
    • Project Name (editable text field)
    • Description (editable text field)
    • Package Name (editable text field with auto-generation)
    • Version (default: 0.0.1-SNAPSHOT)
  • Build & Runtime Options

    • Project Type selection (Maven Project, Gradle Project, etc.)
    • Programming Language selection (Java, Kotlin, Groovy)
    • Spring Boot Version selection from available releases
    • Packaging type (JAR/WAR)
    • Java Version selection (17, 21, 25)
    • Configuration File Format selection (Properties/YAML) - newly added

2. Dependency Management

  • Searchable Dependency Panel

    • Real-time search filtering as you type
    • Visual checkmarks (✓) for selected dependencies
    • Highlight indicator for current selection
    • Browse 100+ Spring Boot Starter dependencies
    • Multi-select capability with visual feedback
    • Search placeholder text with instructions
    • Alphabetically sorted dependency list
  • Dependency Selection

    • Toggle dependencies on/off with Enter key
    • Search box with filtered results
    • Maintains selection state across searches
    • Dependencies automatically added to project configuration

3. Modal Popup System

  • Selection Popup

    • Displays available options for the current field
    • Scrollable list with keyboard navigation
    • Visual highlight for current selection
    • Activated on Enter for dropdown fields
    • Closed with Esc or selection
  • Export Configuration Popup

    • Format selection (YAML, JSON, TOML)
    • Filename input with editable text field
    • Tab navigation between filename and format
    • Visual focus indicators
    • Preview of export path
    • Confirmation with Enter, cancellation with Esc
  • Configuration Menu Popup

    • Extract Project toggle (auto-extract ZIP after download)
    • Export configuration option
    • Generate project option
    • Keyboard shortcuts (1, 2, 3 for quick access)
    • Accessed via Shift+C hotkey
  • Message Popup System (Success/Error)

    • Centered modal display with distinct styling
    • Success state (green accent, checkmark icon)
    • Error state (red accent, error icon)
    • Multi-line message support
    • Detailed error information display
    • Dismissible with any key press
    • Replaces footer status messages for better visibility

4. Footer & Status Display

  • Redesigned Footer Layout

    • "Keybindings" label (centered, dimmed)
    • Centered status message display
    • Generate button with visual selection state
    • Export button with visual selection state
    • Action buttons with Enter prompt when selected
    • Color-coded button states (active/inactive)
  • Status Messages

    • Keyboard shortcut hints
    • Current action feedback
    • Navigation instructions

5. Project Generation

  • Direct Generation from TUI

    • One-click generation with Generate button
    • Loading spinner with animation during API calls
    • Success popup notification
    • Error popup with detailed error messages
    • Automatic ZIP download to current directory
    • Optional auto-extraction of project files
  • Background Process Handling

    • Non-blocking UI during generation
    • Async/await for API calls
    • Clean progress indicators

6. Configuration Export

  • Multi-Format Support

    • YAML export (human-readable, widely used)
    • JSON export (machine-friendly, universal)
    • TOML export (minimal syntax, clear structure)
  • Export Process

    • Accessible via Shift+C menu or Export button
    • Custom filename support
    • Automatic file extension appending
    • Current configuration snapshot
    • Includes all metadata and dependencies
    • Success/error feedback via popup

Command-Line Interface (CLI)

1. Argument Parsing

  • File Input Parameter (--file <path>)

    • Accepts YAML, JSON, or TOML configuration files
    • Validates file existence
    • Automatic format detection by extension
  • Extract Flag (--extract)

    • Conditional logic: only matters when --file is provided
    • Automatically extracts ZIP after generation
    • Creates project directory in current location
  • CLI Documentation

    • Rich help text with clap framework
    • Version information display
    • Author information
    • About description
    • Usage examples in help output

2. Headless Project Generation

  • Non-Interactive Mode

    • Generate projects from config files without TUI
    • Animated spinner during generation
    • Clear success/error messages with icons (✓/✗)
    • Exit code handling for CI/CD integration
  • Output Handling

    • Terminal color support (green for success, red for errors)
    • Spinner animation with multiple frames
    • Line clearing for clean output
    • Detailed error reporting

Configuration File Support

1. Multi-Format Parsing

  • YAML Support

    • serde_yaml integration
    • Nested structure support
    • Comments preserved (where possible)
  • JSON Support

    • serde_json integration
    • Compact and pretty formatting
    • Validation and error messages
  • TOML Support

    • toml crate integration
    • Section-based organization
    • Type-safe parsing

2. Configuration Schema

projectType: maven-project
language: java/kotlin/groovy
platformVersion: ""
packaging: jar/war
configurationFileFormat: properties/yaml
javaVersion: 17/21/25
groupId: com.example
artifactId: demo
name: demo
description: Demo project for Spring Boot
packageName: com.example.demo
dependencies: web,security,data-jpa
bootVersion: 3.2.0
version: 0.0.1-SNAPSHOT

3. Example Configurations

  • rake-service-config.yaml - Maven + Kotlin with web and security
  • rake-service-config.json - Same config in JSON format
  • security-config.toml - Gradle + Java security project

API Integration

1. Spring Initializr API Client

  • Capabilities Endpoint

    • Fetch available project types
    • Retrieve supported languages
    • Get Spring Boot versions
    • List Java versions
    • Obtain packaging options
    • Fetch dependency groups
  • Dependencies Endpoint

    • Retrieve full dependency catalog
    • Parse dependency metadata
    • Cache dependency information
  • Generation Endpoint

    • POST request with full configuration
    • Binary ZIP file download
    • Error handling for invalid configurations
    • Retry logic for network issues

2. HTTP Client (reqwest)

  • Async Operations

    • Non-blocking API calls
    • Tokio runtime integration
    • Concurrent requests support
  • Error Handling

    • Network timeout handling
    • HTTP status code validation
    • Detailed error messages
    • User-friendly error reporting

Testing Infrastructure

1. Unit Tests

  • CLI Parsing Tests (tests/cli.rs)
    • Default CliResult validation
    • Args derive parser functionality
    • No file returns None logic
    • File-only parsing
    • File with extract flag
    • Extract flag conditional behavior
    • Multiple file format support
    • Edge case handling

2. Integration Tests

  • Example File Generation Tests
    • Validates all three example configurations
    • Verifies ZIP file creation
    • Checks artifact naming conventions
    • Automatic cleanup after tests
    • Real API integration testing

3. CI/CD Pipeline

  • GitHub Actions Workflow (.github/workflows/test.yml)
    • Multi-platform testing (Ubuntu, macOS, Windows)
    • Rust stable toolchain
    • Code formatting checks (rustfmt)
    • Linting with clippy
    • Cargo build verification
    • Unit test execution
    • Integration test execution
    • Dependency caching for faster builds
    • Separate compilation check job

Code Quality & Architecture

1. Module Organization

  • api/ - Spring Initializr API client

    • mod.rs - API interface definitions
    • util.rs - Helper functions
  • cli/ - Command-line interface

    • mod.rs - Argument parsing and CLI logic
  • config/ - Configuration management

    • config_parser.rs - Multi-format config parsing
    • global_config.rs - Global settings (future use)
    • util.rs - Configuration utilities
  • generator/ - Project generation logic

    • mod.rs - Generation orchestration
  • tui/ - Terminal user interface

    • mod.rs - Complete TUI implementation (1000+ lines)
  • types/ - Type definitions

    • api.rs - API response types
    • config.rs - Configuration types
    • generic.rs - Shared types

2. Error Handling

  • Custom Error Types
    • thiserror for error definitions
    • anyhow for error propagation
    • Context-aware error messages
    • User-friendly error formatting

3. State Management

  • App State Structure
    • Capabilities caching
    • Dependency catalog
    • Current configuration
    • UI state (current field, active pane, popups)
    • Selection states (ListState)
    • Input buffer management

Documentation

1. README.md

  • Comprehensive Documentation

    • Project overview with badges
    • Features list
    • Installation instructions
    • Usage examples
    • TUI controls table
    • Roadmap
    • Contributing guidelines
    • License information
    • Acknowledgments
  • Markdown Fixes

    • Fixed image references
    • Corrected LICENSE link
    • Fixed clone URL
    • Fixed indentation rendering issues

2. Release Notes

  • RELEASE_NOTES.md
    • Detailed feature descriptions
    • Keyboard shortcuts reference
    • Installation guide
    • Example workflows
    • Technical stack overview
    • Platform binary information
    • Changelog format

3. Example Files

  • Three Complete Examples
    • Different project types
    • Different languages
    • Different configurations
    • Real-world scenarios
    • Tested and validated

User Experience Enhancements

1. Visual Improvements

  • Color Theming

    • Dark background (RGB 30, 33, 39)
    • Spring Green accent (RGB 109, 179, 63)
    • Muted gray for inactive elements
    • White text for readability
    • Color-coded states (active, selected, error, success)
  • Layout Design

    • 60/40 split between config and dependencies
    • Proper spacing and padding
    • Border styling with color accents
    • Centered modal popups
    • Responsive layout adaptation

2. Keyboard Navigation

  • Comprehensive Shortcuts
    • Tab: Switch panes
    • Up/Down: Navigate items
    • Left/Right: Navigate dependencies
    • Enter: Select/Edit
    • Esc: Cancel/Close
    • Shift+C: Configuration menu
    • Backspace: Delete characters in input
    • Character keys: Type in input fields

3. Feedback Systems

  • Visual Feedback

    • Focus indicators
    • Selection highlighting
    • Input cursors
    • Progress animations
    • Success/error popups
  • Status Messages

    • Operation feedback
    • Error explanations
    • Help hints
    • Action confirmations

Cross-Platform Support

1. Platform Compatibility

  • Linux Support

    • Tested on Ubuntu
    • Terminal compatibility
    • Path handling
  • macOS Support

    • Intel and Apple Silicon
    • Terminal.app compatibility
    • iTerm2 compatibility
  • Windows Support

    • Windows Terminal compatibility
    • PowerShell support
    • Path normalization

2. Terminal Features

  • UTF-8 Support

    • Unicode characters
    • Box drawing characters
    • Emoji support (where available)
    • Fallback to ASCII when needed
  • Color Support

    • ANSI color codes
    • RGB color support
    • Graceful degradation

Build & Distribution

1. Cargo Configuration

  • Dependencies

    • Core: tokio, reqwest, serde
    • TUI: ratatui, crossterm (optional feature)
    • CLI: clap with derive feature
    • Formats: serde_json, serde_yaml, toml
    • Utilities: anyhow, thiserror, zip, dirs
  • Features

    • Default: TUI enabled
    • Modular TUI feature for headless builds

2. Build Targets

  • Release Builds

    • Optimized binaries
    • Stripped symbols
    • Static linking where possible
  • Development Builds

    • Debug symbols
    • Fast compilation
    • Helpful error messages

Summary Statistics

  • Total Lines of Code: ~2,500+ lines (excluding tests and deps)
  • Test Coverage: 10+ unit tests, 3 integration tests
  • Configuration Formats: 3 (YAML, JSON, TOML)
  • TUI Components: 7 major sections (header, config panel, metadata, dependencies, footer, popups)
  • CLI Arguments: 2 main parameters with conditional logic
  • API Endpoints: 3 (capabilities, dependencies, generation)
  • Keyboard Shortcuts: 10+ bindings
  • Example Configs: 3 complete examples
  • Supported Platforms: 3 (Linux, macOS, Windows)

…cies

- Added Cargo.toml with dependencies for anyhow, thiserror, clap, tokio, reqwest, ratatui, crossterm, serde, serde_json, zip, dirs, and serde_yaml.
- Created a Makefile to run the project using `cargo run`.
- Implemented API module with functions to fetch dependencies and capabilities from Spring Initializr.
- Added utility functions for API headers and base URL.
- Developed CLI module for argument parsing and configuration handling.
- Introduced configuration parsing and global configuration management.
- Created a generator module for constructing download URLs and handling project generation.
- Implemented a TUI (Text User Interface) for user interaction and project configuration.
- Defined data structures for API responses and configuration management.
… management

- Introduced a new `config.yaml` file for project configuration.
- Updated `generate_project` function to include project configuration file generation in YAML, JSON, and TOML formats.
- Enhanced TUI to manage dependencies with a dedicated pane, allowing users to search and select dependencies.
- Refactored rendering functions for improved layout and usability.
- Added functionality to toggle between configuration and dependency panes.
- Improved user feedback and status messages during project generation.

feat: Add new configuration formats and enhance CLI functionality
- Introduced new configuration files in JSON, YAML, and TOML formats for project generation.
- Removed the old YAML configuration file and added new example configurations for rake and security services.
- Updated the CLI to support configuration file input and extraction options.
- Enhanced error handling in API responses for better debugging.
- Added a spinner for project generation feedback in the CLI.
- Implemented a new export feature for configuration files with options for YAML, JSON, and TOML formats.
- Refactored project generation logic to support extraction of downloaded ZIP files.
- Added unit and integration tests for CLI argument parsing and project generation.

changes for 0.0.1 release:
 Update CI workflow, enhance makefile for multi-target builds, and refine .gitignore
@punixcorn punixcorn merged commit c026a54 into main Feb 1, 2026
4 checks passed
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