Refactor: Extract shared markdown builders for rules generation strategies#73
Merged
przeprogramowani merged 1 commit intomasterfrom Sep 26, 2025
Merged
Conversation
…egies Extract common scaffolding from Single and Multi file strategies into reusable builders module. This reduces code duplication and ensures consistent formatting across both strategies. Key changes: - Created markdown-builders module with shared utilities - Extracted project header, empty state, and library section rendering - Unified iteration logic over layer/stack/library structure - Simplified both strategies to use shared builders Benefits: - Guarantees consistent formatting across strategies - Reduces effort when adding new strategies - Single source of truth for markdown generation logic - Easier maintenance and testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
✅ All checks have passed successfully!
Coverage reports have been uploaded as artifacts. |
mkczarkowski
added a commit
that referenced
this pull request
Oct 4, 2025
* refactor: extract shared markdown builders for rules generation strategies (#73) Extract common scaffolding from Single and Multi file strategies into reusable builders module. This reduces code duplication and ensures consistent formatting across both strategies. Key changes: - Created markdown-builders module with shared utilities - Extracted project header, empty state, and library section rendering - Unified iteration logic over layer/stack/library structure - Simplified both strategies to use shared builders Benefits: - Guarantees consistent formatting across strategies - Reduces effort when adding new strategies - Single source of truth for markdown generation logic - Easier maintenance and testing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com> * refactor: centralize keyboard activation handling (#71) * refactor: centralize keyboard activation handling * test: add coverage for useKeyboardActivation hook * docs: add prompt-manager plans and custom prompts * docs: updates to reflect feedback * docs: create prd * feat: implement phase 1 (flags and access) * feat: implement phase 2 (organizations) * fix: remove typo from impl plan documents * feat: implement phase 3 (prompt collections and admin apis) * refactor: rename collections to differentiate between prompts and collections * feat: implement phase 4 (member api and ui) * feat: implement phase 5 (admin ui) * feat: implement phase 7 (localization) * feat: add UI adjustments * fix: handle localization in search * feat: implement link to prompt * feat: implement invite links * feat: apply RLS to protect access * refactor: simplify test mocks * refactor: rename prompt manager to prompt library * chore: update migrations order and consolidate rls * chore: cleanup docs * feat: enable prompt library on prod --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
Problem
The Single and Multi-file rules generation strategies contained significant code duplication:
Solution
Extracted common scaffolding into a shared
markdown-buildersmodule that provides reusable utilities:New Shared Builders
createProjectMarkdown- Generates consistent project headerscreateEmptyStateMarkdown- Returns standardized empty state messagegetProjectMetadata- Provides standard project file metadatarenderLibrarySection- Renders library markdown with configurable headersiterateLayersStacksLibraries- Unified iteration logic over layer/stack/library structurecreateLibraryFileMetadata- Generates file metadata for multi-file outputKey Benefits
✅ Single source of truth - All markdown generation logic now lives in one place
✅ Guaranteed consistency - Both strategies use the same builders, ensuring uniform formatting
✅ Easier maintenance - Changes to formatting only need to be made once
✅ Reduced complexity - Strategies are now simpler and focus on their core responsibility
✅ Better testability - Shared builders can be tested independently
✅ Future-proof - Adding new strategies is now much simpler
Changes Made
src/services/rules-builder/markdown-builders/index.tsmoduleSingleFileRulesStrategyto use shared buildersMultiFileRulesStrategyto use shared buildersTesting
🤖 Generated with Claude Code