rdev/cmd/sdlc/cmd_init.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

54 lines
1.1 KiB
Go

package main
import (
"fmt"
"path/filepath"
"github.com/orchard9/rdev/internal/sdlc"
"github.com/spf13/cobra"
)
var initProjectName string
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize .sdlc/ directory structure",
RunE: func(_ *cobra.Command, _ []string) error {
root := mustResolveRoot()
name := initProjectName
if name == "" {
name = filepath.Base(root)
}
if err := sdlc.Init(root, name); err != nil {
return err
}
if jsonOutput {
return printJSON(map[string]string{
"status": "initialized",
"root": root,
"project": name,
})
}
fmt.Println("Initialized .sdlc/ structure")
fmt.Printf(" Root: %s\n", root)
fmt.Printf(" Project: %s\n", name)
fmt.Println()
fmt.Println("Created directories:")
for _, dir := range sdlc.SubDirs() {
fmt.Printf(" .sdlc/%s/\n", dir)
}
fmt.Println()
fmt.Println("Next: sdlc feature create <slug> --title \"Feature Name\"")
return nil
},
}
func init() {
initCmd.Flags().StringVar(&initProjectName, "name", "", "project name (default: directory name)")
rootCmd.AddCommand(initCmd)
}