Skip to content

Conversation

@ahogappa
Copy link
Owner

@ahogappa ahogappa commented Dec 24, 2025

Summary

Add a new simple progress display mode as an alternative to the verbose tree display. This provides a compact single-line progress indicator for users who prefer minimal output.

Display Format

During execution:

⠹ [3/5] DeployTask | Uploading files...

Parallel execution (multiple tasks running):

⠹ [2/5] DownloadLayer1, DownloadLayer2 | Downloading...

Completion:

✓ [5/5] All tasks completed (1234ms)

Failure:

✗ [3/5] DeployTask failed: Connection refused

Configuration

Via environment variable:

TASKI_PROGRESS_MODE=simple ruby my_task.rb
TASKI_PROGRESS_MODE=tree ruby my_task.rb   # default

Via API:

Taski.progress_mode = :simple
Taski.progress_mode = :tree  # default

Changes

  • Add SimpleProgressDisplay class with same interface as TreeProgressDisplay
  • Add Taski.progress_mode and Taski.progress_mode= API
  • Add TASKI_PROGRESS_MODE environment variable support
  • Add example file examples/simple_progress_demo.rb
  • Update README.md and docs/GUIDE.md with documentation

Test plan

  • All existing tests pass
  • New tests for SimpleProgressDisplay added
  • New tests for progress_mode configuration added
  • Lint passes

Closes #97

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced Simple Mode progress display—a compact single-line alternative to the default Tree Visualization
    • Configure via the progress_mode API or TASKI_PROGRESS_MODE environment variable
    • Simple Mode displays real-time task progress with colorized status indicators
  • Documentation

    • Added comprehensive guides documenting both display modes and configuration options
    • Included example script demonstrating Simple Mode in action
  • Tests

    • Added test suite validating Simple Mode functionality across various scenarios

✏️ Tip: You can customize this high-level summary in your review settings.

Add a new simple progress display mode that shows task execution status
in a compact single-line format. Features include TASKI_PROGRESS_MODE
environment variable and Taski.progress_mode API.

Closes #97

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 24, 2025

Walkthrough

This PR introduces a configurable progress display mode system for Taski. It adds a new "simple" one-line progress display as an alternative to the existing tree-based display, selectable via environment variable TASKI_PROGRESS_MODE=simple or the public API method Taski.progress_mode = :simple. The implementation includes a new SimpleProgressDisplay class, core integration logic, documentation, examples, and comprehensive tests.

Changes

Cohort / File(s) Summary
Documentation & Examples
README.md, docs/GUIDE.md, examples/simple_progress_demo.rb
Added new "Simple mode" section to README with one-line visual; expanded docs/GUIDE.md with Display Modes section detailing Tree vs. Simple modes, configuration options, and behavior details; created example script demonstrating simple progress mode with layered task execution and dependency composition.
Core Progress Display System
lib/taski.rb, lib/taski/execution/simple_progress_display.rb
Implemented dynamic progress display mode factory in lib/taski.rb with new public methods progress_mode, progress_mode=, reset_progress_display!, create_progress_display, and progress_mode_from_env. Added new SimpleProgressDisplay class providing minimalist single-line progress display with spinner frames, colored status icons, task state tracking, threaded rendering, and output capture integration.
Test Suite
test/test_simple_progress_display.rb
Comprehensive test coverage for SimpleProgressDisplay including registration idempotency, state management (running/completed/failed), TTY-aware rendering with cursor control and formatting, progress mode configuration via environment and API, and display factory behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A thread-safe line of hope appears,
No tree to tangle worries here!
One spinner spins, one status shows—
Progress dances as work flows. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a simple one-line progress display mode as an alternative to the existing tree display.
Linked Issues check ✅ Passed The PR fully implements all requirements from issue #97: simple one-line display showing progress (completed/total), running tasks, final status; configurable via environment variable and API; follows existing interface; maintains tree mode as default.
Out of Scope Changes check ✅ Passed All changes are within scope: the new SimpleProgressDisplay class, Taski module API additions (progress_mode getters/setters), configuration support, example file, and documentation updates directly support the simple mode feature.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/simple-progress-display

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
README.md (1)

277-280: Add language specifier to fenced code block.

The code block showing terminal output should specify a language identifier for proper rendering and to satisfy markdownlint.

🔎 Proposed fix
-```
+```text
 ⠹ [3/5] DeployTask | Uploading files...
 ✓ [5/5] All tasks completed (1234ms)
</details>

Based on static analysis hints (markdownlint).

</blockquote></details>
<details>
<summary>docs/GUIDE.md (1)</summary><blockquote>

`290-342`: **Add language specifiers to fenced code blocks.**

Multiple code blocks showing terminal output should specify a language identifier (e.g., `text`) for proper rendering and to satisfy markdownlint.

Affected lines: 298, 310, 318, 323.



<details>
<summary>🔎 Proposed fix for line 298</summary>

```diff
-```
+```text
 WebServer (Task)
 ├── ⠋ Config (Task) | Reading config.yml...
 │   ├── ✅ Database (Task) 45.2ms
 │   └── ⠙ Cache (Task) | Connecting...
 └── ◻ Server (Task)

Apply similar changes to code blocks at lines 310, 318, and 323.
</details>

Based on static analysis hints (markdownlint).

</blockquote></details>
<details>
<summary>examples/simple_progress_demo.rb (1)</summary><blockquote>

`1-1`: **Add execute permission to script file.**

The script has a shebang (`#!/usr/bin/env ruby`) but lacks execute permission. Add it with:

