@@ -772,7 +772,7 @@ describe("Config", () => {
772772 ) ,
773773 )
774774
775- it . live ( "loads extra config directories after global config and before project config " , ( ) =>
775+ it . live ( "loads custom config directories after project config with singular last " , ( ) =>
776776 Effect . acquireRelease (
777777 Effect . promise ( ( ) => tmpdir ( ) ) ,
778778 ( tmp ) => Effect . promise ( ( ) => tmp [ Symbol . asyncDispose ] ( ) ) ,
@@ -781,12 +781,14 @@ describe("Config", () => {
781781 const global = path . join ( tmp . path , "global" )
782782 const firstExtra = path . join ( tmp . path , "extra-a" )
783783 const secondExtra = path . join ( tmp . path , "extra-b" )
784+ const singularExtra = path . join ( tmp . path , "extra-singular" )
784785 const root = path . join ( tmp . path , "repo" )
785786 return Effect . gen ( function * ( ) {
786787 yield * Effect . promise ( async ( ) => {
787788 await fs . mkdir ( global , { recursive : true } )
788789 await fs . mkdir ( firstExtra , { recursive : true } )
789790 await fs . mkdir ( secondExtra , { recursive : true } )
791+ await fs . mkdir ( singularExtra , { recursive : true } )
790792 await fs . mkdir ( path . join ( root , ".opencode" ) , { recursive : true } )
791793 await Promise . all ( [
792794 fs . writeFile (
@@ -801,6 +803,10 @@ describe("Config", () => {
801803 path . join ( secondExtra , "opencode.json" ) ,
802804 JSON . stringify ( { $schema : "extra-b" , model : "extra-b/model" } ) ,
803805 ) ,
806+ fs . writeFile (
807+ path . join ( singularExtra , "opencode.json" ) ,
808+ JSON . stringify ( { $schema : "extra-singular" , model : "extra-singular/model" } ) ,
809+ ) ,
804810 fs . writeFile (
805811 path . join ( root , "opencode.json" ) ,
806812 JSON . stringify ( { $schema : "project" , model : "project/model" } ) ,
@@ -819,19 +825,21 @@ describe("Config", () => {
819825
820826 expect ( entries . filter ( ( entry ) => entry . type === "directory" ) . map ( ( entry ) => entry . path ) ) . toEqual ( [
821827 AbsolutePath . make ( global ) ,
828+ AbsolutePath . make ( path . join ( root , ".opencode" ) ) ,
822829 AbsolutePath . make ( firstExtra ) ,
823830 AbsolutePath . make ( secondExtra ) ,
824- AbsolutePath . make ( path . join ( root , ".opencode" ) ) ,
831+ AbsolutePath . make ( singularExtra ) ,
825832 ] )
826833 expect ( documents . map ( ( document ) => document . info . $schema ) ) . toEqual ( [
827834 "global" ,
828- "extra-a" ,
829- "extra-b" ,
830835 "project" ,
831836 "project-dot" ,
837+ "extra-a" ,
838+ "extra-b" ,
839+ "extra-singular" ,
832840 ] )
833- expect ( Config . latest ( entries , "model" ) ) . toBe ( "project-dot /model" )
834- } ) . pipe ( Effect . provide ( testLayer ( root , global , root , undefined , [ firstExtra , secondExtra ] ) ) )
841+ expect ( Config . latest ( entries , "model" ) ) . toBe ( "extra-singular /model" )
842+ } ) . pipe ( Effect . provide ( testLayer ( root , global , root , undefined , [ firstExtra , secondExtra , singularExtra ] ) ) )
835843 } )
836844 } ) ,
837845 ) ,
0 commit comments