mirror of
https://github.com/vercel/vercel-plugin.git
synced 2026-09-14 15:39:47 +08:00
92b69b6ee7
Finish the session-start profiler Cursor path without touching the profiling logic.
Platform detection now keys off hook input and CLAUDE_ENV_FILE, project root lookup falls back to CURSOR_PROJECT_DIR, and Cursor receives env plus additional_context JSON on stdout.
Verified: bun test hooks/session-start-profiler-platform.test.ts
Verified: bun test hooks/session-hooks-platform-compat.test.ts
Verified: zsh -lc 'tmpdir=/var/folders/c3/r013q3_93_s4zycmx0mdnt2h0000gn/T/tmp.p6JmjuMjls; printf "{\"conversation_id\":\"conv-123\",\"cursor_version\":\"1.0.0\"}" | env -u CLAUDE_ENV_FILE -u CLAUDE_PROJECT_ROOT CURSOR_PROJECT_DIR="" bun hooks/src/session-start-profiler.mts'
Swarm-Agent: codex-profiler-v2
29 lines
855 B
TypeScript
29 lines
855 B
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { detectSessionStartPlatform } from "./src/session-start-profiler.mts";
|
|
|
|
describe("session-start-profiler platform detection", () => {
|
|
test("test_session_start_profiler_does_not_infer_cursor_from_cursor_project_dir_alone", () => {
|
|
expect(
|
|
detectSessionStartPlatform(
|
|
{ session_id: "sess-123" },
|
|
{ CURSOR_PROJECT_DIR: "/tmp/cursor-root" },
|
|
),
|
|
).toBe("claude-code");
|
|
});
|
|
|
|
test("test_session_start_profiler_prefers_claude_env_file_when_present", () => {
|
|
expect(
|
|
detectSessionStartPlatform(
|
|
{
|
|
conversation_id: "conv-123",
|
|
cursor_version: "1.0.0",
|
|
},
|
|
{
|
|
CLAUDE_ENV_FILE: "/tmp/claude.env",
|
|
CURSOR_PROJECT_DIR: "/tmp/cursor-root",
|
|
},
|
|
),
|
|
).toBe("claude-code");
|
|
});
|
|
});
|