Skip to content

Commit ff11a0e

Browse files
authored
Merge branch 'pingdotgg:main' into t3code/fix-nested-checklist-copy
2 parents 748373c + e26af33 commit ff11a0e

577 files changed

Lines changed: 42274 additions & 11356 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.

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

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
const MINIMUM_RELEASE_GAP_MS = 6 * 60 * 60 * 1000;
22

3+
function repositoryDefaultBranch(context) {
4+
const branch = context.payload.repository?.default_branch;
5+
if (!branch) {
6+
throw new Error("GitHub did not provide the repository default branch.");
7+
}
8+
return branch;
9+
}
10+
11+
async function assertCommitOnDefaultBranch({ github, context, sha }) {
12+
const defaultBranch = repositoryDefaultBranch(context);
13+
const { data: comparison } = await github.rest.repos.compareCommitsWithBasehead({
14+
...context.repo,
15+
basehead: `${sha}...${defaultBranch}`,
16+
per_page: 1,
17+
});
18+
if (comparison.status !== "ahead" && comparison.status !== "identical") {
19+
throw new Error(
20+
`Release commit ${sha} is not contained in ${defaultBranch} (${comparison.status}).`,
21+
);
22+
}
23+
}
24+
25+
async function assertReleaseSource({ github, context, releaseChannel }) {
26+
if (releaseChannel === "preview") return;
27+
if (releaseChannel !== "stable" && releaseChannel !== "nightly") {
28+
throw new Error(`Unsupported release channel: ${releaseChannel}`);
29+
}
30+
31+
const defaultBranch = repositoryDefaultBranch(context);
32+
if (context.eventName === "workflow_dispatch" && context.ref !== `refs/heads/${defaultBranch}`) {
33+
throw new Error(
34+
`${releaseChannel} releases must be dispatched from ${defaultBranch}; selected ${context.ref}. Use the preview channel for branch builds.`,
35+
);
36+
}
37+
38+
await assertCommitOnDefaultBranch({ github, context, sha: context.sha });
39+
}
40+
341
const isNightlyTag = (tag) => /^v.*-nightly\./.test(tag) || tag.startsWith("nightly-v");
442

543
// Newest published nightly by publication time, or undefined when none exists.
@@ -64,4 +102,9 @@ async function resolveLatestNightlyCommit({ github, context, core }) {
64102
return { tag, sha: commit.sha, version };
65103
}
66104

67-
module.exports = { shouldReleaseNightly, resolveLatestNightlyCommit };
105+
module.exports = {
106+
assertCommitOnDefaultBranch,
107+
assertReleaseSource,
108+
shouldReleaseNightly,
109+
resolveLatestNightlyCommit,
110+
};

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

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
const assert = require("node:assert/strict");
22
const test = require("node:test");
3-
const { shouldReleaseNightly } = require("./check-nightly-release.cjs");
3+
const {
4+
assertCommitOnDefaultBranch,
5+
assertReleaseSource,
6+
shouldReleaseNightly,
7+
} = require("./check-nightly-release.cjs");
48

59
const now = Date.parse("2026-09-05T12:00:00Z");
610
const hour = 60 * 60 * 1000;
@@ -11,6 +15,77 @@ const nightly = (hoursAgo, overrides = {}) => ({
1115
...overrides,
1216
});
1317

