status

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 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)
- Declared TESTED/BENCHED percentage (declared status, not verified evidence)
- 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
		}

		projectID := utils.ReadProjectID(cmd)

		db, err := utils.OpenIndexRO(cmd, dbPath)
		if err != nil {
			return err
		}
		defer func() { _ = db.Close() }()

		tokens, err := db.GetTokensByReqID(projectID, reqID)
		if err != nil {
			return utils.GuardContract(cmd, err)
		}

		if len(tokens) == 0 {

			if jsonOutput {
				fmt.Fprintf(os.Stderr, "No tokens found for %s\n", reqID)
			} else {
				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,TestCANARY_CBIN_CLI_001_CLI_StatusCmd_DeclaredWording; UPDATED=2026-08-31

Functions

This section is empty.

Types

type StatusStats

type StatusStats struct {
	Total   int
	Stub    int
	Impl    int
	Tested  int
	Benched int
	// DeclaredComplete counts tokens declaring STATUS=TESTED or
	// STATUS=BENCHED -- a claim, not proof. Renamed from "Completed"
	// (R-15): the old name and the summary text below implied verified
	// completion.
	DeclaredComplete int
}

StatusStats holds progress statistics.

These counts reflect DECLARED token STATUS only, not verified evidence: a token counted in DeclaredComplete may have no passing test or bench record at all (R-15). Do not read DeclaredComplete as "done" -- use evidence.Complete for that question.

Jump to

Keyboard shortcuts

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