Skip to content

Latest commit

ย 

History

91 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kratos

CI

ํ•œ๊ตญ์–ด | 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/์œผ๋กœ ์ด๋™ํ•ด ๋ณด์กดํ•ฉ๋‹ˆ๋‹ค. ์ž๋™ ๋ฌผ๋ฆฌ ์‚ญ์ œ๋Š” ์ˆ˜ํ–‰ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

v1 ์ƒํƒœ์™€ ์•ˆ์ „ ๊ฒฝ๊ณ„

ํ˜„์žฌ 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, paths alias ํ•ด์„
  • package.json์˜ main, module, types, bin, exports entrypoint ํ•ด์„
  • package.json scripts, GitHub Actions workflow/composite action run ๋ช…๋ น์ด ์‹คํ–‰ํ•˜๋Š” ๋กœ์ปฌ 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.json

scan --output์— ์ƒ๋Œ€ ๊ฒฝ๋กœ๋ฅผ ๋„˜๊ธฐ๋ฉด ์Šค์บ” ๋Œ€์ƒ root ๊ธฐ์ค€์œผ๋กœ ํ•ด์„๋ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ์ €์žฅ ์œ„์น˜๋Š” <root>/.kratos/latest-report.json์ž…๋‹ˆ๋‹ค.

๋ช…๋ น์–ด

kratos scan [root] [--output path] [--no-write] [--json]

ํ”„๋กœ์ ํŠธ๋ฅผ ๋ถ„์„ํ•˜๊ณ  report JSON์„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

  • root๋ฅผ ์ƒ๋žตํ•˜๋ฉด ํ˜„์žฌ ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์Šค์บ”ํ•ฉ๋‹ˆ๋‹ค.
  • --output path๋Š” report ์ €์žฅ ์œ„์น˜๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
  • --no-write๋Š” ๋ถ„์„ ๊ฒฐ๊ณผ๋ฅผ ์ถœ๋ ฅํ•˜๋˜ report ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  • --json์€ ์ฝ˜์†” ์š”์•ฝ ๋Œ€์‹  ์ „์ฒด JSON report๋ฅผ stdout์œผ๋กœ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  • ๊ธฐ๋ณธ ์ถœ๋ ฅ ๊ฒฝ๋กœ๋Š” <root>/.kratos/latest-report.json์ž…๋‹ˆ๋‹ค.

kratos report [report-path-or-root] [--format summary|json|md]

์ €์žฅ๋œ report๋ฅผ ์‚ฌ๋žŒ์ด ์ฝ๊ธฐ ์‰ฌ์šด ํ˜•์‹ ๋˜๋Š” ์›๋ณธ JSON์œผ๋กœ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

  • summary๋Š” ๊ธฐ๋ณธ ์ฝ˜์†” ์š”์•ฝ์ž…๋‹ˆ๋‹ค.
  • json์€ ์ €์žฅ๋œ report JSON์„ pretty-printํ•ฉ๋‹ˆ๋‹ค.
  • md๋Š” ๊ณต์œ ํ•˜๊ธฐ ์‰ฌ์šด Markdown report๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  • ์ž…๋ ฅ์ด ํ”„๋กœ์ ํŠธ root์ด๋ฉด .kratos/latest-report.json์„ ์ž๋™์œผ๋กœ ์ฐพ์Šต๋‹ˆ๋‹ค.

kratos diff [before-report-path-or-root] [after-report-path-or-root] [--format summary|json|md]

๋‘ 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๊ฐ€ ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

kratos clean [report-path-or-root] [--apply] [--min-confidence value]

์‚ญ์ œ ํ›„๋ณด๋ฅผ 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 Bump workflow๋Š” ๋Œ€์ƒ ๋ฒ„์ „์œผ๋กœ package.json๊ณผ platform optionalDependencies ๋ฒ„์ „์„ ๋งž์ถ”๋Š” version-only PR์„ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค.
  • tag๋ฅผ ๋งŒ๋“ค๊ธฐ ์ „์—๋Š” ๊ฐ™์€ commit์—์„œ cargo test --workspace, npm run verify, native packaging CI๊ฐ€ ํ†ต๊ณผํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
  • Release Publish workflow๋Š” ์ง€์ •๋œ 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-up workflow๋Š” ๊ฒŒ์‹œ๋œ ๋ฆด๋ฆฌ์Šค์— ๋Œ€์‘ํ•˜๋Š” 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๋กœ ํ™•์ธํ•˜์„ธ์š”.

About

Rust CLI for finding dead code in JS/TS projects: orphan files, broken imports, dead exports, reports, diffs, and safe cleanup previews.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages