status

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatusCmd = &cobra.Command{
	Use:   "status <REQ-ID>",
	Short: "Show implementation progress for a requirement",
	Long: `Status displays implementation progress summary for a requirement.

Shows:
- Total token count
- Breakdown by status (STUB, IMPL, TESTED, BENCHED)
- Completion percentage
- List of incomplete work

Examples:
  canary status CBIN-133
  canary status CBIN-133 --no-color`,
	Args: cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		prompt, _ := cmd.Flags().GetString("prompt")
		if prompt != "" {
			if _, err := utils.LoadPrompt(prompt); err != nil {
				return err
			}
		}
		reqID := args[0]
		noColor, _ := cmd.Flags().GetBool("no-color")
		dbPath, _ := cmd.Flags().GetString("db")
		jsonOutput, _ := cmd.Flags().GetBool("json")

		if noColor {
			color.NoColor = true
		}

		db, err := storage.Open(dbPath)
		if err != nil {
			fmt.Fprintf(os.Stderr, "⚠️  Database not found\n")
			fmt.Fprintf(os.Stderr, "   Suggestion: Run 'canary index' to build database\n\n")
			return fmt.Errorf("open database: %w", err)
		}
		defer func() { _ = db.Close() }()

		tokens, err := db.GetTokensByReqID(reqID)
		if err != nil {
			return fmt.Errorf("query tokens: %w", err)
		}

		if len(tokens) == 0 {
			fmt.Printf("No tokens found for %s\n", reqID)
			return fmt.Errorf("requirement not found")
		}

		stats := calculateStats(tokens)

		if jsonOutput {
			enc := json.NewEncoder(os.Stdout)
			return enc.Encode(buildStatusJSON(reqID, stats, tokens))
		}

		displayStatusSummary(reqID, stats, tokens)

		return nil
	},
}

CANARY: REQ=CBIN-CLI-001; FEATURE="StatusCmd"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_CLI_001_CLI_StatusCmd; UPDATED=2025-10-16

Functions

This section is empty.

Types

type StatusStats

type StatusStats struct {
	Total     int
	Stub      int
	Impl      int
	Tested    int
	Benched   int
	Completed int
}

StatusStats holds progress statistics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL