1import * as Effect from "effect/Effect";
2import * as FileSystem from "effect/FileSystem";
3import * as Layer from "effect/Layer";
4import * as S from "effect/Schema";
5
6import * as AI from "alchemy/AI";
7
8export const regex = AI.Parameter("regex")(
9 S.String,
10)`The regex pattern to search for.`;
11
12export class Grep extends (AI.Tool<Grep>()("grep")`
13Search files for a ${regex} pattern and return the matching lines with their file paths and line numbers.`) {}
14
15export 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);