Download code-intel.html from VanyaJ/bada-terminal: direct link, hf CLI and curl.
- Browser
- Download file 29.3 kB
-
https://huggingface.co/VanyaJ/bada-terminal/resolve/main/code-intel.html
- Command line
-
hf download hf://VanyaJ/bada-terminal/code-intel.html
-
curl -L -o code-intel.html https://huggingface.co/VanyaJ/bada-terminal/resolve/main/code-intel.html
29.3 kB
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>๐งฌ BADA Code Intelligence</title> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap'); | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| :root { | |
| --bg-base: #1e1e2e; | |
| --bg-mantle: #181825; | |
| --bg-crust: #11111b; | |
| --bg-surface0: #313244; | |
| --bg-surface1: #45475a; | |
| --bg-surface2: #585b70; | |
| --text: #cdd6f4; | |
| --text-sub: #a6adc8; | |
| --text-dim: #6c7086; | |
| --purple: #cba6f7; | |
| --green: #a6e3a1; | |
| --blue: #89b4fa; | |
| --yellow: #f9e2af; | |
| --pink: #f5c2e7; | |
| --red: #f38ba8; | |
| --peach: #fab387; | |
| --teal: #94e2d5; | |
| --lavender: #b4befe; | |
| --shadow: rgba(0, 0, 0, 0.3); | |
| } | |
| body { | |
| font-family: 'Inter', -apple-system, sans-serif; | |
| background: var(--bg-base); | |
| color: var(--text); | |
| height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| overflow: hidden; | |
| } | |
| /* Header & Tabs */ | |
| .header { | |
| background: var(--bg-mantle); | |
| border-bottom: 1px solid var(--bg-surface0); | |
| padding: 14px 20px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| flex-shrink: 0; | |
| } | |
| .title-area { | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| } | |
| .title-logo { | |
| font-size: 20px; | |
| background: linear-gradient(135deg, var(--blue), var(--purple)); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| font-weight: 700; | |
| } | |
| .tabs { | |
| display: flex; | |
| background: var(--bg-crust); | |
| padding: 4px; | |
| border-radius: 8px; | |
| gap: 4px; | |
| } | |
| .tab-btn { | |
| padding: 8px 16px; | |
| border-radius: 6px; | |
| font-size: 13px; | |
| font-weight: 500; | |
| color: var(--text-sub); | |
| background: transparent; | |
| border: none; | |
| cursor: pointer; | |
| transition: all 0.2s ease; | |
| } | |
| .tab-btn:hover { | |
| color: var(--text); | |
| background: rgba(255, 255, 255, 0.05); | |
| } | |
| .tab-btn.active { | |
| color: var(--bg-base); | |
| background: linear-gradient(135deg, var(--blue), var(--purple)); | |
| font-weight: 600; | |
| box-shadow: 0 4px 12px rgba(137, 180, 250, 0.2); | |
| } | |
| /* Main Container */ | |
| .container { | |
| flex: 1; | |
| display: flex; | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .tab-content { | |
| flex: 1; | |
| display: none; | |
| flex-direction: column; | |
| padding: 24px; | |
| overflow-y: auto; | |
| height: 100%; | |
| } | |
| .tab-content.active { | |
| display: flex; | |
| } | |
| /* Common Card Styling */ | |
| .card { | |
| background: var(--bg-mantle); | |
| border: 1px solid var(--bg-surface0); | |
| border-radius: 12px; | |
| padding: 20px; | |
| margin-bottom: 20px; | |
| box-shadow: 0 6px 18px var(--shadow); | |
| } | |
| .card-title { | |
| font-size: 16px; | |
| font-weight: 600; | |
| color: var(--lavender); | |
| margin-bottom: 15px; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| /* Wizard view forms */ | |
| .form-group { | |
| margin-bottom: 16px; | |
| } | |
| label { | |
| display: block; | |
| font-size: 13px; | |
| font-weight: 500; | |
| color: var(--text-sub); | |
| margin-bottom: 6px; | |
| } | |
| input, select, textarea { | |
| width: 100%; | |
| padding: 10px 14px; | |
| background: var(--bg-surface0); | |
| border: 1px solid var(--bg-surface1); | |
| border-radius: 8px; | |
| color: var(--text); | |
| font-size: 13px; | |
| outline: none; | |
| transition: all 0.2s ease; | |
| } | |
| input:focus, select:focus, textarea:focus { | |
| border-color: var(--blue); | |
| box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.15); | |
| } | |
| .input-row { | |
| display: flex; | |
| gap: 10px; | |
| } | |
| .btn { | |
| padding: 10px 18px; | |
| border-radius: 8px; | |
| font-size: 13px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| border: none; | |
| transition: all 0.2s ease; | |
| white-space: nowrap; | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .btn-primary { | |
| background: linear-gradient(135deg, var(--blue), var(--purple)); | |
| color: var(--bg-crust); | |
| } | |
| .btn-primary:hover { | |
| opacity: 0.9; | |
| transform: translateY(-1px); | |
| } | |
| .btn-secondary { | |
| background: var(--bg-surface1); | |
| color: var(--text); | |
| border: 1px solid var(--bg-surface2); | |
| } | |
| .btn-secondary:hover { | |
| background: var(--bg-surface2); | |
| } | |
| /* List Table */ | |
| .project-table { | |
| width: 100%; | |
| border-collapse: collapse; | |
| margin-top: 10px; | |
| } | |
| .project-table th, .project-table td { | |
| padding: 12px 16px; | |
| text-align: left; | |
| border-bottom: 1px solid var(--bg-surface0); | |
| } | |
| .project-table th { | |
| font-weight: 600; | |
| color: var(--text-dim); | |
| font-size: 12px; | |
| text-transform: uppercase; | |
| letter-spacing: 0.8px; | |
| } | |
| .project-table td { | |
| font-size: 13px; | |
| } | |
| .badge { | |
| padding: 3px 8px; | |
| border-radius: 4px; | |
| font-size: 11px; | |
| font-weight: 600; | |
| } | |
| .badge-blue { background: rgba(137, 180, 250, 0.15); color: var(--blue); } | |
| .badge-green { background: rgba(166, 227, 161, 0.15); color: var(--green); } | |
| .badge-yellow { background: rgba(249, 226, 175, 0.15); color: var(--yellow); } | |
| /* Explorer View layout */ | |
| .explorer-layout { | |
| display: grid; | |
| grid-template-columns: 320px 1fr; | |
| gap: 20px; | |
| flex: 1; | |
| height: 100%; | |
| overflow: hidden; | |
| } | |
| .sidebar-panel { | |
| display: flex; | |
| flex-direction: column; | |
| border-right: 1px solid var(--bg-surface0); | |
| padding-right: 15px; | |
| overflow-y: auto; | |
| height: 100%; | |
| } | |
| .content-panel { | |
| display: flex; | |
| flex-direction: column; | |
| overflow-y: auto; | |
| height: 100%; | |
| } | |
| /* Symbol Tree */ | |
| .symbol-list { | |
| list-style: none; | |
| font-size: 13px; | |
| } | |
| .symbol-item { | |
| padding: 6px 10px; | |
| border-radius: 6px; | |
| cursor: pointer; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| transition: all 0.15s ease; | |
| color: var(--text-sub); | |
| } | |
| .symbol-item:hover { | |
| background: var(--bg-surface0); | |
| color: var(--text); | |
| } | |
| .symbol-item.active { | |
| background: rgba(137, 180, 250, 0.15); | |
| color: var(--blue); | |
| font-weight: 500; | |
| } | |
| .symbol-type-icon { | |
| font-size: 11px; | |
| font-weight: bold; | |
| width: 18px; | |
| height: 18px; | |
| border-radius: 4px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .icon-file { background: rgba(137, 180, 250, 0.2); color: var(--blue); } | |
| .icon-class { background: rgba(203, 166, 247, 0.2); color: var(--purple); } | |
| .icon-function { background: rgba(166, 227, 161, 0.2); color: var(--green); } | |
| /* Code detail view */ | |
| .code-viewer { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 13px; | |
| background: var(--bg-crust); | |
| padding: 16px; | |
| border-radius: 8px; | |
| border: 1px solid var(--bg-surface0); | |
| overflow-x: auto; | |
| line-height: 1.5; | |
| } | |
| /* Compare Diff View */ | |
| .compare-grid { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 15px; | |
| margin-bottom: 20px; | |
| } | |
| .diff-list { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 8px; | |
| } | |
| .diff-card { | |
| background: var(--bg-mantle); | |
| border: 1px solid var(--bg-surface0); | |
| border-radius: 8px; | |
| padding: 12px; | |
| border-left: 4px solid var(--text-dim); | |
| } | |
| .diff-card.added { border-left-color: var(--green); } | |
| .diff-card.removed { border-left-color: var(--red); } | |
| .diff-card.modified { border-left-color: var(--yellow); } | |
| .diff-header { | |
| display: flex; | |
| justify-content: space-between; | |
| margin-bottom: 6px; | |
| font-size: 12px; | |
| font-weight: 600; | |
| } | |
| .diff-path { | |
| font-family: 'JetBrains Mono', monospace; | |
| color: var(--text-sub); | |
| } | |
| /* Loading Overlay */ | |
| .loading-overlay { | |
| position: absolute; | |
| top: 0; left: 0; right: 0; bottom: 0; | |
| background: rgba(24, 24, 37, 0.85); | |
| z-index: 200; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| gap: 15px; | |
| opacity: 0; | |
| pointer-events: none; | |
| transition: opacity 0.25s ease; | |
| backdrop-filter: blur(4px); | |
| } | |
| .loading-overlay.visible { | |
| opacity: 1; | |
| pointer-events: auto; | |
| } | |
| .spinner { | |
| width: 40px; | |
| height: 40px; | |
| border: 4px solid rgba(137, 180, 250, 0.2); | |
| border-top-color: var(--blue); | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| .progress-container { | |
| width: 300px; | |
| height: 8px; | |
| background: var(--bg-surface0); | |
| border-radius: 4px; | |
| overflow: hidden; | |
| margin-top: 10px; | |
| } | |
| .progress-bar { | |
| width: 0%; | |
| height: 100%; | |
| background: linear-gradient(90deg, var(--blue), var(--purple)); | |
| transition: width 0.3s ease; | |
| } | |
| </style> | |
| <script src="src/utils/focus-restorer.js"></script> | |
| </head> | |
| <body> | |
| <!-- Header --> | |
| <div class="header"> | |
| <div class="title-area"> | |
| <div class="title-logo">๐งฌ BADA Code Intelligence</div> | |
| </div> | |
| <div class="tabs"> | |
| <button class="tab-btn active" onclick="switchTab('wizard')">โ๏ธ ํ๋ก์ ํธ ๋ฑ๋ก/๊ด๋ฆฌ</button> | |
| <button class="tab-btn" onclick="switchTab('explorer')">๐ ๊ตฌ์กฐ ํ์๊ธฐ</button> | |
| <button class="tab-btn" onclick="switchTab('compare')">๐ ํ๋ก์ ํธ ๋น๊ต</button> | |
| </div> | |
| </div> | |
| <!-- Container --> | |
| <div class="container"> | |
| <!-- Tab 1: Wizard (Project Management) --> | |
| <div id="tab-wizard" class="tab-content active"> | |
| <div class="card"> | |
| <div class="card-title">โ ์ ๊ท ์ฝ๋๋ฒ ์ด์ค ํ๋ก์ ํธ ๋ฑ๋ก</div> | |
| <div class="form-group"> | |
| <label>ํ๋ก์ ํธ ์ด๋ฆ</label> | |
| <input type="text" id="projName" placeholder="์: langfuse-cli-agent" /> | |
| </div> | |
| <div class="form-group"> | |
| <label>์์ค์ฝ๋ ์ ๋ ๊ฒฝ๋ก</label> | |
| <div class="input-row"> | |
| <input type="text" id="projPath" placeholder="/Users/jungkibong/Projects/my-app" /> | |
| <button class="btn btn-secondary" onclick="selectFolder()">๐ ์ ํ</button> | |
| </div> | |
| </div> | |
| <button class="btn btn-primary" onclick="registerProject()">โ๏ธ ํ๋ก์ ํธ ๋ฑ๋ก ๋ฐ ๋ถ์ ์์</button> | |
| </div> | |
| <div class="card"> | |
| <div class="card-title" style="display: flex; justify-content: space-between; align-items: center;"> | |
| <span>๐ ๋ฑ๋ก๋ ํ๋ก์ ํธ ๋ชฉ๋ก</span> | |
| <button class="btn btn-secondary" style="padding: 4px 10px; font-size: 12px;" onclick="importProject()">๐ ํ์ผ์์ ๋ถ๋ฌ์ค๊ธฐ</button> | |
| </div> | |
| <table class="project-table"> | |
| <thead> | |
| <tr> | |
| <th>ํ๋ก์ ํธ๋ช </th> | |
| <th>๊ฒฝ๋ก</th> | |
| <th>์ํ</th> | |
| <th>๋ง์ง๋ง ๋ถ์</th> | |
| <th>์์ </th> | |
| </tr> | |
| </thead> | |
| <tbody id="projectListBody"> | |
| <!-- Dynamic project list --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <!-- Tab 2: Explorer (Structure Analyzer) --> | |
| <div id="tab-explorer" class="tab-content"> | |
| <div class="explorer-layout"> | |
| <div class="sidebar-panel"> | |
| <div class="form-group"> | |
| <label>๋์ ํ๋ก์ ํธ ์ ํ</label> | |
| <select id="explorerProjectSelect" onchange="loadExplorerSymbols()"> | |
| <!-- Dynamic options --> | |
| </select> | |
| </div> | |
| <div style="border-top: 1px solid var(--bg-surface0); margin: 10px 0;"></div> | |
| <h4 style="margin-bottom: 8px; font-size: 12px; color: var(--text-dim); text-transform: uppercase;">์ฝ๋ ์ฌ๋ณผ ํธ๋ฆฌ</h4> | |
| <div id="symbolTree" style="flex: 1; overflow-y: auto;"> | |
| <!-- Tree elements --> | |
| </div> | |
| </div> | |
| <div class="content-panel"> | |
| <div class="card" style="flex: 1; display: flex; flex-direction: column;"> | |
| <div class="card-title">๐ ์ฌ๋ณผ ์์ธ ์ ๋ณด</div> | |
| <div id="symbolDetailContent" style="flex: 1; display: flex; flex-direction: column; gap: 14px;"> | |
| <p style="color: var(--text-dim);">์ผ์ชฝ ํธ๋ฆฌ์์ ์์ค์ฝ๋ ํ์ผ์ด๋ ํด๋์ค, ํจ์ ์ฌ๋ณผ์ ์ ํํ์ญ์์ค.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Tab 3: Compare (Diffing Tool) --> | |
| <div id="tab-compare" class="tab-content"> | |
| <div class="card"> | |
| <div class="card-title">๐ ๋ค์ค ํ๋ก์ ํธ ๋น๊ต ๋ถ์</div> | |
| <div class="compare-grid"> | |
| <div class="form-group"> | |
| <label>๊ธฐ์ค ํ๋ก์ ํธ (Source Project)</label> | |
| <select id="compareSourceSelect"> | |
| <!-- Dynamic options --> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label>๋์ ํ๋ก์ ํธ (Target Project)</label> | |
| <select id="compareTargetSelect"> | |
| <!-- Dynamic options --> | |
| </select> | |
| </div> | |
| </div> | |
| <button class="btn btn-primary" onclick="compareProjects()">๐ ๊ตฌ์กฐ ์ฐจ์ด์ ๋น๊ต ๋ถ์ ์คํ</button> | |
| </div> | |
| <div class="card" id="compareResultCard" style="display: none;"> | |
| <div class="card-title" id="compareResultTitle">๐ ๋น๊ต ๊ฒฐ๊ณผ</div> | |
| <div class="diff-list" id="diffList"> | |
| <!-- Dynamic diff elements --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Loading Overlay --> | |
| <div id="loadingOverlay" class="loading-overlay"> | |
| <div class="spinner"></div> | |
| <div class="loading-text" id="loadingText" style="font-size: 14px; font-weight: 600; color: var(--blue);">ํ๋ก์ ํธ ์์ค์ฝ๋ ์ ์ ๋ถ์ ์งํ ์ค...</div> | |
| <div class="progress-container"> | |
| <div class="progress-bar" id="progressBar"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| const { ipcRenderer } = require('electron'); | |
| let allProjects = []; | |
| window.onload = async () => { | |
| // ํญ ํ๋ผ๋ฏธํฐ ํ์ธ | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const initialTab = urlParams.get('tab') || 'wizard'; | |
| switchTab(initialTab); | |
| // ๋ฐ์ดํฐ ๋ก๋ | |
| await refreshProjects(); | |
| }; | |
| function switchTab(tabId) { | |
| document.querySelectorAll('.tab-btn').forEach(btn => { | |
| btn.classList.remove('active'); | |
| if (btn.outerHTML.includes(tabId)) btn.classList.add('active'); | |
| }); | |
| document.querySelectorAll('.tab-content').forEach(content => { | |
| content.classList.remove('active'); | |
| }); | |
| document.getElementById(`tab-${tabId}`).classList.add('active'); | |
| if (tabId === 'explorer') { | |
| fillProjectSelects('explorerProjectSelect'); | |
| loadExplorerSymbols(); | |
| } else if (tabId === 'compare') { | |
| fillProjectSelects('compareSourceSelect'); | |
| fillProjectSelects('compareTargetSelect'); | |
| } | |
| } | |
| async function refreshProjects() { | |
| try { | |
| allProjects = await ipcRenderer.invoke('get-code-projects') || []; | |
| renderProjectList(); | |
| } catch (err) { | |
| console.error('Failed to get projects:', err); | |
| } | |
| } | |
| function renderProjectList() { | |
| const tbody = document.getElementById('projectListBody'); | |
| tbody.innerHTML = ''; | |
| if (allProjects.length === 0) { | |
| tbody.innerHTML = `<tr><td colspan="5" style="text-align: center; color: var(--text-dim);">๋ฑ๋ก๋ ์ฝ๋๋ฒ ์ด์ค ํ๋ก์ ํธ๊ฐ ์์ต๋๋ค.</td></tr>`; | |
| return; | |
| } | |
| allProjects.forEach(p => { | |
| const lastAnalyzed = p.last_analyzed_at ? new Date(p.last_analyzed_at).toLocaleString() : '๋ฏธ๋ถ์'; | |
| const badgeClass = p.status === 'analyzed' ? 'badge-green' : 'badge-yellow'; | |
| const badgeLabel = p.status === 'analyzed' ? '๋ถ์ ์๋ฃ' : '๋๊ธฐ ์ค'; | |
| tbody.innerHTML += ` | |
| <tr> | |
| <td style="font-weight: 600; color: var(--lavender);">${escapeHtml(p.name)}</td> | |
| <td style="font-family: monospace; color: var(--text-sub);">${escapeHtml(p.path)}</td> | |
| <td><span class="badge ${badgeClass}">${badgeLabel}</span></td> | |
| <td>${lastAnalyzed}</td> | |
| <td style="white-space: nowrap;"> | |
| <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px;" onclick="triggerAnalysis('${p.id}')">๐ ์ฌ๋ถ์</button> | |
| <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px;" onclick="exportProject('${p.id}')">๐พ ๋ด๋ณด๋ด๊ธฐ</button> | |
| <button class="btn btn-secondary" style="padding: 4px 8px; font-size: 11px; color: var(--red, #f38ba8);" onclick="deleteProject('${p.id}', '${escapeHtml(p.name)}')">๐๏ธ ์ญ์ </button> | |
| </td> | |
| </tr> | |
| `; | |
| }); | |
| } | |
| function fillProjectSelects(selectId) { | |
| const select = document.getElementById(selectId); | |
| if (!select) return; | |
| select.innerHTML = ''; | |
| if (allProjects.length === 0) { | |
| select.innerHTML = `<option value="">๋ฑ๋ก๋ ํ๋ก์ ํธ ์์</option>`; | |
| return; | |
| } | |
| allProjects.forEach(p => { | |
| select.innerHTML += `<option value="${p.id}">${escapeHtml(p.name)}</option>`; | |
| }); | |
| } | |
| async function selectFolder() { | |
| try { | |
| const folderPath = await ipcRenderer.invoke('select-vault-folder'); | |
| if (folderPath) { | |
| document.getElementById('projPath').value = folderPath; | |
| } | |
| } catch (err) { | |
| console.error('Folder selection failed:', err); | |
| } | |
| } | |
| async function registerProject() { | |
| const name = document.getElementById('projName').value.trim(); | |
| const path = document.getElementById('projPath').value.trim(); | |
| if (!name || !path) { | |
| alert('ํ๋ก์ ํธ ์ด๋ฆ๊ณผ ์ ๋ ๊ฒฝ๋ก๋ฅผ ๋ชจ๋ ์ ๋ ฅํด์ฃผ์ญ์์ค.'); | |
| return; | |
| } | |
| showLoading(true, '์๋ก์ด ํ๋ก์ ํธ ๋ฑ๋ก ๋ฐ ์์ค์ฝ๋ ๋ถ์์ ์์ํฉ๋๋ค...'); | |
| try { | |
| const regResult = await ipcRenderer.invoke('register-code-project', { name, path }); | |
| if (regResult.success) { | |
| // ๋ฑ๋ก ์ฑ๊ณต ํ ์ ์ ๋ถ์ ํธ๋ฆฌ๊ฑฐ | |
| await ipcRenderer.invoke('analyze-code-project', regResult.projectId); | |
| await refreshProjects(); | |
| alert('ํ๋ก์ ํธ ๋ฑ๋ก ๋ฐ ์์ค์ฝ๋ AST ๋ถ์์ด ์๋ฃ๋์์ต๋๋ค!'); | |
| } else { | |
| alert('๋ฑ๋ก ์คํจ: ' + regResult.error); | |
| } | |
| } catch (err) { | |
| alert('์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| async function triggerAnalysis(projectId) { | |
| showLoading(true, 'ํ๋ก์ ํธ ์์ค์ฝ๋ ๋ฆฌ์ํ๋ง ๋ฐ AST ๋ถ์์ ์งํ ์ค์ ๋๋ค...'); | |
| try { | |
| const result = await ipcRenderer.invoke('analyze-code-project', projectId); | |
| if (result.success) { | |
| await refreshProjects(); | |
| alert('๋ถ์ ์๋ฃ!'); | |
| } else { | |
| alert('๋ถ์ ์คํจ: ' + result.error); | |
| } | |
| } catch (err) { | |
| alert('๋ถ์ ์ค ์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| // ๋ฑ๋ก๋ ํ๋ก์ ํธ ์ญ์ โ ๋ฑ๋ก ์ ๋ณด์ ์ธ๋ฑ์ฑ๋ ์ฝ๋ ๋ฐ์ดํฐ๋ฅผ ํจ๊ป ์ ๊ฑฐ | |
| async function deleteProject(projectId, name) { | |
| if (!confirm(`'${name}' ํ๋ก์ ํธ๋ฅผ ์ญ์ ํ์๊ฒ ์ต๋๊น?\n๋ฑ๋ก ์ ๋ณด์ ์ธ๋ฑ์ฑ๋ ์ฝ๋ ์ฌ๋ณผ/๊ด๊ณ/์ด๋ ฅ์ด ๋ชจ๋ ์ ๊ฑฐ๋ฉ๋๋ค.`)) return; | |
| showLoading(true, 'ํ๋ก์ ํธ ์ญ์ ์ค...'); | |
| try { | |
| const result = await ipcRenderer.invoke('delete-code-project', projectId); | |
| if (result.success) { | |
| await refreshProjects(); | |
| alert('์ญ์ ์๋ฃ!'); | |
| } else { | |
| alert('์ญ์ ์คํจ: ' + result.error); | |
| } | |
| } catch (err) { | |
| alert('์ญ์ ์ค ์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| // ํ๋ก์ ํธ ์ฝ๋ ์ธํ ๋ฆฌ์ ์ค ๋ฐ์ดํฐ๋ฅผ JSON ํ์ผ๋ก ๋ด๋ณด๋ด๊ธฐ | |
| async function exportProject(projectId) { | |
| showLoading(true, '๋ด๋ณด๋ด๊ธฐ ํ์ผ ์์ฑ ์ค...'); | |
| try { | |
| const result = await ipcRenderer.invoke('export-code-project', projectId); | |
| if (result.success) { | |
| alert(`๋ด๋ณด๋ด๊ธฐ ์๋ฃ!\n๊ฒฝ๋ก: ${result.filePath}\n์ฌ๋ณผ ${result.symbolCount}๊ฐ`); | |
| } else if (!result.canceled) { | |
| alert('๋ด๋ณด๋ด๊ธฐ ์คํจ: ' + result.error); | |
| } | |
| } catch (err) { | |
| alert('๋ด๋ณด๋ด๊ธฐ ์ค ์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| // JSON ํ์ผ์์ ํ๋ก์ ํธ ์ฝ๋ ์ธํ ๋ฆฌ์ ์ค ๋ฐ์ดํฐ ๋ถ๋ฌ์ค๊ธฐ | |
| async function importProject() { | |
| showLoading(true, '๋ถ๋ฌ์ค๊ธฐ ํ์ผ ์ฒ๋ฆฌ ์ค...'); | |
| try { | |
| const result = await ipcRenderer.invoke('import-code-project'); | |
| if (result.success) { | |
| await refreshProjects(); | |
| alert(`๋ถ๋ฌ์ค๊ธฐ ์๋ฃ!\nํ๋ก์ ํธ: ${result.name}\n์ฌ๋ณผ ${result.symbolCount}๊ฐ`); | |
| } else if (!result.canceled) { | |
| alert('๋ถ๋ฌ์ค๊ธฐ ์คํจ: ' + result.error); | |
| } | |
| } catch (err) { | |
| alert('๋ถ๋ฌ์ค๊ธฐ ์ค ์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| async function loadExplorerSymbols() { | |
| const projectId = document.getElementById('explorerProjectSelect').value; | |
| const tree = document.getElementById('symbolTree'); | |
| tree.innerHTML = ''; | |
| if (!projectId) { | |
| tree.innerHTML = `<p style="color: var(--text-dim); font-size: 13px;">์ ํ๋ ํ๋ก์ ํธ๊ฐ ์์ต๋๋ค.</p>`; | |
| return; | |
| } | |
| try { | |
| const symbols = await ipcRenderer.invoke('get-code-symbols', projectId, { limit: 100 }); | |
| if (symbols.length === 0) { | |
| tree.innerHTML = `<p style="color: var(--text-dim); font-size: 13px;">์ฝ๋ ๊ตฌ์กฐ ๋ถ์ ๊ฒฐ๊ณผ๊ฐ ๋น์ด์์ต๋๋ค. ์ฌ๋ถ์์ ์คํํด๋ณด์ญ์์ค.</p>`; | |
| return; | |
| } | |
| symbols.forEach(sym => { | |
| const st = sym.symbol_type || sym.type; // DB๋ symbol_type ๋ฐํ (๊ตฌ๋ฒ์ ํธํ ์ํด type ํด๋ฐฑ) | |
| const typeLabel = st === 'file' ? 'F' : (st === 'class' ? 'C' : 'M'); | |
| const typeIconClass = st === 'file' ? 'icon-file' : (st === 'class' ? 'icon-class' : 'icon-function'); | |
| const li = document.createElement('div'); | |
| li.className = 'symbol-item'; | |
| li.onclick = () => showSymbolDetail(sym); | |
| li.innerHTML = ` | |
| <span class="symbol-type-icon ${typeIconClass}">${typeLabel}</span> | |
| <span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">${escapeHtml(sym.name)}</span> | |
| `; | |
| tree.appendChild(li); | |
| }); | |
| } catch (err) { | |
| tree.innerHTML = `<p style="color: var(--red); font-size: 13px;">์ฌ๋ณผ ๋ก๋ ์คํจ: ${err.message}</p>`; | |
| } | |
| } | |
| function showSymbolDetail(symbol) { | |
| document.querySelectorAll('.symbol-item').forEach(el => el.classList.remove('active')); | |
| event.currentTarget.classList.add('active'); | |
| const detail = document.getElementById('symbolDetailContent'); | |
| detail.innerHTML = ` | |
| <div> | |
| <h3 style="font-size: 15px; color: var(--lavender); margin-bottom: 6px;">${escapeHtml(symbol.name)}</h3> | |
| <p style="font-size: 12px; color: var(--text-sub);">ํ์ : <strong style="color: var(--blue);">${(symbol.symbol_type || symbol.type || 'N/A').toUpperCase()}</strong></p> | |
| <p style="font-size: 12px; color: var(--text-sub);">์ ์ ํ์ผ: <span style="font-family: monospace;">${escapeHtml(symbol.file_path || 'N/A')}</span></p> | |
| ${symbol.start_line ? `<p style="font-size: 12px; color: var(--text-sub);">์ฝ๋ ๋ผ์ธ: L${symbol.start_line} ~ L${symbol.end_line}</p>` : ''} | |
| </div> | |
| <div style="border-top: 1px solid var(--bg-surface0); margin: 10px 0;"></div> | |
| <div style="flex: 1; display: flex; flex-direction: column; gap: 8px;"> | |
| <h4 style="font-size: 13px; color: var(--text-sub);">์ฌ๋ณผ ๊ฐ์ ๋ฐ ๊ตฌ์กฐ ์ ๋ณด</h4> | |
| <div class="code-viewer" style="flex: 1; max-height: 400px; overflow-y: auto;"> | |
| ${escapeHtml(JSON.stringify(symbol, null, 2))} | |
| </div> | |
| </div> | |
| `; | |
| } | |
| async function compareProjects() { | |
| const srcId = document.getElementById('compareSourceSelect').value; | |
| const tgtId = document.getElementById('compareTargetSelect').value; | |
| if (!srcId || !tgtId) { | |
| alert('๋น๊ตํ ๋ ํ๋ก์ ํธ๋ฅผ ์ ํํด์ฃผ์ญ์์ค.'); | |
| return; | |
| } | |
| showLoading(true, '๋ ํ๋ก์ ํธ์ ์ ์ ๊ตฌ์กฐ AST ์ฐจ์ด์ ์ ๋ถ์ ์ค์ ๋๋ค...'); | |
| try { | |
| const result = await ipcRenderer.invoke('compare-code-projects', srcId, tgtId, {}); | |
| const resultCard = document.getElementById('compareResultCard'); | |
| const diffList = document.getElementById('diffList'); | |
| diffList.innerHTML = ''; | |
| resultCard.style.display = 'block'; | |
| if (!result.added && !result.removed && !result.modified) { | |
| diffList.innerHTML = `<p style="color: var(--text-dim); text-align: center; padding: 20px 0;">๋ ํ๋ก์ ํธ ๊ฐ์ ์ฌ๋ณผ ๋ฐ ์ํคํ ์ฒ ์ฐจ์ด์ ์ด ์กด์ฌํ์ง ์์ต๋๋ค.</p>`; | |
| return; | |
| } | |
| const added = result.added || []; | |
| const removed = result.removed || []; | |
| const modified = result.modified || []; | |
| added.forEach(item => { | |
| diffList.innerHTML += ` | |
| <div class="diff-card added"> | |
| <div class="diff-header" style="color: var(--green);"> | |
| <span>[+] ์ ๊ท ์ถ๊ฐ๋จ</span> | |
| <span>Type: ${item.type.toUpperCase()}</span> | |
| </div> | |
| <div class="diff-path">${escapeHtml(item.name)}</div> | |
| <div style="font-size: 12px; color: var(--text-dim); margin-top: 4px;">ํ์ผ: ${escapeHtml(item.file_path)}</div> | |
| </div> | |
| `; | |
| }); | |
| removed.forEach(item => { | |
| diffList.innerHTML += ` | |
| <div class="diff-card removed"> | |
| <div class="diff-header" style="color: var(--red);"> | |
| <span>[-] ์ญ์ ๋จ</span> | |
| <span>Type: ${item.type.toUpperCase()}</span> | |
| </div> | |
| <div class="diff-path">${escapeHtml(item.name)}</div> | |
| <div style="font-size: 12px; color: var(--text-dim); margin-top: 4px;">ํ์ผ: ${escapeHtml(item.file_path)}</div> | |
| </div> | |
| `; | |
| }); | |
| modified.forEach(item => { | |
| diffList.innerHTML += ` | |
| <div class="diff-card modified"> | |
| <div class="diff-header" style="color: var(--yellow);"> | |
| <span>[*] ๊ตฌ์กฐ ๋ณ๊ฒฝ ๊ฐ์ง</span> | |
| <span>Type: ${item.type.toUpperCase()}</span> | |
| </div> | |
| <div class="diff-path">${escapeHtml(item.name)}</div> | |
| <div style="font-size: 12px; color: var(--text-dim); margin-top: 4px;">ํ์ผ: ${escapeHtml(item.file_path)}</div> | |
| </div> | |
| `; | |
| }); | |
| if (added.length === 0 && removed.length === 0 && modified.length === 0) { | |
| diffList.innerHTML = `<p style="color: var(--text-dim); text-align: center; padding: 20px 0;">๊ตฌ์กฐ์ ๋ณ๊ฒฝ์ด ๋ฐ๊ฒฌ๋์ง ์์์ต๋๋ค.</p>`; | |
| } | |
| } catch (err) { | |
| alert('๋น๊ต ๋ถ์ ์ค ์ค๋ฅ ๋ฐ์: ' + err.message); | |
| } finally { | |
| showLoading(false); | |
| } | |
| } | |
| function showLoading(show, text = '์ ์ ๋ถ์ ์งํ ์ค...') { | |
| const overlay = document.getElementById('loadingOverlay'); | |
| const textEl = document.getElementById('loadingText'); | |
| const bar = document.getElementById('progressBar'); | |
| textEl.textContent = text; | |
| if (show) { | |
| overlay.classList.add('visible'); | |
| bar.style.width = '10%'; | |
| setTimeout(() => bar.style.width = '35%', 300); | |
| setTimeout(() => bar.style.width = '70%', 1000); | |
| setTimeout(() => bar.style.width = '95%', 2500); | |
| } else { | |
| bar.style.width = '100%'; | |
| setTimeout(() => { | |
| overlay.classList.remove('visible'); | |
| bar.style.width = '0%'; | |
| }, 300); | |
| } | |
| } | |
| function escapeHtml(str) { | |
| if (!str) return ''; | |
| return str.replace(/&/g, '&') | |
| .replace(/</g, '<') | |
| .replace(/>/g, '>') | |
| .replace(/"/g, '"') | |
| .replace(/'/g, '''); | |
| } | |
| ipcRenderer.on('switch-tab', (event, tabId) => { | |
| switchTab(tabId); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |