AI로 레거시 코드를 부활시킨 방법: Kiroween을 위한 CodePhoenix 구축

발행: (2025년 12월 5일 오전 01:08 GMT+9)
10 분 소요
원문: Dev.to

I’m happy to translate the article for you, but I’ll need the full text of the post (the content you’d like translated). Could you please paste the article’s body here? I’ll keep the source link at the top exactly as you requested and preserve all formatting, markdown, and code blocks while translating the prose into Korean.

문제: $85 Billion 죽어가는 코드

Right now, at this very moment, the world’s banking systems are held together by COBOL code written in the 1970s. Government agencies run on Visual Basic 6 apps from the 90s. Scientific institutions depend on Fortran programs that nobody alive fully understands anymore.

핵심 통계

  • $85 Billion 전 세계 기술 부채
  • 220 Billion 라인의 COBOL이 아직도 운영 중
  • 43 %의 은행 시스템이 전적으로 COBOL로 구동
  • $500 k–$5 M 평균 비용으로 하나의 레거시 시스템을 마이그레이션
  • 6–18 개월이 일반적인 마이그레이션 일정
  • 92 %의 IT 리더가 기술 부채가 혁신을 늦춘다고 답변

이 코드를 작성한 개발자들은 은퇴하고 있다. 평균 COBOL 프로그래머는 55세 이상이다. 10년 후면 이 지식은 사라질 것이다. 이것은 단순한 기술 문제가 아니라 기업 소프트웨어에 대한 존재론적 위기이다.

아이디어: CodePhoenix – AI를 통한 부활

Kiroween 해커톤의 “Resurrection” 카테고리를 위해, 나는 실제로 죽은 코드를 다시 살아나게 하는 무언가를 만들어야 했습니다. 불사조 메타포는 레거시 시스템의 잿더미에서 다시 일어서는 모습을 완벽하게 표현했습니다. 72시간만 남았고 혼자 작업해야 했기에 Kiro AI에 의존했습니다.

CodePhoenix 워크플로우

  1. Upload – 오래된 레거시 파일(COBOL, VB6, Fortran, PHP 등)을 업로드합니다.
  2. Analyze – AI가 비즈니스 로직, 데이터 구조, 보안을 깊이 이해합니다.
  3. Transform – AI가 현대 언어(TypeScript, React, Python, Go)로 변환합니다.
  4. Export – 클라우드‑준비, 컨테이너화, 문서화된 애플리케이션으로 다운로드합니다.

모두 Kiro AI가 구동하여 불가능을 가능하게 만듭니다.

Kiro 사양을 활용한 기반

코드로서의 아키텍처

I started by writing specifications in .kiro/specs/architecture.md:

Core Architecture:
- Frontend: Next.js 14 App Router with TypeScript
- Backend: Next.js API Routes
- AI Engines: GPT‑4 for transformation, Claude for analysis
- Storage: Session‑based filesystem
- UI: Tailwind CSS with custom phoenix theme (orange/red gradients)
- Code Editor: Monaco Editor (VS Code engine)

Kiro read this single file and generated:

  • Complete Next.js 14 project structure
  • TypeScript configs with strict mode
  • Tailwind setup with custom phoenix color palette
  • API route templates
  • Component scaffolding

Vibe Coding the UI

Vibe 1: Main Upload Zone

Instructions in .kiro/vibe/coding-instructions.md:

VIBE 1: Create the main upload zone
- Drag‑and‑drop area with phoenix rising animation
- Support .cbl, .vb, .for, .php, .pas files
- Show file previews with syntax highlighting
- Animated fire particles on hover
- Error states for unsupported files

Kiro는 완전한 React 컴포넌트를 생성했습니다:

  • Framer Motion 애니메이션 (업로드 시 피닉스 상승)
  • 파일 검증 및 오류 처리
  • 구문 강조가 적용된 파일 미리보기
  • 반응형 모바일 레이아웃
  • 로딩 상태 표시
  • 접근성 지원 (ARIA 레이블, 키보드 네비게이션)

Vibe 2: Analysis Results Dashboard

VIBE 2: Create the analysis results dashboard
- Beautiful card grid showing AI analysis
- Complexity visualization (1‑10 scale with color coding)
- Security vulnerabilities with severity badges
- Business logic extraction display
- Migration roadmap timeline
- ROI calculator with interactive sliders

Kiro는 다음을 제공했습니다:

  • 서로 연결된 6개의 컴포넌트
  • React Flow 의존성 그래프 시각화
  • 애니메이션 차트 (Recharts 통합)
  • 인터랙티브 ROI 계산기
  • 부드러운 페이지 전환

Source:

스티어링이 포함된 API 라우트

나는 세 개의 복잡한 API 엔드포인트가 필요했다:

  • /api/upload – 파일 업로드 처리
  • /api/analyze – AI 코드 분석
  • /api/transform – AI 코드 변환

엔드포인트가 64개의 파일 확장자를 처리하고, OpenAI와 Anthropic API와 통합하며, 정확한 비즈니스 로직을 보존하고, COBOL PICTURE 절에서 정확한 TypeScript 타입을 생성해야 했기 때문에, 나는 .kiro/steering/api-guidelines.md를 만들었다:

API Transformation Rules:

