Commit Graph

16 Commits

Author SHA1 Message Date
f91082186c Fix scroll direction inversion in REPL
Fixed the scroll direction bug where PageUp/PageDown were inverted:

- page_up now scrolls UP (back in time) with positive delta (+10)
- page_down now scrolls DOWN (forward in time) with negative delta (-10)
- Mouse wheel up/down also fixed with same logic (+3/-3)

The scroll logic in scroll_output() was correct (positive = scroll up),
but the key handlers in both main.py and pipeline_runner.py had
the signs inverted.
2026-03-23 17:03:03 -07:00
bfcad4963a Add mouse wheel and keyboard scrolling support to REPL
- Add scroll_offset to REPLState (max 50 lines)
- Modify _render_repl() to use manual scroll position
- Add scroll_output(delta) method for scroll control
- Add PageUp/PageDown keyboard support (scroll 10 lines)
- Add mouse wheel support via SGR mouse tracking
- Update HUD to show scroll percentage (like vim) and position
- Reset scroll when new output arrives
- Add tests for scroll functionality
2026-03-22 17:27:00 -07:00
b1bf739324 Add pipeline mutation commands to REPL
- Add help text for add_stage, remove_stage, swap_stages, move_stage commands
- Implement _cmd_add_stage, _cmd_remove_stage, _cmd_swap_stages, _cmd_move_stage methods
- Update _handle_pipeline_mutation in main.py and pipeline_runner.py
- Fix fragile test by testing output buffer directly instead of rendered output
2026-03-22 17:15:05 -07:00
a050e26c03 Add Ctrl+C quit handling to REPL
- Add _quit_requested flag to TerminalDisplay
- Add request_quit() method to TerminalDisplay
- Handle 'ctrl_c' key in REPL input loops in both pipeline_runner.py and main.py
- When Ctrl+C is pressed, request_quit() is called which sets the flag
- The main loop checks is_quit_requested() and raises KeyboardInterrupt
2026-03-22 16:48:05 -07:00
6646ed78b3 Add REPL effect detection and input handling to pipeline runner
- Detect REPL effect in pipeline and enable interactive mode
- Enable raw terminal mode for REPL input capture
- Add keyboard input loop for REPL commands (return, up/down arrows, backspace)
- Process commands and handle pipeline mutations from REPL
- Fix lint issues in graph and REPL modules (type annotations, imports)
2026-03-21 21:19:30 -07:00
1a7da400e3 feat(graph): Integrate graph system with pipeline runner
Add support for loading pipelines from TOML graph configs in the
pipeline runner, maintaining full backward compatibility with presets.

- Add graph_config parameter to run_pipeline_mode() function
- Support both preset mode and graph mode with conditional logic
- Graph mode: loads from TOML file, uses graph-defined stages
- Preset mode: maintains existing behavior with manual stage building
- Handle items/context appropriately for each mode (graph uses own data sources)
- CLI display flag works in both modes

Backward compatible: graph_config defaults to None, so existing calls
to run_pipeline_mode(preset_name) continue to work unchanged.
2026-03-21 19:26:45 -07:00
901717b86b feat(presets): Add upstream-default preset and enhance demo preset
- Add upstream-default preset matching upstream mainline behavior:
  - Terminal display (not pygame)
  - No message overlay
  - Classic effects: noise, fade, glitch, firehose
  - Mixed positioning mode

- Enhance demo preset to showcase sideline features:
  - Hotswappable effects via effect plugins
  - LFO sensor modulation (oscillator sensor)
  - Mixed positioning mode
  - Message overlay with ntfy integration
  - Includes hud effect for visual feedback

- Update all presets to use mixed positioning mode
- Update completion script for --positioning flag

Usage:
  python -m mainline --preset upstream-default --display terminal
  python -m mainline --preset demo --display pygame
2026-03-21 18:16:02 -07:00
33df254409 feat(positioning): Add configurable PositionStage for positioning modes
- Added PositioningMode enum (ABSOLUTE, RELATIVE, MIXED)
- Created PositionStage class with configurable positioning modes
- Updated terminal display to support positioning parameter
- Updated PipelineParams to include positioning field
- Updated DisplayStage to pass positioning to terminal display
- Added documentation in docs/positioning-analysis.md

