문서로 돌아가기
개요

시스템 개요

시스템, 핵심 루프, 필수 종속성에 대한 간결한 맵.

15분 읽기

PlanToCode는 실행 전에 코드 변경을 계획하고 검증하는 데스크톱 워크스페이스입니다. 로컬 Rust 작업 엔진, React UI, LLM 호출을 위한 서버 프록시를 조정합니다. 시스템은 오프라인 우선 아키텍처를 따르며 데스크톱 앱은 로컬 상태를 위해 SQLite를 사용하여 독립적으로 작동하고, 서버는 인증, LLM 프로바이더 라우팅, 청구를 처리합니다. LLM 접근이 없으면(호스팅은 관리형, 셀프호스팅은 자체 키) 계획 및 분석 파이프라인이 실행되지 않습니다.

시스템 맵

데스크톱 앱, Rust 코어, 로컬 SQLite 저장소, 서버 프록시의 맵.

PlanToCode 시스템 맵 다이어그램
Click to expand
데이터가 아래로 흐르고 이벤트가 위로 스트리밍되는 4계층 아키텍처.

실제 핵심 루프

  1. 텍스트, 음성 전사(useVoiceTranscription 훅을 통해), 또는 비디오 녹화 분석에서 작업을 캡처합니다.
  2. TextImprovementProcessor를 통해 text_improvement 작업으로 작업 설명과 목표를 정제합니다.
  3. 파일 탐색 워크플로우를 실행합니다: RootFolderSelectionProcessor가 디렉토리를 선택하고, RegexFileFilterProcessor가 패턴을 적용하고, FileRelevanceAssessmentProcessor가 콘텐츠에 점수를 매기고, ExtendedPathFinderProcessor가 컨텍스트를 확장합니다.
  4. ImplementationPlanProcessor를 통해 구현 계획을 생성합니다. 이는 XML 형식의 계획을 Monaco 뷰어로 스트리밍합니다.
  5. 선택적으로 XML 태그가 지정된 소스 계획을 사용하여 ImplementationPlanMergeProcessor로 여러 계획 초안을 병합합니다.
  6. PTY 터미널 세션 또는 외부 에이전트용 복사 버튼 템플릿을 통해 승인된 계획을 실행하거나 내보냅니다.
  7. Persist every job, artifact, and terminal log to SQLite (background_jobs, terminal_sessions tables) for history and recovery.

주요 컴포넌트

  • desktop/src/의 데스크톱 UI(React), Monaco 계획 뷰, 터미널 패널, 프로바이더(SessionProvider, TextImprovementProvider) 포함.
  • desktop/src-tauri/의 Rust 코어(Tauri v2), 기능 기반 권한으로 명령, 작업, 영속성 처리.
  • desktop/src-tauri/migrations/consolidated_schema.sql의 로컬 SQLite 스키마, 동시 액세스를 위한 WAL 모드.
  • server/src/의 서버 프록시(Actix-Web), 인증, 프로바이더 라우팅, 스트리밍 응답, Stripe를 통한 청구.
  • mobile/ios/Core/의 모바일 iOS 클라이언트, SwiftUI 인터페이스, Auth0 PKCE, WebSocket 디바이스 링크.
  • infrastructure/ansible/의 인프라 자동화, Hetzner(EU) 및 InterServer(US) 전용 서버용.

필수 종속성

  • 계획 생성, 전사, 분석을 위한 외부 LLM 프로바이더(OpenAI, Anthropic, Google, X.AI, OpenRouter).
  • 데스크톱 및 모바일 세션을 위한 PKCE 흐름이 있는 Auth0 기반 인증.
  • 서버 측 사용자 계정, 청구 상태, 작업 큐를 위한 PostgreSQL 17 및 Redis 7+(자체 호스팅 배포).
  • 파일 탐색 워크플로우를 위한 git ls-files 또는 디렉토리 탐색을 통한 로컬 파일 시스템 액세스.
  • 음성 입력 처리를 위한 Whisper 호환 전사 엔드포인트.

저장소에서 동작이 있는 위치

  • Tauri 명령: desktop/src-tauri/src/commands/ (35개 이상의 명령 모듈: job_commands.rs, workflow_commands.rs, terminal_commands.rs, session_commands.rs, auth0_commands.rs)
  • 워크플로우 오케스트레이션: desktop/src-tauri/src/jobs/workflow_orchestrator/ (definition_loader.rs, stage_scheduler.rs, event_emitter.rs, payload_builder.rs)
  • 작업 프로세서: desktop/src-tauri/src/jobs/processors/ (implementation_plan_processor.rs, text_improvement_processor.rs, root_folder_selection_processor.rs)
  • SQLite 저장소: desktop/src-tauri/src/db_utils/ (background_job_repository/, session_repository.rs, terminal_repository.rs)
  • 서버 라우트: server/src/routes.rs (configure_routes, configure_public_auth_routes, configure_webhook_routes)
  • LLM 프록시 핸들러: server/src/handlers/proxy_handlers.rs 및 server/src/handlers/proxy/ (router.rs, providers/)
  • 프로바이더 트랜스포머: server/src/handlers/provider_transformers/ (openai.rs, google.rs, anthropic.rs, xai.rs)
  • iOS 워크플로우: mobile/ios/Core/Sources/Workflows/WorkflowManager.swift, MobileSessionManager 및 APIClient 포함
  • 인프라 플레이북: infrastructure/ansible/site-base.yml (강화, PostgreSQL, Redis) 및 site-app.yml (배포)

Continue to the runtime walkthrough

See how the core loop executes in practice with detailed job timelines and artifact flows.