-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: extract BaseProgressDisplay class from progress displays #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Create BaseProgressDisplay base class with: - Shared TaskProgress and GroupProgress classes - Common task registration and state management - Template methods for subclass customization - Lifecycle hooks (on_start, on_stop, etc.) - Refactor TreeProgressDisplay to extend BaseProgressDisplay - Remove duplicate task management code - Override template methods for tree rendering - Refactor SimpleProgressDisplay to extend BaseProgressDisplay - Remove duplicate task management code - Override template methods for single-line display - Add PlainProgressDisplay for non-TTY environments - Plain text output without ANSI codes - Enable with TASKI_PROGRESS_MODE=plain Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughAdds a BaseProgressDisplay scaffold, a PlainProgressDisplay implementation, and refactors SimpleProgressDisplay and TreeProgressDisplay to inherit and use the new base; also wires the new plain mode into the factory and env resolution. (48 words) Changes
Sequence Diagram(s)sequenceDiagram
participant Factory as Taski.create_progress_display
participant Display as PlainProgressDisplay
participant Executor as Executor/Runner
participant Out as STDERR/$stdout
Factory->>Display: instantiate(output: STDERR)
Executor->>Display: set_root_task(root_class)
Executor->>Display: register_section_impl(section, impl)
Executor->>Display: start()
Executor->>Display: update_task(task_class, state: :running)
Display->>Out: "[START] TaskName"
Executor->>Display: update_task(task_class, state: :done, duration: 123)
Display->>Out: "[DONE] TaskName (0.123s)"
Executor->>Display: stop()
Display->>Out: "[TASKI] Completed ... (summary)"
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)lib/taski/execution/plain_progress_display.rb (1)
🪛 RuboCop (1.82.1)lib/taski/execution/plain_progress_display.rb[convention] 35-57: Cyclomatic complexity for (Metrics/CyclomaticComplexity) 🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
PlainProgressDisplay is explicitly selected by user via TASKI_PROGRESS_MODE=plain, so it should always output regardless of TTY status. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove redundant @enabled flag from PlainProgressDisplay (always true) - Extract register_tasks_from_tree to BaseProgressDisplay - Use ||= operator for on_section_impl_registered - Remove empty template methods - Fix test compatibility with Ruby 4.0 (replace Minitest::Mock) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
BaseProgressDisplayclassTreeProgressDisplayandSimpleProgressDisplayto inherit from base classPlainProgressDisplayfor CI/non-TTY environments (plain text output)Changes
New
BaseProgressDisplayclass provides:TaskProgress,GroupProgressclasses)short_name,format_duration,tty?)Template methods for subclasses:
on_root_task_set- Called when root task is seton_section_impl_registered- Called when section impl is registeredon_task_registered- Called when a task is registeredon_task_updated- Called when task state changeson_group_updated- Called when group state changesshould_activate?- Determine if display should activateon_start/on_stop- Lifecycle hooksPlainProgressDisplay output format:
Enable with:
TASKI_PROGRESS_MODE=plainCode reduction
TreeProgressDisplay: ~200 lines removed (duplicated state management)SimpleProgressDisplay: ~100 lines removedTest plan
rake standard)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.