Skip to content

fix(yaml): add parameter definitions for goose recipe validation#2450

Open
zichen0116 wants to merge 2 commits intogithub:mainfrom
zichen0116:fix/goose-recipe-missing-args-parameter
Open

fix(yaml): add parameter definitions for goose recipe validation#2450
zichen0116 wants to merge 2 commits intogithub:mainfrom
zichen0116:fix/goose-recipe-missing-args-parameter

Conversation

@zichen0116
Copy link
Copy Markdown

Summary

  • Add parameters field to generated YAML recipe files when {{args}} placeholder is used
  • Goose recipe validation requires that all template variables have corresponding parameter definitions

Problem

When running goose recipe validate on spec-kit generated recipe files, validation fails with:

Error: recipe file is invalid: Missing definitions for parameters in the recipe file: args.

This happens because the generated YAML recipes use {{args}} in the prompt body but don't define the args parameter in the recipe header.

Fix

  • Modified _render_yaml() to accept an optional parameters argument and include it in the YAML header
  • Updated setup() to detect {{args}} in the prompt body and pass the corresponding parameter definition

Testing

  • Existing YAML integration tests continue to pass
  • Generated recipes now include the parameters field when {{args}} is used

Fixes #2423

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
Copilot AI review requested due to automatic review settings May 5, 2026 04:23
@zichen0116 zichen0116 requested a review from mnriem as a code owner May 5, 2026 04:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 a parameters header section.
  • Updated YamlIntegration.setup() to detect {{args}} in generated recipe bodies and inject an args parameter 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.

Comment on lines +1298 to +1312
# 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,
Comment on lines +1298 to +1312
# 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,
Copy link
Copy Markdown
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@zichen0116
Copy link
Copy Markdown
Author

Thanks for the review! I've addressed both issues:

  1. render_yaml_command fix: Updated CommandRegistrar.render_yaml_command() in agents.py to detect {{args}} in the body and pass parameters to _render_yaml(). This covers the preset/extension registration path.

  2. Regression test: Added test_yaml_has_parameters_when_args_placeholder to verify that generated YAML recipes include the parameters block when {{args}} is used.

The body already has {{args}} by the time render_yaml_command is called (line 491-493 in agents.py converts $ARGUMENTS to the agent's args placeholder before the format-specific renderer is invoked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Goose Standard Recipes are missing input params

3 participants