OHREN_Lab

Open source오픈소스shrink-anythingshrink-anything

shrink-anything deletes dead code, files and dependencies, and keeps each cut only if your own tests still passshrink-anything, 죽은 코드와 파일, 의존성을 지우고 지울 때마다 내 테스트로 확인하는 도구

shrink-anything finds dead code, files, dependencies and assets, deletes them and runs your own tests after every cut, keeping only what still passes. A cut that breaks something is put back, every cut can be undone byte for byte, and it is MIT licensed.shrink-anything은 쓰이지 않는 코드, 파일, 의존성, 자산을 찾아 지우고, 지울 때마다 사용자가 정한 테스트를 돌려 통과한 것만 남깁니다. 깨진 지움은 되돌려 놓고, 모든 지움은 바이트 그대로 되돌릴 수 있으며, 라이선스는 MIT입니다.

Checked확인일

shrink-anything is a command-line tool that finds dead code, files, dependencies and assets in a codebase, deletes them and runs your own tests after every cut. The README says what passes stays, what breaks is put back, and the whole process is reversible. Less code also means less for an agent to read: the author reports 46% fewer tokens on the demo app.shrink-anything은 코드베이스에서 죽은 코드, 파일, 의존성, 자산을 찾아 지우고, 지울 때마다 사용자의 테스트를 돌리는 명령줄 도구입니다. 통과한 지움은 남기고 무언가를 깨뜨린 지움은 되돌려 놓으며, 모든 과정을 되돌릴 수 있다고 README는 설명합니다. 코드가 줄면 에이전트가 읽을 양도 줄어, 시연 앱에서는 토큰이 46% 줄었다고 저자는 적었습니다.

It looks for five kinds of things: dead code whose name is only mentioned inside its own definition (18 languages), dead files no other file names (Python, JS/TS, PHP, Ruby, Dart and Lua/Luau), unused dependencies that nothing imports and whose commands nothing runs (npm, pnpm, yarn, bun, Cargo, pip and Go modules), dead weight such as images, fonts and sounds nothing names and files stored twice (any project), and duplicates that are the same code however they are named or laid out (18 languages, merged by your agent). It counts names instead of building a call graph, so it can miss dead code but never invent it. Cuts go in batches, and a failing batch is split until the one breaking cut is found and put back. A cut stays only if the check exits 0 and at least as many tests run as before, and a check that already fails is refused. Tests are never touched, and undo restores every file byte for byte.찾는 대상은 다섯 갈래입니다. 이름이 자기 정의 안에서만 나오는 죽은 코드(18개 언어), 다른 파일이 이름을 부르지 않는 죽은 파일(Python, JS/TS, PHP, Ruby, Dart, Lua/Luau), 어디에서도 가져오지 않고 그 명령도 실행하지 않는 의존성(npm, pnpm, yarn, bun, Cargo, pip, Go 모듈), 아무도 부르지 않는 그림, 글꼴, 소리 같은 자산과 두 번 저장된 파일(어느 프로젝트나), 이름과 꼴이 달라도 같은 코드인 중복(18개 언어 · 합치기는 에이전트가)입니다. 호출 그래프를 만들지 않고 이름을 세는 방식이라 죽은 코드를 놓칠 수는 있어도 지어내지는 않는다고 적었습니다. 지움은 묶음으로 들어가고, 실패한 묶음은 쪼개서 문제의 지움 하나를 찾아 되돌립니다. 검사 명령이 0으로 끝나고 테스트 수가 전보다 적지 않을 때만 지움이 남으며, 이미 실패하는 검사는 받지 않습니다. 테스트 파일은 건드리지 않고, undo는 파일을 바이트 그대로 되돌립니다.

It installs with npm or cargo, and the go command with your check after it does everything in one run. You can also list what could go with scan, or take it step by step with commands such as cut, task, weigh, verify, undo and report. The report command makes markdown and an SVG card for your PR. Judgment calls such as duplicates and public methods go to an agent through --agent, which takes claude or another command that reads a prompt on stdin, and the agent’s work is kept only if the check passes. It also comes as a Claude Code plugin, a built-in MCP server and a skill.설치는 npm이나 cargo로 하고, go 명령에 검사 명령을 붙이면 한 번에 돌아갑니다. scan으로 지울 수 있는 것만 보거나, cut, task, weigh, verify, undo, report 같은 명령으로 단계를 나눌 수도 있습니다. report는 PR에 붙일 마크다운과 SVG 카드를 만듭니다. 중복이나 공개 메서드처럼 판단이 필요한 일은 --agent로 넘기며, 이 옵션은 claude나 표준 입력으로 프롬프트를 읽는 다른 명령 같은 에이전트를 받고, 검사를 통과할 때만 그 작업을 남깁니다. Claude Code 플러그인, 내장 MCP 서버, 스킬로도 쓸 수 있습니다.

The README says that with no tests you get a scan, not a cut you should trust. Cuts it cannot prove, such as public methods, library exports and framework-registered classes, are skipped and go to your agent or need --aggressive, and assets in folders served as-is, such as public and static, also need --aggressive. The line and file results in the README are the author’s measurements on demo projects in the examples folder, where dead code was planted on purpose. The license is MIT.테스트가 없으면 결과는 믿을 만한 지움이 아니라 검사에 그친다고 README는 적었습니다. 공개 메서드, 라이브러리 내보내기, 프레임워크가 등록하는 클래스처럼 증명할 수 없는 지움은 건너뛰고 에이전트에 넘기거나 --aggressive가 필요하며, public이나 static처럼 그대로 내보내는 폴더의 자산도 --aggressive가 있어야 지웁니다. README의 줄 수와 파일 수 결과는 죽은 코드를 일부러 심어 둔 examples 폴더의 시연 프로젝트에서 저자가 잰 값입니다. 라이선스는 MIT입니다.

The shrink-anything report card for a demo project: a large figure for dependencies going from 3 to 1, bars for lines from 106 to 58, files from 5 to 3, dependencies from 3 to 1 and tokens for an agent, and the note that 3 tests ran before and 3 after with node --test.
Image: shrink-anything repository.그림: shrink-anything 저장소. Copyright (c) 2026 EL4CTEO · MIT License Open original원본 보기

All algoit posts알고IT 글 목록

Follow our AI news onAI 소식 팔로우하기X Instagram Threads