Skip to content

Commit 595785d

Browse files
author
PR Batch Tester
committed
Merge remote-tracking branch 'origin/main' into HEAD
2 parents 698c0df + 2577baf commit 595785d

34 files changed

Lines changed: 931 additions & 1119 deletions

‎.github/scripts/mirror-play-apk.cjs‎

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,15 @@ async function main() {
164164
}
165165
const safeName = build.versionName.replace(/[^0-9A-Za-z.]+/g, "-").replace(/^-|-$/g, "");
166166
const apkName = `t3code-android-${channel}-${safeName}-${build.versionCode}.apk`;
167-
const tag = outputDirectory ? undefined : requireEnv("RELEASE_TAG");
168-
const snapshotTag = `android-beta-${build.versionCode}`;
169-
const release = tag ? readRelease(tag) : undefined;
170-
const snapshot = tag ? readRelease(snapshotTag) : undefined;
171-
const hasApk = (value) =>
172-
value &&
173-
!value.isDraft &&
174-
value.assets.some(
167+
const tag = `android-beta-${build.versionCode}`;
168+
const release = outputDirectory ? undefined : readRelease(tag);
169+
if (
170+
release &&
171+
!release.isDraft &&
172+
release.assets.some(
175173
(asset) => asset.name === apkName && asset.state === "uploaded" && asset.size > 0,
176-
);
177-
const pruneBetaAssets = () => {
178-
for (const stale of release?.assets ?? []) {
179-
if (stale.name.endsWith(".apk") && stale.name !== apkName) {
180-
gh("release", "delete-asset", tag, stale.name, "--yes");
181-
}
182-
}
183-
};
184-
if (hasApk(release) && hasApk(snapshot)) {
185-
pruneBetaAssets();
174+
)
175+
) {
186176
console.log(`${apkName} is already published.`);
187177
return;
188178
}
@@ -209,16 +199,8 @@ async function main() {
209199
"",
210200
"These builds have been promoted for wider testing, but may still contain bugs. The beta is optional; the store app also works with Nightly servers.",
211201
].join("\n");
212-
// Publish the versioned beta first, then advance the stable download page.
213202
// The build number makes retries and unchanged hourly checks idempotent.
214-
publishBeta(
215-
snapshotTag,
216-
apkPath,
217-
notes,
218-
`Android beta ${build.versionName} (${build.versionCode})`,
219-
);
220-
publishBeta(tag, apkPath, notes, "T3 Code for Android (beta)");
221-
pruneBetaAssets();
203+
publishBeta(tag, apkPath, notes, `Android beta ${build.versionName} (${build.versionCode})`);
222204
} finally {
223205
fs.rmSync(path.dirname(apkPath), { recursive: true, force: true });
224206
}

‎.github/workflows/mobile-android-apk.yml‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Mobile Android APK
22

3-
# Checks closed testing hourly. New beta builds get a versioned prerelease and
4-
# update the android-beta download page. Unchanged checks publish nothing.
3+
# Checks closed testing hourly. Each new beta gets one versioned prerelease.
4+
# Unchanged checks publish nothing.
55
on:
66
schedule:
77
# Avoid minute zero, when GitHub scheduled jobs are busiest.
@@ -21,7 +21,6 @@ jobs:
2121
contents: write
2222
env:
2323
PACKAGE_NAME: com.t3tools.t3code
24-
RELEASE_TAG: android-beta
2524
steps:
2625
- id: credentials
2726
name: Check for Play credentials

‎.github/workflows/release.yml‎

Lines changed: 48 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,8 @@ jobs:
689689
resource_key: win32-arm64
690690
cli_archive: true
691691

692-
# npm gets the same bytes as the GitHub Release: the launcher plus one
693-
# package per CLI archive. Preview publishes too, under the `preview`
694-
# dist-tag, which nothing resolves unless asked for by name.
695-
publish_cli:
696-
name: Publish CLI to npm
692+
release:
693+
name: Publish GitHub Release
697694
needs:
698695
[
699696
preflight,
@@ -702,74 +699,13 @@ jobs:
702699
test,
703700
test_server,
704701
desktop_mac_arm64,
705-
desktop_linux_x64,
706-
desktop_linux_arm64,
707-
desktop_win_x64,
708-
desktop_win_arm64,
709-
]
710-
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.test.result == 'success' && needs.test_server.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' }}
711-
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
712-
timeout-minutes: 15
713-
permissions:
714-
contents: read
715-
id-token: write
716-
steps:
717-
- name: Checkout
718-
uses: actions/checkout@v6
719-
with:
720-
ref: ${{ needs.preflight.outputs.ref }}
721-
sparse-checkout: |
722-
/*
723-
!/.repos/
724-
sparse-checkout-cone-mode: false
725-
726-
- name: Setup Vite+
727-
uses: voidzero-dev/setup-vp@v1
728-
with:
729-
node-version-file: package.json
730-
cache: true
731-
run-install: |
732-
args:
733-
- --filter=t3...
734-
- --filter=@t3tools/scripts...
735-
736-
- name: Download all CLI archives
737-
uses: actions/download-artifact@v8
738-
with:
739-
pattern: cli-*
740-
merge-multiple: true
741-
path: release-cli
742-
743-
- name: Build npm packages from CLI archives
744-
run: node scripts/build-npm-platform-packages.ts --archives-dir release-cli --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
745-
746-
# A dry run of every package first: an auth or scope error here (the
747-
# @t3code org missing, a package without a trusted publisher) fails
748-
# before anything is live, instead of after some platforms already are.
749-
- name: Check npm publish access (dry run)
750-
run: |
751-
if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --dry-run --verbose; then
752-
echo "::error::npm publish --dry-run failed. Make sure the @t3code npm org exists and that t3 and every @t3code/t3-<platform> package has a trusted publisher registered for .github/workflows/release.yml (see docs/operations/release.md)." >&2
753-
exit 1
754-
fi
755-
756-
- name: Publish CLI packages
757-
run: node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose
758-
759-
release:
760-
name: Publish GitHub Release
761-
needs:
762-
[
763-
preflight,
764-
desktop_mac_arm64,
765702
desktop_mac_x64,
766703
desktop_linux_x64,
767704
desktop_linux_arm64,
768705
desktop_win_x64,
769706
desktop_win_arm64,
770-
publish_cli,
771707
]
772-
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_mac_x64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' && needs.publish_cli.result == 'success' }}
708+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.test.result == 'success' && needs.test_server.result == 'success' && needs.desktop_mac_arm64.result == 'success' && needs.desktop_mac_x64.result == 'success' && needs.desktop_linux_x64.result == 'success' && needs.desktop_linux_arm64.result == 'success' && needs.desktop_win_x64.result == 'success' && needs.desktop_win_arm64.result == 'success' }}
773709
runs-on: blacksmith-8vcpu-ubuntu-2404
774710
timeout-minutes: 30
775711
permissions:
@@ -957,6 +893,49 @@ jobs:
957893
fail_on_unmatched_files: true
958894
token: ${{ github.token }}
959895

896+
# The `t3` npm package is a launcher that downloads this version's CLI
897+
# archive from the GitHub Release, so it publishes only once that release
898+
# exists. Preview publishes too, under the `preview` dist-tag, which
899+
# nothing resolves unless asked for by name.
900+
publish_cli:
901+
name: Publish CLI to npm
902+
needs: [preflight, release]
903+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
904+
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
905+
timeout-minutes: 15
906+
permissions:
907+
contents: read
908+
id-token: write
909+
steps:
910+
- name: Checkout
911+
uses: actions/checkout@v6
912+
with:
913+
ref: ${{ needs.preflight.outputs.ref }}
914+
sparse-checkout: |
915+
/*
916+
!/.repos/
917+
sparse-checkout-cone-mode: false
918+
919+
- name: Setup Vite+
920+
uses: voidzero-dev/setup-vp@v1
921+
with:
922+
node-version-file: package.json
923+
cache: true
924+
run-install: |
925+
args:
926+
- --filter=t3...
927+
- --filter=@t3tools/scripts...
928+
929+
- name: Build the npm launcher
930+
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
931+
932+
- name: Publish the npm launcher
933+
run: |
934+
if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
935+
echo "::error::npm publish failed. Make sure package t3 has a trusted publisher registered for .github/workflows/release.yml (see docs/operations/release.md)." >&2
936+
exit 1
937+
fi
938+
960939
publish_aur:
961940
name: Publish AUR package
962941
needs: [preflight, release]
@@ -1074,8 +1053,8 @@ jobs:
10741053
10751054
deploy_web:
10761055
name: Deploy hosted web app
1077-
needs: [preflight, build_web, release]
1078-
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_web.result == 'success' && needs.release.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
1056+
needs: [preflight, build_web, release, publish_cli]
1057+
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build_web.result == 'success' && needs.release.result == 'success' && needs.publish_cli.result == 'success' && needs.preflight.outputs.release_channel != 'preview' }}
10791058
runs-on: blacksmith-2vcpu-ubuntu-2404
10801059
timeout-minutes: 10
10811060
env:

‎apps/desktop/src/app/DesktopCliShim.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ export const renderCliShim = (input: {
6060
`set "T3CODE_CLI_PATH=${cmdText(input.shimPath)}"`,
6161
`if not defined T3CODE_HOME set "T3CODE_HOME=${cmdText(input.t3Home)}"`,
6262
'set "ELECTRON_RUN_AS_NODE=1"',
63+
// Electron's Windows executable starts without stdin; this tells the CLI to reopen the console.
64+
'set "T3CODE_DESKTOP_CLI_LAUNCHER=1"',
6365
// A goto, not a parenthesized block: "Program Files (x86)" would close the block early.
6466
`if exist ${cmdWord(target.executable)} goto run`,
6567
...restore,

‎apps/mobile/src/features/workspace/WorkspaceRootScreen.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function WorkspaceRootContent() {
5959
const nativeMetrics = useNativeLayoutMetrics();
6060
const systemTabBar = useSystemWorkspaceTabBar();
6161
const sidebarTabs = useSidebarWorkspaceTabs();
62+
const sidebarPicker = sidebarTabs === "picker";
6263
const sidebarNavigation =
6364
primaryColumn !== null &&
6465
(layout.usesSplitView ||
@@ -98,8 +99,8 @@ function WorkspaceRootContent() {
9899
return (
99100
<WorkspaceTabsContext value={context}>
100101
<View
101-
className={sidebarTabs ? "flex-1 bg-drawer" : "flex-1 bg-screen"}
102-
style={sidebarTabs ? { paddingTop: insets.top } : undefined}
102+
className={sidebarPicker ? "flex-1 bg-drawer" : "flex-1 bg-screen"}
103+
style={sidebarPicker ? { paddingTop: insets.top } : undefined}
103104
>
104105
{Platform.OS === "ios" ? (
105106
<NativeStackScreenOptions
@@ -136,8 +137,8 @@ function WorkspaceRootContent() {
136137
]}
137138
/>
138139
)}
139-
{sidebarTabs ? <WorkspaceSidebarTabs /> : null}
140-
<SafeAreaInsetsContext value={sidebarTabs ? { ...insets, top: 0 } : insets}>
140+
{sidebarPicker ? <WorkspaceSidebarTabs /> : null}
141+
<SafeAreaInsetsContext value={sidebarPicker ? { ...insets, top: 0 } : insets}>
141142
{state.selectedTab === "threads" ? <HomeRouteScreen /> : <PullRequestsScreen />}
142143
</SafeAreaInsetsContext>
143144
<WorkspaceToolbar

‎apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { StackActions, useNavigation } from "@react-navigation/native";
2-
import { Keyboard, View } from "react-native";
1+
import { View } from "react-native";
32
import { SegmentedControl } from "../../components/ui/SegmentedControl";
43
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
54
import type { WorkspaceTab } from "./workspace-tabs-state";
5+
import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
66

77
export function WorkspaceSidebarTabs() {
88
const workspace = useWorkspaceTabs()!;
9-
const navigation = useNavigation();
9+
const selectTab = useSelectWorkspaceTab();
1010
return (
1111
<View className="px-4 pb-3 pt-2">
1212
<SegmentedControl
@@ -16,12 +16,7 @@ export function WorkspaceSidebarTabs() {
1616
{ value: "pullRequests", label: "Pull requests" },
1717
]}
1818
selected={workspace.state.selectedTab}
19-
onSelect={(tab: WorkspaceTab) => {
20-
if (tab === workspace.state.selectedTab) return;
21-
Keyboard.dismiss();
22-
if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
23-
workspace.dispatch({ type: "select", tab });
24-
}}
19+
onSelect={(tab: WorkspaceTab) => selectTab(tab)}
2520
/>
2621
</View>
2722
);

‎apps/mobile/src/features/workspace/WorkspaceToolbar.ios.tsx‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import { NativeWorkspaceTabActivityContext } from "../../native/v5-workspace-con
1111
import { useHardwareKeyboardCommand } from "../keyboard/hardwareKeyboardCommands";
1212
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
1313
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
14+
import { useSidebarWorkspaceTabs } from "./useSystemWorkspaceTabBar";
15+
import { useSelectWorkspaceTab } from "./useSelectWorkspaceTab";
16+
import { useMobileNavigationTheme } from "../../lib/useMobileNavigationTheme";
17+
18+
// Tabler's git-pull-request geometry, shared with the UIKit tab bar.
19+
const PULL_REQUEST_ICON = require("../../../assets/icons/pull-request.png");
1420

1521
export function WorkspaceToolbar(props: {
1622
readonly onNewTask: () => void;
@@ -19,8 +25,12 @@ export function WorkspaceToolbar(props: {
1925
const workspace = useWorkspaceTabs()!;
2026
const navigation = useNavigation();
2127
const metrics = useNativeLayoutMetrics();
28+
const sidebarTabs = useSidebarWorkspaceTabs();
29+
const selectTab = useSelectWorkspaceTab();
30+
const selectedTint = useMobileNavigationTheme().colors.primary;
2231
const nativeToolbarCompose =
23-
Platform.OS === "ios" && (Platform.isPad || (metrics?.verticalBarEdge ?? "none") !== "none");
32+
Platform.OS === "ios" &&
33+
(Platform.isPad || sidebarTabs !== null || (metrics?.verticalBarEdge ?? "none") !== "none");
2434
const { isTabActive } = workspace;
2535
const tabActive = use(NativeWorkspaceTabActivityContext)?.active ?? true;
2636
const { panes, togglePrimarySidebar } = useAdaptiveWorkspaceLayout();
@@ -122,6 +132,24 @@ export function WorkspaceToolbar(props: {
122132
)}
123133
</Toolbar>
124134
<Toolbar placement="bottom">
135+
{sidebarTabs === "toolbar" ? (
136+
<Toolbar.Button
137+
identifier="workspace-tab-threads"
138+
accessibilityLabel="Threads"
139+
icon={selectedTab === "threads" ? "text.bubble.fill" : "text.bubble"}
140+
tintColor={selectedTab === "threads" ? selectedTint : undefined}
141+
onPress={() => selectTab("threads")}
142+
/>
143+
) : null}
144+
{sidebarTabs === "toolbar" ? (
145+
<Toolbar.Button
146+
identifier="workspace-tab-pull-requests"
147+
accessibilityLabel="Pull requests"
148+
icon={{ type: "image", source: PULL_REQUEST_ICON, tinted: true }}
149+
tintColor={selectedTab === "pullRequests" ? selectedTint : undefined}
150+
onPress={() => selectTab("pullRequests")}
151+
/>
152+
) : null}
125153
{nativeToolbarCompose ? <Toolbar.Spacer flexible /> : null}
126154
{nativeToolbarCompose ? (
127155
<Toolbar.Button
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { StackActions, useNavigation } from "@react-navigation/native";
2+
import { useCallback } from "react";
3+
import { Keyboard } from "react-native";
4+
import { useWorkspaceTabs } from "./WorkspaceTabsContext";
5+
import type { WorkspaceTab } from "./workspace-tabs-state";
6+
7+
/** Switch workspace tabs from inside the sidebar, closing any open detail first. */
8+
export function useSelectWorkspaceTab() {
9+
const workspace = useWorkspaceTabs()!;
10+
const navigation = useNavigation();
11+
const selectedTab = workspace.state.selectedTab;
12+
const { dispatch } = workspace;
13+
return useCallback(
14+
(tab: WorkspaceTab) => {
15+
if (tab === selectedTab) return;
16+
Keyboard.dismiss();
17+
if (navigation.getState()?.index) navigation.dispatch(StackActions.popToTop());
18+
dispatch({ type: "select", tab });
19+
},
20+
[dispatch, navigation, selectedTab],
21+
);
22+
}
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { Platform } from "react-native";
22
import { useAdaptiveWorkspaceLayout } from "../layout/AdaptiveWorkspaceLayout";
3+
import { useNativeLayoutMetrics } from "../../native/native-layout-metrics";
34

4-
export function useSidebarWorkspaceTabs() {
5+
/** Where an iOS split window shows the workspace tabs instead of UIKit's tab bar. */
6+
export function useSidebarWorkspaceTabs(): "picker" | "toolbar" | null {
57
const { layout } = useAdaptiveWorkspaceLayout();
6-
return Platform.OS === "ios" && Platform.isPad && layout.usesSplitView;
8+
const metrics = useNativeLayoutMetrics();
9+
if (Platform.OS !== "ios" || !layout.usesSplitView) return null;
10+
if (Platform.isPad) return "picker";
11+
// The Duo's side rail carries UIKit's tabs. Unfolded in portrait it has no
12+
// rail, so the tabs sit in the thread list's own toolbar.
13+
return (metrics?.verticalBarEdge ?? "none") === "none" ? "toolbar" : null;
714
}
815

916
export function useSystemWorkspaceTabBar() {
1017
const sidebarTabs = useSidebarWorkspaceTabs();
11-
return Platform.OS === "ios" && !sidebarTabs;
18+
return Platform.OS === "ios" && sidebarTabs === null;
1219
}

0 commit comments

Comments
 (0)