<?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>DEV Community: Osvaldo Dias dos Santos</title>
    <description>The latest articles on DEV Community by Osvaldo Dias dos Santos (@odsantos).</description>
    <link>https://dev.to/odsantos</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%2F3764845%2F520ce54c-a88b-4a4a-93f9-9cce45396493.jpg</url>
      <title>DEV Community: Osvaldo Dias dos Santos</title>
      <link>https://dev.to/odsantos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/odsantos"/>
    <language>en</language>
    <item>
      <title>Surgically Cleaning Code: A Gemma 4 AI Tool for Repairing Corrupted Snippets</title>
      <dc:creator>Osvaldo Dias dos Santos</dc:creator>
      <pubDate>Sat, 23 May 2026 23:57:13 +0000</pubDate>
      <link>https://dev.to/odsantos/surgically-cleaning-code-a-gemma-4-ai-tool-for-repairing-corrupted-snippets-18p9</link>
      <guid>https://dev.to/odsantos/surgically-cleaning-code-a-gemma-4-ai-tool-for-repairing-corrupted-snippets-18p9</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/google-gemma-2026-05-06"&gt;Gemma 4 Challenge: Build with Gemma 4&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;I built &lt;strong&gt;Code Cleaner&lt;/strong&gt;, a professional desktop utility designed to solve a common developer pain point: the "dirty" code we get when copying snippets from terminals, PDF guides, or legacy documentation.&lt;/p&gt;

&lt;p&gt;While many tools can strip line numbers using simple patterns, they often fail when the code is actually &lt;strong&gt;corrupted&lt;/strong&gt;—such as when a terminal window wraps a single HTML tag or a keyword across two lines. &lt;/p&gt;

&lt;p&gt;Code Cleaner solves this by implementing a &lt;strong&gt;hybrid sanitization pipeline&lt;/strong&gt;. It first uses deterministic Regex for rapid line-number removal and then leverages &lt;strong&gt;Gemma 4&lt;/strong&gt; to "heal" the structural corruption, ensuring the code is syntactically correct and ready for immediate execution.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key highlights include:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visual Analysis Layer:&lt;/strong&gt; A transparent view that highlights exactly what the AI detected as corruption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Diff View:&lt;/strong&gt; A professional side-by-side comparison allowing developers to verify every single character change before applying it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer-Centric UI:&lt;/strong&gt; A high-contrast "Cobalt" theme with full Light/Dark mode support, built with Electron.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Below, you can see the AI in action—transitioning from corrupted input to a perfectly healed output.&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%2Fm4h9ybwlwrpjm5ufkbmj.png" 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%2Fm4h9ybwlwrpjm5ufkbmj.png" alt=" " width="800" height="523"&gt;&lt;/a&gt;&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%2Ftaa2clifdn6rvujgptl4.png" 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%2Ftaa2clifdn6rvujgptl4.png" alt=" " width="800" height="523"&gt;&lt;/a&gt;&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%2F2e3re0ewd8v8fqjm2vmc.png" 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%2F2e3re0ewd8v8fqjm2vmc.png" alt=" " width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;The full source code is available on GitHub: &lt;a href="https://github.com/odsantos/gemma4-code-cleaner" rel="noopener noreferrer"&gt;https://github.com/odsantos/gemma4-code-cleaner&lt;/a&gt; (&lt;a href="https://github.com/odsantos/gemma4-code-cleaner" rel="noopener noreferrer"&gt;https://github.com/odsantos/gemma4-code-cleaner&lt;/a&gt;)&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Gemma 4
&lt;/h2&gt;

&lt;p&gt;For this project, I implemented an intentional, two-tier model strategy to balance precision and performance:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The Powerhouse: Gemma 4 31B (Dense)&lt;/strong&gt;&lt;br&gt;
The core of the "Repair" feature is powered by the cloud-based &lt;em&gt;gemma-4-31b-it&lt;/em&gt; model. I chose the 31B Dense model because structural repair is a reasoning task, not a pattern-matching task. To fix a fragmented keyword or a split tag, the model must understand the context of the programming language. By using the 31B model's high-level thinking capabilities, Code Cleaner can distinguish between a line number and a legitimate numeric constant, preventing accidental data loss.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The Speedster: Gemma 4 26B (MoE)&lt;/strong&gt;&lt;br&gt;
To provide a flexible user experience, I included the &lt;em&gt;gemma-4-26b-a4b-it&lt;/em&gt; model as an option for users who need high-throughput, lightweight cleaning for simpler snippets where deep reasoning is less critical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Hybrid Approach:&lt;/strong&gt;&lt;br&gt;
I deliberately avoided sending the "easy" work (line number stripping) to the AI. Instead, I built a pipeline where &lt;strong&gt;Regex&lt;/strong&gt; handles the deterministic cleanup, and &lt;strong&gt;Gemma 4&lt;/strong&gt; is reserved for the probabilistic "surgical repair." This minimizes latency and maximizes the model's effectiveness on the most difficult parts of the task.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gemmachallenge</category>
      <category>gemma</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
