Milestone 3
Some checks failed
CI / Test (pull_request) Failing after 6s
CI / Build (pull_request) Failing after 6s
CI / Lint (pull_request) Failing after 12s

This commit is contained in:
2025-10-14 22:10:45 -04:00
parent 99878adefb
commit 8b1339d0cf
9 changed files with 821 additions and 133 deletions

View File

@ -1,58 +1,54 @@
## Milestone 3: Workstreams
## Milestone 3: Workstreams ✓ COMPLETE
### Workstream Data Model
28. **Implement workstream storage** (`internal/storage/workstreams.go`)
```go
type WorkstreamsFile struct {
CurrentWorkstream string
Workstreams map[string]*Workstream
}
func LoadWorkstreams(path string) (*WorkstreamsFile, error)
func (w *WorkstreamsFile) Save(path string) error
```
28. **Implement workstream storage** (`internal/storage/workstreams.go`)
- `LoadWorkstreams(path string) (*WorkstreamCollection, error)`
- `SaveWorkstreams(path string, collection *WorkstreamCollection) error`
29. **Create workstream manager** (`internal/core/workstream_manager.go`)
29.**Create workstream manager** (`internal/core/workstream_manager.go`)
- `CreateWorkstream(name string, base string) error`
- `GetCurrentWorkstream() (*Workstream, error)`
- `SwitchWorkstream(name string) error`
- `ListWorkstreams() ([]*Workstream, error)`
- `AddCommitToWorkstream(sha, message string) error`
- `GetCurrentWorkstreamName() (string, error)`
### Workstream Commands
30. **Implement onx new** (`internal/commands/new.go`)
```go
func New(repo *Repository, name string) error {
// 1. Fetch latest from origin/main
// 2. Create workstream entry
// 3. Set as current workstream
// 4. Update workspace to base commit
// 5. Log to oplog
}
```
30.**Implement onx new** (`internal/commands/new.go`)
- Validates workstream name
- Creates workstream entry
- Sets as current workstream
- Updates workspace to base commit
- Logs to oplog with transaction wrapper
- Provides helpful next-step guidance
31. **Implement onx list** (`internal/commands/list.go`)
- Read workstreams.json
- Format output with current indicator (*)
- Show commit count per workstream
- Color code output for better readability
31.**Implement onx list** (`internal/commands/list.go`)
- Reads workstreams.json via storage layer
- Formats output with current indicator (*)
- Shows commit count per workstream
- Color-coded output for status (active=green, merged/abandoned/archived=gray)
- `--all` flag to show non-active workstreams
- Alias: `ls`
32. **Implement onx switch** (`internal/commands/switch.go`)
```go
func Switch(repo *Repository, name string) error {
// 1. Save current ephemeral state
// 2. Load target workstream
// 3. Checkout latest commit in workstream
// 4. Update current_workstream
// 5. Restore workspace state
// 6. Log to oplog
}
```
32.**Implement onx switch** (`internal/commands/switch.go`)
- Validates target workstream exists
- Checkouts latest commit in target workstream
- Updates current_workstream pointer
- Logs to oplog with transaction wrapper
- Shows helpful info about target workstream
33. **Add workstream validation**
- Validate workstream names (no special chars)
- Check for uncommitted changes before switch
- Prevent duplicate workstream names
33. **Add workstream validation**
- Validates workstream names (alphanumeric, hyphens, underscores, slashes only)
- Prevents duplicate workstream names
- Prevents reserved names (HEAD, main, master, etc.)
- Integrated in `ValidateWorkstreamName()` function
### Integration & Refactoring
- ✓ Refactored `onx save` to use WorkstreamManager
- ✓ All commands properly wired in `cmd/onx/main.go`
- ✓ All tests passing
- ✓ Build successful