Skip to content

goose recipe with an indented first prompt line generates unparseable yaml #3342

Description

@Quratulain-bilal

the goose recipe renderer (YamlIntegration._render_yaml in src/specify_cli/integrations/base.py) writes the prompt body under a bare | block scalar. yaml infers a plain block scalar's indentation from its first non-empty line, so when a command body's first line is itself indented (for example a markdown code block or a nested list continuation), the parser expects that deeper indentation for the whole block and rejects the later, shallower lines. the generated .goose recipe then fails to parse.

repro:

import yaml
from specify_cli.integrations.base import YamlIntegration
body = "    indented first line\nback to normal"
out = YamlIntegration._render_yaml("Title", "Desc", body, "src")
yaml.safe_load(out)  # yaml.parser.ParserError: expected <block end>, but found '<scalar>'

it also reproduces through the public CommandRegistrar().render_yaml_command({"description": "d"}, body, "src") path.

a plain body (first line not indented) is unaffected, which is why the existing fixtures don't catch it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions