Spaces:
Running
Running
make the internals and make it so that i can send full repositories and it will clean it
Browse files- api.html +163 -0
- index.html +110 -14
api.html
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>CodeCleano API</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 9 |
+
<style>
|
| 10 |
+
.endpoint-method {
|
| 11 |
+
font-family: monospace;
|
| 12 |
+
padding: 0.25rem 0.5rem;
|
| 13 |
+
border-radius: 0.25rem;
|
| 14 |
+
font-weight: bold;
|
| 15 |
+
}
|
| 16 |
+
.endpoint-get { background-color: #6EE7B7; color: #065F46; }
|
| 17 |
+
.endpoint-post { background-color: #93C5FD; color: #1E40AF; }
|
| 18 |
+
</style>
|
| 19 |
+
</head>
|
| 20 |
+
<body class="bg-gray-900 text-gray-100">
|
| 21 |
+
<nav class="bg-gray-800/80 backdrop-blur-md fixed w-full z-50">
|
| 22 |
+
<div class="container mx-auto px-6 py-4">
|
| 23 |
+
<div class="flex justify-between items-center">
|
| 24 |
+
<div class="flex items-center space-x-2">
|
| 25 |
+
<i data-feather="cpu" class="text-blue-400"></i>
|
| 26 |
+
<span class="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-500">CodeCleano API</span>
|
| 27 |
+
</div>
|
| 28 |
+
<div class="flex space-x-6">
|
| 29 |
+
<a href="index.html" class="hover:text-blue-400 transition">Back to App</a>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
</nav>
|
| 34 |
+
|
| 35 |
+
<main class="container mx-auto px-6 pt-24 pb-12">
|
| 36 |
+
<section class="mb-16">
|
| 37 |
+
<h1 class="text-4xl font-bold mb-6">CodeCleano API Documentation</h1>
|
| 38 |
+
<p class="text-xl text-gray-400 max-w-3xl">
|
| 39 |
+
Programmatic access to our code cleaning and refactoring engine. Process individual files or entire repositories.
|
| 40 |
+
</p>
|
| 41 |
+
</section>
|
| 42 |
+
|
| 43 |
+
<section class="mb-16">
|
| 44 |
+
<h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Authentication</h2>
|
| 45 |
+
<div class="bg-gray-800/70 p-6 rounded-lg mb-6">
|
| 46 |
+
<p class="mb-4">All API requests require an API key sent in the <code class="bg-gray-700 px-2 py-1 rounded">X-API-Key</code> header.</p>
|
| 47 |
+
<div class="code-block p-4 bg-gray-900 rounded">
|
| 48 |
+
<pre class="text-green-400 overflow-x-auto text-sm">curl -H "X-API-Key: your_api_key_here" https://api.codecleano.ai/v1/clean</pre>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
</section>
|
| 52 |
+
|
| 53 |
+
<section class="mb-16">
|
| 54 |
+
<h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Endpoints</h2>
|
| 55 |
+
|
| 56 |
+
<!-- Single File Cleaning -->
|
| 57 |
+
<div class="bg-gray-800/70 p-6 rounded-lg mb-8">
|
| 58 |
+
<div class="flex items-center mb-4">
|
| 59 |
+
<span class="endpoint-method endpoint-post mr-4">POST</span>
|
| 60 |
+
<span class="font-mono text-lg">/v1/clean</span>
|
| 61 |
+
</div>
|
| 62 |
+
<p class="mb-4">Clean and refactor a single code file.</p>
|
| 63 |
+
|
| 64 |
+
<h3 class="font-bold mb-2">Request</h3>
|
| 65 |
+
<div class="code-block p-4 bg-gray-900 rounded mb-4">
|
| 66 |
+
<pre class="text-green-400 overflow-x-auto text-sm">{
|
| 67 |
+
"code": "def messy(x,y):\n return x+y if x>y else 0",
|
| 68 |
+
"language": "python",
|
| 69 |
+
"options": {
|
| 70 |
+
"rename_vars": true,
|
| 71 |
+
"extract_methods": true,
|
| 72 |
+
"optimize": true
|
| 73 |
+
}
|
| 74 |
+
}</pre>
|
| 75 |
+
</div>
|
| 76 |
+
|
| 77 |
+
<h3 class="font-bold mb-2">Response</h3>
|
| 78 |
+
<div class="code-block p-4 bg-gray-900 rounded">
|
| 79 |
+
<pre class="text-green-400 overflow-x-auto text-sm">{
|
| 80 |
+
"cleaned_code": "def calculate_sum(x, y):\n return x + y if x > y else 0",
|
| 81 |
+
"changes_made": 2,
|
| 82 |
+
"execution_time": "0.45s"
|
| 83 |
+
}</pre>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<!-- Repository Cleaning -->
|
| 88 |
+
<div class="bg-gray-800/70 p-6 rounded-lg">
|
| 89 |
+
<div class="flex items-center mb-4">
|
| 90 |
+
<span class="endpoint-method endpoint-post mr-4">POST</span>
|
| 91 |
+
<span class="font-mono text-lg">/v1/clean-repo</span>
|
| 92 |
+
</div>
|
| 93 |
+
<p class="mb-4">Process an entire repository from GitHub, GitLab, or Bitbucket.</p>
|
| 94 |
+
|
| 95 |
+
<h3 class="font-bold mb-2">Request</h3>
|
| 96 |
+
<div class="code-block p-4 bg-gray-900 rounded mb-4">
|
| 97 |
+
<pre class="text-green-400 overflow-x-auto text-sm">{
|
| 98 |
+
"repo_url": "https://github.com/user/repo",
|
| 99 |
+
"language": "javascript",
|
| 100 |
+
"branch": "main",
|
| 101 |
+
"options": {
|
| 102 |
+
"max_file_size": 10000,
|
| 103 |
+
"ignore_tests": true
|
| 104 |
+
}
|
| 105 |
+
}</pre>
|
| 106 |
+
</div>
|
| 107 |
+
|
| 108 |
+
<h3 class="font-bold mb-2">Response</h3>
|
| 109 |
+
<div class="code-block p-4 bg-gray-900 rounded">
|
| 110 |
+
<pre class="text-green-400 overflow-x-auto text-sm">{
|
| 111 |
+
"repo_name": "user/repo",
|
| 112 |
+
"files_processed": 42,
|
| 113 |
+
"issues_found": 127,
|
| 114 |
+
"download_url": "https://storage.codecleano.ai/clean-repos/abc123.zip",
|
| 115 |
+
"summary": "Found 15 variables to rename\nExtracted 8 methods\nFixed 32 style violations...",
|
| 116 |
+
"execution_time": "2m 15s"
|
| 117 |
+
}</pre>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</section>
|
| 121 |
+
|
| 122 |
+
<section>
|
| 123 |
+
<h2 class="text-2xl font-bold mb-6 border-b border-gray-700 pb-2">Rate Limits</h2>
|
| 124 |
+
<div class="grid md:grid-cols-3 gap-6">
|
| 125 |
+
<div class="bg-gray-800/70 p-6 rounded-lg">
|
| 126 |
+
<h3 class="font-bold mb-2 text-blue-400">Free Tier</h3>
|
| 127 |
+
<ul class="text-gray-300 space-y-2">
|
| 128 |
+
<li>20 requests/hour</li>
|
| 129 |
+
<li>Max file size: 50KB</li>
|
| 130 |
+
<li>Basic refactoring</li>
|
| 131 |
+
</ul>
|
| 132 |
+
</div>
|
| 133 |
+
<div class="bg-gray-800/70 p-6 rounded-lg">
|
| 134 |
+
<h3 class="font-bold mb-2 text-purple-400">Pro Tier</h3>
|
| 135 |
+
<ul class="text-gray-300 space-y-2">
|
| 136 |
+
<li>100 requests/hour</li>
|
| 137 |
+
<li>Max file size: 500KB</li>
|
| 138 |
+
<li>Advanced optimizations</li>
|
| 139 |
+
</ul>
|
| 140 |
+
</div>
|
| 141 |
+
<div class="bg-gray-800/70 p-6 rounded-lg">
|
| 142 |
+
<h3 class="font-bold mb-2 text-green-400">Enterprise</h3>
|
| 143 |
+
<ul class="text-gray-300 space-y-2">
|
| 144 |
+
<li>Unlimited requests</li>
|
| 145 |
+
<li>No size limits</li>
|
| 146 |
+
<li>Custom models</li>
|
| 147 |
+
</ul>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
</section>
|
| 151 |
+
</main>
|
| 152 |
+
|
| 153 |
+
<footer class="bg-gray-900/80 py-8 border-t border-gray-800">
|
| 154 |
+
<div class="container mx-auto px-6 text-center">
|
| 155 |
+
<p class="text-gray-500">© 2023 CodeCleano API. All rights reserved.</p>
|
| 156 |
+
</div>
|
| 157 |
+
</footer>
|
| 158 |
+
|
| 159 |
+
<script>
|
| 160 |
+
feather.replace();
|
| 161 |
+
</script>
|
| 162 |
+
</body>
|
| 163 |
+
</html>
|
index.html
CHANGED
|
@@ -38,8 +38,8 @@
|
|
| 38 |
<a href="#" class="hover:text-blue-400 transition">Home</a>
|
| 39 |
<a href="#" class="hover:text-blue-400 transition">Features</a>
|
| 40 |
<a href="#" class="hover:text-blue-400 transition">Tutorial</a>
|
| 41 |
-
<a href="
|
| 42 |
-
|
| 43 |
</div>
|
| 44 |
<button onclick="document.getElementById('demo-modal').classList.remove('hidden')" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg font-medium transition">
|
| 45 |
Live Demo
|
|
@@ -272,13 +272,36 @@ model.save_pretrained("code_cleaner_model")</code></pre>
|
|
| 272 |
</div>
|
| 273 |
</div>
|
| 274 |
</div>
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
</div>
|
| 281 |
-
|
| 282 |
</div>
|
| 283 |
</div>
|
| 284 |
|
|
@@ -325,14 +348,27 @@ model.save_pretrained("code_cleaner_model")</code></pre>
|
|
| 325 |
backgroundColor: 0x111827,
|
| 326 |
size: 0.8
|
| 327 |
});
|
| 328 |
-
|
| 329 |
// Code Processing Functionality
|
| 330 |
const codeEditor = document.getElementById('code-editor');
|
| 331 |
const processBtn = document.getElementById('process-btn');
|
|
|
|
|
|
|
|
|
|
| 332 |
const resultContainer = document.getElementById('result-container');
|
|
|
|
|
|
|
| 333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
processBtn.addEventListener('click', async () => {
|
| 335 |
-
|
| 336 |
if (!code.trim()) return;
|
| 337 |
|
| 338 |
processBtn.disabled = true;
|
|
@@ -342,20 +378,30 @@ model.save_pretrained("code_cleaner_model")</code></pre>
|
|
| 342 |
try {
|
| 343 |
// Using a mock API for demonstration
|
| 344 |
// In production, replace with your actual API endpoint
|
| 345 |
-
const
|
|
|
|
| 346 |
method: 'POST',
|
| 347 |
headers: {
|
| 348 |
'Content-Type': 'application/json',
|
| 349 |
},
|
| 350 |
body: JSON.stringify({
|
| 351 |
-
|
| 352 |
-
|
| 353 |
})
|
| 354 |
});
|
| 355 |
|
| 356 |
const data = await response.json();
|
| 357 |
-
resultContainer.innerHTML = `
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
resultContainer.innerHTML = `<div class="text-red-400 p-4 bg-gray-800 rounded-lg">Error: ${error.message}</div>`;
|
| 360 |
} finally {
|
| 361 |
processBtn.disabled = false;
|
|
@@ -363,6 +409,56 @@ model.save_pretrained("code_cleaner_model")</code></pre>
|
|
| 363 |
feather.replace();
|
| 364 |
}
|
| 365 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
|
| 367 |
feather.replace();
|
| 368 |
</script>
|
|
|
|
| 38 |
<a href="#" class="hover:text-blue-400 transition">Home</a>
|
| 39 |
<a href="#" class="hover:text-blue-400 transition">Features</a>
|
| 40 |
<a href="#" class="hover:text-blue-400 transition">Tutorial</a>
|
| 41 |
+
<a href="api.html" class="hover:text-blue-400 transition">API</a>
|
| 42 |
+
<a href="#" class="hover:text-blue-400 transition" onclick="document.getElementById('demo-modal').classList.remove('hidden')">Live Demo</a>
|
| 43 |
</div>
|
| 44 |
<button onclick="document.getElementById('demo-modal').classList.remove('hidden')" class="bg-blue-600 hover:bg-blue-700 px-4 py-2 rounded-lg font-medium transition">
|
| 45 |
Live Demo
|
|
|
|
| 272 |
</div>
|
| 273 |
</div>
|
| 274 |
</div>
|
| 275 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
| 276 |
+
<div class="flex flex-col">
|
| 277 |
+
<label class="text-gray-300 mb-2">Choose Language</label>
|
| 278 |
+
<select id="language-select" class="bg-gray-700 text-white p-2 rounded">
|
| 279 |
+
<option value="python">Python</option>
|
| 280 |
+
<option value="javascript">JavaScript</option>
|
| 281 |
+
<option value="java">Java</option>
|
| 282 |
+
<option value="csharp">C#</option>
|
| 283 |
+
<option value="php">PHP</option>
|
| 284 |
+
</select>
|
| 285 |
+
</div>
|
| 286 |
+
<div class="flex items-end">
|
| 287 |
+
<button id="process-btn" class="bg-blue-600 hover:bg-blue-700 px-8 py-3 rounded-lg font-bold text-lg transition w-full">
|
| 288 |
+
Clean This Code
|
| 289 |
+
</button>
|
| 290 |
+
</div>
|
| 291 |
+
</div>
|
| 292 |
+
<div class="text-center">
|
| 293 |
+
<p class="text-gray-400 mb-2">OR</p>
|
| 294 |
+
<button id="repo-btn" class="border border-blue-500 text-blue-400 hover:bg-blue-500/10 px-6 py-2 rounded-lg transition">
|
| 295 |
+
<i data-feather="github" class="inline mr-2"></i> Clean Entire Repository
|
| 296 |
</button>
|
| 297 |
+
<div id="repo-input" class="hidden mt-4">
|
| 298 |
+
<input type="text" id="repo-url" class="bg-gray-700 text-white p-2 rounded w-full mb-2" placeholder="https://github.com/user/repo">
|
| 299 |
+
<button id="process-repo" class="bg-blue-600 hover:bg-blue-700 px-6 py-2 rounded-lg transition w-full">
|
| 300 |
+
Process Repository
|
| 301 |
+
</button>
|
| 302 |
+
</div>
|
| 303 |
</div>
|
| 304 |
+
</div>
|
| 305 |
</div>
|
| 306 |
</div>
|
| 307 |
|
|
|
|
| 348 |
backgroundColor: 0x111827,
|
| 349 |
size: 0.8
|
| 350 |
});
|
|
|
|
| 351 |
// Code Processing Functionality
|
| 352 |
const codeEditor = document.getElementById('code-editor');
|
| 353 |
const processBtn = document.getElementById('process-btn');
|
| 354 |
+
const repoBtn = document.getElementById('repo-btn');
|
| 355 |
+
const processRepoBtn = document.getElementById('process-repo');
|
| 356 |
+
const repoInput = document.getElementById('repo-input');
|
| 357 |
const resultContainer = document.getElementById('result-container');
|
| 358 |
+
const repoUrl = document.getElementById('repo-url');
|
| 359 |
+
const languageSelect = document.getElementById('language-select');
|
| 360 |
|
| 361 |
+
// Toggle repository input
|
| 362 |
+
repoBtn.addEventListener('click', () => {
|
| 363 |
+
repoInput.classList.toggle('hidden');
|
| 364 |
+
if (!repoInput.classList.contains('hidden')) {
|
| 365 |
+
codeEditor.value = '';
|
| 366 |
+
}
|
| 367 |
+
});
|
| 368 |
+
|
| 369 |
+
// Process single code snippet
|
| 370 |
processBtn.addEventListener('click', async () => {
|
| 371 |
+
const code = codeEditor.value;
|
| 372 |
if (!code.trim()) return;
|
| 373 |
|
| 374 |
processBtn.disabled = true;
|
|
|
|
| 378 |
try {
|
| 379 |
// Using a mock API for demonstration
|
| 380 |
// In production, replace with your actual API endpoint
|
| 381 |
+
const language = languageSelect.value;
|
| 382 |
+
const response = await fetch('/api/clean', {
|
| 383 |
method: 'POST',
|
| 384 |
headers: {
|
| 385 |
'Content-Type': 'application/json',
|
| 386 |
},
|
| 387 |
body: JSON.stringify({
|
| 388 |
+
code: code,
|
| 389 |
+
language: language
|
| 390 |
})
|
| 391 |
});
|
| 392 |
|
| 393 |
const data = await response.json();
|
| 394 |
+
resultContainer.innerHTML = `
|
| 395 |
+
<div class="mb-4 flex justify-between items-center">
|
| 396 |
+
<h4 class="font-bold text-blue-400">Cleaned Code</h4>
|
| 397 |
+
<button onclick="copyResult()" class="text-xs bg-gray-700 px-2 py-1 rounded">
|
| 398 |
+
<i data-feather="copy" class="w-3 h-3"></i> Copy
|
| 399 |
+
</button>
|
| 400 |
+
</div>
|
| 401 |
+
<pre class="text-green-400 p-4 bg-gray-800 rounded-lg overflow-auto"><code>${data.cleaned_code}</code></pre>
|
| 402 |
+
`;
|
| 403 |
+
feather.replace();
|
| 404 |
+
} catch (error) {
|
| 405 |
resultContainer.innerHTML = `<div class="text-red-400 p-4 bg-gray-800 rounded-lg">Error: ${error.message}</div>`;
|
| 406 |
} finally {
|
| 407 |
processBtn.disabled = false;
|
|
|
|
| 409 |
feather.replace();
|
| 410 |
}
|
| 411 |
});
|
| 412 |
+
// Process entire repository
|
| 413 |
+
processRepoBtn.addEventListener('click', async () => {
|
| 414 |
+
const url = repoUrl.value.trim();
|
| 415 |
+
if (!url) return;
|
| 416 |
+
|
| 417 |
+
processRepoBtn.disabled = true;
|
| 418 |
+
processRepoBtn.innerHTML = '<i data-feather="loader" class="animate-spin"></i> Processing Repository...';
|
| 419 |
+
feather.replace();
|
| 420 |
+
|
| 421 |
+
try {
|
| 422 |
+
const response = await fetch('/api/clean-repo', {
|
| 423 |
+
method: 'POST',
|
| 424 |
+
headers: {
|
| 425 |
+
'Content-Type': 'application/json',
|
| 426 |
+
},
|
| 427 |
+
body: JSON.stringify({
|
| 428 |
+
repo_url: url,
|
| 429 |
+
language: languageSelect.value
|
| 430 |
+
})
|
| 431 |
+
});
|
| 432 |
+
|
| 433 |
+
const data = await response.json();
|
| 434 |
+
resultContainer.innerHTML = `
|
| 435 |
+
<div class="mb-4">
|
| 436 |
+
<h4 class="font-bold text-blue-400">Repository Analysis</h4>
|
| 437 |
+
<p class="text-sm text-gray-400">${data.files_processed} files processed</p>
|
| 438 |
+
</div>
|
| 439 |
+
<div class="flex justify-between mb-2">
|
| 440 |
+
<span class="text-sm">Found ${data.issues_found} issues</span>
|
| 441 |
+
<a href="${data.download_url}" class="text-blue-400 hover:underline text-sm">
|
| 442 |
+
<i data-feather="download" class="inline mr-1 w-3 h-3"></i> Download Cleaned Code
|
| 443 |
+
</a>
|
| 444 |
+
</div>
|
| 445 |
+
<div class="bg-gray-800 rounded-lg p-4 max-h-64 overflow-auto">
|
| 446 |
+
${data.summary.replace(/\n/g, '<br>')}
|
| 447 |
+
</div>
|
| 448 |
+
`;
|
| 449 |
+
} catch (error) {
|
| 450 |
+
resultContainer.innerHTML = `<div class="text-red-400 p-4 bg-gray-800 rounded-lg">Error: ${error.message}</div>`;
|
| 451 |
+
} finally {
|
| 452 |
+
processRepoBtn.disabled = false;
|
| 453 |
+
processRepoBtn.innerHTML = 'Process Repository';
|
| 454 |
+
feather.replace();
|
| 455 |
+
}
|
| 456 |
+
});
|
| 457 |
+
|
| 458 |
+
function copyResult() {
|
| 459 |
+
const code = resultContainer.querySelector('code').textContent;
|
| 460 |
+
navigator.clipboard.writeText(code);
|
| 461 |
+
}
|
| 462 |
|
| 463 |
feather.replace();
|
| 464 |
</script>
|