<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Yorky Berrio Reyes</title>
    <description>The latest articles on Forem by Yorky Berrio Reyes (@yorky47).</description>
    <link>https://forem.com/yorky47</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3757537%2Fb9f8f431-1812-4398-9122-b6845d3521ed.png</url>
      <title>Forem: Yorky Berrio Reyes</title>
      <link>https://forem.com/yorky47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/yorky47"/>
    <language>en</language>
    <item>
      <title>GitGuard: The AI Safety Net for your Repository</title>
      <dc:creator>Yorky Berrio Reyes</dc:creator>
      <pubDate>Sun, 15 Feb 2026 18:51:03 +0000</pubDate>
      <link>https://forem.com/yorky47/gitguard-the-ai-safety-net-for-your-repository-f4c</link>
      <guid>https://forem.com/yorky47/gitguard-the-ai-safety-net-for-your-repository-f4c</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-01-21"&gt;GitHub Copilot CLI Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitGuard&lt;/strong&gt; is a command-line tool designed to bring "Psychological Safety" to Git operations. It acts as an intelligent firewall between your natural language intent and the actual execution of Git commands.&lt;/p&gt;

&lt;p&gt;We've all been there: staring at the terminal, sweating before hitting Enter on a git reset --hard, or Googling "how to undo last commit without losing files" for the 100th time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitGuard&lt;/strong&gt; solves this by using the GitHub Copilot CLI as a translation engine, but with a twist: it wraps the AI suggestions in a safety layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Translate: You type what you want to do in plain English (e.g., "undo last commit but keep changes").&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Analyze: &lt;strong&gt;GitGuard&lt;/strong&gt; consults Copilot to generate the correct Git command.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Classify Risk: Before showing you the command, GitGuard's internal Risk Classifier analyzes the command (using Regex patterns) to detect destructive operations (deletions, force pushes, history rewrites). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify: It presents the command with a clear explanation and a risk level (🟢 LOW, 🔴 HIGH).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Refine: If the command isn't quite right, you can conversationally refine it (e.g., "add the force flag") without restarting.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It is built 100% in Kotlin, leveraging the robust JVM ecosystem while providing a modern terminal UX.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;You can find the full source code and installation instructions here:&lt;br&gt;
👉 GitHub Repository: &lt;a href="https://github.com/yorky47/git-guard" rel="noopener noreferrer"&gt;yorky47/git-guard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling Dangerous Operations&lt;/strong&gt;&lt;br&gt;
Here is &lt;strong&gt;GitGuard&lt;/strong&gt; protecting the user from a high-risk operation. It correctly identifies git reset --hard as dangerous and requires explicit confirmation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1pmclpxrdclrs8bm4ny.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff1pmclpxrdclrs8bm4ny.gif" alt="High-risk-example" width="805" height="619"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  My Experience with GitHub Copilot CLI
&lt;/h2&gt;

&lt;p&gt;Building &lt;strong&gt;GitGuard&lt;/strong&gt; was a unique experience because I didn't just use Copilot to write the code—I used the Copilot CLI as the core engine of my application.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Challenge: Taming the LLM
&lt;/h3&gt;

&lt;p&gt;The biggest challenge was making the output of a Large Language Model (LLM) deterministic enough for a CLI tool. The standard gh copilot suggest output is designed for humans to read, not for software to parse.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Solution: Strict Prompt Engineering
&lt;/h3&gt;

&lt;p&gt;To solve this, I implemented a strict prompt injection technique within the CopilotService. I force the CLI to act as a JSON API:&lt;/p&gt;

&lt;p&gt;// From CopilotService.kt&lt;br&gt;
Kotlin&lt;br&gt;
&lt;code&gt;private val TOOM_PROMPT = "Act:GitGuard Task:Intent2Git Output:JSON_Format:{command,explanation} Rules:StrictJSON,NoThinking,NoLogs"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This allows &lt;strong&gt;GitGuard&lt;/strong&gt; to parse the response reliably, extracting the command for execution and the explanation for the UI, while filtering out the "noise" typically associated with CLI outputs.&lt;/p&gt;

&lt;p&gt;Impact on Development&lt;br&gt;
Using the Copilot CLI extension expedited the core logic significantly. Instead of building a complex NLP model to understand Git intent, I could rely on Copilot's vast knowledge of Git syntax. This allowed me to focus on the Application Logic: the risk classification system, the terminal UI, and the safety guardrails.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitGuard&lt;/strong&gt; proves that the GitHub Copilot CLI isn't just a helper tool for developers—it's a powerful backend API that enables a new class of intelligent developer tools.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>cli</category>
      <category>githubcopilot</category>
    </item>
  </channel>
</rss>
