diff --git a/apps/desktop/src/store/projects.ts b/apps/desktop/src/store/projects.ts index 8190cdf4e4af..eb993cd400f9 100644 --- a/apps/desktop/src/store/projects.ts +++ b/apps/desktop/src/store/projects.ts @@ -2,7 +2,7 @@ import { atom } from 'nanostores' import { liveSessionProjectId, type SidebarProjectTree } from '@/app/chat/sidebar/projects/workspace-groups' import type { HermesGitBranch } from '@/global' -import { desktopDefaultCwd, isDesktopFsRemoteMode, selectDesktopPaths } from '@/lib/desktop-fs' +import { desktopDefaultCwd, isDesktopFsRemoteMode, selectDesktopPaths, writeDesktopFileText } from '@/lib/desktop-fs' import { desktopGit } from '@/lib/desktop-git' import { persistentAtom } from '@/lib/persisted' import { activeGateway, ensureActiveGatewayOpen } from '@/store/gateway' @@ -336,20 +336,19 @@ export async function generateProjectIdea(name: string): Promise { } } -// Write IDEA.md to a project's primary folder (desktop only, best-effort). Local -// fs write is hardened in the electron main; a remote backend / missing bridge -// just skips it. +// Write IDEA.md to a project's primary folder (best-effort). Routes through the +// remote-aware fs write, so it lands on the backend for a remote gateway and on +// disk locally — the project is created regardless of whether the file lands. async function writeProjectIdea(folder: null | string | undefined, idea: string): Promise { const dir = (folder || '').trim() const body = idea.trim() - const write = window.hermesDesktop?.writeTextFile - if (!dir || !body || !write) { + if (!dir || !body) { return } try { - await write(`${dir.replace(/[/\\]+$/, '')}/IDEA.md`, body.endsWith('\n') ? body : `${body}\n`) + await writeDesktopFileText(`${dir.replace(/[/\\]+$/, '')}/IDEA.md`, body.endsWith('\n') ? body : `${body}\n`) } catch { // Best-effort: the project is created regardless of whether IDEA.md lands. }