create

package
v0.3.6 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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:   "create <req-id> <feature-name>",
	Short: "Generate a new CANARY token template",
	Long: `Create a properly formatted CANARY token for a new requirement.

Example:
  canary create CBIN-CLI-105 "UserProfile" --aspect CLI --status IMPL

Outputs a ready-to-paste CANARY token comment.`,
	Args: cobra.MinimumNArgs(2),
	RunE: func(cmd *cobra.Command, args []string) error {
		reqID := args[0]
		feature := args[1]
		prompt, _ := cmd.Flags().GetString("prompt")
		if prompt != "" {
			if _, err := utils.LoadPrompt(prompt); err != nil {
				return err
			}
		}
		aspect, _ := cmd.Flags().GetString("aspect")
		status, _ := cmd.Flags().GetString("status")
		owner, _ := cmd.Flags().GetString("owner")
		test, _ := cmd.Flags().GetString("test")
		bench, _ := cmd.Flags().GetString("bench")

		if err := reqid.ValidateAspect(aspect); err != nil {
			return fmt.Errorf("invalid aspect: %w", err)
		}

		aspect = reqid.NormalizeAspect(aspect)

		token, err := buildCreateToken(reqID, feature, aspect, status, test, bench, owner)
		if err != nil {
			return err
		}

		fmt.Println(token)
		fmt.Println("\n// Paste this above your implementation:")
		fmt.Printf("// func %s() { ... }\n", feature)

		return nil
	},
}

CreateCmd generates a new CANARY token template

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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