History

Add workspace file browser and preview panel (#3087)

Julius Marminge committed 4 months agov0.0.28-nightly.20260615.565

Commit de8bdc11 parent 477795662 files · +2850 −9551Browse files

Showing the changes to apps/server/src/workspace/Services/WorkspaceFileSystem.ts (1 of 62 files). Show all

Unified · Split

apps/server/src/workspace/Services/WorkspaceFileSystem.ts+21−2
@@ -10,7 +10,12 @@ import * as Schema from "effect/Schema"; · 9 unmodified lines
1010 import * as Context from "effect/Context";
1111 import type * as Effect from "effect/Effect";
1212
13−import type { ProjectWriteFileInput, ProjectWriteFileResult } from "@t3tools/contracts";
13+import type {
14+ ProjectReadFileInput,
15+ ProjectReadFileResult,
16+ ProjectWriteFileInput,
17+ ProjectWriteFileResult,
18+} from "@t3tools/contracts";
1419 import { WorkspacePathOutsideRootError } from "./WorkspacePaths.ts";
1520
1621 export class WorkspaceFileSystemError extends Schema.TaggedErrorClass<WorkspaceFileSystemError>()(
@@ -22,12 +27,26 @@ export class WorkspaceFileSystemError extends Schema.TaggedErrorClass<WorkspaceF · 5 unmodified lines
2227 detail: Schema.String,
2328 cause: Schema.optional(Schema.Defect()),
2429 },
25−) {}
30+) {
31+ override get message(): string {
32+ return this.detail;
33+ }
34+}
2635
2736 /**
2837 * WorkspaceFileSystemShape - Service API for workspace-relative file operations.
2938 */
3039 export interface WorkspaceFileSystemShape {
40+ /**
41+ * Read a UTF-8 text file relative to the workspace root.
42+ */
43+ readonly readFile: (
44+ input: ProjectReadFileInput,
45+ ) => Effect.Effect<
46+ ProjectReadFileResult,
47+ WorkspaceFileSystemError | WorkspacePathOutsideRootError
48+ >;
49+
3150 /**
3251 * Write a file relative to the workspace root.
3352 *