Raising dead npm packages with Kiro, and refusing to trust what came back

2026-12-03来源 dev.toEnglish

This post is written as part of the Kiroween 2026 hackathon (Resurrection category).

Every JavaScript project carries dead packages. querystring@0.2.1 has not had a release since 2021 and is still downloaded around 16 million times a week. Old versions of minimist, 0.0.8 among them, carry two prototype-pollution advisories that will never be patched in place, because nobody is left to patch them.

Tools tell you a dependency is dead. The usual advice is "migrate to something else", which means rewriting code that works. For the Resurrection category I wanted to take the theme literally: raise the package itself, and prove that the thing that came back behaves like the thing that died.

That project is Revenant: https://revenant-fawn.vercel.app

What it does

Paste a package.json or a GitHub URL. Revenant checks every dependency against the npm registry, OSV, deps.dev and GitHub and draws a graveyard: one stone per package, where every mark on the stone is a real fact with a source.

Then it raises the dead ones in five acts: Exhume, Autopsy, Modernize, Trial, Rise. Kiro does the two steps that need judgement:

  • a coroner agent (file tools only) reads the dead package and writes its autopsy: the public API and its observable behaviour;
  • a necromancer agent (file and shell tools) modernizes it for Node.js 22 and ports the minimal fix for each known advisory.

Neither agent is trusted. The trial loads the original and the risen package in separate processes, runs both on hundreds of generated inputs, and compares return values, thrown errors and changes to built-in prototypes. Any undeclared difference is a possession and the resurrection fails. A declared difference is only accepted where an advisory proves the original was vulnerable on that input, and each claimed fix is checked against the first upstream version that fixed it.

Five packages have risen so far. Three are on npm and usable today through overrides:

"overrides": { "querystringify": "npm:@abhimanyurb/querystringify@0.0.4" } 

How Kiro built it

Specs first. Two specs hold 30 requirements in EARS form and 41 correctness properties. Every property is exactly one fast-check test, tagged with its number, so you can go from a sentence in design.md to the test that enforces it. The second spec was written by Kiro itself, from four weaknesses I saw in the first real resurrection.

Headless CLI, one task per run. A small driver ran kiro-cli on a single spec task, then gated the result: clean tree, tsc, the full test suite, next build. Only then did the branch become a pull request. Sessions ran unattended for 6 to 32 minutes. Because the acceptance criteria and properties were already on disk, the task prompt could be four lines long.

Steering. Five files that every session reads: vocabulary, the stack with verified API field names, file layout, property-test rules and git rules. The git file had the biggest effect. Once it existed, Kiro committed in small, reviewable commits on its own.

Hooks. Tests on save, a spec-traceability check after each task, a contract for new data sources, and a guard that blocks npm publish, force pushes and pull requests against repositories I do not own.

MCP, both ways. Kiro used context7 and fetch to write the API clients against live responses instead of remembered ones. Revenant also ships its own MCP server, so inside Kiro you can ask whether a dependency is dead before you add it.

The agents were confidently wrong, three times

This is the part I learned the most from.

  1. The first record said no advisory applied to querystringify@0.0.4. One did. The agent had never been given advisory data and filled the gap with a guess. Fix: the worker fetches advisories itself, and the record has to account for every one.
  2. The next record said "fixed" while parse('toString=pwned').toString still returned 'pwned'. Fix: every claimed fix is now checked against the first upstream version that fixed it.
  3. Raising minimist and deep-extend, the fixes were correct and the trial still failed them. Prototype pollution does not change the return value. It quietly changes Object.prototype, and the trial only compared return values. Fix: every call now records side effects on built-in prototypes.

Each of these started as a new requirement and a new property in the spec, never as a looser test. And a property test caught a bug the examples missed: fast-check generated an invalid date as the scan time, which broke the severity rule about once in fourteen runs.

You can check the minimist fix by hand. With the original package, Object.prototype.polluted ends up as yes after parsing a crafted argument. With the risen one it stays undefined, and normal parsing gives identical output.

What I took away

An agent's claim about its own work is a hypothesis. The useful part of the product is the part that tests it. Spec-driven development with property tests is what made that practical: when something fails, it points at a sentence in the design, not at a vague feeling that the code is off.

Kiro's monthly allowance ran out mid-task on 15 November. A small part was finished by hand from the same spec, and the pull request says exactly which part. When the allowance came back on 1 December, Kiro raised the two waiting packages and wrote the next fix, spec first.

原文:https://www.a8q9.cn/en/article/raising-dead-npm-packages-with-kiro-and-refusing-to-trust-what-came-back-91f086.html

相关文章