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 * as NodeServices from "@effect/platform-node/NodeServices"; |
| 2 | import { assert, it } from "@effect/vitest"; |
| 3 | import * as HostProcess from "@t3tools/shared/HostProcess"; |
| 4 | import * as Effect from "effect/Effect"; |
| 5 | import * as Exit from "effect/Exit"; |
| 6 | import * as FileSystem from "effect/FileSystem"; |
| 7 | |
| 8 | import * as DesktopPreReadyFileSystem from "./DesktopPreReadyFileSystem.ts"; |
| 9 | import * as DesktopUserData from "./DesktopUserData.ts"; |
| 10 | |
| 11 | const resolveWindowsUserData = (appDataDirectory: string) => |
| 12 | DesktopUserData.resolveUserDataPath({ |
| 13 | appDataDirectory, |
| 14 | isDevelopment: false, |
| 15 | platform: "win32", |
| 16 | }).pipe(Effect.provide(DesktopPreReadyFileSystem.layer)); |
| 17 | |
| 18 | it.layer(NodeServices.layer)("DesktopPreReadyFileSystem", (it) => { |
| 19 | it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32" || process.getuid?.() === 0)( |
| 20 | "fails instead of treating an unreadable profile as missing", |
| 21 | () => |
| 22 | Effect.gen(function* () { |
| 23 | const fileSystem = yield* FileSystem.FileSystem; |
| 24 | const root = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-pre-ready-fs-" }); |
| 25 | yield* fileSystem.chmod(root, 0o000); |
| 26 | yield* Effect.addFinalizer(() => fileSystem.chmod(root, 0o700).pipe(Effect.orDie)); |
| 27 | |
| 28 | const exit = yield* Effect.exit(resolveWindowsUserData(root)); |
| 29 | |
| 30 | assert.isTrue(Exit.isFailure(exit)); |
| 31 | }), |
| 32 | ); |
| 33 | }); |