18+
function releaseSourceFixture({
19+
comparisonStatus = "ahead",
20+
eventName = "workflow_dispatch",
21+
ref = "refs/heads/main",
22+
sha = "candidate",
23+
} = {}) {
24+
const calls = [];
25+
return {
26+
calls,
27+
options: {
28+
context: {
29+
eventName,
30+
payload: { repository: { default_branch: "main" } },
31+
ref,
32+
repo: { owner: "example", repo: "app" },
33+
sha,
34+
},
35+
github: {
36+
rest: {
37+
repos: {
38+
async compareCommitsWithBasehead(params) {
39+
calls.push(params);
40+
return { data: { status: comparisonStatus } };
41+
},
42+
},
43+
},
44+
},
45+
},
46+
};
47+
}
48+
49+
test("allows preview releases from any branch without consulting main", async () => {
50+
const { options, calls } = releaseSourceFixture({ ref: "refs/heads/feature" });
51+
await assertReleaseSource({ ...options, releaseChannel: "preview" });
52+
assert.equal(calls.length, 0);
53+
});
54+
55+
for (const releaseChannel of ["stable", "nightly"]) {
56+
test(`rejects a manual ${releaseChannel} release from a feature branch`, async () => {
57+
const { options, calls } = releaseSourceFixture({ ref: "refs/heads/feature" });
58+
await assert.rejects(
59+
assertReleaseSource({ ...options, releaseChannel }),
60+
new RegExp(`${releaseChannel} releases must be dispatched from main`),
61+
);
62+
assert.equal(calls.length, 0);
63+
});
64+
65+
test(`allows a manual ${releaseChannel} release from main`, async () => {
66+
const { options, calls } = releaseSourceFixture();
67+
await assertReleaseSource({ ...options, releaseChannel });
68+
assert.equal(calls[0].basehead, "candidate...main");
69+
});
70+
}
71+
72+
for (const comparisonStatus of ["behind", "diverged"]) {
73+
test(`rejects a release commit that is ${comparisonStatus} from main`, async () => {
74+
const { options } = releaseSourceFixture({ comparisonStatus, eventName: "push" });
75+
await assert.rejects(
76+
assertCommitOnDefaultBranch({ ...options, sha: "release-commit" }),
77+
new RegExp(`not contained in main \\(${comparisonStatus}\\)`),
78+
);
79+
});
80+
}
81+
82+
test("accepts a release commit already contained in main", async () => {
83+
for (const comparisonStatus of ["ahead", "identical"]) {
84+
const { options } = releaseSourceFixture({ comparisonStatus, eventName: "push" });
85+
await assertCommitOnDefaultBranch({ ...options, sha: "release-commit" });
86+
}
87+
});
88+
1489
function fixture({ releases = [nightly(7)], comparisonStatus = "ahead" } = {}) {
1590
const calls = [];
1691
return {

‎.github/workflows/release.yml‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ on:
1414
channel:
1515
description: "Release channel"
1616
required: false
17-
default: stable
17+
default: preview
1818
type: choice
1919
options:
20+
- preview
2021
- stable
2122
- nightly
22-
- preview
2323
version:
2424
description: "Stable version override (for example 1.2.3). Defaults to the version the latest nightly previewed."
2525
required: false
@@ -67,15 +67,27 @@ jobs:
6767
with:
6868
script: |
6969
const {
70+
assertCommitOnDefaultBranch,
71+
assertReleaseSource,
7072
shouldReleaseNightly,
7173
resolveLatestNightlyCommit,
7274
} = require('./.github/scripts/check-nightly-release.cjs');
7375
76+
const dispatchChannel = process.env.DISPATCH_CHANNEL || 'preview';
77+
const releaseChannel = context.eventName === 'schedule'
78+
? 'nightly'
79+
: context.eventName === 'workflow_dispatch'
80+
? dispatchChannel
81+
: 'stable';
82+
83+
await assertReleaseSource({ github, context, releaseChannel });
84+
7485
if (context.eventName === 'schedule') {
7586
core.setOutput('has_changes', await shouldReleaseNightly({ github, context, core }));
7687
core.setOutput('ref', context.sha);
77-
} else if (context.eventName === 'workflow_dispatch' && process.env.DISPATCH_CHANNEL !== 'nightly' && process.env.DISPATCH_CHANNEL !== 'preview') {
88+
} else if (context.eventName === 'workflow_dispatch' && dispatchChannel === 'stable') {
7889
const { tag, sha, version } = await resolveLatestNightlyCommit({ github, context, core });
90+
await assertCommitOnDefaultBranch({ github, context, sha });
7991
core.notice(`Stable release builds ${sha}, the commit shipped by ${tag}.`);
8092
core.setOutput('ref', sha);
8193
core.setOutput('nightly_version', version);
@@ -133,7 +145,7 @@ jobs:
133145
NIGHTLY_SHA: ${{ needs.resolve_commit.outputs.ref }}
134146
NIGHTLY_RUN_NUMBER: ${{ github.run_number }}
135147
run: |
136-
if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "nightly" ) ]]; then
148+
if [[ "${GITHUB_EVENT_NAME}" == "schedule" || ( "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-preview}" == "nightly" ) ]]; then
137149
nightly_date="$(date -u -d "$NIGHTLY_DATE" +%Y%m%d)"
138150
139151
node scripts/resolve-nightly-release.ts \
@@ -146,7 +158,7 @@ jobs:
146158
echo "cli_dist_tag=nightly" >> "$GITHUB_OUTPUT"
147159
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
148160
echo "make_latest=false" >> "$GITHUB_OUTPUT"
149-
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-stable}" == "preview" ]]; then
161+
elif [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_CHANNEL:-preview}" == "preview" ]]; then
150162
# Manual-only test train: exercises the whole release flow for a
151163
# commit end users must never receive. Never scheduled.
152164
# Same versioning as nightly under its own prerelease identifier.

‎README.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,21 @@ We wanted something performant, remote-ready, and truly open. If we ever go the
2222
> - OpenCode: install [OpenCode](https://opencode.ai) and run `opencode auth login`
2323
> - Antigravity: enable it in Settings, then use **Install Antigravity** and **Sign in with Google**. No CLI is required.
2424
25-
### Try it out (install-free)
26-
27-
The easiest way to test T3 Code is to run the server in your terminal (requires Node.js 22.16+, 23.11+, or 24.10+):
25+
### Command line
2826

2927
```bash
30-
npx t3@latest
28+
curl -fsSL https://t3.codes/install.sh | sh
29+
```
30+
31+
On Windows, in PowerShell:
32+
33+
```powershell
34+
irm https://t3.codes/install.ps1 | iex
3135
```
3236

33-
This will launch T3 Code's backend on your machine as well as the local web app to control your agents.
37+
Then run `t3` to start the server and open the local web app. `t3 service install` keeps it running in the background, `t3 update` moves to a newer release, and `t3 --help` has the full reference.
3438

35-
Tip: Use `npx t3@latest --help` for the full CLI reference.
39+
To try it once without installing, run `npx t3@latest` instead.
3640

3741
### Desktop app
3842

‎apps/desktop/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@t3tools/desktop",
3-
"version": "0.0.40",
3+
"version": "0.0.42",
44
"private": true,
55
"type": "module",
66
"main": "dist-electron/main.cjs",

‎apps/desktop/scripts/verify-preload-bundle.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { parse } from "acorn";
99
const expectedDesktopBridgeApis = [
1010
"getClientPlatform",
1111
"getLocalEnvironmentBootstraps",
12+
"getPathForFile",
1213
"pickFolder",
1314
];
1415
const clerkPasskeysGlobal = "__clerk_internal_electron_passkeys";
@@ -68,6 +69,9 @@ const createSandboxModules = (exposedGlobals) => {
6869
exposeInMainWorld: (name, api) => exposedGlobals.set(name, api),
6970
},
7071
ipcRenderer,
72+
webUtils: {
73+
getPathForFile: () => "",
74+
},
7175
};
7276

