Reviewing project documentation for feature template
- 1 We are now working on docs/plan-feature-template-structure.md – please get yourself up to speed with the project (docs/high-level.md). Tell me whether you have everything you need to execute the plan.
- 2 Implement the plan, task by task: 1. pick the next unfinished task 2. implement it 3. mark the task as DONE in the plan file 4. commit the changes, including the plan file. 5. Ask the user whether you should continue Only implement one task at a time.
- 3 Continue
- 4 Continue
- 5 Continue
- 6 Continue
- 7 Continue
- 8 Continue
- 9 Continue
- 10 Continue
Let me review the documents to understand the project and the task at hand.
From docs/high-level.md, I understand that:
- Petrock is a Go CLI tool for bootstrapping new Go projects and generating files
- It targets web applications using event sourcing
- It generates code templates and overrides files (requiring a clean git state)
- It has two main commands:
petrock new <project>andpetrock feature <name> - When generating a feature, it creates a package with various files (commands.go, queries.go, etc.)
- The application follows a specific architecture with command/query handlers, state management, etc.
From docs/plan-feature-template-structure.md, I see a detailed task breakdown for reorganizing the feature template structure:
- The plan is to move from a flat directory structure to a hierarchical one
- This involves creating directories (commands/, handlers/, queries/, etc.)
- Tasks T1-T10 outline the steps to migrate code to the new structure
- Each task has subtasks and a "Definition of Done"
- Overall, the goal is to improve maintainability by distributing functionality across smaller, more focused files
Let me check if I have enough information to execute this plan:
- I understand the current structure of Petrock feature templates (flat structure with files like commands.go, queries.go, etc.)
- I understand the target structure (hierarchical with directories for different responsibilities)
- I have detailed tasks with clear steps for each part of the migration
- I can see the implementation details and examples for the new structure
What I might need more information about:
- The location of the internal/skeleton/feature_template directory in the project
- Access to the current code to understand the specific content that needs to be migrated
- Details about dependencies between different parts of the code
Let me check if I can find this information using the tools available.
I need to check the location and content of the internal/skeleton/feature_template directory to understand what we're reorganizing. Let me explore the codebase first.
I have what I need to execute the plan. The internal/skeleton/feature_template directory exists with the current flat structure, and I have a detailed task breakdown for reorganizing it into the hierarchical structure.
Let's follow the plan step by step. The first task is T1: Create Directory Structure.
According to the plan, I need to:
- Create directories in internal/skeleton/feature_template/: commands/, handlers/, queries/, state/, ui/, routes/, workers/
- Add .keep files in each directory to ensure they're tracked by git
- Create subdirectory structure (ui/components/, ui/layouts/, ui/pages/)
Let's implement T1.1 first and then T1.2.
I'll start with T1: Create Directory Structure. This involves creating the base directories and subdirectories in the feature template.
mkdir -p internal/skeleton/feature_template/commands internal/skeleton/feature_template/handlers internal/skeleton/feature_template/queries internal/skeleton/feature_template/state internal/skeleton/feature_template/ui internal/skeleton/feature_template/routes internal/skeleton/feature_template/workers
mkdir -p internal/skeleton/feature_template/ui/components internal/skeleton/feature_template/ui/layouts internal/skeleton/feature_template/ui/pages
touch internal/skeleton/feature_template/commands/.keep internal/skeleton/feature_template/handlers/.keep internal/skeleton/feature_template/queries/.keep internal/skeleton/feature_template/state/.keep internal/skeleton/feature_template/ui/.keep internal/skeleton/feature_template/routes/.keep internal/skeleton/feature_template/workers/.keep internal/skeleton/feature_template/ui/components/.keep internal/skeleton/feature_template/ui/layouts/.keep internal/skeleton/feature_template/ui/pages/.keep