@@ -186,6 +186,8 @@ def test_load_catalog_reads_recipe_entries(tmp_path: Path) -> None:
186186 "source" : "./demo" ,
187187 "trusted" : True ,
188188 "description" : "demo plugin" ,
189+ "docs_url" : "https://example.com/demo/readme" ,
190+ "requires_env" : ["DEMO_TOKEN" ],
189191 }
190192 }
191193 }
@@ -197,6 +199,8 @@ def test_load_catalog_reads_recipe_entries(tmp_path: Path) -> None:
197199 assert "demo" in catalog
198200 assert catalog ["demo" ]["source" ] == "./demo"
199201 assert catalog ["demo" ]["trusted" ] is True
202+ assert catalog ["demo" ]["docs_url" ] == "https://example.com/demo/readme"
203+ assert catalog ["demo" ]["requires_env" ] == ["DEMO_TOKEN" ]
200204
201205
202206def test_default_paths_exist (monkeypatch : pytest .MonkeyPatch ) -> None :
@@ -219,6 +223,8 @@ def test_resolve_catalog_recipes_from_local_file(tmp_path: Path) -> None:
219223 "demo" : {
220224 "source" : "./demo-recipe" ,
221225 "trusted" : True ,
226+ "docs_url" : "https://example.com/demo/setup" ,
227+ "requires_env" : ["DEMO_TOKEN" ],
222228 }
223229 }
224230 }
@@ -231,6 +237,30 @@ def test_resolve_catalog_recipes_from_local_file(tmp_path: Path) -> None:
231237 assert specs ["demo" ].slug == "demo"
232238 assert specs ["demo" ].source == str (source_recipe .resolve ())
233239 assert specs ["demo" ].trusted is True
240+ assert specs ["demo" ].docs_url == "https://example.com/demo/setup"
241+ assert specs ["demo" ].requires_env == ["DEMO_TOKEN" ]
242+
243+
244+ def test_resolve_catalog_recipes_derives_github_readme_url (tmp_path : Path ) -> None :
245+ catalog_file = tmp_path / "catalog.yaml"
246+ catalog_file .write_text (
247+ yaml .safe_dump (
248+ {
249+ "recipes" : {
250+ "x" : {
251+ "source" : "https://github.com/acme/web2api-recipes.git" ,
252+ "ref" : "main" ,
253+ "subdir" : "recipes/x" ,
254+ }
255+ }
256+ }
257+ ),
258+ encoding = "utf-8" ,
259+ )
260+
261+ specs = resolve_catalog_recipes (catalog_source = str (catalog_file ))
262+ assert specs ["x" ].docs_url == "https://github.com/acme/web2api-recipes/blob/main/recipes/x/README.md"
263+ assert specs ["x" ].requires_env == []
234264
235265
236266def test_resolve_catalog_recipes_sparse_checkout_for_remote_catalog (
@@ -271,6 +301,8 @@ def _fake_run(command, check: bool, text: bool, **kwargs): # noqa: ANN001
271301 assert "demo" in specs
272302 assert specs ["demo" ].source == "https://example.com/catalog.git"
273303 assert specs ["demo" ].source_subdir == "recipes/demo"
304+ assert specs ["demo" ].docs_url is None
305+ assert specs ["demo" ].requires_env == []
274306
275307 assert any (
276308 command [:9 ]
0 commit comments