<?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: Guilherme Sousa</title>
    <description>The latest articles on DEV Community by Guilherme Sousa (@gifflet).</description>
    <link>https://dev.to/gifflet</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%2F764801%2F42ad5aed-1f58-4f23-af00-8ef4048c9707.jpg</url>
      <title>DEV Community: Guilherme Sousa</title>
      <link>https://dev.to/gifflet</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gifflet"/>
    <language>en</language>
    <item>
      <title>Introducing ccmd: Slash Command Manager for Claude Code</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Thu, 17 Jul 2025 11:00:00 +0000</pubDate>
      <link>https://dev.to/gifflet/introducing-ccmd-slash-command-manager-for-claude-code-56pd</link>
      <guid>https://dev.to/gifflet/introducing-ccmd-slash-command-manager-for-claude-code-56pd</guid>
      <description>&lt;p&gt;I've recently published &lt;a href="https://github.com/gifflet/ccmd" rel="noopener noreferrer"&gt;&lt;code&gt;ccmd&lt;/code&gt;&lt;/a&gt;, a command-line tool I built to help manage Claude Code commands (slash commands, like &lt;code&gt;/migrate-db&lt;/code&gt;, &lt;code&gt;/seed&lt;/code&gt;, &lt;code&gt;/hello-world&lt;/code&gt;, etc.). If you're using Claude Code regularly and creating custom prompts, you’ve probably faced the same issue I did: managing and reusing these commands across different projects gets messy quickly.&lt;/p&gt;

&lt;p&gt;The idea is to treat commands as versioned packages—similar to how you manage dependencies with tools like &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;pip&lt;/code&gt;, or &lt;code&gt;go mod&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Built It
&lt;/h2&gt;

&lt;p&gt;I love using Claude Code, but I found myself copy-pasting &lt;code&gt;.md&lt;/code&gt; files into each repo just to reuse a command. Worse, if I wanted to update one of them, I had no visibility on where else that command was being used. I wanted a way to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version control my prompts&lt;/li&gt;
&lt;li&gt;Reuse the same command in multiple projects&lt;/li&gt;
&lt;li&gt;Easily install/remove/update them&lt;/li&gt;
&lt;li&gt;Keep project directories clean&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, I built this tool to do just that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing
&lt;/h2&gt;

&lt;p&gt;You can get started in three ways:&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: via npm (Recommended)
&lt;/h3&gt;

&lt;p&gt;Assuming you have Node.js installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @gifflet/ccmd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the easiest and most portable method, as more users typically have Node.js available than Go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 2: via Go
&lt;/h3&gt;

&lt;p&gt;If you prefer or already use Go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/gifflet/ccmd/cmd/ccmd@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 3: via Release Page
&lt;/h3&gt;

&lt;p&gt;If you don’t want to install via npm or Go, you can grab a precompiled binary:&lt;/p&gt;

&lt;p&gt;👉 Head over to the &lt;a href="https://github.com/gifflet/ccmd/releases" rel="noopener noreferrer"&gt;Releases page&lt;/a&gt; and download the executable for your OS (Windows, macOS, Linux). Make sure it’s executable and available in your PATH.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Usage
&lt;/h2&gt;

&lt;p&gt;Inside any Claude-enabled project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ccmd init                    &lt;span class="c"&gt;# sets up a ccmd.yaml&lt;/span&gt;
ccmd &lt;span class="nb"&gt;install&lt;/span&gt; &amp;lt;git-url&amp;gt;       &lt;span class="c"&gt;# installs a command&lt;/span&gt;
ccmd list                    &lt;span class="c"&gt;# see what's installed&lt;/span&gt;
ccmd update &amp;lt;name&amp;gt;           &lt;span class="c"&gt;# update a specific command&lt;/span&gt;
ccmd remove &amp;lt;name&amp;gt;           &lt;span class="c"&gt;# remove a command&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ccmd &lt;span class="nb"&gt;install &lt;/span&gt;gifflet/hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That installs the command into &lt;code&gt;.claude/commands/&lt;/code&gt;, where Claude Code can detect and run it as &lt;code&gt;/hello-world&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Your Own Commands
&lt;/h2&gt;

