Skip to content

Commands Overview

Goca provides a comprehensive set of commands to generate Clean Architecture components and manage your project structure.

Command Categories

Project Initialization

  • goca init - Initialize a new Clean Architecture project

Complete Features

Layer-Specific Generation

Domain Layer

Application Layer

Infrastructure Layer

Adapter Layer

Configuration & Templates

Utilities

  • goca di - Generate dependency injection container
  • goca messages - Generate error messages and constants
  • goca mocks - Generate testify/mock mocks for all interfaces
  • goca doctor - Check project health and Clean Architecture structure
  • goca analyze - Deep self-analysis: architecture, security, quality, standards, tests, dependencies
  • goca ci - Generate CI/CD pipeline configuration (GitHub Actions)
  • goca mcp-server - Start MCP server for AI assistant integration (GitHub Copilot, Claude, Cursor)
  • goca upgrade - Upgrade project configuration to current Goca version
  • goca version - Display version information

Testing

Quick Reference

CommandPurposeAuto-Integration
goca initCreate new projectComplete setup
goca featureGenerate full featureAutomatic
goca integrateWire existing featuresAutomatic
goca entityCreate entities onlyManual
goca usecaseCreate use cases onlyManual
goca repositoryCreate repositories onlyManual
goca handlerCreate handlers onlyManual
goca middlewareGenerate HTTP middleware packageManual
goca diGenerate DI containerManual
goca interfacesGenerate interface contractsManual
goca messagesGenerate error message constantsManual
goca mocksGenerate testify/mock mocksManual
goca test-integrationGenerate integration test filesManual
goca configManage project configuration
goca templateManage custom templates
goca ciGenerate CI/CD pipelines
goca mcp-serverMCP server for AI assistants
goca doctorProject health checks
goca analyzeDeep project self-analysis
goca upgradeUpgrade config/metadata

Common Workflows

bash
# Initialize project
goca init myproject --module github.com/user/myproject

# Generate complete features
goca feature User --fields "name:string,email:string"
goca feature Product --fields "name:string,price:float64"

# Everything is integrated automatically!
go run cmd/server/main.go

Workflow 2: Layer-by-Layer

bash
# Generate entity
goca entity Order --fields "customer:string,total:float64"

# Generate use case
goca usecase OrderService --entity Order

# Generate repository
goca repository Order --database postgres

# Generate handler
goca handler Order --type http

# Wire everything together
goca integrate --all

Workflow 3: Add to Existing Project

bash
# Generate new feature
goca feature Payment --fields "amount:float64,method:string"

# Automatically integrated with existing features

Global Flags

All commands support these flags:

bash
--help, -h          Show help for command
--verbose, -v       Enable verbose output (includes debug details)
--quiet, -q         Suppress all output except errors and success messages
--dry-run           Show what would be generated without creating files
--no-color          Disable colored output
--no-interactive    Disable interactive prompts

Examples by Use Case

Building a REST API

bash
goca init ecommerce-api --module github.com/user/ecommerce
cd ecommerce-api

goca feature Product --fields "name:string,price:float64,stock:int"
goca feature Order --fields "customer:string,total:float64,status:string"
goca feature User --fields "name:string,email:string,role:string"

Building a Microservice

bash
goca init payment-service --module github.com/user/payment
cd payment-service

goca feature Payment --fields "amount:float64,currency:string,status:string"
goca handler Payment --type grpc
goca handler Payment --type http

Building a CLI Tool

bash
goca init data-processor --module github.com/user/processor
cd data-processor

goca feature DataProcessor --fields "input:string,output:string"
goca handler DataProcessor --type cli

Next Steps

Choose a command to learn more:

Essential Commands

Detailed Generation

Utilities

Released under the MIT License.