11# How to Contribute
22
3- We would love to accept your patches and contributions to this project.
3+ We would love to accept your patches and contributions to this project. This
4+ document includes:
5+
6+ - ** [ Before you begin] ( #before-you-begin ) :** Essential steps to take before
7+ becoming a Gemini CLI contributor.
8+ - ** [ Code contribution process] ( #code-contribution-process ) :** How to contribute
9+ code to Gemini CLI.
10+ - ** [ Development setup and workflow] ( #development-setup-and-workflow ) :** How to
11+ set up your development environment and workflow.
12+ - ** [ Documentation contribution process] ( #documentation-contribution-process ) :**
13+ How to contribute documentation to Gemini CLI.
14+
15+ We're looking forward to seeing your contributions!
416
517## Before you begin
618
@@ -23,15 +35,25 @@ sign a new one.
2335This project follows
2436[ Google's Open Source Community Guidelines] ( https://opensource.google/conduct/ ) .
2537
26- ## Contribution Process
38+ ## Code contribution process
39+
40+ ### Get started
41+
42+ The process for contributing code is as follows:
2743
28- ### Code Reviews
44+ 1 . ** Find an issue** that you want to work on.
45+ 2 . ** Fork the repository** and create a new branch.
46+ 3 . ** Make your changes** in the ` packages/ ` directory.
47+ 4 . ** Ensure all checks pass** by running ` npm run preflight ` .
48+ 5 . ** Open a pull request** with your changes.
49+
50+ ### Code reviews
2951
3052All submissions, including submissions by project members, require review. We
3153use [ GitHub pull requests] ( https://docs.github.com/articles/about-pull-requests )
3254for this purpose.
3355
34- ### Self Assigning Issues
56+ ### Self assigning issues
3557
3658If you're looking for an issue to work on, check out our list of issues that are
3759labeled
@@ -44,12 +66,12 @@ assign the issue to you, provided it is not already assigned.
4466Please note that you can have a maximum of 3 issues assigned to you at any given
4567time.
4668
47- ### Pull Request Guidelines
69+ ### Pull request guidelines
4870
4971To help us review and merge your PRs quickly, please follow these guidelines.
5072PRs that do not meet these standards may be closed.
5173
52- #### 1. Link to an Existing Issue
74+ #### 1. Link to an existing issue
5375
5476All PRs should be linked to an existing issue in our tracker. This ensures that
5577every change has been discussed and is aligned with the project's goals before
@@ -62,7 +84,7 @@ any code is written.
6284If an issue for your change doesn't exist, please ** open one first** and wait
6385for feedback before you start coding.
6486
65- #### 2. Keep It Small and Focused
87+ #### 2. Keep it small and focused
6688
6789We favor small, atomic PRs that address a single issue or add a single,
6890self-contained feature.
@@ -74,37 +96,40 @@ self-contained feature.
7496Large changes should be broken down into a series of smaller, logical PRs that
7597can be reviewed and merged independently.
7698
77- #### 3. Use Draft PRs for Work in Progress
99+ #### 3. Use draft PRs for work in progress
78100
79101If you'd like to get early feedback on your work, please use GitHub's ** Draft
80102Pull Request** feature. This signals to the maintainers that the PR is not yet
81103ready for a formal review but is open for discussion and initial feedback.
82104
83- #### 4. Ensure All Checks Pass
105+ #### 4. Ensure all checks pass
84106
85107Before submitting your PR, ensure that all automated checks are passing by
86108running ` npm run preflight ` . This command runs all tests, linting, and other
87109style checks.
88110
89- #### 5. Update Documentation
111+ #### 5. Update documentation
90112
91113If your PR introduces a user-facing change (e.g., a new command, a modified
92114flag, or a change in behavior), you must also update the relevant documentation
93115in the ` /docs ` directory.
94116
95- #### 6. Write Clear Commit Messages and a Good PR Description
117+ See more about writing documentation:
118+ [ Documentation contribution process] ( #documentation-contribution-process ) .
119+
120+ #### 6. Write clear commit messages and a good PR description
96121
97122Your PR should have a clear, descriptive title and a detailed description of the
98123changes. Follow the [ Conventional Commits] ( https://www.conventionalcommits.org/ )
99124standard for your commit messages.
100125
101- - ** Good PR Title :** ` feat(cli): Add --json flag to 'config get' command `
102- - ** Bad PR Title :** ` Made some changes `
126+ - ** Good PR title :** ` feat(cli): Add --json flag to 'config get' command `
127+ - ** Bad PR title :** ` Made some changes `
103128
104129In the PR description, explain the "why" behind your changes and link to the
105130relevant issue (e.g., ` Fixes #123 ` ).
106131
107- ## Forking
132+ ### Forking
108133
109134If you are forking the repository you will be able to run the Build, Test and
110135Integration test workflows. However in order to make the integration tests run
@@ -118,12 +143,12 @@ Additionally you will need to click on the `Actions` tab and enable workflows
118143for your repository, you'll find it's the large blue button in the center of the
119144screen.
120145
121- ## Development Setup and Workflow
146+ ### Development setup and workflow
122147
123148This section guides contributors on how to build, modify, and understand the
124149development setup of this project.
125150
126- ### Setting Up the Development Environment
151+ ### Setting up the development environment
127152
128153** Prerequisites:**
129154
@@ -135,7 +160,7 @@ development setup of this project.
135160 version of Node.js ` >=20 ` is acceptable.
1361612 . ** Git**
137162
138- ### Build Process
163+ ### Build process
139164
140165To clone the repository:
141166
@@ -160,7 +185,7 @@ This command typically compiles TypeScript to JavaScript, bundles assets, and
160185prepares the packages for execution. Refer to ` scripts/build.js ` and
161186` package.json ` scripts for more details on what happens during the build.
162187
163- ### Enabling Sandboxing
188+ ### Enabling sandboxing
164189
165190[ Sandboxing] ( #sandboxing ) is highly recommended and requires, at a minimum,
166191setting ` GEMINI_SANDBOX=true ` in your ` ~/.env ` and ensuring a sandboxing
@@ -176,7 +201,7 @@ npm run build:all
176201
177202To skip building the sandbox container, you can use ` npm run build ` instead.
178203
179- ### Running
204+ ### Running the CLI
180205
181206To start the Gemini CLI from the source code (after building), run the following
182207command from the root directory:
@@ -190,11 +215,11 @@ utilize `npm link path/to/gemini-cli/packages/cli` (see:
190215[ docs] ( https://docs.npmjs.com/cli/v9/commands/npm-link ) ) or
191216` alias gemini="node path/to/gemini-cli/packages/cli" ` to run with ` gemini `
192217
193- ### Running Tests
218+ ### Running tests
194219
195220This project contains two types of tests: unit tests and integration tests.
196221
197- #### Unit Tests
222+ #### Unit tests
198223
199224To execute the unit test suite for the project:
200225
@@ -206,7 +231,7 @@ This will run tests located in the `packages/core` and `packages/cli`
206231directories. Ensure tests pass before submitting any changes. For a more
207232comprehensive check, it is recommended to run ` npm run preflight ` .
208233
209- #### Integration Tests
234+ #### Integration tests
210235
211236The integration tests are designed to validate the end-to-end functionality of
212237the Gemini CLI. They are not run as part of the default ` npm run test ` command.
@@ -220,7 +245,7 @@ npm run test:e2e
220245For more detailed information on the integration testing framework, please see
221246the [ Integration Tests documentation] ( ./docs/integration-tests.md ) .
222247
223- ### Linting and Preflight Checks
248+ ### Linting and preflight checks
224249
225250To ensure code quality and formatting consistency, run the preflight check:
226251
@@ -267,7 +292,7 @@ root directory:
267292npm run lint
268293```
269294
270- ### Coding Conventions
295+ ### Coding conventions
271296
272297- Please adhere to the coding style, patterns, and conventions used throughout
273298 the existing codebase.
@@ -279,7 +304,7 @@ npm run lint
279304- ** Imports:** Pay special attention to import paths. The project uses ESLint to
280305 enforce restrictions on relative imports between packages.
281306
282- ### Project Structure
307+ ### Project structure
283308
284309- ` packages/ ` : Contains the individual sub-packages of the project.
285310 - ` a2a-server ` : A2A server implementation for the Gemini CLI. (Experimental)
@@ -294,9 +319,9 @@ npm run lint
294319
295320For more detailed architecture, see ` docs/architecture.md ` .
296321
297- ## Debugging
322+ ### Debugging
298323
299- ### VS Code:
324+ #### VS Code
300325
3013260 . Run the CLI to interactively debug in VS Code with ` F5 `
3023271 . Start the CLI in debug mode from the root directory:
@@ -354,9 +379,9 @@ used for the CLI's interface, is compatible with React DevTools version 4.x.
354379 Your running CLI application should then connect to React DevTools.
355380 ! [](/docs/assets/connected_devtools.png)
356381
357- # # Sandboxing
382+ # ## Sandboxing
358383
359- # ## macOS Seatbelt
384+ # ### macOS Seatbelt
360385
361386On macOS, ` gemini` uses Seatbelt (` sandbox-exec` ) under a ` permissive-open`
362387profile (see ` packages/cli/src/utils/sandbox-macos-permissive-open.sb` ) that
@@ -372,7 +397,7 @@ Available built-in profiles are `{permissive,restrictive}-{open,closed,proxied}`
372397` .gemini/sandbox-macos-< profile> .sb` under your project settings directory
373398` .gemini` .
374399
375- # ## Container-based Sandboxing (All Platforms )
400+ # ### Container-based sandboxing (all platforms )
376401
377402For stronger container-based sandboxing on macOS or other platforms, you can set
378403` GEMINI_SANDBOX=true| docker| podman| < command> ` in your environment or ` .env`
@@ -395,7 +420,7 @@ for your projects by creating the files `.gemini/sandbox.Dockerfile` and/or
395420running ` gemini` with ` BUILD_SANDBOX=1` to trigger building of your custom
396421sandbox.
397422
398- # ### Proxied Networking
423+ # ### Proxied networking
399424
400425All sandboxing methods, including macOS Seatbelt using ` * -proxied` profiles,
401426support restricting outbound network traffic through a custom proxy server that
@@ -406,7 +431,7 @@ connections to `example.com:443` (e.g. `curl https://example.com`) and declines
406431all other requests. The proxy is started and stopped automatically alongside the
407432sandbox.
408433
409- # # Manual Publish
434+ # ## Manual publish
410435
411436We publish an artifact for each commit to our internal registry. But if you need
412437to manually cut a local build, then run the following commands:
@@ -418,3 +443,91 @@ npm run auth
418443npm run prerelease:dev
419444npm publish --workspaces
420445` ` `
446+
447+ # # Documentation contribution process
448+
449+ Our documentation must be kept up-to-date with our code contributions. We want
450+ our documentation to be clear, concise, and helpful to our users. We value:
451+
452+ - ** Clarity:** Use simple and direct language. Avoid jargon where possible.
453+ - ** Accuracy:** Ensure all information is correct and up-to-date.
454+ - ** Completeness:** Cover all aspects of a feature or topic.
455+ - ** Examples:** Provide practical examples to help users understand how to use
456+ Gemini CLI.
457+
458+ # ## Getting started
459+
460+ The process for contributing to the documentation is similar to contributing
461+ code.
462+
463+ 1. ** Fork the repository** and create a new branch.
464+ 2. ** Make your changes** in the ` /docs` directory.
465+ 3. ** Preview your changes locally** in Markdown rendering.
466+ 4. ** Lint and format your changes.** Our preflight check includes linting and
467+ formatting for documentation files.
468+ ` ` ` bash
469+ npm run preflight
470+ ` ` `
471+ 5. ** Open a pull request** with your changes.
472+
473+ # ## Documentation structure
474+
475+ Our documentation is organized using [sidebar.json](docs/sidebar.json) as the
476+ table of contents. When adding new documentation:
477+
478+ 1. Create your markdown file ** in the appropriate directory** under ` /docs` .
479+ 2. Add an entry to ` sidebar.json` in the relevant section.
480+ 3. Ensure all internal links use relative paths and point to existing files.
481+
482+ # ## Style guide
483+
484+ We follow the
485+ [Google Developer Documentation Style Guide](https://developers.google.com/style).
486+ Please refer to it for guidance on writing style, tone, and formatting.
487+
488+ # ### Key style points
489+
490+ - Use sentence case for headings.
491+ - Write in second person (" you" ) when addressing the reader.
492+ - Use present tense.
493+ - Keep paragraphs short and focused.
494+ - Use code blocks with appropriate language tags for syntax highlighting.
495+ - Include practical examples whenever possible.
496+
497+ # ## Linting and formatting
498+
499+ We use ` prettier` to enforce a consistent style across our documentation. The
500+ ` npm run preflight` command will check for any linting issues.
501+
502+ You can also run the linter and formatter separately:
503+
504+ - ` npm run lint` - Check for linting issues
505+ - ` npm run format` - Auto-format markdown files
506+ - ` npm run lint:fix` - Auto-fix linting issues where possible
507+
508+ Please make sure your contributions are free of linting errors before submitting
509+ a pull request.
510+
511+ # ## Before you submit
512+
513+ Before submitting your documentation pull request, please:
514+
515+ 1. Run ` npm run preflight` to ensure all checks pass.
516+ 2. Review your changes for clarity and accuracy.
517+ 3. Check that all links work correctly.
518+ 4. Ensure any code examples are tested and functional.
519+ 5. Sign the
520+ [Contributor License Agreement (CLA)](https://cla.developers.google.com/) if
521+ you haven' t already.
522+
523+ ### Need help?
524+
525+ If you have questions about contributing documentation:
526+
527+ - Check our [FAQ](docs/faq.md).
528+ - Review existing documentation for examples.
529+ - Open [an issue](https://github.com/google-gemini/gemini-cli/issues) to discuss
530+ your proposed changes.
531+ - Reach out to the maintainers.
532+
533+ We appreciate your contributions to making Gemini CLI documentation better!
0 commit comments