vg-coder-cli 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -167,16 +167,10 @@
|
|
|
167
167
|
/* Buttons */
|
|
168
168
|
.btn-group {
|
|
169
169
|
display: grid;
|
|
170
|
-
grid-template-columns: 1fr;
|
|
170
|
+
grid-template-columns: 1fr 1fr;
|
|
171
171
|
gap: 12px;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
@media (min-width: 600px) {
|
|
175
|
-
.btn-group {
|
|
176
|
-
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
174
|
.btn {
|
|
181
175
|
border: none;
|
|
182
176
|
background: var(--ios-blue);
|
|
@@ -204,6 +198,11 @@
|
|
|
204
198
|
color: var(--ios-blue);
|
|
205
199
|
}
|
|
206
200
|
|
|
201
|
+
/* Full width button */
|
|
202
|
+
.btn-full {
|
|
203
|
+
grid-column: 1 / -1;
|
|
204
|
+
}
|
|
205
|
+
|
|
207
206
|
.btn-copy {
|
|
208
207
|
background: #E5E5EA;
|
|
209
208
|
color: black;
|
|
@@ -367,7 +366,7 @@
|
|
|
367
366
|
</div>
|
|
368
367
|
<div class="prompt-content" id="system-prompt-content">
|
|
369
368
|
<div class="code-block" id="prompt-text"></div>
|
|
370
|
-
<button class="btn btn-secondary" onclick="copySystemPrompt()"
|
|
369
|
+
<button class="btn btn-secondary btn-full" onclick="copySystemPrompt()">
|
|
371
370
|
<span id="copy-icon">📋</span>
|
|
372
371
|
<span id="copy-text">Copy Prompt</span>
|
|
373
372
|
</button>
|
|
@@ -396,9 +395,6 @@
|
|
|
396
395
|
<button class="btn btn-secondary" onclick="copyAnalyzeResult()">
|
|
397
396
|
<span id="analyze-copy-icon">📋</span> Copy
|
|
398
397
|
</button>
|
|
399
|
-
<button class="btn btn-copy" onclick="copyAnalyzeAsFile()">
|
|
400
|
-
<span id="analyze-file-icon">📄</span> File
|
|
401
|
-
</button>
|
|
402
398
|
</div>
|
|
403
399
|
<div class="response" id="analyze-response"></div>
|
|
404
400
|
</div>
|
|
@@ -502,9 +498,35 @@ EOF
|
|
|
502
498
|
setTimeout(() => toast.classList.remove('show'), 3000);
|
|
503
499
|
}
|
|
504
500
|
|
|
505
|
-
|
|
501
|
+
// --- ROBUST COPY FUNCTION (MODERN + FALLBACK) ---
|
|
502
|
+
function fallbackCopyTextToClipboard(text) {
|
|
503
|
+
var textArea = document.createElement("textarea");
|
|
504
|
+
textArea.value = text;
|
|
505
|
+
|
|
506
|
+
// Ensure textarea is not visible but part of DOM
|
|
507
|
+
textArea.style.position = "fixed";
|
|
508
|
+
textArea.style.left = "-9999px";
|
|
509
|
+
textArea.style.top = "0";
|
|
510
|
+
document.body.appendChild(textArea);
|
|
511
|
+
|
|
512
|
+
textArea.focus();
|
|
513
|
+
textArea.select();
|
|
514
|
+
|
|
506
515
|
try {
|
|
507
|
-
|
|
516
|
+
var successful = document.execCommand('copy');
|
|
517
|
+
return successful;
|
|
518
|
+
} catch (err) {
|
|
519
|
+
console.error('Fallback: Oops, unable to copy', err);
|
|
520
|
+
return false;
|
|
521
|
+
} finally {
|
|
522
|
+
document.body.removeChild(textArea);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
async function copyToClipboard(text, btnElement, successIconId, successTextId) {
|
|
527
|
+
if (!text) return showToast('Nothing to copy', 'error');
|
|
528
|
+
|
|
529
|
+
const updateUI = () => {
|
|
508
530
|
if (btnElement) {
|
|
509
531
|
btnElement.classList.add('copied');
|
|
510
532
|
const icon = document.getElementById(successIconId);
|
|
@@ -523,8 +545,29 @@ EOF
|
|
|
523
545
|
}, 2000);
|
|
524
546
|
}
|
|
525
547
|
showToast('Copied to clipboard!');
|
|
526
|
-
}
|
|
527
|
-
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// Try Modern API first
|
|
551
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
552
|
+
try {
|
|
553
|
+
await navigator.clipboard.writeText(text);
|
|
554
|
+
updateUI();
|
|
555
|
+
} catch (err) {
|
|
556
|
+
console.warn('Modern copy failed, trying fallback', err);
|
|
557
|
+
// Try fallback if modern API fails
|
|
558
|
+
if (fallbackCopyTextToClipboard(text)) {
|
|
559
|
+
updateUI();
|
|
560
|
+
} else {
|
|
561
|
+
showToast('Failed to copy', 'error');
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
} else {
|
|
565
|
+
// Use fallback immediately if API doesn't exist
|
|
566
|
+
if (fallbackCopyTextToClipboard(text)) {
|
|
567
|
+
updateUI();
|
|
568
|
+
} else {
|
|
569
|
+
showToast('Failed to copy', 'error');
|
|
570
|
+
}
|
|
528
571
|
}
|
|
529
572
|
}
|
|
530
573
|
|
|
@@ -576,21 +619,12 @@ EOF
|
|
|
576
619
|
async function copyAnalyzeResult() {
|
|
577
620
|
const btn = event.target.closest('.btn');
|
|
578
621
|
if (!lastAnalyzeResult) {
|
|
579
|
-
showToast('Please analyze first', 'error');
|
|
622
|
+
showToast('Please analyze/download first', 'error');
|
|
580
623
|
return;
|
|
581
624
|
}
|
|
582
625
|
copyToClipboard(lastAnalyzeResult, btn, 'analyze-copy-icon', 'analyze-copy-text');
|
|
583
626
|
}
|
|
584
627
|
|
|
585
|
-
async function copyAnalyzeAsFile() {
|
|
586
|
-
const btn = event.target.closest('.btn');
|
|
587
|
-
if (!lastAnalyzeResult) {
|
|
588
|
-
showToast('Please analyze first', 'error');
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
copyToClipboard(lastAnalyzeResult, btn, 'analyze-file-icon', 'analyze-file-text');
|
|
592
|
-
}
|
|
593
|
-
|
|
594
628
|
async function testExecute() {
|
|
595
629
|
const btn = event.target.closest('.btn');
|
|
596
630
|
const bash = document.getElementById('execute-bash').value;
|
|
@@ -613,7 +647,6 @@ EOF
|
|
|
613
647
|
}
|
|
614
648
|
|
|
615
649
|
async function executeFromClipboard() {
|
|
616
|
-
const btn = event.target.closest('.btn');
|
|
617
650
|
try {
|
|
618
651
|
const text = await navigator.clipboard.readText();
|
|
619
652
|
if (!text.trim()) return showToast('Clipboard is empty', 'error');
|
|
Binary file
|
|
Binary file
|