Skip to content

Conversation

@holmboe
Copy link
Contributor

@holmboe holmboe commented Jan 12, 2026

Summary

This PR refactors the codebase for better maintainability and clearer APIs.

Changes

1. Move display logic from library to CLI (47b3052)

  • Move task display functions to cli.py
  • Rename print methods to getter methods across modules:
    • diffusion: print_uriget_uris_formatted, etc.
    • paste: print_pastesget_pastes_formatted
    • user: print_whoamiget_whoami
    • passphrase: remove print_secret, use get_secret directly
  • Library modules now return data structures instead of printing directly

2. Convert maniphest.py to package structure (ffa4e6c)

  • Split 3,317 line monolithic file into focused submodules:
    • core.py: Main Maniphest class orchestrator
    • utils.py: Utility functions
    • validators.py: Input validation
    • resolvers.py: PHID resolution
    • fetchers.py: API data fetching
    • filters.py: Task filtering
    • formatters.py: Data formatting
  • Maintain backward compatibility via __init__.py re-exports

3. Improve Conduit access denied error message (3df5a42)

  • Change from generic API message to actionable:
    Access denied, visit {url}/K{id} to allow Conduit

4. Improve method naming (c7a2bd6)

  • create_task_clicreate_task
  • create_from_configcreate_tasks_from_yaml
  • get_whoamiwhoami
  • add_commentadd_task_comment
  • infoget_task_info
  • days_to_unixdays_ago_to_timestamp
  • _load_search_from_yaml_load_search_config

Testing

All 257 tests pass.

- Move task display functions to cli.py (display_task_rich, display_task_tree,
  display_task_strict, display_tasks)
- Rename print methods to getter methods across modules:
  - diffusion: print_uri -> get_uris_formatted, print_repositories ->
    get_repositories_formatted, print_branches -> get_branches_formatted
  - paste: print_pastes -> get_pastes_formatted
  - user: print_whoami -> get_whoami
  - passphrase: remove print_secret, use get_secret directly
  - maniphest: _format_and_display_tasks -> _build_task_display_data
- CLI now handles all output formatting and printing
- Library modules return data structures instead of printing directly

This separation improves testability and allows library code to be
used programmatically without side effects.
Split maniphest.py (3,317 lines) into focused submodules:
- core.py: Main Maniphest class orchestrator
- utils.py: Utility functions (timestamps, variable rendering)
- validators.py: Input validation
- resolvers.py: PHID resolution
- fetchers.py: API data fetching
- filters.py: Task filtering
- formatters.py: Data formatting

- Remove underscore prefix from utility functions now at module level
- Update test imports to use new package structure
- Maintain backward compatibility via __init__.py re-exports
Change from generic API message to actionable:
"Access denied, visit {url}/K{id} to allow Conduit"
- create_task_cli -> create_task (not CLI-specific)
- create_from_config -> create_tasks_from_yaml (more specific)
- get_whoami -> whoami (cleaner API)
- add_comment -> add_task_comment (more specific)
- info -> get_task_info (was too vague)
- days_to_unix -> days_ago_to_timestamp (clearer intent)
- _load_search_from_yaml -> _load_search_config (simpler)
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! real nice. was needed

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