Skip to content

fix: reduce release bundle to only necessary files#11

Merged
allenhutchison merged 7 commits intomainfrom
fix/release-bundle-size
Dec 30, 2025
Merged

fix: reduce release bundle to only necessary files#11
allenhutchison merged 7 commits intomainfrom
fix/release-bundle-size

Conversation

@allenhutchison
Copy link
Copy Markdown
Owner

@allenhutchison allenhutchison commented Dec 29, 2025

Summary

  • Switch from exclusion-based to inclusion-based archive creation
  • Use node directly instead of npm (no package.json needed at runtime)
  • Add validation for JSON structure before modification

Files included in release

Path Purpose
dist/ Compiled JavaScript
commands/ CLI commands
node_modules/ Runtime dependencies
gemini-extension.json Extension config (modified to use node dist/index.js)
deep-research-GEMINI.md Documentation

Changes from development config

The release gemini-extension.json uses node dist/index.js instead of npm start, eliminating the need for package.json in the bundle.

Test plan

  • Create a test release to verify archive contents

Summary by CodeRabbit

  • Chores

    • Improved release workflow to stage artifacts, install production dependencies, and create a focused release archive with validation and progress messages.
    • Updated version management so the release version drives all packaged config files.
    • Added .gitignore rules to exclude release artifacts.
  • New Features

    • Added a Gemini extension configuration enabling MCP server integration.

✏️ Tip: You can customize this high-level summary in your review settings.

Include only runtime-required files in release archive:
- dist/ (compiled JavaScript)
- commands/ (CLI commands)
- node_modules/ (dependencies)
- gemini-extension.json (extension config)
- deep-research-GEMINI.md (documentation)
- package.json (package metadata)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 29, 2025

Walkthrough

Reworks the release GitHub Actions workflow to stage artifacts into release/staging, install production dependencies there, robustly update JSON version fields, validate staging contents, and create a focused tarball containing only runtime files (dist, commands, node_modules, gemini-extension.json, deep-research-GEMINI.md). Adds release/gemini-extension.json and .gitignore entries for release outputs.

Changes

Cohort / File(s) Summary
Release workflow
.github/workflows/release.yml
Adds staging preparation step (creates release/staging, copies dist, commands, release assets, package files), introduces update_json_version helper using VERSION, installs production deps in staging (npm ci --omit=dev), validates required files/dirs, and tars only staging contents into a focused archive.
Release manifest
release/gemini-extension.json
New release manifest defining name, version, contextFileName, and mcpServers entry running node with args ["dist/index.js"] in ${extensionPath}.
VCS ignores
.gitignore
Adds rules to ignore release/staging/ and release/*.tar.gz artifacts.

Sequence Diagram(s)

(No sequence diagram generated.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through staging, careful and spry,

Packed only the bits that must fly,
A manifest placed, versions set right,
Tarred up tidy, ready for flight. 🥕✨

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly aligns with the main objective: optimizing the release bundle to include only necessary files by switching from exclusion-based to inclusion-based archive creation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1042582 and 4030143.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • .gitignore
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-12-22T02:36:16.011Z
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: Applies to gemini-extension.json : Define extension metadata and MCP server configuration in `gemini-extension.json`

Applied to files:

  • .github/workflows/release.yml
🔇 Additional comments (5)
.gitignore (1)

36-38: LGTM!

The ignore patterns correctly exclude the staging directory and archive artifacts generated by the release workflow, preventing accidental commits of build outputs.

.github/workflows/release.yml (4)

37-75: Well-structured JSON update with proper validation.

The helper function correctly validates file existence, captures jq exit codes, validates the output JSON, and cleans up temp files on failure. Using jq --arg v "$VERSION" properly escapes the version string.


77-94: Clean staging workflow preparation.

The staging approach isolates release artifacts and enables production-only dependency installation. The set -e ensures failures propagate correctly. This addresses the previous feedback about including only runtime dependencies.


96-100: Correctly installs production dependencies only.

Using npm ci --omit=dev ensures the release bundle excludes dev dependencies, significantly reducing bundle size. This properly addresses the previous feedback about pruning dev dependencies.


102-140: Robust archive creation with comprehensive validation.

The validation loop collects all missing items before failing, providing a complete error report rather than failing on the first issue. Using -C "$STAGING" creates clean archive paths directly from the staging directory containing only production dependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

- Keep version sync for package.json and gemini-extension.json in repo
- Create release-specific gemini-extension.json with node dist/index.js
- Remove package.json from bundle (not needed at runtime)
- Use tar --transform to rename release config in archive
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

51-57: Consider using production-only dependencies to reduce bundle size.

Including the entire node_modules directory can significantly increase the bundle size, potentially defeating the purpose of this PR (reducing release bundle size). Development dependencies are not needed at runtime.

🔎 Proposed optimization

Add a step before creating the release archive to prune development dependencies:

+      - name: Prepare production dependencies
+        run: |
+          # Create a clean production node_modules
+          rm -rf node_modules
+          npm ci --production
+
       - name: Create release archive
         run: |
           mkdir -p release

This ensures only production dependencies are included in the release bundle, reducing its size.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a943d57 and 233c49b.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: Applies to gemini-extension.json : Define extension metadata and MCP server configuration in `gemini-extension.json`
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: The project is structured as a Gemini CLI extension using the Model Context Protocol (MCP) with logic residing in `src/` and commands in `commands/`
📚 Learning: 2025-12-22T02:36:16.011Z
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: Applies to gemini-extension.json : Define extension metadata and MCP server configuration in `gemini-extension.json`

Applied to files:

  • .github/workflows/release.yml

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml
Validate that mcpServers["gemini-deep-research"] exists before modifying
and verify the output is valid JSON before including in archive.
- Add release/gemini-extension.json with node command (version controlled)
- Simplify workflow by removing dynamic JSON generation
- Update both dev and release configs during version bump
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 233c49b and 1042582.

📒 Files selected for processing (2)
  • .github/workflows/release.yml
  • release/gemini-extension.json
✅ Files skipped from review due to trivial changes (1)
  • release/gemini-extension.json
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: Applies to gemini-extension.json : Define extension metadata and MCP server configuration in `gemini-extension.json`
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: The project is structured as a Gemini CLI extension using the Model Context Protocol (MCP) with logic residing in `src/` and commands in `commands/`
📚 Learning: 2025-12-22T02:36:16.011Z
Learnt from: CR
Repo: allenhutchison/gemini-cli-deep-research PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-22T02:36:16.011Z
Learning: Applies to gemini-extension.json : Define extension metadata and MCP server configuration in `gemini-extension.json`

Applied to files:

  • .github/workflows/release.yml

Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
- Check target files exist before processing
- Capture jq exit code and fail on error
- Validate output is well-formed JSON before replacing
- Clean up temp files on failure
- Provide clear error messages for each failure mode
- Validate required directories exist (dist, commands, node_modules)
- Validate required files exist (release/gemini-extension.json, deep-research-GEMINI.md)
- Collect all errors and report them together
- Fail fast with clear error messages before attempting tar
- Create staging directory with only required files
- Run npm ci --omit=dev to install production dependencies only
- Create archive from staging directory (excludes devDependencies)
- Add release/staging/ and release/*.tar.gz to .gitignore
@allenhutchison allenhutchison merged commit f609f55 into main Dec 30, 2025
2 checks passed
@allenhutchison allenhutchison deleted the fix/release-bundle-size branch December 30, 2025 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant