utils

shai_tix.utils.build_folder_name(type: Literal['story', 'task'], date: str, id: int, sanitized_title: str) str[source]

Build a folder name for a story or task.

Constructs a folder name in the format: {type}-{date}-{id}-{sanitized_title}

Parameters:
  • type – Entity type (“story” or “task”)

  • date – Creation date in YYYY-MM-DD format

  • id – Global ID (will be zero-padded)

  • sanitized_title – Pre-sanitized title string

Returns:

Folder name string

class shai_tix.utils.Ticket(type: str, id: int, title: str, date: str)[source]
classmethod from_folder(folder: Path) Ticket | None[source]

Parse a folder path to extract ticket information.

Parses the folder name according to the pattern: {type}-{date}-{id}-{title} where type is “story” or “task”. The encoded title is decoded back to the original title with spaces.

Parameters:

folder – Path object representing the folder (only name is checked, no filesystem validation is performed)

Returns:

Ticket instance if the folder name matches the expected pattern, None otherwise

shai_tix.utils.safe_write(path: Path, content: str)[source]

Safely write content to a file, creating parent directories if needed.