implement

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Overview

CANARY: REQ=CP-253; FEATURE="RequirementLookup"; ASPECT=API; STATUS=TESTED; UPDATED=2026-08-29

Index

Constants

This section is empty.

Variables

View Source
var ImplementCmd = &cobra.Command{
	Use:   "implement <query>",
	Short: "Generate implementation guidance for a requirement",
	Long: `Generate comprehensive implementation guidance for a requirement specification.

This command:
- Accepts requirement by ID (CBIN-XXX), name, or fuzzy search query
- Uses fuzzy matching with auto-selection for strong matches
- Generates complete implementation prompt including:
  - Specification details
  - Implementation plan
  - Constitutional principles
  - Implementation checklist
  - Progress tracking
  - Test-first guidance

Examples:
  canary implement CBIN-105              # Exact ID match
  canary implement "user auth"           # Fuzzy search
  canary implement UserAuthentication    # Feature name match
  canary implement --list                # List all unimplemented requirements`,
	Args: cobra.MaximumNArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {
		promptArg, _ := cmd.Flags().GetString("prompt-arg")
		if promptArg != "" {
			if _, err := utils.LoadPrompt(promptArg); err != nil {
				return err
			}
		}
		listFlag, _ := cmd.Flags().GetBool("list")
		promptFlag, _ := cmd.Flags().GetBool("prompt")

		if listFlag {
			return listUnimplemented()
		}

		if len(args) < 1 {
			return fmt.Errorf("requirement query is required (use --list to show all unimplemented)")
		}

		query := args[0]

		spec, err := findRequirement(query)
		if err != nil {
			return fmt.Errorf("find requirement: %w", err)
		}

		flags := &ImplementFlags{
			Prompt: promptFlag,
		}

		prompt, err := renderImplementPrompt(spec, flags)
		if err != nil {
			return fmt.Errorf("generate prompt: %w", err)
		}

		fmt.Println(prompt)

		return nil
	},
}

CANARY: REQ=CP-253; FEATURE="ImplementCmd"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_133_CLI_ExactMatch; OWNER=canary; DOC=user:docs/user/implement-command-guide.md; DOC_HASH=ed68fb1d97cf0562; UPDATED=2026-08-29

Functions

This section is empty.

Types

type ImplementFlags

type ImplementFlags struct {
	Prompt       bool
	ShowProgress bool
	ContextLines int
}

ImplementFlags holds command flags

type ProgressStats

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

ProgressStats tracks implementation progress

type RequirementSpec

type RequirementSpec struct {
	ReqID       string
	FeatureName string
	SpecPath    string
	SpecContent string
	PlanPath    string
	PlanContent string
	HasPlan     bool
}

RequirementSpec holds loaded specification data

Jump to

Keyboard shortcuts

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