Add 'phabfive edit' command with object type auto-detection#133
Open
Add 'phabfive edit' command with object type auto-detection#133
Conversation
Timpan4
approved these changes
Feb 24, 2026
This is a work-in-progress commit for issue #132. The basic structure is in place but requires additional implementation in maniphest.py. Completed: - Created edit.py module with Edit class - Monogram detection (T/K/P) from CLI args or YAML Link field - Auto-detect piped stdin (no --from-stdin flag needed!) - YAML parser for batch operations from stdin - Board/column validation logic with multi-board handling - Batch error handling with partition suggestions - CLI command registration and routing Remaining work: - Implement _get_task_data() in maniphest.py - Implement edit_task_by_id() in maniphest.py - Implement priority navigation (raise/lower with Triage skip) - Implement column navigation (forward/backward) - Add change detection logic - Add PHID resolution helpers - Add transaction builder - Write tests - Update documentation The command structure is ready and follows the design: - Auto-detects object type from monogram (T123, K456, P789) - Auto-detects piped input vs CLI argument - Supports batch editing with atomic validation - Smart board/column handling with helpful error messages Related to #132
Add all required methods to maniphest.py to support the edit command: New methods: - _get_task_data(): Fetch task with columns/projects attachments - edit_task_by_id(): Main edit method with change detection - _navigate_priority(): Raise/lower priority (skips Triage) - _navigate_column(): Move to column by name or forward/backward - _get_column_info(): Fetch column info for a board - _resolve_user_phid(): Resolve username to PHID Features implemented: - Change detection: Only applies transactions for changed fields - Priority navigation: Wish→Low→Normal→High→Unbreak (skips Triage) - Column navigation: forward/backward by sequence, or by name - Auto-add to board: Adds task to board if needed when setting column - Dry-run support: Shows changes without applying - Comment support: Adds comment transaction The edit command is now fully functional for tasks! Related to #132
Add 34 tests covering all edit command functionality: Test coverage: - Monogram detection (T/K/P from CLI and URLs) - Priority navigation with Triage skip logic * Raise/lower through full ladder * Special Triage handling: raise→unbreak, lower→high * Edge cases (stay at min/max) - Column navigation (forward/backward/by-name) - Board/column validation - Stdin auto-detection - YAML parsing from stdin - Object grouping by type Also fixes priority navigation for Triage: - Triage (90) sits between High (80) and Unbreak (100) - When on Triage: raise→unbreak, lower→high - Triage excluded from normal raise/lower ladder All 34 tests pass ✓ Related to #132
- Fix duplicate _get_column_info() method by using existing implementation - Update _navigate_column() to work with dict format instead of list - Fix priority navigation to properly skip Triage priority: - Raise from Triage goes to Unbreak (not normal progression) - Lower from Triage goes to High (not normal progression) - Add 34 comprehensive tests for edit command covering: - Monogram detection (T/K/P from text and URLs) - Priority raise/lower navigation with Triage skip logic - Column forward/backward navigation - Board/column validation - Stdin auto-detection - YAML parsing - Object type grouping All 326 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create docs/edit-cli.md with full edit command documentation: - Overview and quick start - Command syntax and input modes - Priority management with Triage skip logic - Workboard column management with directional navigation - Batch operations with atomic validation - Partition suggestions for multi-board scenarios - Advanced workflows and examples - Troubleshooting guide - Update docs/index.md: - Add Edit CLI to feature list - Add link to edit-cli.md in CLI Reference section - Update README.md: - Add Edit feature to features list - Add edit command examples to Quick Start 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
8d80b15 to
c8b0fef
Compare
- Remove duplicate _resolve_user_phid() definition (F811) - Add None check in caller for user resolution - Remove unnecessary list() in sorted() call (C414) - Remove unused yaml_content variable (F841) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements a unified
phabfive editcommand that auto-detects object types from monograms (T/K/P) and provides intelligent batch editing capabilities with atomic validation.Fixes #132
Features Implemented
Core Functionality
sys.stdin.isatty()(no--from-stdinflag needed)raise/lower,forward/backward)--commentflagTask Editing (Maniphest)
Batch Operations
--tagArchitecture
New Files
phabfive/edit.py(452 lines) - Edit handler with monogram detection, YAML parsing, and validationtests/test_edit.py(498 lines) - Comprehensive test suite (34 tests)docs/edit-cli.md(603 lines) - Complete documentation with examples and troubleshootingModified Files
phabfive/cli.py- Added edit command and routingphabfive/maniphest.py- Added editing methods:edit_task_by_id()- Main edit entry point with change detection_get_task_data()- Fetch task with attachments_navigate_priority()- Priority raise/lower with Triage skip_navigate_column()- Column forward/backward navigation_resolve_user_phid()- Username to PHID resolutiondocs/index.md- Added Edit CLI to documentation indexREADME.md- Added edit command to features and examplesTest Coverage
34 comprehensive tests, all passing:
Full test suite: 326/326 tests passing (no regressions)
Usage Examples
Single Task Edit
Batch Edit from Search
phabfive maniphest search --assigned=@me | phabfive edit --status=resolvedDirectional Navigation
Multi-Board Handling
Error Handling
Partition Suggestions
When tasks are on different boards, the command provides helpful partition suggestions:
Documentation
Complete documentation added in
docs/edit-cli.mdcovering:Commits
Testing Instructions
Breaking Changes
None. This is a new command that doesn't affect existing functionality.
Future Work
The architecture is designed to easily extend to these object types through the existing monogram detection system.
Related
sys.stdin.isatty()pattern for consistency🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com