refactor(prompts): simplify prompt configuration #590
Merged
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.
Closes #530
Applied changes based on Issue #530.
I’ve refactored src/config/prompts.ts to make it more modular, readable, and maintainable—without changing any of its outward behavior:
1. Extracted a literal list of commit types
Pulled the Conventional‑Commit types into a single
const
array and exposed aConventionalCommitType
type alias so that they live in one place:【F:src/config/prompts.ts†L5-L12】【F:src/config/prompts.ts†L18-L19】
2. Built the system‐prompt via an array/join
Rewrote the gigantic template‐literal as an array of lines joined by
'\n'
. This improves readability (each instructive line is explicit) and guarantees easier future modifications:【F:src/config/prompts.ts†L21-L35】
3. Made PromptBuilderConfig properties readonly
Marked all properties on
PromptBuilderConfig
asreadonly
and collapsed the JSDoc/comments to a more compact style:【F:src/config/prompts.ts†L43-L54】
All existing tests for
conventionalCommitsSystemPrompt
andpromptBuilderConfig
continue to pass unchanged, and no external behavior (including the exact text content of the prompt) was altered.【F:tests/unit/config/prompts.test.ts†L1-L33】
Let me know if you’d like any further tweaks!