mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-13 15:44:56 +00:00
chore: generate
This commit is contained in:
@@ -105,9 +105,9 @@ it.instance("explore agent asks for external directories and allows whitelisted
|
||||
expect(explore).toBeDefined()
|
||||
expect(Permission.evaluate("external_directory", "/some/other/path", explore!.permission).action).toBe("ask")
|
||||
expect(Permission.evaluate("external_directory", Truncate.GLOB, explore!.permission).action).toBe("allow")
|
||||
expect(Permission.evaluate("external_directory", path.join(Global.Path.tmp, "agent-work"), explore!.permission).action).toBe(
|
||||
"allow",
|
||||
)
|
||||
expect(
|
||||
Permission.evaluate("external_directory", path.join(Global.Path.tmp, "agent-work"), explore!.permission).action,
|
||||
).toBe("allow")
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -548,9 +548,9 @@ it.instance(
|
||||
it.instance("global tmp directory children are allowed for external_directory", () =>
|
||||
Effect.gen(function* () {
|
||||
const build = yield* load((svc) => svc.get("build"))
|
||||
expect(Permission.evaluate("external_directory", path.join(Global.Path.tmp, "scratch"), build!.permission).action).toBe(
|
||||
"allow",
|
||||
)
|
||||
expect(
|
||||
Permission.evaluate("external_directory", path.join(Global.Path.tmp, "scratch"), build!.permission).action,
|
||||
).toBe("allow")
|
||||
expect(Permission.evaluate("external_directory", "/some/other/path", build!.permission).action).toBe("ask")
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -107,46 +107,50 @@ describe("tool.assertExternalDirectory", () => {
|
||||
)
|
||||
|
||||
if (process.platform === "win32") {
|
||||
it.instance("normalizes Windows path variants to one glob", () =>
|
||||
Effect.gen(function* () {
|
||||
const { requests, ctx } = makeCtx()
|
||||
it.instance(
|
||||
"normalizes Windows path variants to one glob",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const { requests, ctx } = makeCtx()
|
||||
|
||||
const outerTmp = yield* tmpdirScoped()
|
||||
yield* Effect.promise(() => Bun.write(path.join(outerTmp, "outside.txt"), "x"))
|
||||
const outerTmp = yield* tmpdirScoped()
|
||||
yield* Effect.promise(() => Bun.write(path.join(outerTmp, "outside.txt"), "x"))
|
||||
|
||||
const target = path.join(outerTmp, "outside.txt")
|
||||
const alt = target
|
||||
.replace(/^[A-Za-z]:/, "")
|
||||
.replaceAll("\\", "/")
|
||||
.toLowerCase()
|
||||
const target = path.join(outerTmp, "outside.txt")
|
||||
const alt = target
|
||||
.replace(/^[A-Za-z]:/, "")
|
||||
.replaceAll("\\", "/")
|
||||
.toLowerCase()
|
||||
|
||||
yield* assertExternalDirectoryEffect(ctx, alt)
|
||||
yield* assertExternalDirectoryEffect(ctx, alt)
|
||||
|
||||
const req = requests.find((r) => r.permission === "external_directory")
|
||||
const expected = glob(path.join(outerTmp, "*"))
|
||||
expect(req).toBeDefined()
|
||||
expect(req!.patterns).toEqual([expected])
|
||||
expect(req!.always).toEqual([expected])
|
||||
}),
|
||||
const req = requests.find((r) => r.permission === "external_directory")
|
||||
const expected = glob(path.join(outerTmp, "*"))
|
||||
expect(req).toBeDefined()
|
||||
expect(req!.patterns).toEqual([expected])
|
||||
expect(req!.always).toEqual([expected])
|
||||
}),
|
||||
{ git: true },
|
||||
)
|
||||
|
||||
it.instance("uses drive root glob for root files", () =>
|
||||
Effect.gen(function* () {
|
||||
const { requests, ctx } = makeCtx()
|
||||
it.instance(
|
||||
"uses drive root glob for root files",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const { requests, ctx } = makeCtx()
|
||||
|
||||
const tmp = yield* TestInstance
|
||||
const root = path.parse(tmp.directory).root
|
||||
const target = path.join(root, "boot.ini")
|
||||
const tmp = yield* TestInstance
|
||||
const root = path.parse(tmp.directory).root
|
||||
const target = path.join(root, "boot.ini")
|
||||
|
||||
yield* assertExternalDirectoryEffect(ctx, target)
|
||||
yield* assertExternalDirectoryEffect(ctx, target)
|
||||
|
||||
const req = requests.find((r) => r.permission === "external_directory")
|
||||
const expected = path.join(root, "*")
|
||||
expect(req).toBeDefined()
|
||||
expect(req!.patterns).toEqual([expected])
|
||||
expect(req!.always).toEqual([expected])
|
||||
}),
|
||||
const req = requests.find((r) => r.permission === "external_directory")
|
||||
const expected = path.join(root, "*")
|
||||
expect(req).toBeDefined()
|
||||
expect(req!.patterns).toEqual([expected])
|
||||
expect(req!.always).toEqual([expected])
|
||||
}),
|
||||
{ git: true },
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user