feat(cli): add specify extension init scaffolding command#1929
feat(cli): add specify extension init scaffolding command#1929mvanhorn wants to merge 1 commit intogithub:mainfrom
specify extension init scaffolding command#1929Conversation
Add a new `specify extension init <name>` subcommand that scaffolds a ready-to-develop extension directory from the built-in template. Substitutes extension metadata (ID, name, author, description, repository URL, date) into all template files. The extension ecosystem has 23+ community extensions, all manually created by copying extensions/template/. This command completes the extension authoring lifecycle - every other stage (search, add, remove, enable, disable, update, catalog management) already has CLI support. Features: - Extension ID validation (lowercase, hyphen-separated) - Interactive prompts when CLI args are omitted - --output flag for custom output directory - --no-git flag to skip git initialization - Replaces EXAMPLE-README.md as the new README.md - Prints next-steps guidance panel Includes 23 pytest test cases covering validation, placeholder substitution, CLI integration, and edge cases.
|
When an extension gets added / removed / enabled or disabled this should happen automatically. So while this is indeed needed it should not be a separate command as it will easily be forgotten. If that is not happening it is a bug. |
|
Good point - auto-scaffolding on extension add/remove/enable/disable would be more reliable than a separate command. I can rework this to hook into the extension lifecycle instead. Would you prefer the scaffolding runs as part of |
|
@mvanhorn As part of the add if the extension is auto-enable (most are) or at enable time |
|
Got it - I'll rework this to run scaffolding as part of |
Description
Add a
specify extension init <name>subcommand that scaffolds a new extension directory from the built-in template (extensions/template/), substituting user-provided metadata into all placeholder values.The extension ecosystem has 23+ community extensions published to the catalog, each manually created by copying
extensions/template/and hand-editing 7 files. Every other stage of the extension lifecycle has CLI support (search, add, remove, enable, disable, update, set-priority, catalog management) - except creation. This closes that gap.What it does:
extensions/template/tospec-kit-<name>/in the current or specified directory^[a-z][a-z0-9]*(-[a-z0-9]+)*$)EXAMPLE-README.mdas the newREADME.md--no-gitto skip)specify initUsage:
This command does NOT require a spec-kit project - you can scaffold an extension anywhere, then test it with
specify extension add --dev /path/to/extension.The template source is resolved from the installed package first (works in wheel/air-gapped), falling back to the source tree layout.
Testing
pytest- all 810 existing tests passtests/test_extension_init.py:specify extension init my-test --no-gitproduces a working extension directory with all placeholders replacedAI Disclosure
This contribution was developed with AI assistance (Claude Code). The implementation follows existing patterns from the
specify initcommand andextension addsubcommand.