Skip to content

feat(repo): add gemini-cli-bot metrics and workflows#25888

Merged
gundermanc merged 13 commits intomainfrom
gundermanc/repo-metrics
Apr 24, 2026
Merged

feat(repo): add gemini-cli-bot metrics and workflows#25888
gundermanc merged 13 commits intomainfrom
gundermanc/repo-metrics

Conversation

@gundermanc
Copy link
Copy Markdown
Member

Summary

This PR introduces the foundation for the new gemini-cli-bot (Cognitive Repository architecture). It sets up high-frequency "Pulse" maintenance workflows and daily "Brain" investigation workflows, supported by robust metrics collection using the GitHub CLI.

Details

The gemini-cli-bot transforms the repository into a proactive system using two primary layers:

  • Reflex Layer (Pulse): Runs every 30 minutes for deterministic tasks and metrics tracking.
  • Reasoning Layer (Brain): Runs daily for agentic policy evaluation and optimization.

Changes in this PR:

  • Established the tools/gemini-cli-bot/ directory structure (metrics, processes/scripts, investigations, critique, history).
  • Implemented tools/gemini-cli-bot/metrics/index.ts, an aggregation runner exposed via npm run metrics.
  • Migrated and converted six JavaScript metrics scripts to TypeScript (measuring domain expertise, latency, open issues/PRs, review distribution, throughput, and time-to-first-response).
  • Added .github/workflows/gemini-cli-bot-pulse.yml and .github/workflows/gemini-cli-bot-brain.yml.

Related Issues

N/A (Implements PR 1 from Plan.md)

How to Validate

  1. Pull the branch locally.
  2. Ensure you are authenticated with the GitHub CLI (gh auth status).
  3. Run npm run metrics.
  4. Verify that metrics-before.csv is generated successfully and populated with valid JSON objects or CSV values representing the repository state.
  5. Review the new GitHub Actions workflows (gemini-cli-bot-pulse.yml and gemini-cli-bot-brain.yml) for structural correctness.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

This commit establishes the foundational metrics and automation workflows for the new gemini-cli-bot (Cognitive Repository).

It includes:
- A new `tools/gemini-cli-bot` directory structure.
- Several TypeScript metrics scripts (e.g., latency, throughput, open issues) that leverage the GitHub CLI.
- A deterministic runner (`metrics/index.ts`) exposed via `npm run metrics`.
- Two new GitHub Action workflows: `gemini-cli-bot-pulse.yml` (runs every 30m) and `gemini-cli-bot-brain.yml` (runs daily) to power the Reflex and Reasoning layers.
@gemini-cli gemini-cli Bot added the priority/p1 Important and should be addressed in the near term. label Apr 23, 2026
@gundermanc gundermanc marked this pull request as ready for review April 23, 2026 22:00
@gundermanc gundermanc requested review from a team as code owners April 23, 2026 22:00
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the initial architecture for the gemini-cli-bot, designed to transform the repository into a proactive, agentic system. By implementing a dual-layer execution model—the Pulse for deterministic data collection and the Brain for strategic analysis—the system enables automated repository health monitoring and optimization using the GitHub CLI.

Highlights

  • Architecture Setup: Established the foundational directory structure for the gemini-cli-bot, including dedicated folders for metrics, processes, investigations, and history.
  • Metrics Collection: Implemented a new metrics aggregation runner (npm run metrics) and migrated six key repository health scripts to TypeScript.
  • Automation Workflows: Added GitHub Actions workflows for high-frequency Pulse maintenance and daily Brain investigation tasks.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/gemini-cli-bot-brain.yml
    • .github/workflows/gemini-cli-bot-pulse.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the foundational architecture for the gemini-cli-bot, specifically implementing a metrics collection system. It adds a central runner and several TypeScript scripts to track repository health indicators such as PR latency, throughput, domain expertise, and review distribution. The review feedback identifies critical security vulnerabilities regarding command injection in index.ts and domain_expertise.ts, where file paths are interpolated into shell commands without proper sanitization.

Comment thread tools/gemini-cli-bot/metrics/index.ts Outdated
Comment thread tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

Size Change: -4 B (0%)

Total Size: 33.7 MB

