Skip to content

feat: implement tui command for workflow [CDMD-4526]#1900

Open
amirabbas-gh wants to merge 9 commits intomainfrom
feat/workflow-tui
Open

feat: implement tui command for workflow [CDMD-4526]#1900
amirabbas-gh wants to merge 9 commits intomainfrom
feat/workflow-tui

Conversation

@amirabbas-gh
Copy link
Collaborator

@amirabbas-gh amirabbas-gh commented Dec 16, 2025

📚 Description

This PR introduces a new interactive Terminal User Interface (TUI) for managing workflow runs in the codemod CLI. The TUI provides a streamlined, step-by-step interface for viewing, monitoring, and managing workflow executions directly from the terminal.

Key Features:

  • Multi-screen navigation: Navigate through workflow runs → tasks → actions with intuitive keyboard controls
  • Real-time monitoring: Auto-refresh capabilities to track workflow and task status updates in real-time
  • Interactive terminal view: Full PTY (pseudo-terminal) support for running tasks with proper color, formatting, and interactive prompts
  • Task management: View task details, trigger individual tasks or all tasks, and monitor execution progress
  • Log viewing: Scrollable log viewer with proper terminal emulation (VT100 parser) for accurate rendering
  • Progress tracking: Visual progress indicators and status messages for workflow and task execution
  • Confirmation dialogs: Safety prompts for destructive actions like canceling tasks or triggering workflows
  • Responsive UI: Handles terminal resize events gracefully with proper PTY resizing

Technical Highlights:

  • Built with ratatui for the TUI framework and crossterm for terminal control
  • Uses portable-pty for full terminal emulation, enabling proper interactive command execution
  • Implements VT100 parser for accurate terminal output rendering
  • Thread-safe state management with proper lock handling and error recovery
  • Efficient refresh intervals with configurable auto-refresh (default: 1 second)

🧪 Test Plan

  1. Basic TUI Navigation:
    codemod workflow tui
    • Verify the workflows list screen appears
    • Use arrow keys to navigate through workflow runs
    • Press Enter to view tasks for a selected workflow
    • Navigate through tasks and view actions screen
    • Test keyboard shortcuts (q to quit, h for help, etc.)
  2. Task Triggering:
    • Select a workflow and task
    • Trigger a single task and verify confirmation dialog
    • Trigger all tasks and verify execution
    • Monitor task execution in real-time
  3. Terminal View:
    • Navigate to terminal view for a running task
    • Verify proper terminal emulation (colors, formatting)
    • Test interactive prompts if the task requires input
    • Verify terminal resize handling
  4. Log Viewing:
    • View logs for completed tasks
    • Test scrolling through logs (up/down arrows, Page Up/Down)
    • Verify log content is properly formatted
  5. Auto-refresh:
    • Start a workflow run
    • Verify status updates automatically refresh
    • Test with custom refresh interval: codemod workflow tui --refresh-interval 5
  6. Error Handling:
    • Test with invalid workflow paths
    • Verify error messages are displayed properly

@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
codemod Ignored Ignored Dec 16, 2025 8:41pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/codemod@1900

commit: 23dff0f

@mohebifar mohebifar force-pushed the main branch 2 times, most recently from 936b648 to a20d519 Compare December 21, 2025 08:42
@amirabbas-gh amirabbas-gh force-pushed the feat/workflow-tui branch 4 times, most recently from 9c8a7fc to 01dde24 Compare December 25, 2025 18:50
@mohebifar mohebifar requested a review from Copilot December 26, 2025 17:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a Terminal User Interface (TUI) command for interactive workflow management. The changes add console log collection capabilities throughout the execution pipeline, introduce a new target_path field to workflow runs, and create a comprehensive TUI with terminal emulation support for monitoring and triggering workflow tasks.

Key changes:

  • Added target_path field to WorkflowRun model for tracking execution location
  • Implemented console log collection mechanism across all JavaScript execution engines
  • Created new TUI command with real-time workflow monitoring and interactive task triggering

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/models/src/workflow.rs Added optional target_path field to WorkflowRun struct
crates/core/src/engine.rs Added target_path parameter to run_workflow, enhanced error logging to task logs
crates/codemod-sandbox/src/sandbox/engine/*.rs Added console_log_collector callback for capturing JavaScript console output
crates/codemod-sandbox/Cargo.toml Added gag dependency for stdout capture
crates/cli/src/commands/workflow/tui.rs New 2500+ line TUI implementation with terminal emulation
crates/cli/Cargo.toml Added TUI dependencies (ratatui, crossterm, portable-pty, vt100)
crates/core/tests/engine_tests.rs Updated all test calls to match new run_workflow signature
Various test files Added console_log_collector: None to execution options

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@linear
Copy link

linear bot commented Dec 29, 2025

@mohebifar mohebifar requested a review from sahilmob December 29, 2025 18:02
Copy link
Contributor

@sahilmob sahilmob left a comment

Choose a reason for hiding this comment

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

LGTM in general; I would prefer we split crates/cli/src/commands/workflow/tui.rs into multiple files. Also, the places where unwrap is used might need some attention.

let pty_system = NativePtySystem::default();

// Get terminal size from app state
let (rows, cols) = app.terminal_size;
Copy link
Contributor

Choose a reason for hiding this comment

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

Dose this reacts to terminal window size changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed


// Reset the terminal parser for fresh output
{
let mut parser = app.terminal_parser.write().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

What if unwrap fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed


// Mark PTY as running
{
let mut running = app.pty_running.lock().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

also this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@amirabbas-gh amirabbas-gh changed the title feat: implement tui command for workflow feat: implement tui command for workflow [CDMD-4526] Jan 6, 2026
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.

2 participants