feat(FN-3398): update desktop README with multi-project setup and troublesh

The merge lands Step 7 of FN-3398, adding documentation and delivery artifacts across the mobile and desktop packages with updated READMEs, mobile-specific docs, and architecture references.

Fusion-Task-Id: FN-3398
This commit is contained in:
Fusion
2026-05-04 21:41:52 -07:00
committed by gsxdsm
parent 95ccf50397
commit 025eb7b3ae
43 changed files with 2025 additions and 398 deletions

View File

@@ -0,0 +1,58 @@
import { readFile, rename, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { app } from "electron";
export interface ShellConnectionProfile {
id: string;
name: string;
serverUrl: string;
authToken?: string | null;
createdAt: string;
updatedAt: string;
lastUsedAt?: string | null;
}
export interface DesktopShellSettings {
desktopMode: "local" | "remote";
activeProfileId: string | null;
profiles: ShellConnectionProfile[];
}
const DEFAULT_SETTINGS: DesktopShellSettings = {
desktopMode: "remote",
activeProfileId: null,
profiles: [],
};
function getSettingsPath(): string {
return join(app.getPath("userData"), "shell-connections.json");
}
function normalize(input: unknown): DesktopShellSettings {
if (!input || typeof input !== "object") {
return { ...DEFAULT_SETTINGS };
}
const candidate = input as Partial<DesktopShellSettings>;
return {
desktopMode: candidate.desktopMode === "local" ? "local" : "remote",
activeProfileId: typeof candidate.activeProfileId === "string" ? candidate.activeProfileId : null,
profiles: Array.isArray(candidate.profiles) ? candidate.profiles.filter((item) => item && typeof item === "object") as ShellConnectionProfile[] : [],
};
}
export async function readShellSettings(): Promise<DesktopShellSettings> {
try {
const raw = await readFile(getSettingsPath(), "utf-8");
return normalize(JSON.parse(raw));
} catch {
return { ...DEFAULT_SETTINGS };
}
}
export async function writeShellSettings(settings: DesktopShellSettings): Promise<void> {
const path = getSettingsPath();
const temp = `${path}.tmp`;
await writeFile(temp, JSON.stringify(settings, null, 2), "utf-8");
await rename(temp, path);
}