Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Addresses the need to relocate the packages cache on space-constrained systems where C: drive is limited. Users can now move the cache to alternative drives (e.g., D:/ or E:/).

Changes

New commands:

  • winapp cache get-path - Display current cache location
  • winapp cache move <path> - Relocate cache with validation (empty/non-existent directories only)
  • winapp cache clear - Delete all cached packages (with confirmation)

Architecture:

  • Added ICacheService and CacheService for cache operations
  • Extended IWinappDirectoryService.GetPackagesDirectory() to resolve custom locations
  • Custom location persisted in ~/.winapp/cache-config.json
  • Updated 5 services (BuildToolsService, PackageCacheService, PackageInstallationService, MsixService, WorkspaceSetupService) to use GetPackagesDirectory() instead of hardcoded paths

Design:

  • Only the packages subfolder moves; .winapp remains in user directory for configuration
  • Backward compatible: defaults to ~/.winapp/packages when no custom location set
  • Existing WINAPP_CLI_CACHE_DIRECTORY environment variable still honored

Example Usage

# Check current location
winapp cache get-path

# Relocate cache
winapp cache move D:\WinAppCache

# Clear cache
winapp cache clear
Original prompt

This section details on the original issue you should resolve

<issue_title>Need to Set a Custom location for .winapp</issue_title>
<issue_description>Currently, the .winapp folder is placed in the user's directory.

However, on space constrained systems, these caches are usually placed on a different SSD. For example, I put all the caches I can on the D:/ or E:/ SSD drives as space on C: is a very high premium.

As a feature, I would like to have a way to set the cache directory, similar to how the nuget http and packages cache can be changed.

</issue_description>

<agent_instructions>Add this new command and subcommand to manage the packages cache. Make sure to add code to validate the passed folder for the move command (ensure it's empty or that it exists / if it doesn't exist, ask to create it). Add tests to ensure changing cache works</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@nmetulev Great idea. How about something like this?
winapp cache get-path # get current path of the .winapp folder
winapp cache move <new-path> # change the cache location and move existing cache there
winapp cache clear # clear the cache

we use the .winapp folder today for more than the cache (we need to store the value of the cache path somewhere :D) so we should move the packages subfolder under .winapp that is the actual cache and we move that instead of moving the full folder. </comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add custom location setting for .winapp cache Add cache location management commands for relocating .winapp packages Nov 13, 2025
Copilot AI requested a review from nmetulev November 13, 2025 19:15
Copilot finished work on behalf of nmetulev November 13, 2025 19:15
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.

Need to Set a Custom location for .winapp

3 participants