Skip to content

[Refactor] Split single-file monolith (promptpacker.go) into a standard Go package structure #2

@ImmaZoni

Description

@ImmaZoni

Description

Currently, the entire application—CLI parsing, Bubble Tea models, file system traversal, .gitignore parsing, formatting, and config loading—is housed in a single ~1,700-line promptpacker.go file. As we add more features (like output chunking and token counting), this file will become increasingly difficult to maintain.

Why it matters

A standard Go package layout makes the codebase easier to navigate for new contributors, separates concerns, and makes unit testing significantly easier.

Proposed Solution

Refactor the project into a standard Go project layout. For example:

  • cmd/promptpacker/main.go (Entry point & CLI flags setup)
  • internal/tui/ (Bubble Tea models, spinners, progress bars)
  • internal/scanner/ (File walking, worker pools, content formatting)
  • internal/ignore/ (Gitignore parsing and exclusion logic)
  • internal/config/ (Config file loading, parsing, and profile merging)

Tasks

  • Create internal/ and cmd/ directories.
  • Move TUI logic to internal/tui.
  • Move core scanning logic to internal/scanner.
  • Move config loading to internal/config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions