|
| 1 | +# Badal Gemini CLI Notes |
| 2 | + |
| 3 | +This document explains the long-lived Badal-specific shape of the |
| 4 | +`badal-io/gemini-cli` fork. It is meant to capture fork-level operational and |
| 5 | +development context, not ticket-specific work. |
| 6 | + |
| 7 | +## What This Repo Is |
| 8 | + |
| 9 | +- This repository is a fork of `google-gemini/gemini-cli`. |
| 10 | +- Badal uses the fork in `badal-io/gemini-cli`. |
| 11 | +- The `badal` branch is the effective Badal baseline branch. |
| 12 | + |
| 13 | +Important: a lot of upstream identity still remains in the codebase. |
| 14 | + |
| 15 | +- Package names are still largely `@google/*`. |
| 16 | +- The root `package.json` repository URL still points at the upstream Google |
| 17 | + repository. |
| 18 | +- The root `README.md` and many GitHub workflows still describe the upstream |
| 19 | + project rather than Badal's operational use. |
| 20 | + |
| 21 | +## How Badal Uses This Fork |
| 22 | + |
| 23 | +Badal does not use this repo only as a local CLI. This fork is also used as the |
| 24 | +runtime for containerized agent sessions launched by Backstage. |
| 25 | + |
| 26 | +The high-level Badal-specific shape is: |
| 27 | + |
| 28 | +- a custom runtime image defined in `deploy/cloudrun/Dockerfile` |
| 29 | +- a Badal-managed image build workflow in `.github/workflows/cloudrun-image.yml` |
| 30 | +- bundled extensions installed into the runtime image |
| 31 | +- extra operational tooling added to the container for agent use |
| 32 | +- integration with Backstage, which is responsible for launching sessions and |
| 33 | + injecting runtime configuration |
| 34 | + |
| 35 | +## Runtime Image |
| 36 | + |
| 37 | +The custom runtime image is built from `deploy/cloudrun/Dockerfile`. |
| 38 | + |
| 39 | +At a high level it: |
| 40 | + |
| 41 | +- builds and packs the Gemini CLI monorepo packages |
| 42 | +- installs the packed CLI artifacts globally in the runtime container |
| 43 | +- installs operational tools used by agent sessions such as `gh`, `gcloud`, |
| 44 | + `terraform`, `vault`, `bun`, and `bd` |
| 45 | +- installs extensions under `/root/.gemini/extensions` |
| 46 | +- copies in Badal-managed Gemini settings and the container entrypoint |
| 47 | + |
| 48 | +Known note: |
| 49 | + |
| 50 | +- the `hookwise` / `captain-hook` extension is intentionally disabled in the |
| 51 | + Dockerfile because of build issues |
| 52 | + |
| 53 | +## Extensions |
| 54 | + |
| 55 | +Gemini CLI already supports extensions natively. The extension docs live under |
| 56 | +`docs/extensions/`. |
| 57 | + |
| 58 | +For Badal, extensions matter because they are part of the deployed agent |
| 59 | +runtime, not just a user-side convenience feature. |
| 60 | + |
| 61 | +General extension-related locations to know: |
| 62 | + |
| 63 | +- `docs/extensions/` |
| 64 | +- `packages/` |
| 65 | +- `deploy/cloudrun/Dockerfile` |
| 66 | + |
| 67 | +When working on extensions in this fork, verify both: |
| 68 | + |
| 69 | +- the extension package itself |
| 70 | +- whether the runtime image is bundling it correctly |
| 71 | + |
| 72 | +## Workflows |
| 73 | + |
| 74 | +Current workflow reality: |
| 75 | + |
| 76 | +- the repository still contains a large inherited set of upstream Google |
| 77 | + workflows |
| 78 | +- only some workflows reflect Badal-specific operational needs |
| 79 | +- `.github/workflows/cloudrun-image.yml` is the clearest Badal-specific workflow |
| 80 | + today |
| 81 | + |
| 82 | +### `cloudrun-image.yml` |
| 83 | + |
| 84 | +Purpose: |
| 85 | + |
| 86 | +- build and publish the `gemini-a2a` runtime image to GHCR |
| 87 | + |
| 88 | +Behavior to verify when editing it: |
| 89 | + |
| 90 | +- which branches trigger builds |
| 91 | +- which pull request targets trigger builds |
| 92 | +- which paths are included in the workflow filters |
| 93 | +- how the image name and tags are computed |
| 94 | + |
| 95 | +## Code Areas That Matter Most For Badal |
| 96 | + |
| 97 | +If you need to understand or modify the Badal flavor, start here: |
| 98 | + |
| 99 | +- `deploy/cloudrun/Dockerfile` |
| 100 | +- `.github/workflows/cloudrun-image.yml` |
| 101 | +- `docs/extensions/` |
| 102 | +- `packages/` |
| 103 | + |
| 104 | +If the work involves agent launch behavior, credentials, or session wiring, the |
| 105 | +other repo to read is `repo-devex-backstage`, especially the Gemini agent |
| 106 | +backend that injects runtime configuration into this container. |
| 107 | + |
| 108 | +## Testing Notes |
| 109 | + |
| 110 | +Useful baseline commands in this repo: |
| 111 | + |
| 112 | +```bash |
| 113 | +npm ci |
| 114 | +npm run build |
| 115 | +npm test |
| 116 | +``` |
| 117 | + |
| 118 | +When making Badal-specific changes, also verify the behavior that matters for |
| 119 | +the deployment path you touched, for example: |
| 120 | + |
| 121 | +- image build behavior if you changed `deploy/cloudrun/Dockerfile` |
| 122 | +- workflow behavior if you changed `.github/workflows/` |
| 123 | +- extension packaging if you changed extension-related code |
| 124 | + |
| 125 | +## Practical Takeaways |
| 126 | + |
| 127 | +- Treat this repo as "upstream Gemini CLI plus Badal deployment/runtime |
| 128 | + customizations". |
| 129 | +- Do not assume upstream docs, README badges, workflow names, or repository URLs |
| 130 | + reflect Badal's actual usage. |
| 131 | +- For agent-runtime work, the Dockerfile, workflows, and extension packaging are |
| 132 | + more important than the upstream marketing/docs surface. |
0 commit comments