Skip to content

[stage1] fix: strip YAML frontmatter from TOML integration prompts#2096

Open
RbBtSn0w wants to merge 4 commits intogithub:mainfrom
RbBtSn0w:fix-toml-integration
Open

[stage1] fix: strip YAML frontmatter from TOML integration prompts#2096
RbBtSn0w wants to merge 4 commits intogithub:mainfrom
RbBtSn0w:fix-toml-integration

Conversation

@RbBtSn0w
Copy link
Copy Markdown
Contributor

@RbBtSn0w RbBtSn0w commented Apr 5, 2026

Summary

Fix the active TOML integration path used by specify init --ai gemini/tabnine.

This PR corrects two problems in TomlIntegration:

  • YAML description values were not parsed with real YAML semantics, so block scalar descriptions (| / >) were mishandled
  • generated TOML prompt content incorrectly included the source Markdown template frontmatter instead of just the command body

What changed

  • parse TOML integration descriptions from YAML frontmatter instead of line-scanning description:
  • preserve YAML block scalar semantics for multiline descriptions
  • split processed templates into frontmatter and body before rendering TOML, so prompt contains only the command body
  • add regression coverage for block scalar descriptions and prompt output excluding YAML frontmatter

Validation

  • uv run --with pytest python -m pytest tests/integrations/test_integration_gemini.py tests/integrations/test_integration_tabnine.py -q
  • uv run --with pytest python -m pytest tests/integrations -q
  • real output check via specify init --ai gemini --offline

Issue

Part of #2095.

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

Fixes TOML integration generation (Gemini/Tabnine) so command descriptions are parsed with real YAML semantics (including | / > block scalars) and generated TOML prompt values exclude the source Markdown frontmatter.

Changes:

  • Parse description from YAML frontmatter via yaml.safe_load to preserve block-scalar semantics.
  • Split processed templates into frontmatter vs body so TOML prompt contains only the command body.
  • Add regression tests covering block-scalar descriptions and prompt output excluding frontmatter.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/specify_cli/integrations/base.py Updates TomlIntegration to YAML-parse description, split frontmatter/body, and render TOML strings more robustly.
tests/integrations/test_integration_base_toml.py Adds regression coverage for YAML block scalar description parsing and for excluding frontmatter from TOML prompts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RbBtSn0w RbBtSn0w changed the title fix: strip YAML frontmatter from TOML integration prompts [stage1] fix: strip YAML frontmatter from TOML integration prompts Apr 5, 2026
@RbBtSn0w RbBtSn0w marked this pull request as ready for review April 5, 2026 01:35
@RbBtSn0w RbBtSn0w requested a review from mnriem as a code owner April 5, 2026 01:35
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants