<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maksym Kursin on Medium]]></title>
        <description><![CDATA[Stories by Maksym Kursin on Medium]]></description>
        <link>https://medium.com/@m0ps?source=rss-3d1ed6e74ead------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SaV-NrsMyy8TYFBftEZosw.jpeg</url>
            <title>Stories by Maksym Kursin on Medium</title>
            <link>https://medium.com/@m0ps?source=rss-3d1ed6e74ead------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 20:35:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m0ps/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond the Fix: Building an In-House Terraform Review Agent with Gemini CLI]]></title>
            <link>https://medium.com/@m0ps/beyond-the-fix-building-an-in-house-terraform-review-agent-with-gemini-cli-2632f2bcaf73?source=rss-3d1ed6e74ead------2</link>
            <guid isPermaLink="false">https://medium.com/p/2632f2bcaf73</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[gemini-cli]]></category>
            <category><![CDATA[google-gemini]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <dc:creator><![CDATA[Maksym Kursin]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 14:21:24 GMT</pubDate>
            <atom:updated>2026-02-02T14:21:24.608Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we turned a CLI tool into a dynamic infrastructure-as-code reviewer using GitLab CI and GitLab MCP.</h4><p>In my <a href="https://medium.com/@m0ps/inception-how-i-fixed-a-p1-bug-in-gemini-cli-using-gemini-cli-843c194a601b">last article</a>, I shared the story of how I stumbled upon a P1 bug in the <strong>Gemini CLI</strong> and fixed it without deep TypeScript knowledge. While that story focused on the “Inception-like” debugging process, I dropped a hint about <em>why</em> I was using the tool in the first place: to build an automated code review agent for our internal infrastructure.</p><p>Since publishing that story, my inbox has been pinged by quite a few people asking the same question: <em>“How exactly did you implement that review agent?”</em></p><p>Today, I’m pulling back the curtain on our in-house implementation. Here is how we built a cost-effective, maintainable automated reviewer for our Terraform repositories using <strong>GitLab CI</strong>, <strong>Gemini CLI</strong>, and <strong>GitLab MCP</strong>.</p><h3>The “Why”: Build vs. Buy</h3><p>For a while, I had been actively scouting for an AI-powered code review solution. My day-to-day work was heavily focused on reviewing Terraform code, and I knew that an LLM could help catch low-hanging fruit and logic errors.</p><p>I surveyed the landscape and found several commercial SaaS products designed to automate merge request reviews. I really liked the concept — having an automated pair of eyes on every PR seemed invaluable. However, I couldn’t quite justify the procurement headache or the cost of bringing those commercial tools in-house for a use case I hadn’t fully validated yet.</p><p>Then, the <strong>Gemini CLI</strong> was released.</p><p>As soon as I saw it, it clicked. It wasn’t just a chat tool; it was a programmable interface for the model. I realized I didn’t need to buy a black-box product. I could use Gemini CLI as a building block to create exactly what I needed — an in-house agent integrated directly into our existing workflows.</p><p>Since we already had established GitLab CI pipelines for our Terraform repositories, wrapping the reviewer in a CI job was the logical path. The idea was simple: <strong>Once an MR is opened, the agent analyzes the changes and posts a review as a comment.</strong></p><p><em>(Note: While our primary focus is Terraform, we have since successfully extended this to review our HashiCorp Packer image repositories as well.)</em></p><h3>The Architecture: Keeping It Dynamic</h3><p>When designing this, we wanted to avoid two specific headaches common in CI/CD automation:</p><ol><li><strong>Pipeline Clutter:</strong> We didn’t want to paste massive, multi-line prompts directly into our .gitlab-ci.yml files.</li><li><strong>Image Fatigue:</strong> We didn’t want to rebuild and republish a container image every time we needed to tweak a tool configuration or change an argument.</li></ol><p>To solve this, we combined three components:</p><ul><li><strong>GitLab CI Pipeline:</strong> The orchestrator.</li><li><a href="https://github.com/google-gemini/gemini-cli"><strong>Gemini CLI</strong></a><strong>:</strong> The brain.</li><li><a href="https://gitlab.com/fforster/gitlab-mcp"><strong>GitLab MCP</strong></a><strong>:</strong> The bridge (implementing the Model Context Protocol) that allows the model to read diffs and post comments.</li></ul><h3>Implementation Details</h3><p>The core principle here is <strong>dynamic configuration</strong>. Instead of hardcoding behavior, we inject it at runtime using <strong>Extensions</strong>.</p><p>Here is the actual GitLab CI job definition. Notice how clean the script is — there are no prompts or complex tool definitions here.</p><pre>review:gemini:<br>  stage: review<br>  image: $GEMINI_CLI_IMAGE<br>  rules:<br>    # Trigger on Merge Requests, but ignore automated bots like Renovate<br>    - if: $CI_PIPELINE_SOURCE == &quot;merge_request_event&quot; &amp;&amp; $CI_COMMIT_REF_NAME !~ /^renovate\//<br>  tags:<br>    - $NON_PROD_RUNNER_TAG<br>  variables:<br>    GITLAB_TOKEN: $GITLAB_TRIAGE_BOT_TOKEN<br>    GOOGLE_GENAI_USE_VERTEXAI: true<br>    GOOGLE_CLOUD_LOCATION: global<br>  before_script:<br>    - !reference [.gitlab-creds, prep]<br>    # The Magic: Install the extension dynamically<br>    - echo &quot;y&quot; | gemini extensions install git@gitlab.com:company/platform/resources/gemini-cli-extensions/review-utils.git --ref v1.1.0<br>  script:<br>    # Fetch Project ID for Vertex AI context<br>    - |<br>      export GOOGLE_CLOUD_PROJECT=$(curl -H &#39;Metadata-Flavor: Google&#39; http://metadata.google.internal/computeMetadata/v1/project/project-id)<br>    # Run the dynamic review command<br>    - gemini -y /mr:review:$PIPELINE_TYPE &quot;$CI_MERGE_REQUEST_IID $CI_PROJECT_ID&quot;</pre><h4>The Secret Sauce: Extensions</h4><p>The line installing the extension (gemini extensions install...) is the most critical part of this setup. We treat our prompts and tool configurations as code, versioned in a separate gemini-cli-extensions repository.</p><p>This gives us two massive benefits:</p><ol><li><strong>Decoupled Prompts:</strong> We leverage the <a href="https://geminicli.com/docs/extensions/">Gemini CLI extension system</a> to version and distribute our <a href="https://geminicli.com/docs/cli/custom-commands/">slash commands</a> (like /mr:review:terraform). This keeps our pipeline YAML files readable and clean. We don&#39;t have to push a commit to the application repo just to change the &quot;persona&quot; of the reviewer.</li><li><strong>Decoupled Configuration:</strong> The <strong>GitLab MCP</strong> server configuration (which defines how Gemini talks to GitLab) is also stored in the extension. If we need to change a timeout or add a command-line argument to gitlab-mcp, we update the extension—<strong>not the Docker image.</strong></li></ol><p>This means our CI runner image stays generic and stable, while the logic it runs evolves independently.</p><p>Also, this approach offers great <strong>reproducibility</strong>: any developer on my team can install the same extension version locally and debug the agent’s behavior on their own machine. Or even use it against repos, which are currently not onboarded to the Gemini Review pipeline.</p><h3>Dealing with Noise and Models</h3><p>A common concern with AI reviewers is the “noise” factor. You don’t want a bot posting the exact same “LGTM” comment on every single commit push to an MR.</p><p>To handle this, we rely on the prompt itself. We instruct Gemini to compare its current recommendations against the previous comments it made. If the recommendation hasn’t changed, it stays silent. It’s a simple heuristic, but it saves us from notification fatigue.</p><p><strong>Model Evolution:</strong> When we started this project, we were utilizing the <strong>Gemini 2.5-pro</strong> model. It was effective, though it occasionally missed nuances in complex dependency chains. Nowadays, we have switched to the <strong>Gemini 3.0</strong> family. The improvement in result quality has been significant. While there is still room for improvement, it has become a genuine asset in spotting issues — especially in Terraform code — before a human reviewer even looks at it.</p><h3>Plans for the Future</h3><p>We are far from done. Here is where we want to take this agent next:</p><ol><li><strong>Smarter Triggering:</strong> Currently, the job runs frequently. We want to implement more advanced logic to reduce noise and API costs, triggering the review only when specific criteria are met.</li><li><strong>Platform Tooling Expansion:</strong> Since the experiment with Terraform and Packer proved successful, we plan to expand this to other internal platform team repositories. If that goes well, we will look into rolling it out for our application code repositories later on.</li><li><strong>Agent Skills:</strong> This is the big one. We want to investigate plugging in <a href="https://geminicli.com/docs/cli/skills/">Agent Skills</a> to provide specific domain knowledge — like our internal compliance rules or security policies — so the LLM isn’t just reviewing for syntax, but for <em>our</em> specific engineering standards.</li></ol><p>If you are already using GitLab and have access to Vertex AI, I highly recommend trying this approach. It’s a low-risk, high-reward way to dip your toes into AI-assisted workflows without buying into a black-box ecosystem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2632f2bcaf73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inception: How I Fixed a P1 Bug in Gemini CLI… Using Gemini CLI]]></title>
            <link>https://medium.com/@m0ps/inception-how-i-fixed-a-p1-bug-in-gemini-cli-using-gemini-cli-843c194a601b?source=rss-3d1ed6e74ead------2</link>
            <guid isPermaLink="false">https://medium.com/p/843c194a601b</guid>
            <category><![CDATA[gemini]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[gemini-cli]]></category>
            <category><![CDATA[success-story]]></category>
            <dc:creator><![CDATA[Maksym Kursin]]></dc:creator>
            <pubDate>Wed, 31 Dec 2025 06:45:40 GMT</pubDate>
            <atom:updated>2025-12-31T06:45:40.859Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>I have zero TypeScript skills and was a total AI skeptic. Here is how I managed to contribute to a repository with over 89,000 stars.</strong></p><p>Look, I’ll be honest. Until very recently, I was the guy rolling his eyes at the AI hype train.</p><p>While everyone else was losing their minds over LLMs, I was sitting in the corner, arms crossed, thinking, <em>“Okay, sure, it writes poems, but can it actually do the work?”</em> I saw it as a cool party trick, not a serious engineering tool.</p><p>But recently? I’m turning.</p><p>This actually happened about a month ago. I’ve been buried under a mountain of work since then, but the quiet lull of the holidays finally gave me a second to breathe and actually write this down. It’s a story about a situation that felt like the developer version of the movie <em>Inception</em>: <strong>I fixed a P1 (Priority 1) bug in </strong><strong>gemini-cli using </strong><strong>gemini-cli itself.</strong></p><p>Here is the kicker — I have absolutely <strong>zero</strong> experience with TypeScript.</p><p>Software engineering is actually a pretty small part of my job. I’m a Platform Engineer; I glue things together, I don’t usually spend my days deep-diving into massive application codebases.</p><p>Yet, I woke up the next morning feeling happy as a kid because I’d successfully contributed to a massive open-source project that now has over <strong>89k stars</strong>.</p><p>Here is how I went from “I can’t read this code” to merging a critical fix.</p><h4>The Motivation: Locked Out of Gemini 3</h4><p>To understand the motivation, you need the context.</p><p>We use gemini-cli in some of our Terraform repositories. It&#39;s not mission-critical—if it breaks, our production doesn&#39;t go down—but it is a massive value-add. We use it for automated code reviews to spot issues that go beyond simple static analysis. It catches things a linter would miss.</p><p>We also use extensions to distribute prompts and MCP (Model Context Protocol) server configurations. It’s a smart setup: instead of updating the pipeline code every time we need a new prompt, we just bump the extension version, and the CLI downloads it at runtime.</p><p>When the <strong>Gemini 3 Pro</strong> model preview was announced, I was eager to try it out. To do that, I had to bump the version of gemini-cli we were running.</p><p>I bumped the version, pushed the change, and… the pipeline stopped working.</p><h4>The Investigation</h4><p>It turned out the update introduced a regression. The CLI was choking on extension installations from non-GitHub repositories (we use GitLab).</p><p>I didn’t just give up and revert to the old version. I hopped onto the repository’s GitHub issues and found a report from a couple of weeks prior that sounded exactly like my problem. The issue had been quiet, so I added a comment explaining that we were hitting the same wall.</p><p>Overnight, one of the maintainers confirmed the regression and slapped a <strong>P1 (Priority 1)</strong> label on it.</p><h4>The Dilemma</h4><p>A “P1” label is great, but in open source, it doesn’t magically summon a developer to fix it immediately. I checked the ticket: no one was working on it.</p><p>I was stuck. I was effectively locked into the old CLI version, which meant I was locked out of testing Gemini 3 Pro. Urgency is a hell of a motivator, so I decided to try something crazy.</p><p>I thought: <em>Why not let the tool try to fix itself?</em></p><h4>The “Inception” Maneuver</h4><p>I didn’t open an IDE and stare blankly at the screen trying to parse syntax I didn’t understand. Instead, I treated the CLI like a senior dev sitting next to me who had infinite patience.</p><p><strong>Step 1: Finding the needle</strong></p><p>I had the command that was failing and the ugly error output. I had no clue where in the massive file tree the code actually lived.</p><p>So, I just pasted the error logs into gemini-cli and essentially asked:</p><blockquote>“Here is the mess. Where is this coming from?”</blockquote><p>It cut right through the noise. It immediately identified the exact function causing the issue and pointed me to the relevant test files. No grepping, no hunting. Just “It’s right here.”</p><p><strong>Step 2: Learning TypeScript in 30 seconds</strong></p><p>Locating the code is one thing; reading it is another. As I said, I don’t know TypeScript. The syntax looked alien to me.</p><p>Instead of guessing, I asked the CLI to act as a tutor. I asked for a detailed explanation of the function. It broke it down line-by-line, explaining the variables, the types, and the logic flow.</p><p>Suddenly, it clicked. I understood <em>why</em> the bug was happening: the logic was too restrictive and had stopped accounting for the specific URL structure we use in GitLab.</p><p><strong>Step 3: The Fix</strong></p><p>Armed with an understanding of the “why,” implementing the fix wasn’t actually a big deal.</p><ol><li>I asked the AI to help me write a test case that replicated the GitLab failure.</li><li>I added that “missed case” to the test suite (and watched it fail — which is a satisfying kind of pain because it confirms you found the bug).</li><li>I adjusted the condition in the function to allow it to properly handle GitLab repos again.</li><li>I ran the tests. <strong>Green.</strong></li></ol><h4>The Result</h4><p>This wasn’t just a hacky patch or a lucky guess. It was a legitimate, tested contribution that unlocked Gemini 3 Pro for the team.</p><ul><li><strong>The PR:</strong> <a href="https://github.com/google-gemini/gemini-cli/pull/13800">#13800</a></li><li><strong>The Release:</strong> <a href="https://github.com/google-gemini/gemini-cli/releases/tag/v0.19.0">gemini-cli v0.19.0</a></li></ul><h4>From Skeptic to Believer</h4><p>When that PR got merged, I felt a level of pride I haven’t felt in a while.</p><p>If you had told me earlier this year that I would be debugging TypeScript issues in an 89k-star repo, I would have laughed in your face. But here we are.</p><p>The AI didn’t do the work <em>for</em> me in the sense that I could just sleep while it coded. It did something better: <strong>it upskilled me instantly.</strong> It turned a lack of knowledge into a solvable logic puzzle.</p><p>My appreciation for this tech is growing. It’s not just about generating text; it’s about lowering the barrier to entry so people like me can fix P1 bugs we technically “shouldn’t” be able to touch.</p><p>And honestly? That’s pretty cool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=843c194a601b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>