@@ -2,12 +2,12 @@ import { Fs } from '#fs'
22import { FileSystem } from '@effect/platform'
33import { Effect , Schema as S } from 'effect'
44import { describe , expect , it } from 'vitest'
5- import { Dir } from './_.js'
5+ import { Builder } from './_.js'
66
77// Local helper function for decoding
88const decodeAbsDir = S . decodeSync ( Fs . Path . AbsDir . Schema )
99
10- describe ( 'Dir ' , ( ) => {
10+ describe ( 'Builder ' , ( ) => {
1111 describe ( 'chaining API' , ( ) => {
1212 it ( 'creates files and directories' , async ( ) => {
1313 // Setup memory filesystem
@@ -17,9 +17,9 @@ describe('Dir', () => {
1717 const fs = yield * FileSystem . FileSystem
1818
1919 // Create a directory with chaining
20- const dir = Dir . withChaining ( Dir . create ( '/test' ) )
20+ const builder = Builder . withChaining ( Builder . create ( '/test' ) )
2121
22- yield * dir
22+ yield * builder
2323 . file ( 'README.md' , '# Test Project' )
2424 . file ( 'package.json' , { name : 'test' , version : '1.0.0' } )
2525 . dir ( 'src/' , _ =>
@@ -64,9 +64,9 @@ describe('Dir', () => {
6464 const isDev = true
6565 const isProd = false
6666
67- const dir = Dir . withChaining ( Dir . create ( '/app' ) )
67+ const builder = Builder . withChaining ( Builder . create ( '/app' ) )
6868
69- yield * dir
69+ yield * builder
7070 . file ( 'app.js' , 'console.log("app")' )
7171 . when ( isDev , _ =>
7272 _
@@ -104,9 +104,9 @@ describe('Dir', () => {
104104 const program = Effect . gen ( function * ( ) {
105105 const fs = yield * FileSystem . FileSystem
106106
107- const dir = Dir . withChaining ( Dir . create ( '/workspace' ) )
107+ const builder = Builder . withChaining ( Builder . create ( '/workspace' ) )
108108
109- yield * dir
109+ yield * builder
110110 . remove ( 'old.txt' )
111111 . clear ( 'cache/' )
112112 . file ( 'new.txt' , 'new content' )
@@ -149,9 +149,9 @@ describe('Dir', () => {
149149 const program = Effect . gen ( function * ( ) {
150150 const fs = yield * FileSystem . FileSystem
151151
152- const dir = Dir . withChaining ( Dir . create ( '/project' ) )
152+ const builder = Builder . withChaining ( Builder . create ( '/project' ) )
153153
154- yield * dir
154+ yield * builder
155155 . move ( 'draft.md' , 'README.md' )
156156 . move ( 'old-name.txt' , 'new-name.txt' )
157157 . commit ( )
@@ -181,12 +181,12 @@ describe('Dir', () => {
181181 const program = Effect . gen ( function * ( ) {
182182 const fs = yield * FileSystem . FileSystem
183183
184- const dir = Dir . withChaining ( Dir . create ( '/data' ) )
184+ const builder = Builder . withChaining ( Builder . create ( '/data' ) )
185185
186186 const uint8Array = new Uint8Array ( [ 0 , 1 , 2 , 3 , 4 ] )
187187 const buffer = Buffer . from ( [ 5 , 6 , 7 , 8 , 9 ] )
188188
189- yield * dir
189+ yield * builder
190190 . file ( 'data1.bin' , uint8Array )
191191 . file ( 'data2.bin' , buffer )
192192 . commit ( )
@@ -212,9 +212,9 @@ describe('Dir', () => {
212212 const program = Effect . gen ( function * ( ) {
213213 const fs = yield * FileSystem . FileSystem
214214
215- const dir = Dir . withChaining ( Dir . create ( '/app' ) )
215+ const builder = Builder . withChaining ( Builder . create ( '/app' ) )
216216
217- yield * dir
217+ yield * builder
218218 . dir ( 'src/' , _ =>
219219 _
220220 . file ( 'index.ts' , 'export {}' )
@@ -244,21 +244,21 @@ describe('Dir', () => {
244244 } )
245245
246246 describe ( 'create functions' , ( ) => {
247- it ( 'creates a Dir with absolute path' , ( ) => {
248- const dir = Dir . create ( '/absolute/path' )
249- expect ( dir . base . segments ) . toEqual ( [ 'absolute' , 'path' ] )
247+ it ( 'creates a Builder with absolute path' , ( ) => {
248+ const builder = Builder . create ( '/absolute/path' )
249+ expect ( builder . base . segments ) . toEqual ( [ 'absolute' , 'path' ] )
250250 } )
251251
252- it ( 'creates a Dir with Fs.Path.AbsDir' , ( ) => {
252+ it ( 'creates a Builder with Fs.Path.AbsDir' , ( ) => {
253253 const absDir = decodeAbsDir ( '/test/' )
254- const dir = Dir . create ( absDir )
255- expect ( dir . base ) . toBe ( absDir )
254+ const builder = Builder . create ( absDir )
255+ expect ( builder . base ) . toBe ( absDir )
256256 } )
257257 } )
258258
259- describe ( 'DirSpec ' , ( ) => {
259+ describe ( 'SpecBuilder ' , ( ) => {
260260 it ( 'creates a spec with operations' , ( ) => {
261- const spec = Dir . spec ( '/test' )
261+ const spec = Builder . spec ( '/test' )
262262 . file ( 'README.md' , '# Test' )
263263 . dir ( 'src/' , _ => _ . file ( 'index.ts' , 'export {}' ) )
264264
@@ -277,7 +277,7 @@ describe('Dir', () => {
277277 const isDev = true
278278 const isProd = false
279279
280- const spec = Dir . spec ( '/app' )
280+ const spec = Builder . spec ( '/app' )
281281 . file ( 'main.ts' , 'console.log("main")' )
282282 . when ( isDev , _ => _ . file ( 'env.txt' , 'DEBUG=true' ) )
283283 . unless ( isProd , _ => _ . file ( 'dev.config.js' , '{}' ) )
@@ -293,7 +293,7 @@ describe('Dir', () => {
293293 } )
294294
295295 it ( 'supports withBase to change base directory' , ( ) => {
296- const spec1 = Dir . spec ( '/project1' )
296+ const spec1 = Builder . spec ( '/project1' )
297297 . file ( 'test.txt' , 'content' )
298298
299299 const spec2 = spec1 . withBase ( '/project2' )
@@ -304,13 +304,13 @@ describe('Dir', () => {
304304 } )
305305
306306 it ( 'supports merge to combine specs' , ( ) => {
307- const spec1 = Dir . spec ( '/test' )
307+ const spec1 = Builder . spec ( '/test' )
308308 . file ( 'a.txt' , 'A' )
309309
310- const spec2 = Dir . spec ( '/test' )
310+ const spec2 = Builder . spec ( '/test' )
311311 . file ( 'b.txt' , 'B' )
312312
313- const spec3 = Dir . spec ( '/test' )
313+ const spec3 = Builder . spec ( '/test' )
314314 . file ( 'c.txt' , 'C' )
315315
316316 const merged = spec1 . merge ( spec2 , spec3 )
@@ -343,16 +343,16 @@ describe('Dir', () => {
343343 const memoryFs = Fs . Memory . layer ( { } )
344344
345345 // Create a spec
346- const spec = Dir . spec ( '/test' )
346+ const spec = Builder . spec ( '/test' )
347347 . file ( 'spec.md' , '# From Spec' )
348348 . dir ( 'nested/' , _ => _ . file ( 'inner.txt' , 'nested content' ) )
349349
350350 const program = Effect . gen ( function * ( ) {
351351 const fs = yield * FileSystem . FileSystem
352352
353- // Create a chain from a dir and merge the spec
354- const dir = Dir . create ( '/test' )
355- const chain = Dir . chain ( dir )
353+ // Create a chain from a builder and merge the spec
354+ const builder = Builder . create ( '/test' )
355+ const chain = Builder . chain ( builder )
356356
357357 // Apply spec operations to chain
358358 yield * chain . merge ( spec ) . commit ( )
0 commit comments