Skip to content

feat: add Windows PowerShell setup script#31

Merged
CoderCoco merged 3 commits into
mainfrom
claude/add-windows-setup-script-eagqM
Apr 29, 2026
Merged

feat: add Windows PowerShell setup script#31
CoderCoco merged 3 commits into
mainfrom
claude/add-windows-setup-script-eagqM

Conversation

@CoderCoco
Copy link
Copy Markdown
Owner

Summary

Add a PowerShell equivalent of the existing setup.sh script to enable Windows developers to set up the Game Server Manager project with a single command.

Key Changes

  • New setup.ps1 script that provides Windows-native setup automation with the following functionality:
    • Prerequisite validation and installation (Node.js 20+, Terraform, AWS CLI v2)
    • Automatic tool installation via winget where available, with fallback to manual download for AWS CLI
    • npm workspace dependency installation and Lambda bundle building
    • S3 backend bucket creation with versioning, encryption, and public access blocking
    • DynamoDB lock table creation for Terraform state locking
    • Terraform initialization with automatic state migration from local to S3 backend
    • User-friendly setup guidance with next steps and Discord bot configuration instructions

Implementation Details

  • Uses PowerShell 5.1+ with strict error handling ($ErrorActionPreference = 'Stop')
  • Includes helper functions for command detection and tool installation
  • Parses terraform.tfvars to extract project name and AWS region for backend configuration
  • Handles region-specific S3 bucket creation (special handling for us-east-1)
  • Gracefully skips resource creation if S3 bucket or DynamoDB table already exist
  • Provides clear console output with progress indicators and actionable error messages
  • Mirrors the functionality and user experience of the existing bash setup script

https://claude.ai/code/session_01LHDg9ZNoZmERqW6zAN61bj

PowerShell equivalent of setup.sh covering the same steps: Node.js
20+ / Terraform / AWS CLI prerequisite checks with winget-based
auto-install, npm ci + Lambda bundle build, S3 + DynamoDB Terraform
backend bootstrap, and terraform init with optional state migration.

https://claude.ai/code/session_01LHDg9ZNoZmERqW6zAN61bj
Copilot AI review requested due to automatic review settings April 29, 2026 03:03
Update the prerequisites table, clone-and-bootstrap section, and
repository map to cover the new Windows PowerShell setup script,
including the execution-policy note for first-time Windows users.

https://claude.ai/code/session_01LHDg9ZNoZmERqW6zAN61bj
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Windows PowerShell bootstrap script to give Windows developers a one-command setup path equivalent to the existing setup.sh, covering prerequisites, JS workspace install/build, and Terraform backend bootstrapping + init.

Changes:

  • Add setup.ps1 implementing Windows-native setup flow (prereq checks/installs, npm ci, Lambda bundle build, S3+DynamoDB backend bootstrap).
  • Parse terraform/terraform.tfvars to derive backend bucket/table names and region.
  • Run terraform init with optional local→S3 state migration.

Comment thread setup.ps1 Outdated
Comment on lines +98 to +102
npm ci

Write-Host ""
Write-Host " Building Lambda bundles..."
npm run build:lambdas
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

$ErrorActionPreference='Stop' does not stop execution when a native command (npm/aws/terraform/winget/etc.) exits non-zero in PowerShell 5.1, so the script can continue and print "Setup complete" even after failures. Consider wrapping native invocations in a helper that throws on non-zero $LASTEXITCODE (or explicitly checking $LASTEXITCODE after each critical command).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in b32a077. Added an Invoke-Native helper that calls & $Block then throws if $LASTEXITCODE -ne 0, and wrapped every native invocation (winget, npm ci, npm run build:lambdas, all aws calls, and both terraform init variants) with it.


Generated by Claude Code

Comment thread setup.ps1
$ScriptDir = $PSScriptRoot

Write-Host ""
Write-Host " Game Server Manager - Setup"
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

PR title doesn’t follow the repo’s Conventional Commits requirement for squash-merge (it should start with a type like feat/fix/chore, optional scope, then ":"). Please retitle to something like "chore(setup): add Windows PowerShell setup script" (or another appropriate type/scope) so the merge commit subject is well-formed (see CONTRIBUTING.md "PR titles").

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed — PR title updated to feat: add Windows PowerShell setup script.


Generated by Claude Code

$ErrorActionPreference='Stop' only traps cmdlet errors in PowerShell 5.1,
not native executable exit codes. Add an Invoke-Native wrapper that checks
$LASTEXITCODE after every native call (winget, npm, aws, terraform) and
throws immediately on failure so the script can't silently reach "Setup
complete" after a partial failure.

https://claude.ai/code/session_01LHDg9ZNoZmERqW6zAN61bj
@CoderCoco CoderCoco changed the title Add Windows PowerShell setup script for Game Server Manager feat: add Windows PowerShell setup script Apr 29, 2026
@CoderCoco CoderCoco merged commit f53a39f into main Apr 29, 2026
7 checks passed
@CoderCoco CoderCoco deleted the claude/add-windows-setup-script-eagqM branch April 29, 2026 03:10
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.

3 participants