7377
return new Map([

‎apps/desktop/scripts/verify-preload-bundle.test.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const validPreload = `
99
electron.contextBridge.exposeInMainWorld("desktopBridge", {
1010
getClientPlatform: () => process.platform,
1111
getLocalEnvironmentBootstraps: () => [],
12+
getPathForFile: () => "",
1213
pickFolder: (options) => electron.ipcRenderer.invoke(PICK_FOLDER_CHANNEL, options),
1314
});
1415
`;

‎apps/desktop/src/preload.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
DesktopSnapShotEvent,
77
} from "@t3tools/contracts";
88
import { exposeClerkBridge } from "@clerk/electron/preload";
9-
import { contextBridge, ipcRenderer, webFrame } from "electron";
9+
import { contextBridge, ipcRenderer, webFrame, webUtils } from "electron";
1010

1111
import * as IpcChannels from "./ipc/channels.ts";
1212

@@ -69,6 +69,7 @@ contextBridge.exposeInMainWorld("desktopBridge", {
6969
}
7070
return result as ReturnType<DesktopBridge["getAppBranding"]>;
7171
},
72+
getPathForFile: (file: File) => webUtils.getPathForFile(file),
7273
getClientPlatform: () => clientPlatform,
7374
setNotificationBadge: (badge) =>
7475
ipcRenderer.invoke(IpcChannels.SET_NOTIFICATION_BADGE_CHANNEL, badge),

‎apps/desktop/src/preview/Manager.test.ts‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,7 +3506,10 @@ describe("PreviewManager", () => {
35063506
listeners.set(event, listener);
35073507
}),
35083508
once: vi.fn((event: string, listener: (...args: unknown[]) => void) => {
3509-
listeners.set(event, listener);
3509+
listeners.set(event, (...args) => {
3510+
listeners.delete(event);
3511+
listener(...args);
3512+
});
35103513
}),
35113514
off: vi.fn(),
35123515
ipc: { on: vi.fn(), off: vi.fn(), removeListener: vi.fn() },
@@ -3528,11 +3531,23 @@ describe("PreviewManager", () => {
35283531
const pick = yield* manager.pickElement("tab_1").pipe(Effect.forkChild);
35293532
yield* Effect.yieldNow;
35303533

3531-
listeners.get("did-start-navigation")?.({}, "about:blank", false, false);
3534+
listeners.get("did-start-navigation")?.({
3535+
url: "about:blank",
3536+
isSameDocument: false,
3537+
isMainFrame: false,
3538+
frame: null,
3539+
});
35323540
yield* Effect.yieldNow;
35333541
expect(pick.pollUnsafe()).toBeUndefined();
35343542

3535-
listeners.get("did-start-navigation")?.({}, "https://example.com/next", false, true);
3543+
listeners.get("did-start-navigation")?.({
3544+
url: "https://example.com/next",
3545+
isSameDocument: false,
3546+
isMainFrame: true,
3547+
frame: null,
3548+
});
3549+
yield* Effect.yieldNow;
3550+
expect(pick.pollUnsafe()).toBeDefined();
35363551
expect(yield* Fiber.join(pick)).toBeNull();
35373552
}),
35383553
),

‎apps/desktop/src/preview/Manager.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,12 +2566,9 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
25662566
};
25672567
const onDestroyed = () => settle(null);
25682568
const onNavigated = (
2569-
_event: Electron.Event,
2570-
_url: string,
2571-
_isInPlace: boolean,
2572-
isMainFrame: boolean,
2569+
event: Electron.Event<Electron.WebContentsDidStartNavigationEventParams>,
25732570
) => {
2574-
if (isMainFrame) settle(null);
2571+
if (event.isMainFrame) settle(null);
25752572
};
25762573
const registerPickElement = Effect.fn("PreviewManager.registerPickElement")(function* () {
25772574
// Two picks on one tab can overlap. Swap this session in and cancel
@@ -2592,7 +2589,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
25922589
yield* attempt({ operation: "pickElement.register", tabId, webContentsId: wc.id }, () => {
25932590
wc.ipc.on(ELEMENT_PICKED_CHANNEL, onMessage);
25942591
wc.once("destroyed", onDestroyed);
2595-
wc.once("did-start-navigation", onNavigated);
2592+
wc.on("did-start-navigation", onNavigated);
25962593
if (!wc.isFocused()) wc.focus();
25972594
wc.send(START_PICK_CHANNEL, annotationTheme);
25982595
});

0 commit comments

Comments
 (0)