feat(create-gen-app): decouple architecture and implement caching with TTL#15
Merged
pyramation merged 3 commits intomainfrom Nov 28, 2025
Merged
Conversation
…s into dedicated subdirectories and classes.
…DME to detail modular API components and remove `ignore` pattern references.
…mically - add TTL opt-out flow to create-gen-app-test (new --ttl/--no-ttl flags) and avoid forcing 1-week default - read package name from package.json (fallback @launchql/cli) for version checks instead of hard-coding create-gen-app - expose CacheManager appstash dirs via getters and allow caller-provided dirs to own appstash lifecycle - update callers/tests to use getReposDir() and refresh README to document optional TTL and dirs injection
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.
Summary
This PR refactors the create-gen-app package by decoupling its core components and introducing a robust caching mechanism with TTL (Time-To-Live) support. It also updates the create-gen-app-test CLI to orchestrate these components more cleanly, adding new features such as version checks and manual cache clearing.
🏗️ Architecture Improvements
Decoupled Components
The previously monolithic logic has been split into standalone, reusable classes:
CacheManager
Handles template caching, retrieval, and TTL-based expiration using appstash.
GitCloner
Encapsulates all git-related operations cleanly.
Templatizer
Pure local template processor responsible for extract → prompt → replace steps.
Orchestration Layer
GitCloner,CacheManager,Templatizer) together.✨ New Features
Caching + TTL Support
Manual Cache Clearing
--clear-cacheAllows users to manually wipe cached templates.
Automatic Version Check
create-gen-appversion and notifies the user if an update is available.🧪 Testing
Integration Tests Enabled
cached-template.test.ts.Test Stability Improvements
noTty: trueto avoid hanging prompts during tests.EMAIL).✔️ Verification Steps
1. Run Tests
pnpm test packages/create-gen-app-test 2. Verify CLI Behavior First run — should clone: node packages/create-gen-app-test/dist/cli.js \ --repo launchql/pgpm-boilerplates \ --template module \ --output /tmp/cga-test Second run — should use cache: node packages/create-gen-app-test/dist/cli.js \ --repo launchql/pgpm-boilerplates \ --template module \ --output /tmp/cga-test-2 Clear cache: node packages/create-gen-app-test/dist/cli.js --clear-cache