{% macro icon(name, label=None, cls="") -%} {%- endmacro %} {% macro ref(id) -%}#{{ "%04d"|format(id) }}{%- endmacro %} {% macro session_link(s, copy=True) -%} {{ s.title or s.claude_session_id[:8] }} {{ s.status_label }} {%- if copy %} {% endif %} {%- endmacro %} {% macro decision_status_badge(status) -%} {%- set tone = {"open": "warning", "answered": "info", "resolved": "success", "ready": "info", "in_progress": "info"}.get(status, "neutral") -%} {%- set label = {"open": "Open", "answered": "Answered", "resolved": "Resolved", "ready": "Ready", "in_progress": "In progress", "waiting": "Waiting"}.get(status, status|capitalize) -%} {{ label }} {%- endmacro %} {% macro kind_badge(kind) -%} {%- if kind == 'action' -%}{{ icon("zap") }}Action{%- endif -%} {%- endmacro %} {% macro linear_badge(row) -%} {%- if row.linear_identifier -%} {{ row.linear_identifier }}{{ icon("external") }} {%- elif row.linear_push_error -%} {{ icon("alert") }}Linear push failed {%- endif -%} {%- endmacro %} {% macro empty_state(icon_name, title, compact=False) -%}
{{ icon(icon_name) }}

{{ title }}

{{ caller() }}
{%- endmacro %} {% macro folder_select(folders, selected, field_id, label="Folder") -%} {%- endmacro %} {% macro stuck_badge(stuck) -%} {%- if stuck %}Stuck for {{ stuck.days }} day{{ "" if stuck.days == 1 else "s" }} · {{ stuck.reason }}{% endif -%} {%- endmacro %} {% macro due_buckets(work, href) -%} {%- if work.overdue or work.due_soon or work.stuck %}

{%- if work.overdue %}{{ work.overdue | length }} overdue{% endif %} {%- if work.due_soon %} {{ work.due_soon | length }} due soon{% endif %} {%- if work.stuck %} {{ work.stuck | length }} stuck{% endif %}

{%- endif %} {%- endmacro %} {% macro due_badge(due_on) -%} {%- set d = due_on | due -%} {%- if d %}{{ d.label }}{% endif -%} {%- endmacro %} {# Steps done (solid) against steps planned (faint) per day, and a warning once an active goal stalls. #} {% macro burnup(trend, w=160, h=36) -%} {%- if trend and trend.days | length > 1 -%} {%- set n = trend.days | length -%} {%- set top = [trend.total | max, 1] | max -%} {%- endif -%} {%- endmacro %} {% macro stall_warning(trend) -%} {%- if trend and trend.stalled_days -%}No progress for {{ trend.stalled_days }} days{%- endif -%} {%- endmacro %} {% macro goal_achieve(o, pr, next) -%} {%- set open_steps = pr.total - pr.done -%}
{%- endmacro %} {# A goal as one row: progress, the next step and whose it is, and Achieved. #} {% macro goal_card(o, next, show_project=False) -%} {%- set pr = o.progress -%} {%- set owner_labels = {"me": "You", "agent": "Agent", "external": "Waiting"} -%}
{% if show_project %}{{ o.project_name }}{% endif %} {{ o.title }} {{ linear_badge(o) }}{{ due_badge(o.due_on) }} {% if o.status == "paused" %}Paused{% endif %} {% if pr.ready_to_close %}Ready to close{% endif %} {{ stall_warning(o.trend) }} {{ pr.done }}/{{ pr.total }} {% if pr.next %}Next: {{ owner_labels[pr.next_owner] }} {{ pr.next.title }} {% elif not pr.total %}No steps yet {% else %}{% endif %} {{ goal_achieve(o, pr, next) }}
{%- endmacro %}