Skip to content

Commit 7c35d66

Browse files
Fix powershell files
1 parent d5fd598 commit 7c35d66

File tree

5 files changed

+89
-89
lines changed

5 files changed

+89
-89
lines changed

.specify/scripts/powershell/check-prerequisites.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $ErrorActionPreference = 'Stop'
2727

2828
# Show help if requested
2929
if ($Help) {
30-
Write-Output @"
30+
Write-Output @'
3131
Usage: check-prerequisites.ps1 [OPTIONS]
3232
3333
Consolidated prerequisite checking for Spec-Driven Development workflow.
@@ -42,14 +42,14 @@ OPTIONS:
4242
EXAMPLES:
4343
# Check task prerequisites (plan.md required)
4444
.\check-prerequisites.ps1 -Json
45-
45+
4646
# Check implementation prerequisites (plan.md + tasks.md required)
4747
.\check-prerequisites.ps1 -Json -RequireTasks -IncludeTasks
48-
48+
4949
# Get feature paths only (no validation)
5050
.\check-prerequisites.ps1 -PathsOnly
5151
52-
"@
52+
'@
5353
exit 0
5454
}
5555

@@ -59,8 +59,8 @@ EXAMPLES:
5959
# Get feature paths and validate branch
6060
$paths = Get-FeaturePathsEnv
6161

62-
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit:$paths.HAS_GIT)) {
63-
exit 1
62+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit:$paths.HAS_GIT)) {
63+
exit 1
6464
}
6565

6666
# If paths-only mode, output paths and exit (support combined -Json -PathsOnly)
@@ -88,20 +88,20 @@ if ($PathsOnly) {
8888
# Validate required directories and files
8989
if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) {
9090
Write-Output "ERROR: Feature directory not found: $($paths.FEATURE_DIR)"
91-
Write-Output "Run /specify first to create the feature structure."
91+
Write-Output 'Run /specify first to create the feature structure.'
9292
exit 1
9393
}
9494

9595
if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
9696
Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)"
97-
Write-Output "Run /plan first to create the implementation plan."
97+
Write-Output 'Run /plan first to create the implementation plan.'
9898
exit 1
9999
}
100100

101101
# Check for tasks.md if required
102102
if ($RequireTasks -and -not (Test-Path $paths.TASKS -PathType Leaf)) {
103103
Write-Output "ERROR: tasks.md not found in $($paths.FEATURE_DIR)"
104-
Write-Output "Run /tasks first to create the task list."
104+
Write-Output 'Run /tasks first to create the task list.'
105105
exit 1
106106
}
107107

@@ -113,36 +113,36 @@ if (Test-Path $paths.RESEARCH) { $docs += 'research.md' }
113113
if (Test-Path $paths.DATA_MODEL) { $docs += 'data-model.md' }
114114

115115
# Check contracts directory (only if it exists and has files)
116-
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
117-
$docs += 'contracts/'
116+
if ((Test-Path $paths.CONTRACTS_DIR) -and (Get-ChildItem -Path $paths.CONTRACTS_DIR -ErrorAction SilentlyContinue | Select-Object -First 1)) {
117+
$docs += 'contracts/'
118118
}
119119

120120
if (Test-Path $paths.QUICKSTART) { $docs += 'quickstart.md' }
121121

122122
# Include tasks.md if requested and it exists
123-
if ($IncludeTasks -and (Test-Path $paths.TASKS)) {
124-
$docs += 'tasks.md'
123+
if ($IncludeTasks -and (Test-Path $paths.TASKS)) {
124+
$docs += 'tasks.md'
125125
}
126126

127127
# Output results
128128
if ($Json) {
129129
# JSON output
130-
[PSCustomObject]@{
131-
FEATURE_DIR = $paths.FEATURE_DIR
132-
AVAILABLE_DOCS = $docs
130+
[PSCustomObject]@{
131+
FEATURE_DIR = $paths.FEATURE_DIR
132+
AVAILABLE_DOCS = $docs
133133
} | ConvertTo-Json -Compress
134134
} else {
135135
# Text output
136136
Write-Output "FEATURE_DIR:$($paths.FEATURE_DIR)"
137-
Write-Output "AVAILABLE_DOCS:"
138-
137+
Write-Output 'AVAILABLE_DOCS:'
138+
139139
# Show status of each potential document
140140
Test-FileExists -Path $paths.RESEARCH -Description 'research.md' | Out-Null
141141
Test-FileExists -Path $paths.DATA_MODEL -Description 'data-model.md' | Out-Null
142142
Test-DirHasFiles -Path $paths.CONTRACTS_DIR -Description 'contracts/' | Out-Null
143143
Test-FileExists -Path $paths.QUICKSTART -Description 'quickstart.md' | Out-Null
144-
144+
145145
if ($IncludeTasks) {
146146
Test-FileExists -Path $paths.TASKS -Description 'tasks.md' | Out-Null
147147
}
148-
}
148+
}

.specify/scripts/powershell/common.ps1

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ function Get-RepoRoot {
1010
} catch {
1111
# Git command failed
1212
}
13-
13+
1414
# Fall back to script location for non-git repos
15-
return (Resolve-Path (Join-Path $PSScriptRoot "../../..")).Path
15+
return (Resolve-Path (Join-Path $PSScriptRoot '../../..')).Path
1616
}
1717