```shell
chmod +x examples/simple_progress_demo.rb

Based on static analysis hints (RuboCop).

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 24790ee and 4e31b80.

📒 Files selected for processing (6)
  • README.md
  • docs/GUIDE.md
  • examples/simple_progress_demo.rb
  • lib/taski.rb
  • lib/taski/execution/simple_progress_display.rb
  • test/test_simple_progress_display.rb
🧰 Additional context used
🧬 Code graph analysis (3)
examples/simple_progress_demo.rb (2)
lib/taski.rb (2)
  • progress_mode (194-196)
  • progress_mode (200-205)
lib/taski/execution/task_output_router.rb (1)
  • puts (150-161)
lib/taski.rb (2)
lib/taski/execution/simple_progress_display.rb (1)
  • stop (175-191)
lib/taski/execution/tree_progress_display.rb (1)
  • stop (428-445)
lib/taski/execution/simple_progress_display.rb (2)
lib/taski/execution/tree_progress_display.rb (1)
  • build_tree_node (87-112)
lib/taski/execution/task_output_router.rb (2)
  • print (163-166)
  • flush (173-175)
🪛 markdownlint-cli2 (0.18.1)
README.md

277-277: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

docs/GUIDE.md

298-298: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


310-310: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


318-318: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


323-323: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 RuboCop (1.82.0)
examples/simple_progress_demo.rb

[warning] 1-1: Script file simple_progress_demo.rb doesn't have execute permission.

(Lint/ScriptPermission)

lib/taski/execution/simple_progress_display.rb

[convention] 101-135: Assignment Branch Condition size for update_task is too high. [<18, 25, 12> 33.06/23]

(Metrics/AbcSize)


[convention] 101-135: Cyclomatic complexity for update_task is too high. [13/7]

(Metrics/CyclomaticComplexity)


[convention] 227-248: Assignment Branch Condition size for render_final is too high. [<11, 28, 12> 32.39/23]

(Metrics/AbcSize)


[convention] 227-248: Cyclomatic complexity for render_final is too high. [8/7]

(Metrics/CyclomaticComplexity)


[convention] 227-248: Perceived complexity for render_final is too high. [9/8]

(Metrics/PerceivedComplexity)


[convention] 250-284: Assignment Branch Condition size for build_status_line is too high. [<18, 43, 23> 51.98/23]

(Metrics/AbcSize)


[convention] 250-284: Cyclomatic complexity for build_status_line is too high. [16/7]

(Metrics/CyclomaticComplexity)


[convention] 250-284: Perceived complexity for build_status_line is too high. [18/8]

(Metrics/PerceivedComplexity)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (10)
test/test_simple_progress_display.rb (1)

1-309: LGTM! Comprehensive test coverage.

The test suite thoroughly validates the SimpleProgressDisplay implementation, including:

  • Task registration and state management
  • TTY and non-TTY behavior
  • Rendering with spinners, task counts, and status icons
  • Progress mode configuration via environment and API
  • Display factory behavior based on mode selection

The use of sleep statements in TTY tests is appropriate for allowing the renderer thread to execute.

lib/taski.rb (3)

14-14: LGTM! Clean integration of simple progress display.

The require statement properly integrates the new SimpleProgressDisplay class into the module structure.


192-211: Consider thread safety for progress mode state.

The progress_mode getter/setter methods modify @progress_mode without synchronization. While this is likely acceptable for typical usage (setting mode once at application startup), concurrent access from multiple threads could theoretically cause race conditions.

If the mode is only intended to be set during initialization (before any tasks run), this is fine. Otherwise, consider adding synchronization similar to the @args_monitor pattern used elsewhere in this file.

Do you want to add synchronization, or is the current approach acceptable given expected usage patterns?


214-231: LGTM! Clean factory pattern and environment integration.

The create_progress_display factory method provides clean separation between modes, and progress_mode_from_env properly defaults to :tree for backward compatibility.

examples/simple_progress_demo.rb (1)

11-80: LGTM! Clear demonstration of simple progress mode.

The demo effectively illustrates:

  • Setting progress mode via API
  • Task definitions with exports
  • Automatic dependency resolution
  • Final result retrieval

The task structure with parallel downloads (Layer1, Layer2, Layer3) followed by extraction and verification is a good real-world example.

lib/taski/execution/simple_progress_display.rb (5)

1-62: LGTM! Clean initialization and constants.

The implementation provides:

  • Appropriate spinner frames and render interval
  • Clear icon and color definitions
  • Well-structured TaskProgress struct with proper initialization
  • Thread-safe monitor-based synchronization

64-148: LGTM! Comprehensive public API.

The public interface methods properly:

  • Handle output capture configuration
  • Register tasks and sections with idempotency
  • Update task states with proper synchronization
  • Track task registration status

150-191: LGTM! Robust lifecycle management.

The start/stop methods correctly:

  • Handle nested calls with nest level tracking
  • Check for TTY before starting renderer thread
  • Hide/show cursor appropriately
  • Synchronize state changes with monitor
  • Join renderer thread on stop

This matches the pattern used in TreeProgressDisplay.


195-215: LGTM! Effective code reuse.

Reusing TreeProgressDisplay.build_tree_node for tree structure building is an appropriate design choice. This:

  • Avoids code duplication
  • Ensures consistent dependency resolution
  • Maintains a single source of truth for tree structure

The coupling is acceptable given the code reuse benefits.


217-305: LGTM! Well-structured rendering logic.

The rendering methods effectively:

  • Build compact single-line status displays
  • Handle multiple running tasks
  • Show appropriate icons for different states
  • Truncate output for readability
  • Provide informative final status

The RuboCop complexity warnings for update_task, render_final, and build_status_line are false positives—the complexity is inherent to state management and conditional formatting. The code is well-organized and readable.

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.

Feature: Add simple one-line progress display mode

2 participants