Introduce the platform adapter layer; extract window context behind it #27

Closed
Tyler wants to merge 0 commits from pr/07-platform-interfaces into main
Owner

Phase 3 groundwork, PR 7. Mirrors GitHub PR Twest2/StepForge#11.

  • app/platform/index.js: single factory selecting platform implementations; shared code no longer inspects process.platform.
  • app/platform/interfaces.js: documented adapter contracts + click-source vocabulary.
  • Window-context detection extracted verbatim to app/platform/{windows,linux,darwin}/window-context.js; text-intel delegates to the injected provider (3 platform methods + dead child_process import removed).
  • app/platform/linux/diagnostics.js: session/portal/PipeWire/xinput/device detection with actionable messages; platform:capabilities IPC.

Behavior-preserving. Verified: 268 unit tests incl. new platform suite; startup smoke passes; click selftest unchanged (stream, 3/3, 8/8).

Phase 3 groundwork, PR 7. Mirrors GitHub PR Twest2/StepForge#11. - app/platform/index.js: single factory selecting platform implementations; shared code no longer inspects process.platform. - app/platform/interfaces.js: documented adapter contracts + click-source vocabulary. - Window-context detection extracted verbatim to app/platform/{windows,linux,darwin}/window-context.js; text-intel delegates to the injected provider (3 platform methods + dead child_process import removed). - app/platform/linux/diagnostics.js: session/portal/PipeWire/xinput/device detection with actionable messages; platform:capabilities IPC. Behavior-preserving. Verified: 268 unit tests incl. new platform suite; startup smoke passes; click selftest unchanged (stream, 3/3, 8/8).
Tyler added 1 commit 2026-07-04 04:17:45 +00:00
Introduce the platform adapter layer; extract window context behind it
Template tests / tests (pull_request) Failing after 33s
970d76a780
Phase 3 groundwork of the improvement plan (PR 7 of the sequence). The Linux
work is a platform rewrite, so this first establishes the interface boundary
and moves an OS-specific piece behind it with Windows behavior preserved — no
new process.platform branches in shared code.

- app/platform/index.js is the single factory that selects a platform
  implementation; shared code asks it for adapters and never inspects
  process.platform itself.
- app/platform/interfaces.js documents the adapter contracts
  (WindowContextProvider, ClickSource, PowerPolicy) and the explicit click-
  source vocabulary.
- Extracted the foreground-window/element detection into per-OS adapters,
  verbatim from text-intel.js:
    app/platform/windows/window-context.js  (PowerShell UIAutomation)
    app/platform/linux/window-context.js     (xprop)
    app/platform/darwin/window-context.js     (AppleScript)
  text-intel.js now delegates to the injected provider and its three
  platform-branching methods (and the now-dead child_process import) are gone.
- app/platform/linux/diagnostics.js detects session type, portal/PipeWire,
  xinput, readable input devices, and the resulting click/screen-capture
  profile, returning actionable messages for the UI. Exposed via a new
  platform:capabilities IPC + preload method.

This is behavior-preserving: the Windows/macOS/Linux window-context code is
the same, just relocated behind the factory, and the capture pipeline is
untouched.

Tests: platform selection for every OS, provider validity + null-object for
unsupported OS, the shared service delegating to an injected provider, Linux
capability detection (x11/xinput, Wayland-without-PipeWire messaging, no-click
fallback, evdev), the capability facade, and a guard that text-intel no longer
branches on process.platform. 268 unit tests pass; startup smoke passes and
the click self-test is unchanged (stream source, markers 3/3, burst 8/8).

Co-Authored-By: Claude Fable 5 <[email protected]>
Author
Owner

Merged into main as 9019409 (same-SHA merge to both forges; GitHub mirror PR Twest2/StepForge#11 MERGED, CI green ubuntu+windows). Closing.

Merged into main as 9019409 (same-SHA merge to both forges; GitHub mirror PR Twest2/StepForge#11 MERGED, CI green ubuntu+windows). Closing.
Tyler closed this pull request 2026-07-04 04:19:59 +00:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Tyler/StepForge#27