MCPcopy Create free account
hub / github.com/github/gh-aw / NewStatusCommand

Function NewStatusCommand

pkg/cli/status.go:9–50  ·  view source on GitHub ↗

NewStatusCommand creates the status command

()

Source from the content-addressed store, hash-verified

7
8// NewStatusCommand creates the status command
9func NewStatusCommand() *cobra.Command {
10 cmd := &cobra.Command{
11 Use: "status [pattern]",
12 Short: "Show status of all agentic workflows in the repository",
13 Long: `Show status of all agentic workflows in the repository.
14
15Displays a table with workflow name, AI engine, compilation status, enabled/disabled state,
16and time remaining until expiration (if stop-after is configured).
17
18The optional pattern argument filters workflows by name (case-insensitive substring match).
19It accepts workflow IDs (basename without .md) or full filenames.`,
20 Example: ` ` + string(constants.CLIExtensionPrefix) + ` status # Show all workflow status
21 ` + string(constants.CLIExtensionPrefix) + ` status ci- # Show workflows with 'ci-' in name
22 ` + string(constants.CLIExtensionPrefix) + ` status --json # Output in JSON format
23 ` + string(constants.CLIExtensionPrefix) + ` status --ref main # Show latest run status for main branch
24 ` + string(constants.CLIExtensionPrefix) + ` status --label automation # Show workflows with 'automation' label
25 ` + string(constants.CLIExtensionPrefix) + ` status --repo owner/other-repo # Check status in different repository`,
26 RunE: func(cmd *cobra.Command, args []string) error {
27 var pattern string
28 if len(args) > 0 {
29 pattern = args[0]
30 }
31 verbose, _ := cmd.Flags().GetBool("verbose")
32 jsonFlag, _ := cmd.Flags().GetBool("json")
33 ref, _ := cmd.Flags().GetString("ref")
34 labelFilter, _ := cmd.Flags().GetString("label")
35 repoOverride, _ := cmd.Flags().GetString("repo")
36 statusLog.Printf("Status command invoked: pattern=%q, json=%v, ref=%q, label=%q, repo=%q", pattern, jsonFlag, ref, labelFilter, repoOverride)
37 return StatusWorkflows(pattern, verbose, jsonFlag, ref, labelFilter, repoOverride)
38 },
39 }
40
41 addJSONFlag(cmd)
42 cmd.Flags().StringP("repo", "r", "", "Target repository ([HOST/]owner/repo format). Defaults to current repository")
43 cmd.Flags().String("ref", "", "Filter runs by branch or tag name (e.g., main, v1.0.0)")
44 cmd.Flags().String("label", "", "Filter workflows by label")
45
46 // Register completions for status command
47 cmd.ValidArgsFunction = CompleteWorkflowNames
48
49 return cmd
50}

Callers 5

initFunction · 0.92
TestShortFlagConsistencyFunction · 0.85

Calls 5

StatusWorkflowsFunction · 0.85
addJSONFlagFunction · 0.85
GetStringMethod · 0.65
PrintfMethod · 0.45
StringMethod · 0.45

Tested by 4

TestShortFlagConsistencyFunction · 0.68