1 KiB
1 KiB
Implementation Plan: Issue 258
Phase 1: Command Structure
- Create
cmd/core/cmd/test.go - Register
testcommand with Cobra - Add flags:
--all,--filter,--coverage
Phase 2: Change Detection
- Run
git diff --name-only HEADto get changed files - Filter for
.gofiles (exclude_test.go) - Map each file to its test file:
internal/foo/bar.go→internal/foo/bar_test.go- Skip if test file does not exist
Phase 3: Test Execution
- Build
go testcommand with detected test files - Pass through
--coverageflag as-cover - Pass through
--filteras-runpattern - Stream output to terminal
Phase 4: Edge Cases
- No changed files → inform user, optionally run all
- No matching test files → inform user
--allflag → skip detection, rungo test ./...
Files to Create/Modify
cmd/core/cmd/test.go(new)cmd/core/cmd/root.go(register command)
Testing
- Add
cmd/core/cmd/test_test.gowith unit tests - Manual testing with actual git changes