COBOL → TypeScript Mapping:
- IDENTIFICATION DIVISION → Module exports with metadata
- DATA DIVISION → Interface definitions
- PICTURE 9(5)V99 → number (with validation)
- PICTURE X(50) → string (max length 50)
- PICTURE S9(7)V99 COMP-3 → Decimal type
- PERFORM UNTIL → while loop with guard clause
- EVALUATE → switch statement with exhaustive checking

VB6 → React Mapping:
- Form → Functional component
- Control → React component with state
- Event handlers → onClick/onChange callbacks
- Recordset → Array of typed objects
- ADO connection → Fetch API or GraphQL

이 스티어링 규칙을 사용하여 Kiro는 다음과 같은 API를 생성했다:

  • 64개의 레거시 언어 파일 확장자를 정확히 파싱
  • COBOL 데이터 타입을 TypeScript로 ~95 % 정확도로 매핑
  • 비즈니스 로직을 정확히 보존 (핵심!)
  • 관용적인 최신 코드 생성
  • 포괄적인 오류 처리 포함

결과: 전체 스택 애플리케이션 기반이 ~85 % AI‑생성된 상태.

변환 엔진

도전 과제: 50년 된 코드를 AI가 이해하도록 만들기

현대 LLM은 2010년대‑2020년대 GitHub 코드를 기반으로 학습됩니다. 수백만 줄의 TypeScript와 Python을 보았지만, COBOL, Fortran 77, RPG 등은 학습 데이터에 거의 없습니다. 따라서 GPT‑4가 COBOL을 TypeScript로 변환할 수는 있지만, 미묘한 오류를 자주 발생시킵니다.

잘못된 변환 (스티어링 없이)

COMPUTE TAX-AMOUNT = INCOME * 0.20
// WRONG! Loses precision
const taxAmount = income * 0.2;

올바른 변환 (스티어링 포함)

// Correct – uses Decimal for exact arithmetic
const taxAmount = new Decimal(income).times(0.20);

해결책: 도메인 전문성을 위한 MCP 서버

레거시 언어 각각에 대해 AI가 전문가 수준의 이해를 가질 수 있도록 .kiro/mcp/에 세 개의 Model Context Protocol (MCP) 서버를 구축했습니다.

COBOL 파서 MCP (cobol-parser-mcp.ts)

/**
 * Capabilities:
 * - Tokenize COBOL divisions
 * - Parse PICTURE clauses to TypeScript types
 * - Extract PERFORM logic to function calls
 * - Map COPY books to imports
 * - Analyze COMP/COMP-3 binary fields
 * - Handle REDEFINES (union types)
 */

Fortran 분석기 MCP (fortran-analyzer-mcp.ts)

/**
 * Capabilities:
 * - Parse SUBROUTINE/FUNCTION blocks
 * - Analyze DO loops and GOTOs
 * - Map COMMON blocks to classes
 * - Convert FORMAT statements to template literals
 * - Handle IMPLICIT NONE type inference
 */

레거시 데이터베이스 MCP (legacy-db-mcp.ts)

/**
 * Capabilities:
 * - Parse DB2/Oracle DDL
 * - Generate Prisma schema
 * - Suggest PostgreSQL migration
 * - Map hierarchical databases to relational
 */

이 MCP 서버들은 구조화된 AST와 의미 메타데이터를 Kiro에 전달하여 95 % 이상의 정확도로 변환을 가능하게 합니다.

Diff Viewer 구축

사용자는 변환 과정을 나란히 볼 필요가 있습니다. 저는 하나의 Vibe 명령을 작성했습니다:

Create an interactive code comparison viewer using Monaco Editor.

Left pane: original legacy code with syntax highlighting.  
Right pane: transformed modern code.

Features: line mapping, diff highlights, collapsible sections, export buttons.

Kiro는 약 400줄 규모의 React 컴포넌트를 생성했으며, 다음을 제공합니다:

  • 듀얼‑패널 Monaco 에디터 (원본 vs. 변환된 코드)
  • 64개의 소스 언어와 40개의 타깃 언어에 대한 구문 강조
  • 라인‑별 diff 강조 표시
  • 대용량 파일을 위한 접을 수 있는 섹션
  • 두 패널 모두에서 검색/바꾸기 기능
  • 내보내기 기능 (PDF, Markdown, 원시 코드)

다중 언어 지원

Initially I targeted five languages; the platform now supports 64 source languages, including:

  • 메인프레임 시대: COBOL, RPG, JCL, PL/I, 어셈블러
  • 데스크톱 시대: VB6, PowerBuilder, Delphi, FoxPro
  • Web 1.0: Classic ASP, ColdFusion, Perl CGI
  • 과학: Fortran 77/90, ALGOL, APL
  • 시스템: Pascal, Modula‑2, Ada

And 40+ target frameworks such as:

  • Web: TypeScript, React, Next.js, Vue, Angular, Svelte
  • 백엔드: Python, FastAPI, Django, Flask, Node.js, NestJS
  • 엔터프라이즈: Java Spring Boot, C# .NET Core, Kotlin
  • 모바일: React Native, Flutter, SwiftUI

The result is a versatile, AI‑driven platform that can resurrect virtually any legacy codebase and deliver modern, production‑ready applications.

Back to Blog

관련 글

더 보기 »