Skip to content

feat(demo): add Scene/Stage DSL, runner, and example scenario#4784

Merged
gregpriday merged 3 commits intodevelopfrom
feature/issue-4778-build-demo-scene-stage-dsl
Apr 2, 2026
Merged

feat(demo): add Scene/Stage DSL, runner, and example scenario#4784
gregpriday merged 3 commits intodevelopfrom
feature/issue-4778-build-demo-scene-stage-dsl

Conversation

@gregpriday
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a typed Stage API (demo/stage.ts) with cursor, keyboard, camera, wait, and sleep helpers that wrap the existing low-level demo IPC commands
  • Adds a DemoRunner (demo/runner.ts) that handles Electron launch, scene sequencing, and the full capture lifecycle (start → scenes → stop → encode)
  • Adds a basic-terminal example scenario showing cursor movement, clicking, and terminal typing end-to-end
  • Adds npm run demo and npm run demo:record scripts to package.json

Resolves #4778

Changes

  • demo/stage.ts — Stage class with five namespaced sub-APIs, auto-wires capture lifecycle around scene execution
  • demo/runner.ts — DemoRunner class; reuses e2e/helpers/launch.ts for Electron launch with retry, loads scenario files dynamically
  • demo/scenes/basic-terminal.ts — working example scenario; imports selectors from the shared E2E registry
  • demo/tsconfig.json — TypeScript config scoped to the demo directory
  • electron/ipc/handlers/demo.ts — minor handler additions to surface startCapture / stopCapture / encode over IPC
  • .gitignore — ignore demo/output/ artefacts

Testing

All three unit tests in electron/ipc/handlers/__tests__/demo.handlers.test.ts pass. Typecheck, lint, and format all clean (npm run check).

- Fix ffmpeg frame naming bug: encode now uses frame-%06d.png matching capture output
- Add Stage class wrapping window.electron.demo.* via page.evaluate()
- Add demo runner script with CLI args (--scenario, --output, --preset, --fps)
- Add basic-terminal example scenario (open terminal, type command)
- Add demo/tsconfig.json for standalone NodeNext type checking
- Add npm scripts: demo (launch demo mode), demo:record (record scenario)
- Add demo-output/ to .gitignore
- Add fps validation in runner (guard against NaN/0/negative, default to 30)
- Remove unused --keep-frames CLI flag
- Fix window-destroyed mid-capture stall: call stopCapture() instead of silent return
- Add file-level eslint-disable for no-explicit-any in stage.ts (page.evaluate browser context)
- Remove unused framesDir variable initialization in runner.ts
@gregpriday gregpriday force-pushed the feature/issue-4778-build-demo-scene-stage-dsl branch from 5019f01 to 967bb8b Compare April 2, 2026 04:29
@gregpriday gregpriday merged commit 73d0082 into develop Apr 2, 2026
3 checks passed
@gregpriday gregpriday deleted the feature/issue-4778-build-demo-scene-stage-dsl branch April 2, 2026 04:29
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.

Build demo Scene/Stage DSL, runner, and example scenario

1 participant