@devries-cameron20 / t3code Mirror · read-only / commits / d3415f36d0
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 22:00 UTC

fix(mobile): skill chips in messages open their instructions (#22120)

oliver committed Oct 20, 2026 at 01:09 UTC d3415f36d0cfe733010378bb4dbd53f2a452231f
4 files changed +66 -1
apps/mobile/src/features/threads/ThreadFeed.tsx
+41 -1
@@ -3,7 +3,12 @@ import * as Dialog from "../../components/ui/Dialog";
3 import { useOpenPullRequest } from "../../native/useOpenPullRequest";
4 import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";
5 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";
12 import { ThreadContextDivider } from "./thread-context-divider";
13 import { ThreadHandoffDivider, ThreadHandoffRow } from "./thread-handoff-row";
14 import { SecretRequestCard } from "./SecretRequestCard";
@@ -1788,6 +1793,14 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
1793 const iconSubtleColor = theme["--color-icon-subtle"];
1794 const screenColor = theme["--color-screen"];
1795 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 + };
1804 const resolveLinkedThread = (href: string) => {
1805 const linkedThreadId = parseThreadLinkHref(href);
1806 if (!linkedThreadId) return null;
@@ -1798,6 +1811,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
1811 );
1812 };
1813 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 + }
1820 const target = resolveLinkedThread(href);
1821 if (target) {
1822 navigation.navigate("Thread", {
@@ -1868,6 +1887,20 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
1887 onImagePress: (href) => onMarkdownLinkPress(href, true),
1888 resolveImageSource,
1889 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 + }
1904 const thread = resolveLinkedThread(href);
1905 if (thread) {
1906 return {
@@ -1883,6 +1916,13 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
1916 return target ? fileChipMenu(target) : undefined;
1917 },
1918 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 + }
1926 if (resolveLinkedThread(href)) {
1927 if (actionId === "open-thread") onMarkdownLinkPress(href);
1928 else if (actionId === "copy-thread-link") copyTextWithHaptic(href);
apps/mobile/src/lib/enrichedLinkPresentation.test.ts
+20
@@ -3,6 +3,7 @@ import type { ComposerContextId, ReviewCommentContextRecord } from "@t3tools/con
3 import {
4 enrichedContextLinkPresentation,
5 enrichedLinkVariantPattern,
6 + enrichedSkillInstructionsPath,
7 enrichedSkillLinkRegex,
8 enrichedSkillReference,
9 ENRICHED_INLINE_FILE_LINK_REGEX,
@@ -54,6 +55,25 @@ describe("Enriched link presentation", () => {
55 expect(regex.test(`${sigil}${sigil}check`)).toBe(false);
56 },
57 );
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 +
77 it("matches only the complete URL, including literal regex metacharacters", () => {
78 const url = "file:///workspace/app[1].tsx?line=3+4";
79 const pattern = new RegExp(enrichedLinkVariantPattern(url));
apps/mobile/src/lib/enrichedLinkPresentation.ts
+4
@@ -65,3 +65,7 @@ export function enrichedSkillReference(
65 const match = /^\p{Sc}(.+)$/u.exec(url);
66 return match ? skills?.find((skill) => skill.name === match[1]) : undefined;
67 }
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
+1
@@ -25,6 +25,7 @@ export interface NativeMarkdownTextStyle {
25 export interface SelectableMarkdownSkill {
26 readonly name: string;
27 readonly displayName?: string | null;
28 + readonly path?: string;
29 }
30
31 export interface MarkdownImageRequest {