Repository navigation
feat(core): improve install size - #152
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces the published install footprint for the CLI by bundling valibot into the build output and replacing heavier runtime dependencies (configstore, jsonc-parser) with lightweight in-repo utilities for prompt caching and JSONC stripping.
Changes:
- Updated
tsdownbundling config to bundlevalibotand movedvalibottodevDependencies. - Replaced
configstorewith a localPromptCachebacked by a JSON file under the user config directory. - Replaced
jsonc-parserwith an in-repostripJsonCommentsimplementation (with comprehensive tests) and used it for config loading.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tsdown.config.ts | Configures bundling behavior to include valibot in build output. |
| src/utils/strip-json-comments.ts | Adds internal JSONC comment/trailing-comma stripping implementation. |
| src/utils/strip-json-comments.test.ts | Adds unit tests covering comment stripping + trailing comma behavior and project template parsing. |
| src/utils.ts | Switches config parsing to stripJsonComments + JSON.parse and updates cache typing to PromptCache. |
| src/prompts/runnable.ts | Replaces Configstore typing with PromptCache. |
| src/prompts/branch-runnable.ts | Replaces Configstore typing with PromptCache. |
| src/prompt-cache.ts | Introduces file-backed prompt cache replacement for configstore. |
| src/index.ts | Uses FilePromptCache when cache is enabled. |
| src/branch.ts | Uses FilePromptCache when cache is enabled. |
| package.json | Removes runtime deps, adds THIRD_PARTY_NOTICES.md to published files, moves valibot to dev deps. |
| package-lock.json | Updates lockfile to reflect dependency removals and valibot as dev-only. |
Suppressed comments (2)
src/utils.ts:125
- On config parse failure, the code logs an error and calls process.exit(0). Exiting with status 0 typically signals success to shells/CI, which can hide misconfiguration. Use a non-zero exit code for invalid config.
res = JSON.parse(stripJsonComments(jsonc, { trailingCommas: true }));
} catch (err) {
p.log.error(
`Invalid JSON/JSONC config file at ${config_path}. Exiting.\n` + err,
);
src/utils.ts:232
- The warning in this function hard-codes
~/.config, but the cache location can differ (e.g. when XDG_CONFIG_HOME is set, or on non-Unix platforms). Consider making the message location-agnostic or mentioning XDG_CONFIG_HOME as well to avoid misleading troubleshooting guidance.
export function set_value_cache(
config_store: PromptCache,
key: string,
value: string,
): void {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+30
to
+41
| private read(): Record<string, string> { | ||
| try { | ||
| return JSON.parse(fs.readFileSync(this.path, "utf8")); | ||
| } catch (error) { | ||
| if ((error as NodeJS.ErrnoException).code === "ENOENT") return {}; | ||
| if (error instanceof SyntaxError) { | ||
| this.write({}); | ||
| return {}; | ||
| } | ||
| throw error; | ||
| } | ||
| } |
Comment on lines
19
to
24
| "files": [ | ||
| "dist", | ||
| "LICENSE", | ||
| "THIRD_PARTY_NOTICES.md", | ||
| "readme.md" | ||
| ], |
Comment on lines
213
to
217
| export function get_value_from_cache( | ||
| config_store: Configstore, | ||
| config_store: PromptCache, | ||
| key: string, | ||
| ): string { | ||
| try { |
Bundled tree-shaken valibot with package and moved to devDep. Removed config store in favor of hand-rolled alternative. Replaced json-c with a strip-json-comments equivalent. Should drop approx 2.78 MB of install size and down to 8 *total* dependencies from *21*.
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 14, 2026
# [1.26.0](v1.25.0...v1.26.0) (2026-08-14) ### Features * **core:** improve install size ([#152](#152)) ([e372d9b](e372d9b))
|
🎉 This PR is included in version 1.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Bundled tree-shaken valibot with package and moved to devDep. Removed config store in favor of hand-rolled alternative. Replaced json-c with a strip-json-comments equivalent. Should drop approx 2.78 MB of install size and down to 8 total dependencies from 21.