Skip to content

Commit b9ef09a

Browse files
committed
tweak: read plurals too and stop erroring on them
1 parent eb81994 commit b9ef09a

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

packages/opencode/src/config/config.ts

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ export namespace Config {
9292

9393
const promises: Promise<void>[] = []
9494
for (const dir of unique(directories)) {
95-
await assertValid(dir)
96-
9795
if (dir.endsWith(".opencode") || dir === Flag.OPENCODE_CONFIG_DIR) {
9896
for (const file of ["opencode.jsonc", "opencode.json"]) {
9997
log.debug(`loading config from ${path.join(dir, file)}`)
@@ -155,23 +153,6 @@ export namespace Config {
155153
}
156154
})
157155

158-
const INVALID_DIRS = new Bun.Glob(`{${["agents", "commands", "plugins", "tools", "skills"].join(",")}}/`)
159-
async function assertValid(dir: string) {
160-
const invalid = await Array.fromAsync(
161-
INVALID_DIRS.scan({
162-
onlyFiles: false,
163-
cwd: dir,
164-
}),
165-
)
166-
for (const item of invalid) {
167-
throw new ConfigDirectoryTypoError({
168-
path: dir,
169-
dir: item,
170-
suggestion: item.substring(0, item.length - 1),
171-
})
172-
}
173-
}
174-
175156
async function installDependencies(dir: string) {
176157
if (Installation.isLocal()) return
177158

@@ -197,7 +178,7 @@ export namespace Config {
197178
await BunProc.run(["install"], { cwd: dir }).catch(() => {})
198179
}
199180

200-
const COMMAND_GLOB = new Bun.Glob("command/**/*.md")
181+
const COMMAND_GLOB = new Bun.Glob("{command,commands}/**/*.md")
201182
async function loadCommand(dir: string) {
202183
const result: Record<string, Command> = {}
203184
for await (const item of COMMAND_GLOB.scan({
@@ -235,7 +216,7 @@ export namespace Config {
235216
return result
236217
}
237218

238-
const AGENT_GLOB = new Bun.Glob("agent/**/*.md")
219+
const AGENT_GLOB = new Bun.Glob("{agent,agents}/**/*.md")
239220
async function loadAgent(dir: string) {
240221
const result: Record<string, Agent> = {}
241222

@@ -278,7 +259,7 @@ export namespace Config {
278259
return result
279260
}
280261

281-
const MODE_GLOB = new Bun.Glob("mode/*.md")
262+
const MODE_GLOB = new Bun.Glob("{mode,modes}/**/*.md")
282263
async function loadMode(dir: string) {
283264
const result: Record<string, Agent> = {}
284265
for await (const item of MODE_GLOB.scan({
@@ -307,7 +288,7 @@ export namespace Config {
307288
return result
308289
}
309290

310-
const PLUGIN_GLOB = new Bun.Glob("plugin/*.{ts,js}")
291+
const PLUGIN_GLOB = new Bun.Glob("{plugin,plugins}/**/*.{ts,js}")
311292
async function loadPlugin(dir: string) {
312293
const plugins: string[] = []
313294

packages/opencode/src/skill/skill.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export namespace Skill {
3535
}),
3636
)
3737

38-
const OPENCODE_SKILL_GLOB = new Bun.Glob("skill/**/SKILL.md")
38+
const OPENCODE_SKILL_GLOB = new Bun.Glob("{skill,skills}/**/SKILL.md")
3939
const CLAUDE_SKILL_GLOB = new Bun.Glob("skills/**/SKILL.md")
4040

4141
export const state = Instance.state(async () => {

0 commit comments

Comments
 (0)