<?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: Akshit Chugh</title>
    <description>The latest articles on DEV Community by Akshit Chugh (@achugh787).</description>
    <link>https://dev.to/achugh787</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%2F3964552%2F8d18f8b3-dedb-443f-b28d-b1d464f53241.png</url>
      <title>DEV Community: Akshit Chugh</title>
      <link>https://dev.to/achugh787</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/achugh787"/>
    <language>en</language>
    <item>
      <title>I got tired of saying "it worked yesterday" so I built a CLI to prove it</title>
      <dc:creator>Akshit Chugh</dc:creator>
      <pubDate>Tue, 02 Jun 2026 11:57:12 +0000</pubDate>
      <link>https://dev.to/achugh787/i-got-tired-of-saying-it-worked-yesterday-so-i-built-a-cli-to-prove-it-4ao9</link>
      <guid>https://dev.to/achugh787/i-got-tired-of-saying-it-worked-yesterday-so-i-built-a-cli-to-prove-it-4ao9</guid>
      <description>&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%2F2sn88g1gqilcluumz08a.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%2F2sn88g1gqilcluumz08a.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last month I was debugging a Prisma issue for like two hours.&lt;/p&gt;

&lt;p&gt;Everything was fine the day before. Same code. Same machine. I hadn't touched the project in a few days, came back, ran it boom, crash. &lt;code&gt;PrismaClientInitializationError&lt;/code&gt;. I checked the schema. I checked the database. I regenerated the client. Nothing.&lt;/p&gt;

&lt;p&gt;Turns out I had updated some global packages a couple days earlier and Prisma's CLI version had drifted out of sync with what the project expected. Two hours of my life. Gone. For a version number.&lt;/p&gt;

&lt;p&gt;And the worst part? I couldn't even be sure that was the actual cause. I was just guessing.&lt;/p&gt;




&lt;p&gt;That's the thing nobody talks about. Your environment is silently mutating all the time. You &lt;code&gt;npm install -g&lt;/code&gt; something here, your Node version bumps there via nvm, a port that used to be free is now occupied — and you have zero record of any of it. When something breaks, you're doing archaeology with no tools.&lt;/p&gt;

&lt;p&gt;So I spent a day and built &lt;strong&gt;snapcd&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;Every time you &lt;code&gt;cd&lt;/code&gt; into a project directory, it silently takes a snapshot of your environment in the background. We're talking:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node + npm versions&lt;/li&gt;
&lt;li&gt;All globally installed packages and their versions&lt;/li&gt;
&lt;li&gt;Environment variables (sensitive ones like &lt;code&gt;SECRET&lt;/code&gt;, &lt;code&gt;TOKEN&lt;/code&gt;, &lt;code&gt;KEY&lt;/code&gt; get auto-redacted)&lt;/li&gt;
&lt;li&gt;PATH entries&lt;/li&gt;
&lt;li&gt;Open ports&lt;/li&gt;
&lt;li&gt;Hostname, platform, CWD&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Under 100ms. You won't even notice it's running. Same trick nvm and direnv use.&lt;/p&gt;

&lt;p&gt;Then when something breaks, you just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;snapback diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you get a clean diff of exactly what changed between your last two snapshots.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Snapback diff: "before-upgrade" → "after-upgrade"

Core
  ✅ Node.js : v20.11.0
  ⚠️  npm     : 9.8.1 → 10.2.4

Global npm Packages
  typescript   ⚠️ changed   4.9.5 → 5.3.2
  vercel       ✚ added      33.0.0
  netlify-cli  ✗ removed    17.0.0

Open Ports
  ✚ 3000
  ✗ 8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I'd had this during the Prisma incident, I would've seen &lt;code&gt;prisma&lt;/code&gt; sitting right there with a version change and fixed it in five minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to use it
&lt;/h2&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; snapcd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the shell hook to your &lt;code&gt;.zshrc&lt;/code&gt; or &lt;code&gt;.bashrc&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;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;snapback hook&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. From now on every &lt;code&gt;cd&lt;/code&gt; auto-snapshots silently. You can also save manual named snapshots before doing something risky:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;snapback save before-that-upgrade
&lt;span class="c"&gt;# do the thing&lt;/span&gt;
snapback save after-that-upgrade
snapback diff before-that-upgrade after-that-upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything is stored locally in &lt;code&gt;~/.snapback/&amp;lt;project-name&amp;gt;/snapshots.json&lt;/code&gt;. No account, no cloud, no telemetry.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I built it in a day
&lt;/h2&gt;

&lt;p&gt;Honestly I didn't want to over-engineer it. The whole point is that it should be invisible until you need it. I wrote it in Node.js, kept the output readable, and shipped it.&lt;/p&gt;

&lt;p&gt;There's a certain class of bugs that aren't really bugs — they're just your environment silently changing underneath you. &lt;code&gt;snapcd&lt;/code&gt; doesn't fix those bugs. It just makes sure you're never blind when they happen.&lt;/p&gt;

&lt;p&gt;If you've ever said "it worked yesterday" and meant it, give it a try.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/achugh787/snapcd" rel="noopener noreferrer"&gt;github.com/achugh787/snapcd&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Docs:&lt;/strong&gt; &lt;a href="https://achugh787.github.io/snapcd" rel="noopener noreferrer"&gt;achugh787.github.io/snapcd&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Curious what you think. Would love feedback on what else it should track.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>architecture</category>
      <category>cli</category>
    </item>
  </channel>
</rss>
