summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYihui Khuu <[email protected]>2025-09-27 00:46:49 +1000
committerGitHub <[email protected]>2025-09-26 09:46:49 -0500
commit7ecdc1b5d8c324edfd28a9ce23a7fc6e8b7d520f (patch)
tree3041f76a9d37029e762ca873ca59c5dc703bd0ec
parent39917a35ce04c00a79c018edc0f0a4fea23f2da3 (diff)
downloadopencode-7ecdc1b5d8c324edfd28a9ce23a7fc6e8b7d520f.tar.gz
opencode-7ecdc1b5d8c324edfd28a9ce23a7fc6e8b7d520f.zip
fix: config loading not considering symlinks (#2800)
-rw-r--r--packages/opencode/src/config/config.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index ec4e6be94..40e4d90a4 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -120,7 +120,13 @@ export namespace Config {
async function assertValid(dir: string) {
const ALLOWED_DIRS = new Set(["agent", "command", "mode", "plugin", "tool", "themes"])
const UNEXPECTED_DIR_GLOB = new Bun.Glob("*/")
- for await (const item of UNEXPECTED_DIR_GLOB.scan({ absolute: true, cwd: dir, onlyFiles: false })) {
+ for await (const item of UNEXPECTED_DIR_GLOB.scan({
+ absolute: true,
+ followSymlinks: true,
+ dot: true,
+ cwd: dir,
+ onlyFiles: false,
+ })) {
const dirname = path.basename(item)
if (!ALLOWED_DIRS.has(dirname)) {
throw new InvalidError({
@@ -134,7 +140,7 @@ export namespace Config {
const COMMAND_GLOB = new Bun.Glob("command/**/*.md")
async function loadCommand(dir: string) {
const result: Record<string, Command> = {}
- for await (const item of COMMAND_GLOB.scan({ absolute: true, cwd: dir })) {
+ for await (const item of COMMAND_GLOB.scan({ absolute: true, followSymlinks: true, dot: true, cwd: dir })) {
const content = await Bun.file(item).text()
const md = matter(content)
if (!md.data) continue
@@ -169,7 +175,7 @@ export namespace Config {
async function loadAgent(dir: string) {
const result: Record<string, Agent> = {}
- for await (const item of AGENT_GLOB.scan({ absolute: true, cwd: dir })) {
+ for await (const item of AGENT_GLOB.scan({ absolute: true, followSymlinks: true, dot: true, cwd: dir })) {
const content = await Bun.file(item).text()
const md = matter(content)
if (!md.data) continue
@@ -207,7 +213,7 @@ export namespace Config {
const MODE_GLOB = new Bun.Glob("mode/*.md")
async function loadMode(dir: string) {
const result: Record<string, Agent> = {}
- for await (const item of MODE_GLOB.scan({ absolute: true, cwd: dir })) {
+ for await (const item of MODE_GLOB.scan({ absolute: true, followSymlinks: true, dot: true, cwd: dir })) {
const content = await Bun.file(item).text()
const md = matter(content)
if (!md.data) continue
@@ -233,7 +239,7 @@ export namespace Config {
async function loadPlugin(dir: string) {
const plugins: string[] = []
- for await (const item of PLUGIN_GLOB.scan({ absolute: true, cwd: dir })) {
+ for await (const item of PLUGIN_GLOB.scan({ absolute: true, followSymlinks: true, dot: true, cwd: dir })) {
plugins.push("file://" + item)
}
return plugins