Skip to content

fix(config): parse markdown prompt file blocks as prompts#12610

Open
rodboev wants to merge 1 commit into
continuedev:mainfrom
rodboev:pr/markdown-prompt-file-blocks
Open

fix(config): parse markdown prompt file blocks as prompts#12610
rodboev wants to merge 1 commit into
continuedev:mainfrom
rodboev:pr/markdown-prompt-file-blocks

Conversation

@rodboev

@rodboev rodboev commented Jun 11, 2026

Copy link
Copy Markdown

Fixes #12412

Summary

Markdown files referenced from config.yaml prompts blocks are currently resolved but then dropped, because markdown fallback parsing always wraps the file as a rule. This changes block unrolling so markdown files resolved for the prompts section become prompt blocks instead.

Root cause

packages/config-yaml/src/load/unroll.ts:436-441 resolves uses blocks and then reads the array for the current section, such as blockConfigYaml.prompts. But resolveBlock parses markdown fallback content through parseMarkdownRuleOrAssistantUnrolled, and parseYamlOrMarkdownRule at unroll.ts:798-802 always wraps markdown as { rules: [...] }. For a prompts block, that leaves blockConfigYaml.prompts undefined, so the prompt is silently skipped.

Changes

  • packages/config-yaml/src/markdown/parseMarkdownPrompt.ts: add a small markdown prompt parser that preserves frontmatter name, description, prompt body, and source file.
  • packages/config-yaml/src/markdown/index.ts: export the prompt parser.
  • packages/config-yaml/src/load/unroll.ts: pass the target section into resolved block parsing and wrap markdown prompt files under prompts.
  • packages/config-yaml/src/load/unroll.test.ts: cover markdown prompt block unrolling and existing markdown rule fallback.

What this doesn't change

This does not change YAML prompt blocks, injected blocks, or local prompt-file discovery in core/config/yaml/loadYaml.ts. It also keeps markdown fallback as rules for non-prompts sections.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

N/A, no UI change.

Tests

  • cd packages/config-yaml && npm test -- src/load/unroll.test.ts — blocked before this test file executes by existing TS7006 diagnostics in src/converter.ts on unchanged origin/main lines.
  • cd packages/config-yaml && cross-env NODE_OPTIONS=--experimental-vm-modules npx jest src/load/unroll.test.ts --globals '{"ts-jest":{"diagnostics":false}}' — 30/30 passing. Covers markdown prompt block unrolling, frontmatter parsing, filename fallback, source file propagation, and unchanged markdown rule fallback.

Summary by cubic

Parse markdown files referenced in config.yaml prompts blocks as prompts instead of rules, so referenced prompts are no longer dropped. Non-prompts markdown fallbacks still parse as rules.

  • Bug Fixes
    • Unroll markdown prompt file blocks into prompts by passing a section hint through unroll.ts.
    • Added parseMarkdownPrompt and exported from packages/config-yaml/src/markdown/index.ts to keep name, description, body, and sourceFile.
    • Tests in packages/config-yaml/src/load/unroll.test.ts cover prompt parsing, filename fallback, source propagation, and unchanged rule fallback.

Written for commit ca4e36a. Summary will update on new commits.

Review in cubic

@rodboev rodboev requested a review from a team as a code owner June 11, 2026 20:32
@rodboev rodboev requested review from sestinj and removed request for a team June 11, 2026 20:32
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 11, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Markdown Files in prompts Section are Misidentified as Rules and Dropped

1 participant