fix: instructions should be able to handle absolute paths (#1762)
This commit is contained in:
@@ -74,8 +74,22 @@ export namespace SystemPrompt {
|
|||||||
paths.add(path.join(os.homedir(), ".claude", "CLAUDE.md"))
|
paths.add(path.join(os.homedir(), ".claude", "CLAUDE.md"))
|
||||||
|
|
||||||
if (config.instructions) {
|
if (config.instructions) {
|
||||||
for (const instruction of config.instructions) {
|
for (let instruction of config.instructions) {
|
||||||
const matches = await Filesystem.globUp(instruction, cwd, root).catch(() => [])
|
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))
|
matches.forEach((path) => paths.add(path))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user