Move pattern matching logic out of Instruction - #50
Merged
Conversation
Vladyslav-Kuksiuk
marked this pull request as ready for review
June 8, 2026 20:28
MykytaPimonovTD
approved these changes
Jun 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors embed-code-go’s embedding instruction parsing by relocating source-line pattern matching logic from Instruction into Pattern, while also updating documentation to reflect current CLI/config options and improve wording.
Changes:
- Refactored pattern compilation/matching into
embedding/parsing/pattern.go(multi-line patterns compiled into per-line matchers; matching exposed viaPattern.FindIn). - Updated
Instructioncreation and matching to use the new pattern API, including returning a proper error for invalid glob patterns. - Documentation updates for CLI/config fields (
doc-excludes,info,stacktrace) and build instructions.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents additional CLI/config options and adjusts manual build instructions. |
| main.go | Documents info and stacktrace flags in the top-level usage comment. |
| fragmentation/fragment.go | Improves/internalizes doc comments for fragment helpers and constants. |
| embedding/parsing/pattern.go | Moves pattern compilation/matching logic here and introduces FindIn for range matching. |
| embedding/parsing/instruction.go | Switches instruction matching to Pattern.FindIn and validates pattern compilation at parse time. |
| embedding/parsing/instruction_test.go | Adds coverage for invalid glob patterns producing a user-facing error. |
| EMBEDDING.md | Readability/wording fixes and minor formatting corrections. |
| configuration/configuration.go | Improves documentation comments and clarifies defaults. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Oleg-Melnik
approved these changes
Jun 17, 2026
Oleg-Melnik
left a comment
Collaborator
There was a problem hiding this comment.
LGTM with resolved comments from Copilot prior to merging.
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.
This PR:
instruction.gotopattern.go;