MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / RunStatus

Function RunStatus

internal/cmd/status.go:19–79  ·  view source on GitHub ↗

RunStatus prints progress for a PRD. Returns nil on success, error otherwise. Exit code should be 0 on success.

(opts StatusOptions)

Source from the content-addressed store, hash-verified

17// RunStatus prints progress for a PRD.
18// Returns nil on success, error otherwise. Exit code should be 0 on success.
19func RunStatus(opts StatusOptions) error {
20 // Set defaults
21 if opts.Name == "" {
22 opts.Name = "main"
23 }
24 if opts.BaseDir == "" {
25 cwd, err := os.Getwd()
26 if err != nil {
27 return fmt.Errorf("failed to get current directory: %w", err)
28 }
29 opts.BaseDir = cwd
30 }
31
32 // Build PRD path
33 prdPath := filepath.Join(opts.BaseDir, ".chief", "prds", opts.Name, "prd.md")
34
35 // Load PRD
36 p, err := prd.LoadPRD(prdPath)
37 if err != nil {
38 return fmt.Errorf("failed to load PRD %q: %w", opts.Name, err)
39 }
40
41 // Count completed stories
42 total := len(p.UserStories)
43 completed := 0
44 var incomplete []prd.UserStory
45 for _, story := range p.UserStories {
46 if story.Passes {
47 completed++
48 } else {
49 incomplete = append(incomplete, story)
50 }
51 }
52
53 // Print project name
54 fmt.Println(p.Project)
55
56 // Print progress summary
57 if total == 0 {
58 fmt.Println("No stories defined")
59 return nil
60 }
61
62 fmt.Printf("%d/%d stories complete\n", completed, total)
63
64 // Print incomplete stories
65 if len(incomplete) > 0 {
66 fmt.Println("\nIncomplete stories:")
67 for _, story := range incomplete {
68 status := ""
69 if story.InProgress {
70 status = " (in progress)"
71 }
72 fmt.Printf(" %s: %s%s\n", story.ID, story.Title, status)
73 }
74 } else {
75 fmt.Println("\nAll stories complete!")
76 }

Callers 6

runStatusFunction · 0.92
TestRunStatusAllCompleteFunction · 0.85
TestRunStatusEmptyPRDFunction · 0.85

Calls 1

LoadPRDFunction · 0.92

Tested by 5

TestRunStatusAllCompleteFunction · 0.68
TestRunStatusEmptyPRDFunction · 0.68