Skip to content

Conversation

@serhiishtokal
Copy link

Summary

Adds a --local-templates CLI option to enable loading templates from a local directory instead of GitHub releases. This improves the development workflow described in the "Testing template and command changes locally" section of CONTRIBUTING.md https://github.com/github/spec-kit/blob/main/CONTRIBUTING.md#testing-template-and-command-changes-locally

Motivation

Currently, testing local template changes requires manually copying packages (step 2 in CONTRIBUTING.md). This feature allows developers to test directly with:

specify init . --local-templates ".genreleases"

Changes

  • Added load_template_from_local() function in src/specify_cli/__init__.py
  • Added --local-templates parameter to the init command
  • Local template files are preserved after extraction (not deleted)
  • Updated README.md with CLI option documentation and usage example
  • Updated CONTRIBUTING.md local testing section with --local-templates workflow

Testing

I have personally tested these changes:

  • ✅ Verified with specify init . --ai claude --local-templates ".genreleases"
  • ✅ Confirmed template extraction works correctly
  • ✅ Confirmed local zip files are preserved after use
  • ✅ Tested error handling with invalid directory paths

AI Disclosure

This PR was developed with assistance from Antigravity IDE powered by Claude Opus 4.5 (Anthropic's AI coding assistant).

Add support for loading templates from a local directory instead of
GitHub releases. This enables testing template and CLI changes locally
before publishing.

- New load_template_from_local() function with input validation
- Validates directory exists and is accessible
- Preserves local template files (doesn't delete after extraction)
- Displays [DEV MODE] indicator in output
Copilot AI review requested due to automatic review settings December 25, 2025 00:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a --local-templates CLI option to enable loading templates from a local directory instead of GitHub releases, improving the development workflow for contributors testing local template changes.

Key Changes

  • Added load_template_from_local() function to load templates from local .genreleases directory
  • Modified download_and_extract_template() to support local template loading via optional local_dir parameter
  • Updated CLI documentation in README.md and CONTRIBUTING.md with usage examples

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/specify_cli/init.py Implements local template loading functionality with new function and parameter integration
README.md Documents the new --local-templates CLI option with example usage
CONTRIBUTING.md Updates local testing workflow to use --local-templates instead of manual copying

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 674 to 675
# Sort alphabetically - versions like v1.0.0, v1.0.1 will order correctly
zip_path = sorted(matches)[-1]
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alphabetical sorting of version strings may not work correctly for all semantic version formats. For example, "v1.10.0" would sort before "v1.9.0" alphabetically, which is incorrect. Consider using a more robust version sorting method, such as extracting the version numbers and comparing them numerically, or using a library like packaging.version for proper semantic version comparison.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I removed the sorting since we usually only have one file locally anyway. Keeps it simple and avoids the sorting bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant