ํ๊ตญ์ด | English | ไธญๆ | Espaรฑol | ๆฅๆฌ่ช
์ฃฝ์ ์ฝ๋๋ฅผ ๊ฐ์ฐจ ์์ด ์ฐพ์๋ ๋๋ค.
๋ผ์ด์ ์ค ยท ๊ธฐ์ฌ ๊ฐ์ด๋ ยท ํ๋ ๊ฐ๋ น ยท ๋ณด์ ยท ํ์
Kratos๋ JavaScript/TypeScript ํ๋ก์ ํธ์์ ์ฌ์ฉ๋์ง ์๋ ํ์ผ, ๋์ด์ง import, ์ฌ์ฉ๋์ง ์๋ export, ๊ณ ๋ฆฝ๋ ๋ชจ๋์ ์ฐพ์ ๋ฆฌํฌํธ๋ก ๋จ๊ธฐ๋ CLI ๋๊ตฌ์
๋๋ค. ํ์ฌ ๊ตฌ์กฐ๋ Rust core/CLI์ npm launcher๋ฅผ ๊ฒฐํฉํ๋ฉฐ, npm ํจํค์ง @jeremyfellaz/kratos๊ฐ ํ๋ซํผ๋ณ native addon ํจํค์ง๋ฅผ ์ ํ์ ์ผ๋ก ๋ถ๋ฌ ์คํํฉ๋๋ค.
Kratos๋ ์๋ ์ญ์ ๋๊ตฌ๋ผ๊ธฐ๋ณด๋ค ์์ ํ ์ ๋ฆฌ ํ๋ฆ์ ์ํ ๋ถ์ ๋๊ตฌ์
๋๋ค. clean์ ๊ธฐ๋ณธ์ ์ผ๋ก dry-run์ด๋ฉฐ, --apply๋ ๊ฒ์ฆ๋ ํ์ผ์ ์๋ ์ฝ๋ ๊ฒฝ๋ก์์ <root>/.kratos/clean-quarantine/์ผ๋ก ์ด๋ํด ๋ณด์กดํฉ๋๋ค. ์๋ ๋ฌผ๋ฆฌ ์ญ์ ๋ ์ํํ์ง ์์ต๋๋ค.
ํ์ฌ npm ๋ฒ์ ์ 0.3.7์ด๋ฉฐ v1.0์ ์์ง ์ถ์๋์ง ์์์ต๋๋ค. v1 ๋ฒ์๋ scan, report, diff, clean, schema v3, scan --no-write, ๊ทธ๋ฆฌ๊ณ ๋ณด์กด ๊ฒฉ๋ฆฌํ clean --apply์
๋๋ค. Windows ๋ฑ Unix descriptor-relative ์์ ๊ฒ์ฆ์ ์ ๊ณตํ์ง ์๋ ํ๋ซํผ์์๋ clean --apply๊ฐ fail-closed๋ฉ๋๋ค. sweep, watch, workspace/cache ๋ฐ HTML report๋ v1.1+ ํ๋ณด์ด๋ฉฐ ํ์ฌ ๋ช
๋ น/๊ธฐ๋ฅ์ผ๋ก ์ฝ์ํ์ง ์์ต๋๋ค.
๋ฆด๋ฆฌ์ค ํ๋ณด๋ candidate SHA์ manifest version์ ๋ง์ถ ๋ค, packed root package์ ํ๋ซํผ addon์ consumer smoke๋ฅผ ํ์ธํฉ๋๋ค. ๊ฒ์ ํ์๋ GitHub Release/Publish run, root+5 addon package, expected npm dist-tag๊ฐ ๊ฐ์ version์ ๊ฐ๋ฆฌํค๋์ง ๊ฐ์ฌํฉ๋๋ค.
- ์ฌ์ฉ๋์ง ์๋ ํ์ผ๊ณผ ๊ณ ๋ฆฝ๋ component/module ํ๋ณด ํ์ง
- ๋์ด์ง ๋ด๋ถ import ํ์ง
- ์ฌ์ฉ๋์ง ์๋ export์ import ํ๋ณด ํ์ง
- Next.js
app//pages/route entrypoint ํด๋ฆฌ์คํฑ tsconfig.json/jsconfig.json์baseUrl,pathsalias ํด์package.json์main,module,types,bin,exportsentrypoint ํด์package.jsonscripts, GitHub Actions workflow/composite actionrun๋ช ๋ น์ด ์คํํ๋ ๋ก์ปฌ script entrypoint ๋ณดํธscripts/verify-*,scripts/*smoke*,scripts/*validation*ํํ์ ์๋ ๊ฒ์ฆ script ๋ณดํธ- ์ค์บ ๋์ source tree ์์
*.test.*,*.spec.*,src/__tests__/**ํ ์คํธ ํ์ผ์ ์ญ์ ํ๋ณด์์ ์ ์ธํ๊ณ ํ ์คํธ import edge ๋ฐ์ - Next.js framework-consumed export, ์ธ์ ๊ฐ๋ฅํ dynamic import wrapper, ์์ re-export barrel ๋ณด์ ์ฒ๋ฆฌ
- ์ ์ฅ๋ ๋ฆฌํฌํธ ์์ฝ, JSON, Markdown ์ถ๋ ฅ
- ๋ ๋ฆฌํฌํธ ๊ฐ finding ๋ณํ ๋น๊ต
- ์ ๋ขฐ๋ ๊ธฐ์ค๊ฐ์ ์ ์ฉํ ์์ ์ญ์ ํ๋ณด ๋ฏธ๋ฆฌ๋ณด๊ธฐ
ํจํค์ง ์ฌ์ฉ์ ๊ธฐ์ค ๊ธฐ๋ณธ ์คํ ๋ฐฉ์์ npx์
๋๋ค.
npx @jeremyfellaz/kratos scan ./my-app
npx @jeremyfellaz/kratos report ./my-app
npx @jeremyfellaz/kratos report ./my-app --format md
npx @jeremyfellaz/kratos clean ./my-app --min-confidence 0.9๋ฆฌํฌํธ๋ฅผ ํ์ธํ ๋ค ์๋ ์ฝ๋ ๊ฒฝ๋ก์์ ๊ฒฉ๋ฆฌํ ๋๋ง --apply๋ฅผ ๋ถ์
๋๋ค.
npx @jeremyfellaz/kratos clean ./my-app --apply --min-confidence 0.9๋ ์์ ์ ๋ฆฌํฌํธ๋ฅผ ๋น๊ตํ ์๋ ์์ต๋๋ค.
npx @jeremyfellaz/kratos scan ./my-app --output .kratos/before.json
# ์ฝ๋๋ฅผ ์ ๋ฆฌํ๊ฑฐ๋ ๋ธ๋์น๋ฅผ ๋ฐ๊พผ ๋ค
npx @jeremyfellaz/kratos scan ./my-app --output .kratos/after.json
npx @jeremyfellaz/kratos diff ./my-app/.kratos/before.json ./my-app/.kratos/after.jsonscan --output์ ์๋ ๊ฒฝ๋ก๋ฅผ ๋๊ธฐ๋ฉด ์ค์บ ๋์ root ๊ธฐ์ค์ผ๋ก ํด์๋ฉ๋๋ค. ๊ธฐ๋ณธ ์ ์ฅ ์์น๋ <root>/.kratos/latest-report.json์
๋๋ค.
ํ๋ก์ ํธ๋ฅผ ๋ถ์ํ๊ณ report JSON์ ์ ์ฅํฉ๋๋ค.
root๋ฅผ ์๋ตํ๋ฉด ํ์ฌ ์์ ๋๋ ํฐ๋ฆฌ๋ฅผ ์ค์บํฉ๋๋ค.--output path๋ report ์ ์ฅ ์์น๋ฅผ ์ง์ ํฉ๋๋ค.--no-write๋ ๋ถ์ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํ๋ report ํ์ผ์ ์์ฑํ์ง ์์ต๋๋ค.--json์ ์ฝ์ ์์ฝ ๋์ ์ ์ฒด JSON report๋ฅผ stdout์ผ๋ก ์ถ๋ ฅํฉ๋๋ค.- ๊ธฐ๋ณธ ์ถ๋ ฅ ๊ฒฝ๋ก๋
<root>/.kratos/latest-report.json์ ๋๋ค.
์ ์ฅ๋ report๋ฅผ ์ฌ๋์ด ์ฝ๊ธฐ ์ฌ์ด ํ์ ๋๋ ์๋ณธ JSON์ผ๋ก ์ถ๋ ฅํฉ๋๋ค.
summary๋ ๊ธฐ๋ณธ ์ฝ์ ์์ฝ์ ๋๋ค.json์ ์ ์ฅ๋ report JSON์ pretty-printํฉ๋๋ค.md๋ ๊ณต์ ํ๊ธฐ ์ฌ์ด Markdown report๋ฅผ ์ถ๋ ฅํฉ๋๋ค.- ์
๋ ฅ์ด ํ๋ก์ ํธ root์ด๋ฉด
.kratos/latest-report.json์ ์๋์ผ๋ก ์ฐพ์ต๋๋ค.
๋ report์ finding ๋ณํ๋ฅผ ๋น๊ตํฉ๋๋ค.
- ๊ธฐ๋ณธ ํ์์
summary์ ๋๋ค. json์ introduced/resolved/persisted finding์ machine-readable ํ์์ผ๋ก ์ถ๋ ฅํฉ๋๋ค.md๋ ๋ฆฌ๋ทฐ๋ ์ด์์ ๋ถ์ด๊ธฐ ์ฌ์ด Markdown diff๋ฅผ ์ถ๋ ฅํฉ๋๋ค.- JSON/Markdown diff๋
identityVersion: 1๊ณผ ์ ์ฒดkratos:v1:<sha256>finding ID๋ฅผ ๋ ธ์ถํฉ๋๋ค. ID๋ finding ์ข ๋ฅ, ์ ๊ทํ๋ root-relative ๊ฒฝ๋ก, semantic locator๋ก๋ง ๊ณ์ฐํ๋ฉฐ reason, confidence,safe,cleanSafety, timestamp๋ ์ ์ธํฉ๋๋ค. - ๊ฐ ์ ๋ ฅ์ report ํ์ผ ๊ฒฝ๋ก ๋๋ ํ๋ก์ ํธ root๊ฐ ๋ ์ ์์ต๋๋ค.
์ญ์ ํ๋ณด๋ฅผ previewํ๊ฑฐ๋ ์๋ ์ฝ๋ ๊ฒฝ๋ก์์ ๋ณด์กด ๊ฒฉ๋ฆฌํฉ๋๋ค.
- ๊ธฐ๋ณธ ๋์์ dry-run์ ๋๋ค.
--apply๋ฅผ ๋ถ์ด๋ฉด ํ์ผ์<root>/.kratos/clean-quarantine/์ผ๋ก ์ด๋ํด ๋ณด์กดํ๋ฉฐ ์๋์ผ๋ก ๋ฌผ๋ฆฌ ์ญ์ ํ์ง ์์ต๋๋ค.--min-confidence value๋0.0๋ถํฐ1.0๊น์ง์ confidence threshold์ ๋๋ค.--min-confidence๋ฅผ ์๋ตํ๋ฉดkratos.config.json์thresholds.cleanMinConfidence๋ฅผ ์ฌ์ฉํ๊ณ , ์ค์ ์ด ์์ผ๋ฉด0.0์ ์ฌ์ฉํฉ๋๋ค.
fixtures/demo-app์ ์ค์บํ๋ฉด ์์ฝ ์ถ๋ ฅ์ ์๋์ ๊ฐ์ ํํ์
๋๋ค.
Kratos scan complete.
Impact: 6 actionable findings: 1 broken import, 2 cleanup candidates, 3 dead exports.
Best next move: Fix broken imports before deleting files.
Root: <root>
Files scanned: 5
Entrypoints: 1
Broken imports: 1
Orphan files: 2
Dead exports: 3
Unused imports: 0
Route entrypoints: 1
Deletion candidates: 2
Saved report: <root>/.kratos/latest-report.json
Next steps:
- Preview cleanup: kratos clean <root>/.kratos/latest-report.json
- Shareable markdown: kratos report <root>/.kratos/latest-report.json --format md
Broken imports:
- src/lib/broken.ts -> ./missing-helper
Top cleanup candidates:
- src/components/DeadWidget.tsx (confidence 0.92, Component-like module has no inbound references.)
- src/lib/broken.ts (confidence 0.88, Module has no inbound references and is not treated as an entrypoint.)
Orphan files:
- src/components/DeadWidget.tsx
- src/lib/broken.ts
Dead exports:
- src/components/DeadWidget.tsx#DeadWidget
- src/lib/broken.ts#brokenFeature
- src/lib/math.ts#multiply
clean --min-confidence 0.9๋ ์ ๋ขฐ๋ ๊ธฐ์ค๊ฐ์ ํต๊ณผํ ์ญ์ ํ๋ณด์ ์ ์ธ๋ ํ๋ณด๋ฅผ ๋๋ ๋ณด์ฌ์ค๋๋ค.
Kratos clean dry run.
Deletion targets: 1
- <root>/src/components/DeadWidget.tsx (confidence 0.92, Component-like module has no inbound references.)
Threshold-skipped targets: 1
- <root>/src/lib/broken.ts (confidence 0.88, Module has no inbound references and is not treated as an entrypoint.)
Re-run with --apply to move these files into retained quarantine.
๋์ผํ ๋ ๋ฆฌํฌํธ๋ฅผ ๋น๊ตํ๋ฉด ์๋ก ์๊ธฐ๊ฑฐ๋ ํด๊ฒฐ๋ ํ์ง ๊ฒฐ๊ณผ ์์ด ์ ์ง ์ค์ธ ๊ฐ์๋ง ํ์๋ฉ๋๋ค.
Kratos diff complete.
Before: <before-report>
After: <after-report>
Broken imports: introduced 0, resolved 0, persisted 1
Orphan files: introduced 0, resolved 0, persisted 2
Dead exports: introduced 0, resolved 0, persisted 3
Unused imports: introduced 0, resolved 0, persisted 0
Route entrypoints: introduced 0, resolved 0, persisted 1
Deletion candidates: introduced 0, resolved 0, persisted 2
Totals: introduced 0, resolved 0, persisted 9
ํ์ฌ scan์ schemaVersion: 3 report๋ฅผ ์์ฑํฉ๋๋ค.
{
"schemaVersion": 3,
"summary": {
"filesScanned": 5,
"entrypoints": 1,
"brokenImports": 1,
"orphanFiles": 2,
"deadExports": 3,
"unusedImports": 0,
"routeEntrypoints": 1,
"deletionCandidates": 2
},
"cleanSafety": {
"fingerprintAlgorithm": "sha256",
"candidates": [
{
"file": "<absolute-path>",
"fingerprint": "<sha256-or-null>",
"identity": "<stable-file-identity-or-null>",
"parentIdentity": "<stable-parent-identity-or-null>"
}
]
}
}findings์๋ brokenImports, orphanFiles, deadExports, unusedImports, routeEntrypoints, deletionCandidates๊ฐ ๋ค์ด๊ฐ๋๋ค. graph.modules์๋ ๋ถ์๋ ๋ชจ๋ ๊ฒฝ๋ก, entrypoint ์ฌ๋ถ, import/export ๊ฐ์๊ฐ ๊ธฐ๋ก๋ฉ๋๋ค.
v2/legacy report๋ ๊ณ์ ์ฝ์ ์ ์์ง๋ง cleanSafety evidence๊ฐ ์์ผ๋ฏ๋ก clean --apply์์๋ fail-closed๋ฉ๋๋ค.
ํ๋ก์ ํธ root์ kratos.config.json์ ๋ ์ ์์ต๋๋ค. JSONC ์คํ์ผ ์ฃผ์๊ณผ trailing comma๋ฅผ ํ์ฉํฉ๋๋ค.
{
"ignore": ["storybook-static", "generated"],
"ignorePatterns": ["src/generated/**", "!src/generated/keep.ts"],
"keepPatterns": ["scripts/manual-*.mjs"],
"entry": ["src/bootstrap.ts"],
"roots": ["src", "app", "pages"],
"thresholds": {
"cleanMinConfidence": 0.85
},
"suppressions": [
{
"kind": "deadExport",
"file": "src/components/LazyCard.tsx",
"export": "default",
"reason": "Loaded dynamically by route metadata."
},
{
"kind": "brokenImport",
"file": "src/legacy/shim.ts",
"source": "./generated-shim",
"reason": "Generated at deploy time."
}
]
}ignore: ๊ธฐ๋ณธ ignore ๋ชฉ๋ก์ ์ถ๊ฐํ ๋๋ ํฐ๋ฆฌ ์ด๋ฆ์ ๋๋ค.ignorePatterns:.gitignore์คํ์ผ ๊ฒฝ๋ก ํจํด์ ๋๋ค.!๋ก ์์ธ๋ฅผ ๋ ์ ์์ต๋๋ค.- Kratos๋ ๊ธฐ๋ณธ ignore ๋๋ ํฐ๋ฆฌ ์ดํ ํ๋ก์ ํธ root์
.gitignore๋ฅผ ์๋์ผ๋ก ์ฝ๊ณ , ๊ทธ ๋ค์ignorePatterns๋ฅผ ์ ์ฉํด ์์ธ/override๋ฅผ ์ค ์ ์์ต๋๋ค. keepPatterns:.gitignore์คํ์ผ ๊ฒฝ๋ก ํจํด์ ๋๋ค. ๋งค์นญ๋ ํ์ผ์ ์ค์บ์์ ์ ์ธํ์ง ์๊ณ orphan/deletion candidate์์๋ง ๋ณดํธํฉ๋๋ค.entry: entrypoint๋ก ๊ฐ์ ์ง์ ํ ํ๋ก์ ํธ root ๊ธฐ์ค ์๋ ํ์ผ ๊ฒฝ๋ก์ ๋๋ค.roots: ์ค์บ ๋ฒ์๋ฅผ ์ ํํ ํ๋ก์ ํธ root ๊ธฐ์ค ์๋ ๋๋ ํฐ๋ฆฌ์ ๋๋ค.thresholds.cleanMinConfidence:clean์ ๊ธฐ๋ณธ ์ ๋ขฐ๋ ๊ธฐ์ค๊ฐ์ ๋๋ค.suppressions: ์๋์ ์ผ๋ก ๋ฌด์ํ ํ์ง ๊ฒฐ๊ณผ์ ๋๋ค.kind๋brokenImport,orphanFile,deadExport,unusedImport,deletionCandidate์ค ํ๋์ ๋๋ค.
Kratos๋ .kratos/suppressions.json์ด ์์ผ๋ฉด ๊ฐ์ suppression ํ์์ผ๋ก ํจ๊ป ์ฝ์ต๋๋ค. file ๊ฐ์ ํ๋ก์ ํธ root ๊ธฐ์ค ์๋ ๊ฒฝ๋ก์ฌ์ผ ํฉ๋๋ค.
ํ์ ์กฐ๊ฑด:
- Node.js 18+
- npm 9+
- Rust stable toolchain
์ค์น:
npm install๊ถ์ฅ ๊ฒ์ฆ:
cargo test --workspace
npm run verify
npm run smoke์ ์ฅ์ checkout์์๋ published native addon ํจํค์ง๊ฐ ์์ ์ ์์ผ๋ฏ๋ก npx @jeremyfellaz/kratos ...๋ณด๋ค ์๋ ๋ช
๋ น์ด ์์ ํฉ๋๋ค.
npm run scan -- ./fixtures/demo-app
npm run report -- ./fixtures/demo-app/.kratos/latest-report.json
npm run clean -- ./fixtures/demo-app/.kratos/latest-report.json
cargo run -p kratos-cli -- diff ./fixtures/demo-app ./fixtures/demo-app- root npm package๋
@jeremyfellaz/kratos์ ๋๋ค. - CLI binary ์ด๋ฆ์
kratos์ ๋๋ค. - platform addon package๋ macOS arm64/x64, Linux x64/arm64, Windows x64๋ฅผ ๋์์ผ๋ก ํฉ๋๋ค.
- root package์
optionalDependencies๋ ๊ฐ์ ๋ฆด๋ฆฌ์ค ๋ฒ์ ์ platform addon package๋ฅผ ๊ฐ๋ฆฌํต๋๋ค. - raw checkout์์๋ native addon์ด ์์ ์ ์์ง๋ง, ๋ฆด๋ฆฌ์ค ํจํค์ง์์๋ launcher๊ฐ ํ์ฌ ํ๋ซํผ์ ๋ง๋ addon์ ๋ก๋ํฉ๋๋ค.
๋ฆด๋ฆฌ์ค๋ vX.Y.Z ๋๋ vX.Y.Z-prerelease.N ํํ์ semver tag๋ฅผ ๊ธฐ์ค์ผ๋ก ์์ง์
๋๋ค.
Manual Release Bumpworkflow๋ ๋์ ๋ฒ์ ์ผ๋กpackage.json๊ณผ platformoptionalDependencies๋ฒ์ ์ ๋ง์ถ๋ version-only PR์ ์ค๋นํฉ๋๋ค.- tag๋ฅผ ๋ง๋ค๊ธฐ ์ ์๋ ๊ฐ์ commit์์
cargo test --workspace,npm run verify, native packaging CI๊ฐ ํต๊ณผํด์ผ ํฉ๋๋ค. Release Publishworkflow๋ ์ง์ ๋ tag ref๋ฅผ checkoutํ๊ณ Node package ๊ฒ์ฆ, Rust workspace test, platform native artifact build๋ฅผ ์ํํฉ๋๋ค.- platform addon npm package๋ฅผ ๋จผ์ pack/smoke/publishํ๊ณ , ๋ง์ง๋ง์ root package๋ฅผ publishํ ๋ค GitHub Release๋ฅผ ์์ฑํ๊ฑฐ๋ ๊ฐฑ์ ํฉ๋๋ค.
Release Published Follow-upworkflow๋ ๊ฒ์๋ ๋ฆด๋ฆฌ์ค์ ๋์ํ๋ publish run ์ฑ๊ณต ์ฌ๋ถ์ ๋ฆด๋ฆฌ์ค asset ์กด์ฌ ์ฌ๋ถ๋ฅผ ๊ฐ์ฌํฉ๋๋ค. ์ด workflow๋ publish๋ฅผ ๋ค์ ์คํํ์ง ์์ต๋๋ค.
release tag push, npm publish, GitHub Release ๊ฒ์ ๊ฐ์ ์์ ์ ์ ์ง๋ณด์์ ํ์ธ ํ์๋ง ์งํํฉ๋๋ค.
Kratos๋ MIT ๋ผ์ด์ ์ค๋ก ๊ณต๊ฐ๋๋ ์คํ์์ค ํ๋ก์ ํธ์ ๋๋ค.
- ๋ฒ๊ทธ ์ ๋ณด์ ๊ธฐ๋ฅ ์ ์์ GitHub Issues๋ฅผ ์ฌ์ฉํด ์ฃผ์ธ์.
- ๋ณด์ ์ด์๋ ๊ณต๊ฐ ์ด์๋ก ์ฌ๋ฆฌ์ง ๋ง๊ณ SECURITY.md์ ์ ์ฐจ๋ฅผ ๋ฐ๋ผ ์ฃผ์ธ์.
- ๊ธฐ์ฌ ์ ์๋ CONTRIBUTING.md์ CODE_OF_CONDUCT.md๋ฅผ ํ์ธํด ์ฃผ์ธ์.
- ํ๋ก์ ํธ ์ ์ง์ ๋์์ด ๋๊ณ ์ถ๋ค๋ฉด GitHub Sponsors๋ฅผ ํตํด ํ์ํ ์ ์์ต๋๋ค.
Kratos๋ ๋ณด์์ ์ธ ์ ์ ๋ถ์๊ณผ ํด๋ฆฌ์คํฑ์ ํจ๊ป ์ฌ์ฉํฉ๋๋ค. ํ์ฌ ๊ตฌํ์ ์๋ ค์ง Next.js route export, package/workflow/action script entrypoint, ์๋ ๊ฒ์ฆ script, tooling config, ํ
์คํธ ํ์ผ, ์ธ์ ๊ฐ๋ฅํ React.lazy/next/dynamic wrapper, ์์ re-export barrel์ ๋ณดํธํฉ๋๋ค. ๊ทธ๋๋ custom runtime entrypoint, ์์ฑ ํ์ผ, ํ๋ก์ ํธ ๊ณ ์ loader๋ ์ ์ ๋ถ์ ๋ฐ์ ์์ ์ ์์ผ๋ฏ๋ก ํ์ํ๋ฉด entry, keepPatterns, suppression์ผ๋ก ๋ช
์ํ๊ณ , ๋จ์ deletion candidate๋ --apply ์ ์ report์ diff๋ก ํ์ธํ์ธ์.