Open History to see the last commit
1// @effect-diagnostics nodeBuiltinImport:off
2import * as NodeFS from "node:fs";
3import * as NodePath from "node:path";
4
5import { assert, it } from "@effect/vitest";
6
7import { buildTriageContext, buildTriageLaunchPrompt, TRIAGE_PLAYBOOK } from "./triagePrompt.ts";
8
9it("stays byte-identical to .github/triage/PLAYBOOK.md", () => {
10 // Older releases fetch the repository playbook.
11 const canonicalPath = NodePath.join(
12 import.meta.dirname,
13 "../../../../.github/triage/PLAYBOOK.md",
14 );
15 assert.equal(TRIAGE_PLAYBOOK, NodeFS.readFileSync(canonicalPath, "utf8"));
16});
17
18it("launch prompt stays a single argv-safe line naming the prompt file", () => {
19 // Windows .cmd shims cannot carry multiline argv.
20 const launch = buildTriageLaunchPrompt(String.raw`C:\Users\a b\.t3\userdata\triage\x\prompt.md`);
21 assert.notInclude(launch, "\n");
22 assert.include(launch, String.raw`C:\Users\a b\.t3\userdata\triage\x\prompt.md`);
23 assert.isBelow(launch.length, 1_000);
24});
25
26it("context file labels the CLI version as the CLI's, not the user's build", () => {
27 const context = buildTriageContext({
28 generatedAt: "2026-09-24T00:00:00.000Z",
29 cliVersion: "0.0.42",
30 os: "linux x64 (7.2.0)",
31 nodeVersion: "v26.8.2",
32 launchedAs: "npx t3 triage",
33 server: "running (pid 42, http://127.0.0.1:3773, version 0.0.43-nightly.20260923.2173)",
34 paths: {
35 stateDir: "/home/u/.t3/userdata",
36 dbPath: "/home/u/.t3/userdata/state.sqlite",
37 settingsPath: "/home/u/.t3/userdata/settings.json",
38 logsDir: "/home/u/.t3/userdata/logs",
39 serviceLogPath: "/home/u/.t3/userdata/logs/boot-service.log",
40 desktopBackendLogGlob: "/home/u/.t3/userdata/logs/server-child*.log*",
41 serverTracePath: "/home/u/.t3/userdata/logs/server.trace.ndjson",
42 providerEventLogPath: "/home/u/.t3/userdata/logs/provider/events.log",
43 terminalLogsDir: "/home/u/.t3/userdata/logs/terminals",
44 providerStatusCacheDir: "/home/u/.t3/caches",
45 secretsDir: "/home/u/.t3/userdata/secrets",
46 sourceCacheDir: "/home/u/.t3/source",
47 },
48 });
49 assert.notInclude(context, "Installed version");
50 assert.notInclude(context, "Release tag");
51 assert.include(context, "- Triage CLI version: 0.0.42 (");
52 assert.include(context, "version 0.0.43-nightly.20260923.2173");
53});