This script simulates a fresh installation of the project, including a clean git environment, to verify that everything works as expected for new users.
- Creates a temporary directory for testing
- Saves and clears current git config (user.name and user.email) to simulate a fresh git installation
- Sets temporary test git credentials
- Clones the repository from GitHub
- Checks out the specified tag (default: v0.1.1)
- Installs dependencies using
uv sync - Runs all tests with pytest
- Runs linting checks (ruff and pyrefly)
- Restores original git config
- Cleans up temporary directory
.\test-clean-install.ps1.\test-clean-install.ps1 -Tag "v0.2.0".\test-clean-install.ps1 -KeepTemp.\test-clean-install.ps1 -SkipLint.\test-clean-install.ps1 -Tag "v0.1.1" -KeepTemp -SkipLint-Tag <string>: Git tag to checkout (default: "v0.1.1")-KeepTemp: Don't delete the temporary directory after testing-SkipLint: Skip ruff and pyrefly checks, run tests only
0: All checks passed1: One or more checks failed
==================================================
Clean Installation Test for code-trajectory-mcp
==================================================
[1/8] Creating temporary directory: C:\Users\...\Temp\code-trajectory-test-20251203-221530
[2/8] Saving current git config...
[3/8] Simulating fresh git installation (clearing git config)...
[4/8] Setting temporary test git config...
[5/8] Cloning repository from GitHub...
[6/8] Checking out tag: v0.1.1
[7/8] Installing dependencies with uv sync...
[8/8] Running tests...
====== TEST OUTPUT ======
...
=========================
Running linting checks...
--- Ruff Check ---
...
--- Pyrefly Check ---
...
==================================================
TEST SUMMARY
==================================================
[✓] Tests: PASSED
[✓] Ruff: PASSED
[✓] Pyrefly: PASSED
Test directory: C:\Users\...\Temp\code-trajectory-test-20251203-221530
✓ All checks passed!
Restoring original git config...
Cleaning up temporary directory...
✓ Cleanup complete
- Git config restoration: Your original git user.name and user.email are always restored, even if the script fails
- Error handling: Uses PowerShell's error handling to ensure cleanup runs
- Unique temp directories: Uses timestamps to avoid conflicts
- Optional cleanup: Use
-KeepTempto inspect the test environment
- Pre-release testing: Verify that a new version works from scratch
- CI simulation: Test the same environment that CI uses
- Bug reproduction: Test with a clean state when debugging issues
- Documentation verification: Ensure the setup process works for new users