Standardized workflow for adding a new Go module to GopherPaw. Use when the user asks to add a new feature, create a new package, implement a new component, or build a new module in the internal/ directory.
internal/Copy this checklist and track progress:
Add Module Progress:
- [ ] Step 1: Analyze CoPaw reference
- [ ] Step 2: Update contract docs (Contract First!)
- [ ] Step 3: Define Go interfaces
- [ ] Step 4: Implement + write edge-case tests
- [ ] Step 5: Wire up in cmd/ or parent module
Read the corresponding Python module in copaw-source/src/copaw/:
Output: brief summary of what this module does and key design decisions.
Before writing any code, update the contract documents:
docs/architecture_spec.md: Add the new module to the architecture diagram, define its layer placement and dependency relationshipsdocs/api_spec.md: Add the Go interface definitions for this moduleAsk the user to review and approve the spec changes before proceeding.
Create the interface file in the correct package:
// internal/newmodule/newmodule.go
// Package newmodule provides [one-line description].
package newmodule
import "context"
// SomeInterface defines the contract for [purpose].
type SomeInterface interface {
Method(ctx context.Context, arg Type) (Result, error)
}
Rules:
context.Context for I/O operationsImplement the interface with a concrete struct. Write tests simultaneously.
Test requirements (per testing-tdd rule):
File layout:
internal/newmodule/
├── newmodule.go # Interface + types
├── impl.go # Implementation
├── impl_test.go # Tests
└── options.go # Functional options (if needed)
Connect the new module to the application:
internal/config/ if neededcmd/gopherpaw/main.go with dependency injectionAfter all steps are done:
go vet ./... and go test ./...CONTEXT.md if the module changes project status/progress