Skip to content

Commit f5081b0

Browse files
authored
Merge branch 'main' into feat/diff-header-open-in-editor
2 parents 93f203c + 1d1bf50 commit f5081b0

319 files changed

Lines changed: 20164 additions & 5764 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

‎.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+
[[email protected]](mailto:[email protected]). 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/scripts/check-nightly-release.cjs‎

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
const MINIMUM_RELEASE_GAP_MS = 6 * 60 * 60 * 1000;
22

3-
// Runs after the workflow acquires the nightly concurrency lock.
4-
async function shouldReleaseNightly({ github, context, core, now = Date.now() }) {
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 }) {
57
const releases = await github.paginate(github.rest.repos.listReleases, {
68
...context.repo,
79
per_page: 100,
810
});
9-
const lastNightly = releases
10-
.filter(
11-
(release) =>
12-
!release.draft &&
13-
release.published_at &&
14-
(/^v.*-nightly\./.test(release.tag_name) || release.tag_name.startsWith("nightly-v")),
15-
)
11+
return releases
12+
.filter((release) => !release.draft && release.published_at && isNightlyTag(release.tag_name))
1613
.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 });
1719

1820
if (!lastNightly) {
1921
core.info("No published nightly found. Proceeding with release.");
@@ -41,4 +43,25 @@ async function shouldReleaseNightly({ github, context, core, now = Date.now() })
4143
return true;
4244
}
4345

44-
module.exports = { shouldReleaseNightly };
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 };

‎.github/scripts/check-nightly-release.test.cjs‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,45 @@ for (const status of ["behind", "diverged"]) {
9999
assert.equal(await shouldReleaseNightly(options), false);
100100
});
101101
}
102+
103+
const { resolveLatestNightlyCommit } = require("./check-nightly-release.cjs");
104+
105+
function nightlyCommitFixture({ releases, commitSha = "abc123" }) {
106+
const refs = [];
107+
const { options } = fixture({ releases });
108+
options.github.rest.repos.getCommit = async ({ ref }) => {
109+
refs.push(ref);
110+
return { data: { sha: commitSha } };
111+
};
112+
return { options, refs };
113+
}
114+
115+
test("stable releases resolve the commit of the newest published nightly", async () => {
116+
const { options, refs } = nightlyCommitFixture({
117+
releases: [
118+
nightly(10, { tag_name: "v1.0.1-nightly.20260905.100" }),
119+
nightly(1, { tag_name: "v1.0.1-nightly.20260905.123" }),
120+
nightly(0, { tag_name: "v1.0.0" }),
121+
nightly(0, { draft: true, tag_name: "v1.0.1-nightly.20260905.999" }),
122+
],
123+
commitSha: "deadbeef",
124+
});
125+
assert.deepEqual(await resolveLatestNightlyCommit(options), {
126+
tag: "v1.0.1-nightly.20260905.123",
127+
sha: "deadbeef",
128+
version: "1.0.1",
129+
});
130+
assert.deepEqual(refs, ["v1.0.1-nightly.20260905.123"]);
131+
});
132+
133+
test("stable releases derive the version from legacy nightly tags", async () => {
134+
const { options } = nightlyCommitFixture({
135+
releases: [nightly(1, { tag_name: "nightly-v0.9.0-nightly.20260905.5" })],
136+
});
137+
assert.equal((await resolveLatestNightlyCommit(options)).version, "0.9.0");
138+
});
139+
140+
test("stable releases fail without a published nightly", async () => {
141+
const { options } = nightlyCommitFixture({ releases: [nightly(0, { tag_name: "v1.0.0" })] });
142+
await assert.rejects(resolveLatestNightlyCommit(options), /No published nightly/);
143+
});

0 commit comments

Comments
 (0)