The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { T3_PROJECT_FILE_NAME, type EnvironmentId, type T3ProjectFile } from "@t3tools/contracts"; |
| 2 | import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile"; |
| 3 | import { executeAtomQuery } from "@t3tools/client-runtime/state/runtime"; |
| 4 | |
| 5 | import { |
| 6 | getProjectFileQueryAtom, |
| 7 | resolveProjectFileQueryData, |
| 8 | } from "~/components/files/projectFilesQueryState"; |
| 9 | import { appAtomRegistry } from "~/rpc/atomRegistry"; |
| 10 | |
| 11 | export async function readT3ProjectFile( |
| 12 | environmentId: EnvironmentId, |
| 13 | workspaceRoot: string, |
| 14 | ): Promise<T3ProjectFile | null> { |
| 15 | const result = await executeAtomQuery( |
| 16 | appAtomRegistry, |
| 17 | getProjectFileQueryAtom(environmentId, workspaceRoot, T3_PROJECT_FILE_NAME), |
| 18 | { reportDefect: false, reportFailure: false }, |
| 19 | ); |
| 20 | const data = resolveProjectFileQueryData( |
| 21 | environmentId, |
| 22 | workspaceRoot, |
| 23 | T3_PROJECT_FILE_NAME, |
| 24 | result._tag === "Success" ? result.value : null, |
| 25 | ); |
| 26 | if (data === null || data.exists === false || data.truncated) return null; |
| 27 | return parseT3ProjectFile(data.contents); |
| 28 | } |