Showing the changes to apps/server/src/workspace/Services/WorkspaceFileSystem.ts (1 of 62 files). Show all
Unified · Split
| @@ -10,7 +10,12 @@ import * as Schema from "effect/Schema"; · 9 unmodified lines | ||
| 10 | 10 | import * as Context from "effect/Context"; |
| 11 | 11 | import type * as Effect from "effect/Effect"; |
| 12 | 12 | |
| 13 | −import type { ProjectWriteFileInput, ProjectWriteFileResult } from "@t3tools/contracts"; | |
| 13 | +import type { | |
| 14 | + ProjectReadFileInput, | |
| 15 | + ProjectReadFileResult, | |
| 16 | + ProjectWriteFileInput, | |
| 17 | + ProjectWriteFileResult, | |
| 18 | +} from "@t3tools/contracts"; | |
| 14 | 19 | import { WorkspacePathOutsideRootError } from "./WorkspacePaths.ts"; |
| 15 | 20 | |
| 16 | 21 | export class WorkspaceFileSystemError extends Schema.TaggedErrorClass<WorkspaceFileSystemError>()( |
| @@ -22,12 +27,26 @@ export class WorkspaceFileSystemError extends Schema.TaggedErrorClass<WorkspaceF · 5 unmodified lines | ||
| 22 | 27 | detail: Schema.String, |
| 23 | 28 | cause: Schema.optional(Schema.Defect()), |
| 24 | 29 | }, |
| 25 | −) {} | |
| 30 | +) { | |
| 31 | + override get message(): string { | |
| 32 | + return this.detail; | |
| 33 | + } | |
| 34 | +} | |
| 26 | 35 | |
| 27 | 36 | /** |
| 28 | 37 | * WorkspaceFileSystemShape - Service API for workspace-relative file operations. |
| 29 | 38 | */ |
| 30 | 39 | 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 | + | |
| 31 | 50 | /** |
| 32 | 51 | * Write a file relative to the workspace root. |
| 33 | 52 | * |