Skip to content

Specs Directory Created at Git Root Instead of Project Root #1151

@nicolasstelter

Description

@nicolasstelter

Issue: Specs Directory Created at Git Root Instead of Project Root

Date: 2025-01-27
Status: Fixed
Related: .specify/scripts/powershell/create-new-feature.ps1

Problem

When running /speckit.specify, the specs directory was being created at the git repository root (C:/Users/info/dev) instead of the project root where the .specify marker exists. I'm not sure if that makes sense.

Root Cause

The create-new-feature.ps1 script prioritized git rev-parse --show-toplevel over the .specify marker location. In repositories where the git root is a parent directory of the actual project (which has the .specify marker), this caused specs to be created in the wrong location.

Solution

Updated the script to prefer .specify marker location over git root:

  1. Check if current directory or any parent has a .specify marker
  2. If found, use that as the project root (even if git root differs)
  3. Fall back to git root only if no .specify marker exists

Changes Made

  • Modified repository root detection logic in create-new-feature.ps1 (lines 130-164)
  • Added explicit check for .specify marker before using git root
  • Ensures specs are created in the correct project directory

Impact

  • Future specs will be created in the correct project directory
  • Existing specs may need to be moved manually if created in wrong location
  • Script now respects project boundaries defined by .specify marker

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions