<?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: ankit</title>
    <description>The latest articles on DEV Community by ankit (@ankii1510).</description>
    <link>https://dev.to/ankii1510</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4280455%2F3a45946f-1410-4f46-955f-90b3a5b44956.png</url>
      <title>DEV Community: ankit</title>
      <link>https://dev.to/ankii1510</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankii1510"/>
    <language>en</language>
    <item>
      <title>I drew my repo's dead code as a graveyard (and built a checker that says "unsafe")</title>
      <dc:creator>ankit</dc:creator>
      <pubDate>Thu, 03 Dec 2026 11:46:38 +0000</pubDate>
      <link>https://dev.to/ankii1510/i-drew-my-repos-dead-code-as-a-graveyard-and-built-a-checker-that-says-unsafe-2gng</link>
      <guid>https://dev.to/ankii1510/i-drew-my-repos-dead-code-as-a-graveyard-and-built-a-checker-that-says-unsafe-2gng</guid>
      <description>&lt;p&gt;I wrote this post for the Kiroween 2026 hackathon. My entry is Reap, which I built with Kiro for the Resurrection category.&lt;/p&gt;

&lt;p&gt;Most old projects carry files that nothing imports anymore, a dependency with known advisories, a file that grew past 900 lines and a TODO from 2019. Old npm libraries often have one more problem. Many of them call util.isString and similar helpers that newer Node.js versions removed, so they crash on a current Node.&lt;/p&gt;

&lt;p&gt;Reap works on that in three steps. Scan draws the dead weight on a map, Revive writes a patch for the removed APIs, and Verify runs the old and the new code side by side to check that the patch changed nothing. A fourth part, Watch, rescans a list of repositories every week, and Kiro Crew wrote it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scan: the graveyard map
&lt;/h2&gt;

&lt;p&gt;You paste a public GitHub repository or pick one of four bundled samples. Reap reads the file tree and the source through GitHub's API right in your browser, with no server and no API key, and checks the dependencies against OSV.dev. Then it draws what it found. Unused files are tombstones, vulnerable dependency versions are zombies, files over 400 lines are haunted houses, and old TODO, FIXME and HACK comments are ghosts. Click one and you get the path, why it was flagged and a command to copy, like git rm -- src/old.js or npm uninstall lodash.&lt;/p&gt;

&lt;p&gt;Finding unused files without running anything was the hard part. The analyzer builds an import graph and looks for files that no entry point, test or config file can reach. My first version flagged 26 live files in Reap's own monorepo as unused, because it only read the root package.json. It now reads each package's entry points and the tsconfig path aliases, and a test keeps it that way. I still call these results estimates, since a file loaded by a computed name looks dead when it isn't.&lt;/p&gt;

&lt;p&gt;Later I added more languages. Scan also reads Python, Go, Rust, Ruby, Java and a few others, and checks their lockfiles in OSV.dev. On psf/requests it found five files over 400 lines and checked two dependencies, neither with a known advisory. Unused files are still found only in JavaScript and TypeScript, because those are the only imports it follows, and the page tells you that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Revive: a patch that admits it wasn't run
&lt;/h2&gt;

&lt;p&gt;Revive rewrites the Node.js APIs that newer versions removed, such as util.isString and fs.F_OK. It parses the code first, with acorn for JavaScript and Babel's parser for TypeScript, TSX and JSX, and changes only the exact ranges it understands. It never touches test files or .d.ts files.&lt;/p&gt;

&lt;p&gt;TypeScript caught me out once. util.isError(e) is a type guard, and my first replacement returned a plain boolean, so e.message stopped compiling after the rewrite. The real TypeScript compiler caught it in a test, and the rewrite now keeps the type narrowing.&lt;/p&gt;

&lt;p&gt;The output is a unified diff. Getting one that git apply accepts every time took a property test: for random pairs of texts, it applies the diff with the real git and checks that the result equals the new text. It found a case I hadn't thought of, a line that gains a final line break.&lt;/p&gt;

&lt;p&gt;The page says plainly that the patch was not executed. A browser can't run your repository, so it can't tell you the behavior stayed the same. Verify is the step that checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify: VERIFIED or UNSAFE
&lt;/h2&gt;

&lt;p&gt;Verify installs the library and runs its own tests in a sandbox with no network. It rewrites the removed APIs and runs the tests again. Then it calls the original and the revived code with the same generated, seeded inputs and compares every result.&lt;/p&gt;

&lt;p&gt;On a bundled 2014-style sample library, the revived code gave the same answer on 336 of 336 calls, and Verify said VERIFIED. Then I made a change that keeps every test green but drops negative numbers in sum. The tests still passed. Verify said UNSAFE, listed 9 differences out of 336 calls and printed the inputs, for example sum([-5, 5]): original gave 0; your version gives 5.&lt;/p&gt;

&lt;p&gt;I also tried a real abandoned npm library, simple-node-logger, last released in August 2021. On Node 24, 4 of its 49 tests failed with util.isDate is not a function, and Verify rewrote that one call. In a public GitHub Actions run the tests went from 45 of 49 to 49 of 49, and all 784 compared calls gave the same result. Most of the evidence there comes from the tests, though. The library's exports are factories that create loggers and files, and generated inputs say little about those, which the report also points out.&lt;/p&gt;