1818
function Get-CurrentBranch {
1919
# First check if SPECIFY_FEATURE environment variable is set
2020
if ($env:SPECIFY_FEATURE) {
2121
return $env:SPECIFY_FEATURE
2222
}
23-
23+
2424
# Then check git if available
2525
try {
2626
$result = git rev-parse --abbrev-ref HEAD 2>$null
@@ -30,15 +30,15 @@ function Get-CurrentBranch {
3030
} catch {
3131
# Git command failed
3232
}
33-
33+
3434
# For non-git repos, try to find the latest feature directory
3535
$repoRoot = Get-RepoRoot
36-
$specsDir = Join-Path $repoRoot "specs"
37-
36+
$specsDir = Join-Path $repoRoot 'specs'
37+
3838
if (Test-Path $specsDir) {
39-
$latestFeature = ""
39+
$latestFeature = ''
4040
$highest = 0
41-
41+
4242
Get-ChildItem -Path $specsDir -Directory | ForEach-Object {
4343
if ($_.Name -match '^(\d{3})-') {
4444
$num = [int]$matches[1]
@@ -48,14 +48,14 @@ function Get-CurrentBranch {
4848
}
4949
}
5050
}
51-
51+
5252
if ($latestFeature) {
5353
return $latestFeature
5454
}
5555
}
56-
56+
5757
# Final fallback
58-
return "main"
58+
return 'main'
5959
}
6060

6161
function Test-HasGit {
@@ -72,16 +72,16 @@ function Test-FeatureBranch {
7272
[string]$Branch,
7373
[bool]$HasGit = $true
7474
)
75-
75+
7676
# For non-git repos, we can't enforce branch naming but still provide output
7777
if (-not $HasGit) {
78-
Write-Warning "[specify] Warning: Git repository not detected; skipped branch validation"
78+
Write-Warning '[specify] Warning: Git repository not detected; skipped branch validation'
7979
return $true
8080
}
81-
81+
8282
if ($Branch -notmatch '^[0-9]{3}-') {
8383
Write-Output "ERROR: Not on a feature branch. Current branch: $Branch"
84-
Write-Output "Feature branches should be named like: 001-feature-name"
84+
Write-Output 'Feature branches should be named like: 001-feature-name'
8585
return $false
8686
}
8787
return $true
@@ -97,19 +97,19 @@ function Get-FeaturePathsEnv {
9797
$currentBranch = Get-CurrentBranch
9898
$hasGit = Test-HasGit
9999
$featureDir = Get-FeatureDir -RepoRoot $repoRoot -Branch $currentBranch
100-
100+
101101
[PSCustomObject]@{
102-
REPO_ROOT = $repoRoot
102+
REPO_ROOT = $repoRoot
103103
CURRENT_BRANCH = $currentBranch
104-
HAS_GIT = $hasGit
105-
FEATURE_DIR = $featureDir
106-
FEATURE_SPEC = Join-Path $featureDir 'spec.md'
107-
IMPL_PLAN = Join-Path $featureDir 'plan.md'
108-
TASKS = Join-Path $featureDir 'tasks.md'
109-
RESEARCH = Join-Path $featureDir 'research.md'
110-
DATA_MODEL = Join-Path $featureDir 'data-model.md'
111-
QUICKSTART = Join-Path $featureDir 'quickstart.md'
112-
CONTRACTS_DIR = Join-Path $featureDir 'contracts'
104+
HAS_GIT = $hasGit
105+
FEATURE_DIR = $featureDir
106+
FEATURE_SPEC = Join-Path $featureDir 'spec.md'
107+
IMPL_PLAN = Join-Path $featureDir 'plan.md'
108+
TASKS = Join-Path $featureDir 'tasks.md'
109+
RESEARCH = Join-Path $featureDir 'research.md'
110+
DATA_MODEL = Join-Path $featureDir 'data-model.md'
111+
QUICKSTART = Join-Path $featureDir 'quickstart.md'
112+
CONTRACTS_DIR = Join-Path $featureDir 'contracts'
113113
}
114114
}
115115

.specify/scripts/powershell/create-new-feature.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ param(
99
$ErrorActionPreference = 'Stop'
1010

1111
if (-not $FeatureDescription -or $FeatureDescription.Count -eq 0) {
12-
Write-Error "Usage: ./create-new-feature.ps1 [-Json] <feature description>"
12+
Write-Error 'Usage: ./create-new-feature.ps1 [-Json] <feature description>'
1313
exit 1
1414
}
1515
$featureDesc = ($FeatureDescription -join ' ').Trim()
@@ -39,7 +39,7 @@ function Find-RepositoryRoot {
3939
}
4040
$fallbackRoot = (Find-RepositoryRoot -StartDir $PSScriptRoot)
4141
if (-not $fallbackRoot) {
42-
Write-Error "Error: Could not determine repository root. Please run this script from within the repository."
42+
Write-Error 'Error: Could not determine repository root. Please run this script from within the repository.'
4343
exit 1
4444
}
4545

@@ -48,7 +48,7 @@ try {
4848
if ($LASTEXITCODE -eq 0) {
4949
$hasGit = $true
5050
} else {
51-
throw "Git not available"
51+
throw 'Git not available'
5252
}
5353
} catch {
5454
$repoRoot = $fallbackRoot
@@ -91,21 +91,21 @@ New-Item -ItemType Directory -Path $featureDir -Force | Out-Null
9191

9292
$template = Join-Path $repoRoot '.specify/templates/spec-template.md'
9393
$specFile = Join-Path $featureDir 'spec.md'
94-
if (Test-Path $template) {
95-
Copy-Item $template $specFile -Force
96-
} else {
97-
New-Item -ItemType File -Path $specFile | Out-Null
94+
if (Test-Path $template) {
95+
Copy-Item $template $specFile -Force
96+
} else {
97+
New-Item -ItemType File -Path $specFile | Out-Null
9898
}
9999

100100
# Set the SPECIFY_FEATURE environment variable for the current session
101101
$env:SPECIFY_FEATURE = $branchName
102102

103103
if ($Json) {
104-
$obj = [PSCustomObject]@{
104+
$obj = [PSCustomObject]@{
105105
BRANCH_NAME = $branchName
106-
SPEC_FILE = $specFile
106+
SPEC_FILE = $specFile
107107
FEATURE_NUM = $featureNum
108-
HAS_GIT = $hasGit
108+
HAS_GIT = $hasGit
109109
}
110110
$obj | ConvertTo-Json -Compress
111111
} else {

.specify/scripts/powershell/setup-plan.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ $ErrorActionPreference = 'Stop'
1111

1212
# Show help if requested
1313
if ($Help) {
14-
Write-Output "Usage: ./setup-plan.ps1 [-Json] [-Help]"
15-
Write-Output " -Json Output results in JSON format"
16-
Write-Output " -Help Show this help message"
14+
Write-Output 'Usage: ./setup-plan.ps1 [-Json] [-Help]'
15+
Write-Output ' -Json Output results in JSON format'
16+
Write-Output ' -Help Show this help message'
1717
exit 0
1818
}
1919

@@ -24,16 +24,16 @@ if ($Help) {
2424
$paths = Get-FeaturePathsEnv
2525

2626
# Check if we're on a proper feature branch (only for git repos)
27-
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit $paths.HAS_GIT)) {
28-
exit 1
27+
if (-not (Test-FeatureBranch -Branch $paths.CURRENT_BRANCH -HasGit $paths.HAS_GIT)) {
28+
exit 1
2929
}
3030

3131
# Ensure the feature directory exists
3232
New-Item -ItemType Directory -Path $paths.FEATURE_DIR -Force | Out-Null
3333

3434
# Copy plan template if it exists, otherwise note it or create empty file
3535
$template = Join-Path $paths.REPO_ROOT '.specify/templates/plan-template.md'
36-
if (Test-Path $template) {
36+
if (Test-Path $template) {
3737
Copy-Item $template $paths.IMPL_PLAN -Force
3838
Write-Output "Copied plan template to $($paths.IMPL_PLAN)"
3939
} else {
@@ -44,12 +44,12 @@ if (Test-Path $template) {
4444

4545
# Output results
4646
if ($Json) {
47-
$result = [PSCustomObject]@{
47+
$result = [PSCustomObject]@{
4848
FEATURE_SPEC = $paths.FEATURE_SPEC
49-
IMPL_PLAN = $paths.IMPL_PLAN
50-
SPECS_DIR = $paths.FEATURE_DIR
51-
BRANCH = $paths.CURRENT_BRANCH
52-
HAS_GIT = $paths.HAS_GIT
49+
IMPL_PLAN = $paths.IMPL_PLAN
50+
SPECS_DIR = $paths.FEATURE_DIR
51+
BRANCH = $paths.CURRENT_BRANCH
52+
HAS_GIT = $paths.HAS_GIT
5353
}
5454
$result | ConvertTo-Json -Compress
5555
} else {

0 commit comments

Comments
 (0)