Skip to content

Commit 6a89e9f

Browse files
authored
fix(core): skip node_modules when discovering markdown agents (#62571)
1 parent 478de99 commit 6a89e9f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎packages/core/src/config/plugin/agent.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function expandHome(resource: string, home: string) {
135135
function discover(fs: FSUtil.Interface, directory: string) {
136136
return Effect.forEach(legacySources, (source) =>
137137
fs
138-
.scan(source.pattern, { cwd: directory, absolute: true, dot: true, symlink: true })
138+
.scan(source.pattern, { cwd: directory, absolute: true, dot: true, symlink: true, ignore: FSUtil.ignoreGlobs })
139139
.pipe(
140140
Effect.map((files) => files.toSorted().map((filepath) => ({ directory, filepath, primary: source.primary }))),
141141
),

‎packages/core/test/config/agent.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ permissions:
442442
yield* Effect.promise(async () => {
443443
await fs.mkdir(path.join(tmp.path, "agents", "team"), { recursive: true })
444444
await fs.mkdir(path.join(tmp.path, "modes"), { recursive: true })
445+
await fs.mkdir(path.join(tmp.path, "agents", ".opencode", "node_modules", "probe"), { recursive: true })
446+
await fs.writeFile(
447+
path.join(tmp.path, "agents", ".opencode", "node_modules", "probe", "README.md"),
448+
"# Dependency README",
449+
)
445450
await fs.writeFile(
446451
path.join(tmp.path, "agents", "reviewer.md"),
447452
`---
@@ -509,6 +514,7 @@ Use native v2 fields.`,
509514
expect(themed?.color).toBeUndefined()
510515
expect(yield* agents.get(Agent.ID.make("disabled"))).toBeUndefined()
511516
expect(yield* agents.get(Agent.ID.make("empty"))).toBeUndefined()
517+
expect(yield* agents.get(Agent.ID.make(".opencode/node_modules/probe/README"))).toBeUndefined()
512518
expect(yield* agents.get(Agent.ID.make("plan"))).toMatchObject({ system: "Make a plan.", mode: "primary" })
513519
}),
514520
),

0 commit comments

Comments
 (0)