Migrate workspace to Vite+ and pnpm (#2899)
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Cursor Agent <[email protected]>
This commit is contained in:
299 files changed
+16445
-4576
No files matched your search
+43
-55
@@ -15,67 +15,61 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
|
||||
- name: Cache Bun and Turbo
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.bun/install/cache
|
||||
.turbo
|
||||
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-${{ hashFiles('turbo.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Cache Playwright browsers
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}
|
||||
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-playwright-
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: vp install --frozen-lockfile
|
||||
|
||||
- name: Ensure Electron runtime is installed
|
||||
run: |
|
||||
if ! node -e "require('./apps/desktop/node_modules/electron')" >/dev/null 2>&1; then
|
||||
rm -rf apps/desktop/node_modules/electron/dist apps/desktop/node_modules/electron/path.txt
|
||||
bun apps/desktop/node_modules/electron/install.js
|
||||
fi
|
||||
node -e "require('./apps/desktop/node_modules/electron')"
|
||||
run: vp run --filter @t3tools/desktop ensure:electron
|
||||
|
||||
- name: Format
|
||||
run: bun run fmt:check
|
||||
|
||||
- name: Lint
|
||||
run: bun run lint
|
||||
- name: Check
|
||||
run: vp check
|
||||
|
||||
- name: Typecheck
|
||||
run: bun run typecheck
|
||||
run: vp run typecheck
|
||||
|
||||
- name: Test
|
||||
run: bun run test
|
||||
run: vp run test
|
||||
|
||||
- name: Install browser test runtime
|
||||
run: |
|
||||
cd apps/web
|
||||
bunx playwright install --with-deps chromium
|
||||
run: vp run --filter @t3tools/web test:browser:install
|
||||
|
||||
- name: Browser test
|
||||
run: bun run --cwd apps/web test:browser
|
||||
- name: Browser test / Chat view
|
||||
working-directory: apps/web
|
||||
run: vp test run --mode browser --browser=chromium src/components/ChatView.browser.tsx
|
||||
|
||||
- name: Browser test / Chat markdown
|
||||
working-directory: apps/web
|
||||
run: vp test run --mode browser --browser=chromium src/components/ChatMarkdown.browser.tsx
|
||||
|
||||
- name: Browser test / Components
|
||||
working-directory: apps/web
|
||||
run: |
|
||||
vp test run --mode browser --browser=chromium \
|
||||
src/components/GitActionsControl.browser.tsx \
|
||||
src/components/KeybindingsToast.browser.tsx \
|
||||
src/components/ThreadTerminalDrawer.browser.tsx \
|
||||
src/components/chat/MessagesTimeline.browser.tsx \
|
||||
src/components/chat/ProviderModelPicker.browser.tsx \
|
||||
src/components/chat/CompactComposerControlsMenu.browser.tsx \
|
||||
src/components/settings/SettingsPanels.browser.tsx
|
||||
|
||||
- name: Build desktop pipeline
|
||||
run: bun run build:desktop
|
||||
run: vp run build:desktop
|
||||
|
||||
- name: Verify preload bundle output
|
||||
run: |
|
||||
@@ -90,24 +84,21 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: vp install --frozen-lockfile
|
||||
|
||||
- name: Install mobile native static analysis tools
|
||||
run: brew bundle install --file apps/mobile/Brewfile
|
||||
|
||||
- name: Lint mobile native sources
|
||||
run: node scripts/mobile-native-static-check.ts
|
||||
run: vp run lint:mobile
|
||||
|
||||
release_smoke:
|
||||
name: Release Smoke
|
||||
@@ -117,18 +108,15 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: vp install --frozen-lockfile
|
||||
|
||||
- name: Exercise release-only workflow steps
|
||||
run: node scripts/release-smoke.ts
|
||||
@@ -85,26 +85,18 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: vp install --frozen-lockfile
|
||||
|
||||
- name: Ensure Electron runtime is installed
|
||||
run: |
|
||||
if ! node -e "require('./apps/desktop/node_modules/electron')" >/dev/null 2>&1; then
|
||||
rm -rf apps/desktop/node_modules/electron/dist apps/desktop/node_modules/electron/path.txt
|
||||
bun apps/desktop/node_modules/electron/install.js
|
||||
fi
|
||||
node -e "require('./apps/desktop/node_modules/electron')"
|
||||
run: vp run --filter @t3tools/desktop ensure:electron
|
||||
|
||||
- id: release_meta
|
||||
name: Resolve release version
|
||||
@@ -160,14 +152,14 @@ jobs:
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Lint
|
||||
run: bun run lint
|
||||
- name: Check
|
||||
run: vp check
|
||||
|
||||
- name: Typecheck
|
||||
run: bun run typecheck
|
||||
run: vp run typecheck
|
||||
|
||||
- name: Test
|
||||
run: bun run test
|
||||
run: vp run test
|
||||
|
||||
- id: previous_tag
|
||||
name: Resolve previous release tag
|
||||
@@ -219,18 +211,15 @@ jobs:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
run: vp install --frozen-lockfile
|
||||
|
||||
- name: Align package versions to release version
|
||||
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
@@ -390,7 +379,7 @@ jobs:
|
||||
echo "Signing disabled for ${{ matrix.platform }}."
|
||||
fi
|
||||
|
||||
bun run dist:desktop:artifact -- "${args[@]}"
|
||||
vp run dist:desktop:artifact -- "${args[@]}"
|
||||
|
||||
- name: Collect release assets
|
||||
shell: bash
|
||||
@@ -452,28 +441,29 @@ jobs:
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: package.json
|
||||
registry-url: https://registry.npmjs.org
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile --filter=t3 --filter=@t3tools/web --filter=@t3tools/scripts
|
||||
run: vp install --frozen-lockfile --filter=t3 --filter=@t3tools/web --filter=@t3tools/scripts
|
||||
|
||||
- name: Align package versions to release version
|
||||
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
|
||||
- name: Build web package
|
||||
run: bun --filter=@t3tools/web run build
|
||||
run: vp run --filter @t3tools/web build
|
||||
|
||||
- name: Build CLI package
|
||||
run: bun --filter=t3 run build
|
||||
run: vp run --filter t3 build
|
||||
|
||||
- name: Publish CLI package
|
||||
run: node apps/server/scripts/cli.ts publish --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --app-version "${{ needs.preflight.outputs.version }}" --verbose
|
||||
@@ -498,18 +488,15 @@ jobs:
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile --filter=@t3tools/scripts
|
||||
run: vp install --frozen-lockfile --filter=@t3tools/scripts
|
||||
|
||||
- name: Download all desktop artifacts
|
||||
uses: actions/download-artifact@v8
|
||||
@@ -619,24 +606,21 @@ jobs:
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install release tooling dependencies
|
||||
run: bun install --frozen-lockfile --filter=@t3tools/scripts --filter=@t3tools/web
|
||||
run: vp install --frozen-lockfile --filter=@t3tools/scripts --filter=@t3tools/web
|
||||
|
||||
- name: Align package versions to release version
|
||||
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
|
||||
- name: Refresh release lockfile
|
||||
run: bun install --lockfile-only --ignore-scripts
|
||||
run: vp install --lockfile-only --ignore-scripts
|
||||
|
||||
- name: Deploy and alias channel
|
||||
shell: bash
|
||||
@@ -668,7 +652,7 @@ jobs:
|
||||
|
||||
echo "Deploying hosted web app for $channel_name channel."
|
||||
deployment_url="$(
|
||||
bunx [email protected] deploy \
|
||||
vp dlx [email protected] deploy \
|
||||
--prod \
|
||||
--skip-domain \
|
||||
--yes \
|
||||
@@ -680,13 +664,13 @@ jobs:
|
||||
)"
|
||||
|
||||
echo "Aliasing $deployment_url to $channel_domain."
|
||||
bunx [email protected] alias set "$deployment_url" "$channel_domain" \
|
||||
vp dlx [email protected] alias set "$deployment_url" "$channel_domain" \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
"${vercel_scope_args[@]}"
|
||||
|
||||
if [[ "$channel_name" == "latest" && -n "$router_domain" && "$router_domain" != "$channel_domain" ]]; then
|
||||
echo "Aliasing $deployment_url to router domain $router_domain."
|
||||
bunx [email protected] alias set "$deployment_url" "$router_domain" \
|
||||
vp dlx [email protected] alias set "$deployment_url" "$router_domain" \
|
||||
--token "$VERCEL_TOKEN" \
|
||||
"${vercel_scope_args[@]}"
|
||||
fi
|
||||
@@ -724,18 +708,15 @@ jobs:
|
||||
echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
|
||||
echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile --filter=@t3tools/scripts
|
||||
run: vp install --frozen-lockfile --filter=@t3tools/scripts
|
||||
|
||||
- id: update_versions
|
||||
name: Update version strings
|
||||
@@ -745,11 +726,11 @@ jobs:
|
||||
|
||||
- name: Format package.json files
|
||||
if: steps.update_versions.outputs.changed == 'true'
|
||||
run: bunx [email protected] apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
|
||||
run: vp fmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
|
||||
|
||||
- name: Refresh lockfile
|
||||
if: steps.update_versions.outputs.changed == 'true'
|
||||
run: bun install --lockfile-only --ignore-scripts
|
||||
run: vp install --lockfile-only --ignore-scripts
|
||||
|
||||
- name: Commit and push version bump
|
||||
if: steps.update_versions.outputs.changed == 'true'
|
||||
@@ -757,7 +738,7 @@ jobs:
|
||||
env:
|
||||
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
|
||||
run: |
|
||||
if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock; then
|
||||
if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml; then
|
||||
echo "No version changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
@@ -765,7 +746,7 @@ jobs:
|
||||
git config user.name "${{ steps.app_bot.outputs.name }}"
|
||||
git config user.email "${{ steps.app_bot.outputs.email }}"
|
||||
|
||||
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
|
||||
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json pnpm-lock.yaml
|
||||
git commit -m "chore(release): prepare $RELEASE_TAG"
|
||||
git push origin HEAD:main
|
||||
|
||||
@@ -786,18 +767,15 @@ jobs:
|
||||
with:
|
||||
ref: ${{ needs.preflight.outputs.ref }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version-file: package.json
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v6
|
||||
- name: Setup Vite+
|
||||
uses: voidzero-dev/setup-vp@v1
|
||||
with:
|
||||
node-version-file: package.json
|
||||
cache: true
|
||||
run-install: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile --filter=@t3tools/scripts
|
||||
run: vp install --frozen-lockfile --filter=@t3tools/scripts
|
||||
|
||||
- name: Announce prerelease on Discord
|
||||
if: needs.preflight.outputs.is_prerelease == 'true'
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
[tools]
|
||||
node = "24.13.1"
|
||||
bun = "1.3.9"
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"ignorePatterns": [
|
||||
".reference",
|
||||
".repos/**",
|
||||
".plans",
|
||||
"dist",
|
||||
"dist-electron",
|
||||
"node_modules",
|
||||
"bun.lock",
|
||||
"*.tsbuildinfo",
|
||||
"**/routeTree.gen.ts",
|
||||
"apps/mobile/android/**",
|
||||
"apps/mobile/ios/**",
|
||||
"apps/web/public/mockServiceWorker.js",
|
||||
"apps/web/src/lib/vendor/qrcodegen.ts",
|
||||
"apps/mobile/uniwind-types.d.ts",
|
||||
"*.icon/**"
|
||||
],
|
||||
"sortPackageJson": {},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [".devcontainer/devcontainer.json"],
|
||||
"options": {
|
||||
"trailingComma": "none"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"ignorePatterns": [
|
||||
"dist",
|
||||
"dist-electron",
|
||||
".repos/**",
|
||||
"node_modules",
|
||||
"bun.lock",
|
||||
"*.tsbuildinfo",
|
||||
"**/routeTree.gen.ts",
|
||||
"apps/mobile/android/**",
|
||||
"apps/mobile/ios/**",
|
||||
"apps/mobile/uniwind-types.d.ts"
|
||||
],
|
||||
"plugins": ["eslint", "oxc", "react", "unicorn", "typescript"],
|
||||
"jsPlugins": ["./oxlint-plugin-t3code/index.ts"],
|
||||
"categories": {
|
||||
"correctness": "warn",
|
||||
"suspicious": "warn",
|
||||
"perf": "warn"
|
||||
},
|
||||
"rules": {
|
||||
"unicorn/no-array-sort": "off",
|
||||
"react-in-jsx-scope": "off",
|
||||
"eslint/no-shadow": "off",
|
||||
"eslint/no-await-in-loop": "off",
|
||||
"eslint/no-underscore-dangle": "off",
|
||||
"t3code/no-inline-schema-compile": "warn"
|
||||
}
|
||||
}
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
vp staged
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
## Task Completion Requirements
|
||||
|
||||
- All of `bun fmt`, `bun lint`, and `bun typecheck` must pass before considering tasks completed.
|
||||
- If changing native mobile code, `bun lint:mobile` must also pass.
|
||||
- NEVER run `bun test`. Always use `bun run test` (runs Vitest).
|
||||
- `vp check` and `vp run typecheck` must pass before considering tasks completed.
|
||||
- If changing native mobile code, `vp run lint:mobile` must also pass.
|
||||
- Use `vp test` for the built-in Vite+ test command and `vp run test` when you specifically need the `test` package script.
|
||||
|
||||
## Project Snapshot
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ Before local development, prepare the environment and install dependencies:
|
||||
```bash
|
||||
# Optional: only needed if you use mise for dev tool management.
|
||||
mise install
|
||||
bun install .
|
||||
vp install
|
||||
```
|
||||
|
||||
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening an issue or PR.
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
"type": "module",
|
||||
"main": "dist-electron/main.cjs",
|
||||
"scripts": {
|
||||
"dev": "bun run --parallel dev:bundle dev:electron",
|
||||
"dev:bundle": "tsdown --watch",
|
||||
"dev:electron": "node scripts/dev-electron.mjs",
|
||||
"build": "tsdown",
|
||||
"build": "vp pack",
|
||||
"ensure:electron": "node scripts/ensure-electron-runtime.mjs",
|
||||
"start": "node scripts/start-electron.mjs",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"test": "vp test run --passWithNoTests",
|
||||
"smoke-test": "node scripts/smoke-test.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -28,7 +26,8 @@
|
||||
"devDependencies": {
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"tsdown": "catalog:",
|
||||
"cross-env": "^10.1.0",
|
||||
"vite-plus": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"productName": "T3 Code (Alpha)"
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import { createRequire } from "node:module";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { ensureElectronRuntime } from "./ensure-electron-runtime.mjs";
|
||||
|
||||
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
|
||||
const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
|
||||
@@ -129,7 +130,7 @@ function readJson(path) {
|
||||
}
|
||||
|
||||
function buildMacLauncher(electronBinaryPath) {
|
||||
const sourceAppBundlePath = resolve(electronBinaryPath, "../../..");
|
||||
const sourceAppBundlePath = resolve(dirname(electronBinaryPath), "../..");
|
||||
const runtimeDir = join(desktopDir, ".electron-runtime");
|
||||
const targetAppBundlePath = join(runtimeDir, `${APP_DISPLAY_NAME}.app`);
|
||||
const targetBinaryPath = join(targetAppBundlePath, "Contents", "MacOS", "Electron");
|
||||
@@ -163,6 +164,8 @@ function buildMacLauncher(electronBinaryPath) {
|
||||
}
|
||||
|
||||
export function resolveElectronPath() {
|
||||
ensureElectronRuntime();
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const electronBinaryPath = require("electron");
|
||||
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
function getPlatformPath() {
|
||||
switch (process.platform) {
|
||||
case "darwin":
|
||||
return "Electron.app/Contents/MacOS/Electron";
|
||||
case "freebsd":
|
||||
case "openbsd":
|
||||
case "linux":
|
||||
return "electron";
|
||||
case "win32":
|
||||
return "electron.exe";
|
||||
default:
|
||||
throw new Error(`Electron builds are not available on platform: ${process.platform}`);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureExecutable(filePath) {
|
||||
if (process.platform !== "win32") {
|
||||
chmodSync(filePath, 0o755);
|
||||
}
|
||||
}
|
||||
|
||||
function repairPathFile(electronDir, platformPath) {
|
||||
const pathFile = join(electronDir, "path.txt");
|
||||
const currentPath = existsSync(pathFile) ? readFileSync(pathFile, "utf8") : undefined;
|
||||
|
||||
if (currentPath !== platformPath) {
|
||||
writeFileSync(pathFile, platformPath);
|
||||
}
|
||||
}
|
||||
|
||||
function getRequiredRuntimePaths(electronDir, platformPath) {
|
||||
const paths = [join(electronDir, "dist", platformPath)];
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
paths.push(
|
||||
join(electronDir, "dist", "Electron.app", "Contents", "Info.plist"),
|
||||
join(
|
||||
electronDir,
|
||||
"dist",
|
||||
"Electron.app",
|
||||
"Contents",
|
||||
"Frameworks",
|
||||
"Electron Framework.framework",
|
||||
"Electron Framework",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
function isMachO(filePath) {
|
||||
if (process.platform !== "darwin") {
|
||||
return true;
|
||||
}
|
||||
|
||||
const result = spawnSync("file", ["-b", filePath], {
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
return result.status === 0 && result.stdout.includes("Mach-O");
|
||||
}
|
||||
|
||||
function missingRuntimePaths(electronDir, platformPath) {
|
||||
return getRequiredRuntimePaths(electronDir, platformPath).filter((runtimePath) => {
|
||||
return !existsSync(runtimePath);
|
||||
});
|
||||
}
|
||||
|
||||
function invalidRuntimePaths(electronDir, platformPath) {
|
||||
if (process.platform !== "darwin") {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
join(electronDir, "dist", platformPath),
|
||||
join(
|
||||
electronDir,
|
||||
"dist",
|
||||
"Electron.app",
|
||||
"Contents",
|
||||
"Frameworks",
|
||||
"Electron Framework.framework",
|
||||
"Electron Framework",
|
||||
),
|
||||
].filter((runtimePath) => existsSync(runtimePath) && !isMachO(runtimePath));
|
||||
}
|
||||
|
||||
function runChecked(command, args) {
|
||||
const result = spawnSync(command, args, {
|
||||
encoding: "utf8",
|
||||
stdio: "inherit",
|
||||
});
|
||||
|
||||
if (result.status === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`${command} ${args.join(" ")} failed with exit code ${result.status ?? "unknown"}`,
|
||||
);
|
||||
}
|
||||
|
||||
function installElectronRuntime(electronDir, version) {
|
||||
const tempDir = mkdtempSync(join(tmpdir(), "t3-electron-"));
|
||||
const zipPath = join(tempDir, `electron-v${version}-${process.platform}-${process.arch}.zip`);
|
||||
|
||||
try {
|
||||
runChecked("curl", [
|
||||
"-fsSL",
|
||||
`https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-${process.platform}-${process.arch}.zip`,
|
||||
"-o",
|
||||
zipPath,
|
||||
]);
|
||||
if (process.platform === "darwin") {
|
||||
runChecked("ditto", ["-x", "-k", zipPath, join(electronDir, "dist")]);
|
||||
} else {
|
||||
runChecked("python3", [
|
||||
"-c",
|
||||
"import os, sys, zipfile; os.makedirs(sys.argv[2], exist_ok=True); zipfile.ZipFile(sys.argv[1]).extractall(sys.argv[2])",
|
||||
zipPath,
|
||||
join(electronDir, "dist"),
|
||||
]);
|
||||
}
|
||||
} finally {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
export function ensureElectronRuntime() {
|
||||
const electronPackageJsonPath = require.resolve("electron/package.json");
|
||||
const electronPackageJson = JSON.parse(readFileSync(electronPackageJsonPath, "utf8"));
|
||||
const electronDir = dirname(electronPackageJsonPath);
|
||||
const platformPath = getPlatformPath();
|
||||
const electronPath = join(electronDir, "dist", platformPath);
|
||||
const missingBeforeInstall = missingRuntimePaths(electronDir, platformPath);
|
||||
const invalidBeforeInstall = invalidRuntimePaths(electronDir, platformPath);
|
||||
|
||||
if (missingBeforeInstall.length > 0 || invalidBeforeInstall.length > 0) {
|
||||
if (existsSync(join(electronDir, "dist"))) {
|
||||
rmSync(join(electronDir, "dist"), { recursive: true, force: true });
|
||||
}
|
||||
rmSync(join(electronDir, "path.txt"), { force: true });
|
||||
installElectronRuntime(electronDir, electronPackageJson.version);
|
||||
}
|
||||
|
||||
const missingAfterInstall = missingRuntimePaths(electronDir, platformPath);
|
||||
const invalidAfterInstall = invalidRuntimePaths(electronDir, platformPath);
|
||||
if (missingAfterInstall.length > 0 || invalidAfterInstall.length > 0) {
|
||||
throw new Error(
|
||||
`Electron runtime is incomplete after install.\nMissing:\n${missingAfterInstall
|
||||
.map((runtimePath) => `- ${runtimePath}`)
|
||||
.join("\n")}\nInvalid:\n${invalidAfterInstall
|
||||
.map((runtimePath) => `- ${runtimePath}`)
|
||||
.join("\n")}`,
|
||||
);
|
||||
}
|
||||
|
||||
ensureExecutable(electronPath);
|
||||
repairPathFile(electronDir, platformPath);
|
||||
|
||||
return electronPath;
|
||||
}
|
||||
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
const electronPath = ensureElectronRuntime();
|
||||
process.stdout.write(`${electronPath}\n`);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const {
|
||||
appendSwitchMock,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Option from "effect/Option";
|
||||
import type { BrowserWindow } from "electron";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
import * as ElectronDialog from "./ElectronDialog.ts";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Option from "effect/Option";
|
||||
import type * as Electron from "electron";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { buildFromTemplateMock, createFromNamedImageMock, setApplicationMenuMock } = vi.hoisted(
|
||||
() => ({
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import type * as Electron from "electron";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { registerFileProtocolMock, registerSchemesAsPrivilegedMock, unregisterProtocolMock } =
|
||||
vi.hoisted(() => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { openExternalMock, writeTextMock } = vi.hoisted(() => ({
|
||||
openExternalMock: vi.fn(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { onMock, removeListenerMock, themeState } = vi.hoisted(() => ({
|
||||
onMock: vi.fn(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Cause from "effect/Cause";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { autoUpdaterMock } = vi.hoisted(() => ({
|
||||
autoUpdaterMock: {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import type * as Electron from "electron";
|
||||
import { beforeEach, vi } from "vitest";
|
||||
import { beforeEach, vi } from "vite-plus/test";
|
||||
|
||||
const { appFocusMock, getAllWindowsMock } = vi.hoisted(() => ({
|
||||
appFocusMock: vi.fn(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
createInitialDesktopUpdateState,
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as Option from "effect/Option";
|
||||
import * as Ref from "effect/Ref";
|
||||
|
||||
import type * as Electron from "electron";
|
||||
import { vi } from "vitest";
|
||||
import { vi } from "vite-plus/test";
|
||||
|
||||
import * as DesktopAssets from "../app/DesktopAssets.ts";
|
||||
import * as DesktopConfig from "../app/DesktopConfig.ts";
|
||||
|
||||
@@ -5,5 +5,5 @@
|
||||
"types": ["node", "electron"],
|
||||
"lib": ["ESNext", "DOM", "esnext.disposable"]
|
||||
},
|
||||
"include": ["src", "tsdown.config.ts"]
|
||||
"include": ["src", "vite.config.ts"]
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { defineConfig } from "tsdown";
|
||||
|
||||
const shared = {
|
||||
format: "cjs" as const,
|
||||
outDir: "dist-electron",
|
||||
sourcemap: true,
|
||||
outExtensions: () => ({ js: ".cjs" }),
|
||||
};
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
...shared,
|
||||
entry: ["src/main.ts"],
|
||||
clean: true,
|
||||
noExternal: (id) => id.startsWith("@t3tools/"),
|
||||
},
|
||||
{
|
||||
...shared,
|
||||
entry: ["src/preload.ts"],
|
||||
},
|
||||
]);
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": ["dist-electron/**"],
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["t3#build"],
|
||||
"persistent": true,
|
||||
},
|
||||
"start": {
|
||||
"dependsOn": ["build", "@t3tools/web#build", "t3#build"],
|
||||
"cache": false,
|
||||
"persistent": true,
|
||||
},
|
||||
"smoke-test": {
|
||||
"dependsOn": ["build", "@t3tools/web#build", "t3#build"],
|
||||
"cache": false,
|
||||
"outputs": [],
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import { defineConfig } from "vite-plus";
|
||||
|
||||
const shouldLaunchElectronAfterPack = process.env.T3CODE_DESKTOP_DEV === "1";
|
||||
|
||||
export default defineConfig({
|
||||
run: {
|
||||
tasks: {
|
||||
dev: {
|
||||
command: "cross-env T3CODE_DESKTOP_DEV=1 vp pack --watch",
|
||||
dependsOn: ["t3#build"],
|
||||
cache: false,
|
||||
},
|
||||
"dev:bundle": {
|
||||
command: "vp pack --watch",
|
||||
cache: false,
|
||||
},
|
||||
"dev:electron": {
|
||||
command: "node scripts/dev-electron.mjs",
|
||||
dependsOn: ["t3#build"],
|
||||
cache: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
pack: [
|
||||
{
|
||||
format: "cjs",
|
||||
outDir: "dist-electron",
|
||||
sourcemap: true,
|
||||
outExtensions: () => ({ js: ".cjs" }),
|
||||
entry: ["src/main.ts"],
|
||||
clean: true,
|
||||
deps: {
|
||||
alwaysBundle: (id) => id.startsWith("@t3tools/"),
|
||||
},
|
||||
...(shouldLaunchElectronAfterPack ? { onSuccess: "node scripts/dev-electron.mjs" } : {}),
|
||||
},
|
||||
{
|
||||
format: "cjs",
|
||||
outDir: "dist-electron",
|
||||
sourcemap: true,
|
||||
outExtensions: () => ({ js: ".cjs" }),
|
||||
entry: ["src/preload.ts"],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -14,6 +14,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/check": "^0.9.7",
|
||||
"@vercel/config": "^0.3.0",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="astro/client" />
|
||||
@@ -298,9 +298,9 @@ const mobileEndorsementRows = [
|
||||
<div class="open-term-body">
|
||||
<div><span class="prompt">$</span> gh repo fork pingdotgg/t3code --clone</div>
|
||||
<div class="dim">✓ Cloned t3code into ./t3code</div>
|
||||
<div><span class="prompt">$</span> cd t3code && bun install</div>
|
||||
<div><span class="prompt">$</span> cd t3code && vp install</div>
|
||||
<div class="dim">✓ 1 284 packages installed in 4.2s</div>
|
||||
<div><span class="prompt">$</span> bun dev</div>
|
||||
<div><span class="prompt">$</span> vp run dev</div>
|
||||
<div class="dim">▲ T3 Code dev server → <span class="accent">http://localhost:4001</span></div>
|
||||
<div class="cursor"><span class="prompt">$</span><span class="caret"></span></div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { VercelConfig } from "@vercel/config/v1";
|
||||
|
||||
export const config: VercelConfig = {
|
||||
installCommand: "npm install -g vite-plus && vp install --filter '@t3tools/marketing'",
|
||||
buildCommand: "vp run --filter @t3tools/marketing build",
|
||||
outputDirectory: "dist",
|
||||
};
|
||||
+10
-10
@@ -21,25 +21,25 @@ Run commands from `apps/mobile`.
|
||||
Start Metro for the dev client:
|
||||
|
||||
```bash
|
||||
bun run dev:client
|
||||
vp run dev:client
|
||||
```
|
||||
|
||||
Build and run the local iOS dev client:
|
||||
|
||||
```bash
|
||||
bun run ios:dev
|
||||
vp run ios:dev
|
||||
```
|
||||
|
||||
Build and run the local iOS preview app:
|
||||
|
||||
```bash
|
||||
bun run ios:preview
|
||||
vp run ios:preview
|
||||
```
|
||||
|
||||
Force the review diff highlighter engine:
|
||||
|
||||
```bash
|
||||
EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript bun run ios:dev
|
||||
EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript vp run ios:dev
|
||||
```
|
||||
|
||||
`javascript` is the default and recommended setting for the review diff screen. Set `EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=native` only when you explicitly want to test the native Shiki engine.
|
||||
@@ -47,8 +47,8 @@ EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript bun run ios:dev
|
||||
Inspect the resolved Expo config for a variant:
|
||||
|
||||
```bash
|
||||
bun run config:dev
|
||||
bun run config:preview
|
||||
vp run config:dev
|
||||
vp run config:preview
|
||||
```
|
||||
|
||||
Run static checks for mobile native code:
|
||||
@@ -64,18 +64,18 @@ The native lint task runs SwiftLint for Swift plus ktlint and detekt for Kotlin.
|
||||
Create a cloud dev-client build:
|
||||
|
||||
```bash
|
||||
bun run eas:ios:dev
|
||||
vp run eas:ios:dev
|
||||
```
|
||||
|
||||
Create a persistent preview build:
|
||||
|
||||
```bash
|
||||
bun run eas:ios:preview
|
||||
vp run eas:ios:preview
|
||||
```
|
||||
|
||||
Android equivalents:
|
||||
|
||||
```bash
|
||||
bun run eas:android:dev
|
||||
bun run eas:android:preview
|
||||
vp run eas:android:dev
|
||||
vp run eas:android:preview
|
||||
```
|
||||
@@ -31,7 +31,7 @@
|
||||
"config:preview": "APP_VARIANT=preview expo config",
|
||||
"config:prod": "APP_VARIANT=production expo config",
|
||||
"profile:android:hermes": "mkdir -p profiles/review && react-native profile-hermes profiles/review",
|
||||
"test": "vitest run",
|
||||
"test": "vp test run",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { extractPairingUrlFromQrPayload, parsePairingUrl } from "./pairing";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
const expoMocks = vi.hoisted(() => ({
|
||||
requireNativeView: vi.fn(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
countReviewCommentContexts,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
getDefaultReviewExpandedFileIds,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
resolveReviewHighlighterEngine,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { assert, beforeEach, it } from "vitest";
|
||||
import { assert, beforeEach, it } from "vite-plus/test";
|
||||
import { AtomRegistry } from "effect/unstable/reactivity";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
MessageId,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ChangeTypes, FileDiffMetadata } from "@pierre/diffs/types";
|
||||
import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
|
||||
import type { ChangeTypes, FileDiffMetadata } from "@pierre/diffs/types";
|
||||
import type { OrchestrationCheckpointSummary, ReviewDiffPreviewSource } from "@t3tools/contracts";
|
||||
import * as Arr from "effect/Array";
|
||||
import { pipe } from "effect/Function";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { assert, it } from "vitest";
|
||||
import { assert, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
getReviewAsyncStateSnapshot,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { applyDiffRangesToTokens, computeWordAltDiffRanges } from "./reviewWordDiffs";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import type { ReviewRenderableFile } from "./reviewModel";
|
||||
import { highlightReviewFile } from "./shikiReviewHighlighter";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { buildNativeReviewTokensResetKey, hashReviewDiffKey } from "./useNativeReviewDiffBridge";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { resolveTerminalRouteBootstrap } from "./terminalRouteBootstrap";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
const expoMocks = vi.hoisted(() => ({
|
||||
requireNativeView: vi.fn(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { getTerminalBufferReplayKey, getTerminalSurfaceReplayBuffer } from "./terminalBufferReplay";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import type { KnownTerminalSession } from "@t3tools/client-runtime";
|
||||
import { DEFAULT_TERMINAL_ID, EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
DEFAULT_TERMINAL_FONT_SIZE,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { buildGhosttyThemeConfig, getPierreTerminalTheme } from "./terminalTheme";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { beforeEach, describe, expect, it } from "vite-plus/test";
|
||||
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { makeQueuedMessageMetadata, makeTurnCommandMetadata } from "./commandMetadata";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { mobileAuthClientMetadata, redactPairingCredential } from "./connection";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
EventId,
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
"scripts": {
|
||||
"dev": "node --watch src/bin.ts",
|
||||
"build": "node scripts/cli.ts build",
|
||||
"build:bundle": "tsdown",
|
||||
"build:bundle": "vp pack",
|
||||
"start": "node dist/bin.mjs",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
"test": "vp test run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anthropic-ai/claude-agent-sdk": "^0.3.154",
|
||||
@@ -43,7 +43,7 @@
|
||||
"@types/node": "catalog:",
|
||||
"effect-acp": "workspace:*",
|
||||
"effect-codex-app-server": "workspace:*",
|
||||
"tsdown": "catalog:",
|
||||
"vite-plus": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bun
|
||||
#!/usr/bin/env node
|
||||
// @effect-diagnostics nodeBuiltinImport:off
|
||||
import { appendFileSync } from "node:fs";
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
} from "../../../scripts/lib/brand-assets.ts";
|
||||
import { resolveCatalogDependencies } from "../../../scripts/lib/resolve-catalog.ts";
|
||||
import { fromJsonStringPretty } from "@t3tools/shared/schemaJson";
|
||||
import rootPackageJson from "../../../package.json" with { type: "json" };
|
||||
import serverPackageJson from "../package.json" with { type: "json" };
|
||||
import { parse as parseYaml } from "yaml";
|
||||
|
||||
interface PackageJson {
|
||||
name: string;
|
||||
@@ -39,6 +39,11 @@ interface PackageJson {
|
||||
const PackageJsonPrettyJson = fromJsonStringPretty(Schema.Unknown);
|
||||
const encodePackageJson = Schema.encodeEffect(PackageJsonPrettyJson);
|
||||
|
||||
interface WorkspaceConfig {
|
||||
readonly catalog?: Record<string, string>;
|
||||
readonly overrides?: Record<string, string>;
|
||||
}
|
||||
|
||||
class CliError extends Data.TaggedError("CliError")<{
|
||||
readonly message: string;
|
||||
readonly cause?: unknown;
|
||||
@@ -48,6 +53,14 @@ const RepoRoot = Effect.service(Path.Path).pipe(
|
||||
Effect.flatMap((path) => path.fromFileUrl(new URL("../../..", import.meta.url))),
|
||||
);
|
||||
|
||||
const readWorkspaceConfig = Effect.fn("readWorkspaceConfig")(function* () {
|
||||
const path = yield* Path.Path;
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const repoRoot = yield* RepoRoot;
|
||||
const workspaceYaml = yield* fs.readFileString(path.join(repoRoot, "pnpm-workspace.yaml"));
|
||||
return parseYaml(workspaceYaml) as WorkspaceConfig;
|
||||
});
|
||||
|
||||
const runCommand = Effect.fn("runCommand")(function* (command: ChildProcess.Command) {
|
||||
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
||||
const child = yield* spawner.spawn(command);
|
||||
@@ -215,6 +228,9 @@ const publishCmd = Command.make(
|
||||
// Acquire: backup package.json, resolve catalog dependencies, and strip devDependencies/scripts
|
||||
Effect.gen(function* () {
|
||||
const version = Option.getOrElse(config.appVersion, () => serverPackageJson.version);
|
||||
const workspaceConfig = yield* readWorkspaceConfig();
|
||||
const workspaceCatalog = workspaceConfig.catalog ?? {};
|
||||
const workspaceOverrides = workspaceConfig.overrides ?? {};
|
||||
const pkg: PackageJson = {
|
||||
name: serverPackageJson.name,
|
||||
repository: serverPackageJson.repository,
|
||||
@@ -225,12 +241,12 @@ const publishCmd = Command.make(
|
||||
files: serverPackageJson.files,
|
||||
dependencies: resolveCatalogDependencies(
|
||||
serverPackageJson.dependencies,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
workspaceCatalog,
|
||||
"apps/server",
|
||||
),
|
||||
overrides: resolveCatalogDependencies(
|
||||
rootPackageJson.overrides,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
workspaceOverrides,
|
||||
workspaceCatalog,
|
||||
"apps/server",
|
||||
),
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
createAttachmentId,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { deriveAuthClientMetadata } from "./utils.ts";
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
import * as TestClock from "effect/testing/TestClock";
|
||||
import { vi } from "vitest";
|
||||
import { vi } from "vite-plus/test";
|
||||
|
||||
import { readBootstrapEnvelope, resolveFdPath } from "./bootstrap.ts";
|
||||
import { assertNone, assertSome } from "@effect/vitest/utils";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { parseTurnDiffFilesFromUnifiedDiff } from "./Diffs.ts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parsePatchFiles } from "@pierre/diffs";
|
||||
import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
|
||||
|
||||
export interface TurnDiffFileSummary {
|
||||
readonly path: string;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CheckpointRef, ProjectId, ThreadId, TurnId } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
ProjectionSnapshotQuery,
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as FileSystem from "effect/FileSystem";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as PlatformError from "effect/PlatformError";
|
||||
import * as Scope from "effect/Scope";
|
||||
import { describe, expect } from "vitest";
|
||||
import { describe, expect } from "vite-plus/test";
|
||||
|
||||
import { checkpointRefForThreadTurn } from "../Utils.ts";
|
||||
import { CheckpointStoreLive } from "./CheckpointStore.ts";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
import * as Layer from "effect/Layer";
|
||||
import { vi } from "vitest";
|
||||
import { vi } from "vite-plus/test";
|
||||
|
||||
import { ProcessRunner, ProcessSpawnError, type ProcessRunnerShape } from "../../processRunner.ts";
|
||||
import { resolveServerEnvironmentLabel } from "./ServerEnvironmentLabel.ts";
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as Layer from "effect/Layer";
|
||||
import * as PlatformError from "effect/PlatformError";
|
||||
import * as Scope from "effect/Scope";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
import { expect } from "vitest";
|
||||
import { expect } from "vite-plus/test";
|
||||
import type {
|
||||
GitActionProgressEvent,
|
||||
GitPreparePullRequestThreadInput,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { isLoopbackHostname, resolveDevRedirectUrl } from "./http.ts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { inferImageExtension, parseBase64DataUrl } from "./imageMime.ts";
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { CheckpointStoreLive } from "../../checkpointing/Layers/CheckpointStore.ts";
|
||||
import { CheckpointStore } from "../../checkpointing/Services/CheckpointStore.ts";
|
||||
|
||||
@@ -17,7 +17,7 @@ import * as Metric from "effect/Metric";
|
||||
import * as Option from "effect/Option";
|
||||
import * as Queue from "effect/Queue";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { PersistenceSqlError } from "../../persistence/Errors.ts";
|
||||
import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts";
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as Exit from "effect/Exit";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import * as Scope from "effect/Scope";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { CheckpointReactor } from "../Services/CheckpointReactor.ts";
|
||||
import { ProviderCommandReactor } from "../Services/ProviderCommandReactor.ts";
|
||||
|
||||
@@ -28,7 +28,7 @@ import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { deriveServerPaths, ServerConfig } from "../../config.ts";
|
||||
import { TextGenerationError } from "@t3tools/contracts";
|
||||
|
||||
@@ -30,7 +30,7 @@ import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { OrchestrationEventStoreLive } from "../../persistence/Layers/OrchestrationEventStore.ts";
|
||||
import { OrchestrationCommandReceiptRepositoryLive } from "../../persistence/Layers/OrchestrationCommandReceipts.ts";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ThreadId } from "@t3tools/contracts";
|
||||
import * as Cause from "effect/Cause";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { logCleanupCauseUnlessInterrupted } from "./ThreadDeletionReactor.ts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import {
|
||||
MessageId,
|
||||
CommandId,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type OrchestrationEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { createEmptyReadModel, projectEvent } from "./projector.ts";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @effect-diagnostics nodeBuiltinImport:off
|
||||
import { homedir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { expandHomePath } from "./pathExpansion.ts";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ProjectId, type OrchestrationProject } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import { TerminalManager } from "../../terminal/Services/Manager.ts";
|
||||
|
||||
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
||||
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { describe, it } from "vitest";
|
||||
import { describe, it } from "vite-plus/test";
|
||||
import { ThreadId } from "@t3tools/contracts";
|
||||
import * as CodexErrors from "effect-codex-app-server/errors";
|
||||
import * as CodexRpc from "effect-codex-app-server/rpc";
|
||||
|
||||
@@ -37,7 +37,8 @@ class CursorAdapter extends Context.Service<CursorAdapter, CursorAdapterShape>()
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const mockAgentPath = path.join(__dirname, "../../../scripts/acp-mock-agent.ts");
|
||||
const bunExe = "bun";
|
||||
const mockAgentCommand = "node";
|
||||
const mockAgentArgs = [mockAgentPath] as const;
|
||||
|
||||
async function makeMockAgentWrapper(
|
||||
extraEnv?: Record<string, string>,
|
||||
@@ -51,7 +52,7 @@ async function makeMockAgentWrapper(
|
||||
const script = `#!/bin/sh
|
||||
${envExports}
|
||||
${options?.initialDelaySeconds ? `sleep ${JSON.stringify(String(options.initialDelaySeconds))}` : ""}
|
||||
exec ${JSON.stringify(bunExe)} ${JSON.stringify(mockAgentPath)} "$@"
|
||||
exec ${JSON.stringify(mockAgentCommand)} ${mockAgentArgs.map((arg) => JSON.stringify(arg)).join(" ")} "$@"
|
||||
`;
|
||||
await writeFile(wrapperPath, script, "utf8");
|
||||
await chmod(wrapperPath, 0o755);
|
||||
@@ -73,7 +74,7 @@ printf '%s\t' "$@" >> ${JSON.stringify(argvLogPath)}
|
||||
printf '\n' >> ${JSON.stringify(argvLogPath)}
|
||||
export T3_ACP_REQUEST_LOG_PATH=${JSON.stringify(requestLogPath)}
|
||||
${envExports}
|
||||
exec ${JSON.stringify(bunExe)} ${JSON.stringify(mockAgentPath)} "$@"
|
||||
exec ${JSON.stringify(mockAgentCommand)} ${mockAgentArgs.map((arg) => JSON.stringify(arg)).join(" ")} "$@"
|
||||
`;
|
||||
await writeFile(wrapperPath, script, "utf8");
|
||||
await chmod(wrapperPath, 0o755);
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
import * as Path from "effect/Path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import type * as EffectAcpSchema from "effect-acp/schema";
|
||||
import type { CursorSettings } from "@t3tools/contracts";
|
||||
import { createModelCapabilities } from "@t3tools/shared/model";
|
||||
@@ -68,16 +68,13 @@ const makeMockAgentWrapper = Effect.fn("makeMockAgentWrapper")(function* (
|
||||
prefix: "cursor-provider-mock-",
|
||||
});
|
||||
const wrapperPath = path.join(dir, "fake-agent.sh");
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
const bunCommand = JSON.stringify("bun");
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
const mockAgentPathJson = JSON.stringify(mockAgentPath);
|
||||
const mockAgentCommand = ["node", mockAgentPath].map((arg) => JSON.stringify(arg)).join(" ");
|
||||
const envExports = Object.entries(extraEnv ?? {})
|
||||
.map(([key, value]) => `export ${key}=${JSON.stringify(value)}`)
|
||||
.join("\n");
|
||||
const script = `#!/bin/sh
|
||||
${envExports}
|
||||
exec ${bunCommand} ${mockAgentPathJson} "$@"
|
||||
exec ${mockAgentCommand} "$@"
|
||||
`;
|
||||
yield* fileSystem.writeFileString(wrapperPath, script);
|
||||
yield* fileSystem.chmod(wrapperPath, 0o755);
|
||||
@@ -93,17 +90,14 @@ const makeMockAgentWithAboutWrapper = Effect.fn("makeMockAgentWithAboutWrapper")
|
||||
prefix: "cursor-provider-about-mock-",
|
||||
});
|
||||
const wrapperPath = path.join(dir, "fake-agent.sh");
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
const bunCommand = JSON.stringify("bun");
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
const mockAgentPathJson = JSON.stringify(mockAgentPath);
|
||||
const mockAgentCommand = ["node", mockAgentPath].map((arg) => JSON.stringify(arg)).join(" ");
|
||||
const script = `#!/bin/sh
|
||||
if [ "$1" = "about" ]; then
|
||||
printf 'CLI Version 2026.04.09-f2b0fcd\\n'
|
||||
printf 'User Email [email protected]\\n'
|
||||
exit 0
|
||||
fi
|
||||
exec ${bunCommand} ${mockAgentPathJson} "$@"
|
||||
exec ${mockAgentCommand} "$@"
|
||||
`;
|
||||
yield* fileSystem.writeFileString(wrapperPath, script);
|
||||
yield* fileSystem.chmod(wrapperPath, 0o755);
|
||||
|
||||
@@ -45,6 +45,9 @@ import {
|
||||
import { AcpSessionRuntime } from "../acp/AcpSessionRuntime.ts";
|
||||
import { CursorListAvailableModelsResponse } from "../acp/CursorAcpExtension.ts";
|
||||
|
||||
const decodeCursorListAvailableModelsResponse = Schema.decodeUnknownEffect(
|
||||
CursorListAvailableModelsResponse,
|
||||
);
|
||||
const PROVIDER = ProviderDriverKind.make("cursor");
|
||||
const CURSOR_PRESENTATION = {
|
||||
displayName: "Cursor",
|
||||
@@ -547,9 +550,7 @@ const discoverCursorModelsViaListAvailableModels = (
|
||||
Effect.gen(function* () {
|
||||
yield* acp.start();
|
||||
const response = yield* acp.request("cursor/list_available_models", {});
|
||||
const decoded = yield* Schema.decodeUnknownEffect(CursorListAvailableModelsResponse)(
|
||||
response,
|
||||
);
|
||||
const decoded = yield* decodeCursorListAvailableModelsResponse(response);
|
||||
return buildCursorDiscoveredModelsFromAvailableModelsResponse(decoded);
|
||||
}),
|
||||
environment,
|
||||
|
||||
@@ -11,7 +11,7 @@ import * as Schema from "effect/Schema";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import * as TestClock from "effect/testing/TestClock";
|
||||
import { beforeEach } from "vitest";
|
||||
import { beforeEach } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
OpenCodeSettings,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { beforeEach } from "vitest";
|
||||
import { beforeEach } from "vite-plus/test";
|
||||
|
||||
import { OpenCodeSettings } from "@t3tools/contracts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
|
||||
@@ -1131,6 +1131,11 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
const initialCheckedAt = initialCodex?.checkedAt;
|
||||
assert.notStrictEqual(initialCheckedAt, undefined);
|
||||
|
||||
// The rebuilt instance may re-probe synchronously during the
|
||||
// settings update. Advance the TestClock first so `checkedAt`
|
||||
// can safely act as the fresh-probe marker this assertion uses.
|
||||
yield* TestClock.adjust("1 second");
|
||||
|
||||
// Drive a settings change. The Hydration layer's
|
||||
// `SettingsWatcherLive` consumes this via `streamChanges`,
|
||||
// calls `reconcile`, which rebuilds the codex instance (the
|
||||
|
||||
@@ -15,7 +15,7 @@ import * as ManagedRuntime from "effect/ManagedRuntime";
|
||||
import * as Option from "effect/Option";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { ProjectionSnapshotQuery } from "../../orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import { SqlitePersistenceMemory } from "../../persistence/Layers/Sqlite.ts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { mergeProviderInstanceEnvironment } from "./ProviderInstanceEnvironment.ts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import * as EffectAcpErrors from "effect-acp/errors";
|
||||
import { ProviderDriverKind } from "@t3tools/contracts";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ProviderDriverKind, RuntimeRequestId, TurnId } from "@t3tools/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
makeAcpAssistantItemEvent,
|
||||
|
||||
@@ -8,14 +8,15 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { describe, expect } from "vitest";
|
||||
import { describe, expect } from "vite-plus/test";
|
||||
|
||||
import { AcpSessionRuntime, type AcpSessionRequestLogEvent } from "./AcpSessionRuntime.ts";
|
||||
import type * as EffectAcpProtocol from "effect-acp/protocol";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const mockAgentPath = path.join(__dirname, "../../../scripts/acp-mock-agent.ts");
|
||||
const bunExe = "bun";
|
||||
const mockAgentCommand = "node";
|
||||
const mockAgentArgs = [mockAgentPath];
|
||||
|
||||
describe("AcpSessionRuntime", () => {
|
||||
it.effect("merges custom initialize client capabilities into the ACP handshake", () => {
|
||||
@@ -39,8 +40,8 @@ describe("AcpSessionRuntime", () => {
|
||||
Effect.provide(
|
||||
AcpSessionRuntime.layer({
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
},
|
||||
cwd: process.cwd(),
|
||||
clientCapabilities: {
|
||||
@@ -99,8 +100,8 @@ describe("AcpSessionRuntime", () => {
|
||||
Effect.provide(
|
||||
AcpSessionRuntime.layer({
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
},
|
||||
cwd: process.cwd(),
|
||||
clientInfo: { name: "t3-test", version: "0.0.0" },
|
||||
@@ -157,8 +158,8 @@ describe("AcpSessionRuntime", () => {
|
||||
Effect.provide(
|
||||
AcpSessionRuntime.layer({
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
env: {
|
||||
T3_ACP_EMIT_INTERLEAVED_ASSISTANT_TOOL_CALLS: "1",
|
||||
},
|
||||
@@ -195,8 +196,8 @@ describe("AcpSessionRuntime", () => {
|
||||
Effect.provide(
|
||||
AcpSessionRuntime.layer({
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
env: {
|
||||
T3_ACP_EMIT_GENERIC_TOOL_PLACEHOLDERS: "1",
|
||||
},
|
||||
@@ -247,8 +248,8 @@ describe("AcpSessionRuntime", () => {
|
||||
AcpSessionRuntime.layer({
|
||||
authMethodId: "test",
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
},
|
||||
cwd: process.cwd(),
|
||||
clientInfo: { name: "t3-test", version: "0.0.0" },
|
||||
@@ -282,8 +283,8 @@ describe("AcpSessionRuntime", () => {
|
||||
AcpSessionRuntime.layer({
|
||||
authMethodId: "test",
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
},
|
||||
cwd: process.cwd(),
|
||||
clientInfo: { name: "t3-test", version: "0.0.0" },
|
||||
@@ -325,8 +326,8 @@ describe("AcpSessionRuntime", () => {
|
||||
AcpSessionRuntime.layer({
|
||||
authMethodId: "test",
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
},
|
||||
cwd: process.cwd(),
|
||||
clientInfo: { name: "t3-test", version: "0.0.0" },
|
||||
@@ -379,8 +380,8 @@ describe("AcpSessionRuntime", () => {
|
||||
AcpSessionRuntime.layer({
|
||||
authMethodId: "test",
|
||||
spawn: {
|
||||
command: bunExe,
|
||||
args: [mockAgentPath],
|
||||
command: mockAgentCommand,
|
||||
args: mockAgentArgs,
|
||||
env: {
|
||||
T3_ACP_REQUEST_LOG_PATH: requestLogPath,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import type * as EffectAcpSchema from "effect-acp/schema";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it } from "@effect/vitest";
|
||||
import * as Console from "effect/Console";
|
||||
import * as Effect from "effect/Effect";
|
||||
import { describe, expect } from "vitest";
|
||||
import { describe, expect } from "vite-plus/test";
|
||||
import type * as EffectAcpSchema from "effect-acp/schema";
|
||||
|
||||
import { AcpSessionRuntime } from "./AcpSessionRuntime.ts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import {
|
||||
CursorListAvailableModelsResponse,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Effect from "effect/Effect";
|
||||
import type * as EffectAcpSchema from "effect-acp/schema";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { applyCursorAcpModelSelection, buildCursorAcpSpawnInput } from "./CursorAcpSupport.ts";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import { ProviderDriverKind, type ModelCapabilities } from "@t3tools/contracts";
|
||||
import { createModelCapabilities } from "@t3tools/shared/model";
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import {
|
||||
import { OtlpSerialization, OtlpTracer } from "effect/unstable/observability";
|
||||
import { RpcClient, RpcSerialization } from "effect/unstable/rpc";
|
||||
import * as Socket from "effect/unstable/socket/Socket";
|
||||
import { vi } from "vitest";
|
||||
import { vi } from "vite-plus/test";
|
||||
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import * as Ref from "effect/Ref";
|
||||
import * as Schedule from "effect/Schedule";
|
||||
import * as Scope from "effect/Scope";
|
||||
import { TestClock } from "effect/testing";
|
||||
import { expect } from "vitest";
|
||||
import { expect } from "vite-plus/test";
|
||||
|
||||
import * as ProcessRunner from "../../processRunner.ts";
|
||||
import type { TerminalManagerShape } from "../Services/Manager.ts";
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as Layer from "effect/Layer";
|
||||
import * as Path from "effect/Path";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { createModelSelection } from "@t3tools/shared/model";
|
||||
import { expect } from "vitest";
|
||||
import { expect } from "vite-plus/test";
|
||||
|
||||
import { ServerConfig } from "../config.ts";
|
||||
import { type TextGenerationShape } from "./TextGeneration.ts";
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as Path from "effect/Path";
|
||||
import * as Result from "effect/Result";
|
||||
import * as Schema from "effect/Schema";
|
||||
import { createModelSelection } from "@t3tools/shared/model";
|
||||
import { expect } from "vitest";
|
||||
import { expect } from "vite-plus/test";
|
||||
|
||||
import { CodexSettings, ProviderInstanceId, TextGenerationError } from "@t3tools/contracts";
|
||||
|
||||
|
||||
Loaded 100 of 299 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user