Skip to content

Move pattern matching logic out of Instruction - #50

Merged
Vladyslav-Kuksiuk merged 8 commits into
masterfrom
improve-readability
Jun 18, 2026
Merged

Move pattern matching logic out of Instruction#50
Vladyslav-Kuksiuk merged 8 commits into
masterfrom
improve-readability

Conversation

@Vladyslav-Kuksiuk

Copy link
Copy Markdown
Collaborator

This PR:

  • moves the pattern matching logic from instruction.go to pattern.go;
  • improves the readability of some documentation.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this Jun 8, 2026
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk marked this pull request as ready for review June 8, 2026 20:28

Copilot AI 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.

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 via Pattern.FindIn).
  • Updated Instruction creation 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.

Comment thread embedding/parsing/pattern.go Outdated
Comment thread README.md Outdated

@Oleg-Melnik Oleg-Melnik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with resolved comments from Copilot prior to merging.

Base automatically changed from agents to master June 18, 2026 15:41
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk merged commit 9dc4987 into master Jun 18, 2026
3 checks passed
@Vladyslav-Kuksiuk
Vladyslav-Kuksiuk deleted the improve-readability branch June 18, 2026 15:41
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.

4 participants