refactor(core): centralize prompt discovery in PromptLoader and cleanup AssertionEngine#44
Open
silkiy wants to merge 3 commits into
Open
refactor(core): centralize prompt discovery in PromptLoader and cleanup AssertionEngine#44silkiy wants to merge 3 commits into
silkiy wants to merge 3 commits into
Conversation
|
@silkiy is attempting to deploy a commit to the priyanshus's projects Team on Vercel. A member of the Team first needs to authorize it. |
priyanshus
reviewed
Apr 20, 2026
| /** | ||
| * Service to handle centralized prompt searching and loading. | ||
| */ | ||
| export class PromptLoader { |
Collaborator
There was a problem hiding this comment.
Can we break this function further?
Author
There was a problem hiding this comment.
Good catch! I agree the previous function was doing too much. I've broken it down into smaller, single-responsibility private methods (checkUserConfig, checkSdkDist, and checkSdkSource) so resolvePromptPath just acts as a clean orchestrator now. Just pushed the update!
…better readability
Collaborator
|
@silkiy Please check the tests. A few failed. Thanks. |
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.
Description
This PR addresses structural issues and dead code identified in
AssertionEngine.ts(Issue #43). The logic for resolving prompt file paths has been extracted from the engine and centralized into a dedicated service withinPromptLoader.Key Changes
AssertionEngine: Removed the unusedsearchPathsvariable and deleted the legacyloadPromptmethod. The engine now delegates path resolution toPromptLoader.PromptLoader.resolveAndLoad: Centralized the discovery logic with the following priority:promptsDirset inevaliphy.config.ts../prompts.../../prompts(useful for development).FILE_NOT_FOUNDandPROMPT_LOAD_ERRORhandling to provide clearer debugging information to users.promptLoader.test.tscovering all resolution scenarios, fallback mechanisms, and frontmatter validation usingvitest.Validation
pnpm exec tsc --noEmit(Type-check passed).pnpm exec vitest run packages/assertions/tests/judge/promptLoader.test.ts(All tests passed).Closes #43