Skip to content

Expose platform metadata on WaveEnv and preview mocks#3021

Merged
sawka merged 5 commits intomainfrom
copilot/add-platform-to-waveenv
Mar 10, 2026
Merged

Expose platform metadata on WaveEnv and preview mocks#3021
sawka merged 5 commits intomainfrom
copilot/add-platform-to-waveenv

Conversation

Copy link
Contributor

Copilot AI commented Mar 9, 2026

WaveEnv did not surface platform information, so platform-aware behavior could not be added through the shared environment contract. This updates the contract, production implementation, and preview mock to carry platform state without wiring it into any consumers yet.

  • WaveEnv contract

    • Add platform: NodeJS.Platform
    • Add isWindows() and isMacOS() helpers
  • Production implementation

    • Populate platform from PLATFORM in frontend/util/platformutil.ts
    • Forward isWindows / isMacOS from the same utility into makeWaveEnvImpl()
  • Preview mock

    • Add optional platform override to MockEnv
    • Default mock platform to macOS
    • Expose platform, isWindows(), and isMacOS() on the mock env
    • Preserve platform overrides through applyMockEnvOverrides()

Example:

const env = useWaveEnv();

env.platform;      // "darwin" | "win32" | ...
env.isMacOS();     // boolean
env.isWindows();   // boolean

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 9, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 97d7fcc
Status:⚡️  Build in progress...

View logs

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot AI changed the title [WIP] Add platform to WaveEnv and implement platform checks Expose platform metadata on WaveEnv and preview mocks Mar 9, 2026
Copilot finished work on behalf of sawka March 9, 2026 23:35
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Copilot finished work on behalf of sawka March 9, 2026 23:42
@sawka sawka marked this pull request as ready for review March 10, 2026 00:03
electron: overrides.electron ? { ...previewElectronApi, ...overrides.electron } : previewElectronApi,
electron: {
...previewElectronApi,
getPlatform: () => platform,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: The getPlatform function should be defined AFTER the ...overrides.electron spread to ensure it always returns the correct platform value, even when users override other electron properties.

Currently, if a user passes getPlatform in overrides.electron, it will override the platform-based implementation. The correct order should be:

electron: {
    ...previewElectronApi,
    ...overrides.electron,
    getPlatform: () => platform,
},

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 10, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
frontend/preview/mock/mockwaveenv.ts 160 The getPlatform function is defined before ...overrides.electron, allowing user overrides to potentially replace the mock platform value. Move it after the spread to ensure the mock platform is always used.
Files Reviewed (3 files)
  • frontend/app/waveenv/waveenv.ts - Type extension adds platform, isWindows, isMacOS
  • frontend/app/waveenv/waveenvimpl.ts - Implementation correctly uses platform utilities
  • frontend/preview/mock/mockwaveenv.ts - Mock support added (has existing warning)

@sawka sawka merged commit e087a4c into main Mar 10, 2026
5 of 6 checks passed
@sawka sawka deleted the copilot/add-platform-to-waveenv branch March 10, 2026 03:34
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.

2 participants