Skip to content

[Backlog] Interactive Mode for Feature Generation #19

@sazardev

Description

@sazardev

Overview

Implement an interactive mode for feature generation that guides developers through the process with prompts, suggestions, and validation, improving the developer experience and reducing errors.

Background

While CLI flags are powerful, an interactive mode can help new users and provide a more guided experience for complex feature generation. This will make Goca more accessible while maintaining its flexibility.

Scope

In Scope

  • Interactive prompts for feature generation
  • Field type suggestions and validation
  • Database selection wizard
  • Protocol selection (HTTP, gRPC, GraphQL)
  • Configuration preview before generation
  • Smart defaults based on context
  • Input validation with helpful error messages
  • Confirmation before file writes

Out of Scope

  • Full GUI application
  • Web-based interface
  • Visual schema designer
  • Real-time code preview

Requirements

Functional Requirements

  • Prompt for entity name with validation
  • Interactive field definition
  • Database type selection menu
  • Handler type selection
  • Advanced options menu
  • Configuration preview
  • Confirmation before generation
  • Save configuration option

Non-Functional Requirements

  • Responsive terminal UI
  • Clear and helpful prompts
  • Keyboard navigation
  • Abort capability at any step
  • Compatible with CI/CD (detects TTY)

Technical Design

Interactive Flow

Welcome to Goca Interactive Mode
=================================

What would you like to generate?
  1. Complete Feature
  2. Entity Only
  3. Repository Only
> 1

Enter entity name (PascalCase): User

Add fields to User:
  Field 1 name: name
  Field 1 type: 
    1. string
    2. int
    3. float64
    4. bool
    5. time.Time
  > 1
  
  Field 2 name: email
  Field 2 type: string
  
  Add another field? (y/n): n

Select database:
  1. PostgreSQL
  2. MySQL
  3. MongoDB
  4. SQLite
> 1

Select handler type:
  1. HTTP (REST)
  2. gRPC
  3. GraphQL
  4. CLI
> 1

Configuration Preview:
=====================
Entity: User
Fields:
  - name: string
  - email: string
Database: postgres
Handler: http
Timestamps: yes
Soft Delete: yes

Files to be generated:
  - internal/domain/user.go
  - internal/repository/postgres_user_repository.go
  - internal/usecase/user_service.go
  - internal/handler/http/user_handler.go
  - internal/di/container.go (updated)

Proceed with generation? (y/n): y

Generating feature User...
✓ Generated internal/domain/user.go
✓ Generated internal/repository/postgres_user_repository.go
✓ Generated internal/usecase/user_service.go
✓ Generated internal/handler/http/user_handler.go
✓ Updated internal/di/container.go

Feature User generated successfully!

Implementation Plan

Phase 1: Core Interactive Mode

  • Implement terminal UI framework
  • Create interactive prompts
  • Add input validation

Phase 2: Advanced Features

  • Add configuration preview
  • Implement smart suggestions
  • Add save configuration option

Phase 3: Integration

  • Integrate with existing commands
  • Add --interactive flag
  • Create onboarding tutorial

CLI Usage

goca feature --interactive
goca init --interactive
goca --interactive  # General interactive mode

Acceptance Criteria

  • Interactive mode launches correctly
  • All prompts are clear and helpful
  • Input validation works
  • Configuration preview accurate
  • Generated code matches preview
  • Can abort at any step
  • Works in TTY environments only
  • Documentation includes interactive mode guide
  • Tutorial video created

Priority and Classification

Priority: High
Category: Developer Experience
Section: CLI Improvements
Release Target: Backlog (Post v2.0.0)
Estimated Effort: 3-4 weeks
Complexity: Medium
Dependencies: None

Related Issues

  • Improves onboarding experience
  • Reduces errors in feature generation
  • Complements project scaffolding wizard

Additional Notes

Interactive mode will significantly improve the first-time user experience and reduce the learning curve for Goca while maintaining the flexibility of flag-based commands for automation.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions