Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ClaudeCapabilitiesProbe.test.ts

43 lines1.7 KB

1// @effect-diagnostics nodeBuiltinImport:off - cleanup uses Node's retrying rm, which the FileSystem service does not expose.
2import * as NodeServices from "@effect/platform-node/NodeServices";
3import { ClaudeSettings, type ServerProvider } from "@t3tools/contracts";
4import { vi } from "vite-plus/test";
5import { assert, it } from "@effect/vitest";
6import * as Effect from "effect/Effect";
7import * as Schema from "effect/Schema";
8​
9import {
10 buildClaudeCapabilitiesProbeQueryOptions,
11 probeClaudeWorkspaceSnapshot,
12} from "./ClaudeProvider.ts";
13​
14vi.mock("@anthropic-ai/claude-agent-sdk", { spy: true });
15​
16const decodeClaudeSettings = Schema.decodeEffect(ClaudeSettings);
17​
18it("drops strict MCP mode, and only that, next to an administrator's managed-mcp.json", () => {
19 const options = buildClaudeCapabilitiesProbeQueryOptions({
20 executablePath: "/usr/bin/claude",
21 abortController: new AbortController(),
22 environment: { HOME: "/home/user" },
23 cwd: undefined,
24 managedMcpConfig: true,
25 });
26​
27 // Claude exits before initializing when handed --strict-mcp-config here.
28 assert.equal(options.strictMcpConfig, undefined);
29 assert.deepEqual(options.mcpServers, {});
30 assert.equal(options.env?.ENABLE_CLAUDEAI_MCP_SERVERS, "false");
31});
32​
33it.effect("reports a deleted worktree's scan as finished, not pending", () =>
34 Effect.gen(function* () {
35 const snapshot = yield* probeClaudeWorkspaceSnapshot(
36 yield* decodeClaudeSettings({}),
37 { skills: [], slashCommands: [] } as unknown as ServerProvider,
38 "/nonexistent/t3-deleted-worktree",
39 { HOME: "/nonexistent/t3-home" },
40 );
41 assert.strictEqual(snapshot.slashCommandsPending, false);
42 }).pipe(Effect.provide(NodeServices.layer)),
43);