88 */
99
1010import { spawn_out } from '@fuzdev/fuz_util/process.js' ;
11- import { readFile , writeFile , mkdir } from 'node:fs/promises' ;
12- import { existsSync } from 'node:fs' ;
11+ import { readFile , writeFile , mkdir , stat } from 'node:fs/promises' ;
1312import { git_checkout , type GitBranch , type GitOrigin } from '@fuzdev/fuz_util/git.js' ;
1413import { EMPTY_OBJECT } from '@fuzdev/fuz_util/object.js' ;
1514
@@ -23,7 +22,7 @@ import {
2322 git_tag ,
2423 git_push_tag ,
2524 git_has_changes ,
26- git_get_changed_files ,
25+ git_list_uncommitted_files ,
2726 git_has_file_changed ,
2827 git_stash ,
2928 git_stash_pop ,
@@ -165,9 +164,9 @@ export const default_git_operations: GitOperations = {
165164 return wrap_with_value ( ( ) => git_has_changes ( cwd ? { cwd} : undefined ) ) ;
166165 } ,
167166
168- get_changed_files : async ( options ) => {
167+ list_uncommitted_files : async ( options ) => {
169168 const { cwd} = options ?? EMPTY_OBJECT ;
170- return wrap_with_value ( ( ) => git_get_changed_files ( cwd ? { cwd} : undefined ) ) ;
169+ return wrap_with_value ( ( ) => git_list_uncommitted_files ( cwd ? { cwd} : undefined ) ) ;
171170 } ,
172171
173172 // Tagging
@@ -203,9 +202,9 @@ export const default_git_operations: GitOperations = {
203202
204203export const default_process_operations : ProcessOperations = {
205204 spawn : async ( options ) => {
206- const { cmd, args, spawn_options } = options ;
205+ const { cmd, args, cwd } = options ;
207206 try {
208- const spawned = await spawn_out ( cmd , args , spawn_options ) ;
207+ const spawned = await spawn_out ( cmd , args , cwd ? { cwd } : undefined ) ;
209208 if ( spawned . result . ok ) {
210209 return {
211210 ok : true ,
@@ -318,8 +317,13 @@ export const default_fs_operations: FsOperations = {
318317 return wrap_void ( ( ) => mkdir ( path , { recursive} ) ) ;
319318 } ,
320319
321- exists : ( options ) => {
322- return existsSync ( options . path ) ;
320+ exists : async ( options ) => {
321+ try {
322+ await stat ( options . path ) ;
323+ return true ;
324+ } catch {
325+ return false ;
326+ }
323327 } ,
324328} ;
325329
0 commit comments