&lt;p&gt;To publish your own slash command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;my-command &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;my-command
ccmd init
&lt;span class="c"&gt;# Fill in the interactive prompts&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your &lt;code&gt;index.md&lt;/code&gt; (or other entrypoint), commit, and push to GitHub. Then others can install it via:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ccmd &lt;span class="nb"&gt;install &lt;/span&gt;https://github.com/your-user/my-command
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thoughts on Prompts as Code
&lt;/h2&gt;

&lt;p&gt;One of my motivations here is to treat markdown command files as real software artifacts. They deserve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Versioning&lt;/li&gt;
&lt;li&gt;Reuse&lt;/li&gt;
&lt;li&gt;Dependency management&lt;/li&gt;
&lt;li&gt;Independent evolution from the main repo&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tool helps make that possible.&lt;/p&gt;




&lt;p&gt;If you'd like to try it or contribute, the repo is here:&lt;br&gt;
👉 &lt;a href="https://github.com/gifflet/ccmd" rel="noopener noreferrer"&gt;https://github.com/gifflet/ccmd&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback, PRs, or ideas are always welcome!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Git Commit Conventions Using Cursor MCP: A Complete Guide</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Thu, 03 Apr 2025 15:04:09 +0000</pubDate>
      <link>https://dev.to/gifflet/how-to-enforce-git-commit-conventions-using-cursor-mcp-a-complete-guide-3cfc</link>
      <guid>https://dev.to/gifflet/how-to-enforce-git-commit-conventions-using-cursor-mcp-a-complete-guide-3cfc</guid>
      <description>&lt;p&gt;Ever struggled with maintaining consistent Git practices across your team? You're not alone! Let's dive into how Cursor's Model Context Protocol (MCP) can help enforce Git conventions and make your version control workflow smoother than ever.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 Introduction
&lt;/h2&gt;

&lt;p&gt;Git conventions are crucial for maintaining a clean and organized codebase, especially in team environments. While following these conventions manually can be challenging, Cursor's MCP Git integration makes it almost effortless. In this article, you'll learn how to leverage MCP Git to enforce conventions and streamline your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✨ Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cursor IDE installed&lt;/li&gt;
&lt;li&gt;Basic understanding of Git concepts&lt;/li&gt;
&lt;li&gt;A team project using Git&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🛠️ Setting Up MCP Git in Cursor
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Installation and Configuration
&lt;/h3&gt;

&lt;p&gt;There are three ways to set up MCP Git in Cursor:&lt;/p&gt;

&lt;h4&gt;
  
  
  Using uvx (Recommended)
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"git"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"uvx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"mcp-server-git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--repository"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"path/to/git/repo"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Using Docker
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"git"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"docker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"run"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"--rm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"-i"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"--mount"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"type=bind,src=/Users/username,dst=/Users/username"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"mcp/git"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Using pip
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# First, install the package&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;mcp-server-git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"git"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"-m"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mcp_server_git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--repository"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"path/to/git/repo"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Adding Git MCP Rules
&lt;/h3&gt;

&lt;p&gt;To ensure your project follows proper Git conventions, add the Git MCP rules file to your repository:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download the &lt;a href="https://github.com/gifflet/cursor-like-pro/blob/main/rules/git-conventions/git-conventions.mdc" rel="noopener noreferrer"&gt;git-conventions.mdc&lt;/a&gt; file&lt;/li&gt;
&lt;li&gt;Create the &lt;code&gt;.cursor/rules&lt;/code&gt; directory in your project root if it doesn't exist:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; .cursor/rules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Place the &lt;code&gt;git-conventions.mdc&lt;/code&gt; file in the &lt;code&gt;.cursor/rules&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;Open the &lt;code&gt;git-conventions.mdc&lt;/code&gt; file in Cursor and verify that:

