Skip to content

feat(windows): refactor fs module to work with both windows and unix #1901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cwoolum
Copy link
Collaborator

@cwoolum cwoolum commented May 20, 2025

Summary

This PR adds Windows support to the Amazon Q CLI by implementing platform-specific command execution and
filesystem operations. The changes ensure that the CLI works consistently across both Windows and Unix-based
systems.

Changes

  • Implemented platform-specific filesystem operations in a modular structure
  • Created separate modules for Unix and Windows implementations
  • Added proper handling of Windows paths and symlinks
  • Updated tests to use platform-agnostic paths
  • Fixed permission issues that were occurring on Windows systems

Implementation Details

  • Created a modular filesystem structure with platform-specific implementations:
    • fs/mod.rs: Common code and public interface
    • fs/unix.rs: Unix-specific implementations
    • fs/windows.rs: Windows-specific implementations
  • Added Windows-specific symlink handling that works without admin privileges
  • Implemented proper path handling for Windows using relative paths
  • Updated tool registration to use platform-appropriate naming

Testing

All tests have been updated to run on both Windows and Unix platforms by:

  • Using relative paths instead of absolute paths
  • Handling symlinks differently based on platform
  • Using platform-agnostic path manipulation

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.75%. Comparing base (f7cf836) to head (5727e0d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1901   +/-   ##
=======================================
  Coverage   16.75%   16.75%           
=======================================
  Files         213      213           
  Lines       20704    20704           
  Branches      871      871           
=======================================
  Hits         3468     3468           
  Misses      17236    17236           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cwoolum cwoolum changed the title feat(windows): fix tests to work for windows and refactor the fs mod feat(windows): refactor fs module to work with both windows and unix May 20, 2025
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