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(cli): add --local-templates option for local development testing #1386

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
serhiishtokal wants to merge 2 commits into github:main
base: main
Choose a base branch
Loading
from serhiishtokal:feature/cli-local-templates

Conversation

@serhiishtokal
Copy link

@serhiishtokal serhiishtokal commented Dec 25, 2025

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

@serhiishtokal serhiishtokal Dec 25, 2025

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

Reviewers

Copilot code review Copilot Copilot left review comments

@localden localden Awaiting requested review from localden localden 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

AltStyle によって変換されたページ (->オリジナル) /