Established the "Heart" of the Prompt Optimization Pipeline by building a robust,
extensible data infrastructure and a high-fidelity golden dataset.
Key improvements:
- Core Schema: Defined the `Scenario` interface in `data/schema.ts` supporting
multiple negative failure modes, platform-specific shell contexts (Unix/Win32),
and strict tool-call typing.
- Optimization Manifest: Created `data/manifest.json` to define "No-Fly Zones"
for the optimizer, protecting literal tool names and template variables, while
providing descriptive context for validation.
- Tool Alignment Dataset: Authored 113 scenarios in `data/tool_alignment.jsonl`
across 20 tools, focusing on "Built-in over Shell" preference. Heavily weighted
`replace` (12) and `write_file` (10) to enforce surgical editing.
- Extensible Validator: Implemented `scripts/validate-data.ts` to provide
real-time integrity checks and purpose-driven coverage reports.
- Project Integration: Added `data:validate`, `data:format`, and `data:lint`
scripts to package.json and updated ESLint config to cover the data directory.
This commit modifies the packaging setup to allow the CLI to be
executed directly from its GitHub URL using `npx`, for example:
`npx https://github.com/google-gemini/gemini-cli` (once merged to main).
This is achieved without requiring the bundle to be checked into
the repository.
Key changes and motivations:
- Modify `scripts.prepare` to run `npm run bundle`:
Ensures the CLI bundle is generated automatically when `npx`
installs the package from a git URL. This replaces previous
approaches (e.g., using `prepack`) which were not consistently
triggered in the `npx` environment.
- Update `scripts.bundle` to use a direct path for `esbuild`
and externalize `sqlite3`:
Using `node_modules/.bin/esbuild` provides a more reliable way
to invoke the bundler. Externalizing `sqlite3` is crucial for
correctly handling its native addon, preventing runtime errors.
- Add `bin`, `files`, and root `sqlite3` dependency:
- The `bin` field defines the `gemini` command.
- The `files` array ensures the generated `bundle/` directory is
recognized by npm.
- `sqlite3` is added as a root dependency to ensure it's
installed by `npx` when `gemini-code` is fetched, allowing the
externalized module to be resolved.
These changes collectively ensure that the necessary build artifacts
are created on-the-fly during `npx` installation, providing a
seamless execution experience directly from the GitHub repository URL.
- Converted scripts/copy_files.cjs to use ES module syntax (renaming to copy_files.js).
- This change aligns with the project's preference for ES modules over CommonJS for better modernity and future-proofing.
- Updated eslint.config.js to remove the .cjs override.
- Adjusted scripts/build_package.sh to call the new .js file.
- Replaces the rsync command in the build_package.sh script with a
Node.js script (copy_files.cjs) to handle copying necessary files
(e.g., .md, .json, .sb) during the build process.
- Addresses an issue where the build would fail on systems
that do not have rsync installed (e.g., some Windows environments or
minimal Linux distributions) by using a Node.js script, providing a
cross-platform solution as Node.js is already a project dependency.
- Updates the ESLint configuration to correctly lint .cjs files as
CommonJS modules.
Fixes https://github.com/google-gemini/gemini-cli/issues/387