chore: format code

This commit is contained in:
GitHub Action
2025-11-08 01:59:02 +00:00
parent 16357e8041
commit 34ff87d504
182 changed files with 940 additions and 3646 deletions

View File

@@ -381,11 +381,7 @@ test("resolves scoped npm plugins in config", async () => {
await Bun.write(
path.join(dir, "opencode.json"),
JSON.stringify(
{ $schema: "https://opencode.ai/config.json", plugin: ["@scope/plugin"] },
null,
2,
),
JSON.stringify({ $schema: "https://opencode.ai/config.json", plugin: ["@scope/plugin"] }, null, 2),
)
},
})

View File

@@ -13,8 +13,7 @@ describe("ide", () => {
test("should detect Visual Studio Code", () => {
process.env["TERM_PROGRAM"] = "vscode"
process.env["GIT_ASKPASS"] =
"/path/to/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
process.env["GIT_ASKPASS"] = "/path/to/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Visual Studio Code")
})
@@ -29,24 +28,21 @@ describe("ide", () => {
test("should detect Cursor", () => {
process.env["TERM_PROGRAM"] = "vscode"
process.env["GIT_ASKPASS"] =
"/path/to/Cursor.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
process.env["GIT_ASKPASS"] = "/path/to/Cursor.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Cursor")
})
test("should detect VSCodium", () => {
process.env["TERM_PROGRAM"] = "vscode"
process.env["GIT_ASKPASS"] =
"/path/to/VSCodium.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
process.env["GIT_ASKPASS"] = "/path/to/VSCodium.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("VSCodium")
})
test("should detect Windsurf", () => {
process.env["TERM_PROGRAM"] = "vscode"
process.env["GIT_ASKPASS"] =
"/path/to/Windsurf.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
process.env["GIT_ASKPASS"] = "/path/to/Windsurf.app/Contents/Resources/app/extensions/git/dist/askpass.sh"
expect(Ide.ide()).toBe("Windsurf")
})

View File

@@ -13,9 +13,7 @@ function apiError(headers?: Record<string, string>): MessageV2.APIError {
describe("session.retry.getRetryDelayInMs", () => {
test("doubles delay on each attempt when headers missing", () => {
const error = apiError()
const delays = Array.from({ length: 7 }, (_, index) =>
SessionRetry.getRetryDelayInMs(error, index + 1),
)
const delays = Array.from({ length: 7 }, (_, index) => SessionRetry.getRetryDelayInMs(error, index + 1))
expect(delays).toStrictEqual([2000, 4000, 8000, 16000, 32000, 64000, 128000])
})

View File

@@ -31,9 +31,7 @@ describe("tool.patch", () => {
await Instance.provide({
directory: "/tmp",
fn: async () => {
expect(patchTool.execute({ patchText: "invalid patch" }, ctx)).rejects.toThrow(
"Failed to parse patch",
)
expect(patchTool.execute({ patchText: "invalid patch" }, ctx)).rejects.toThrow("Failed to parse patch")
},
})
})
@@ -45,9 +43,7 @@ describe("tool.patch", () => {
const emptyPatch = `*** Begin Patch
*** End Patch`
expect(patchTool.execute({ patchText: emptyPatch }, ctx)).rejects.toThrow(
"No file changes found in patch",
)
expect(patchTool.execute({ patchText: emptyPatch }, ctx)).rejects.toThrow("No file changes found in patch")
},
})
})
@@ -116,9 +112,7 @@ describe("tool.patch", () => {
// Verify file was created with correct content
const filePath = path.join(fixture.path, "config.js")
const content = await fs.readFile(filePath, "utf-8")
expect(content).toBe(
'const API_KEY = "test-key"\nconst DEBUG = false\nconst VERSION = "1.0"',
)
expect(content).toBe('const API_KEY = "test-key"\nconst DEBUG = false\nconst VERSION = "1.0"')
},
})
})

View File

@@ -24,12 +24,9 @@ test("allStructured matches command sequences", () => {
"git status*": "allow",
}
expect(Wildcard.allStructured({ head: "git", tail: ["status", "--short"] }, rules)).toBe("allow")
expect(
Wildcard.allStructured(
{ head: "npm", tail: ["run", "build", "--watch"] },
{ "npm run *": "allow" },
),
).toBe("allow")
expect(Wildcard.allStructured({ head: "npm", tail: ["run", "build", "--watch"] }, { "npm run *": "allow" })).toBe(
"allow",
)
expect(Wildcard.allStructured({ head: "ls", tail: ["-la"] }, rules)).toBeUndefined()
})
@@ -54,7 +51,5 @@ test("allStructured handles sed flags", () => {
expect(Wildcard.allStructured({ head: "sed", tail: ["-i", "file"] }, rules)).toBe("ask")
expect(Wildcard.allStructured({ head: "sed", tail: ["-i.bak", "file"] }, rules)).toBe("ask")
expect(Wildcard.allStructured({ head: "sed", tail: ["-n", "1p", "file"] }, rules)).toBe("allow")
expect(
Wildcard.allStructured({ head: "sed", tail: ["-i", "-n", "/./p", "myfile.txt"] }, rules),
).toBe("ask")
expect(Wildcard.allStructured({ head: "sed", tail: ["-i", "-n", "/./p", "myfile.txt"] }, rules)).toBe("ask")
})