&lt;ul&gt;
&lt;li&gt;The "Rule Type" at the top shows "Agent Requested"&lt;/li&gt;
&lt;li&gt;The "Description" shows "Git conventions and workflow guidelines using Conventional Commits" (If the description is not showing copy the description from the top of the &lt;code&gt;.mdc&lt;/code&gt; file)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If the description is not showing correctly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the description from the top of the &lt;code&gt;.mdc&lt;/code&gt; file: "Git conventions and workflow guidelines using Conventional Commits"&lt;/li&gt;
&lt;li&gt;Paste it into the Description field in Cursor's rule header&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎁 Benefits of Git MCP with Conventions
&lt;/h2&gt;

&lt;p&gt;Integrating Git MCP with the rules defined in &lt;code&gt;git-conventions.mdc&lt;/code&gt; brings several benefits to your team:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. 🔄 Automatic Standardization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Consistent commit message formatting&lt;/li&gt;
&lt;li&gt;Standardized branch naming&lt;/li&gt;
&lt;li&gt;Automatic convention validation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. ⚡ Enhanced Productivity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reduced time spent on code reviews&lt;/li&gt;
&lt;li&gt;Fewer merge conflicts&lt;/li&gt;
&lt;li&gt;Cleaner and more organized commit history&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. 📊 Better Traceability
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;More descriptive and meaningful commits&lt;/li&gt;
&lt;li&gt;Easier changelog generation&lt;/li&gt;
&lt;li&gt;Better understanding of code changes&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  📚 Resources and Further Learning
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Cursor Like Pro Repository
&lt;/h3&gt;

&lt;p&gt;Want to learn more about maximizing your Cursor IDE experience? Check out the &lt;a href="https://github.com/gifflet/cursor-like-pro" rel="noopener noreferrer"&gt;Cursor Like Pro&lt;/a&gt; repository! This fantastic resource contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comprehensive guides and tips&lt;/li&gt;
&lt;li&gt;Best practices for Cursor&lt;/li&gt;
&lt;li&gt;Additional MCP integration examples&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Take Action&lt;/strong&gt;: Visit the repository now to supercharge your Cursor skills!&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉 Conclusion
&lt;/h2&gt;

&lt;p&gt;Enforcing Git conventions doesn't have to be a manual, time-consuming process. With Cursor's MCP Git integration, you can automate these practices and focus on what matters most - writing great code. Remember, consistent Git practices lead to better collaboration and more maintainable projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Next Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Set up your project's Git conventions using MCP&lt;/li&gt;
&lt;li&gt;Create team-specific commit message templates&lt;/li&gt;
&lt;li&gt;Schedule a team workshop on Git conventions&lt;/li&gt;
&lt;li&gt;Visit the Cursor Like Pro repository for more advanced tips&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>cursor</category>
      <category>mcp</category>
      <category>ai</category>
    </item>
    <item>
      <title>Como Habilitar o Provedor Legado no OpenSSL 3.x</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Fri, 13 Dec 2024 21:26:49 +0000</pubDate>
      <link>https://dev.to/gifflet/como-habilitar-o-provedor-legado-no-openssl-3x-4cmj</link>
      <guid>https://dev.to/gifflet/como-habilitar-o-provedor-legado-no-openssl-3x-4cmj</guid>
      <description>&lt;p&gt;Com o OpenSSL 3.x, algoritmos antigos como RC2 foram movidos para o provedor legacy. Se você precisa usá-los (por questões de legado ou compatibilidade), é só seguir este passo a passo para habilitá-los.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Primeiro: confirme sua versão do OpenSSL
&lt;/h2&gt;

&lt;p&gt;Antes de começar, veja se sua versão do OpenSSL é 3.x. Use o comando:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se a saída for algo como &lt;code&gt;OpenSSL 3.0.9&lt;/code&gt;, estamos no caminho certo! Caso contrário, talvez seja necessário atualizar.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Ativando o provedor legacy
&lt;/h2&gt;

