Skip to content

feat(zsh-plugin): Add Shell/Agent modes with dynamic prompt switching #2011

@dariuszkowalski-com

Description

@dariuszkowalski-com

Description

Add dual-mode functionality to ZSH plugin allowing users to switch between Shell mode (current behavior) and Agent mode (interactive forge mode), with dynamic prompt indicators and command routing.

Current Behavior

The plugin currently operates in a single mode where:

  • All commands are treated as shell commands by default
  • Forge commands require explicit : prefix
  • Prompt shows standard shell indicator (# for root, $ for user)
  • No visual indication of forge interaction mode

Proposed Changes

1. Mode System

  • Add mode state management for tracking current operation mode
  • Implement two modes: shell (default) and agent

2. Mode Switching

  • Command interface for explicit mode switching
  • Keyboard shortcut for quick mode switching
  • Integration with command dispatch system

3. Agent Mode Behavior

  • Default input treated as forge prompts (no : prefix needed)
  • Shell commands require ! prefix (e.g., !ls -la)
  • Prompt indicator changes from #/$ to :

4. Prompt Integration

  • Display mode-appropriate indicators in prompt
  • Updates for mode display in prompt segments
  • Maintain compatibility with existing prompt customizations

5. Visual Feedback

  • Syntax highlighting updates for ! commands in agent mode
  • Mode status in prompt segments
  • Clear visual distinction between modes

Benefits

  • Enhanced UX: Seamless switching between shell and AI interaction
  • Reduced Friction: No need for : prefix in agent mode
  • Clear Context: Visual indicators prevent command confusion
  • Backward Compatible: Existing workflows remain unchanged
  • Productivity: Faster AI interaction in dedicated mode

Use Cases

  • Extended AI coding sessions in agent mode
  • Quick shell commands during AI interactions
  • Context switching between development and AI assistance
  • Training scenarios for new users

Considerations

  • Mode state should persist within shell session
  • Graceful fallback for unsupported terminals
  • Minimal performance impact on prompt rendering
  • Compatibility with existing ZSH frameworks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions