Skip to content

Fix imports frontmatter to include markdown content in lock files#1257

Merged
pelikhan merged 5 commits intomainfrom
copilot/fix-imports-in-lock-file
Oct 6, 2025
Merged

Fix imports frontmatter to include markdown content in lock files#1257
pelikhan merged 5 commits intomainfrom
copilot/fix-imports-in-lock-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 6, 2025

✅ COMPLETE: Make imports frontmatter include markdown content in lock file

Problem

The imports: field in workflow frontmatter was only extracting tools and engines from imported files, but was not extracting and prepending the markdown content to the workflow. This meant important instructions, guidelines, or context from imported files were being lost.

Solution

Modified the import processing pipeline to extract markdown content from imported files and prepend it to the main workflow content, matching the expected behavior where imports work like @include directives for both frontmatter and markdown.

Implementation Details

Modified Files:

  1. pkg/parser/frontmatter.go

    • Added ImportsResult struct to hold return values (tools, engines, markdown, imported files)
    • Changed ProcessImportsFromFrontmatterWithManifest to return *ImportsResult instead of multiple values
    • Updated wrapper function to use struct fields
  2. pkg/workflow/compiler.go

    • Updated to use ImportsResult struct
    • Accesses struct fields: MergedTools, MergedEngines, MergedMarkdown, ImportedFiles
  3. pkg/workflow/imports_markdown_test.go (new file)

    • Comprehensive test coverage for single/multiple imports
    • Tests imports + @includes combination

Code Quality Improvements

  • ✅ Refactored to use struct type for clearer API
  • ✅ All tests pass (190+ tests)
  • ✅ Code formatted with go fmt
  • ✅ No breaking changes

Behavior

The imports field now provides complete component import:

  • ✅ Frontmatter (tools, engines) extracted and merged
  • ✅ Markdown content extracted and prepended in order
  • ✅ Imported files tracked in manifest comments
  • ✅ Compatible with @include directives
  • ✅ All tools from imports merged correctly
Original prompt

Make sure "imports" (from frontmatter) are imported in the lock file. Their frontmatter should be imported like @include and the markdown should be prepended.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 6, 2025 16:47
- Modified ProcessImportsFromFrontmatterWithManifest to extract and return markdown content
- Updated compiler to prepend imported markdown to workflow content
- Added comprehensive tests for markdown prepending
- All existing tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix imports in lock file for frontmatter Fix imports frontmatter to include markdown content in lock files Oct 6, 2025
Copilot AI requested a review from pelikhan October 6, 2025 16:55
Comment thread pkg/parser/frontmatter.go Outdated
- Added ImportsResult struct to hold return values
- Updated function to return *ImportsResult instead of multiple values
- Updated all call sites to use struct fields
- All tests pass with no regressions

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 6, 2025 18:41
@pelikhan pelikhan marked this pull request as ready for review October 6, 2025 19:20
@pelikhan pelikhan merged commit 27eeefb into main Oct 6, 2025
11 checks passed
@pelikhan pelikhan deleted the copilot/fix-imports-in-lock-file branch October 6, 2025 19:47
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