&lt;p&gt;O segredo está no arquivo de configuração do OpenSSL, o &lt;code&gt;openssl.cnf&lt;/code&gt;. Ele geralmente fica aqui:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linux: /etc/ssl/openssl.cnf&lt;/li&gt;
&lt;li&gt;MacOS: /usr/local/etc/openssl/openssl.cnf&lt;/li&gt;
&lt;li&gt;Windows: %ProgramFiles%\Common Files\SSL\openssl.cnf&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Se não encontrar o arquivo, pode criar um novo.&lt;/p&gt;

&lt;p&gt;Adicione ou edite o seguinte trecho:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openssl_conf = openssl_init

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
legacy = legacy_sect

[default_sect]
activate = 1

[legacy_sect]
activate = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Isso configura o OpenSSL para carregar tanto o provedor padrão quanto o legacy.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Exportando a configuração
&lt;/h2&gt;

&lt;p&gt;Agora, informe ao OpenSSL onde está o arquivo atualizado:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;OPENSSL_CONF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/ssl/openssl.cnf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Testando os provedores carregados
&lt;/h2&gt;

&lt;p&gt;Verifique se o provedor legacy está ativo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl list &lt;span class="nt"&gt;-providers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se tudo estiver correto, você verá algo como:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Providers:
  default
  legacy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se o &lt;code&gt;legacy&lt;/code&gt; não aparecer, revise o arquivo &lt;code&gt;openssl.cnf&lt;/code&gt; e o comando de exportação.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Testando o uso de algoritmos legados
&lt;/h2&gt;

&lt;p&gt;Agora que o provedor legacy está ativo, você pode usar algoritmos antigos. Vamos testar isso na prática. Crie um arquivo de entrada chamado &lt;code&gt;input.txt&lt;/code&gt; (ou substitua pelo nome de um arquivo que você já tenha):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Texto de teste para criptografia."&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; input.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Agora, execute o comando de criptografia usando &lt;strong&gt;RC2-40-CBC&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl enc &lt;span class="nt"&gt;-rc2-40-cbc&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nt"&gt;-in&lt;/span&gt; input.txt &lt;span class="nt"&gt;-out&lt;/span&gt; output.enc &lt;span class="nt"&gt;-provider&lt;/span&gt; legacy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Este comando faz o seguinte:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lê o arquivo &lt;code&gt;input.txt&lt;/code&gt; (que você acabou de criar).&lt;/li&gt;
&lt;li&gt;Cria um arquivo criptografado chamado &lt;code&gt;output.enc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Usa o algoritmo RC2-40-CBC, que depende do provedor legacy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Para verificar que deu certo, você pode descriptografar o arquivo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl enc &lt;span class="nt"&gt;-rc2-40-cbc&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;-in&lt;/span&gt; output.enc &lt;span class="nt"&gt;-out&lt;/span&gt; decrypted.txt &lt;span class="nt"&gt;-provider&lt;/span&gt; legacy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depois, confira o conteúdo do arquivo &lt;code&gt;decrypted.txt&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat &lt;/span&gt;decrypted.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Se tudo correu bem, o texto original deve aparecer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dica Extra: Migre para algoritmos modernos
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;RC2&lt;/strong&gt; e outros algoritmos legados são obsoletos e inseguros. Sempre que possível, substitua por algo mais confiável, como AES-256-CBC. Aqui está um exemplo de como usar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl enc &lt;span class="nt"&gt;-aes-256-cbc&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nt"&gt;-in&lt;/span&gt; input.txt &lt;span class="nt"&gt;-out&lt;/span&gt; output.enc &lt;span class="nt"&gt;-k&lt;/span&gt; &lt;span class="s2"&gt;"sua-senha-segura"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusão
&lt;/h2&gt;

