History

Format workspace filesystem effect chains

Cursor Agent committed 4 months ago

Commit e72791d1 parent b356b221 file · +12 −12Browse files

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

Unified · Split

apps/server/src/workspace/WorkspaceFileSystem.ts+12−12
@@ -154,12 +154,12 @@ export const make = Effect.gen(function* () { · 153 unmodified lines
154 cause,154 cause,
155 });155 });
156 156
157 const realWorkspaceRoot = yield* fileSystem.realPath(input.cwd).pipe(157 const realWorkspaceRoot = yield* fileSystem
158 Effect.mapError(toOperationError("realpath-workspace-root", input.cwd)),158 .realPath(input.cwd)
159 );159 .pipe(Effect.mapError(toOperationError("realpath-workspace-root", input.cwd)));
160 const realTargetPath = yield* fileSystem.realPath(target.absolutePath).pipe(160 const realTargetPath = yield* fileSystem
161 Effect.mapError(toOperationError("realpath-target", target.absolutePath)),161 .realPath(target.absolutePath)
162 );162 .pipe(Effect.mapError(toOperationError("realpath-target", target.absolutePath)));
163 const relativeRealPath = path.relative(realWorkspaceRoot, realTargetPath);163 const relativeRealPath = path.relative(realWorkspaceRoot, realTargetPath);
164 if (164 if (
165 relativeRealPath.startsWith(`..${path.sep}`) ||165 relativeRealPath.startsWith(`..${path.sep}`) ||
@@ -176,9 +176,9 @@ export const make = Effect.gen(function* () { · 10 unmodified lines
176 176
177 return yield* Effect.scoped(177 return yield* Effect.scoped(
178 Effect.gen(function* () {178 Effect.gen(function* () {
179 const file = yield* fileSystem.open(realTargetPath, { flag: "r" }).pipe(179 const file = yield* fileSystem
180 Effect.mapError(toOperationError("open", realTargetPath, realTargetPath)),180 .open(realTargetPath, { flag: "r" })
181 );181 .pipe(Effect.mapError(toOperationError("open", realTargetPath, realTargetPath)));
182 const stat = yield* file.stat.pipe(182 const stat = yield* file.stat.pipe(
183 Effect.mapError(toOperationError("stat", realTargetPath, realTargetPath)),183 Effect.mapError(toOperationError("stat", realTargetPath, realTargetPath)),
184 );184 );
@@ -197,9 +197,9 @@ export const make = Effect.gen(function* () { · 12 unmodified lines
197 bytesToRead === 0197 bytesToRead === 0
198 ? new Uint8Array()198 ? new Uint8Array()
199 : Option.getOrElse(199 : Option.getOrElse(
200 yield* file.readAlloc(bytesToRead).pipe(200 yield* file
201 Effect.mapError(toOperationError("read", realTargetPath, realTargetPath)),201 .readAlloc(bytesToRead)
202 ),202 .pipe(Effect.mapError(toOperationError("read", realTargetPath, realTargetPath))),
203 () => new Uint8Array(),203 () => new Uint8Array(),
204 );204 );
205 if (fileBytes.includes(0)) {205 if (fileBytes.includes(0)) {