| 1 | import * as Effect from "effect/Effect"; |
| 2 | import * as FileSystem from "effect/FileSystem"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as S from "effect/Schema"; |
| 5 | |
| 6 | import * as AI from "alchemy/AI"; |
| 7 | |
| 8 | export const regex = AI.Parameter("regex")( |
| 9 | S.String, |
| 10 | )`The regex pattern to search for.`; |
| 11 | |
| 12 | export class Grep extends (AI.Tool<Grep>()("grep")` |
| 13 | Search files for a ${regex} pattern and return the matching lines with their file paths and line numbers.`) {} |
| 14 | |
| 15 | export const GrepLive = Layer.effect( |
| 16 | Grep, |
| 17 | Effect.gen(function* () { |
| 18 | const _fs = yield* FileSystem.FileSystem; |
| 19 | return Effect.fn(function* ({ regex }) { |
| 20 | void regex; |
| 21 | }); |
| 22 | }), |
| 23 | ); |