Project Management

Learn how Gemini CLI manages its packages, releases, and development workflow using NPM workspaces, Lerna, and automated CI/CD processes.

NPM Workspaces

Understanding the monorepo structure and package organization

Workspace Structure

gemini-cli/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ cli/                 # Main CLI package
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── dist/
β”‚   β”œβ”€β”€ core/                # Core functionality
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── dist/
β”‚   β”œβ”€β”€ tools/               # Built-in tools
β”‚   β”‚   β”œβ”€β”€ package.json
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── dist/
β”‚   └── extensions/          # Extension system
β”‚       β”œβ”€β”€ package.json
β”‚       β”œβ”€β”€ src/
β”‚       └── dist/
β”œβ”€β”€ package.json             # Root workspace config
β”œβ”€β”€ lerna.json              # Lerna configuration
β”œβ”€β”€ tsconfig.json           # TypeScript config
└── .github/                # CI/CD workflows
    └── workflows/
        β”œβ”€β”€ test.yml
        β”œβ”€β”€ build.yml
        └── release.yml

Root Package.json

{
  "name": "gemini-cli-workspace",
  "private": true,
  "workspaces": [
    "packages/*"
  ],
  "scripts": {
    "build": "lerna run build",
    "test": "lerna run test",
    "lint": "lerna run lint",
    "clean": "lerna clean",
    "bootstrap": "lerna bootstrap",
    "version": "lerna version",
    "publish": "lerna publish"
  },
  "devDependencies": {
    "lerna": "^6.0.0",
    "typescript": "^5.0.0",
    "@types/node": "^18.0.0"
  }
}

Package Management

Commands and workflows for managing packages

Development Commands

npm run bootstrap

Install and link all package dependencies

npm run build

Build all packages in dependency order

npm run test

Run tests across all packages

npm run clean

Clean node_modules and build artifacts

Lerna Commands

lerna run build --scope @gemini/cli

Build specific package

lerna add lodash packages/core

Add dependency to specific package

lerna version --conventional-commits

Version packages using conventional commits

lerna publish --registry https://registry.npmjs.org

Publish packages to npm registry

Release Process

Automated release workflow using GitHub Actions

GitHub Actions Workflow

name: Release

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: 'npm'
      
      - run: npm ci
      - run: npm run build
      - run: npm run test
      - run: npm run lint

  release:
    needs: test
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ secrets.GITHUB_TOKEN }}
      
      - uses: actions/setup-node@v3
        with:
          node-version: '18'
          cache: 'npm'
          registry-url: 'https://registry.npmjs.org'
      
      - run: npm ci
      - run: npm run build
      
      - name: Configure Git
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
      
      - name: Version and Publish
        run: |
          npm run version -- --conventional-commits --yes
          npm run publish -- --yes
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Development Workflow

Best practices for contributing to the project

1

Fork and Clone

Fork the repository and clone it locally for development.

git clone https://github.com/your-username/gemini-cli.git
2

Setup Development Environment

Install dependencies and set up the development environment.

npm install && npm run bootstrap
3

Create Feature Branch

Create a new branch for your feature or bug fix.

git checkout -b feature/my-new-feature
4

Develop and Test

Make your changes and ensure all tests pass.

npm run build && npm run test && npm run lint
5

Submit Pull Request

Push your changes and create a pull request with a clear description.

git push origin feature/my-new-feature

Best Practices

Guidelines for effective project management

Code Quality

  • Follow conventional commit messages
  • Maintain test coverage above 80%
  • Use TypeScript for type safety
  • Run linting and formatting checks

Release Management

  • Use semantic versioning
  • Generate changelogs automatically
  • Test releases in staging environment
  • Monitor post-release metrics

Related Resources

Learn more about contributing and development