Skip to content

Commit 24e015d

Browse files
committed
Merge remote-tracking branch 'origin/main' into t3/bd91e103
2 parents 32cede8 + b7b53d4 commit 24e015d

99 files changed

Lines changed: 19269 additions & 684 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.

‎.gitattributes‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Batch files need CRLF for cmd.exe to parse them reliably.
44
*.cmd text eol=crlf
55
*.bat text eol=crlf
6-
# GitHub's GraphQL schema and the operations graphqlgen writes from it.
6+
# GitHub's and Expo's GraphQL schemas and the operations graphqlgen writes from them.
77
packages/source-control-github/schema/** linguist-generated
8+
apps/server/schema/** linguist-generated
89
**/*.graphql.ts linguist-generated

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ jobs:
9393
- name: Check generated GitHub GraphQL operations
9494
run: vp run --filter @t3tools/source-control-github generate --check
9595

96+
- name: Check generated Expo GraphQL operations
97+
run: vp run --filter t3 generate --check
98+
9699
- name: Check
97100
run: vp check
98101

‎apps/mobile/src/features/devices/device-stream.browser.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ export function start(configuration: DeviceStreamConfiguration) {
140140
canvas.style.display = "none";
141141
image.style.display = "block";
142142
},
143+
onCanvasVideo: () => {
144+
image.style.display = "none";
145+
canvas.style.display = "";
146+
},
143147
onUnauthorized: unauthorized,
144148
onInputConnected: (connected) => {
145149
inputConnected = connected;

‎apps/mobile/src/features/pull-requests/PullRequestFiles.tsx‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { PullRequestChangeBreakdown } from "@t3tools/contracts";
12
import { PullRequestSectionHeading } from "./PullRequestSectionHeading";
23
import { AnimatedLegendList } from "@legendapp/list/reanimated";
34
import Animated from "react-native-reanimated";
@@ -23,6 +24,33 @@ import {
2324
import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed";
2425
import { usePullRequestFileFilter } from "./usePullRequestFileFilter";
2526

27+
const BREAKDOWN_LABELS = {
28+
code: "Code",
29+
tests: "Tests",
30+
mocks: "Mocks",
31+
generated: "Generated",
32+
} satisfies Record<keyof NonNullable<PullRequestChangeBreakdown>, string>;
33+
34+
function PullRequestChangeBreakdownLine(props: {
35+
readonly breakdown: NonNullable<PullRequestChangeBreakdown>;
36+
}) {
37+
const parts = (Object.keys(BREAKDOWN_LABELS) as Array<keyof typeof BREAKDOWN_LABELS>).flatMap(
38+
(kind) => {
39+
const { additions, deletions } = props.breakdown[kind];
40+
return additions === 0 && deletions === 0
41+
? []
42+
: [
43+
`${BREAKDOWN_LABELS[kind]} +${additions.toLocaleString()} −${deletions.toLocaleString()}`,
44+
];
45+
},
46+
);
47+
return (
48+
<Text className="text-2xs tabular-nums text-foreground-muted" numberOfLines={2}>
49+
{parts.join(" · ")}
50+
</Text>
51+
);
52+
}
53+
2654
function fileDirectory(path: string) {
2755
const separator = path.lastIndexOf("/");
2856
return separator < 0 ? "" : path.slice(0, separator);
@@ -37,6 +65,9 @@ export function usePullRequestFilesContent(props: {
3765
const result = usePullRequestDiff(props.params);
3866
const detail = useEnvironmentQuery(composerPullRequests.detail(requestTarget(props.params)));
3967
const viewed = usePullRequestFilesViewed(props.params, props.params.commit ? null : detail.data);
68+
const breakdown = useEnvironmentQuery(
69+
props.params.commit ? null : composerPullRequests.changeBreakdown(requestTarget(props.params)),
70+
).data;
4071
const filter = usePullRequestFileFilter(result.parsed);
4172
const parsed = filter.parsed;
4273
const loading = result.isPending && parsed.kind === "empty" && !result.error;
@@ -209,6 +240,7 @@ export function usePullRequestFilesContent(props: {
209240
? `${filter.hiddenCount} test ${filter.hiddenCount === 1 ? "file" : "files"} hidden`
210241
: "Test files included"}
211242
</Text>
243+
{breakdown ? <PullRequestChangeBreakdownLine breakdown={breakdown} /> : null}
212244
</View>
213245
<PullRequestDiffStats
214246
additions={parsed.additions}

‎apps/mobile/src/features/pull-requests/pullRequestFileFilters.ts‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1+
import { classifyChangedFile } from "@t3tools/shared/changedFileKind";
12
import type { ReviewParsedDiff } from "../review/reviewModel";
23

4+
/** Test support such as fixtures and snapshots is hidden along with the tests. */
35
export function isPullRequestTestFile(path: string): boolean {
4-
const segments = path.replaceAll("\\", "/").split("/");
5-
const name = segments.at(-1) ?? "";
6-
return (
7-
segments
8-
.slice(0, -1)
9-
.some((segment) => /^(?:__tests__|__snapshots__|tests?|spec|e2e)$/i.test(segment)) ||
10-
/\.(?:test|spec)\./i.test(name) ||
11-
/\.snap$/i.test(name) ||
12-
/^(?:test_.+|.+_test)\.py$/i.test(name) ||
13-
/_test\.(?:go|rs|rb|c|cc|cpp|h|hpp)$/i.test(name) ||
14-
/(?:Test|Tests|Spec)\.(?:java|kt|kts|swift|cs)$/.test(name) ||
15-
/_spec\.rb$/i.test(name)
16-
);
6+
const kind = classifyChangedFile(path);
7+
return kind === "tests" || kind === "mocks";
178
}
189

1910
export function filterPullRequestTestFiles(

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import * as Dialog from "../../components/ui/Dialog";
33
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
44
import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";
55
import { useMarkdownImageSource } from "../../native/useMarkdownImageSource";
6-
import { enrichedContextLinkPresentation } from "../../lib/enrichedLinkPresentation";
6+
import {
7+
enrichedContextLinkPresentation,
8+
enrichedSkillDisplayName,
9+
enrichedSkillInstructionsPath,
10+
enrichedSkillReference,
11+
} from "../../lib/enrichedLinkPresentation";
712
import { ThreadContextDivider } from "./thread-context-divider";
813
import { ThreadHandoffDivider, ThreadHandoffRow } from "./thread-handoff-row";
914
import { SecretRequestCard } from "./SecretRequestCard";
@@ -1788,6 +1793,14 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
17881793
const iconSubtleColor = theme["--color-icon-subtle"];
17891794
const screenColor = theme["--color-screen"];
17901795
const userBubbleColor = theme["--color-user-bubble"];
1796+
const openSkillInstructions = (path: string) => {
1797+
void Haptics.selectionAsync();
1798+
navigation.navigate("ThreadFile", {
1799+
environmentId: String(props.environmentId),
1800+
threadId: String(props.threadId),
1801+
path: fileRoutePathSegments(path),
1802+
});
1803+
};
17911804
const resolveLinkedThread = (href: string) => {
17921805
const linkedThreadId = parseThreadLinkHref(href);
17931806
if (!linkedThreadId) return null;
@@ -1798,6 +1811,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
17981811
);
17991812
};
18001813
const onMarkdownLinkPress = (href: string, imageEmbed = false) => {
1814+
const skill = enrichedSkillReference(href, props.skills);
1815+
if (skill) {
1816+
const instructionsPath = enrichedSkillInstructionsPath(skill);
1817+
if (instructionsPath) openSkillInstructions(instructionsPath);
1818+
return;
1819+
}
18011820
const target = resolveLinkedThread(href);
18021821
if (target) {
18031822
navigation.navigate("Thread", {
@@ -1868,6 +1887,20 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
18681887
onImagePress: (href) => onMarkdownLinkPress(href, true),
18691888
resolveImageSource,
18701889
fileContextMenu: (href) => {
1890+
const skill = enrichedSkillReference(href, props.skills);
1891+
if (skill) {
1892+
return {
1893+
title: enrichedSkillDisplayName(skill),
1894+
actions: [
1895+
{
1896+
id: "open-skill",
1897+
title: "View instructions",
1898+
disabled: !enrichedSkillInstructionsPath(skill),
1899+
},
1900+
{ id: "copy-skill", title: "Copy skill" },
1901+
],
1902+
};
1903+
}
18711904
const thread = resolveLinkedThread(href);
18721905
if (thread) {
18731906
return {
@@ -1883,6 +1916,13 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
18831916
return target ? fileChipMenu(target) : undefined;
18841917
},
18851918
onFileContextMenuAction: (href, actionId) => {
1919+
const skill = enrichedSkillReference(href, props.skills);
1920+
if (skill) {
1921+
const instructionsPath = enrichedSkillInstructionsPath(skill);
1922+
if (actionId === "open-skill" && instructionsPath) openSkillInstructions(instructionsPath);
1923+
else if (actionId === "copy-skill") copyTextWithHaptic(`$${skill.name}`);
1924+
return;
1925+
}
18861926
if (resolveLinkedThread(href)) {
18871927
if (actionId === "open-thread") onMarkdownLinkPress(href);
18881928
else if (actionId === "copy-thread-link") copyTextWithHaptic(href);

‎apps/mobile/src/lib/enrichedLinkPresentation.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ComposerContextId, ReviewCommentContextRecord } from "@t3tools/con
33
import {
44
enrichedContextLinkPresentation,
55
enrichedLinkVariantPattern,
6+
enrichedSkillInstructionsPath,
67
enrichedSkillLinkRegex,
78
enrichedSkillReference,
89
ENRICHED_INLINE_FILE_LINK_REGEX,
@@ -54,6 +55,25 @@ describe("Enriched link presentation", () => {
5455
expect(regex.test(`${sigil}${sigil}check`)).toBe(false);
5556
},
5657
);
58+
it("opens skill instructions only for filesystem paths", () => {
59+
expect(
60+
enrichedSkillInstructionsPath({
61+
name: "ketchup",
62+
path: "/home/me/.claude/skills/ketchup/SKILL.md",
63+
}),
64+
).toBe("/home/me/.claude/skills/ketchup/SKILL.md");
65+
expect(
66+
enrichedSkillInstructionsPath({ name: "review", path: "C:\\skills\\review\\SKILL.md" }),
67+
).toBe("C:\\skills\\review\\SKILL.md");
68+
expect(
69+
enrichedSkillInstructionsPath({
70+
name: "workspace-skill",
71+
path: "acp://skill/workspace-skill",
72+
}),
73+
).toBeUndefined();
74+
expect(enrichedSkillInstructionsPath({ name: "bare" })).toBeUndefined();
75+
});
76+
5777
it("matches only the complete URL, including literal regex metacharacters", () => {
5878
const url = "file:///workspace/app[1].tsx?line=3+4";
5979
const pattern = new RegExp(enrichedLinkVariantPattern(url));

‎apps/mobile/src/lib/enrichedLinkPresentation.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ export function enrichedSkillReference(
6565
const match = /^\p{Sc}(.+)$/u.exec(url);
6666
return match ? skills?.find((skill) => skill.name === match[1]) : undefined;
6767
}
68+
69+
export function enrichedSkillInstructionsPath(skill: SelectableMarkdownSkill) {
70+
return skill.path && !/^[a-z][a-z\d+.-]*:\/\//i.test(skill.path) ? skill.path : undefined;
71+
}

‎apps/mobile/src/native/SelectableMarkdownText.types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface NativeMarkdownTextStyle {
2525
export interface SelectableMarkdownSkill {
2626
readonly name: string;
2727
readonly displayName?: string | null;
28+
readonly path?: string;
2829
}
2930

3031
export interface MarkdownImageRequest {

‎apps/server/graphql.config.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from "@effect/graphql-generator/Config";
2+
3+
// `schema/expo.graphql` is api.expo.dev's schema, read by introspection
4+
// (`vp run generate:expo-schema`). The EAS Simulator operations are the ones
5+
// eas-cli's `simulator:*` commands send; Expo does not document them.
6+
export default defineConfig({
7+
schema: "./schema/expo.graphql",
8+
documents: ["src/device/**/*.graphql"],
9+
scalars: {
10+
// Feature gates arrive as an object of gate name to boolean.
11+
JSONObject: "effect/Schema#Json",
12+
},
13+
});

0 commit comments

Comments
 (0)