mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-03 18:00:48 -07:00
Debug command. (#23851)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -39,6 +39,21 @@ export default function App() {
|
||||
null,
|
||||
);
|
||||
|
||||
// --- Toast Logic ---
|
||||
const [toastMessage, setToastMessage] = useState<string | null>(null);
|
||||
const toastTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
const showToast = (msg: string) => {
|
||||
setToastMessage(msg);
|
||||
if (toastTimeoutRef.current) {
|
||||
clearTimeout(toastTimeoutRef.current);
|
||||
}
|
||||
toastTimeoutRef.current = setTimeout(() => {
|
||||
setToastMessage(null);
|
||||
toastTimeoutRef.current = null;
|
||||
}, 5000);
|
||||
};
|
||||
|
||||
// --- Theme Logic ---
|
||||
const [themeMode, setThemeMode] = useState<ThemeMode>(() => {
|
||||
const saved = localStorage.getItem('devtools-theme');
|
||||
@@ -306,21 +321,52 @@ export default function App() {
|
||||
>
|
||||
{selectedSessionId &&
|
||||
connectedSessions.includes(selectedSessionId) && (
|
||||
<button
|
||||
onClick={handleExport}
|
||||
style={{
|
||||
fontSize: '11px',
|
||||
padding: '4px 8px',
|
||||
border: `1px solid ${t.border}`,
|
||||
background: t.bg,
|
||||
color: t.text,
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer',
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
📤 Export
|
||||
</button>
|
||||
<>
|
||||
<button
|
||||
onClick={async () => {
|
||||
try {
|
||||
await fetch('/api/trigger-debugger', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ sessionId: selectedSessionId }),
|
||||
});
|
||||
showToast(
|
||||
'Node debugger attached. Open chrome://inspect in Chrome to start debugging.',
|
||||
);
|
||||
} catch (e) {
|
||||
console.error('Failed to trigger debugger:', e);
|
||||
}
|
||||
}}
|
||||
style={{
|
||||
fontSize: '11px',
|
||||
padding: '4px 8px',
|
||||
border: `1px solid ${t.border}`,
|
||||
background: t.bg,
|
||||
color: t.text,
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer',
|
||||
fontWeight: 600,
|
||||
}}
|
||||
title="Attach Node Debugger and open chrome://inspect"
|
||||
>
|
||||
🐞 Debug Node
|
||||
</button>
|
||||
<button
|
||||
onClick={handleExport}
|
||||
style={{
|
||||
fontSize: '11px',
|
||||
padding: '4px 8px',
|
||||
border: `1px solid ${t.border}`,
|
||||
background: t.bg,
|
||||
color: t.text,
|
||||
borderRadius: '4px',
|
||||
cursor: 'pointer',
|
||||
fontWeight: 600,
|
||||
}}
|
||||
>
|
||||
📤 Export
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
<label
|
||||
@@ -487,6 +533,38 @@ export default function App() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Toast Notification */}
|
||||
{toastMessage && (
|
||||
<div
|
||||
style={{
|
||||
position: 'fixed',
|
||||
bottom: '24px',
|
||||
right: '24px',
|
||||
background: t.accent,
|
||||
color: '#fff',
|
||||
padding: '12px 24px',
|
||||
borderRadius: '8px',
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
||||
fontSize: '13px',
|
||||
fontWeight: 500,
|
||||
zIndex: 1000,
|
||||
animation: 'fadeInOut 5s ease forwards',
|
||||
}}
|
||||
>
|
||||
{toastMessage}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* CSS Animations */}
|
||||
<style>{`
|
||||
@keyframes fadeInOut {
|
||||
0% { opacity: 0; transform: translateY(10px); }
|
||||
5% { opacity: 1; transform: translateY(0); }
|
||||
95% { opacity: 1; transform: translateY(0); }
|
||||
100% { opacity: 0; transform: translateY(10px); }
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user