feat: add copy diagnostics button
Add copy diagnostics button in About dialog. Button copies report with OpenChamber state, OpenCode health, directories, and projects. Show success or error toasts after copying attempt.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { create } from 'zustand';
|
||||
import { devtools } from 'zustand/middleware';
|
||||
import { opencodeClient } from '@/lib/opencode/client';
|
||||
import { getDesktopHomeDirectory } from '@/lib/desktop';
|
||||
import { getDesktopHomeDirectory, isVSCodeRuntime } from '@/lib/desktop';
|
||||
import { updateDesktopSettings } from '@/lib/persistence';
|
||||
import { useFileSearchStore } from '@/stores/useFileSearchStore';
|
||||
import { streamDebugEnabled } from '@/stores/utils/streamDebug';
|
||||
@@ -76,7 +76,7 @@ const getHomeDirectory = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
const storedHome = safeStorage.getItem('homeDirectory') || cachedHomeDirectory || null;
|
||||
const saved = safeStorage.getItem('lastDirectory');
|
||||
if (saved) {
|
||||
if (saved && !isVSCodeRuntime()) {
|
||||
return resolveDirectoryPath(saved, storedHome);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ const getHomeDirectory = () => {
|
||||
return desktopHome;
|
||||
}
|
||||
|
||||
if (storedHome) {
|
||||
if (storedHome && !isVSCodeRuntime()) {
|
||||
cachedHomeDirectory = storedHome;
|
||||
return storedHome;
|
||||
}
|
||||
@@ -187,7 +187,19 @@ const initializeHomeDirectory = async () => {
|
||||
return fallback;
|
||||
};
|
||||
|
||||
const initialHomeDirectory = getHomeDirectory();
|
||||
const getVsCodeWorkspaceFolder = (): string | null => {
|
||||
if (!isVSCodeRuntime()) {
|
||||
return null;
|
||||
}
|
||||
const workspaceFolder = (window as unknown as { __VSCODE_CONFIG__?: { workspaceFolder?: unknown } }).__VSCODE_CONFIG__?.workspaceFolder;
|
||||
if (typeof workspaceFolder !== 'string' || workspaceFolder.trim().length === 0) {
|
||||
return null;
|
||||
}
|
||||
const normalized = normalizeDirectoryPath(workspaceFolder);
|
||||
return normalized.length > 0 ? normalized : null;
|
||||
};
|
||||
|
||||
const initialHomeDirectory = getVsCodeWorkspaceFolder() || getHomeDirectory();
|
||||
if (initialHomeDirectory) {
|
||||
opencodeClient.setDirectory(initialHomeDirectory);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user