Merge remote-tracking branch 'upstream/main' into josh/desktop-wsl-parallel-backends

This commit is contained in:
Josh Gratton committed 2026-06-05 13:43:46 -04:00
commit adaa1839ed
91 files changed
+738 -528

No files matched your search

+25 -1
View File
@@ -8,6 +8,7 @@ on:
permissions:
contents: read
id-token: none
statuses: write
concurrency:
group: relay-production
@@ -46,7 +47,8 @@ jobs:
run-install: true
- name: Deploy production relay stage
run: vp run --filter t3code-relay deploy --stage prod --yes
id: deploy
run: vp run --filter t3code-relay deploy --stage prod --yes --github-output
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
PLANETSCALE_API_TOKEN_ID: ${{ secrets.PLANETSCALE_API_TOKEN_ID }}
@@ -54,3 +56,25 @@ jobs:
AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
APNS_PRIVATE_KEY: ${{ secrets.APNS_PRIVATE_KEY }}
- name: Publish relay deploy commit status
uses: actions/github-script@v8
with:
script: |
const result = "${{ steps.deploy.outputs.result }}";
const changed = "${{ steps.deploy.outputs.changed }}" === "true";
const description = changed
? "Relay production deploy applied infrastructure changes."
: result === "noop"
? "Relay production deploy was a no-op."
: `Relay production deploy completed with result: ${result}.`;
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.sha,
state: "success",
context: "Relay deploy / production",
description,
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
});
-2
View File
@@ -1,2 +0,0 @@
[tools]
node = "24.13.1"
-1
View File
@@ -1 +0,0 @@
vp staged
+26 -15
View File
@@ -1,23 +1,26 @@
# T3 Code
T3 Code is a minimal web GUI for coding agents (currently Codex, Claude, and OpenCode, more coming soon).
T3 Code is a minimal web GUI for coding agents (currently Codex, Claude, Cursor, and OpenCode, more coming soon).
## Installation
> [!WARNING]
> T3 Code currently supports Codex, Claude, and OpenCode.
> T3 Code currently supports Codex, Claude, Cursor, and OpenCode.
> Install and authenticate at least one provider before use:
>
> - Codex: install [Codex CLI](https://developers.openai.com/codex/cli) and run `codex login`
> - Claude: install [Claude Code](https://claude.com/product/claude-code) and run `claude auth login`
> - Cursor: install [Cursor CLI](https://cursor.com/cli) and run `cursor-agent login`
> - OpenCode: install [OpenCode](https://opencode.ai) and run `opencode auth login`
### Run without installing
```bash
npx t3
npx t3@latest
```
Tip: Use `npx t3@latest --help` for the full CLI reference.
### Desktop app
Install the latest version of the desktop app from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), or from your favorite package registry:
@@ -46,11 +49,7 @@ We are very very early in this project. Expect bugs.
We are not accepting contributions yet.
Observability guide: [docs/operations/observability.md](./docs/operations/observability.md)
Relay observability: [docs/operations/relay-observability.md](./docs/operations/relay-observability.md)
T3 Cloud Clerk setup: [docs/cloud/t3-cloud-clerk.md](./docs/cloud/t3-cloud-clerk.md)
There's no public docs site yet, checkout the miscellaneous markdown files in [docs](./docs).
## Documentation
@@ -62,17 +61,29 @@ T3 Cloud Clerk setup: [docs/cloud/t3-cloud-clerk.md](./docs/cloud/t3-cloud-clerk
## If you REALLY want to contribute still.... read this first
Before local development, prepare the environment and install dependencies:
### Install `vp`
T3 Code uses Vite+ so you'll need to install the global `vp` command-line tool.
#### macOS / Linux
```bash
# Optional: only needed if you use mise for dev tool management.
mise install
vp install
curl -fsSL https://vite.plus | bash
```
T3 Cloud is optional and disabled in a fresh clone. To enable it for web, desktop, and mobile source
builds, copy [`.env.example`](./.env.example) to `.env` at the repository root and set the canonical
public configuration there.
#### Windows
```bash
irm https://vite.plus/ps1 | iex
```
Checkout their getting started guide for more information: https://viteplus.dev/guide/
### Install dependencies
```bash
vp i
```
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening an issue or PR.
+1 -2
View File
@@ -27,8 +27,7 @@
"@types/node": "catalog:",
"cross-env": "^10.1.0",
"electron-builder": "26.8.1",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
},
"productName": "T3 Code (Alpha)"
}
+1 -1
View File
@@ -52,7 +52,7 @@ const make = Effect.gen(function* () {
Effect.map((parsed) =>
Option.fromNullishOr(parsed.t3codeCommitHash).pipe(Option.flatMap(normalizeCommitHash)),
),
Effect.catch(() => Effect.succeed(Option.none<string>())),
Effect.orElseSucceed(() => Option.none<string>()),
),
});
});
@@ -116,11 +116,11 @@ export const resolveTailscaleAdvertisedEndpoints = Effect.fn("resolveTailscaleAd
input.statusJson === undefined
? yield* readTailscaleStatus.pipe(
Effect.map((status) => status.magicDnsName),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: input.statusJson
? yield* parseTailscaleMagicDnsName(input.statusJson).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: null;
const magicDnsEndpoint = yield* resolveTailscaleMagicDnsAdvertisedEndpoint({
@@ -2,7 +2,7 @@ import { assert, describe, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
import { afterEach } from "vitest";
import { afterEach } from "vite-plus/test";
import { fetchCloudAuth, validateClerkFrontendApiUrl } from "./cloudAuth.ts";
@@ -295,7 +295,7 @@ function readSettings(
onSome: (raw) =>
decodeDesktopSettingsJson(raw).pipe(
Effect.map((parsed) => normalizeDesktopSettingsDocument(parsed, appVersion)),
Effect.catch(() => Effect.succeed(defaultSettings)),
Effect.orElseSucceed(() => defaultSettings),
),
}),
),
@@ -63,7 +63,7 @@ const readClientSettings = (
onSome: (raw) =>
decodeClientSettingsJson(raw).pipe(
Effect.map((settings) => Option.some(settings)),
Effect.catch(() => Effect.succeed(Option.none<ClientSettings>())),
Effect.orElseSucceed(() => Option.none<ClientSettings>()),
),
}),
),
@@ -185,7 +185,7 @@ function readRegistryDocument(
onSome: (raw) =>
decodeSavedEnvironmentRegistryDocumentJson(raw).pipe(
Effect.map(normalizeSavedEnvironmentRegistryDocument),
Effect.catch(() => Effect.succeed({ version: 1, records: [] })),
Effect.orElseSucceed(() => ({ version: 1, records: [] })),
),
}),
),
@@ -196,7 +196,7 @@ const runCommandOutput = Effect.fn("desktop.shellEnvironment.runCommandOutput")(
.pipe(
Effect.timeoutOption(input.timeout),
Effect.map(Option.getOrElse(() => "")),
Effect.catch(() => Effect.succeed("")),
Effect.orElseSucceed(() => ""),
);
});
+1 -1
View File
@@ -120,7 +120,7 @@ function parseAppUpdateYml(raw: string): Effect.Effect<Option.Option<AppUpdateYm
return decodeAppUpdateYmlConfig(entries).pipe(
Effect.map((config) => (config.provider ? Option.some(config) : Option.none())),
Effect.catch(() => Effect.succeed(Option.none<AppUpdateYmlConfig>())),
Effect.orElseSucceed(() => Option.none<AppUpdateYmlConfig>()),
);
}
@@ -1,4 +1,4 @@
import { beforeEach, vi } from "vitest";
import { beforeEach, vi } from "vite-plus/test";
import { describe, expect, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import type { EnvironmentId } from "@t3tools/contracts";
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import {
extractAgentNotificationDeepLink,
@@ -2,7 +2,7 @@
import * as NodeCrypto from "node:crypto";
import { beforeEach, vi } from "vitest";
import { beforeEach, vi } from "vite-plus/test";
import { describe, expect, it } from "@effect/vitest";
import Constants from "expo-constants";
import * as Effect from "effect/Effect";
+1 -1
View File
@@ -2,7 +2,7 @@
import * as NodeCrypto from "node:crypto";
import { vi } from "vitest";
import { vi } from "vite-plus/test";
import { describe, expect, it } from "@effect/vitest";
import * as Crypto from "effect/Crypto";
import * as Effect from "effect/Effect";
@@ -1,4 +1,4 @@
import { beforeEach, vi } from "vitest";
import { beforeEach, vi } from "vite-plus/test";
import { describe, expect, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vite-plus/test";
import { resolveCloudPublicConfig } from "./publicConfig";
+1 -1
View File
@@ -1,5 +1,5 @@
import { EnvironmentId } from "@t3tools/contracts";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
const mocks = vi.hoisted(() => {
const values = new Map<string, string>();
@@ -6,7 +6,7 @@ import {
setManagedRelaySession,
} from "@t3tools/client-runtime";
import * as Effect from "effect/Effect";
import { beforeEach, vi } from "vitest";
import { beforeEach, vi } from "vite-plus/test";
const mocks = vi.hoisted(() => {
const environmentConnection = {
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vite-plus/test";
vi.mock("@expo/ui/swift-ui", () => ({
HStack: "HStack",
+2 -3
View File
@@ -38,12 +38,11 @@
"@t3tools/shared": "workspace:*",
"@t3tools/tailscale": "workspace:*",
"@t3tools/web": "workspace:*",
"@types/bun": "catalog:",
"@types/bun": "1.3.14",
"@types/node": "catalog:",
"effect-acp": "workspace:*",
"effect-codex-app-server": "workspace:*",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
},
"engines": {
"node": "^22.16 || ^23.11 || >=24.10"
+31 -7
View File
@@ -195,6 +195,31 @@ const buildCmd = Command.make(
// publish subcommand
// ---------------------------------------------------------------------------
interface PublishCommandConfig {
readonly access: string;
readonly tag: string;
readonly provenance: boolean;
readonly dryRun: boolean;
}
const createVpPmPublishArgs = (config: PublishCommandConfig): ReadonlyArray<string> => {
const args = [
"publish",
"--filter",
"t3",
"--access",
config.access,
"--tag",
config.tag,
"--no-git-checks",
];
if (config.provenance) args.push("--provenance");
if (config.dryRun) args.push("--dry-run");
return args;
};
const publishCmd = Command.make(
"publish",
{
@@ -260,17 +285,16 @@ const publishCmd = Command.make(
const iconBackups = yield* applyPublishIconOverrides(repoRoot, serverDir);
return { iconBackups };
}),
// Use: npm publish
// Use: pnpm publish from the workspace root so pnpm-only workspace
// config, including override selectors, is interpreted correctly.
() =>
Effect.gen(function* () {
const args = ["publish", "--access", config.access, "--tag", config.tag];
if (config.provenance) args.push("--provenance");
if (config.dryRun) args.push("--dry-run");
const args = createVpPmPublishArgs(config);
yield* Effect.log(`[cli] Running: npm ${args.join(" ")}`);
yield* Effect.log(`[cli] Running: vp pm ${args.join(" ")}`);
yield* runCommand(
ChildProcess.make("npm", [...args], {
cwd: serverDir,
ChildProcess.make("vp", ["pm", ...args], {
cwd: repoRoot,
stdout: config.verbose ? "inherit" : "ignore",
stderr: "inherit",
// Windows needs shell mode to resolve .cmd shims.
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import * as PlatformError from "effect/PlatformError";
import * as ServerSecretStore from "./ServerSecretStore.ts";
@@ -35,7 +35,7 @@ const makeCheckpointStore = Effect.gen(function* () {
const isGitRepository: CheckpointStoreShape["isGitRepository"] = (cwd) =>
vcsRegistry.resolve({ cwd, requestedKind: "git" }).pipe(
Effect.map(() => true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
const captureCheckpoint: CheckpointStoreShape["captureCheckpoint"] = Effect.fn(
@@ -1,5 +1,5 @@
import { describe, expect, it } from "@effect/vitest";
import { vi } from "vitest";
import { vi } from "vite-plus/test";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
@@ -152,9 +152,7 @@ export const makeCloudManagedEndpointRuntime = Effect.gen(function* () {
const nextConfigKey = runtimeConfigKey(config);
const active = yield* Ref.get(activeRef);
if (active?.configKey === nextConfigKey) {
const isRunning = yield* active.child.isRunning.pipe(
Effect.catch(() => Effect.succeed(false)),
);
const isRunning = yield* active.child.isRunning.pipe(Effect.orElseSucceed(() => false));
if (isRunning) {
return {
status: "running",
+7 -7
View File
@@ -702,7 +702,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
const tempDir = process.env.TMPDIR ?? process.env.TEMP ?? process.env.TMP ?? "/tmp";
const canonicalizeExistingPath = (value: string) =>
fileSystem.realPath(value).pipe(Effect.catch(() => Effect.succeed(value)));
fileSystem.realPath(value).pipe(Effect.orElseSucceed(() => value));
const normalizeStatusCacheKey = canonicalizeExistingPath;
const nonRepositoryStatusDetails = {
isRepo: false,
@@ -766,7 +766,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
if (details.isDefaultBranch && latest.state !== "open") return null;
return toStatusPr(latest);
}),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: null;
@@ -788,7 +788,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
);
const readConfigValueNullable = (cwd: string, key: string) =>
gitCore.readConfigValue(cwd, key).pipe(Effect.catch(() => Effect.succeed(null)));
gitCore.readConfigValue(cwd, key).pipe(Effect.orElseSucceed(() => null));
const resolveHostingProvider = Effect.fn("resolveHostingProvider")(function* (
cwd: string,
@@ -972,7 +972,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
) {
const terms = yield* sourceControlProvider(cwd).pipe(
Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
Effect.catch(() => Effect.succeed(getChangeRequestTerminologyForKind("unknown"))),
Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
);
const summary = summarizeGitActionResult(result, terms);
let latestOpenPr: PullRequestInfo | null = null;
@@ -1016,7 +1016,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
upstreamRef: finalBranchContext.upstreamRef,
}).pipe(
Effect.flatMap((headContext) => findOpenPr(cwd, headContext)),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
}
@@ -1080,7 +1080,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
const defaultFromProvider = yield* sourceControlProvider(cwd).pipe(
Effect.flatMap((provider) => provider.getDefaultBranch({ cwd })),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
if (defaultFromProvider) {
return defaultFromProvider;
@@ -1686,7 +1686,7 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
const changeRequestTerms = wantsPr
? yield* sourceControlProvider(input.cwd).pipe(
Effect.map((provider) => getChangeRequestTerminologyForKind(provider.kind)),
Effect.catch(() => Effect.succeed(getChangeRequestTerminologyForKind("unknown"))),
Effect.orElseSucceed(() => getChangeRequestTerminologyForKind("unknown")),
)
: null;
+8 -18
View File
@@ -156,8 +156,8 @@ export const otlpTracesProxyRouteLayer = HttpRouter.add(
otlpTracesUrl,
}),
),
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Trace export failed.", { status: 502 })),
Effect.orElseSucceed(() =>
HttpServerResponse.text("Trace export failed.", { status: 502 }),
),
);
}).pipe(
@@ -205,9 +205,7 @@ export const attachmentsRouteLayer = HttpRouter.add(
}
const fileSystem = yield* FileSystem.FileSystem;
const fileInfo = yield* fileSystem
.stat(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(filePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
return HttpServerResponse.text("Not Found", { status: 404 });
}
@@ -218,9 +216,7 @@ export const attachmentsRouteLayer = HttpRouter.add(
"Cache-Control": "public, max-age=31536000, immutable",
},
}).pipe(
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 })),
),
Effect.orElseSucceed(() => HttpServerResponse.text("Internal Server Error", { status: 500 })),
);
}).pipe(
Effect.catchTags({
@@ -265,9 +261,7 @@ export const projectFaviconRouteLayer = HttpRouter.add(
"Cache-Control": PROJECT_FAVICON_CACHE_CONTROL,
},
}).pipe(
Effect.catch(() =>
Effect.succeed(HttpServerResponse.text("Internal Server Error", { status: 500 })),
),
Effect.orElseSucceed(() => HttpServerResponse.text("Internal Server Error", { status: 500 })),
);
}).pipe(
Effect.catchTags({
@@ -337,14 +331,12 @@ export const staticAndDevRouteLayer = HttpRouter.add(
}
}
const fileInfo = yield* fileSystem
.stat(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(filePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
const indexPath = path.resolve(staticRoot, "index.html");
const indexData = yield* fileSystem
.readFile(indexPath)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!indexData) {
return HttpServerResponse.text("Not Found", { status: 404 });
}
@@ -355,9 +347,7 @@ export const staticAndDevRouteLayer = HttpRouter.add(
}
const contentType = Mime.getType(filePath) ?? "application/octet-stream";
const data = yield* fileSystem
.readFile(filePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const data = yield* fileSystem.readFile(filePath).pipe(Effect.orElseSucceed(() => null));
if (!data) {
return HttpServerResponse.text("Internal Server Error", { status: 500 });
}
@@ -335,7 +335,7 @@ const runAttachmentSideEffects = Effect.fn("runAttachmentSideEffects")(function*
const attachmentsRootDir = serverConfig.attachmentsDir;
const readAttachmentRootEntries = fileSystem
.readDirectory(attachmentsRootDir, { recursive: false })
.pipe(Effect.catch(() => Effect.succeed([] as Array<string>)));
.pipe(Effect.orElseSucceed(() => [] as Array<string>));
const removeDeletedThreadAttachmentEntry = Effect.fn("removeDeletedThreadAttachmentEntry")(
function* (threadSegment: string, entry: string) {
@@ -397,9 +397,7 @@ const runAttachmentSideEffects = Effect.fn("runAttachmentSideEffects")(function*
}
const absolutePath = path.join(attachmentsRootDir, relativePath);
const fileInfo = yield* fileSystem
.stat(absolutePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(absolutePath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
return;
}
@@ -80,9 +80,7 @@ export const makeProjectFaviconResolver = Effect.gen(function* () {
if (!isPathWithinProject(projectCwd, candidate)) {
continue;
}
const stats = yield* fileSystem
.stat(candidate)
.pipe(Effect.catch(() => Effect.succeed(null)));
const stats = yield* fileSystem.stat(candidate).pipe(Effect.orElseSucceed(() => null));
if (stats?.type === "File") {
return candidate;
}
@@ -105,7 +103,7 @@ export const makeProjectFaviconResolver = Effect.gen(function* () {
const sourcePath = path.join(cwd, sourceFile);
const source = yield* fileSystem
.readFileString(sourcePath)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!source) {
continue;
}
@@ -347,7 +347,7 @@ export const resolveProviderMaintenanceCapabilitiesEffect = Effect.fn(
const fileSystem = yield* FileSystem.FileSystem;
const realCommandPath = yield* fileSystem
.realPath(resolvedCommandPath)
.pipe(Effect.catch(() => Effect.succeed(resolvedCommandPath)));
.pipe(Effect.orElseSucceed(() => resolvedCommandPath));
return resolver.resolve({
...options,
realCommandPath,
@@ -406,7 +406,7 @@ const fetchNpmLatestVersion = Effect.fn("fetchNpmLatestVersion")(function* (pack
).pipe(HttpClientRequest.setHeader("accept", "application/json"));
const response = yield* client.execute(request).pipe(
Effect.timeoutOption(LATEST_VERSION_TIMEOUT_MS),
Effect.catch(() => Effect.succeed(Option.none())),
Effect.orElseSucceed(() => Option.none()),
);
if (Option.isNone(response)) {
return null;
@@ -417,7 +417,7 @@ const fetchNpmLatestVersion = Effect.fn("fetchNpmLatestVersion")(function* (pack
}
const payload = yield* httpResponse.json.pipe(
Effect.flatMap(Schema.decodeUnknownEffect(NpmLatestVersionResponse)),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
return payload ? nonEmptyString(payload.version) : null;
});
+1 -3
View File
@@ -35,9 +35,7 @@ export const make = Effect.fn("makeReviewService")(function* () {
const git = yield* GitVcsDriver.GitVcsDriver;
const canonicalizePath = (value: string) =>
fileSystem
.realPath(path.resolve(value))
.pipe(Effect.catch(() => Effect.succeed(path.resolve(value))));
fileSystem.realPath(path.resolve(value)).pipe(Effect.orElseSucceed(() => path.resolve(value)));
const isWithinRoot = (candidate: string, root: string) => {
const relative = path.relative(root, candidate);
@@ -359,7 +359,7 @@ function responseError(
response: HttpClientResponse.HttpClientResponse,
): Effect.Effect<never, BitbucketApiError> {
return response.text.pipe(
Effect.catch(() => Effect.succeed("")),
Effect.orElseSucceed(() => ""),
Effect.flatMap((body) =>
Effect.fail(
new BitbucketApiError({
@@ -524,7 +524,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
);
const readConfigValueNullable = (cwd: string, key: string) =>
git.readConfigValue(cwd, key).pipe(Effect.catch(() => Effect.succeed(null)));
git.readConfigValue(cwd, key).pipe(Effect.orElseSucceed(() => null));
const resolveCheckoutRemote = Effect.fn("BitbucketApi.resolveCheckoutRemote")(function* (input: {
readonly cwd: string;
@@ -544,7 +544,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
if (!input.isCrossRepository) {
const remoteName = yield* git
.resolvePrimaryRemoteName(input.cwd)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (remoteName) return remoteName;
}
@@ -575,7 +575,7 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
host: Option.some("bitbucket.org"),
detail: Option.none<string>(),
})),
Effect.catch(() => Effect.succeed(authFromConfig(config))),
Effect.orElseSucceed(() => authFromConfig(config)),
),
listPullRequests: (input) =>
resolveRepository(input).pipe(
@@ -685,8 +685,8 @@ export const make = Effect.fn("makeBitbucketApi")(function* () {
{
repository: getRepositoryFromLocator(locator),
branchingModel: getBranchingModelFromLocator(locator).pipe(
Effect.catch(() =>
Effect.succeed<typeof RawBitbucketBranchingModelSchema.Type | null>(null),
Effect.orElseSucceed(
(): typeof RawBitbucketBranchingModelSchema.Type | null => null,
),
),
},
@@ -299,7 +299,7 @@ export const refineUnknownRemoteProvider = Effect.fn("refineUnknownRemoteProvide
auth,
}),
),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
),
);
const provider = providers.find((candidate) => candidate !== null);
@@ -277,12 +277,10 @@ export const make = Effect.fn("makeSourceControlRepositoryService")(function* ()
})
.pipe(
Effect.map(() => true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
if (!hasCommits) {
const details = yield* git
.statusDetails(input.cwd)
.pipe(Effect.catch(() => Effect.succeed(null)));
const details = yield* git.statusDetails(input.cwd).pipe(Effect.orElseSucceed(() => null));
return {
repository: toRepositoryInfo(providerKind, urls),
remoteName,
@@ -62,7 +62,7 @@ it.layer(NodeServices.layer)("AnalyticsService test", (it) => {
const payload = yield* request.json.pipe(
Effect.map((body) => body as RecordedBatchRequest["body"]),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
capturedRequests.push({ path: request.url, body: payload });
@@ -1,3 +1,5 @@
/// <reference types="bun" />
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import { PtyAdapter } from "../Services/PTY.ts";
+1 -1
View File
@@ -1289,7 +1289,7 @@ export const makeTerminalManagerWithOptions = Effect.fn("makeTerminalManagerWith
const threadPrefix = `${toSafeThreadId(threadId)}_`;
const entries = yield* fileSystem
.readDirectory(logsDir, { recursive: false })
.pipe(Effect.catch(() => Effect.succeed([] as Array<string>)));
.pipe(Effect.orElseSucceed(() => [] as Array<string>));
yield* Effect.forEach(
entries.filter(
(name) =>
@@ -140,9 +140,7 @@ export const makeCodexTextGeneration = Effect.fn("makeCodexTextGeneration")(func
if (!resolvedPath || !path.isAbsolute(resolvedPath)) {
continue;
}
const fileInfo = yield* fileSystem
.stat(resolvedPath)
.pipe(Effect.catch(() => Effect.succeed(null)));
const fileInfo = yield* fileSystem.stat(resolvedPath).pipe(Effect.orElseSucceed(() => null));
if (!fileInfo || fileInfo.type !== "File") {
continue;
}
+1 -1
View File
@@ -403,7 +403,7 @@ export const makeVcsDriverShape = Effect.fn("makeGitVcsDriverShape")(function* (
"GitVcsDriver.detectRepository.commonDir",
cwd,
["rev-parse", "--git-common-dir"],
).pipe(Effect.catch(() => Effect.succeed(null)));
).pipe(Effect.orElseSucceed(() => null));
return {
kind: "git" as const,
+29 -37
View File
@@ -885,7 +885,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
const remoteNames = yield* runGitStdout("GitVcsDriver.listRemoteNames", cwd, ["remote"]).pipe(
Effect.map(parseRemoteNames),
Effect.catch(() => Effect.succeed<ReadonlyArray<string>>([])),
Effect.orElseSucceed((): ReadonlyArray<string> => []),
);
return (
parseUpstreamRefWithRemoteNames(upstreamRef, remoteNames) ??
@@ -996,7 +996,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
cwd: string,
branchName: string,
) {
const remoteNames = yield* listRemoteNames(cwd).pipe(Effect.catch(() => Effect.succeed([])));
const remoteNames = yield* listRemoteNames(cwd).pipe(Effect.orElseSucceed(() => []));
const parsedRemoteRef = parseRemoteRefWithRemoteNames(branchName, remoteNames);
return parsedRemoteRef?.branchName ?? branchName;
});
@@ -1042,7 +1042,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
return pushDefaultRemote;
}
return yield* resolvePrimaryRemoteName(cwd).pipe(Effect.catch(() => Effect.succeed(null)));
return yield* resolvePrimaryRemoteName(cwd).pipe(Effect.orElseSucceed(() => null));
});
const ensureRemote: GitVcsDriver.GitVcsDriverShape["ensureRemote"] = Effect.fn("ensureRemote")(
@@ -1090,7 +1090,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
).pipe(Effect.map((stdout) => stdout.trim()));
const primaryRemoteName = yield* resolvePrimaryRemoteName(cwd).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
const defaultBranch =
primaryRemoteName === null ? null : yield* resolveDefaultBranchName(cwd, primaryRemoteName);
@@ -1231,7 +1231,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
allowNonZeroExit: true,
},
),
originRemoteExists(cwd).pipe(Effect.catch(() => Effect.succeed(false))),
originRemoteExists(cwd).pipe(Effect.orElseSucceed(() => false)),
],
{ concurrency: "unbounded" },
);
@@ -1276,9 +1276,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
const fallbackAheadCount =
!upstreamRef && refName
? yield* computeAheadCountAgainstBase(cwd, refName).pipe(
Effect.catch(() => Effect.succeed(0)),
)
? yield* computeAheadCountAgainstBase(cwd, refName).pipe(Effect.orElseSucceed(() => 0))
: null;
if (fallbackAheadCount !== null) {
@@ -1294,9 +1292,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
aheadOfDefaultCount =
fallbackAheadCount !== null
? fallbackAheadCount
: yield* computeAheadCountAgainstBase(cwd, refName).pipe(
Effect.catch(() => Effect.succeed(0)),
);
: yield* computeAheadCountAgainstBase(cwd, refName).pipe(Effect.orElseSucceed(() => 0));
}
const stagedEntries = parseNumstatEntries(stagedNumstatStdout);
@@ -1494,11 +1490,11 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
}
const comparableBaseBranch = yield* resolveBaseBranchForNoUpstream(cwd, branch).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
if (comparableBaseBranch) {
const publishRemoteName = yield* resolvePushRemoteName(cwd, branch).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
if (!publishRemoteName) {
return {
@@ -1508,7 +1504,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
}
const hasRemoteBranch = yield* remoteBranchExists(cwd, publishRemoteName, branch).pipe(
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
if (hasRemoteBranch) {
return {
@@ -1545,7 +1541,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
}
const currentUpstream = yield* resolveCurrentUpstream(cwd).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
);
if (currentUpstream) {
yield* runGit("GitVcsDriver.pushCurrentBranch.pushUpstream", cwd, [
@@ -1716,7 +1712,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
input.baseRef ??
(branch
? yield* resolveBaseBranchForNoUpstream(input.cwd, branch).pipe(
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
)
: null);
@@ -1729,18 +1725,16 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
appendTruncationMarker: true,
},
).pipe(
Effect.catch(() =>
Effect.succeed({
exitCode: 0,
stdout: "",
stderr: "",
stdoutTruncated: false,
stderrTruncated: false,
}),
),
Effect.orElseSucceed(() => ({
exitCode: 0,
stdout: "",
stderr: "",
stdoutTruncated: false,
stderrTruncated: false,
})),
);
const dirtyUntracked = yield* readUntrackedReviewDiffs(input.cwd).pipe(
Effect.catch(() => Effect.succeed({ diff: "", truncated: false })),
Effect.orElseSucceed(() => ({ diff: "", truncated: false })),
);
const dirtyDiff = [dirtyTrackedResult.stdout.trimEnd(), dirtyUntracked.diff.trimEnd()]
.filter((diff) => diff.length > 0)
@@ -1757,15 +1751,13 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
appendTruncationMarker: true,
},
).pipe(
Effect.catch(() =>
Effect.succeed({
exitCode: 0,
stdout: "",
stderr: "",
stdoutTruncated: false,
stderrTruncated: false,
}),
),
Effect.orElseSucceed(() => ({
exitCode: 0,
stdout: "",
stderr: "",
stdoutTruncated: false,
stderrTruncated: false,
})),
)
: null;
const baseDiff = baseResult?.stdout ?? "";
@@ -1827,7 +1819,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
const listRefs: GitVcsDriver.GitVcsDriverShape["listRefs"] = Effect.fn("listRefs")(
function* (input) {
const branchRecencyPromise = readBranchRecency(input.cwd).pipe(
Effect.catch(() => Effect.succeed(new Map<string, number>())),
Effect.orElseSucceed(() => new Map<string, number>()),
);
const localBranchResult = yield* executeGit(
"GitVcsDriver.listRefs.branchNoColor",
@@ -1970,7 +1962,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
const candidatePath = line.slice("worktree ".length);
const exists = yield* fileSystem.stat(candidatePath).pipe(
Effect.map(() => true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
currentPath = exists ? candidatePath : null;
} else if (line.startsWith("branch refs/heads/") && currentPath) {
@@ -188,7 +188,7 @@ export const makeWorkspaceEntries = Effect.gen(function* () {
const isInsideVcsWorkTree = (cwd: string): Effect.Effect<boolean> =>
vcsRegistry.detect({ cwd }).pipe(
Effect.map((handle) => handle !== null),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
const filterVcsIgnoredPaths = (
@@ -200,23 +200,23 @@ export const makeWorkspaceEntries = Effect.gen(function* () {
handle
? handle.driver.filterIgnoredPaths(cwd, relativePaths).pipe(
Effect.map((paths) => [...paths]),
Effect.catch(() => Effect.succeed(relativePaths)),
Effect.orElseSucceed(() => relativePaths),
)
: Effect.succeed(relativePaths),
),
Effect.catch(() => Effect.succeed(relativePaths)),
Effect.orElseSucceed(() => relativePaths),
);
const buildWorkspaceIndexFromVcs = Effect.fn("WorkspaceEntries.buildWorkspaceIndexFromVcs")(
function* (cwd: string) {
const vcs = yield* vcsRegistry.detect({ cwd }).pipe(Effect.catch(() => Effect.succeed(null)));
const vcs = yield* vcsRegistry.detect({ cwd }).pipe(Effect.orElseSucceed(() => null));
if (!vcs) {
return null;
}
const listedFiles = yield* vcs.driver
.listWorkspaceFiles(cwd)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!listedFiles) {
return null;
@@ -431,7 +431,7 @@ export const makeWorkspaceEntries = Effect.gen(function* () {
const invalidate: WorkspaceEntriesShape["invalidate"] = Effect.fn("WorkspaceEntries.invalidate")(
function* (cwd) {
const normalizedCwd = yield* normalizeWorkspaceRoot(cwd).pipe(
Effect.catch(() => Effect.succeed(cwd)),
Effect.orElseSucceed(() => cwd),
);
yield* Cache.invalidate(workspaceIndexCache, cwd);
if (normalizedCwd !== cwd) {
@@ -132,7 +132,7 @@ it.layer(TestLayer)("WorkspaceFileSystemLive", (it) => {
const escapedPath = path.resolve(cwd, "..", "escape.md");
const escapedStat = yield* fileSystem
.stat(escapedPath)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
expect(escapedStat).toBeNull();
}),
);
@@ -37,7 +37,7 @@ export const makeWorkspacePaths = Effect.gen(function* () {
const normalizedWorkspaceRoot = path.resolve(expandHomePath(workspaceRoot.trim(), path));
let workspaceStat = yield* fileSystem
.stat(normalizedWorkspaceRoot)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
if (!workspaceStat && options?.createIfMissing) {
yield* fileSystem.makeDirectory(normalizedWorkspaceRoot, { recursive: true }).pipe(
Effect.mapError(
@@ -50,7 +50,7 @@ export const makeWorkspacePaths = Effect.gen(function* () {
);
workspaceStat = yield* fileSystem
.stat(normalizedWorkspaceRoot)
.pipe(Effect.catch(() => Effect.succeed(null)));
.pipe(Effect.orElseSucceed(() => null));
}
if (!workspaceStat) {
return yield* new WorkspaceRootNotExistsError({
+5 -5
View File
@@ -436,7 +436,7 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
repositoryIdentity,
},
} satisfies OrchestrationEvent;
}).pipe(Effect.catch(() => Effect.succeed(event)));
}).pipe(Effect.orElseSucceed(() => event));
default:
return Effect.succeed(event);
}
@@ -459,7 +459,7 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
project: nextProject,
})),
),
Effect.catch(() => Effect.succeed(Option.none())),
Effect.orElseSucceed(() => Option.none()),
);
case "project.deleted":
return Effect.succeed(
@@ -487,7 +487,7 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
thread: nextThread,
})),
),
Effect.catch(() => Effect.succeed(Option.none())),
Effect.orElseSucceed(() => Option.none()),
);
default:
if (event.aggregateKind !== "thread") {
@@ -503,7 +503,7 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
thread: nextThread,
})),
),
Effect.catch(() => Effect.succeed(Option.none())),
Effect.orElseSucceed(() => Option.none()),
);
}
};
@@ -777,7 +777,7 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
thread.session !== null && thread.session.status !== "stopped",
}),
),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
)
: false;
const result = yield* dispatchNormalizedCommand(normalizedCommand);
+1 -1
View File
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "bun"],
"types": ["node"],
"lib": ["ESNext", "esnext.disposable"]
},
"include": ["src", "vite.config.ts", "scripts", "integration", "../../scripts/lib"]
-1
View File
@@ -62,7 +62,6 @@
"tailwindcss": "^4.0.0",
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:",
"vitest-browser-react": "^2.0.5"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { resolveDesktopCloudAuthOAuthOptions } from "./desktopAuth";
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vite-plus/test";
import {
makeDesktopClerkExternalAccountAdapter,
+1 -1
View File
@@ -1,6 +1,6 @@
import { verifyDpopProof } from "@t3tools/shared/dpop";
import * as Effect from "effect/Effect";
import { describe, expect, it, vi } from "vitest";
import { describe, expect, it, vi } from "vite-plus/test";
import { browserCryptoLayer, createBrowserDpopProof, generateBrowserDpopKey } from "./dpop";
+1 -1
View File
@@ -1,6 +1,6 @@
import { EnvironmentId } from "@t3tools/contracts";
import { RelayWebClientId } from "@t3tools/contracts/relay";
import { afterEach, beforeEach, vi } from "vitest";
import { afterEach, beforeEach, vi } from "vite-plus/test";
import { describe, expect, it } from "@effect/vitest";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
+1 -1
View File
@@ -1,4 +1,4 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
import { hasCloudPublicConfig } from "./publicConfig.ts";
@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it } from "vitest";
import { beforeEach, describe, expect, it } from "vite-plus/test";
import {
completeRelayClientInstallDialogClose,
@@ -1,7 +1,7 @@
import "../../index.css";
import { page, userEvent } from "vitest/browser";
import { afterEach, describe, expect, it, vi } from "vitest";
import { page, userEvent } from "vite-plus/test/browser";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
import { render } from "vitest-browser-react";
import type { DesktopCloudAuthOAuthOption } from "../../cloud/desktopAuth";
@@ -1,7 +1,7 @@
import "../../index.css";
import { page } from "vitest/browser";
import { beforeEach, describe, expect, it } from "vitest";
import { page } from "vite-plus/test/browser";
import { beforeEach, describe, expect, it } from "vite-plus/test";
import { render } from "vitest-browser-react";
import {
-1
View File
@@ -8,7 +8,6 @@
"verbatimModuleSyntax": false,
"jsx": "react-jsx",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"paths": {
"~/*": ["./src/*"]
},
+3 -2
View File
@@ -14,7 +14,7 @@
"@t3tools/client-runtime": "workspace:*",
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
"alchemy": "https://pkg.ing/alchemy/8b9c241",
"alchemy": "https://pkg.ing/alchemy/078ff00",
"drizzle-orm": "1.0.0-rc.3",
"effect": "catalog:"
},
@@ -24,6 +24,7 @@
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"drizzle-kit": "1.0.0-rc.3",
"vitest": "catalog:"
"vite": "catalog:",
"vite-plus": "catalog:"
}
}
+14 -2
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { hasDeployChanges, reconcileRootEnvRelayUrl } from "./deploy.ts";
import { hasDeployChanges, reconcileRootEnvRelayUrl, serializeGithubOutput } from "./deploy.ts";
describe("hasDeployChanges", () => {
it("detects resource, binding, and deletion changes", () => {
@@ -50,3 +50,15 @@ describe("reconcileRootEnvRelayUrl", () => {
);
});
});
describe("serializeGithubOutput", () => {
it("serializes relay deploy metadata for GitHub Actions outputs", () => {
expect(
serializeGithubOutput({
changed: false,
result: "noop",
relay_url: "https://relay.example.test",
}),
).toBe("changed=false\nresult=noop\nrelay_url=https://relay.example.test\n");
});
});
+59 -8
View File
@@ -39,6 +39,7 @@ export interface RelayDeployOptions {
readonly stage: Option.Option<string>;
readonly yes: boolean;
readonly adopt: boolean;
readonly githubOutput: boolean;
}
export function reconcileRootEnvRelayUrl(contents: string, relayUrl: string): string {
@@ -62,6 +63,20 @@ export function hasDeployChanges(plan: Plan.Plan): boolean {
);
}
export type RelayDeployResult = "applied" | "noop" | "dry-run" | "cancelled";
export interface RelayDeployOutcome {
readonly result: RelayDeployResult;
readonly changed: boolean;
readonly relayUrl: Option.Option<string>;
}
export function serializeGithubOutput(entries: Readonly<Record<string, string | boolean>>): string {
return Object.entries(entries)
.map(([key, value]) => `${key}=${value}\n`)
.join("");
}
const relayRoot = Effect.service(Path.Path).pipe(
Effect.flatMap((path) => path.fromFileUrl(new URL("..", import.meta.url))),
);
@@ -80,7 +95,7 @@ const loadDeployConfigProvider = Effect.fn("relay.deploy.loadConfigProvider")(fu
}
return yield* ConfigProvider.fromDotEnv({ path: path.join(root, ".env") }).pipe(
Effect.catch(() => Effect.succeed(ConfigProvider.fromEnv())),
Effect.orElseSucceed(() => ConfigProvider.fromEnv()),
);
});
@@ -102,6 +117,22 @@ const reconcileRootEnv = Effect.fn("relay.deploy.reconcileRootEnv")(function* (r
yield* Console.log(`Updated ${rootEnvPath} with T3CODE_RELAY_URL=${relayUrl}`);
});
const writeGithubOutput = Effect.fn("relay.deploy.writeGithubOutput")(function* (
outcome: RelayDeployOutcome,
) {
const fs = yield* FileSystem.FileSystem;
const githubOutputPath = yield* Config.nonEmptyString("GITHUB_OUTPUT");
yield* fs.writeFileString(
githubOutputPath,
serializeGithubOutput({
changed: outcome.changed,
result: outcome.result,
...(Option.isSome(outcome.relayUrl) ? { relay_url: outcome.relayUrl.value } : {}),
}),
{ flag: "a" },
);
});
const deployServices = Layer.mergeAll(
Layer.provideMerge(AlchemyContextLive, PlatformServices),
Layer.provide(ProfileLive, PlatformServices),
@@ -123,11 +154,16 @@ const runRelayDeploy = Effect.fn("relay.deploy.run")(
const plan = yield* Plan.make(stack, { force: options.force }).pipe(
Effect.provide(stack.services),
);
const changed = hasDeployChanges(plan);
if (options.dryRun) {
yield* cli.displayPlan(plan);
return Option.none<string>();
return {
result: "dry-run",
changed,
relayUrl: Option.none<string>(),
} satisfies RelayDeployOutcome;
}
if (!options.yes && hasDeployChanges(plan)) {
if (!options.yes && changed) {
yield* cli.displayPlan(plan);
const approved = yield* Prompt.run(
Prompt.confirm({
@@ -136,7 +172,11 @@ const runRelayDeploy = Effect.fn("relay.deploy.run")(
);
if (!approved) {
yield* Console.log("Deployment cancelled.");
return Option.none<string>();
return {
result: "cancelled",
changed,
relayUrl: Option.none<string>(),
} satisfies RelayDeployOutcome;
}
}
const output = yield* Apply.apply(plan).pipe(Effect.provide(stack.services));
@@ -145,7 +185,11 @@ const runRelayDeploy = Effect.fn("relay.deploy.run")(
message: "Alchemy relay deploy output did not include a URL",
});
}
return Option.some(output.url);
return {
result: changed ? "applied" : "noop",
changed,
relayUrl: Option.some(output.url),
} satisfies RelayDeployOutcome;
},
(effect, options, configProvider, stage) =>
effect.pipe(
@@ -171,9 +215,12 @@ export const deploy = Effect.fn("relay.deploy")(function* (options: RelayDeployO
Effect.provide(ConfigProvider.layer(configProvider)),
);
const stage = Option.getOrElse(options.stage, () => configuredStage);
const relayUrl = yield* runRelayDeploy(options, configProvider, stage);
if (Option.isSome(relayUrl)) {
yield* reconcileRootEnv(relayUrl.value);
const outcome = yield* runRelayDeploy(options, configProvider, stage);
if (Option.isSome(outcome.relayUrl)) {
yield* reconcileRootEnv(outcome.relayUrl.value);
}
if (options.githubOutput) {
yield* writeGithubOutput(outcome);
}
});
@@ -206,6 +253,10 @@ export const relayDeployCommand = Command.make(
Flag.withDescription("Adopt pre-existing cloud resources that conflict with this stack."),
Flag.withDefault(false),
),
githubOutput: Flag.boolean("github-output").pipe(
Flag.withDescription("Append relay deployment metadata to GITHUB_OUTPUT."),
Flag.withDefault(false),
),
},
deploy,
).pipe(Command.withDescription("Deploy the T3 Code relay through Alchemy."));
+1 -1
View File
@@ -161,7 +161,7 @@ const make = Effect.gen(function* () {
}
return claims;
}),
Effect.catch(() => Effect.succeed(null)),
Effect.orElseSucceed(() => null),
),
);
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { relayDatabaseMode } from "./dbConfig.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import {
managedEndpointDigestInput,
@@ -242,7 +242,7 @@ const make = Effect.gen(function* () {
.updateRecord(preferredDnsRecordId, dnsRecord)
.pipe(
Effect.as(true),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
if (checkpointedRecordUpdated) {
return preferredDnsRecordId;
+1 -1
View File
@@ -1,6 +1,6 @@
import { createClerkClient, verifyToken } from "@clerk/backend";
import { describe, expect, it } from "@effect/vitest";
import { vi } from "vitest";
import { vi } from "vite-plus/test";
import * as Context from "effect/Context";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
+1 -3
View File
@@ -13,8 +13,6 @@
},
"devDependencies": {
"@effect/vitest": "catalog:",
"@types/bun": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
"extends": "../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"types": ["bun", "node"],
"types": ["node"],
"lib": ["ESNext", "esnext.disposable"]
},
"include": ["**/*.ts"]
+3 -5
View File
@@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
"prepare": "vp config && effect-tsgo patch",
"prepare": "effect-tsgo patch",
"dev": "node scripts/dev-runner.ts dev",
"dev:server": "node scripts/dev-runner.ts dev:server",
"dev:web": "node scripts/dev-runner.ts dev:web",
@@ -17,6 +17,7 @@
"build:marketing": "vp run --filter @t3tools/marketing build",
"build:desktop": "vp run --filter @t3tools/desktop --filter t3 build",
"typecheck": "vp run -r --concurrency-limit 2 typecheck",
"tc": "vp run -r --concurrency-limit 2 typecheck",
"lint": "vp lint --report-unused-disable-directives",
"lint:mobile": "node scripts/mobile-native-static-check.ts",
"test": "vp run -r test",
@@ -43,10 +44,7 @@
"@oxlint/plugins": "^1.63.0",
"@types/node": "catalog:",
"@typescript/native-preview": "catalog:",
"@vitest/runner": "catalog:",
"vite": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
},
"engines": {
"node": "^24.13.1"
+1 -2
View File
@@ -24,7 +24,6 @@
},
"devDependencies": {
"@effect/vitest": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
@@ -7,7 +7,7 @@ import type {
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import { Atom, AtomRegistry } from "effect/unstable/reactivity";
import { afterEach, describe, expect, it, vi } from "vitest";
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
import { ManagedRelayClient, type ManagedRelayClientShape } from "./managedRelay.ts";
import {
+1 -2
View File
@@ -29,7 +29,6 @@
},
"devDependencies": {
"@effect/vitest": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import * as OpenApi from "effect/unstable/httpapi/OpenApi";
import { RelayApi } from "./relay.ts";
+1 -2
View File
@@ -45,7 +45,6 @@
"@effect/platform-node": "catalog:",
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
@@ -38,7 +38,6 @@
"@effect/platform-node": "catalog:",
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -2
View File
@@ -164,7 +164,6 @@
"@effect/platform-node": "catalog:",
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { serializeComposerMentionPath } from "./composerTrigger.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { encodeOAuthScope, parseAllowedOAuthScope, parseOAuthScope } from "./oauthScope.ts";
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import {
clerkFrontendApiHostnameFromPublishableKey,
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it } from "vite-plus/test";
import { isSecureRelayUrl, normalizeSecureRelayUrl } from "./relayUrl.ts";
+1 -2
View File
@@ -37,7 +37,6 @@
"@effect/platform-node": "catalog:",
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -2
View File
@@ -19,7 +19,6 @@
"devDependencies": {
"@effect/vitest": "catalog:",
"@types/node": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -1
View File
@@ -297,7 +297,7 @@ export const probeTailscaleHttpsEndpoint = (input: {
onNone: () => false,
onSome: (httpResponse) => httpResponse.status >= 200 && httpResponse.status < 300,
});
}).pipe(Effect.catch(() => Effect.succeed(false)));
}).pipe(Effect.orElseSucceed(() => false));
export const resolveTailscaleHttpsBaseUrl = (
input: {
+124
View File
@@ -0,0 +1,124 @@
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 14b0e5d443f6cf615d81960ca0c4942ffa0ac39b..68eebc89c6288f5bdee5fa4515e94e7fc0d332a0 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -7,11 +7,11 @@ import type * as Layer from "effect/Layer";
import type * as Schema from "effect/Schema";
import type * as Scope from "effect/Scope";
import type * as FC from "effect/testing/FastCheck";
-import * as V from "vitest";
+import * as V from "vite-plus/test";
/**
* @since 4.0.0
*/
-export * from "vitest";
+export * from "vite-plus/test";
/**
* @since 4.0.0
*/
diff --git a/dist/index.js b/dist/index.js
index 938c9c817abe9aeddb9ad8c74e099c62cbf5f091..760ecc47fec5e9df2efd75de17c05ba4b0700ec1 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,9 +1,9 @@
-import * as V from "vitest";
+import * as V from "vite-plus/test";
import * as internal from "./internal/internal.js";
/**
* @since 4.0.0
*/
-export * from "vitest";
+export * from "vite-plus/test";
/**
* @since 4.0.0
*/
diff --git a/dist/internal/internal.js b/dist/internal/internal.js
index a30fc1a0dfed2ef215faa9554a151a53443b05d7..405a7cc184e29de5d327c01876963c8a57e80361 100644
--- a/dist/internal/internal.js
+++ b/dist/internal/internal.js
@@ -1,7 +1,7 @@
/**
* @since 4.0.0
*/
-import { getCurrentSuite } from "@vitest/runner";
+import { getCurrentSuite } from "vite-plus/test/plugins/runner";
import * as Cause from "effect/Cause";
import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
@@ -15,7 +15,7 @@ import * as Scope from "effect/Scope";
import * as fc from "effect/testing/FastCheck";
import * as TestClock from "effect/testing/TestClock";
import * as TestConsole from "effect/testing/TestConsole";
-import * as V from "vitest";
+import * as V from "vite-plus/test";
const runPromise = /*#__PURE__*/Effect.fnUntraced(function* (effect, _ctx) {
const exit = yield* Effect.exit(effect);
if (Exit.isFailure(exit)) {
diff --git a/dist/utils.js b/dist/utils.js
index cfb2c39847518b491ca5db87ef693947a75e5e53..c044d7a01c2dd9d86e35db3910aed384eca53a3b 100644
--- a/dist/utils.js
+++ b/dist/utils.js
@@ -4,7 +4,7 @@ import * as Option from "effect/Option";
import * as Predicate from "effect/Predicate";
import * as Result from "effect/Result";
import * as assert from "node:assert";
-import { assert as vassert } from "vitest";
+import { assert as vassert } from "vite-plus/test";
// ----------------------------
// Primitives
// ----------------------------
diff --git a/src/index.ts b/src/index.ts
index 37886fb6c37a12710f73ccee87a3ff6ca8b2c9fa..2207df940dfae2a346211d09b8d39554e0c00d34 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -7,13 +7,13 @@ import type * as Layer from "effect/Layer"
import type * as Schema from "effect/Schema"
import type * as Scope from "effect/Scope"
import type * as FC from "effect/testing/FastCheck"
-import * as V from "vitest"
+import * as V from "vite-plus/test"
import * as internal from "./internal/internal.ts"
/**
* @since 4.0.0
*/
-export * from "vitest"
+export * from "vite-plus/test"
/**
* @since 4.0.0
diff --git a/src/internal/internal.ts b/src/internal/internal.ts
index 31c7ea1299a85ad30f2e07f740ba109e42c4ed5d..9db9071c45d27095af21787cbdebb1c57178f167 100644
--- a/src/internal/internal.ts
+++ b/src/internal/internal.ts
@@ -2,7 +2,7 @@
* @since 4.0.0
*/
-import { getCurrentSuite } from "@vitest/runner"
+import { getCurrentSuite } from "vite-plus/test/plugins/runner"
import * as Cause from "effect/Cause"
import * as Duration from "effect/Duration"
import * as Effect from "effect/Effect"
@@ -16,7 +16,7 @@ import * as Scope from "effect/Scope"
import * as fc from "effect/testing/FastCheck"
import * as TestClock from "effect/testing/TestClock"
import * as TestConsole from "effect/testing/TestConsole"
-import * as V from "vitest"
+import * as V from "vite-plus/test"
import type * as Vitest from "../index.ts"
const runPromise: <E, A>(
diff --git a/src/utils.ts b/src/utils.ts
index ad704454c0d2d3a3f0de9cdb8ffcca616d5f859c..dbd050bff6f27e111ebc89a6f8be07767dc164d8 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -37,7 +37,7 @@ import * as Option from "effect/Option"
import * as Predicate from "effect/Predicate"
import * as Result from "effect/Result"
import * as assert from "node:assert"
-import { assert as vassert } from "vitest"
+import { assert as vassert } from "vite-plus/test"
// ----------------------------
// Primitives
+284 -273
View File
File diff suppressed because it is too large. Load diff
+16 -9
View File
@@ -25,20 +25,18 @@ catalog:
"@effect/sql-pg": 4.0.0-beta.78
"@effect/sql-sqlite-bun": 4.0.0-beta.78
"@effect/vitest": 4.0.0-beta.78
"@effect/tsgo": 0.11.4
"@effect/tsgo": 0.13.2
"@noble/curves": 1.9.1
"@noble/hashes": 1.8.0
"@pierre/diffs": 1.1.20
"@vitest/runner": ^4.1.8
"@types/bun": ^1.3.11
"@vitest/runner": 4.1.8
"@types/node": 24.12.4
"@typescript/native-preview": 7.0.0-dev.20260527.2
"@typescript/native-preview": 7.0.0-dev.20260604.1
jose: 6.2.2
tsdown: ^0.20.3
typescript: ~6.0.3
vitest: npm:@voidzero-dev/vite-plus-test@latest
vite: npm:@voidzero-dev/vite-plus-core@latest
vite-plus: latest
vitest: npm:@voidzero-dev/vite-plus-test@0.1.24
vite: npm:@voidzero-dev/vite-plus-core@0.1.24
vite-plus: 0.1.24
yaml: ^2.9.0
overrides:
# Clerk publishes wallet auth integrations as required dependencies. T3 Code does
@@ -56,6 +54,8 @@ overrides:
"@effect/sql-pg": "catalog:"
"@effect/sql-sqlite-bun": "catalog:"
"@effect/vitest": "catalog:"
"@effect/vitest>@vitest/runner": "-"
"@effect/vitest>vitest": "-"
"@types/node": "catalog:"
effect: "catalog:"
vite: "catalog:"
@@ -71,8 +71,15 @@ peerDependencyRules:
packageExtensions:
"@effect/vitest@*":
dependencies:
"@vitest/runner": "catalog:"
vite-plus: "catalog:"
peerDependenciesMeta:
vitest:
optional: true
"vite-plus@*":
dependencies:
vite: "catalog:"
patchedDependencies:
"@effect/[email protected]": patches/@[email protected]
"@expo/[email protected]": patches/@expo%[email protected]
"@pierre/[email protected]": patches/@pierre%[email protected]
[email protected]: patches/[email protected]
+11 -15
View File
@@ -178,13 +178,11 @@ const resolveGitCommitHash = Effect.fn("resolveGitCommitHash")(function* (repoRo
cwd: repoRoot,
}),
).pipe(
Effect.catch(() =>
Effect.succeed({
stdout: "",
stderr: "",
exitCode: 1,
}),
),
Effect.orElseSucceed(() => ({
stdout: "",
stderr: "",
exitCode: 1,
})),
);
if (result.exitCode !== 0) {
@@ -220,13 +218,11 @@ const resolvePythonForNodeGyp = Effect.fn("resolvePythonForNodeGyp")(function* (
const probe = yield* spawnAndCollectOutput(
ChildProcess.make("python", ["-c", "import sys;print(sys.executable)"]),
).pipe(
Effect.catch(() =>
Effect.succeed({
stdout: "",
stderr: "",
exitCode: 1,
}),
),
Effect.orElseSucceed(() => ({
stdout: "",
stderr: "",
exitCode: 1,
})),
);
if (probe.exitCode !== 0) {
@@ -1008,7 +1004,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
const copiedArtifacts: string[] = [];
for (const entry of stageEntries) {
const from = path.join(stageDistDir, entry);
const stat = yield* fs.stat(from).pipe(Effect.catch(() => Effect.succeed(null)));
const stat = yield* fs.stat(from).pipe(Effect.orElseSucceed(() => null));
if (!stat || stat.type !== "File") continue;
const to = path.join(options.outputDir, entry);
+1 -1
View File
@@ -2,7 +2,7 @@
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { afterEach, describe, expect, it } from "vite-plus/test";
import { loadRepoEnv, resolvePublicConfig } from "./public-config.ts";
+1 -1
View File
@@ -73,7 +73,7 @@ const commandExists = Effect.fn("commandExists")(function* (command: string) {
return yield* spawner.spawn(lookupCommand).pipe(
Effect.flatMap((child) => child.exitCode),
Effect.map((exitCode) => exitCode === 0),
Effect.catch(() => Effect.succeed(false)),
Effect.orElseSucceed(() => false),
);
});
+1 -4
View File
@@ -7,7 +7,6 @@
"test": "vp test run"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.2.77",
"@effect/platform-node": "catalog:",
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
@@ -16,8 +15,6 @@
},
"devDependencies": {
"@effect/vitest": "catalog:",
"@types/bun": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:"
"vite-plus": "catalog:"
}
}
+1 -3
View File
@@ -14,14 +14,12 @@ export default defineConfig({
hookTimeout: 60_000,
testTimeout: 60_000,
},
staged: {
"*": "vp check --fix",
},
fmt: {
ignorePatterns: [
".reference",
".repos/**",
".plans",
".alchemy",
"dist",
"dist-electron",
"node_modules",