Windows compatibility

From bradygaster/squad · View interactive version

Windows compatibility is an AI agent skill from the GitHub repository bradygaster/squad. Cross-platform path handling and command patterns

How to use this skill

Skill file

Context

Squad runs on Windows, macOS, and Linux. Several bugs have been traced to platform-specific assumptions: ISO timestamps with colons (illegal on Windows), git -C with Windows paths (unreliable), forward-slash paths in Node.js on Windows.

Patterns

Filenames & Timestamps

Git Commands

Commit Messages

Paths

Path Comparison (Case Sensitivity)

```typescript

import path from 'node:path';

function normalizeForRootComparison(value: string, volumeIsCaseInsensitive = false): string {

return volumeIsCaseInsensitive ? value.toLowerCase() : value;

}

function isPathWithin(candidate: string, rootDir: string, volumeIsCaseInsensitive = false): boolean {

const a = normalizeForRootComparison(path.resolve(candidate), volumeIsCaseInsensitive);

const b = normalizeForRootComparison(path.resolve(rootDir), volumeIsCaseInsensitive);

const boundary = b.replace(/[\\/]+$/, '') + path.sep;

return a === b || a.startsWith(boundary);

}

```

Repairing Stale LF-Pinned Working Trees

An eol=lf attribute affects checkout behavior; it does not repair files that were already

materialized with CRLF. For the known shebang failure mode, use the repository's

scripts/fix-crlf-worktree.mjs rather than a broad renormalization:

  1. Identify LF-pinned files that are CRLF on disk.
  2. Exclude files with a real content difference from the index.
  3. Rewrite only content-clean paths from the index with git checkout-index -f.
  4. Re-measure the complete repair set and report repaired, skipped, and remaining paths.

This is a local repair, not a source rewrite. Do not use git add --renormalize .; it rewrites

the index and creates unrelated line-ending churn. Do not force-checkout a locally modified file.

Examples

✓ Correct:

# Timestamp utility
$safeTimestamp = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH-mm-ssZ')

# Git workflow (PowerShell)
cd $teamRoot
# NEVER use `git add .squad/` or broad globs — only stage files you intentionally changed
# Stage only files you actually modified — use git status to build explicit list
$filesToStage = git status --porcelain | Where-Object { $_.Length -gt 3 } | ForEach-Object { $_.Substring(3) -replace '^.* -> ','' } | Where-Object {
  $_ -eq '.squad/decisions.md' -or
  $_ -eq '.squad/decisions-archive.md' -or
  $_ -like '.squad/agents/*/history.md' -or
  $_ -like '.squad/agents/*/history-archive.md'
}
if ($filesToStage) { $filesToStage | Where-Object { $_ } | ForEach-Object { git add -- $_ } }
git diff --cached --quiet
if ($LASTEXITCODE -ne 0) {
  $msg = @"
docs(ai-team): session log

Changes:
- Added decisions
"@
  $msgFile = [System.IO.Path]::GetTempFileName()
  Set-Content -Path $msgFile -Value $msg -Encoding utf8
  git commit -F $msgFile
  Remove-Item $msgFile
}

✗ Incorrect:

// Colon in filename
const logPath = `.squad/log/${new Date().toISOString()}.md`; // ILLEGAL on Windows

// git -C with Windows path
exec('git -C C:\\src\\squad add .squad/'); // UNRELIABLE

// Inline newlines in commit message
exec('git commit -m "First line\nSecond line"'); // FAILS silently in PowerShell

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.