&lt;p&gt;Agora você sabe como habilitar o provedor legacy no OpenSSL 3.x e usar algoritmos antigos. Só lembre-se: isso deve ser uma solução temporária. Para novos projetos, prefira algoritmos mais seguros para proteger seus dados!&lt;/p&gt;

</description>
      <category>openssl</category>
      <category>legacyprovider</category>
      <category>cryptography</category>
      <category>security</category>
    </item>
    <item>
      <title>Monitoring resources spec attributes with kubectl</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Mon, 15 Jan 2024 21:27:15 +0000</pubDate>
      <link>https://dev.to/gifflet/monitoring-resources-spec-attributes-with-kubectl-37ba</link>
      <guid>https://dev.to/gifflet/monitoring-resources-spec-attributes-with-kubectl-37ba</guid>
      <description>&lt;p&gt;When developing a controller for an operator in Kubernetes, it's always good to check if the attributes of the managed resource are being properly handled.&lt;/p&gt;

&lt;p&gt;To do this, you can use &lt;code&gt;kubectl&lt;/code&gt; in conjunction with &lt;code&gt;jq&lt;/code&gt; to inspect the desired property of the resource.&lt;/p&gt;

&lt;p&gt;In the command below, for example, you can obtain the configuration defined for the update strategy of each StatefulSet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get statefulsets &lt;span class="nt"&gt;-o&lt;/span&gt; json &lt;span class="nt"&gt;-w&lt;/span&gt; | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'.spec.updateStrategy.type'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;'spec.updateStrategy.type'&lt;/code&gt; is the json path to the property that will be printed to console.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>k8s</category>
      <category>shell</category>
      <category>development</category>
    </item>
    <item>
      <title>QEMU VM with snapshot setup + samba file sharing</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Wed, 10 Jan 2024 16:08:59 +0000</pubDate>
      <link>https://dev.to/gifflet/qemu-vm-with-snapshot-setup-samba-file-sharing-10eh</link>
      <guid>https://dev.to/gifflet/qemu-vm-with-snapshot-setup-samba-file-sharing-10eh</guid>
      <description>&lt;h3&gt;
  
  
  Requirements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;telnet&lt;/li&gt;
&lt;li&gt;qemu&lt;/li&gt;
&lt;li&gt;samba&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Command to install the requirements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  qemu-system-x86 libvirt-clients &lt;span class="se"&gt;\&lt;/span&gt;
  libvirt-daemon qemu-kvm samba telnet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Lets do it
&lt;/h3&gt;

