github / github/spec-kit

[Bug]: PowerShell common.ps1 uses wrong base path for specs directory

Abierto
#1,923 3 comentarios 0 reacciones 0 asignados Ver en GitHub
stale
Lenguaje dominante
Python
Estrellas
137k
Forks
12.3k
Merge medio
2 d 12 h
PR fusionados (30 d)
159

Descripción

### Bug Description

The PowerShell common functions in `.specify/scripts/powershell/common.ps1` use incorrect paths, causing spec files to be created in `specs/` at the repository root instead of `.specify/specs/` as documented and expected by the framework.

### Steps to Reproduce

1. Clone a spec-kit project
2. Check out a feature branch (e.g., `feature/US123-my-feature`)
3. Run `.specify/scripts/powershell/setup-plan.ps1 -Json`
4. Observe files are created in `specs/feature/US123-my-feature/` instead of `.specify/specs/US123-my-feature/`

### Expected Behavior

All spec files should be created under the `.specify/specs/` directory as documented throughout the framework and in `.specify/specs/README.md`.

### Actual Behavior

- Files are created in `specs/` at the repository root (wrong location)
- When using feature branches like `feature/something`, an extra nested `feature/` directory is created: `specs/feature/something/`
- This violates the documented `.specify/` prefix convention
- Requires manual cleanup after every planning operation

### Specify CLI Version

0.2.1

### AI Agent

GitHub Copilot

### Operating System

Windows 10.0.26200 AMD64

### Python Version

3.12.4

### Error Logs

```shell

```

### Additional Context

## Component

Scripts (.specify/scripts/)

## AI Agent (if applicable)

Affects all agents that use `/speckit.plan`, `/speckit.tasks`, and related commands

## Additional Context

- This affects all PowerShell-based workflows
- The bash version (`common.sh`) likely has similar issues if it exists
- Working fix tested in production: https://ghe.coxautoinc.com/deCipher/TestingbyRallyCards/commit/abc54be

- ## Root Cause

**File**: `.specify/scripts/powershell/common.ps1`

**Line 38** (in `Get-CurrentBranch` function):
```powershell
$specsDir = Join-Path $repoRoot "specs"
```
Should be:
```powershell
$specsDir = Join-Path $repoRoot ".specify/specs"
```

**Line 98** (in `Get-FeatureDir` function):
```powershell
Join-Path $repoRoot "specs/$Branch"
```
Should be:
```powershell
$dirName = $Branch -replace '^feature/', '' # Strip branch prefix
Join-Path $repoRoot ".specify/specs/$dirName"
```
## Proposed Fix

```powershell
function Get-FeatureDir {
param([string]$RepoRoot, [string]$Branch)
# Strip feature/ prefix if present for specs directory naming
$dirName = $Branch -replace '^feature/', ''
Join-Path $RepoRoot ".specify/specs/$dirName"
}
```

Also update line 38 in `Get-CurrentBranch`:
```powershell
$specsDir = Join-Path $repoRoot ".specify/specs"
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.