💫 Toolkit to help you get started with SDD or any other process!
fix: preserve feature numbering during reinitialization (#5101)
Shubham Padkonde600eba9df3a5
diff --git a/src/specify_cli/command_init.py b/src/specify_cli/command_init.pyindex 7d1536d4b..31fa2277d 100644--- a/src/specify_cli/command_init.py+++ b/src/specify_cli/command_init.py@@ -853,7 +853,7 @@ def register(app: typer.Typer) -> None:"integration": resolved_integration.key,"here": here,"script": selected_script,- "feature_numbering": "sequential",+ "feature_numbering": previous_init_options.get("feature_numbering", "sequential"),"speckit_version": get_speckit_version(),"allow_symlinks": allow_symlinks,}diff --git a/tests/specify_cli/test_command_init.py b/tests/specify_cli/test_command_init.pyindex e35344587..f932167cd 100644--- a/tests/specify_cli/test_command_init.py+++ b/tests/specify_cli/test_command_init.py@@ -17,6 +17,7 @@ escapes user-controlled display values; init.py was the outlier.from __future__ import annotationsimport importlib+import jsonimport osimport reimport subprocess@@ -93,6 +94,34 @@ def _init(tmp_path: Path, name: str):os.chdir(previous)[email protected]("numbering", ["timestamp", "sequential", None])+def test_reinit_preserves_feature_numbering(tmp_path: Path, monkeypatch, numbering):+ result = _init(tmp_path, "proj")+ assert result.exit_code == 0, _strip(result.stdout)+ project = tmp_path / "proj"+ options_path = project / ".specify" / "init-options.json"+ options = json.loads(options_path.read_text(encoding="utf-8"))+ assert options["feature_numbering"] == "sequential"+ if numbering is None:+ options.pop("feature_numbering")+ else:+ options["feature_numbering"] = numbering+ options["custom_setting"] = "keep me"+ options_path.write_text(json.dumps(options), encoding="utf-8")++ monkeypatch.chdir(project)+ result = CliRunner().invoke(app, [+ "init", "--here", "--force", "--integration", "generic",+ "--integration-options", "--commands-dir .agent/commands",+ "--script", "sh", "--non-interactive", "--ignore-agent-tools", "--offline",+ ])+ assert result.exit_code == 0, _strip(result.stdout)+ updated = json.loads(options_path.read_text(encoding="utf-8"))+ assert updated["feature_numbering"] == (numbering or "sequential")+ assert updated["custom_setting"] == "keep me"+ assert updated["here"] is True++@pytest.mark.parametrize("name", ["proj [v2]", "my[bold]app"])def test_next_steps_cd_shows_the_real_project_name(tmp_path: Path, name: str):"""The `cd` line must name the directory that was actually created."""