Compare commits

..
Author SHA1 Message Date
Cursor AgentandJulius Marminge 33319ce2a8 Address relay lock test diagnostic
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:19:19 +00:00
Cursor AgentandJulius Marminge 77bb590bd8 Format relay client lock changes
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:18:15 +00:00
Cursor AgentandJulius Marminge 5de7504b05 Use noop FileSystem layer for relay lock test
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:16:53 +00:00
Cursor AgentandJulius Marminge 9d9ecd1b24 Make relay lock retry test deterministic
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:16:32 +00:00
Cursor AgentandJulius Marminge b7c0946458 Bound relay install lock retry schedule
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:10:59 +00:00
Cursor AgentandJulius Marminge ad4afef13d Use Effect schedule for relay install locks
Co-authored-by: Julius Marminge <[email protected]>
2026-06-05 16:07:02 +00:00
Julius Marminge 92be60e7c1 include @latest 2026-06-04 23:01:09 -07:00
Julius Marminge 0d6e9e9add we support cursor, duhhh 2026-06-04 23:00:40 -07:00
Julius Marminge 8ab58a0b26 tip 2026-06-04 22:59:28 -07:00
Julius Marminge 6f42bd9c88 cleanup 2026-06-04 22:58:53 -07:00
Julius Marminge 5b26bd408b link 2026-06-04 22:57:04 -07:00
Julius Marminge c04d15d3be document vp instead of mise 2026-06-04 22:56:18 -07:00
Julius Marminge 9da430c828 Refactor recoverable Effect fallbacks to orElseSucceed (#2968) 2026-06-05 05:47:56 +00:00
Julius Marminge a084fbbc0a Remove duplicate 'publish' argument in CLI script 2026-06-04 22:39:59 -07:00
Julius Marminge b870a6e349 Rename function for publishing arguments to vp pm (#2967) 2026-06-05 05:22:37 +00:00
Julius Marminge e1cb19b55b Use pnpm for server publish workflow (#2966) 2026-06-04 22:16:52 -07:00
Julius Marminge 94fc117561 publish deploy status on relay deploy workflow 2026-06-04 21:47:12 -07:00
Julius Marminge 113b9d84c7 remove vp staged 2026-06-04 21:41:54 -07:00
Julius Marminge f60def2054 Migrate tests to vite-plus test APIs (#2964) 2026-06-05 04:39:19 +00:00
Julius Marminge eda163ca17 bump alchemy to fix drizzle schema out attempt 2 2026-06-04 21:03:05 -07:00
Julius Marminge 3579005114 bump alchemy to fix absolute drizzle schema out 2026-06-04 20:45:34 -07:00
Julius Marminge af3dfd229e forward args directly 2026-06-04 20:19:06 -07:00
Julius Marminge 969e6d274c implicit install from vp 2026-06-04 20:16:56 -07:00
Julius Marminge 769bdd251d fallback to None when RELAY_DOMAIN is unset 2026-06-04 20:16:23 -07:00
Julius Marminge 295b9db113 dont fail if env-file is unspecified 2026-06-04 20:12:42 -07:00
Julius Marminge b5a62504d4 move 2026-06-04 20:05:30 -07:00
Julius Marminge ec18938bf9 Restructure documentation into topical folders (#2963) 2026-06-04 20:03:12 -07:00
Julius Marmingeandcodex 5ae77c0d63 feat(relay): Add managed relay tunnels and APN service (#2837)
Co-authored-by: codex <[email protected]>
2026-06-04 19:53:56 -07:00
118 changed files with 972 additions and 575 deletions

No files matched your search

+26 -5
View File
@@ -8,6 +8,7 @@ on:
permissions:
contents: read
id-token: none
statuses: write
concurrency:
group: relay-production
@@ -43,13 +44,11 @@ jobs:
with:
node-version-file: package.json
cache: true
run-install: false
- name: Install dependencies
run: vp install --frozen-lockfile
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 }}
@@ -57,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
+32 -13
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,25 +49,41 @@ We are very very early in this project. Expect bugs.
We are not accepting contributions yet.
Observability guide: [docs/observability.md](./docs/observability.md)
There's no public docs site yet, checkout the miscellaneous markdown files in [docs](./docs).
Relay observability: [docs/relay-observability.md](./docs/relay-observability.md)
## Documentation
T3 Cloud Clerk setup: [docs/t3-cloud-clerk.md](./docs/t3-cloud-clerk.md)
- [Getting started](./docs/getting-started/quick-start.md)
- [Architecture overview](./docs/architecture/overview.md)
- [Provider guides](./docs/providers/codex.md)
- [Operations](./docs/operations/ci.md)
- [Reference](./docs/reference/encyclopedia.md)
## 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)"
}
+2 -5
View File
@@ -29,9 +29,7 @@ export const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alph
export const APP_BUNDLE_ID = isDevelopment
? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}`
: "com.t3tools.t3code";
const APP_PROTOCOL_SCHEMES = isDevelopment
? [`t3code-dev-${devBundleIdSuffix || "local"}`]
: ["t3code"];
const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"];
const LAUNCHER_VERSION = 10;
const defaultIconPath = join(desktopDir, "resources", "icon.icns");
const developmentMacIconPngPath = join(repoRoot, "assets", "dev", "blueprint-macos-1024.png");
@@ -108,7 +106,6 @@ function writeDevelopmentLauncherScript(targetBinaryPath, electronBinaryPath) {
["T3CODE_OTLP_TRACES_URL", process.env.T3CODE_OTLP_TRACES_URL],
["T3CODE_OTLP_EXPORT_INTERVAL_MS", process.env.T3CODE_OTLP_EXPORT_INTERVAL_MS],
["T3CODE_DESKTOP_APP_USER_MODEL_ID", APP_BUNDLE_ID],
["T3CODE_DESKTOP_PROTOCOL_SCHEME", APP_PROTOCOL_SCHEMES[0]],
["T3CODE_DESKTOP_PROTOCOL_REGISTRATION_MANAGED", "1"],
["T3CODE_DESKTOP_PROTOCOL_CALLBACK_URL", protocolCallbackUrl],
].filter((entry) => typeof entry[1] === "string" && entry[1].trim().length > 0);
@@ -119,7 +116,7 @@ function writeDevelopmentLauncherScript(targetBinaryPath, electronBinaryPath) {
...envEntries.map(([name, value]) => `export ${name}=${shellSingleQuote(value)}`),
'for arg in "$@"; do',
' case "$arg" in',
` ${APP_PROTOCOL_SCHEMES[0]}://auth/callback*)`,
" t3code-dev://auth/callback*)",
' if [ -n "$T3CODE_DESKTOP_PROTOCOL_CALLBACK_URL" ]; then',
' /usr/bin/curl -fsS --max-time 2 -X POST --data-binary "$arg" "$T3CODE_DESKTOP_PROTOCOL_CALLBACK_URL" >/dev/null 2>&1 && exit 0',
" fi",
+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>()),
),
});
});
-4
View File
@@ -52,10 +52,6 @@ export class DesktopCloudAuth extends Context.Service<DesktopCloudAuth, DesktopC
) {}
export function resolveCloudAuthCallbackScheme(input: { readonly isDevelopment: boolean }): string {
if (input.isDevelopment) {
const override = process.env.T3CODE_DESKTOP_PROTOCOL_SCHEME?.trim();
if (override) return override;
}
return input.isDevelopment ? DEVELOPMENT_CLOUD_AUTH_CALLBACK_SCHEME : CLOUD_AUTH_CALLBACK_SCHEME;
}
@@ -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";
@@ -209,7 +209,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/*"]
},
+11
View File
@@ -0,0 +1,11 @@
# Documentation
- [Getting started](./getting-started/quick-start.md)
- [Architecture](./architecture/overview.md)
- [Cloud](./cloud/t3-cloud-clerk.md)
- [Integrations](./integrations/source-control-providers.md)
- [Mobile](./mobile/app.md)
- [Operations](./operations/ci.md)
- [Providers](./providers/codex.md)
- [Reference](./reference/encyclopedia.md)
- [User guides](./user/keybindings.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -124,15 +124,11 @@ In **Clerk Dashboard > Native applications**, enable native application support
entries under the mobile SSO redirect allowlist:
```text
t3code-dev-<suffix>://auth/callback
t3code-dev://auth/callback
t3code://auth/callback
```
The first entry is for local desktop development. The `<suffix>` is the lowercased alphanumeric
form of the repository root directory name (e.g. `t3code-dev-t3code` for a checkout named
`t3-code`). Each worktree gets a unique scheme so multiple simultaneous dev instances do not steal
OAuth callbacks from each other. Add each worktree's scheme to the allowlist. The second entry is
for packaged desktop builds.
The first entry is for local desktop development. The second is for packaged desktop builds.
The app also adds a request-scoped `t3_state` query parameter and validates it on callback. Initial
sign-in and linked-account OAuth flows both return through this bridge. The desktop provider keeps
Clerk's stock profile component, replaces its renderer-page callback with the custom-scheme callback,
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1 -1
View File
@@ -3,4 +3,4 @@
- `.github/workflows/ci.yml` runs `bun run lint`, `bun run typecheck`, and `bun run test` on pull requests and pushes to `main`.
- `.github/workflows/release.yml` builds macOS (`arm64` and `x64`), Linux (`x64`), and Windows (`x64`) desktop artifacts from a single `v*.*.*` tag and publishes one GitHub release.
- The release workflow auto-enables signing only when secrets are present: Apple credentials for macOS and Azure Trusted Signing credentials for Windows. Without secrets, it still releases unsigned artifacts.
- See `docs/release.md` for full release/signing setup checklist.
- See [Release Checklist](./release.md) for the full release/signing setup checklist.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2 -2
View File
@@ -13,7 +13,7 @@ The file must be a JSON array of rules:
]
```
See the full schema for more details: [`packages/contracts/src/keybindings.ts`](packages/contracts/src/keybindings.ts)
See the full schema for more details: [`packages/contracts/src/keybindings.ts`](../../packages/contracts/src/keybindings.ts)
## Defaults
@@ -31,7 +31,7 @@ See the full schema for more details: [`packages/contracts/src/keybindings.ts`](
]
```
For most up to date defaults, see [`DEFAULT_KEYBINDINGS` in `apps/server/src/keybindings.ts`](apps/server/src/keybindings.ts)
For most up to date defaults, see [`DEFAULT_KEYBINDINGS` in `apps/server/src/keybindings.ts`](../../apps/server/src/keybindings.ts)
## Configuration
File renamed without changes.
+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");
});
});
+69 -11
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))),
);
@@ -74,9 +89,14 @@ const loadDeployConfigProvider = Effect.fn("relay.deploy.loadConfigProvider")(fu
) {
const path = yield* Path.Path;
const root = yield* relayRoot;
const selectedEnvFile = Option.getOrUndefined(envFileOverride);
const envFile = selectedEnvFile ? path.resolve(root, selectedEnvFile) : path.join(root, ".env");
return yield* ConfigProvider.fromDotEnv({ path: envFile });
if (Option.isSome(envFileOverride)) {
return yield* ConfigProvider.fromDotEnv({ path: path.resolve(root, envFileOverride.value) });
}
return yield* ConfigProvider.fromDotEnv({ path: path.join(root, ".env") }).pipe(
Effect.orElseSucceed(() => ConfigProvider.fromEnv()),
);
});
const relayDeployStage = Config.nonEmptyString("stage").pipe(
@@ -97,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),
@@ -118,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({
@@ -131,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));
@@ -140,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(
@@ -166,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);
}
});
@@ -184,7 +236,9 @@ export const relayDeployCommand = Command.make(
Flag.withDefault(false),
),
envFile: Flag.string("env-file").pipe(
Flag.withDescription("Environment file to load. Defaults to infra/relay/.env."),
Flag.withDescription(
"Environment file to load. Defaults to infra/relay/.env with process env fallback.",
),
Flag.optional,
),
stage: Flag.string("stage").pipe(
@@ -199,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";
+7 -1
View File
@@ -23,8 +23,14 @@ export const RelayDeploymentConfig = Effect.gen(function* () {
const { stage } = yield* Alchemy.Stack;
const relayApiZoneName = yield* Config.nonEmptyString("RELAY_API_ZONE_NAME");
const managedEndpointZoneName = yield* Config.nonEmptyString("RELAY_TUNNEL_ZONE_NAME");
const relayPublicDomainOverride = yield* Config.nonEmptyString("RELAY_DOMAIN").pipe(
const relayPublicDomainOverride = yield* Config.string("RELAY_DOMAIN").pipe(
Config.option,
Config.map(
Option.flatMap((value) => {
const trimmed = value.trim();
return trimmed ? Option.some(trimmed) : Option.none();
}),
),
);
const relayPublicDomain = Option.getOrElse(relayPublicDomainOverride, () =>
relayPublicDomainForStage(stage, relayApiZoneName),
+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:"
}
}
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff. Show more