feat(scripts): port create-new-feature, setup-plan and setup-tasks to Python
Description
Ports the three core workflow scripts to Python, per #3280. Follows the pattern established by the check-prerequisites PoC (#3302): additive port with parity tests that run the bash and Python versions side by side and compare output. Two small non-additive touches: templates/commands/plan.md and templates/commands/tasks.md gain a scripts.py entry, and resolve_skill_placeholders accepts py as a script variant (with interpreter prefixing and a fallback when a command's frontmatter lacks the configured variant).
Scope:
scripts/python/create_new_feature.py— port ofcreate-new-feature.sh, including branch-name generation (stop words, acronym detection, word limits), feature numbering (specs scan + timestamp-dir handling), the 244-char ref-length truncation,--allow-existing-branchmode, andfeature.jsonpersistence (byte-identical to the jq output).scripts/python/setup_plan.py— port ofsetup-plan.sh, including plan template resolution and the status messages that go to stderr in--jsonmode.scripts/python/setup_tasks.py— port ofsetup-tasks.sh, including plan/spec validation and the tasks-template requirement.scripts/python/common.py— addsresolve_template()(overrides → presets via registry → extensions → core), shared by the three scripts above.tests/parity_helpers.py— shared fixtures/helpers for parity tests, extracted from the pattern intest_check_prerequisites_python_parity.py.- 25 parity tests across three files: exact JSON equality against bash, normalized text output, PowerShell JSON parity (skipped when
pwshis unavailable).
One deliberate deviation: --number abc produces a clean error message in Python where bash surfaces a raw arithmetic error (10#abc: value too great for base). The parity test asserts exit code and empty stdout for that case, not the stderr text.
Testing
- [x] Tested locally with
uv run specify --help - [x] Ran existing tests with
uv sync && uv run pytest(3801 passed, 110 skipped) - [x] Manual side-by-side runs of bash vs Python on a sample repo (23 cases: numbering, stop words, acronyms, truncation, collision handling, JSON/text modes)
AI Disclosure
- [ ] I did not use AI assistance for this contribution
- [x] I did use AI assistance (describe below)
Ported and tested with GitHub Copilot CLI. I reviewed the diff and verified parity behavior manually.
Fixes #3280
@copilot review
Please address Copilot feedback and resolve conflicts
@copilot review
@copilot review
Please address Copilot feedback
@copilot review
Please address Copilot feedback
@copilot review
Please address Copilot feedback. If not applicable, please explain why
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review
@copilot review