Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var PrioritizeCmd = &cobra.Command{ Use: "prioritize <REQ-ID> <feature> <priority>", Short: "Update priority of a CANARY token", Long: `Update the priority of a specific token (1=highest, 10=lowest). Priority affects ordering in list and search results.`, Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error { prompt, _ := cmd.Flags().GetString("prompt") if prompt != "" { if _, err := utils.LoadPrompt(prompt); err != nil { return err } } dbPath, _ := cmd.Flags().GetString("db") reqID := args[0] feature := args[1] priority, err := strconv.Atoi(args[2]) if err != nil { return fmt.Errorf("invalid priority: %s (must be 1-10)", args[2]) } if priority < 1 || priority > 10 { return fmt.Errorf("priority must be between 1 (highest) and 10 (lowest)") } projectID, err := utils.WriteProjectID(cmd, ".") if err != nil { return err } db, err := storage.OpenRW(dbPath) if err != nil { return fmt.Errorf("open database: %w", err) } defer func() { _ = db.Close() }() allTokens, err := db.GetTokensByReqID(projectID, reqID) if err != nil { return utils.GuardContract(cmd, err) } var matched []*storage.Token for _, t := range allTokens { if t.Feature == feature { matched = append(matched, t) } } if len(matched) == 0 { return fmt.Errorf("no token found for %s/%s", reqID, feature) } for _, t := range matched { if err := canaryscan.RewriteTokenFields(".", t.FilePath, t.LineNumber, map[string]string{"REQ": reqID}, map[string]string{"PRIORITY": strconv.Itoa(priority)}); err != nil { return fmt.Errorf("update source token: %w", err) } } if err := db.UpdatePriority(projectID, reqID, feature, priority); err != nil { return fmt.Errorf("update priority: %w", err) } fmt.Printf("✅ Updated priority for %s/%s to %d\n", reqID, feature, priority) return nil }, }
CANARY: REQ=ENG-4310; FEATURE="PrioritizeCmd"; ASPECT=CLI; STATUS=TESTED; OWNER=canary; TEST=TestAuditR07MutationsSurviveReindex; UPDATED=2026-08-31
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.