&lt;p&gt;The live site never runs anyone's code, so the web version of Verify needs Docker on your own machine. The GitHub Actions workflow lets you see it run without installing anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watch: the part Kiro Crew wrote
&lt;/h2&gt;

&lt;p&gt;Old projects keep aging after you scan them, and new advisories show up for packages nobody touched. Reap Watch scans a list of repositories every week, compares each scan with the last one and writes a digest of what is new and what got fixed. It exits with code 1 when a new vulnerable dependency appears, so a scheduler can alert you. It runs on your own machine, because a website can't run on a schedule or remember earlier scans. You can use it as a command line tool, as a skill in your agent, or as an app inside Kiro Crew.&lt;/p&gt;

&lt;p&gt;I didn't write that code. I gave Kiro Crew 0.14.1 two spec files, reap-watch/TASK.md for the CLI and reap-watch/crew-app/TASK.md for the app, and the git history of reap-watch/ is Crew's own commits. The CLI took about 6 minutes and 6.8 credits and came with 27 tests. The app took about 13 minutes and 20 credits, with 30 tests. It has a dashboard page, a backend, two weekly jobs and a custom agent, reap-watch-triage, which can only read files and names the one thing to fix first. I ran that agent once by hand on a digest of two repositories, and it picked &lt;a href="mailto:moment@2.22.2"&gt;moment@2.22.2&lt;/a&gt; in simple-node-logger, which is in the scan data. One run doesn't tell me much about how it behaves over weeks.&lt;/p&gt;

&lt;p&gt;Crew's first attempt stopped early. kirocrew run split the spec into 16 tasks and then halted, because an unattended run had nobody to approve its first two tool calls. I ran it again in headless chat mode with trust approval for that one run. On macOS Crew has no OS sandbox, so the spec's rule "write only in this folder" was an instruction that nothing enforced. I checked afterwards and the rest of the repository was unchanged. Running the finished app found two bugs that Crew's own run missed. The weekly job couldn't write its digest, because Crew had marked that folder read-only for the agent, and one test compared /var/... with /private/var/.... I fixed both by hand.&lt;/p&gt;

&lt;p&gt;In the real Crew dashboard I added psf/requests and simple-node-logger, pressed Run now, and the digest listed 2 new vulnerable dependencies. I also installed the app again from the public repository with one kirocrew app install command. It arrived disabled until I trusted it, as the docs say.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I used Kiro
&lt;/h2&gt;

&lt;p&gt;Almost all of the code, tests and docs were written in the Kiro IDE, working with its agent.&lt;/p&gt;

&lt;p&gt;I wrote two specs. The Verify engine's spec (its folder still has the first codename, necromancer) has requirements with EARS-style acceptance criteria, a design and 32 tasks, and each task cites the requirement it serves. The spec for the Kiro tools came before any of that code existed. Writing R3.2, "never write outside the given folder", as a requirement gave me the hostile-path and symlink tests before there was a handler to test. The Reap web app had no spec. I built it in conversation, and it got the same kind of checks only after the monorepo bug showed up. The spec-first code hasn't had a bug like that so far.&lt;/p&gt;

&lt;p&gt;Steering holds the rules I didn't want to break. One always-loaded file says every number in the report has to come from a measured command. Another says the spooky styling must keep WCAG AA contrast. That second rule turned into a palette file and a test that checks every text and control color pair, so I could change the Halloween theme several times and the test failed before anything became hard to read. A third steering file loads only when the agent reads the analyzer code.&lt;/p&gt;

&lt;p&gt;There are three hooks. One checks a saved .js file for removed Node APIs, one prints a dead-code summary after each spec task, and one tells the agent never to edit test files while reviving a library. That last one is Verify's main rule written as a guard. I ran the two command hooks' commands by hand and they work, but I haven't watched them fire inside the IDE.&lt;/p&gt;

&lt;p&gt;Reap also works from inside an agent. An MCP server gives Kiro three tools, reap_scan, reap_revive and reap_checklist, and reap_revive only writes files when you pass apply: true. The same features ship as three skills and a plugin for Kiro and Claude Code, and npx skills add Ankii1510/reap installs them.&lt;/p&gt;

&lt;p&gt;I didn't use Kiro Web, and the IDE has no custom agents. The Verify worker has an engine that runs Kiro CLI headless in a container, but it needs a paid API key I didn't have, so the demo uses the rule-based engine and the Kiro CLI path hasn't been run end to end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;• Live app (Scan and Revive): reap-web-live.vercel.app&lt;br&gt;
• Code, MIT licensed: github.com/Ankii1510/reap&lt;br&gt;
• Verify in GitHub Actions: the simple-node-logger run&lt;br&gt;
• Demo video: YOUTUBE LINK HERE&lt;/p&gt;

&lt;p&gt;To add Watch to Kiro Crew, &lt;br&gt;
run kirocrew app install &lt;a href="https://github.com/Ankii1510/reap.git" rel="noopener noreferrer"&gt;https://github.com/Ankii1510/reap.git&lt;/a&gt; --ref main --subdirectory reap-watch/crew-app/reap-watch and enable it in Apps, Library. &lt;br&gt;
And As a skill: npx skills add Ankii1510/reap --skill reap-watch --agent kiro-cli -y.&lt;/p&gt;

</description>
      <category>kiro</category>
      <category>kiroween</category>
      <category>hackathon</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
