summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSpoon <[email protected]>2026-01-06 21:48:22 +0100
committerGitHub <[email protected]>2026-01-06 14:48:22 -0600
commita10cc634035f283b918e53dbd5e812547477cddd (patch)
tree83d04576f09fb78470a756dc963ae113600e3218
parentcde06e90d0baaefaf4572c1ded201eba4546ac23 (diff)
downloadopencode-a10cc634035f283b918e53dbd5e812547477cddd.tar.gz
opencode-a10cc634035f283b918e53dbd5e812547477cddd.zip
feat: url based instructions (#7125)
-rw-r--r--packages/opencode/src/session/system.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/opencode/src/session/system.ts b/packages/opencode/src/session/system.ts
index dc180bee8..12b6a537e 100644
--- a/packages/opencode/src/session/system.ts
+++ b/packages/opencode/src/session/system.ts
@@ -90,8 +90,13 @@ export namespace SystemPrompt {
}
}
+ const urls: string[] = []
if (config.instructions) {
for (let instruction of config.instructions) {
+ if (instruction.startsWith("https://") || instruction.startsWith("http://")) {
+ urls.push(instruction)
+ continue
+ }
if (instruction.startsWith("~/")) {
instruction = path.join(os.homedir(), instruction.slice(2))
}
@@ -111,12 +116,18 @@ export namespace SystemPrompt {
}
}
- const found = Array.from(paths).map((p) =>
+ const foundFiles = Array.from(paths).map((p) =>
Bun.file(p)
.text()
.catch(() => "")
.then((x) => "Instructions from: " + p + "\n" + x),
)
- return Promise.all(found).then((result) => result.filter(Boolean))
+ const foundUrls = urls.map((url) =>
+ fetch(url)
+ .then((res) => (res.ok ? res.text() : ""))
+ .catch(() => "")
+ .then((x) => (x ? "Instructions from: " + url + "\n" + x : "")),
+ )
+ return Promise.all([...foundFiles, ...foundUrls]).then((result) => result.filter(Boolean))
}
}