c24165b8bc
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4.9 KiB
4.9 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-automated-refactoring-tools | Automated Refactoring Tools | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Automated Refactoring Tools
매 한 줄
"매 AST-level 의 transform — 매 sed 의 X, 매 syntax-aware 의 mass-edit". 매 IDE refactor (Rename · Extract) 의 80년대 Smalltalk 의 root, 2026 의 LLM-augmented codemod (Claude Opus 4.7 + ast-grep) 의 mainstream.
매 핵심
매 3 tier 의 tool
- IDE-builtin: IntelliJ · VS Code · Rider — 매 single-file 의 dominant.
- Codemod: jscodeshift · ts-morph · comby · ast-grep — 매 cross-cutting mass change.
- LLM-driven: Claude Code · Cursor · GitHub Copilot Workspace — 매 semantic-aware 의 modernization.
매 refactor 종류
- Rename (symbol-aware).
- Extract function/variable/component.
- Inline.
- Move (file/module).
- Change signature.
- Convert (e.g.
var → const,function → arrow).
매 응용
- 매 framework migration (Vue 2 → Vue 3, React class → hook).
- API breaking change 의 fan-out fix.
- Code style 의 mechanical enforcement.
💻 패턴
ts-morph: rename + add property
import { Project } from "ts-morph";
const project = new Project({ tsConfigFilePath: "tsconfig.json" });
for (const sf of project.getSourceFiles()) {
for (const cls of sf.getClasses()) {
if (cls.getName()?.endsWith("Service")) {
cls.rename(cls.getName()!.replace(/Service$/, "Manager"));
cls.addProperty({ name: "createdAt", type: "Date", initializer: "new Date()" });
}
}
}
await project.save();
ast-grep: pattern → rewrite (yaml rule)
id: useEffect-cleanup
language: tsx
rule:
pattern: useEffect(() => { $$$BODY }, $DEPS)
fix: |
useEffect(() => {
$$$BODY
return () => { /* cleanup */ };
}, $DEPS)
ast-grep scan -r useEffect-cleanup.yml --update-all
jscodeshift: Vue Options → Composition API
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
root.find(j.ObjectExpression)
.filter(p => p.node.properties.some(pr => pr.key?.name === "data"))
.forEach(path => {
// emit setup() function with refs
// ...
});
return root.toSource();
}
jscodeshift -t vue-comp-api.js src/
comby (language-agnostic structural search)
comby 'console.log(:[args])' 'logger.debug(:[args])' .ts -i
LLM codemod (Claude Opus 4.7) — semantic-aware
import anthropic
client = anthropic.Anthropic()
SYSTEM = "You convert React class components to functional + hooks. Preserve behavior."
with open("UserCard.tsx") as f:
src = f.read()
resp = client.messages.create(
model="claude-opus-4-7",
max_tokens=4096,
system=SYSTEM,
messages=[{"role": "user", "content": src}],
)
print(resp.content[0].text)
IDE script: IntelliJ structural search
$method$($args$) { $body$ }
→ Constraints: method matches ".*Async$"
→ Replace with: async $method$($args$) { $body$ }
매 결정 기준
| 상황 | Tool |
|---|---|
| 매 single-file rename in IDE | IDE builtin |
| TS-only · type-aware | ts-morph |
| TS/JS · less type-aware · faster | jscodeshift |
| Multi-language · structural | comby · ast-grep |
| 매 semantic refactor · framework migration | LLM codemod |
| Mass mechanical regex-safe | sed/perl (드물게) |
기본값: TypeScript 의 ts-morph, polyglot 의 ast-grep, 매 semantic 의 LLM.
🔗 Graph
- 부모: Refactoring_Best_Practices · AST_Traversal
- 응용: Architecture_Refactor
- Adjacent: AI-Assisted Refactoring (AI 기반 리팩토링) · AST_Traversal
🤖 LLM 활용
언제: 매 semantic refactor (class→hook, callback→async/await), 매 deterministic rule 의 hard 의 case. 언제 X: 매 mechanical rename 의 case — IDE 가 cheaper · safer. LLM 의 hallucination risk 의 require code review.
❌ 안티패턴
- Regex-only refactor: 매 string match 의 false positive (comment · string literal).
- Test 없음 refactor: 매 mass codemod 의 test suite 의 gate 의 require.
- PR 의 single huge codemod: 매 review 의 X — file-by-file commit 의 split.
- LLM output 의 blind merge: 매 type-check + test 의 gate 의 mandatory.
🧪 검증 / 중복
- Verified (ts-morph docs, Meta jscodeshift, comby.dev, ast-grep.github.io, Anthropic Claude API docs).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 3-tier taxonomy + ts-morph/ast-grep/comby/LLM examples |