Skip to content

Commit c5ac4e3

Browse files
committed
fix(goose): declare args parameter in generated recipes
1 parent 9483e5c commit c5ac4e3

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/specify_cli/integrations/goose/__init__.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"""Goose integration — Block's open source AI agent."""
22

3+
import re
4+
5+
import yaml
6+
37
from ..base import YamlIntegration
48

59

@@ -19,3 +23,35 @@ class GooseIntegration(YamlIntegration):
1923
"extension": ".yaml",
2024
}
2125
context_file = "AGENTS.md"
26+
27+
@staticmethod
28+
def _render_yaml(title: str, description: str, body: str, source_id: str) -> str:
29+
"""Render a Goose YAML recipe with the required args parameter."""
30+
31+
header = {
32+
"version": "1.0.0",
33+
"title": title,
34+
"description": description,
35+
"author": {"contact": "spec-kit"},
36+
"extensions": [{"type": "builtin", "name": "developer"}],
37+
"activities": ["Spec-Driven Development"],
38+
"parameters": [
39+
{
40+
"key": "args",
41+
"input_type": "string",
42+
"requirement": "optional",
43+
"default": "",
44+
"description": "User input passed to the command.",
45+
}
46+
],
47+
}
48+
header_yaml = yaml.safe_dump(
49+
header,
50+
sort_keys=False,
51+
allow_unicode=True,
52+
default_flow_style=False,
53+
).strip()
54+
55+
indented = "\n".join(f" {line}" for line in body.split("\n"))
56+
lines = [header_yaml, "prompt: |", indented, "", f"# Source: {source_id}"]
57+
return "\n".join(lines) + "\n"

0 commit comments

Comments
 (0)