Skip to main content

Feature Discovery Helper

Feature Discovery Helper - focused on feature directory discovery and numbering.

Overview

This helper handles: - Feature directory discovery and validation - Sequential feature numbering - Spec file management - Feature context extraction

Classes

FeatureDiscoveryHelper

Helper for feature discovery and management operations.

Methods

check_spec_id_exists
check_spec_id_exists(self, spec_id: str, specs_dir: Optional[pathlib.Path] = None) -> tuple[bool, typing.Optional[pathlib.Path]]

Check if a spec ID already exists.

Parameters:

  • spec_id (str, required) - Spec ID to check
  • specs_dir (Optional, optional) - Optional specs directory

Returns: tuple

extract_spec_context
extract_spec_context(self, spec_dir: pathlib.Path) -> Dict[str, Any]

Extract context information from spec directory.

Parameters:

  • spec_dir (Path, required) - Spec directory to analyze

Returns: Dict

find_feature_directory
find_feature_directory(self, branch_name: Optional[str] = None, specs_dir: Optional[pathlib.Path] = None) -> Optional[pathlib.Path]

Find feature directory that matches branch name.

Parameters:

  • branch_name (Optional, optional) - Branch name to find directory for. Uses current if None.
  • specs_dir (Optional, optional) - Optional specs directory. Defaults to project specs.

Returns: Optional

find_feature_directory_for_workflow
find_feature_directory_for_workflow(self, branch_name: Optional[str] = None) -> Optional[pathlib.Path]

Find feature directory accounting for different workflows.

Parameters:

  • branch_name (Optional, optional) - Branch name to find directory for

Returns: Optional

find_spec_by_id
find_spec_by_id(self, spec_id: str) -> Optional[pathlib.Path]

Find spec directory by ID.

Parameters:

  • spec_id (str, required) - Spec ID to find

Returns: Optional

get_next_feature_number
get_next_feature_number(self, specs_dir: Optional[pathlib.Path] = None) -> str

Get next sequential feature number.

Parameters:

  • specs_dir (Optional, optional) - Optional specs directory. Defaults to project specs.

Returns: str

list_available_specs
list_available_specs(self) -> List[Dict[str, str]]

List all available spec directories.

Returns: List