Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add custom specification directory support with --spec-dir option#1082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ahmet-cetinkaya wants to merge8 commits intogithub:main
base:main
Choose a base branch
Loading
fromahmet-cetinkaya:feat/add-context-path-options

Conversation

@ahmet-cetinkaya
Copy link
Contributor

@ahmet-cetinkayaahmet-cetinkaya commentedOct 28, 2025
edited
Loading

Summary

  • Add--spec-dir option tospecify init command for custom specification directories
  • Implement comprehensive validation with helpful error messages and edge case handling
  • Update templates and scripts to support dynamic spec directory references
  • Maintain full backward compatibility with defaultspecs/ directory

Description

This feature introduces significant flexibility to Spec Kit by allowing users to specify custom directory paths for their specifications instead of being limited to the defaultspecs/ directory.

Key Features

  • Custom Directory Support: Use--spec-dir docs/specs,--spec-dir requirements, or any valid relative path
  • Robust Validation: Comprehensive validation prevents:
    • Absolute paths and parent directory traversal attacks
    • Invalid characters with detailed error messages
    • Reserved names (Windows/Unix compatibility)
    • Excessive path lengths and filesystem constraints
  • Unicode Support: Full international character support with proper validation
  • Template Integration: Automatic replacement of hardcodedspecs/ references with custom directory names
  • Script Compatibility: Bash and PowerShell scripts support custom directories viaSPECIFY_SPEC_DIR environment variable

Implementation Details

  • Core Changes: Enhancedvalidate_spec_dir() function andinit command insrc/specify_cli/__init__.py
  • Template Updates: Dynamic{SPEC_DIR} placeholder support in template files
  • Script Integration: Updated shell scripts with environment variable support
  • Comprehensive Testing: 38 tests covering validation, integration, and edge cases

Usage Examples

# Default specs/ directory (unchanged behavior)specify init my-project# Custom spec directoryspecify init my-project --spec-dir docs/specsspecify init my-project --ai claude --spec-dir requirementsspecify init --here --ai copilot --spec-dir docs/feature-specs# Environment variable overrideexport SPECIFY_SPEC_DIR="docs/specs"# Scripts automatically use the custom directory

Test Plan

  • CLI functionality verification with--help command
  • init command testing with various spec directory scenarios
  • check command functionality verification
  • Full test suite execution (38 passed, 1 skipped for Windows-specific test)
  • Code quality and syntax validation
  • Integration testing with edge cases and error handling

Test Coverage

  • Unit Tests: Spec directory validation with comprehensive edge cases
  • Integration Tests: CLI command testing with various scenarios
  • Template Processing: Reference update functionality testing
  • Error Handling: User-friendly error message validation

Impact

  • Breaking Changes: None - fully backward compatible
  • Migration: Existing projects continue working with defaultspecs/ directory
  • Documentation: Updated README with examples and command documentation
  • Compatibility: Maintains compatibility with existing workflows and scripts

Files Changed

  • Core Implementation:src/specify_cli/__init__.py (+262 lines)
  • Templates: Update to support dynamic{SPEC_DIR} placeholder
  • Scripts: Bash and PowerShell integration with environment variable support
  • Tests: Comprehensive test suite with 38 tests (1,023 new lines of test code)
  • Documentation: Updated README and command templates

This enhancement represents a significant improvement to Spec Kit's flexibility while maintaining the robust specification-driven development workflow and ensuring excellent user experience through comprehensive validation and error handling.

yskkin, ahmet-cetinkaya, peterHoburg, keepitok, and J4UNE reacted with thumbs up emojiahmet-cetinkaya, Ivy-Chen1999, peterHoburg, and J4UNE reacted with rocket emojiJ4UNE reacted with eyes emoji
Adds ability to specify custom spec directory via --spec-dir parameter in specify init command. Updates CLI help documentation, refactors bash and PowerShell scripts to support custom directories via SPECIFY_SPEC_DIR environment variable, updates templates to use {SPEC_DIR} placeholder instead of hardcoded "specs", and adds validation for custom directory paths. Maintains backward compatibility by defaulting to "specs" directory.
Introduce pytest-based testing framework with dependencies and comprehensive validation suite for the new --spec-dir capability:- Add pytest and pytest-cov to project dependencies in pyproject.toml- Create test fixtures and configuration in conftest.py for consistent test setup- Implement 1100+ lines of test coverage across 5 specialized test modules- Cover edge cases including path traversal prevention, character validation, and unicode handling- Test both CLI integration and unit-level function validation- Verify file reference updates and directory renaming behaviorThe test infrastructure ensures reliability of the spec directory customization feature through thorough validation of input constraints, error handling, and functional correctness across multiple scenarios.
…ges and edge case handlingEnhance the spec directory validation system to provide better user experience and handle edge cases more robustly:- Improved validation with detailed error messages and helpful tips- Added support for Unicode characters in directory names- Enhanced parent traversal and absolute path detection- Added reserved Windows system name validation- Better control character and invalid character detection- More precise regex patterns in update_spec_directory_references function- Consolidated test coverage in test_validate_spec_dir.py with comprehensive scenarios- Removed redundant test file test_spec_dir_validation.py- Minor improvements to helper function sourcing in bash/powershell scriptsThese changes make validation more comprehensive while maintaining backward compatibility and providing clearer feedback to users when validation fails.
…anch- Merge new AI agents (shai, bob) with --spec-dir option support- Keep both rate limiting functions and spec directory validation- Preserve remote branch checking logic while maintaining clean code structure- Use {SPEC_DIR} variable in templates for custom spec directory support- Update documentation to include both new featuresAll functionality preserved:- --spec-dir option works for custom specification directories- New AI agents (shai, bob) are available- Enhanced error handling with rate limiting- Improved remote branch detection- Scripts support both custom spec dirs and new agents
Allow SPECIFY_SPEC_DIR environment variable to override default specs directory,providing more flexibility in configuration management.
Updated the spec_dir option to properly handle empty environment variablesby checking if the value exists and is not blank before using it,otherwise falling back to the default 'specs' directory.
…le functionalityAdds a new test file with extensive test coverage for the SPECIFY_SPEC_DIRenvironment variable, including validation of different path formats,fallback behavior when unset or empty, and precedence over command line flags.Also updates existing integration test to verify correct default spec dir usage.
…ssues- Fix MD060 table column style errors in docs/index.md, docs/upgrade.md, and docs/local-development.md  by converting tables to compact style with proper pipe spacing- Fix MD060 alignment errors in README.md, templates/analyze.md, and templates/plan-template.md  by adjusting table separator lines for compact style compliance- Fix MD005 list indentation error in templates/commands/specify.md- Fix MD029 ordered list prefix errors in templates/commands/clarify.md- Fix MD046 code block style false positive in templates/commands/clarify.mdTotal: 25 markdownlint errors resolved → 0 errors
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@localdenlocaldenAwaiting requested review from localdenlocalden is a code owner

At least 0 approving reviews are required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@ahmet-cetinkaya

[8]ページ先頭

©2009-2025 Movatter.jp