@@ -3,7 +3,6 @@ export * as InstructionDiscovery from "./instruction-discovery"
33import { Array , Context , Effect , Layer , Schema } from "effect"
44import { isAbsolute , join , relative , sep } from "path"
55import { FSUtil } from "./fs-util"
6- import { Flag } from "./flag/flag"
76import { Global } from "./global"
87import { Location } from "./location"
98import { AbsolutePath } from "./schema"
@@ -22,9 +21,14 @@ export interface Interface {
2221 readonly load : ( ) => Effect . Effect < Instructions . Instructions >
2322}
2423
24+ export const Options = Schema . Struct ( {
25+ project : Schema . optional ( Schema . Boolean ) ,
26+ } )
27+ export type Options = typeof Options . Type
28+
2529export class Service extends Context . Service < Service , Interface > ( ) ( "@opencode/v2/InstructionDiscovery" ) { }
2630
27- const layer = Layer . effect (
31+ export const layer = ( options ?: Options ) => Layer . effect (
2832 Service ,
2933 Effect . gen ( function * ( ) {
3034 const fs = yield * FSUtil . Service
@@ -52,7 +56,7 @@ const layer = Layer.effect(
5256 fromProject === "" || ( fromProject !== ".." && ! fromProject . startsWith ( `..${ sep } ` ) && ! isAbsolute ( fromProject ) )
5357 const discovered = new Set (
5458 yield * Effect . forEach (
55- Flag . OPENCODE_DISABLE_PROJECT_CONFIG || ! insideProject
59+ options ?. project === false || ! insideProject
5660 ? [ ]
5761 : yield * fs . up ( {
5862 targets : [ "AGENTS.md" ] ,
@@ -93,7 +97,11 @@ const layer = Layer.effect(
9397 } ) ,
9498)
9599
96- export const node = makeLocationNode ( { service : Service , layer, deps : [ FSUtil . node , Global . node , Location . node ] } )
100+ export const node = makeLocationNode ( {
101+ service : Service ,
102+ layer : layer ( ) ,
103+ deps : [ FSUtil . node , Global . node , Location . node ] ,
104+ } )
97105
98106function render ( files : ReadonlyArray < File > ) {
99107 return files . map ( ( file ) => `Instructions from: ${ file . path } \n${ file . content } ` ) . join ( "\n\n" )
0 commit comments