Răsfoiți Sursa

tweak: read plurals too and stop erroring on them

Aiden Cline 1 lună în urmă
părinte
comite
b9ef09a0f4
2 a modificat fișierele cu 5 adăugiri și 24 ștergeri
  1. 4 23
      packages/opencode/src/config/config.ts
  2. 1 1
      packages/opencode/src/skill/skill.ts

+ 4 - 23
packages/opencode/src/config/config.ts

@@ -92,8 +92,6 @@ export namespace Config {
 
 
     const promises: Promise<void>[] = []
     const promises: Promise<void>[] = []
     for (const dir of unique(directories)) {
     for (const dir of unique(directories)) {
-      await assertValid(dir)
-
       if (dir.endsWith(".opencode") || dir === Flag.OPENCODE_CONFIG_DIR) {
       if (dir.endsWith(".opencode") || dir === Flag.OPENCODE_CONFIG_DIR) {
         for (const file of ["opencode.jsonc", "opencode.json"]) {
         for (const file of ["opencode.jsonc", "opencode.json"]) {
           log.debug(`loading config from ${path.join(dir, file)}`)
           log.debug(`loading config from ${path.join(dir, file)}`)
@@ -155,23 +153,6 @@ export namespace Config {
     }
     }
   })
   })
 
 
-  const INVALID_DIRS = new Bun.Glob(`{${["agents", "commands", "plugins", "tools", "skills"].join(",")}}/`)
-  async function assertValid(dir: string) {
-    const invalid = await Array.fromAsync(
-      INVALID_DIRS.scan({
-        onlyFiles: false,
-        cwd: dir,
-      }),
-    )
-    for (const item of invalid) {
-      throw new ConfigDirectoryTypoError({
-        path: dir,
-        dir: item,
-        suggestion: item.substring(0, item.length - 1),
-      })
-    }
-  }
-
   async function installDependencies(dir: string) {
   async function installDependencies(dir: string) {
     if (Installation.isLocal()) return
     if (Installation.isLocal()) return
 
 
@@ -197,7 +178,7 @@ export namespace Config {
     await BunProc.run(["install"], { cwd: dir }).catch(() => {})
     await BunProc.run(["install"], { cwd: dir }).catch(() => {})
   }
   }
 
 
-  const COMMAND_GLOB = new Bun.Glob("command/**/*.md")
+  const COMMAND_GLOB = new Bun.Glob("{command,commands}/**/*.md")
   async function loadCommand(dir: string) {
   async function loadCommand(dir: string) {
     const result: Record<string, Command> = {}
     const result: Record<string, Command> = {}
     for await (const item of COMMAND_GLOB.scan({
     for await (const item of COMMAND_GLOB.scan({
@@ -235,7 +216,7 @@ export namespace Config {
     return result
     return result
   }
   }
 
 
-  const AGENT_GLOB = new Bun.Glob("agent/**/*.md")
+  const AGENT_GLOB = new Bun.Glob("{agent,agents}/**/*.md")
   async function loadAgent(dir: string) {
   async function loadAgent(dir: string) {
     const result: Record<string, Agent> = {}
     const result: Record<string, Agent> = {}
 
 
@@ -278,7 +259,7 @@ export namespace Config {
     return result
     return result
   }
   }
 
 
-  const MODE_GLOB = new Bun.Glob("mode/*.md")
+  const MODE_GLOB = new Bun.Glob("{mode,modes}/**/*.md")
   async function loadMode(dir: string) {
   async function loadMode(dir: string) {
     const result: Record<string, Agent> = {}
     const result: Record<string, Agent> = {}
     for await (const item of MODE_GLOB.scan({
     for await (const item of MODE_GLOB.scan({
@@ -307,7 +288,7 @@ export namespace Config {
     return result
     return result
   }
   }
 
 
-  const PLUGIN_GLOB = new Bun.Glob("plugin/*.{ts,js}")
+  const PLUGIN_GLOB = new Bun.Glob("{plugin,plugins}/**/*.{ts,js}")
   async function loadPlugin(dir: string) {
   async function loadPlugin(dir: string) {
     const plugins: string[] = []
     const plugins: string[] = []
 
 

+ 1 - 1
packages/opencode/src/skill/skill.ts

@@ -35,7 +35,7 @@ export namespace Skill {
     }),
     }),
   )
   )
 
 
-  const OPENCODE_SKILL_GLOB = new Bun.Glob("skill/**/SKILL.md")
+  const OPENCODE_SKILL_GLOB = new Bun.Glob("{skill,skills}/**/SKILL.md")
   const CLAUDE_SKILL_GLOB = new Bun.Glob("skills/**/SKILL.md")
   const CLAUDE_SKILL_GLOB = new Bun.Glob("skills/**/SKILL.md")
 
 
   export const state = Instance.state(async () => {
   export const state = Instance.state(async () => {