Skip to main content

Module git

Module git 

Source
Expand description

Git branch-based task ID detection.

Resolves task IDs from three sources in priority order: explicit CLI arg, the CLICKUP_TASK_ID env var, then the current git branch name. Destructive commands (task delete, task link, etc.) opt out of branch resolution.

Structs§

ResolvedTask
A task ID resolved from some source.

Enums§

TaskSource

Functions§

current_branch
Return the current git branch name, or None if not inside a repo, on detached HEAD, or if git is unavailable. Never errors — git absence is treated the same as “not in a repo”.
extract_task_id
Extract a task ID from a branch name, or None if no pattern matches. CU- matches take precedence over custom IDs; first match wins within each.
parse_task_id
Normalize an explicit CLI arg. Strips CU- transparently; detects PREFIX-NUMBER as custom. Never fails — any string becomes a ResolvedTask with source Explicit.
require_task
Like resolve_task, but errors with a helpful hint when nothing resolves.
resolve_task
Resolve a task ID from the priority chain: explicit → env → branch. Returns None if nothing is found — callers decide whether that’s an error.