Files
paseo/packages/server/src/server/agent/providers/claude-agent-commands.real.e2e.test.ts
T
Mohamed Boudra dace4f862f refactor: make executable resolution async and centralize spawn
- Rename findExecutable → findExecutableSync, add async findExecutable
  that uses promisified execFile instead of execFileSync
- Simplify Windows PATH resolution: rely on inherited env from Explorer
  instead of shelling out to PowerShell for registry PATH entries
- Add spawnProcess() helper that centralizes Windows shell/quoting concerns
- Update all agent providers and consumers to use async executable resolution
- Add windowsHide: true across all Windows child process calls
2026-04-08 23:24:43 +07:00

43 lines
1.5 KiB
TypeScript

import { describe, expect, test } from "vitest";
import pino from "pino";
import type { AgentSlashCommand } from "../agent-sdk-types.js";
import { isCommandAvailableSync } from "../../../utils/executable.js";
import { ClaudeAgentClient } from "./claude-agent.js";
// Real-Claude contract coverage: validates slash command shape from a live Claude CLI session.
describe("claude agent commands contract (real)", () => {
test("lists slash commands with the expected contract", async () => {
expect(isCommandAvailableSync("claude")).toBe(true);
const client = new ClaudeAgentClient({
logger: pino({ level: "silent" }),
});
const session = await client.createSession({
provider: "claude",
cwd: process.cwd(),
modeId: "plan",
});
try {
expect(typeof session.listCommands).toBe("function");
const commands = await session.listCommands!();
expect(Array.isArray(commands)).toBe(true);
expect(commands.length).toBeGreaterThan(0);
expect(commands.map((command) => command.name)).toContain("rewind");
for (const command of commands) {
const typed = command as AgentSlashCommand;
expect(typeof typed.name).toBe("string");
expect(typed.name.length).toBeGreaterThan(0);
expect(typed.name.startsWith("/")).toBe(false);
expect(typeof typed.description).toBe("string");
expect(typeof typed.argumentHint).toBe("string");
}
} finally {
await session.close();
}
}, 60_000);
});