Skip to content

fix(windows): cross-platform tests and safer MCP orphan cleanup - #390

Open
dakshagarwal76 wants to merge 2 commits into
peakflo:mainfrom
dakshagarwal76:fix/windows-dev-improvements
Open

fix(windows): cross-platform tests and safer MCP orphan cleanup#390
dakshagarwal76 wants to merge 2 commits into
peakflo:mainfrom
dakshagarwal76:fix/windows-dev-improvements

Conversation

@dakshagarwal76

Copy link
Copy Markdown

Summary

  • Add scripts/run-vitest.mjs so pnpm test:run works on Windows PowerShell
  • Fix orphaned task-management-mcp cleanup to match by command line instead of window title
  • Add unit tests for Windows secret broker PowerShell wrapper and shutdown orphan cleanup

Related Issue

Windows port improvements (see WINDOWS_PORT_LOG.md known issues)

Changes

  • scripts/run-vitest.mjs — cross-platform Vitest launcher
  • src/main/shutdown-orphans.ts — safer Windows MCP process cleanup
  • src/main/secret-broker.ts — extract testable buildWindowsSecretShellScript()
  • package.json — test scripts use new launcher
  • CONTRIBUTING.md — note about cross-platform test commands

Testing

  • pnpm typecheck passes on Windows
  • pnpm test:run works in PowerShell
  • shutdown-orphans.test.ts and secret-broker.test.ts pass

dakshagarwal76 and others added 2 commits July 3, 2026 22:50
Add scripts/run-vitest.mjs so pnpm test:run works on Windows PowerShell.
Match orphaned task-management-mcp processes by command line instead of
window title. Add unit tests for the Windows secret broker PowerShell wrapper.

Co-authored-by: Cursor <cursoragent@cursor.com>
Extend Windows shutdown-orphans test timeout for slow Get-CimInstance.
Use accurate shutdown log message for best-effort MCP cleanup.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 5, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Windows compatibility by adding a cross-platform Vitest launcher, making Windows orphan MCP cleanup safer, and adding unit tests around Windows-specific wrappers and shutdown behavior.

Changes:

  • Add scripts/run-vitest.mjs and switch pnpm test* scripts to use it (so tests run from Windows PowerShell).
  • Refactor Windows orphan task-management-mcp cleanup into src/main/shutdown-orphans.ts and call it from main shutdown.
  • Extract buildWindowsSecretShellScript() and add unit tests for Windows PowerShell wrapper + orphan cleanup.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
WINDOWS_PORT_LOG.md Updates Windows port “known issues” notes to reflect new test coverage and cleanup approach.
src/main/shutdown-orphans.ts Centralizes cross-platform orphan MCP cleanup logic and exposes the kill command for tests.
src/main/shutdown-orphans.test.ts Adds tests for kill-command selection and shutdown behavior.
src/main/secret-broker.ts Extracts Windows PowerShell wrapper script generation into a testable function.
src/main/secret-broker.test.ts Adds unit tests validating the generated PowerShell wrapper script content.
src/main/index.ts Replaces inline orphan cleanup with killOrphanedMcpProcesses() call.
scripts/run-vitest.mjs Introduces a cross-platform Electron-as-Node Vitest launcher.
package.json Updates test scripts to use the new launcher.
CONTRIBUTING.md Documents the cross-platform test launcher behavior for contributors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +4
const WIN_ORPHAN_MCP_PS_COMMAND =
'Get-CimInstance Win32_Process -Filter "Name=\'node.exe\'" | Where-Object { $_.CommandLine -like \'*task-management-mcp*\' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }'
Comment on lines +1 to +2
import { describe, expect, it } from 'vitest'
import { getOrphanMcpKillCommand, killOrphanedMcpProcesses } from './shutdown-orphans'
Comment thread src/main/secret-broker.ts
Comment on lines +169 to +172
export function buildWindowsSecretShellScript(debugLogPath: string): string {
const debugLog = debugLogPath.replace(/\\/g, '\\\\')

const script = `# 20x Secret Shell Wrapper (Windows PowerShell)
return `# 20x Secret Shell Wrapper (Windows PowerShell)
Comment on lines +17 to +18
expect(script).toContain('^export\\s+([^=]+)=(.*)$')
expect(script).toContain('[Environment]::SetEnvironmentVariable')
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