9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
5.6 KiB
5.6 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-dependency-analysis | Dependency Analysis | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Dependency Analysis
매 한 줄
"매 import graph 가 매 codebase 의 X-ray". 매 Madge / dependency-cruiser / Knip / depcheck 가 매 dead code, circular deps, layering violations, unused packages 의 surface. 2026 의 매 Knip + dependency-cruiser + Turbo's prune 가 매 monorepo standard combo.
매 핵심
매 question types
- Module-level: who imports X? what does X import?
- Package-level: which deps are unused? which are dev-only mislabeled?
- Architectural: 매 cross-layer 의 import 가 있나?
- Cycles: 매 circular dependency.
- Reachability: 매 entry-point 의 reachable X 의 dead code.
매 tool matrix
- Madge — 매 visualization, circular detection (JS/TS).
- dependency-cruiser — 매 rules engine + violations CI.
- Knip — 매 unused files/exports/deps (replaces ts-prune + depcheck).
- depcheck — 매 unused npm deps (older, Knip 가 better).
- ts-morph / typescript-eslint — 매 custom AST analyzer.
- Nx graph / Turborepo prune — 매 monorepo affected detection.
매 응용
- CI guard — 매 layer violation 시 fail.
- Dead-code removal — 매 quarterly cleanup.
- Bundle reduction — 매 unused dep removal → smaller install + lockfile.
- Refactor planning — 매 high-fan-in module 의 identify.
- License audit — 매 transitive dep tree.
💻 패턴
Madge 의 circular detection
npx madge --circular --extensions ts,tsx src/
# 매 circular 가 있으면 fail.
npx madge --image graph.svg src/
# 매 SVG 의 visualization.
dependency-cruiser rules
// .dependency-cruiser.cjs
module.exports = {
forbidden: [
{ name: 'no-circular', severity: 'error', from: {}, to: { circular: true } },
{ name: 'no-orphans', severity: 'warn', from: { orphan: true, pathNot: '\\.test\\.ts$' }, to: {} },
{ name: 'domain-not-import-ui', severity: 'error',
from: { path: '^src/domain' }, to: { path: '^src/ui' } },
{ name: 'no-deprecated-core', severity: 'error',
from: {}, to: { dependencyTypes: ['core'], path: '^(punycode|domain)$' } },
],
options: { tsConfig: { fileName: 'tsconfig.json' } },
};
depcruise --config .dependency-cruiser.cjs src/
Knip (unused exports/files/deps)
// knip.json
{
"entry": ["src/index.ts", "src/cli.ts"],
"project": ["src/**/*.{ts,tsx}"],
"ignoreDependencies": ["husky"]
}
npx knip
# 매 unused files, unused exports, unused deps 의 list.
Turborepo prune (monorepo)
turbo prune --scope=@acme/web --docker
# 매 web 의 deps 만 가진 minimal package.json 의 emit — Docker layer cache 의 efficient.
Nx affected graph
npx nx graph
npx nx affected:test --base=main
# 매 변경된 project 의 transitive consumers 만 test.
Custom AST scanner (ts-morph)
import { Project } from 'ts-morph';
const project = new Project({ tsConfigFilePath: 'tsconfig.json' });
const violations: string[] = [];
for (const sf of project.getSourceFiles()) {
for (const imp of sf.getImportDeclarations()) {
const spec = imp.getModuleSpecifierValue();
if (sf.getFilePath().includes('/domain/') && spec.startsWith('@/ui')) {
violations.push(`${sf.getFilePath()} -> ${spec}`);
}
}
}
if (violations.length) { console.error(violations.join('\n')); process.exit(1); }
Bundle-level (esbuild metafile / vite-bundle-visualizer)
vite build --emptyOutDir
npx vite-bundle-visualizer
# 매 actual shipped bytes per package — install-time deps 의 differ.
License + SBOM cross-check
npx license-checker --production --json > licenses.json
npx @cyclonedx/cyclonedx-npm --output-file sbom.json
매 결정 기준
| 상황 | Approach |
|---|---|
| Quick circular check | Madge |
| Layer enforcement in CI | dependency-cruiser |
| Unused files/exports/deps | Knip |
| Monorepo affected detection | Turbo / Nx |
| Custom rules | ts-morph script |
| Bundle size (runtime) | vite/esbuild visualizer |
기본값: Knip + dependency-cruiser in CI; Madge ad-hoc for visualization; Turbo/Nx in monorepos.
🔗 Graph
- 부모: Static-Analysis · Code-Quality
- 변형: dependency-cruiser
- 응용: Monorepo
- Adjacent: SBOM · Turborepo
🤖 LLM 활용
언제: 매 dependency-cruiser rule synthesis from architecture description, 매 Knip output 의 triage (which 의 truly unused), 매 graph interpretation. 언제 X: 매 actual dead-code removal 의 PR (false positive 의 review 필요). 매 production runtime decisions.
❌ 안티패턴
- Run only locally: 매 CI guard 가 X — 매 violation 의 sneak in.
- Knip 의 trust blindly: 매 dynamic require / framework convention 가 false-positive —
ignoreglob 사용. - No layer rules: 매 architecture 가 silently rot.
- Visualization only: 매 SVG 가 cool 가, 매 enforcement 가 X.
- Run on dist/: 매 source 의 analyze, 매 bundled 의 X.
🧪 검증 / 중복
- Verified (Madge docs, dependency-cruiser docs, Knip docs, Turborepo, Nx).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — dependency analysis tools and CI patterns |