rdev/cmd/sdlc/cmd_state.go
jordan 56e3f83955 feat: add auth scopes, OpenAPI docs, SDLC guides, and code quality improvements
- Add auth.RequireScope() to all handler routes for proper authorization
- Add SDLC OpenAPI endpoint documentation (state, features, tasks, branches, merge, archive, orchestrator)
- Add SDLC documentation guides (getting-started, cli-reference, api-reference, command-catalog)
- Add artifact_test.go for SDLC artifact coverage
- Add CLAUDE.md rules: auth scopes requirement, error wrapping with %w
- Fix error wrapping to use %w instead of %v throughout codebase
- Improve CLI merge command with conflict detection and resolution
- Fix handler tests to include auth middleware for RequireScope
- Add cookbook tree runner scripts for automated testing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 13:55:50 -07:00

66 lines
1.4 KiB
Go

package main
import (
"fmt"
"github.com/orchard9/rdev/internal/sdlc"
"github.com/spf13/cobra"
)
var stateCmd = &cobra.Command{
Use: "state",
Short: "Show current SDLC state",
RunE: func(_ *cobra.Command, _ []string) error {
root := mustResolveRoot()
state, err := sdlc.LoadState(root)
if err != nil {
return err
}
if jsonOutput {
return printJSON(state)
}
fmt.Printf("SDLC State (v%d)\n", state.Version)
fmt.Printf(" Project: %s\n", state.Project.Name)
if state.Project.CurrentRoadmap != "" {
fmt.Printf(" Roadmap: %s\n", state.Project.CurrentRoadmap)
}
fmt.Println()
if len(state.ActiveWork.Features) > 0 {
fmt.Println("Active Features:")
for _, f := range state.ActiveWork.Features {
branch := ""
if f.Branch != "" {
branch = fmt.Sprintf(" (%s)", f.Branch)
}
fmt.Printf(" - %s [%s]%s\n", f.Slug, f.Phase, branch)
}
fmt.Println()
}
if len(state.Blocked) > 0 {
fmt.Println("Blocked Items:")
for _, b := range state.Blocked {
fmt.Printf(" - %s/%s: %s\n", b.Type, b.Slug, b.Reason)
}
fmt.Println()
}
if state.LastAction != "" {
fmt.Printf("Last Action: %s by %s\n", state.LastAction, state.LastActor)
}
if state.LastUpdated != nil {
fmt.Printf("Last Updated: %s\n", state.LastUpdated.Format("2006-01-02 15:04:05"))
}
return nil
},
}
func init() {
rootCmd.AddCommand(stateCmd)
}