Skip to content

[FEATURE] Refactor project structure to follow Go conventions #33

@srishtea-22

Description

@srishtea-22

Feature Description

Refactor the project structure to follow standard Go project layout conventions, improving code organization and maintainability.

Problem It Solves

The current project structure doesn't follow standard Go project layout conventions, which can make the codebase harder to navigate for contributors and less idiomatic.

  • The src/ directory is non-standard in Go projects (Go convention uses cmd/ for main applications)
  • AI provider packages (chatgpt, claude, gemini, grok) are at the root level alongside internal utilities
  • Media assets (images, GIFs) are scattered in the root directory
  • There's a typo in the filename: promt.go should be prompt.go

Proposed Solution

Restructure the project following the standard Go project layout:

.
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── go.mod
├── go.sum
├── cmd/
│   └── <app-name>/
│       └── main.go
├── internal/
│   ├── chatgpt/
│   │   └── chatgpt.go
│   ├── claude/
│   │   └── claude.go
│   ├── gemini/
│   │   └── gemini.go
│   ├── grok/
│   │   └── grok.go
│   ├── display/
│   │   └── display.go
│   ├── git/
│   │   └── operations.go
│   ├── stats/
│   │   └── statistics.go
│   └── utils/
│       └── utils.go
├── pkg/
│   └── types/
│       ├── prompt.go
│       └── types.go
└── assets/
    ├── commit.gif
    └── image.png

Key changes:

  • src/ → cmd/ for application entry points
  • AI providers moved to internal/ (unless they should be in pkg/ if meant to be importable by external projects)
  • types/ moved to pkg/types/ (or internal/types/ depending on intended use)
  • Media files consolidated into assets/ directory
  • Fix typo: promt.go → prompt.go

Alternative Solutions

  • Keep AI providers at root level: Continue with current structure, only move src/ to cmd/ and create assets/.
  • Put AI providers in pkg/: If the intention is to make these packages importable by other projects as reusable AI client libraries, they should go in pkg/ instead of internal/.

Use Case

  • New contributors: Can immediately understand the project structure following familiar Go conventions
  • Maintainers: Easier to organize and locate code
  • Go community: Project appears more professional and approachable

Implementation Ideas

Migration steps:

  1. Create new directory structure (cmd/, internal/, pkg/, assets/)
  2. Move files to their new locations
  3. Update all import statements to reflect new paths
  4. Rename promt.go to prompt.go
  5. Update documentation and any build scripts (if required)
  6. Test to ensure everything still works

Open questions:

What should the binary name be in cmd/? (needs project name)
Should types/ be in pkg/ (exportable) or internal/ (internal-only)?
Should AI provider packages be in internal/ or pkg/? (depends on whether they're meant to be reusable libraries)

I'm happy to submit a PR under hacktoberfest implementing these changes once we agree on the structure details.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgoPull requests that update go codehacktoberfestEligible for Hacktoberfesthacktoberfest-acceptedApproved Hacktoberfest contributionhelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions