fix(yaml): add parameter definitions for goose recipe validation#2450
fix(yaml): add parameter definitions for goose recipe validation#2450zichen0116 wants to merge 2 commits intogithub:mainfrom
Conversation
Goose recipe validation requires that all template variables (like {{args}})
have corresponding parameter definitions in the parameters field.
Without this, goose recipe validate fails with:
Missing definitions for parameters in the recipe file: args.
Add the parameters field to generated YAML recipes when {{args}} is used.
Fixes github#2423
There was a problem hiding this comment.
Pull request overview
This PR aims to fix Goose recipe validation by teaching the YAML recipe generator to emit parameter metadata for the {{args}} placeholder used in spec-kit command templates. It fits into the integration layer that materializes agent-specific command files from the shared template set.
Changes:
- Extended
YamlIntegration._render_yaml()to optionally include aparametersheader section. - Updated
YamlIntegration.setup()to detect{{args}}in generated recipe bodies and inject anargsparameter definition. - Kept the rest of the Goose YAML recipe structure unchanged.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Build parameter definitions for template variables used in the body | ||
| params = None | ||
| if "{{args}}" in body: | ||
| params = [ | ||
| { | ||
| "key": "args", | ||
| "input_type": "string", | ||
| "requirement": "user_prompt", | ||
| "description": "Arguments to pass to the command", | ||
| } | ||
| ] | ||
|
|
||
| yaml_content = self._render_yaml( | ||
| title, description, body, f"templates/commands/{src_file.name}" | ||
| title, description, body, f"templates/commands/{src_file.name}", | ||
| parameters=params, |
| # Build parameter definitions for template variables used in the body | ||
| params = None | ||
| if "{{args}}" in body: | ||
| params = [ | ||
| { | ||
| "key": "args", | ||
| "input_type": "string", | ||
| "requirement": "user_prompt", | ||
| "description": "Arguments to pass to the command", | ||
| } | ||
| ] | ||
|
|
||
| yaml_content = self._render_yaml( | ||
| title, description, body, f"templates/commands/{src_file.name}" | ||
| title, description, body, f"templates/commands/{src_file.name}", | ||
| parameters=params, |
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback. If not applicable, please explain why
…ests
- Fix CommandRegistrar.render_yaml_command() to pass parameters when
{{args}} is present in the body, covering the preset/extension path
- Add regression test for parameters block in generated YAML recipes
- Addresses review feedback on PR github#2450
|
Thanks for the review! I've addressed both issues:
The body already has |
Summary
parametersfield to generated YAML recipe files when{{args}}placeholder is usedProblem
When running
goose recipe validateon spec-kit generated recipe files, validation fails with:This happens because the generated YAML recipes use
{{args}}in the prompt body but don't define theargsparameter in the recipe header.Fix
_render_yaml()to accept an optionalparametersargument and include it in the YAML headersetup()to detect{{args}}in the prompt body and pass the corresponding parameter definitionTesting
parametersfield when{{args}}is usedFixes #2423