Skip to content

Conversation

@holmboe
Copy link
Contributor

@holmboe holmboe commented Jan 10, 2026

Summary

  • Add --ascii and --hyperlink CLI options for terminal compatibility
  • Add clickable hyperlinks for task links, assignees, boards, and columns
  • Add three output formats: rich (default), tree, and strict (guaranteed valid YAML)
  • Add assignee display to task output and history
  • Improve input validation with consistent error messages
  • Fix logging configuration for proper error output

New CLI Options

# Output format (rich is default with Rich library styling)
phabfive maniphest show T123 --format=rich    # YAML-like with colors
phabfive maniphest show T123 --format=tree    # Tree structure
phabfive maniphest show T123 --format=strict  # Valid YAML via ruamel.yaml

# Terminal compatibility
phabfive --ascii=auto T123      # Auto-detect Unicode support (default)
phabfive --ascii=always T123    # Force ASCII characters
phabfive --hyperlink=auto T123  # Auto-detect OSC 8 support (default)
phabfive --hyperlink=always T123 # Force hyperlinks

Visual Demo

image

The task link, workboard and column is clickable OSC8-style. The blue URL is a "regular" clickable URL, but it is nicely colored.

Test plan

  • Run uv run tox --skip-missing-interpreters - all tests pass
  • Test phabfive maniphest show T1 with all three formats
  • Test hyperlinks in supported terminals (iTerm, Ghostty, etc.)
  • Test ASCII fallback in basic terminals
  • Test invalid input handling (phabfive maniphest show '*')
  • Test piping to head/less (BrokenPipeError handling)
  • Validate strict format output with yq for all tasks

🤖 Generated with Claude Code

@holmboe holmboe requested a review from Timpan4 January 10, 2026 08:29
Copy link
Contributor

@Timpan4 Timpan4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

holmboe and others added 11 commits January 10, 2026 20:51
- Display current Assignee in regular task show output
- Display assignee change history when using --show-history flag
- Resolve user PHIDs to usernames for readable output

Changes:
- Add need_assignee parameter to _fetch_all_transactions()
- Handle reassign/core:owner transaction types
- Add _build_assignee_transitions() method
- Include Assignee field in Task section
- Include Assignee section in History output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add two global CLI options for terminal output formatting:

- --ascii=WHEN: Use ASCII characters instead of Unicode symbols
  (always/auto/never, default: auto)
- --hyperlink=WHEN: Enable OSC 8 terminal hyperlinks
  (always/auto/never, default: auto)

Auto-detection:
- ASCII: Enabled when stdout is not a TTY or locale is not UTF-8
- Hyperlink: Enabled for known supporting terminals (iTerm, WezTerm,
  Ghostty, Kitty, Alacritty, GNOME Terminal, Konsole, Windows Terminal)

Unicode to ASCII mappings: • → *, ↑ → ^, ↓ → v, → → >, ← → <

Hyperlinks are printed directly to stdout to bypass YAML escaping,
ensuring escape sequences render correctly in supporting terminals.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When --hyperlink is enabled, make additional fields clickable:
- Assignee: Links to user profile (/p/username/)
- Board names: Links to project tag page (/tag/project-slug/)

Updated format_link() to support show_url parameter - when False,
returns text instead of URL when hyperlinks are disabled. This
keeps YAML output valid (no colons in dict keys).

Also fixed _build_assignee_transitions() to use format_direction()
for ASCII mode support, and improved YAML output to properly quote
values containing special characters (colons, braces).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Column names in Boards section now link to Maniphest query filtered
by that column using URL format: /maniphest/?columns={column_phid}

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Show brief usage line when no search criteria provided
- Add __str__ methods to pattern classes for readable log output
- Improve filter log messages to show actual filter values
- Combine tag resolution and AND/OR logic into single log message
- Change single task history fetch log from INFO to DEBUG
- Simplify exception message (CLI now handles usage display)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use log.critical() in cli.py instead of print() for consistent output
- Align pre-logging error format in __init__.py to use "CRITICAL - "
- Ensures all error messages follow the same logging format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a failsafe by supporting three output formats:
- rich (default): YAML-like format using Rich library with hyperlinks
  and manual quoting for special characters
- tree: Visual tree format using Rich Tree
- strict: Guaranteed conformant YAML via ruamel.yaml for piping to yq/jq

Changes:
- Rename --format=yaml to --format=rich
- Add --format=strict using ruamel.yaml for guaranteed valid YAML
- Add _display_task_strict() method for strict YAML output
- Add _needs_yaml_quoting() to detect special chars: :{}[]`'"
- Add MAX_LINE_WIDTH constant and check_line_width() to fail if a line
  exceeds the maximum width in rich format
- Add mutual exclusivity check for --format=strict with --hyperlink=always
- Fix hyperlink auto-detection to work with Rich Console
- Add comprehensive tests for YAML quoting and strict format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add task ID validation in CLI using MONOGRAMS pattern
- Fix logging by setting disable_existing_loggers=False in dictConfig
- Handle BrokenPipeError when output is piped to head/less
- Standardize error messages across passphrase, paste, and maniphest:
  "Invalid <type> ID '<id>'. Expected format: <example>"
- Move MONOGRAMS import to top of cli.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@holmboe holmboe force-pushed the feat-output-formatting branch from 6a17d57 to f93f598 Compare January 10, 2026 19:57
@holmboe holmboe merged commit 97b6813 into master Jan 10, 2026
15 checks passed
@holmboe holmboe deleted the feat-output-formatting branch January 10, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants