fix: keep long frontmatter values on a single line - #3989
Open
deborre wants to merge 1 commit into
Open
Conversation
`CommandRegistrar.render_frontmatter` calls `yaml.dump()` without `width=`,
so PyYAML applies its default ~80-column wrap and folds any long scalar onto
a continuation line.
A `description` longer than roughly 80 characters is therefore rendered as:
---
name: speckit-implement
description: Execute the implementation plan by processing and executing all tasks
defined in tasks.md
---
The YAML remains valid and round-trips faithfully through `yaml.safe_load`,
so this is not data loss. It is a shape inconsistency with real consequences:
- Hand-written core command templates always keep `description` on one line,
so preset- and extension-rendered commands do not match the files they sit
beside in the same directory.
- Consumers that read frontmatter line-wise rather than with a YAML parser
see the description truncated at the fold, followed by a stray line. Spec
Kit itself hand-builds SKILL.md frontmatter in the skills path (see github#3391),
so this is not a hypothetical class of consumer.
- `speckit.implement`'s own description is 89 characters, so a preset that
overrides it hits this immediately.
`width=float("inf")` disables the line-wrapping only; escaping, quoting and
the handling of genuinely multi-line values are unchanged, since PyYAML
selects the scalar style before applying width.
Adds a regression test that fails without the change.
Verified against the repo's own suite: 6354 passed. Four failures in
tests/integrations/test_integration_subcommand.py are present on a clean
checkout too (ANSI escapes in captured output) and are unrelated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CommandRegistrar.render_frontmatter(src/specify_cli/agents.py) callsyaml.dump()withoutwidth=, so PyYAML applies its default ~80-column wrap and folds long scalars onto a continuation line.A
descriptionlonger than roughly 80 characters renders as:Why this is worth fixing
The YAML stays valid and round-trips faithfully through
yaml.safe_load, so this is not data loss — I want to be accurate about the severity. It is a shape inconsistency, with real consequences:descriptionon a single line, so preset- and extension-rendered commands don't match the files sitting beside them in the same directory.speckit.implement's own description is 89 characters, so any preset overriding it hits this immediately.The change
width=float("inf")disables line-wrapping only. Escaping, quoting, and the handling of genuinely multi-line values are unchanged — PyYAML selects the scalar style before applying width.Verification
tests/integrations/test_integration_subcommand.pyreproduce on a clean checkout ofmainas well (ANSI escapes in captured output) and are unrelated to this change.Reproduction