chore: migrate to oxlint and oxfmt

Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-14 14:31:43 +00:00
parent 912ebffc63
commit c379191f80
1480 changed files with 28608 additions and 43547 deletions

View File

@@ -29,56 +29,52 @@ beforeEach(() => {
});
describe("discord native commands", () => {
it(
"streams tool results for native slash commands",
{ timeout: 30_000 },
async () => {
const { ChannelType } = await import("@buape/carbon");
const { createDiscordNativeCommand } = await import("./monitor.js");
it("streams tool results for native slash commands", { timeout: 30_000 }, async () => {
const { ChannelType } = await import("@buape/carbon");
const { createDiscordNativeCommand } = await import("./monitor.js");
const cfg = {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
humanDelay: { mode: "off" },
workspace: "/tmp/clawd",
},
const cfg = {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
humanDelay: { mode: "off" },
workspace: "/tmp/clawd",
},
session: { store: "/tmp/clawdbot-sessions.json" },
discord: { dm: { enabled: true, policy: "open" } },
} as ReturnType<typeof import("../config/config.js").loadConfig>;
},
session: { store: "/tmp/clawdbot-sessions.json" },
discord: { dm: { enabled: true, policy: "open" } },
} as ReturnType<typeof import("../config/config.js").loadConfig>;
const command = createDiscordNativeCommand({
command: {
name: "verbose",
description: "Toggle verbose mode.",
acceptsArgs: true,
},
cfg,
discordConfig: cfg.discord,
accountId: "default",
sessionPrefix: "discord:slash",
ephemeralDefault: true,
});
const command = createDiscordNativeCommand({
command: {
name: "verbose",
description: "Toggle verbose mode.",
acceptsArgs: true,
},
cfg,
discordConfig: cfg.discord,
accountId: "default",
sessionPrefix: "discord:slash",
ephemeralDefault: true,
});
const reply = vi.fn().mockResolvedValue(undefined);
const followUp = vi.fn().mockResolvedValue(undefined);
const reply = vi.fn().mockResolvedValue(undefined);
const followUp = vi.fn().mockResolvedValue(undefined);
await command.run({
user: { id: "u1", username: "Ada", globalName: "Ada" },
channel: { type: ChannelType.DM },
guild: null,
rawData: { id: "i1" },
options: { getString: vi.fn().mockReturnValue("on") },
reply,
followUp,
});
await command.run({
user: { id: "u1", username: "Ada", globalName: "Ada" },
channel: { type: ChannelType.DM },
guild: null,
rawData: { id: "i1" },
options: { getString: vi.fn().mockReturnValue("on") },
reply,
followUp,
});
expect(dispatchMock).toHaveBeenCalledTimes(1);
expect(reply).toHaveBeenCalledTimes(1);
expect(followUp).toHaveBeenCalledTimes(1);
expect(reply.mock.calls[0]?.[0]?.content).toContain("tool");
expect(followUp.mock.calls[0]?.[0]?.content).toContain("final");
},
);
expect(dispatchMock).toHaveBeenCalledTimes(1);
expect(reply).toHaveBeenCalledTimes(1);
expect(followUp).toHaveBeenCalledTimes(1);
expect(reply.mock.calls[0]?.[0]?.content).toContain("tool");
expect(followUp.mock.calls[0]?.[0]?.content).toContain("final");
});
});