summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-08-11 08:23:41 -0500
committerGitHub <[email protected]>2025-08-11 08:23:41 -0500
commitdf7296cfe16d3c2dfffb01941354173fb5f4a812 (patch)
tree48596f054cce0297e7c73c9351ff91cc32256cfd
parent776276d5a48f13b50d240fe66458db68aa6710df (diff)
downloadopencode-df7296cfe16d3c2dfffb01941354173fb5f4a812.tar.gz
opencode-df7296cfe16d3c2dfffb01941354173fb5f4a812.zip
fix: instructions should be able to handle absolute paths (#1762)
-rw-r--r--packages/opencode/src/session/system.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index 2f767c120..7e5c75e67 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -74,8 +74,22 @@ export namespace SystemPrompt {
paths.add(path.join(os.homedir(), ".claude", "CLAUDE.md"))
if (config.instructions) {
- for (const instruction of config.instructions) {
- const matches = await Filesystem.globUp(instruction, cwd, root).catch(() => [])
+ for (let instruction of config.instructions) {
+ if (instruction.startsWith("~/")) {
+ instruction = path.join(os.homedir(), instruction.slice(2))
+ }
+ let matches: string[] = []
+ if (path.isAbsolute(instruction)) {
+ matches = await Array.fromAsync(
+ new Bun.Glob(path.basename(instruction)).scan({
+ cwd: path.dirname(instruction),
+ absolute: true,
+ onlyFiles: true,
+ }),
+ ).catch(() => [])
+ } else {
+ matches = await Filesystem.globUp(instruction, cwd, root).catch(() => [])
+ }
matches.forEach((path) => paths.add(path))
}
}