Open History to see the last commit
1// @effect-diagnostics nodeBuiltinImport:off - CLI integration exercises Node HTTP and filesystem boundaries.
2import * as NodeHttp from "node:http";
3import * as NodeFS from "node:fs";
4import * as NodeOS from "node:os";
5import * as NodePath from "node:path";
6
7import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
8import * as NodeServices from "@effect/platform-node/NodeServices";
9import {
10 CommandId,
11 EnvironmentOrchestrationHttpApi,
12 ProviderInstanceId,
13 ThreadId,
14} from "@t3tools/contracts";
15import * as NetService from "@t3tools/shared/Net";
16import { assert, it } from "@effect/vitest";
17import * as Effect from "effect/Effect";
18import * as DateTime from "effect/DateTime";
19import * as Layer from "effect/Layer";
20import * as HttpRouter from "effect/unstable/http/HttpRouter";
21import * as HttpServer from "effect/unstable/http/HttpServer";
22import * as HttpApi from "effect/unstable/httpapi/HttpApi";
23import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
24import * as CliError from "effect/unstable/cli/CliError";
25import * as TestConsole from "effect/testing/TestConsole";
26import { Command } from "effect/unstable/cli";
27
28import { cli, makeCli } from "./bin.ts";
29import * as ServerConfig from "./config.ts";
30import * as ProjectionSnapshotQuery from "./orchestration/Services/ProjectionSnapshotQuery.ts";
31import * as OrchestrationEngine from "./orchestration/Services/OrchestrationEngine.ts";
32import { OrchestrationLayerLive } from "./orchestration/runtimeLayer.ts";
33import { orchestrationHttpApiLayer } from "./orchestration/http.ts";
34import { layerConfig as SqlitePersistenceLayerLive } from "./persistence/Layers/Sqlite.ts";
35import * as RepositoryIdentityResolver from "./project/RepositoryIdentityResolver.ts";
36import {
37 makePersistedServerRuntimeState,
38 persistServerRuntimeState,
39} from "./serverRuntimeState.ts";
40import * as WorkspacePaths from "./workspace/WorkspacePaths.ts";
41import * as ServerSecretStore from "./auth/ServerSecretStore.ts";
42import * as EnvironmentAuth from "./auth/EnvironmentAuth.ts";
43import { environmentAuthenticatedAuthLayer } from "./auth/http.ts";
44
45const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, NetService.layer);
46class ProjectCliHttpApi extends HttpApi.make("environment").add(EnvironmentOrchestrationHttpApi) {}
47
48const connectCli = makeCli({ cloudEnabled: true });
49const noConnectCli = makeCli({ cloudEnabled: false });
50const runCli = (args: ReadonlyArray<string>, command = cli) =>
51 Command.runWith(command, { version: "0.0.0" })(args);
52const runConnectCli = (args: ReadonlyArray<string>) => runCli(args, connectCli);
53const runCliWithRuntime = (args: ReadonlyArray<string>) =>
54 runCli(args).pipe(Effect.provide(CliRuntimeLayer));
55
56const captureStdout = <A, E, R>(effect: Effect.Effect<A, E, R>) =>
57 Effect.gen(function* () {
58 const result = yield* effect;
59 const output =
60 (yield* TestConsole.logLines).findLast((line): line is string => typeof line === "string") ??
61 "";
62 return { result, output };
63 }).pipe(Effect.provide(Layer.mergeAll(CliRuntimeLayer, TestConsole.layer)));
64
65const makeCliTestServerConfig = (baseDir: string) =>
66 Effect.gen(function* () {
67 const derivedPaths = yield* ServerConfig.deriveServerPaths(baseDir, undefined);
68 return {
69 logLevel: "Info",
70 traceMinLevel: "Info",
71 traceTimingEnabled: true,
72 traceBatchWindowMs: 200,
73 traceMaxBytes: 10 * 1024 * 1024,
74 traceMaxFiles: 10,
75 otlpTracesUrl: undefined,
76 otlpMetricsUrl: undefined,
77 otlpExportIntervalMs: 10_000,
78 otlpServiceName: "t3-server",
79 mode: "web",
80 port: 0,
81 host: "127.0.0.1",
82 cwd: process.cwd(),
83 baseDir,
84 ...derivedPaths,
85 staticDir: undefined,
86 devUrl: undefined,
87 devAllowedOrigins: [],
88 noBrowser: true,
89 startupPresentation: "browser",
90 desktopBootstrapToken: undefined,
91 autoBootstrapProjectFromCwd: false,
92 logWebSocketEvents: false,
93 tailscaleServeEnabled: false,
94 tailscaleServePort: 443,
95 } satisfies ServerConfig.ServerConfig["Service"];
96 });
97
98const makeProjectPersistenceLayer = (config: ServerConfig.ServerConfig["Service"]) =>
99 Layer.mergeAll(
100 OrchestrationLayerLive.pipe(
101 Layer.provideMerge(RepositoryIdentityResolver.layer),
102 Layer.provideMerge(SqlitePersistenceLayerLive),
103 ),
104 WorkspacePaths.layer,
105 ).pipe(Layer.provideMerge(NodeServices.layer), Layer.provide(ServerConfig.layer(config)));
106
107const readPersistedSnapshot = (baseDir: string) =>
108 Effect.gen(function* () {
109 const config = yield* makeCliTestServerConfig(baseDir);
110 return yield* Effect.gen(function* () {
111 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
112 return yield* projectionSnapshotQuery.getSnapshot();
113 }).pipe(Effect.provide(makeProjectPersistenceLayer(config)));
114 });
115
116const withLiveProjectCliServer = <A, E, R>(baseDir: string, run: () => Effect.Effect<A, E, R>) =>
117 Effect.gen(function* () {
118 const config = yield* makeCliTestServerConfig(baseDir);
119 const routesLayer = HttpApiBuilder.layer(ProjectCliHttpApi).pipe(
120 Layer.provide(orchestrationHttpApiLayer),
121 Layer.provide(environmentAuthenticatedAuthLayer),
122 );
123 const appLayer = HttpRouter.serve(routesLayer, {
124 disableListenLog: true,
125 disableLogger: true,
126 }).pipe(
127 Layer.provideMerge(
128 EnvironmentAuth.layer.pipe(
129 Layer.provideMerge(SqlitePersistenceLayerLive),
130 Layer.provide(ServerSecretStore.layer),
131 ),
132 ),
133 Layer.provideMerge(makeProjectPersistenceLayer(config)),
134 Layer.provideMerge(
135 NodeHttpServer.layer(NodeHttp.createServer, {
136 host: "127.0.0.1",
137 port: 0,
138 }),
139 ),
140 Layer.provideMerge(NodeServices.layer),
141 Layer.provide(ServerConfig.layer(config)),
142 );
143
144 return yield* Effect.scoped(
145 Effect.gen(function* () {
146 const server = yield* HttpServer.HttpServer;
147 const address = server.address;
148 if (typeof address === "string" || !("port" in address)) {
149 assert.fail(`Expected TCP address, got ${address}`);
150 }
151 yield* persistServerRuntimeState({
152 path: config.serverRuntimeStatePath,
153 state: yield* makePersistedServerRuntimeState({
154 config,
155 port: address.port,
156 }),
157 });
158 return yield* run();
159 }).pipe(Effect.provide(Layer.mergeAll(appLayer, NodeServices.layer))),
160 );
161 });
162
163it.layer(NodeServices.layer)("bin cli parsing", (it) => {
164 it.effect("accepts the built-in lowercase log-level flag values", () =>
165 runCliWithRuntime(["--log-level", "debug", "--version"]),
166 );
167
168 it.effect("accepts canonical --no-<flag> boolean negation", () =>
169 runCliWithRuntime(["--no-log-websocket-events", "--version"]),
170 );
171
172 it.effect("rejects invalid log-level casing before launching the server", () =>
173 Effect.gen(function* () {
174 const error = yield* runCliWithRuntime(["--log-level", "Debug"]).pipe(Effect.flip);
175
176 if (!CliError.isCliError(error)) {
177 assert.fail(`Expected CliError, got ${String(error)}`);
178 }
179 if (error._tag !== "InvalidValue") {
180 assert.fail(`Expected InvalidValue, got ${error._tag}`);
181 }
182 assert.equal(error.option, "log-level");
183 assert.equal(error.value, "Debug");
184 }),
185 );
186
187 it.effect("rejects connect commands when public configuration is missing", () =>
188 Effect.gen(function* () {
189 const error = yield* runCli(["connect", "status"], noConnectCli).pipe(Effect.flip);
190
191 if (!CliError.isCliError(error)) {
192 assert.fail(`Expected CliError, got ${String(error)}`);
193 }
194 if (error._tag !== "ShowHelp") {
195 assert.fail(`Expected ShowHelp, got ${error._tag}`);
196 }
197 assert.deepEqual(error.commandPath, ["t3", "connect"]);
198 assert.include(error.errors[0]?.message ?? "", "missing T3 Connect public configuration");
199
200 const output = (yield* TestConsole.errorLines).join("\n");
201 assert.include(output, "ERROR");
202 assert.include(output, "missing T3 Connect public configuration");
203 }).pipe(Effect.provide(Layer.mergeAll(CliRuntimeLayer, TestConsole.layer))),
204 );
205
206 it.effect("exposes service lifecycle commands without T3 Connect configuration", () =>
207 Effect.gen(function* () {
208 const { output } = yield* captureStdout(runCli(["service", "--help"], noConnectCli));
209
210 assert.include(output, "Manage the T3 Code background service.");
211 assert.include(output, "install");
212 assert.include(output, "uninstall");
213 assert.include(output, "update");
214 assert.include(output, "status");
215 }),
216 );
217
218 it.effect("reports fresh headless connect state without requiring local configuration", () =>
219 Effect.gen(function* () {
220 const baseDir = NodeFS.mkdtempSync(
221 NodePath.join(NodeOS.tmpdir(), "t3-cli-cloud-status-test-"),
222 );
223 const { output } = yield* captureStdout(
224 runConnectCli(["connect", "status", "--base-dir", baseDir, "--json"]),
225 );
226 // @effect-diagnostics-next-line preferSchemaOverJson:off - CLI JSON output is decoded as a presentation DTO.
227 const status = JSON.parse(output) as {
228 readonly desired: boolean;
229 readonly authenticated: boolean;
230 readonly linked: boolean;
231 readonly cloudUserId: string | null;
232 readonly relayUrl: string | null;
233 };
234
235 assert.equal(status.desired, false);
236 assert.equal(status.authenticated, false);
237 assert.equal(status.linked, false);
238 assert.equal(status.cloudUserId, null);
239 assert.equal(status.relayUrl, null);
240 }),
241 );
242
243 it.effect("reports actionable human-readable headless connect state", () =>
244 Effect.gen(function* () {
245 const baseDir = NodeFS.mkdtempSync(
246 NodePath.join(NodeOS.tmpdir(), "t3-cli-cloud-status-human-test-"),
247 );
248 const { output } = yield* captureStdout(
249 runConnectCli(["connect", "status", "--base-dir", baseDir]),
250 );
251
252 assert.include(output, "T3 Connect\n Exposure: disabled");
253 assert.include(output, " Authorization: missing");
254 assert.include(output, " Environment link: not provisioned");
255 assert.include(output, "Next: Run `t3 connect link` to authorize and enable T3 Connect.");
256 }),
257 );
258
259 it.effect("accepts the --headless login override without enabling access", () =>
260 Effect.gen(function* () {
261 const baseDir = NodeFS.mkdtempSync(
262 NodePath.join(NodeOS.tmpdir(), "t3-cli-cloud-login-test-"),
263 );
264 const { secretsDir } = yield* ServerConfig.deriveServerPaths(baseDir, undefined);
265 NodeFS.mkdirSync(secretsDir, { recursive: true });
266 NodeFS.writeFileSync(
267 NodePath.join(secretsDir, "cloud-cli-oauth-token.bin"),
268 // @effect-diagnostics-next-line preferSchemaOverJson:off - Test fixture matches the persisted CLI token representation.
269 JSON.stringify({
270 accessToken: "access-token",
271 refreshToken: "refresh-token",
272 expiresAtEpochMs: Number.MAX_SAFE_INTEGER,
273 }),
274 );
275
276 const login = yield* captureStdout(
277 runConnectCli(["connect", "login", "--base-dir", baseDir, "--headless"]),
278 );
279 const status = yield* captureStdout(
280 runConnectCli(["connect", "status", "--base-dir", baseDir, "--json"]),
281 );
282 // @effect-diagnostics-next-line preferSchemaOverJson:off - CLI JSON output is decoded as a presentation DTO.
283 const decoded = JSON.parse(status.output) as {
284 readonly desired: boolean;
285 readonly authenticated: boolean;
286 };
287
288 assert.equal(login.output, "✓ Signed in");
289 assert.isFalse(decoded.desired);
290 assert.isTrue(decoded.authenticated);
291 }),
292 );
293
294 it.effect("disables headless connect without a running server", () =>
295 Effect.gen(function* () {
296 const baseDir = NodeFS.mkdtempSync(
297 NodePath.join(NodeOS.tmpdir(), "t3-cli-cloud-unlink-test-"),
298 );
299 const { output } = yield* captureStdout(
300 runConnectCli(["connect", "unlink", "--base-dir", baseDir]),
301 );
302
303 assert.equal(output, "T3 Connect is disabled locally.");
304 }),
305 );
306
307 it.effect("logs out of headless connect and removes the stored CLI authorization", () =>
308 Effect.gen(function* () {
309 const baseDir = NodeFS.mkdtempSync(
310 NodePath.join(NodeOS.tmpdir(), "t3-cli-cloud-logout-test-"),
311 );
312 const { secretsDir } = yield* ServerConfig.deriveServerPaths(baseDir, undefined);
313 const tokenPath = NodePath.join(secretsDir, "cloud-cli-oauth-token.bin");
314 NodeFS.mkdirSync(secretsDir, { recursive: true });
315 NodeFS.writeFileSync(tokenPath, "invalid persisted token");
316
317 const { output } = yield* captureStdout(
318 runConnectCli(["connect", "logout", "--base-dir", baseDir]),
319 );
320
321 assert.equal(
322 output,
323 "Signed out of T3 Connect locally.\nThe background service is managed separately with `t3 service`.",
324 );
325 assert.isFalse(NodeFS.existsSync(tokenPath));
326 }),
327 );
328
329 it.effect("executes auth pairing subcommands and redacts secrets from list output", () =>
330 Effect.gen(function* () {
331 const baseDir = NodeFS.mkdtempSync(
332 NodePath.join(NodeOS.tmpdir(), "t3-cli-auth-pairing-test-"),
333 );
334
335 const createdOutput = yield* captureStdout(
336 runCli(["auth", "pairing", "create", "--base-dir", baseDir, "--json"]),
337 );
338 // @effect-diagnostics-next-line preferSchemaOverJson:off
339 const created = JSON.parse(createdOutput.output) as {
340 readonly id: string;
341 readonly credential: string;
342 };
343 const listedOutput = yield* captureStdout(
344 runCli(["auth", "pairing", "list", "--base-dir", baseDir, "--json"]),
345 );
346 // @effect-diagnostics-next-line preferSchemaOverJson:off
347 const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
348 readonly id: string;
349 readonly credential?: string;
350 }>;
351
352 assert.equal(typeof created.id, "string");
353 assert.equal(typeof created.credential, "string");
354 assert.equal(created.credential.length > 0, true);
355 assert.equal(listed.length, 1);
356 assert.equal(listed[0]?.id, created.id);
357 assert.equal("credential" in (listed[0] ?? {}), false);
358 }),
359 );
360
361 it.effect("executes auth session subcommands and redacts secrets from list output", () =>
362 Effect.gen(function* () {
363 const baseDir = NodeFS.mkdtempSync(
364 NodePath.join(NodeOS.tmpdir(), "t3-cli-auth-session-test-"),
365 );
366
367 const issuedOutput = yield* captureStdout(
368 runCli(["auth", "session", "issue", "--base-dir", baseDir, "--json"]),
369 );
370 // @effect-diagnostics-next-line preferSchemaOverJson:off
371 const issued = JSON.parse(issuedOutput.output) as {
372 readonly sessionId: string;
373 readonly token: string;
374 readonly scopes: ReadonlyArray<string>;
375 };
376 const listedOutput = yield* captureStdout(
377 runCli(["auth", "session", "list", "--base-dir", baseDir, "--json"]),
378 );
379 // @effect-diagnostics-next-line preferSchemaOverJson:off
380 const listed = JSON.parse(listedOutput.output) as ReadonlyArray<{
381 readonly sessionId: string;
382 readonly token?: string;
383 readonly scopes: ReadonlyArray<string>;
384 }>;
385
386 assert.equal(typeof issued.sessionId, "string");
387 assert.equal(typeof issued.token, "string");
388 assert.deepEqual(issued.scopes, [
389 "orchestration:read",
390 "orchestration:operate",
391 "terminal:operate",
392 "review:write",
393 "relay:read",
394 "access:read",
395 "access:write",
396 "relay:write",
397 ]);
398 assert.equal(listed.length, 1);
399 assert.equal(listed[0]?.sessionId, issued.sessionId);
400 assert.deepEqual(listed[0]?.scopes, [
401 "orchestration:read",
402 "orchestration:operate",
403 "terminal:operate",
404 "review:write",
405 "relay:read",
406 "access:read",
407 "access:write",
408 "relay:write",
409 ]);
410 assert.equal("token" in (listed[0] ?? {}), false);
411 }),
412 );
413
414 it.effect("rejects invalid ttl values before running auth commands", () =>
415 Effect.gen(function* () {
416 const error = yield* runCliWithRuntime(["auth", "pairing", "create", "--ttl", "soon"]).pipe(
417 Effect.flip,
418 );
419
420 if (!CliError.isCliError(error)) {
421 assert.fail(`Expected CliError, got ${String(error)}`);
422 }
423 if (error._tag !== "ShowHelp") {
424 assert.fail(`Expected ShowHelp, got ${error._tag}`);
425 }
426 assert.deepEqual(error.commandPath, ["t3", "auth", "pairing", "create"]);
427 const ttlError = error.errors[0] as CliError.CliError | undefined;
428 if (!ttlError || ttlError._tag !== "InvalidValue") {
429 assert.fail(`Expected InvalidValue, got ${String(ttlError?._tag)}`);
430 }
431 assert.equal(ttlError.option, "ttl");
432 assert.equal(ttlError.value, "soon");
433 assert.isTrue(ttlError.message.includes("Invalid duration"));
434 assert.isTrue(ttlError.message.includes("5m, 1h, 30d, or 15 minutes"));
435 }),
436 );
437
438 it.effect("adds, renames, and removes projects offline through the orchestration engine", () =>
439 Effect.gen(function* () {
440 const baseDir = NodeFS.mkdtempSync(
441 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-offline-test-"),
442 );
443 const workspaceRoot = NodeFS.mkdtempSync(
444 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-workspace-"),
445 );
446
447 yield* runCliWithRuntime([
448 "project",
449 "add",
450 workspaceRoot,
451 "--title",
452 "Alpha",
453 "--base-dir",
454 baseDir,
455 ]);
456 const afterAdd = yield* readPersistedSnapshot(baseDir);
457 const addedProject = afterAdd.projects.find(
458 (project) => project.workspaceRoot === workspaceRoot && project.deletedAt === null,
459 );
460 assert.isTrue(addedProject !== undefined);
461 assert.equal(addedProject?.title, "Alpha");
462
463 yield* runCliWithRuntime(["project", "rename", workspaceRoot, "Beta", "--base-dir", baseDir]);
464 const afterRename = yield* readPersistedSnapshot(baseDir);
465 const renamedProject = afterRename.projects.find(
466 (project) => project.id === addedProject?.id,
467 );
468 assert.equal(renamedProject?.title, "Beta");
469 assert.equal(renamedProject?.deletedAt, null);
470
471 yield* runCliWithRuntime([
472 "project",
473 "remove",
474 addedProject?.id ?? "",
475 "--base-dir",
476 baseDir,
477 ]);
478 const afterRemove = yield* readPersistedSnapshot(baseDir);
479 const removedProject = afterRemove.projects.find(
480 (project) => project.id === addedProject?.id,
481 );
482 assert.isTrue((removedProject?.deletedAt ?? null) !== null);
483 }),
484 );
485
486 it.effect("force removes projects that still contain threads", () =>
487 Effect.gen(function* () {
488 const baseDir = NodeFS.mkdtempSync(
489 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-force-remove-test-"),
490 );
491 const workspaceRoot = NodeFS.mkdtempSync(
492 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-force-remove-workspace-"),
493 );
494
495 yield* runCliWithRuntime(["project", "add", workspaceRoot, "--base-dir", baseDir]);
496 const afterAdd = yield* readPersistedSnapshot(baseDir);
497 const project = afterAdd.projects.find(
498 (candidate) => candidate.workspaceRoot === workspaceRoot && candidate.deletedAt === null,
499 );
500 assert.isTrue(project !== undefined);
501
502 const config = yield* makeCliTestServerConfig(baseDir);
503 yield* Effect.gen(function* () {
504 const engine = yield* OrchestrationEngine.OrchestrationEngineService;
505 yield* engine.dispatch({
506 type: "thread.create",
507 commandId: CommandId.make("cmd-cli-force-remove-thread"),
508 threadId: ThreadId.make("thread-cli-force-remove"),
509 projectId: project!.id,
510 title: "Thread",
511 modelSelection: {
512 instanceId: ProviderInstanceId.make("codex"),
513 model: "gpt-5-codex",
514 },
515 interactionMode: "default",
516 runtimeMode: "approval-required",
517 branch: null,
518 worktreePath: null,
519 createdAt: DateTime.formatIso(yield* DateTime.now),
520 });
521 }).pipe(Effect.provide(makeProjectPersistenceLayer(config)));
522
523 yield* runCliWithRuntime([
524 "project",
525 "remove",
526 project!.id,
527 "--force",
528 "--base-dir",
529 baseDir,
530 ]);
531 const afterRemove = yield* readPersistedSnapshot(baseDir);
532 assert.isTrue(
533 (afterRemove.projects.find((candidate) => candidate.id === project!.id)?.deletedAt ??
534 null) !== null,
535 );
536 assert.isTrue(
537 (afterRemove.threads.find((thread) => thread.id === "thread-cli-force-remove")?.deletedAt ??
538 null) !== null,
539 );
540 }),
541 );
542
543 it.effect("routes project commands through a running server when runtime state is present", () =>
544 Effect.gen(function* () {
545 const baseDir = NodeFS.mkdtempSync(
546 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-live-test-"),
547 );
548 const workspaceRoot = NodeFS.mkdtempSync(
549 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-live-workspace-"),
550 );
551
552 yield* withLiveProjectCliServer(baseDir, () =>
553 Effect.gen(function* () {
554 yield* runCliWithRuntime([
555 "project",
556 "add",
557 workspaceRoot,
558 "--title",
559 "Live Project",
560 "--base-dir",
561 baseDir,
562 ]);
563 const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
564 const readModel = yield* projectionSnapshotQuery.getSnapshot();
565 const addedProject = readModel.projects.find(
566 (project) => project.workspaceRoot === workspaceRoot && project.deletedAt === null,
567 );
568 assert.isTrue(addedProject !== undefined);
569 assert.equal(addedProject?.title, "Live Project");
570 }),
571 );
572 }),
573 );
574
575 it.effect("rejects dev-url on project commands", () =>
576 Effect.gen(function* () {
577 const workspaceRoot = NodeFS.mkdtempSync(
578 NodePath.join(NodeOS.tmpdir(), "t3-cli-projects-unknown-option-workspace-"),
579 );
580 const error = yield* runCliWithRuntime([
581 "project",
582 "add",
583 workspaceRoot,
584 "--dev-url",
585 "http://127.0.0.1:5173",
586 ]).pipe(Effect.flip);
587
588 if (!CliError.isCliError(error)) {
589 assert.fail(`Expected CliError, got ${String(error)}`);
590 }
591 if (error._tag !== "ShowHelp") {
592 assert.fail(`Expected ShowHelp, got ${error._tag}`);
593 }
594 assert.deepEqual(error.commandPath, ["t3", "project", "add"]);
595 const optionError = error.errors[0] as CliError.CliError | undefined;
596 if (!optionError || optionError._tag !== "UnrecognizedOption") {
597 assert.fail(`Expected UnrecognizedOption, got ${String(optionError?._tag)}`);
598 }
599 assert.equal(optionError.option, "--dev-url");
600 }),
601 );
602});