&lt;p&gt;Assuming that our terminal is open at /opt/vm create the folder that will be shared with the VM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; shared-resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Considering that the VM is located in /opt/vm/system-image/windows-11 create the snapshot image /opt/vm/snapshot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;qemu-img create &lt;span class="nt"&gt;-b&lt;/span&gt; /opt/vm/system-image/windows-11 &lt;span class="nt"&gt;-f&lt;/span&gt; qcow2 &lt;span class="nt"&gt;-F&lt;/span&gt; qcow2 /opt/vm/snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run the VM using the previously created snapshot image file and enable the monitor via telnet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;qemu-system-x86_64 &lt;span class="nt"&gt;-enable-kvm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-machine&lt;/span&gt; q35 &lt;span class="nt"&gt;-m&lt;/span&gt; 4096 &lt;span class="nt"&gt;-smp&lt;/span&gt; 2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-usb&lt;/span&gt; &lt;span class="nt"&gt;-device&lt;/span&gt; usb-kbd &lt;span class="nt"&gt;-device&lt;/span&gt; usb-tablet &lt;span class="nt"&gt;-rtc&lt;/span&gt; &lt;span class="nv"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;localtime &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-device&lt;/span&gt; virtio-net-pci,netdev&lt;span class="o"&gt;=&lt;/span&gt;net0 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-netdev&lt;/span&gt; user,id&lt;span class="o"&gt;=&lt;/span&gt;net0,hostfwd&lt;span class="o"&gt;=&lt;/span&gt;tcp::3000-:3389,hostfwd&lt;span class="o"&gt;=&lt;/span&gt;tcp::2222-:22,smb&lt;span class="o"&gt;=&lt;/span&gt;/opt/vm/shared-resources &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-drive&lt;/span&gt; &lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;snapshot,media&lt;span class="o"&gt;=&lt;/span&gt;disk,if&lt;span class="o"&gt;=&lt;/span&gt;virtio &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-monitor&lt;/span&gt; telnet:0.0.0.0:1234,server,nowait &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-nographic&lt;/span&gt; &lt;span class="nt"&gt;-serial&lt;/span&gt; mon:stdio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To save the vm snapshot its recommended to wait for the desired system state before "taking a picture" of it.&lt;br&gt;
Considering that the VM is in the expected state, let's save it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;telnet localhost 1234
savevm state
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;To close the telnet session press &lt;code&gt;ctrl&lt;/code&gt; + &lt;code&gt;[&lt;/code&gt; and type &lt;code&gt;q&lt;/code&gt; and ENTER.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With the snapshot saved, now it is possible to boot the VM and load our saved snapshot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;qemu-system-x86_64 &lt;span class="nt"&gt;-enable-kvm&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-machine&lt;/span&gt; q35 &lt;span class="nt"&gt;-m&lt;/span&gt; 4096 &lt;span class="nt"&gt;-smp&lt;/span&gt; 2 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-usb&lt;/span&gt; &lt;span class="nt"&gt;-device&lt;/span&gt; usb-kbd &lt;span class="nt"&gt;-device&lt;/span&gt; usb-tablet &lt;span class="nt"&gt;-rtc&lt;/span&gt; &lt;span class="nv"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;localtime &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-device&lt;/span&gt; virtio-net-pci,netdev&lt;span class="o"&gt;=&lt;/span&gt;net0 &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-netdev&lt;/span&gt; user,id&lt;span class="o"&gt;=&lt;/span&gt;net0,hostfwd&lt;span class="o"&gt;=&lt;/span&gt;tcp::3000-:3389,hostfwd&lt;span class="o"&gt;=&lt;/span&gt;tcp::2222-:22,smb&lt;span class="o"&gt;=&lt;/span&gt;/opt/vm/shared-resources &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-drive&lt;/span&gt; &lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/opt/vm/snapshot,media&lt;span class="o"&gt;=&lt;/span&gt;disk,if&lt;span class="o"&gt;=&lt;/span&gt;virtio &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-loadvm&lt;/span&gt; state &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-nographic&lt;/span&gt; &lt;span class="nt"&gt;-serial&lt;/span&gt; mon:stdio
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the VM (connected remotely with RDP) you can access the shared folder using the following address: 10.0.2.4/qemu&lt;/p&gt;

</description>
      <category>qemu</category>
      <category>vm</category>
      <category>samba</category>
      <category>snapshot</category>
    </item>
    <item>
      <title>Adicionar um novo mapeamento de porta a um cluster K3D existente</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Thu, 10 Aug 2023 15:05:27 +0000</pubDate>
      <link>https://dev.to/gifflet/adicionar-um-novo-mapeamento-de-porta-a-um-cluster-k3d-existente-44im</link>
      <guid>https://dev.to/gifflet/adicionar-um-novo-mapeamento-de-porta-a-um-cluster-k3d-existente-44im</guid>
      <description>&lt;p&gt;Considerando que o seguinte serviço foi criado:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Service&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres-outside-cluster&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NodePort&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
    &lt;span class="na"&gt;replicationRole&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;primary&lt;/span&gt;
  &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;port-5432&lt;/span&gt;
    &lt;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;TCP&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5432&lt;/span&gt;
    &lt;span class="na"&gt;targetPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5432&lt;/span&gt;
    &lt;span class="na"&gt;nodePort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30543&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ao executar o comando abaixo será possível acessar, no host, o postgres via localhost:5432: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;k3d cluster edit k3s-default --port-add 5432:30543@server:0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Onde &lt;code&gt;k3s-default&lt;/code&gt; é o nome do cluster, &lt;code&gt;5432&lt;/code&gt; é a porta do host e &lt;code&gt;30543&lt;/code&gt; é a porta do node.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>k3d</category>
      <category>docker</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Configurando Swagger Springfox em um projeto Spring Boot</title>
      <dc:creator>Guilherme Sousa</dc:creator>
      <pubDate>Tue, 28 Feb 2023 06:07:52 +0000</pubDate>
      <link>https://dev.to/gifflet/configurando-swagger-springfox-em-um-projeto-spring-boot-2k35</link>
      <guid>https://dev.to/gifflet/configurando-swagger-springfox-em-um-projeto-spring-boot-2k35</guid>
      <description>&lt;p&gt;O Swagger é uma ferramenta de software que permite documentar APIs de maneira fácil e padronizada. O Springfox é uma biblioteca que pode ser integrada com o Spring Boot para gerar a documentação da API usando o Swagger.&lt;/p&gt;

&lt;p&gt;Aqui estão os passos para configurar o Swagger Springfox em um projeto Spring Boot:&lt;/p&gt;

&lt;h4&gt;
  
  
  Adicione as dependências necessárias
&lt;/h4&gt;

&lt;p&gt;O primeiro passo é adicionar as dependências necessárias ao arquivo pom.xml (no caso de projetos Maven) ou build.gradle (no caso de projetos Gradle). As dependências são:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.springfox&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;springfox-swagger2&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.9.2&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;io.springfox&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;springfox-swagger-ui&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;2.9.2&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Configure o Swagger
&lt;/h4&gt;

&lt;p&gt;Em seguida, é necessário configurar o Swagger em sua aplicação Spring Boot. Isso pode ser feito criando uma classe de configuração com a anotação &lt;code&gt;@EnableSwagger2&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Configuration&lt;/span&gt;
&lt;span class="nd"&gt;@EnableSwagger2&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SwaggerConfig&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;    
    &lt;span class="nd"&gt;@Bean&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Docket&lt;/span&gt; &lt;span class="nf"&gt;api&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; 
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Docket&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DocumentationType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;SWAGGER_2&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;  
          &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; 
          &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;apis&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;RequestHandlerSelectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;any&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;              
          &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;PathSelectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;any&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt;                          
          &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;                                           
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A classe Docket é usada para configurar as opções do Swagger, como as APIs e os endpoints a serem documentados.&lt;/p&gt;

&lt;h4&gt;
  
  
  Anote os controladores
&lt;/h4&gt;

&lt;p&gt;Por fim, é necessário anotar os controladores da API com as anotações apropriadas do Swagger. Por exemplo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestController&lt;/span&gt;
&lt;span class="nd"&gt;@RequestMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/api"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nd"&gt;@Api&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"API de exemplo"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Exemplo de API com Swagger"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExemploController&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@ApiOperation&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Exemplo de endpoint"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/exemplo"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;exemplo&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Exemplo de API com Swagger"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A anotação &lt;code&gt;@Api&lt;/code&gt; é usada para definir o valor e a descrição da API, enquanto a anotação &lt;code&gt;@ApiOperation&lt;/code&gt; é usada para definir o valor e o tipo de resposta de um endpoint.&lt;/p&gt;

&lt;p&gt;Com esses passos, o Swagger Springfox deve estar configurado e pronto para uso em sua aplicação Spring Boot. Para acessar a interface do usuário do Swagger, basta acessar a URL &lt;code&gt;http://localhost:&amp;lt;porta&amp;gt;/swagger-ui.html&lt;/code&gt;, onde &lt;code&gt;&amp;lt;porta&amp;gt;&lt;/code&gt; é a porta na qual sua aplicação Spring Boot está sendo executada.&lt;/p&gt;

</description>
      <category>swagger</category>
      <category>springboot</category>
      <category>java</category>
    </item>
  </channel>
</rss>
