Path Defaults
Path and folder mapping defaults for SpecifyX template system
Overview
This unified module provides immutable developer defaults for: - Template folder mappings (source -> target) - Path pattern resolution using AI assistant configurations - Project structure defaults - Skip patterns for file processing Replacing complex hardcoded path resolution logic with maintainable configuration that dynamically uses AI assistant settings.
Classes
PathDefaults
Developer defaults for path resolution and folder mappings - packaged with SpecifyX.
Dataclass
This provides centralized, immutable configuration for path resolution and project structure defaults.
Methods
get_default_context_vars
get_default_context_vars(self, project_name: str = 'default') -> specify_cli.models.defaults.path_defaults.ProjectContextVars
Get default context variables for template rendering.
Parameters:
project_name(str, optional) - Name of the project - Default:default
Returns: ProjectContextVars
get_folder_mappings
get_folder_mappings(self, ai_assistant: Optional[str] = None, project_name: str = '') -> List[specify_cli.models.defaults.category_defaults.FolderMappingResult]
Get all folder mappings for the given AI assistant.
Parameters:
ai_assistant(Optional, optional) - Name of the AI assistant (defaults to PROJECT_DEFAULTS)project_name(str, optional) - Project name (optional)
Returns: List
get_project_structure_paths
get_project_structure_paths(self, ai_assistant: Optional[str] = None) -> List[str]
Get list of directories that should be created for project structure.
Parameters:
ai_assistant(Optional, optional) - Name of the AI assistant (defaults to PROJECT_DEFAULTS)
Returns: List
resolve_target_path
resolve_target_path(self, template_path: pathlib.Path, category: str, ai_assistant: Optional[str] = None) -> pathlib.Path
Resolve target path for template file using AI assistant configuration.
Parameters:
template_path(Path, required) - Path to the template filecategory(str, required) - Template category (commands, scripts, memory, runtime_templates)ai_assistant(Optional, optional) - Name of the AI assistant (defaults to PROJECT_DEFAULTS)
Returns: Path
should_be_executable
should_be_executable(self, file_path: pathlib.Path) -> bool
Check if a file should be made executable.
Parameters:
file_path(Path, required) - Path to check
Returns: bool
should_skip_file
should_skip_file(self, file_path: pathlib.Path) -> bool
Check if a file should be skipped during processing.
Parameters:
file_path(Path, required) - Path to check
Returns: bool
validate_pattern_variables
validate_pattern_variables(self, pattern: str, variables: Dict[str, str]) -> bool
Validate that all pattern variables are provided.
Parameters:
pattern(str, required) - Pattern string with\{variable\}placeholdersvariables(Dict, required) - Dictionary of available variables
Returns: bool
Constants
EXECUTABLE_PERMISSIONS(int) =493PYTHON_CACHE_DIR(str) =__pycache__PYTHON_CACHE_EXTENSION(str) =.pycPYTHON_EXTENSION(str) =.pyREGULAR_FILE_PERMISSIONS(int) =420TEMPLATE_EXTENSION(str) =.j2