Filename Size Change
./bundle/chunk-4ZQ4EUK4.js 0 B -49.2 kB (removed) 🏆
./bundle/chunk-GQUOWGLR.js 0 B -2.73 MB (removed) 🏆
./bundle/chunk-LVK34RCK.js 0 B -3.43 kB (removed) 🏆
./bundle/chunk-PCGEPF5G.js 0 B -14.6 MB (removed) 🏆
./bundle/chunk-RYC3PJIU.js 0 B -669 kB (removed) 🏆
./bundle/chunk-XL2CTS7A.js 0 B -3.8 kB (removed) 🏆
./bundle/core-J3IVDB7M.js 0 B -47.7 kB (removed) 🏆
./bundle/devtoolsService-K24XUB6D.js 0 B -27.8 kB (removed) 🏆
./bundle/gemini-4AOS6GRZ.js 0 B -578 kB (removed) 🏆
./bundle/interactiveCli-2N6WJNNX.js 0 B -1.29 MB (removed) 🏆
./bundle/liteRtServerManager-EVAXIUER.js 0 B -2.08 kB (removed) 🏆
./bundle/oauth2-provider-HPH3EAFX.js 0 B -9.16 kB (removed) 🏆
./bundle/chunk-2OHT2RBZ.js 14.6 MB +14.6 MB (new file) 🆕
./bundle/chunk-FIKCERHT.js 3.8 kB +3.8 kB (new file) 🆕
./bundle/chunk-FRDLR7P5.js 49.2 kB +49.2 kB (new file) 🆕
./bundle/chunk-MRBNT7ID.js 3.43 kB +3.43 kB (new file) 🆕
./bundle/chunk-OU7SRYBD.js 669 kB +669 kB (new file) 🆕
./bundle/chunk-QVVJGYZO.js 2.73 MB +2.73 MB (new file) 🆕
./bundle/core-AR4J62EG.js 47.7 kB +47.7 kB (new file) 🆕
./bundle/devtoolsService-ONGLJKMX.js 27.8 kB +27.8 kB (new file) 🆕
./bundle/gemini-RHODJXZ2.js 578 kB +578 kB (new file) 🆕
./bundle/interactiveCli-GEZUT3VB.js 1.29 MB +1.29 MB (new file) 🆕
./bundle/liteRtServerManager-JBOC45HQ.js 2.08 kB +2.08 kB (new file) 🆕
./bundle/oauth2-provider-JBC2FNCY.js 9.16 kB +9.16 kB (new file) 🆕
ℹ️ View Unchanged
Filename Size Change
./bundle/bundled/third_party/index.js 8 MB 0 B
./bundle/chunk-34MYV7JD.js 2.45 kB 0 B
./bundle/chunk-5AUYMPVF.js 858 B 0 B
./bundle/chunk-5PS3AYFU.js 1.18 kB 0 B
./bundle/chunk-664ZODQF.js 124 kB 0 B
./bundle/chunk-DAHVX5MI.js 206 kB 0 B
./bundle/chunk-IUUIT4SU.js 56.5 kB 0 B
./bundle/chunk-MTD736U4.js 1.97 MB 0 B
./bundle/chunk-RJTRUG2J.js 39.8 kB 0 B
./bundle/cleanup-M66PXJG4.js 0 B -932 B (removed) 🏆
./bundle/devtools-36NN55EP.js 696 kB 0 B
./bundle/dist-T73EYRDX.js 356 B 0 B
./bundle/events-XB7DADIJ.js 418 B 0 B
./bundle/examples/hooks/scripts/on-start.js 188 B 0 B
./bundle/examples/mcp-server/example.js 1.43 kB 0 B
./bundle/gemini.js 4.97 kB 0 B
./bundle/getMachineId-bsd-TXG52NKR.js 1.55 kB 0 B
./bundle/getMachineId-darwin-7OE4DDZ6.js 1.55 kB 0 B
./bundle/getMachineId-linux-SHIFKOOX.js 1.34 kB 0 B
./bundle/getMachineId-unsupported-5U5DOEYY.js 1.06 kB 0 B
./bundle/getMachineId-win-6KLLGOI4.js 1.72 kB 0 B
./bundle/memoryDiscovery-NSOLCG4U.js 980 B 0 B
./bundle/multipart-parser-KPBZEGQU.js 11.7 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 222 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 229 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 13.4 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B
./bundle/src-QVCVGIUX.js 47 kB 0 B
./bundle/start-DCBHYVCN.js 0 B -622 B (removed) 🏆
./bundle/tree-sitter-7U6MW5PS.js 274 kB 0 B
./bundle/tree-sitter-bash-34ZGLXVX.js 1.84 MB 0 B
./bundle/cleanup-64N4T5ZW.js 932 B +932 B (new file) 🆕
./bundle/start-7KMFQRMZ.js 622 B +622 B (new file) 🆕

compressed-size-action

Comment thread tools/gemini-cli-bot/metrics/index.ts Fixed
Comment thread .github/workflows/gemini-cli-bot-brain.yml Outdated
Comment thread tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts
Comment thread tools/gemini-cli-bot/metrics/scripts/latency.ts Outdated
Comment thread .github/workflows/gemini-cli-bot-pulse.yml Outdated
Comment thread tools/gemini-cli-bot/metrics/scripts/review_distribution.ts Outdated
Comment thread .github/workflows/gemini-cli-bot-pulse.yml
Comment thread .github/workflows/gemini-cli-bot-pulse.yml Outdated
Copy link
Copy Markdown
Member Author

@gundermanc gundermanc left a comment

Choose a reason for hiding this comment

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

I've pushed updates to address the human review comments: added GitHub repository protection, fetch-depth 0, and pinned action versions in workflows. I also added explicit MetricOutput typing and removed any typing from the metrics scripts. Abstracted GITHUB_OWNER and GITHUB_REPO into constants. As requested, I left the bot comments unmodified.

Copy link
Copy Markdown
Member Author

@gundermanc gundermanc left a comment

Choose a reason for hiding this comment

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

I've additionally resolved the new TypeScript typings errors that were introduced in the 'tools/' directory during the last commit. All metrics scripts should now compile correctly.

Copy link
Copy Markdown
Member Author

@gundermanc gundermanc left a comment

Choose a reason for hiding this comment

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

I've gone ahead and fixed the two command injection vulnerabilities highlighted by the automated security bots as well, sanitizing the paths passed into execSync() using JSON.stringify().

console.log(`Running metric script: ${script}`);
try {
const scriptPath = join(SCRIPTS_DIR, script);
const output = execSync(`npx tsx ${JSON.stringify(scriptPath)}`, {
@gundermanc gundermanc requested a review from Samee24 April 24, 2026 05:45
Copy link
Copy Markdown
Contributor

@Samee24 Samee24 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gundermanc gundermanc enabled auto-merge April 24, 2026 17:04
@gundermanc gundermanc added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit c4b38a5 Apr 24, 2026
27 checks passed
@gundermanc gundermanc deleted the gundermanc/repo-metrics branch April 24, 2026 17:31
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants