@@ -105,6 +105,19 @@ def test_json_output_keys(self, git_repo: Path):
105105 assert key in data , f"missing { key } in JSON: { data } "
106106 assert re .match (r"^\d{8}-\d{6}$" , data ["FEATURE_NUM" ])
107107
108+ def test_writes_feature_metadata_file (self , git_repo : Path ):
109+ """The create script persists .specify/feature.json for downstream commands."""
110+ import json
111+
112+ result = run_script (git_repo , "--json" , "--short-name" , "meta-test" , "Metadata test" )
113+ assert result .returncode == 0 , result .stderr
114+ data = json .loads (result .stdout )
115+
116+ metadata_file = git_repo / ".specify" / "feature.json"
117+ assert metadata_file .exists (), "feature metadata file was not created"
118+ metadata = json .loads (metadata_file .read_text (encoding = "utf-8" ))
119+ assert metadata == {"feature_directory" : f"specs/{ data ['BRANCH_NAME' ]} " }
120+
108121 def test_long_name_truncation (self , git_repo : Path ):
109122 """Test 5: Long branch name is truncated to <= 244 chars."""
110123 long_name = "a-" * 150 + "end"
@@ -774,3 +787,18 @@ def test_ps_dry_run_json_absent_without_flag(self, ps_git_repo: Path):
774787 assert result .returncode == 0 , result .stderr
775788 data = json .loads (result .stdout )
776789 assert "DRY_RUN" not in data , f"DRY_RUN should not be in normal JSON: { data } "
790+
791+ def test_ps_writes_feature_metadata_file (self , ps_git_repo : Path ):
792+ """PowerShell create script persists .specify/feature.json."""
793+ import json
794+
795+ result = run_ps_script (
796+ ps_git_repo , "-Json" , "-ShortName" , "ps-meta" , "PowerShell metadata"
797+ )
798+ assert result .returncode == 0 , result .stderr
799+ data = json .loads (result .stdout )
800+
801+ metadata_file = ps_git_repo / ".specify" / "feature.json"
802+ assert metadata_file .exists (), "feature metadata file was not created"
803+ metadata = json .loads (metadata_file .read_text (encoding = "utf-8-sig" ))
804+ assert metadata == {"feature_directory" : f"specs/{ data ['BRANCH_NAME' ]} " }
0 commit comments