Positioning modes:
- ABSOLUTE: Each line has cursor positioning codes (\033[row;1H)
- RELATIVE: Lines use newlines (no cursor codes, better for scrolling)
- MIXED: Base content uses newlines, effects use absolute positioning (default)

Usage:
  # In pipeline or preset:
  positioning = "absolute"  # or "relative" or "mixed"

  # Via command line (future):
  --positioning absolute
2026-03-21 17:38:20 -07:00
860bab6550 fix(pipeline): Use config display value in auto-injection
- Change line 477 in controller.py to use self.config.display or "terminal"
- Previously hardcoded "terminal" ignored config and CLI arguments
- Now auto-injection respects the validated display configuration

fix(app): Add warnings for auto-selected display

- Add warning in pipeline_runner.py when --display not specified
- Add warning in main.py when --pipeline-display not specified
- Both warnings suggest using null display for headless mode

feat(completion): Add bash/zsh/fish completion scripts

- completion/mainline-completion.bash - bash completion
- completion/mainline-completion.zsh - zsh completion
- completion/mainline-completion.fish - fish completion
- Provides completions for --display, --pipeline-source, --pipeline-effects,
  --pipeline-camera, --preset, --theme, --viewport, and other flags
2026-03-21 17:05:03 -07:00
a747f67f63 fix(pipeline): Fix config module reference in pipeline_runner
- Import engine config module as engine_config to avoid name collision
- Fix UnboundLocalError when accessing config.MESSAGE_DISPLAY_SECS
2026-03-21 15:32:41 -07:00
4acd7b3344 feat(pipeline): Integrate MessageOverlayStage into pipeline construction
- Import MessageOverlayStage in pipeline_runner.py
- Add message overlay stage when preset.enable_message_overlay is True
- Add overlay stage in both initial construction and preset change handler
- Use config.NTFY_TOPIC and config.MESSAGE_DISPLAY_SECS for configuration
2026-03-21 15:31:49 -07:00
7eaa441574 feat: Add fast startup fetch and background caching
- Add  for quick startup using first N feeds
- Add background thread for full fetch and caching
- Update  to use fast fetch
- Update docs and skills
2026-03-19 22:38:55 -07:00
ff08b1d6f5 feat: Complete Pipeline Mutation API implementation
- Add can_hot_swap() function to Pipeline class
- Add cleanup_stage() method to Pipeline class
- Fix remove_stage() to rebuild execution order after removal
- Extend ui_panel.execute_command() with docstrings for mutation commands
- Update WebSocket handler to support pipeline mutation commands
- Add _handle_pipeline_mutation() function for command routing
- Add comprehensive integration tests in test_pipeline_mutation_commands.py
- Update AGENTS.md with mutation API documentation

Issue: #35 (Pipeline Mutation API)
Acceptance criteria met:
-  can_hot_swap() checker for stage compatibility
-  cleanup_stage() cleans up specific stages
-  remove_stage_safe() rebuilds execution order (via remove_stage)
-  Unit tests for all operations
-  Integration with WebSocket commands
-  Documentation in AGENTS.md
2026-03-19 04:33:00 -07:00
238bac1bb2 feat: Complete pipeline hot-rebuild implementation with acceptance tests
- Implements pipeline hot-rebuild with state preservation (issue #43)
- Adds auto-injection of MVP stages for missing capabilities
- Adds radial camera mode for polar coordinate scanning
- Adds afterimage and motionblur effects using framebuffer history
- Adds comprehensive acceptance tests for camera modes and pipeline rebuild
- Updates presets.toml with new effect configurations

Related to: #35 (Pipeline Mutation API epic)
Closes: #43, #44, #45
2026-03-19 03:34:06 -07:00
14d622f0d6 Implement pipeline hot-rebuild with state preservation
- Add save_state/restore_state methods to CameraStage
- Add save_state/restore_state methods to DisplayStage
- Extend Pipeline._copy_stage_state() to preserve camera/display state
- Add save_state/restore_state methods to UIPanel for UI state preservation
- Update pipeline_runner to preserve UI state across preset changes

Camera state preserved:
- Position (x, y)
- Mode (feed, scroll, horizontal, etc.)
- Speed, zoom, canvas dimensions
- Internal timing state

Display state preserved:
- Initialization status
- Dimensions
- Reuse flag for display reinitialization

UI Panel state preserved:
- Stage enabled/disabled status
- Parameter values
- Selected stage and focused parameter
- Scroll position

This enables manual/event-driven rebuilds when inlet-outlet connections change,
while preserving all relevant state across pipeline mutations.
2026-03-18 23:30:24 -07:00
c57617bb3d fix(performance): use simple height estimation instead of PIL rendering
- Replace estimate_block_height (PIL-based) with estimate_simple_height (word wrap)
- Update viewport filter tests to match new height-based filtering (~4 items vs 24)
- Fix CI task duplication in mise.toml (remove redundant depends)

Closes #38
Closes #36
2026-03-18 22:33:36 -07:00