Skip to content

Commit c2ccc99

Browse files
committed
chore: sync with upstream pingdotgg/t3code main
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
2 parents eb6fcb3 + 1d1bf50 commit c2ccc99

1,630 files changed

Lines changed: 168020 additions & 40798 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.coderabbit.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
reviews:
22
review_status: false
33
auto_review:
4-
enabled: false
4+
enabled: true

‎.devcontainer/devcontainer.json‎

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,73 @@
1+
// Dev container for T3 Code. Mirrors CI (ubuntu-24.04, Node 24, Rust stable)
2+
// and the canonical setup in docs/operations/development.md: global `vp`, `vp i`.
3+
// Contributor doc: docs/internals/devcontainer.md
14
{
2-
"name": "T3 Code Dev",
3-
"image": "debian:bookworm",
5+
"name": "T3 Code",
6+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
47
"features": {
5-
"ghcr.io/devcontainers/features/git:1": {},
6-
"ghcr.io/devcontainers-extra/features/bun:1": {
7-
"version": "1.3.11"
8+
// nodeGypDependencies (default true) brings python3/make/g++, which Linux
9+
// needs for node-pty's node-gyp fallback (its prebuilds are mac/win only).
10+
"ghcr.io/devcontainers/features/node:2": {
11+
"version": "24"
812
},
9-
"ghcr.io/devcontainers/features/node:1": {
10-
"version": "24.13.1"
11-
},
12-
"ghcr.io/devcontainers/features/python:1": {
13-
"version": "3.10",
14-
"installTools": false
15-
}
13+
// native/resource-monitor (edition 2024, needs stable >= 1.85). The server
14+
// degrades gracefully without the binary, but CI checks cargo fmt + test.
15+
"ghcr.io/devcontainers/features/rust:1": {},
16+
"ghcr.io/devcontainers/features/github-cli:1": {}
17+
},
18+
"hostRequirements": {
19+
"cpus": 4,
20+
"memory": "8gb",
21+
"storage": "32gb"
22+
},
23+
"containerEnv": {
24+
// Keep all runtime state inside the (gitignored) workspace .t3, matching
25+
// the worktree default. An explicit --home-dir still wins.
26+
"T3CODE_HOME": "${containerWorkspaceFolder}/.t3"
1627
},
17-
"overrideFeatureInstallOrder": [
18-
"ghcr.io/devcontainers/features/git",
19-
"ghcr.io/devcontainers-extra/features/bun"
28+
"mounts": [
29+
// vp keeps the pnpm content-addressable store and metadata cache under
30+
// ~/.cache/pnpm (verified: the v11 store dir lives there); mounting a
31+
// volume there lets installs survive container rebuilds.
32+
"source=t3code-pnpm-store,target=/home/vscode/.cache/pnpm,type=volume",
33+
// Root node_modules holds the whole pnpm virtual store (.pnpm), so one
34+
// volume keeps the heavy tree off the slow macOS/Windows bind mount.
35+
// Scoped by devcontainerId so parallel checkouts do not share it.
36+
// Codespaces note: prebuild snapshots exclude volumes; drop these mounts
37+
// if prebuilt codespaces become the primary workflow.
38+
"source=t3code-node-modules-${devcontainerId},target=${containerWorkspaceFolder}/node_modules,type=volume"
2039
],
21-
"postCreateCommand": {
22-
"bun-install": "bun install --backend=copyfile --frozen-lockfile"
40+
"onCreateCommand": "bash .devcontainer/on-create.sh",
41+
"updateContentCommand": "bash .devcontainer/update-content.sh",
42+
"forwardPorts": [5733, 13773],
43+
"portsAttributes": {
44+
"5733": {
45+
"label": "t3 web (open via the pairing URL, not the bare origin)",
46+
"onAutoForward": "notify"
47+
},
48+
"13773": {
49+
"label": "t3 server",
50+
"onAutoForward": "silent"
51+
}
2352
},
2453
"customizations": {
54+
"codespaces": {
55+
"openFiles": ["docs/internals/devcontainer.md"]
56+
},
2557
"vscode": {
26-
"extensions": ["oxc.oxc-vscode"]
58+
"extensions": ["oxc.oxc-vscode", "rust-lang.rust-analyzer"],
59+
"settings": {
60+
// .repos is a large vendored read-only reference tree; watching it
61+
// burns CPU and file handles.
62+
"files.watcherExclude": {
63+
"**/.repos/**": true,
64+
"**/.t3/**": true
65+
},
66+
"search.exclude": {
67+
"**/.repos": true
68+
}
69+
}
2770
}
28-
}
71+
},
72+
"remoteUser": "vscode"
2973
}

‎.devcontainer/on-create.sh‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
# One-time container setup, baked into prebuilds. Content-dependent work
3+
# (dependency install, Chromium) lives in update-content.sh.
4+
set -euo pipefail
5+
6+
# The Vite+ CLI is the repo task runner (vp i, vp run dev, vp test run).
7+
# Download to a file first: a curl failure inside $( ) would yield an empty
8+
# script and a false success. VP_NODE_MANAGER=no skips the installer's node
9+
# shims; Node comes from the devcontainer feature. The VP_*_DIR group (set
10+
# together, absolute) pins the install location instead of the installer's
11+
# XDG platform defaults, which moved the binary from ~/.vite-plus/bin to
12+
# ~/.local/share/vite-plus/bin between releases and would break the check
13+
# below either way.
14+
export VP_BIN_DIR="$HOME/.local/share/vite-plus/bin"
15+
export VP_DATA_DIR="$HOME/.local/share/vite-plus"
16+
export VP_CACHE_DIR="$HOME/.cache/vite-plus"
17+
installer=$(mktemp)
18+
curl -fsSL https://vite.plus -o "$installer"
19+
VP_NODE_MANAGER=no bash "$installer"
20+
rm -f "$installer"
21+
22+
# Non-login lifecycle shells never source the profile the installer edits,
23+
# so expose vp on the default PATH. test -x keeps a bad install loud.
24+
test -x "$VP_BIN_DIR/vp"
25+
sudo ln -sf "$VP_BIN_DIR/vp" /usr/local/bin/vp
26+
27+
# First-run terminal notice, rendered by the devcontainers base image.
28+
sudo mkdir -p /usr/local/etc/vscode-dev-containers
29+
sudo tee /usr/local/etc/vscode-dev-containers/first-run-notice.txt >/dev/null <<'EOF'
30+
T3 Code devcontainer
31+
32+
vp run dev start server + web, then open the pairing URL it
33+
prints (the bare forwarded port will not authenticate)
34+
cp .env.example .env optional: enable T3 Connect cloud features
35+
(public identifiers, not secrets)
36+
37+
Details: docs/internals/devcontainer.md
38+
EOF

‎.devcontainer/update-content.sh‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Runs at creation and on every prebuild content refresh, so codespaces start
3+
# with deps installed and caches warm. Everything here is idempotent.
4+
set -euo pipefail
5+
6+
# Volume mounts (pnpm store, node_modules) and the directories docker creates
7+
# for them arrive root-owned; hand them to the dev user before installing.
8+
for dir in "$HOME/.cache" "$HOME/.cache/pnpm" node_modules; do
9+
if [ -d "$dir" ] && [ "$(stat -c %U "$dir")" != "$(id -un)" ]; then
10+
sudo chown "$(id -un):$(id -gn)" "$dir"
11+
fi
12+
done
13+
14+
CI=true vp i
15+
# Repairs electron's path.txt and exec bits after install, same as CI.
16+
vp run --filter @t3tools/desktop ensure:electron
17+
# Pre-warms Vite's dep optimizer (cache is keyed on the absolute path, which
18+
# is stable inside the container).
19+
node apps/web/scripts/warm-dep-cache.ts

‎.gitattributes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# git autocrlf=true converts LF to CRLF on Windows, causing issues with oxfmt
22
* text=auto eol=lf
3+
# Batch files need CRLF for cmd.exe to parse them reliably.
4+
*.cmd text eol=crlf
5+
*.bat text eol=crlf

‎.github/SECURITY.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Security policy
2+
3+
Report security vulnerabilities affecting T3 Code or T3 Tools-operated infrastructure to
4+
[security@ping.gg](mailto:security@ping.gg). Please do not disclose them publicly until we have had
5+
a reasonable opportunity to investigate and remediate them.
6+
7+
See the [full security policy](https://t3.codes/security-policy) for reporting details, scope,
8+
and safe harbor terms for good-faith research.

‎.github/VOUCHED.td‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,28 @@
1212
github:0x4bs3nt
1313
github:Adamulek123
1414
github:adityavardhansharma
15+
github:aoright
1516
github:arhxam
1617
github:bil0000
1718
github:binbandit
1819
github:Brechard
20+
github:btsouth
1921
github:chrisdeeming
2022
github:chuks-qua
2123
github:cursoragent
2224
github:D3OXY
25+
github:dbalders
2326
github:eggfriedrice24
2427
github:extoci
28+
github:flamboh
29+
github:FllipEis
2530
github:gbarros-dev
2631
github:gfsaaser24
2732
github:github-actions[bot]
2833
github:gsimone
2934
github:GuilhermeVieiraDev
3035
github:hwanseoc
36+
github:inayayousfi
3137
github:ipanasenko
3238
github:jakeleventhal
3339
github:jamesx0416
@@ -36,13 +42,18 @@ github:jasonLaster
3642
github:JoeEverest
3743
github:justsomelegs
3844
github:kridaydave
45+
github:lgwacker
3946
github:lnieuwenhuis
4047
github:Lucenx9
4148
github:mackinleysmith
4249
github:maria-rcks
50+
github:MatthewFeroz
4351
github:maxwellyoung
4452
github:mwolson
53+
github:myacoub91
54+
github:naMqe-h
4555
github:nateEc
56+
github:naveed949
4657
github:nmggithub
4758
github:Noojuno
4859
github:notkainoa
@@ -64,6 +75,7 @@ github:tarik02
6475
github:tris203
6576
github:tsouth89
6677
github:UtkarshUsername
78+
github:vitalyiegorov
6779
github:Yash-Singh1
6880
github:yashranaway
6981
github:Ymit24
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup APT mirrors
2+
description: Configure Ubuntu package downloads with automatic mirror failover.
3+
runs:
4+
using: composite
5+
steps:
6+
- shell: bash
7+
run: |
8+
# Replace the existing Blacksmith mirror list as well as direct sources.
9+
printf '%s\tpriority:%s\n' \
10+
https://archive.ubuntu.com/ubuntu 1 \
11+
https://mirrors.edge.kernel.org/ubuntu 2 \
12+
https://mirror.math.princeton.edu/pub/ubuntu 3 \
13+
| sudo tee /etc/apt/blacksmith-ubuntu-mirrors.txt > /dev/null
14+
15+
# APT's mirror transport retries each file against the next server.
16+
sudo find /etc/apt -maxdepth 2 -type f \( -name '*.list' -o -name '*.sources' \) \
17+
-exec sed -i -E \
18+
's#https?://(([^/]+\.)?archive|security)\.ubuntu\.com/ubuntu/?#mirror+file:/etc/apt/blacksmith-ubuntu-mirrors.txt#g' {} +
19+
20+
# Move on to a fallback before an unreachable server exhausts the job.
21+
printf '%s\n' 'Acquire::http::Timeout "15";' 'Acquire::https::Timeout "15";' \
22+
| sudo tee /etc/apt/apt.conf.d/80-mirror-timeouts > /dev/null
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
const MINIMUM_RELEASE_GAP_MS = 6 * 60 * 60 * 1000;
2+
3+
const isNightlyTag = (tag) => /^v.*-nightly\./.test(tag) || tag.startsWith("nightly-v");
4+
5+
// Newest published nightly by publication time, or undefined when none exists.
6+
async function findLatestNightly({ github, context }) {
7+
const releases = await github.paginate(github.rest.repos.listReleases, {
8+
...context.repo,
9+
per_page: 100,
10+
});
11+
return releases
12+
.filter((release) => !release.draft && release.published_at && isNightlyTag(release.tag_name))
13+
.sort((a, b) => Date.parse(b.published_at) - Date.parse(a.published_at))[0];
14+
}
15+
16+
// Runs after the workflow acquires the nightly concurrency lock.
17+
async function shouldReleaseNightly({ github, context, core, now = Date.now() }) {
18+
const lastNightly = await findLatestNightly({ github, context });
19+
20+
if (!lastNightly) {
21+
core.info("No published nightly found. Proceeding with release.");
22+
return true;
23+
}
24+
25+
if (now - Date.parse(lastNightly.published_at) < MINIMUM_RELEASE_GAP_MS) {
26+
core.info(`Nightly ${lastNightly.tag_name} was published less than six hours ago. Skipping.`);
27+
return false;
28+
}
29+
30+
const { data: comparison } = await github.rest.repos.compareCommitsWithBasehead({
31+
...context.repo,
32+
basehead: `${lastNightly.tag_name}...${context.sha}`,
33+
per_page: 1,
34+
});
35+
if (comparison.status !== "ahead") {
36+
core.info(
37+
`Candidate commit is ${comparison.status} relative to ${lastNightly.tag_name}. Skipping.`,
38+
);
39+
return false;
40+
}
41+
42+
core.info(`New commits since ${lastNightly.tag_name}, and the six-hour gap has passed.`);
43+
return true;
44+
}
45+
46+
// Stable releases build the commit the latest nightly shipped, so the stable
47+
// build is one nightly users already ran. Returns the nightly tag, its commit,
48+
// and the stable version that nightly was a preview of.
49+
async function resolveLatestNightlyCommit({ github, context, core }) {
50+
const lastNightly = await findLatestNightly({ github, context });
51+
if (!lastNightly) {
52+
throw new Error("No published nightly found. Stable releases build the latest nightly commit.");
53+
}
54+
55+
const tag = lastNightly.tag_name;
56+
// repos.getCommit dereferences annotated tags, so this is the commit either way.
57+
const { data: commit } = await github.rest.repos.getCommit({ ...context.repo, ref: tag });
58+
const version = /^(?:nightly-)?v(\d+\.\d+\.\d+)-nightly\./.exec(tag)?.[1];
59+
if (!version) {
60+
throw new Error(`Cannot derive a stable version from nightly tag ${tag}.`);
61+
}
62+
63+
core.info(`Latest nightly ${tag} shipped ${commit.sha} as a preview of ${version}.`);
64+
return { tag, sha: commit.sha, version };
65+
}
66+
67+
module.exports = { shouldReleaseNightly, resolveLatestNightlyCommit };

0 commit comments

Comments
 (0)