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
This commit is contained in:
2026-03-21 18:16:02 -07:00
parent 33df254409
commit 901717b86b
8 changed files with 219 additions and 4 deletions

View File

@@ -265,6 +265,12 @@ def run_pipeline_mode_direct():
)
display = DisplayRegistry.create(display_name)
# Set positioning mode
if "--positioning" in sys.argv:
idx = sys.argv.index("--positioning")
if idx + 1 < len(sys.argv):
params.positioning = sys.argv[idx + 1]
if not display:
print(f" \033[38;5;196mFailed to create display: {display_name}\033[0m")
sys.exit(1)

View File

@@ -139,6 +139,16 @@ def run_pipeline_mode(preset_name: str = "demo"):
print("Error: Invalid viewport format. Use WxH (e.g., 40x15)")
sys.exit(1)
# Set positioning mode from command line or config
if "--positioning" in sys.argv:
idx = sys.argv.index("--positioning")
if idx + 1 < len(sys.argv):
params.positioning = sys.argv[idx + 1]
else:
from engine import config as app_config
params.positioning = app_config.get_config().positioning
pipeline = Pipeline(config=preset.to_config())
print(" \033[38;5;245mFetching content...\033[0m")

View File

@@ -130,6 +130,7 @@ class Config:
script_fonts: dict[str, str] = field(default_factory=_get_platform_font_paths)
display: str = "pygame"
positioning: str = "mixed"
websocket: bool = False
websocket_port: int = 8765
theme: str = "green"
@@ -174,6 +175,7 @@ class Config:
kata_glyphs="ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ",
script_fonts=_get_platform_font_paths(),
display=_arg_value("--display", argv) or "terminal",
positioning=_arg_value("--positioning", argv) or "mixed",
websocket="--websocket" in argv,
websocket_port=_arg_int("--websocket-port", 8765, argv),
theme=_arg_value("--theme", argv) or "green",

File diff suppressed because one or more lines are too long

View File

@@ -60,6 +60,7 @@ class PipelinePreset:
source_items: list[dict[str, Any]] | None = None # For ListDataSource
enable_metrics: bool = True # Enable performance metrics collection
enable_message_overlay: bool = False # Enable ntfy message overlay
positioning: str = "mixed" # Positioning mode: "absolute", "relative", "mixed"
def to_params(self) -> PipelineParams:
"""Convert to PipelineParams (runtime configuration)."""
@@ -68,6 +69,7 @@ class PipelinePreset:
params = PipelineParams()
params.source = self.source
params.display = self.display
params.positioning = self.positioning
params.border = (
self.border
if isinstance(self.border, bool)
@@ -115,18 +117,38 @@ class PipelinePreset:
source_items=data.get("source_items"),
enable_metrics=data.get("enable_metrics", True),
enable_message_overlay=data.get("enable_message_overlay", False),
positioning=data.get("positioning", "mixed"),
)
# Built-in presets
# Upstream-default preset: Matches the default upstream Mainline operation
UPSTREAM_PRESET = PipelinePreset(
name="upstream-default",
description="Upstream default operation (terminal display, legacy behavior)",
source="headlines",
display="terminal",
camera="scroll",
effects=["noise", "fade", "glitch", "firehose"],
enable_message_overlay=False,
positioning="mixed",
)
# Demo preset: Showcases hotswappable effects and sensors
# This preset demonstrates the sideline features:
# - Hotswappable effects via effect plugins
# - Sensor integration (oscillator LFO for modulation)
# - Mixed positioning mode
# - Message overlay with ntfy integration
DEMO_PRESET = PipelinePreset(
name="demo",
description="Demo mode with effect cycling and camera modes",
description="Demo: Hotswappable effects, LFO sensor modulation, mixed positioning",
source="headlines",
display="pygame",
camera="scroll",
effects=["noise", "fade", "glitch", "firehose"],
effects=["noise", "fade", "glitch", "firehose", "hud"],
enable_message_overlay=True,
positioning="mixed",
)
UI_PRESET = PipelinePreset(
@@ -201,6 +223,7 @@ def _build_presets() -> dict[str, PipelinePreset]:
# Add built-in presets as fallback (if not in YAML)
builtins = {
"demo": DEMO_PRESET,
"upstream-default": UPSTREAM_PRESET,
"poetry": POETRY_PRESET,
"pipeline": PIPELINE_VIZ_PRESET,
"websocket": WEBSOCKET_PRESET,