22# init-stats.ps1 — STATS.md Baseline-Generator v1.0 (PowerShell)
33# FR-REV-B04; Contract: init-stats-cli.md
44#
5- # Usage: pwsh scripts/init-stats.ps1 [-WorkspaceName <string >]
5+ # Usage: pwsh scripts/init-stats.ps1 [-WorkspaceName <name-or-path >]
66# Exit codes: 0=success, 1=error
77[CmdletBinding ()]
88param (
@@ -51,13 +51,15 @@ function Write-StatsEntry {
5151 $entry = " | $timestamp | $Score % | $bar |"
5252
5353 $dir = Split-Path $StatsFile - Parent
54- if (-not (Test-Path $dir )) { New-Item - ItemType Directory - Path $dir - Force | Out-Null }
54+ if (-not (Test-Path - LiteralPath $dir )) {
55+ New-Item - ItemType Directory - Path $dir - Force | Out-Null
56+ }
5557
56- if (Test-Path $StatsFile ) {
57- Add-Content - Path $StatsFile - Value $entry
58+ if (Test-Path - LiteralPath $StatsFile ) {
59+ Add-Content - LiteralPath $StatsFile - Value $entry
5860 } else {
59- $StatsHeader | Set-Content - Path $StatsFile
60- Add-Content - Path $StatsFile - Value $entry
61+ $StatsHeader | Set-Content - LiteralPath $StatsFile
62+ Add-Content - LiteralPath $StatsFile - Value $entry
6163 }
6264 Write-Host " ✓ STATS.md updated at $StatsFile "
6365}
@@ -78,12 +80,12 @@ function Resolve-TargetDir {
7880 param ([string ]$InputPath )
7981
8082 if (Test-Path - LiteralPath $InputPath - PathType Container) {
81- return (Resolve-Path $InputPath ).Path
83+ return (Resolve-Path - LiteralPath $InputPath ).Path
8284 }
8385
8486 $homeCandidate = Join-Path $HomeDir $InputPath
8587 if (Test-Path - LiteralPath $homeCandidate - PathType Container) {
86- return (Resolve-Path $homeCandidate ).Path
88+ return (Resolve-Path - LiteralPath $homeCandidate ).Path
8789 }
8890
8991 return $null
0 commit comments