Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Add file preview comments and task toggles (#3115)

Julius Marmingec2ca9de33ab8
diff --git a/apps/mobile/src/features/review/reviewCommentSelection.test.ts b/apps/mobile/src/features/review/reviewCommentSelection.test.ts
index 25e5f9ce4..b61735f95 100644
--- a/apps/mobile/src/features/review/reviewCommentSelection.test.ts
+++ b/apps/mobile/src/features/review/reviewCommentSelection.test.ts
@@ -78,4 +78,68 @@ describe("review comment serialization", () => {
);
expect(segments[2]).toEqual(expect.objectContaining({ kind: "text", text: "\nAfter" }));
});
+
+ it("parses source-language review comments created by the web file viewer", () => {
+ const [segment] = parseReviewCommentMessageSegments(
+ [
+ '<review_comment sectionId="file:docs/plan.md" sectionTitle="File comment" filePath="docs/plan.md" startIndex="0" endIndex="1" rangeLabel="L1 to L2">',
+ "Clarify this.",
+ "```md",
+ "# Plan",
+ "- Step one",
+ "```",
+ "</review_comment>",
+ ].join("\n"),
+ );
+
+ expect(segment).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({
+ filePath: "docs/plan.md",
+ fenceLanguage: "md",
+ diff: "# Plan\n- Step one",
+ }),
+ }),
+ );
+ });
+
+ it("keeps fenced examples in comment prose separate from the context fence", () => {
+ const [segment] = parseReviewCommentMessageSegments(
+ [
+ '<review_comment sectionId="section-1" sectionTitle="Working tree" filePath="src/app.ts" startIndex="0" endIndex="0" rangeLabel="+1">',
+ "Try this:",
+ "```ts",
+ "const value = 1;",
+ "```",
+ "Then retry.",
+ "```diff",
+ "@@ -0,0 +1,1 @@",
+ "+one",
+ "```",
+ "</review_comment>",
+ ].join("\n"),
+ );
+
+ expect(segment).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({
+ text: ["Try this:", "```ts", "const value = 1;", "```", "Then retry."].join("\n"),
+ diff: "@@ -0,0 +1,1 @@\n+one",
+ }),
+ }),
+ );
+ });
+
+ it("round-trips greater-than signs in review attributes", () => {
+ const serialized = formatReviewCommentContext(
+ { ...makeTarget(), sectionTitle: "Changes > 5" },
+ "Check this.",
+ );
+ const [comment] = parseReviewInlineComments(serialized);
+
+ expect(serialized).toContain('sectionTitle="Changes &gt; 5"');
+ expect(comment?.sectionTitle).toBe("Changes > 5");
+ });
});
diff --git a/apps/mobile/src/features/review/reviewCommentSelection.ts b/apps/mobile/src/features/review/reviewCommentSelection.ts
index 09e1927d1..5e6e1c368 100644
--- a/apps/mobile/src/features/review/reviewCommentSelection.ts
+++ b/apps/mobile/src/features/review/reviewCommentSelection.ts
@@ -21,6 +21,7 @@ export interface ReviewInlineComment {
readonly rangeLabel: string;
readonly text: string;
readonly diff: string;
+ readonly fenceLanguage?: string;
}
export type ReviewCommentMessageSegment =
@@ -38,6 +39,7 @@ let currentTarget: ReviewCommentTarget | null = null;
const listeners = new Set<() => void>();
const REVIEW_COMMENT_BLOCK_PATTERN = /<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g;
const REVIEW_COMMENT_ATTRIBUTE_PATTERN = /([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g;
+const REVIEW_COMMENT_FENCE_PATTERN = /(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;
function emitChange() {
listeners.forEach((listener) => listener());
@@ -170,12 +172,17 @@ function formatReviewSelectedDiff(target: ReviewCommentTarget): string {
}
function escapeReviewCommentAttribute(value: string): string {
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
+ return value
+ .replace(/&/g, "&amp;")
+ .replace(/"/g, "&quot;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;");
}
function unescapeReviewCommentAttribute(value: string): string {
return value
.replace(/&lt;/g, "<")
+ .replace(/&gt;/g, ">")
.replace(/&quot;/g, '"')
.replace(/&amp;/g, "&");
}
@@ -195,15 +202,19 @@ function readNonNegativeInteger(value: string | undefined): number | null {
return Number(value);
}
-function extractReviewCommentText(rawBody: string): string {
- const fenceIndex = rawBody.indexOf("```diff");
- const commentBody = fenceIndex >= 0 ? rawBody.slice(0, fenceIndex) : rawBody;
- return commentBody.trim();
-}
-
-function extractReviewCommentDiff(rawBody: string): string {
- const match = rawBody.match(/```diff\s*\n([\s\S]*?)\n```/);
- return match?.[1]?.trim() ?? "";
+function extractReviewCommentBody(rawBody: string): {
+ text: string;
+ language: string;
+ contents: string;
+} {
+ const matches = Array.from(rawBody.matchAll(REVIEW_COMMENT_FENCE_PATTERN));
+ const match = matches.at(-1);
+ const fenceIndex = match?.index;
+ return {
+ text: rawBody.slice(0, fenceIndex ?? rawBody.length).trim(),
+ language: match?.[2]?.trim() || "diff",
+ contents: match?.[3] ?? "",
+ };
}
function parseReviewInlineComment(
@@ -219,6 +230,7 @@ function parseReviewInlineComment(
if (!filePath || !sectionId || startIndex === null || endIndex === null) {
return null;
}
+ const body = extractReviewCommentBody(rawBody);
return {
id: `review-comment:${index}:${sectionId}:${filePath}:${startIndex}:${endIndex}`,
@@ -228,13 +240,20 @@ function parseReviewInlineComment(
startIndex: Math.min(startIndex, endIndex),
endIndex: Math.max(startIndex, endIndex),
rangeLabel: attributes.rangeLabel?.trim() || "line",
- text: extractReviewCommentText(rawBody),
- diff: extractReviewCommentDiff(rawBody),
+ text: body.text,
+ diff: body.contents,
+ fenceLanguage: body.language,
};
}
export function formatReviewCommentContext(target: ReviewCommentTarget, comment: string): string {
const rangeLabel = formatReviewSelectedRangeLabel(target);
+ const diff = formatReviewSelectedDiff(target);
+ const longestBacktickRun = Math.max(
+ 0,
+ ...Array.from(diff.matchAll(/`+/g), (match) => match[0].length),
+ );
+ const fence = "`".repeat(Math.max(3, longestBacktickRun + 1));
return [
[
"<review_comment",
@@ -247,9 +266,9 @@ export function formatReviewCommentContext(target: ReviewCommentTarget, comment:
">",
].join(""),
comment.trim(),
- "```diff",
- formatReviewSelectedDiff(target),
- "```",
+ `${fence}diff`,
+ diff,
+ fence,
"</review_comment>",
].join("\n");
}
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index 4f06e0812..a23a9caff 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -1193,6 +1193,9 @@ const ReviewCommentCard = memo(function ReviewCommentCard(props: {
});
function buildReviewCommentPatch(comment: ReviewInlineComment): string {
+ if ((comment.fenceLanguage ?? "diff") !== "diff") {
+ return "";
+ }
const diff = comment.diff.trim();
if (!diff) {
return "";
diff --git a/apps/web/src/components/ChatMarkdown.browser.tsx b/apps/web/src/components/ChatMarkdown.browser.tsx
index 4eeab3e80..7ef340976 100644
--- a/apps/web/src/components/ChatMarkdown.browser.tsx
+++ b/apps/web/src/components/ChatMarkdown.browser.tsx
@@ -69,6 +69,26 @@ describe("ChatMarkdown", () => {
document.body.innerHTML = "";
});
+ it("makes task-list checkboxes interactive when a change handler is provided", async () => {
+ const onTaskListChange = vi.fn();
+ const screen = await render(
+ <ChatMarkdown
+ text={"- [ ] Ship it"}
+ cwd="/repo/project"
+ onTaskListChange={onTaskListChange}
+ />,
+ );
+
+ try {
+ const checkbox = page.getByRole("checkbox", { name: "Toggle task" });
+ await expect.element(checkbox).not.toBeDisabled();
+ await checkbox.click();
+ expect(onTaskListChange).toHaveBeenCalledWith({ markerOffset: 2, checked: true });
+ } finally {
+ await screen.unmount();
+ }
+ });
+
it("rewrites file uri hrefs into direct paths before rendering", async () => {
const filePath =
"/Users/yashsingh/p/sco/claude-code-extract/src/utils/permissions/PermissionRule.ts";
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index ecd6bc40f..bfb9cbd77 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -91,6 +91,7 @@ interface ChatMarkdownProps {
text: string;
cwd: string | undefined;
threadRef?: ScopedThreadRef | undefined;
+ onTaskListChange?: ((input: { markerOffset: number; checked: boolean }) => void) | undefined;
isStreaming?: boolean;
skills?: ReadonlyArray<Pick<ServerProviderSkill, "name" | "displayName">>;
className?: string;
@@ -108,6 +109,17 @@ const highlightedCodeCache = new LRUCache<string>(
MAX_HIGHLIGHT_CACHE_MEMORY_BYTES,
);
const highlighterPromiseCache = new Map<string, Promise<DiffsHighlighter>>();
+
+function findTaskListMarkerOffset(markdown: string, listItemStart: number): number | null {
+ const firstLineEnd = markdown.indexOf("\n", listItemStart);
+ const firstLine = markdown.slice(
+ listItemStart,
+ firstLineEnd === -1 ? markdown.length : firstLineEnd,
+ );
+ const match = firstLine.match(/^(?:\s*(?:[-+*]|\d+[.)])\s+)(\[[ xX]\])/);
+ if (!match?.[1]) return null;
+ return listItemStart + firstLine.indexOf(match[1]);
+}
const CHAT_MARKDOWN_SANITIZE_SCHEMA = {
...defaultSchema,
attributes: {
@@ -1170,6 +1182,7 @@ function ChatMarkdown({
text,
cwd,
threadRef,
+ onTaskListChange,
isStreaming = false,
skills = EMPTY_MARKDOWN_SKILLS,
className,
@@ -1215,8 +1228,44 @@ function ChatMarkdown({
p({ node: _node, children, ...props }) {
return <p {...props}>{renderSkillInlineMarkdownChildren(children, skills)}</p>;
},
- li({ node: _node, children, ...props }) {
- return <li {...props}>{renderSkillInlineMarkdownChildren(children, skills)}</li>;
+ li({ node, children, ...props }) {
+ const listItemStart = node?.position?.start.offset;
+ const markerOffset =
+ typeof listItemStart === "number" ? findTaskListMarkerOffset(text, listItemStart) : null;
+ return (
+ <li {...props} data-task-marker-offset={markerOffset ?? undefined}>
+ {renderSkillInlineMarkdownChildren(children, skills)}
+ </li>
+ );
+ },
+ input({ node: _node, type, checked, disabled: _disabled, ...props }) {
+ if (type !== "checkbox" || !onTaskListChange) {
+ return (
+ <input
+ {...props}
+ type={type}
+ checked={checked}
+ disabled={_disabled}
+ readOnly={type === "checkbox"}
+ />
+ );
+ }
+ return (
+ <input
+ {...props}
+ type="checkbox"
+ name="markdown-task"
+ aria-label="Toggle task"
+ checked={checked}
+ onChange={(event) => {
+ const markerOffset = Number(
+ event.currentTarget.closest("li")?.dataset.taskMarkerOffset,
+ );
+ if (!Number.isSafeInteger(markerOffset)) return;
+ onTaskListChange({ markerOffset, checked: event.currentTarget.checked });
+ }}
+ />
+ );
},
a({ node, href, children, ...props }) {
const normalizedHref = href ? normalizeMarkdownLinkHrefKey(href) : "";
@@ -1330,9 +1379,11 @@ function ChatMarkdown({
fileLinkParentSuffixByPath,
isStreaming,
markdownFileLinkMetaByHref,
+ onTaskListChange,
threadRef,
resolvedTheme,
skills,
+ text,
],
);
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index b260ddec0..c12ed7ba8 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -164,6 +164,7 @@ import {
formatElementContextLabel,
} from "../lib/elementContext";
import { appendPreviewAnnotationPrompt } from "../lib/previewAnnotation";
+import { appendReviewCommentsToPrompt, type ReviewCommentContext } from "../reviewCommentContext";
import { ChatComposer, type ChatComposerHandle } from "./chat/ChatComposer";
import { ExpandedImageDialog } from "./chat/ExpandedImageDialog";
import { PullRequestThreadDialog } from "./PullRequestThreadDialog";
@@ -1119,6 +1120,7 @@ function ChatViewContent(props: ChatViewProps) {
const setComposerDraftPreviewAnnotations = useComposerDraftStore(
(store) => store.setPreviewAnnotations,
);
+ const setComposerDraftReviewComments = useComposerDraftStore((store) => store.setReviewComments);
const setComposerDraftModelSelection = useComposerDraftStore((store) => store.setModelSelection);
const setComposerDraftRuntimeMode = useComposerDraftStore((store) => store.setRuntimeMode);
const setComposerDraftInteractionMode = useComposerDraftStore(
@@ -3636,6 +3638,7 @@ function ChatViewContent(props: ChatViewProps) {
terminalContexts: composerTerminalContexts,
elementContexts: composerElementContexts,
previewAnnotations: composerPreviewAnnotations,
+ reviewComments: composerReviewComments,
selectedProvider: ctxSelectedProvider,
selectedModel: ctxSelectedModel,
selectedProviderModels: ctxSelectedProviderModels,
@@ -3652,7 +3655,10 @@ function ChatViewContent(props: ChatViewProps) {
prompt: promptForSend,
imageCount: composerImages.length,
terminalContexts: composerTerminalContexts,
- elementContextCount: composerElementContexts.length + composerPreviewAnnotations.length,
+ elementContextCount:
+ composerElementContexts.length +
+ composerPreviewAnnotations.length +
+ composerReviewComments.length,
});
if (showPlanFollowUpPrompt && activeProposedPlan) {
const followUp = resolvePlanFollowUpSubmission({
@@ -3672,7 +3678,8 @@ function ChatViewContent(props: ChatViewProps) {
composerImages.length === 0 &&
sendableComposerTerminalContexts.length === 0 &&
composerElementContexts.length === 0 &&
- composerPreviewAnnotations.length === 0
+ composerPreviewAnnotations.length === 0 &&
+ composerReviewComments.length === 0
? parseStandaloneComposerSlashCommand(trimmed)
: null;
if (standaloneSlashCommand) {
@@ -3722,14 +3729,19 @@ function ChatViewContent(props: ChatViewProps) {
const composerTerminalContextsSnapshot = [...sendableComposerTerminalContexts];
const composerElementContextsSnapshot = [...composerElementContexts];
const composerPreviewAnnotationsSnapshot = [...composerPreviewAnnotations];
+ const composerReviewCommentsSnapshot: ReviewCommentContext[] = [...composerReviewComments];
const messageTextWithContexts = appendElementContextsToPrompt(
appendTerminalContextsToPrompt(promptForSend, composerTerminalContextsSnapshot),
composerElementContextsSnapshot,
);
- const messageTextForSend = composerPreviewAnnotationsSnapshot.reduce(
+ const messageTextWithPreviewAnnotations = composerPreviewAnnotationsSnapshot.reduce(
(text, annotation) => appendPreviewAnnotationPrompt(text, annotation),
messageTextWithContexts,
);
+ const messageTextForSend = appendReviewCommentsToPrompt(
+ messageTextWithPreviewAnnotations,
+ composerReviewCommentsSnapshot,
+ );
const messageIdForSend = newMessageId();
const messageCreatedAt = new Date().toISOString();
const outgoingMessageText = formatOutgoingPrompt({
@@ -3899,6 +3911,8 @@ function ChatViewContent(props: ChatViewProps) {
composerTerminalContextsRef.current.length === 0 &&
composerElementContextsRef.current.length === 0 &&
(useComposerDraftStore.getState().getComposerDraft(composerDraftTarget)?.previewAnnotations
+ .length ?? 0) === 0 &&
+ (useComposerDraftStore.getState().getComposerDraft(composerDraftTarget)?.reviewComments
.length ?? 0) === 0
) {
setOptimisticUserMessages((existing) => {
@@ -3919,6 +3933,7 @@ function ChatViewContent(props: ChatViewProps) {
setComposerDraftTerminalContexts(composerDraftTarget, composerTerminalContextsSnapshot);
setComposerDraftElementContexts(composerDraftTarget, composerElementContextsSnapshot);
setComposerDraftPreviewAnnotations(composerDraftTarget, composerPreviewAnnotationsSnapshot);
+ setComposerDraftReviewComments(composerDraftTarget, composerReviewCommentsSnapshot);
composerRef.current?.resetCursorState({
cursor: collapseExpandedComposerCursor(promptForSend, promptForSend.length),
prompt: promptForSend,
@@ -4874,7 +4889,7 @@ function ChatViewContent(props: ChatViewProps) {
/>
) : activeRightPanelSurface?.kind === "diff" ? (
<Suspense fallback={null}>
- <DiffPanel mode="embedded" />
+ <DiffPanel mode="embedded" composerDraftTarget={composerDraftTarget} />
</Suspense>
) : (activeRightPanelSurface?.kind === "files" ||
activeRightPanelSurface?.kind === "file") &&
@@ -4886,6 +4901,10 @@ function ChatViewContent(props: ChatViewProps) {
environmentId={activeProject.environmentId}
cwd={activeWorkspaceRoot}
projectName={activeProject.name}
+ threadRef={activeThreadRef}
+ composerDraftTarget={composerDraftTarget}
+ keybindings={keybindings}
+ availableEditors={availableEditors}
relativePath={
activeRightPanelSurface.kind === "file"
? activeRightPanelSurface.relativePath
@@ -4948,7 +4967,7 @@ function ChatViewContent(props: ChatViewProps) {
/>
) : activeRightPanelSurface?.kind === "diff" ? (
<Suspense fallback={null}>
- <DiffPanel mode="embedded" />
+ <DiffPanel mode="embedded" composerDraftTarget={composerDraftTarget} />
</Suspense>
) : activeRightPanelSurface?.kind === "plan" ? (
<PlanSidebar
@@ -4973,6 +4992,10 @@ function ChatViewContent(props: ChatViewProps) {
environmentId={activeProject.environmentId}
cwd={activeWorkspaceRoot}
projectName={activeProject.name}
+ threadRef={activeThreadRef}
+ composerDraftTarget={composerDraftTarget}
+ keybindings={keybindings}
+ availableEditors={availableEditors}
relativePath={
activeRightPanelSurface.kind === "file"
? activeRightPanelSurface.relativePath
diff --git a/apps/web/src/components/DiffPanel.tsx b/apps/web/src/components/DiffPanel.tsx
index 7b492020e..080fa291e 100644
--- a/apps/web/src/components/DiffPanel.tsx
+++ b/apps/web/src/components/DiffPanel.tsx
@@ -1,7 +1,7 @@
-import { FileDiff, Virtualizer } from "@pierre/diffs/react";
+import { Virtualizer } from "@pierre/diffs/react";
import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
import { scopeThreadRef } from "@t3tools/client-runtime";
-import type { TurnId } from "@t3tools/contracts";
+import type { ScopedThreadRef, TurnId } from "@t3tools/contracts";
import {
ChevronDownIcon,
ChevronLeftIcon,
@@ -20,6 +20,7 @@ import {
useState,
} from "react";
import { openInPreferredEditor } from "../editorPreferences";
+import { type DraftId } from "../composerDraftStore";
import { useCheckpointDiff } from "~/lib/checkpointDiffState";
import { useVcsStatus } from "~/lib/vcsStatusState";
import { cn } from "~/lib/utils";
@@ -41,6 +42,7 @@ import { buildThreadRouteParams, resolveThreadRouteRef } from "../threadRoutes";
import { useSettings } from "../hooks/useSettings";
import { formatShortTimestamp } from "../timestampFormat";
import { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from "./DiffPanelShell";
+import { AnnotatableFileDiff } from "./diffs/AnnotatableFileDiff";
import { ToggleGroup, Toggle } from "./ui/toggle-group";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
@@ -147,11 +149,12 @@ const DIFF_PANEL_UNSAFE_CSS = `
interface DiffPanelProps {
mode?: DiffPanelMode;
+ composerDraftTarget: ScopedThreadRef | DraftId;
}
export { DiffWorkerPoolProvider } from "./DiffWorkerPoolProvider";
-export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
+export default function DiffPanel({ mode = "inline", composerDraftTarget }: DiffPanelProps) {
const navigate = useNavigate();
const { resolvedTheme } = useTheme();
const settings = useSettings();
@@ -218,6 +221,10 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
const selectedCheckpointTurnCount =
selectedTurn &&
(selectedTurn.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[selectedTurn.turnId]);
+ const reviewSectionId = selectedTurn ? `turn:${selectedTurn.turnId}` : "conversation";
+ const reviewSectionTitle = selectedTurn
+ ? `Turn ${selectedCheckpointTurnCount ?? "?"}`
+ : "All turns";
const selectedCheckpointRange = useMemo(
() =>
typeof selectedCheckpointTurnCount === "number"
@@ -673,8 +680,12 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
openDiffFile(filePath);
}}
>
- <FileDiff
+ <AnnotatableFileDiff
fileDiff={fileDiff}
+ filePath={filePath}
+ sectionId={reviewSectionId}
+ sectionTitle={reviewSectionTitle}
+ composerDraftTarget={composerDraftTarget}
renderHeaderPrefix={() => (
<Tooltip>
<TooltipTrigger
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx
index ac440320a..6908202e7 100644
--- a/apps/web/src/components/chat/ChatComposer.tsx
+++ b/apps/web/src/components/chat/ChatComposer.tsx
@@ -56,6 +56,7 @@ import {
import { useComposerPathSearch } from "../../lib/composerPathSearchState";
import { type ElementContextDraft } from "../../lib/elementContext";
import { ComposerPendingElementContexts } from "./ComposerPendingElementContexts";
+import { ComposerPendingReviewComments } from "./ComposerPendingReviewComments";
import { ComposerPreviewAnnotationCards } from "./ComposerPreviewAnnotationCards";
import {
shouldUseCompactComposerPrimaryActions,
@@ -117,6 +118,7 @@ import {
import { formatProviderSkillDisplayName } from "../../providerSkillPresentation";
import { searchProviderSkills } from "../../providerSkillSearch";
import { useMediaQuery } from "../../hooks/useMediaQuery";
+import type { ReviewCommentContext } from "../../reviewCommentContext";
const IMAGE_SIZE_LIMIT_LABEL = `${Math.round(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES / (1024 * 1024))}MB`;
@@ -406,6 +408,7 @@ export interface ChatComposerHandle {
terminalContexts: TerminalContextDraft[];
elementContexts: ElementContextDraft[];
previewAnnotations: PreviewAnnotationPayload[];
+ reviewComments: ReviewCommentContext[];
selectedPromptEffort: string | null;
selectedModelOptionsForDispatch: unknown;
selectedModelSelection: ModelSelection;
@@ -615,6 +618,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const composerTerminalContexts = composerDraft.terminalContexts;
const composerElementContexts = composerDraft.elementContexts;
const composerPreviewAnnotations = composerDraft.previewAnnotations;
+ const composerReviewComments = composerDraft.reviewComments;
const nonPersistedComposerImageIds = composerDraft.nonPersistedImageIds;
const setComposerDraftPrompt = useComposerDraftStore((store) => store.setPrompt);
@@ -636,6 +640,9 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
const removeComposerDraftPreviewAnnotation = useComposerDraftStore(
(store) => store.removePreviewAnnotation,
);
+ const removeComposerDraftReviewComment = useComposerDraftStore(
+ (store) => store.removeReviewComment,
+ );
const clearComposerDraftPersistedAttachments = useComposerDraftStore(
(store) => store.clearPersistedAttachments,
);
@@ -896,12 +903,16 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
prompt,
imageCount: composerImages.length,
terminalContexts: composerTerminalContexts,
- elementContextCount: composerElementContexts.length + composerPreviewAnnotations.length,
+ elementContextCount:
+ composerElementContexts.length +
+ composerPreviewAnnotations.length +
+ composerReviewComments.length,
}),
[
composerElementContexts.length,
composerImages.length,
composerPreviewAnnotations.length,
+ composerReviewComments.length,
composerTerminalContexts,
prompt,
],
@@ -1998,6 +2009,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
terminalContexts: composerTerminalContextsRef.current,
elementContexts: composerElementContextsRef.current,
previewAnnotations: composerPreviewAnnotations,
+ reviewComments: composerReviewComments,
selectedPromptEffort,
selectedModelOptionsForDispatch,
selectedModelSelection,
@@ -2017,6 +2029,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
composerTerminalContextsRef,
composerElementContextsRef,
composerPreviewAnnotations,
+ composerReviewComments,
isConnecting,
isComposerApprovalState,
pendingUserInputs.length,
@@ -2272,6 +2285,19 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
/>
)}
+ {!isComposerCollapsedMobile &&
+ !isComposerApprovalState &&
+ pendingUserInputs.length === 0 &&
+ composerReviewComments.length > 0 && (
+ <ComposerPendingReviewComments
+ comments={composerReviewComments}
+ onRemove={(commentId) =>
+ removeComposerDraftReviewComment(composerDraftTarget, commentId)
+ }
+ className="mb-3"
+ />
+ )}
+
{!isComposerCollapsedMobile &&
!isComposerApprovalState &&
pendingUserInputs.length === 0 &&
diff --git a/apps/web/src/components/chat/ComposerPendingReviewComments.browser.tsx b/apps/web/src/components/chat/ComposerPendingReviewComments.browser.tsx
new file mode 100644
index 000000000..a5aa6e224
--- /dev/null
+++ b/apps/web/src/components/chat/ComposerPendingReviewComments.browser.tsx
@@ -0,0 +1,41 @@
+import "../../index.css";
+
+import { afterEach, describe, expect, it, vi } from "vite-plus/test";
+import { page } from "vite-plus/test/browser";
+import { render } from "vitest-browser-react";
+
+import { ComposerPendingReviewComments } from "./ComposerPendingReviewComments";
+
+describe("ComposerPendingReviewComments", () => {
+ afterEach(() => {
+ document.body.innerHTML = "";
+ });
+
+ it("renders a removable file comment pill", async () => {
+ const onRemove = vi.fn();
+ const screen = await render(
+ <ComposerPendingReviewComments
+ comments={[
+ {
+ id: "comment-1",
+ sectionId: "file:src/app.ts",
+ sectionTitle: "File comment",
+ filePath: "src/app.ts",
+ startIndex: 1,
+ endIndex: 2,
+ rangeLabel: "L2 to L3",
+ text: "Keep this configurable.",
+ diff: "@@ -2,2 +2,2 @@\n two\n three",
+ },
+ ]}
+ onRemove={onRemove}
+ />,
+ );
+
+ await expect.element(page.getByText("src/app.ts L2 to L3")).toBeVisible();
+ await page.getByRole("button", { name: "Remove comment on src/app.ts L2 to L3" }).click();
+ expect(onRemove).toHaveBeenCalledWith("comment-1");
+
+ await screen.unmount();
+ });
+});
diff --git a/apps/web/src/components/chat/ComposerPendingReviewComments.tsx b/apps/web/src/components/chat/ComposerPendingReviewComments.tsx
new file mode 100644
index 000000000..0a47b0235
--- /dev/null
+++ b/apps/web/src/components/chat/ComposerPendingReviewComments.tsx
@@ -0,0 +1,60 @@
+import { MessageCircle, X } from "lucide-react";
+
+import {
+ COMPOSER_INLINE_CHIP_CLASS_NAME,
+ COMPOSER_INLINE_CHIP_DISMISS_BUTTON_CLASS_NAME,
+ COMPOSER_INLINE_CHIP_ICON_CLASS_NAME,
+ COMPOSER_INLINE_CHIP_LABEL_CLASS_NAME,
+} from "../composerInlineChip";
+import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
+import type { ReviewCommentContext } from "~/reviewCommentContext";
+import { cn } from "~/lib/utils";
+
+interface ComposerPendingReviewCommentsProps {
+ comments: ReadonlyArray<ReviewCommentContext>;
+ onRemove: (commentId: string) => void;
+ className?: string;
+}
+
+export function ComposerPendingReviewComments({
+ comments,
+ onRemove,
+ className,
+}: ComposerPendingReviewCommentsProps) {
+ if (comments.length === 0) return null;
+
+ return (
+ <div className={cn("flex flex-wrap gap-1.5", className)}>
+ {comments.map((comment) => {
+ const label = `${comment.filePath} ${comment.rangeLabel}`;
+ return (
+ <Tooltip key={comment.id}>
+ <TooltipTrigger
+ render={
+ <span className={cn(COMPOSER_INLINE_CHIP_CLASS_NAME, "pr-1")}>
+ <MessageCircle className={cn(COMPOSER_INLINE_CHIP_ICON_CLASS_NAME, "size-3.5")} />
+ <span className={COMPOSER_INLINE_CHIP_LABEL_CLASS_NAME}>{label}</span>
+ <button
+ type="button"
+ aria-label={`Remove comment on ${label}`}
+ className={COMPOSER_INLINE_CHIP_DISMISS_BUTTON_CLASS_NAME}
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ onRemove(comment.id);
+ }}
+ >
+ <X className="size-3" aria-hidden />
+ </button>
+ </span>
+ }
+ />
+ <TooltipPopup side="top" className="max-w-96 whitespace-pre-wrap leading-tight">
+ {comment.text}
+ </TooltipPopup>
+ </Tooltip>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx
index 743de5aa6..f7da222f4 100644
--- a/apps/web/src/components/chat/MessagesTimeline.test.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx
@@ -296,6 +296,42 @@ describe("MessagesTimeline", () => {
expect(markup).not.toContain("&lt;/review_comment&gt;");
});
+ it("renders file review comments as source code instead of diffs", async () => {
+ const { MessagesTimeline } = await import("./MessagesTimeline");
+ const markup = renderToStaticMarkup(
+ <MessagesTimeline
+ {...buildProps()}
+ timelineEntries={[
+ {
+ id: "entry-1",
+ kind: "message",
+ createdAt: "2026-03-17T19:12:28.000Z",
+ message: {
+ id: MessageId.make("message-source-comment"),
+ role: "user",
+ text: [
+ '<review_comment sectionId="file:docs/plan.md" sectionTitle="File comment" filePath="docs/plan.md" startIndex="0" endIndex="1" rangeLabel="L1 to L2">',
+ "Clarify this.",
+ "```md",
+ "# Plan",
+ "- Step one",
+ "```",
+ "</review_comment>",
+ ].join("\n"),
+ createdAt: "2026-03-17T19:12:28.000Z",
+ streaming: false,
+ },
+ },
+ ]}
+ />,
+ );
+
+ expect(markup).toContain("plan.md");
+ expect(markup).toContain("Clarify this.");
+ expect(markup).toContain("# Plan");
+ expect(markup).not.toContain('data-testid="file-diff"');
+ });
+
it("renders a failure marker for failed tool lifecycle entries", async () => {
const { MessagesTimeline } = await import("./MessagesTimeline");
const markup = renderToStaticMarkup(
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index 250eee4d6..d340f7ac7 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -102,6 +102,7 @@ import { SkillInlineText } from "./SkillInlineText";
import { formatWorkspaceRelativePath } from "../../filePathDisplay";
import {
buildReviewCommentRenderablePatch,
+ formatReviewCommentFence,
parseReviewCommentMessageSegments,
type ReviewCommentContext,
} from "../../reviewCommentContext";
@@ -1270,6 +1271,7 @@ const UserMessageBody = memo(function UserMessageBody(props: {
function UserMessageReviewCommentCard({ comment }: { comment: ReviewCommentContext }) {
const ctx = use(TimelineRowCtx);
+ const fenceLanguage = comment.fenceLanguage ?? "diff";
const renderablePatch = getRenderablePatch(
buildReviewCommentRenderablePatch(comment),
`review-comment:${comment.id}`,
@@ -1290,6 +1292,15 @@ function UserMessageReviewCommentCard({ comment }: { comment: ReviewCommentConte
<SkillInlineText text={comment.text} skills={ctx.skills} />
</div>
)}
+ {fenceLanguage !== "diff" && comment.diff.trim().length > 0 && (
+ <ChatMarkdown
+ text={formatReviewCommentFence(fenceLanguage, comment.diff)}
+ cwd={ctx.markdownCwd}
+ threadRef={ctx.threadRef ?? undefined}
+ skills={ctx.skills}
+ className="text-foreground"
+ />
+ )}
{renderablePatch?.kind === "files" &&
renderablePatch.files.map((fileDiff) => (
<FileDiff
diff --git a/apps/web/src/components/chat/OpenInPicker.tsx b/apps/web/src/components/chat/OpenInPicker.tsx
index cc023d34c..1bb9c0a42 100644
--- a/apps/web/src/components/chat/OpenInPicker.tsx
+++ b/apps/web/src/components/chat/OpenInPicker.tsx
@@ -154,10 +154,14 @@ export const OpenInPicker = memo(function OpenInPicker({
keybindings,
availableEditors,
openInCwd,
+ compact = false,
+ enableShortcut = true,
}: {
keybindings: ResolvedKeybindingsConfig;
availableEditors: ReadonlyArray<EditorId>;
openInCwd: string | null;
+ compact?: boolean;
+ enableShortcut?: boolean;
}) {
const [preferredEditor, setPreferredEditor] = usePreferredEditor(availableEditors);
const options = useMemo(
@@ -184,6 +188,7 @@ export const OpenInPicker = memo(function OpenInPicker({
);
useEffect(() => {
+ if (!enableShortcut) return;
const handler = (e: globalThis.KeyboardEvent) => {
const api = readLocalApi();
if (!isOpenFavoriteEditorShortcut(e, keybindings)) return;
@@ -195,24 +200,39 @@ export const OpenInPicker = memo(function OpenInPicker({
};
window.addEventListener("keydown", handler);
return () => window.removeEventListener("keydown", handler);
- }, [preferredEditor, keybindings, openInCwd]);
+ }, [enableShortcut, preferredEditor, keybindings, openInCwd]);
return (
- <Group aria-label="Subscription actions">
+ <Group aria-label="Open in editor">
<Button
+ aria-label={compact ? "Open file in preferred editor" : undefined}
size="xs"
variant="outline"
disabled={!preferredEditor || !openInCwd}
onClick={() => openInEditor(preferredEditor)}
>
{primaryOption?.Icon && <primaryOption.Icon aria-hidden="true" className="size-3.5" />}
- <span className="sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5">
+ <span
+ className={
+ compact
+ ? "sr-only"
+ : "sr-only @3xl/header-actions:not-sr-only @3xl/header-actions:ml-0.5"
+ }
+ >
Open
</span>
</Button>
- <GroupSeparator className="hidden @3xl/header-actions:block" />
+ <GroupSeparator {...(!compact ? { className: "hidden @3xl/header-actions:block" } : {})} />
<Menu>
- <MenuTrigger render={<Button aria-label="Copy options" size="icon-xs" variant="outline" />}>
+ <MenuTrigger
+ render={
+ <Button
+ aria-label={compact ? "Choose editor" : "Copy options"}
+ size="icon-xs"
+ variant="outline"
+ />
+ }
+ >
<ChevronDownIcon aria-hidden="true" className="size-4" />
</MenuTrigger>
<MenuPopup align="end">
diff --git a/apps/web/src/components/diffs/AnnotatableFileDiff.browser.tsx b/apps/web/src/components/diffs/AnnotatableFileDiff.browser.tsx
new file mode 100644
index 000000000..393c0ab16
--- /dev/null
+++ b/apps/web/src/components/diffs/AnnotatableFileDiff.browser.tsx
@@ -0,0 +1,122 @@
+import "../../index.css";
+
+import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
+import { scopeThreadRef } from "@t3tools/client-runtime";
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
+import { afterEach, describe, expect, it, vi } from "vite-plus/test";
+import { page } from "vite-plus/test/browser";
+import { render } from "vitest-browser-react";
+
+import { useComposerDraftStore } from "~/composerDraftStore";
+
+import { AnnotatableFileDiff } from "./AnnotatableFileDiff";
+
+function dispatchPointer(target: EventTarget, type: string, pointerId: number): void {
+ target.dispatchEvent(
+ new PointerEvent(type, {
+ bubbles: true,
+ cancelable: true,
+ composed: true,
+ pointerId,
+ pointerType: "mouse",
+ }),
+ );
+}
+
+const threadRef = scopeThreadRef(EnvironmentId.make("local"), ThreadId.make("thread-1"));
+
+function TestDiff() {
+ const fileDiff = parsePatchFiles(
+ [
+ "diff --git a/src/app.ts b/src/app.ts",
+ "--- a/src/app.ts",
+ "+++ b/src/app.ts",
+ "@@ -1,3 +1,3 @@",
+ " one",
+ "-two",
+ "+TWO",
+ " three",
+ ].join("\n"),
+ "annotatable-file-diff-test",
+ )[0]!.files[0]!;
+
+ return (
+ <AnnotatableFileDiff
+ fileDiff={fileDiff}
+ filePath="src/app.ts"
+ sectionId="turn:2"
+ sectionTitle="Turn 2"
+ composerDraftTarget={threadRef}
+ renderHeaderPrefix={() => null}
+ options={{
+ diffStyle: "unified",
+ lineDiffType: "none",
+ themeType: "light",
+ }}
+ />
+ );
+}
+
+async function getRenderedDiff() {
+ return vi.waitFor(() => {
+ const element = document.querySelector<HTMLElement>("diffs-container");
+ expect(element?.shadowRoot).not.toBeNull();
+ return element!;
+ });
+}
+
+describe("annotatable Pierre file diff", () => {
+ afterEach(() => {
+ document.body.innerHTML = "";
+ useComposerDraftStore.getState().setReviewComments(threadRef, []);
+ });
+
+ it("creates a local annotation from the gutter and attaches it to the composer", async () => {
+ let screen = await render(<TestDiff />);
+
+ try {
+ const diff = await getRenderedDiff();
+ const addedLineNumber = await vi.waitFor(() => {
+ const elements = Array.from(
+ diff.shadowRoot?.querySelectorAll<HTMLElement>('[data-column-number="2"]') ?? [],
+ );
+ const element = elements.at(-1) ?? null;
+ expect(element).not.toBeNull();
+ return element!;
+ });
+
+ dispatchPointer(addedLineNumber, "pointerdown", 1);
+ dispatchPointer(addedLineNumber, "pointerup", 1);
+
+ const textarea = page.getByRole("textbox", { name: "Comment on lines +2" });
+ await expect.element(textarea).toBeVisible();
+ await textarea.fill("Use the compatible value.");
+ await page.getByRole("button", { name: "Comment" }).click();
+
+ await vi.waitFor(() => {
+ expect(
+ useComposerDraftStore.getState().getComposerDraft(threadRef)?.reviewComments,
+ ).toEqual([
+ expect.objectContaining({
+ sectionId: "turn:2",
+ filePath: "src/app.ts",
+ rangeLabel: "+2",
+ text: "Use the compatible value.",
+ diff: "@@ -0,0 +2,1 @@\n+TWO",
+ }),
+ ]);
+ });
+ expect(document.querySelector("[data-file-comment-annotation]")?.textContent).toContain(
+ "Use the compatible value.",
+ );
+
+ await screen.unmount();
+ screen = await render(<TestDiff />);
+ await expect
+ .element(page.getByText("Use the compatible value.", { exact: true }))
+ .toBeVisible();
+ } finally {
+ await screen.unmount();
+ }
+ });
+});
diff --git a/apps/web/src/components/diffs/AnnotatableFileDiff.tsx b/apps/web/src/components/diffs/AnnotatableFileDiff.tsx
new file mode 100644
index 000000000..ceb2f8778
--- /dev/null
+++ b/apps/web/src/components/diffs/AnnotatableFileDiff.tsx
@@ -0,0 +1,239 @@
+import type {
+ AnnotationSide,
+ DiffLineAnnotation,
+ FileDiffMetadata,
+ SelectedLineRange,
+} from "@pierre/diffs";
+import { FileDiff, type FileDiffProps } from "@pierre/diffs/react";
+import type { ScopedThreadRef } from "@t3tools/contracts";
+import { useCallback, useMemo, useState, type ReactNode } from "react";
+
+import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
+import {
+ buildDiffReviewComment,
+ restoreDiffReviewCommentRange,
+ type ReviewCommentContext,
+} from "~/reviewCommentContext";
+
+import { LocalCommentAnnotation } from "../files/LocalCommentAnnotation";
+import { nextFileCommentId } from "../files/fileCommentAnnotations";
+
+interface DiffCommentAnnotationEntry {
+ id: string;
+ kind: "draft" | "comment";
+ range: SelectedLineRange;
+ rangeLabel: string;
+ text: string;
+}
+
+interface DiffCommentAnnotationGroup {
+ entries: DiffCommentAnnotationEntry[];
+}
+
+type DiffCommentLineAnnotation = DiffLineAnnotation<DiffCommentAnnotationGroup>;
+const EMPTY_REVIEW_COMMENTS: ReadonlyArray<ReviewCommentContext> = [];
+
+function annotationSide(range: SelectedLineRange): AnnotationSide {
+ return (range.endSide ?? range.side) === "deletions" ? "deletions" : "additions";
+}
+
+function appendAnnotationEntry(
+ annotations: ReadonlyArray<DiffCommentLineAnnotation>,
+ range: SelectedLineRange,
+ entry: DiffCommentAnnotationEntry,
+): DiffCommentLineAnnotation[] {
+ const side = annotationSide(range);
+ const annotationIndex = annotations.findIndex(
+ (annotation) => annotation.side === side && annotation.lineNumber === range.end,
+ );
+ if (annotationIndex < 0) {
+ return [
+ ...annotations,
+ {
+ side,
+ lineNumber: range.end,
+ metadata: { entries: [entry] },
+ },
+ ];
+ }
+ return annotations.map((annotation, index) =>
+ index === annotationIndex
+ ? {
+ ...annotation,
+ metadata: { entries: [...annotation.metadata.entries, entry] },
+ }
+ : annotation,
+ );
+}
+
+interface AnnotatableFileDiffProps {
+ fileDiff: FileDiffMetadata;
+ filePath: string;
+ sectionId: string;
+ sectionTitle: string;
+ composerDraftTarget: ScopedThreadRef | DraftId;
+ options: FileDiffProps<DiffCommentAnnotationGroup>["options"];
+ renderHeaderPrefix: (fileDiff: FileDiffMetadata) => ReactNode;
+}
+
+export function AnnotatableFileDiff({
+ fileDiff,
+ filePath,
+ sectionId,
+ sectionTitle,
+ composerDraftTarget,
+ options,
+ renderHeaderPrefix,
+}: AnnotatableFileDiffProps) {
+ const addReviewComment = useComposerDraftStore((store) => store.addReviewComment);
+ const removeReviewComment = useComposerDraftStore((store) => store.removeReviewComment);
+ const reviewComments = useComposerDraftStore(
+ (store) => store.getComposerDraft(composerDraftTarget)?.reviewComments ?? EMPTY_REVIEW_COMMENTS,
+ );
+ const [selectedRange, setSelectedRange] = useState<SelectedLineRange | null>(null);
+ const [draftAnnotation, setDraftAnnotation] = useState<DiffCommentLineAnnotation | null>(null);
+ const persistedAnnotations = useMemo(
+ () =>
+ reviewComments
+ .filter(
+ (comment) =>
+ comment.sectionId === sectionId &&
+ comment.filePath === filePath &&
+ (comment.fenceLanguage ?? "diff") === "diff",
+ )
+ .reduce<DiffCommentLineAnnotation[]>((annotations, comment) => {
+ const range = restoreDiffReviewCommentRange(fileDiff, comment);
+ if (!range) return annotations;
+ return appendAnnotationEntry(annotations, range, {
+ id: comment.id,
+ kind: "comment",
+ range,
+ rangeLabel: comment.rangeLabel,
+ text: comment.text,
+ });
+ }, []),
+ [fileDiff, filePath, reviewComments, sectionId],
+ );
+ const lineAnnotations = useMemo(
+ () => (draftAnnotation ? [...persistedAnnotations, draftAnnotation] : persistedAnnotations),
+ [draftAnnotation, persistedAnnotations],
+ );
+
+ const removeAnnotationEntry = useCallback(
+ (entryId: string) => {
+ setSelectedRange(null);
+ if (
+ draftAnnotation?.metadata.entries.some(
+ (entry) => entry.id === entryId && entry.kind === "draft",
+ )
+ ) {
+ setDraftAnnotation(null);
+ return;
+ }
+ removeReviewComment(composerDraftTarget, entryId);
+ },
+ [composerDraftTarget, draftAnnotation, removeReviewComment],
+ );
+
+ const submitAnnotationEntry = useCallback(
+ (entryId: string, text: string) => {
+ const entry = draftAnnotation?.metadata.entries.find((candidate) => candidate.id === entryId);
+ if (!entry) return;
+
+ const comment = buildDiffReviewComment({
+ id: entry.id,
+ sectionId,
+ sectionTitle,
+ filePath,
+ fileDiff,
+ range: entry.range,
+ text,
+ });
+ if (comment) {
+ addReviewComment(composerDraftTarget, comment);
+ }
+ setSelectedRange(null);
+ setDraftAnnotation(null);
+ },
+ [
+ addReviewComment,
+ composerDraftTarget,
+ fileDiff,
+ filePath,
+ draftAnnotation,
+ sectionId,
+ sectionTitle,
+ ],
+ );
+
+ const beginComment = useCallback(
+ (range: SelectedLineRange) => {
+ const id = nextFileCommentId();
+ const comment = buildDiffReviewComment({
+ id,
+ sectionId,
+ sectionTitle,
+ filePath,
+ fileDiff,
+ range,
+ text: "",
+ });
+ if (!comment) return;
+
+ const draftEntry: DiffCommentAnnotationEntry = {
+ id,
+ kind: "draft",
+ range,
+ rangeLabel: comment.rangeLabel,
+ text: "",
+ };
+ setDraftAnnotation({
+ side: annotationSide(range),
+ lineNumber: range.end,
+ metadata: { entries: [draftEntry] },
+ });
+ },
+ [fileDiff, filePath, sectionId, sectionTitle],
+ );
+
+ const hasOpenCommentForm = draftAnnotation !== null;
+ const handleLineSelectionEnd = useCallback(
+ (range: SelectedLineRange | null) => {
+ setSelectedRange(range);
+ if (range) beginComment(range);
+ },
+ [beginComment],
+ );
+
+ return (
+ <FileDiff<DiffCommentAnnotationGroup>
+ fileDiff={fileDiff}
+ renderHeaderPrefix={renderHeaderPrefix}
+ options={{
+ ...options,
+ enableGutterUtility: !hasOpenCommentForm,
+ enableLineSelection: !hasOpenCommentForm,
+ onGutterUtilityClick: setSelectedRange,
+ onLineSelectionChange: setSelectedRange,
+ onLineSelectionEnd: handleLineSelectionEnd,
+ }}
+ selectedLines={selectedRange}
+ lineAnnotations={lineAnnotations}
+ renderAnnotation={(annotation) => (
+ <div className="py-1">
+ {annotation.metadata.entries.map((entry) => (
+ <LocalCommentAnnotation
+ key={entry.id}
+ kind={entry.kind}
+ rangeLabel={entry.rangeLabel}
+ text={entry.text}
+ onCancel={() => removeAnnotationEntry(entry.id)}
+ onComment={(text) => submitAnnotationEntry(entry.id, text)}
+ onDelete={() => removeAnnotationEntry(entry.id)}
+ />
+ ))}
+ </div>
+ )}
+ />
+ );
+}
diff --git a/apps/web/src/components/files/FilePreviewPanel.browser.tsx b/apps/web/src/components/files/FilePreviewPanel.browser.tsx
new file mode 100644
index 000000000..7886e99cb
--- /dev/null
+++ b/apps/web/src/components/files/FilePreviewPanel.browser.tsx
@@ -0,0 +1,168 @@
+import "../../index.css";
+
+import type { LineAnnotation, SelectedLineRange } from "@pierre/diffs";
+import { Editor } from "@pierre/diffs/editor";
+import { EditorProvider, File } from "@pierre/diffs/react";
+import { afterEach, describe, expect, it, vi } from "vite-plus/test";
+import { page } from "vite-plus/test/browser";
+import { render } from "vitest-browser-react";
+import { useEffect, useMemo, useRef, useState } from "react";
+
+import { installFileEditorDismissal } from "./fileEditorDismissal";
+
+interface AnnotationMetadata {
+ label: string;
+}
+
+function dispatchPointer(target: EventTarget, type: string, pointerId: number): void {
+ target.dispatchEvent(
+ new PointerEvent(type, {
+ bubbles: true,
+ cancelable: true,
+ composed: true,
+ pointerId,
+ pointerType: "mouse",
+ }),
+ );
+}
+
+function EditableAnnotatedFile() {
+ const [selectedLines, setSelectedLines] = useState<SelectedLineRange | null>(null);
+ const [lineAnnotations, setLineAnnotations] = useState<LineAnnotation<AnnotationMetadata>[]>([]);
+ const rootRef = useRef<HTMLDivElement>(null);
+ const editor = useMemo(() => new Editor<AnnotationMetadata>(), []);
+
+ useEffect(() => () => editor.cleanUp(), [editor]);
+ useEffect(() => {
+ const root = rootRef.current;
+ if (!root) return;
+ return installFileEditorDismissal({
+ root,
+ editor,
+ isBlocked: () => false,
+ onDismiss: () => setSelectedLines(null),
+ });
+ }, [editor]);
+
+ return (
+ <>
+ <div ref={rootRef}>
+ <EditorProvider editor={editor}>
+ <File<AnnotationMetadata>
+ file={{ name: "example.ts", contents: "one\ntwo\nthree\n" }}
+ options={{
+ disableFileHeader: true,
+ enableGutterUtility: true,
+ enableLineSelection: true,
+ onGutterUtilityClick: setSelectedLines,
+ onLineSelectionChange: setSelectedLines,
+ onLineSelectionEnd: (range) => {
+ setSelectedLines(range);
+ if (range) {
+ setLineAnnotations([
+ {
+ lineNumber: Math.max(range.start, range.end),
+ metadata: { label: `${range.start}:${range.end}` },
+ },
+ ]);
+ }
+ },
+ }}
+ selectedLines={selectedLines}
+ lineAnnotations={lineAnnotations}
+ renderAnnotation={(annotation) => (
+ <div data-test-file-annotation contentEditable={false}>
+ {annotation.metadata.label}
+ </div>
+ )}
+ disableWorkerPool
+ contentEditable
+ />
+ </EditorProvider>
+ </div>
+ <button type="button">Outside file</button>
+ </>
+ );
+}
+
+async function getEditableFile() {
+ const file = await vi.waitFor(() => {
+ const element = document.querySelector<HTMLElement>("diffs-container");
+ expect(element?.shadowRoot).not.toBeNull();
+ return element!;
+ });
+ const content = await vi.waitFor(() => {
+ const element = file?.shadowRoot?.querySelector<HTMLElement>("[data-content]") ?? null;
+ expect(element).not.toBeNull();
+ return element!;
+ });
+ return { file, content };
+}
+
+describe("editable Pierre file annotations", () => {
+ afterEach(() => {
+ document.body.innerHTML = "";
+ });
+
+ it("keeps gutter selection and annotations enabled while the file is editable", async () => {
+ const screen = await render(<EditableAnnotatedFile />);
+
+ try {
+ const { file, content } = await getEditableFile();
+ const secondLineNumber = await vi.waitFor(() => {
+ const element =
+ file?.shadowRoot?.querySelector<HTMLElement>('[data-column-number="2"]') ?? null;
+ expect(element).not.toBeNull();
+ return element;
+ });
+ await vi.waitFor(() => {
+ expect(
+ file?.shadowRoot?.querySelector("pre")?.hasAttribute("data-interactive-line-numbers"),
+ ).toBe(true);
+ });
+
+ dispatchPointer(secondLineNumber!, "pointerdown", 1);
+ dispatchPointer(secondLineNumber!, "pointerup", 1);
+
+ await vi.waitFor(() => {
+ expect(document.querySelector("[data-test-file-annotation]")?.textContent).toBe("2:2");
+ });
+
+ expect(content.contentEditable).toBe("true");
+ expect(content.getAttribute("role")).toBe("textbox");
+ } finally {
+ await screen.unmount();
+ }
+ });
+
+ it("dismisses editor focus and selection with outside click or Escape", async () => {
+ const screen = await render(<EditableAnnotatedFile />);
+
+ try {
+ const { file, content } = await getEditableFile();
+ content.focus();
+ expect(file?.shadowRoot?.activeElement).toBe(content);
+
+ await page.getByRole("button", { name: "Outside file" }).click();
+ await vi.waitFor(() => {
+ expect(file?.shadowRoot?.activeElement).not.toBe(content);
+ });
+
+ content.focus();
+ expect(file?.shadowRoot?.activeElement).toBe(content);
+ content.dispatchEvent(
+ new KeyboardEvent("keydown", {
+ key: "Escape",
+ bubbles: true,
+ cancelable: true,
+ composed: true,
+ }),
+ );
+ await vi.waitFor(() => {
+ expect(file?.shadowRoot?.activeElement).not.toBe(content);
+ });
+ } finally {
+ await screen.unmount();
+ }
+ });
+});
diff --git a/apps/web/src/components/files/FilePreviewPanel.test.ts b/apps/web/src/components/files/FilePreviewPanel.test.ts
new file mode 100644
index 000000000..3b5295f18
--- /dev/null
+++ b/apps/web/src/components/files/FilePreviewPanel.test.ts
@@ -0,0 +1,82 @@
+import { describe, expect, it } from "vite-plus/test";
+
+import {
+ formatFileCommentRange,
+ normalizeFileCommentRange,
+ remapFileCommentAnnotations,
+} from "./fileCommentAnnotations";
+import { isMarkdownPreviewFile, setMarkdownTaskChecked } from "./filePreviewMode";
+
+describe("file comment annotations", () => {
+ it("normalizes and formats selected line ranges", () => {
+ expect(normalizeFileCommentRange({ start: 16, end: 7 })).toEqual({
+ startLine: 7,
+ endLine: 16,
+ });
+ expect(formatFileCommentRange(7, 7)).toBe("L7");
+ expect(formatFileCommentRange(7, 16)).toBe("L7 to L16");
+ });
+
+ it("keeps an annotation range attached when Pierre remaps its anchor line", () => {
+ expect(
+ remapFileCommentAnnotations([
+ {
+ lineNumber: 20,
+ metadata: {
+ entries: [
+ {
+ id: "comment-1",
+ kind: "comment",
+ startLine: 7,
+ endLine: 16,
+ text: "Keep this guarded.",
+ },
+ ],
+ },
+ },
+ ]),
+ ).toEqual([
+ {
+ lineNumber: 20,
+ metadata: {
+ entries: [
+ {
+ id: "comment-1",
+ kind: "comment",
+ startLine: 11,
+ endLine: 20,
+ text: "Keep this guarded.",
+ },
+ ],
+ },
+ },
+ ]);
+ });
+});
+
+describe("isMarkdownPreviewFile", () => {
+ it("recognizes markdown and MDX files case-insensitively", () => {
+ expect(isMarkdownPreviewFile("README.md")).toBe(true);
+ expect(isMarkdownPreviewFile("docs/guide.MDX")).toBe(true);
+ });
+
+ it("does not treat other text files as markdown", () => {
+ expect(isMarkdownPreviewFile("docs/guide.txt")).toBe(false);
+ expect(isMarkdownPreviewFile("docs/markdown.ts")).toBe(false);
+ });
+});
+
+describe("setMarkdownTaskChecked", () => {
+ const markdown = "- [ ] First\n- [x] Second\n";
+
+ it("checks and unchecks the task marker at the supplied offset", () => {
+ expect(setMarkdownTaskChecked(markdown, 2, true)).toBe("- [x] First\n- [x] Second\n");
+ expect(setMarkdownTaskChecked(markdown, 14, false)).toBe("- [ ] First\n- [ ] Second\n");
+ expect(setMarkdownTaskChecked("1. [X] Ordered\n", 3, false)).toBe("1. [ ] Ordered\n");
+ });
+
+ it("leaves the document unchanged for a stale or invalid marker offset", () => {
+ expect(setMarkdownTaskChecked(markdown, 0, true)).toBe(markdown);
+ expect(setMarkdownTaskChecked(markdown, 200, true)).toBe(markdown);
+ });
+});
diff --git a/apps/web/src/components/files/FilePreviewPanel.tsx b/apps/web/src/components/files/FilePreviewPanel.tsx
index ec76ee84d..d3d24a79b 100644
--- a/apps/web/src/components/files/FilePreviewPanel.tsx
+++ b/apps/web/src/components/files/FilePreviewPanel.tsx
@@ -1,23 +1,51 @@
-import type { EnvironmentId } from "@t3tools/contracts";
+import type {
+ EditorId,
+ EnvironmentId,
+ ResolvedKeybindingsConfig,
+ ScopedThreadRef,
+} from "@t3tools/contracts";
+import type { SelectedLineRange } from "@pierre/diffs";
import { Editor } from "@pierre/diffs/editor";
import { EditorProvider, File, Virtualizer } from "@pierre/diffs/react";
-import { ChevronRight, FolderTree, LoaderCircle } from "lucide-react";
-import { useEffect, useMemo, useRef, useState } from "react";
+import { ChevronRight, Code2, Eye, FolderTree, Globe2, LoaderCircle } from "lucide-react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { isBrowserPreviewFile, openFileInPreview } from "~/browser/openFileInPreview";
+import ChatMarkdown from "~/components/ChatMarkdown";
+import { OpenInPicker } from "~/components/chat/OpenInPicker";
import { ensureEnvironmentApi } from "~/environmentApi";
+import { usePrimaryEnvironmentId } from "~/environments/primary/context";
import { useTheme } from "~/hooks/useTheme";
import { resolveDiffThemeName } from "~/lib/diffRendering";
import { cn } from "~/lib/utils";
+import { isPreviewSupportedInRuntime } from "~/previewStateStore";
+import { resolvePathLinkTarget } from "~/terminal-links";
import { ScrollArea } from "~/components/ui/scroll-area";
import { Toggle } from "~/components/ui/toggle";
import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
+import { stackedThreadToast, toastManager } from "~/components/ui/toast";
+import { type DraftId, useComposerDraftStore } from "~/composerDraftStore";
+import { buildFileReviewComment } from "~/reviewCommentContext";
import FileBrowserPanel from "./FileBrowserPanel";
+import {
+ type FileCommentAnnotationEntry,
+ type FileCommentAnnotationGroup,
+ type FileCommentLineAnnotation,
+ formatFileCommentRange,
+ nextFileCommentId,
+ normalizeFileCommentRange,
+ remapFileCommentAnnotations,
+} from "./fileCommentAnnotations";
+import { installFileEditorDismissal } from "./fileEditorDismissal";
+import { LocalCommentAnnotation } from "./LocalCommentAnnotation";
import { projectFileCacheKey } from "./fileContentRevision";
import { fileBreadcrumbs } from "./filePath";
+import { isMarkdownPreviewFile, setMarkdownTaskChecked } from "./filePreviewMode";
import { FileSaveCoordinator } from "./fileSaveCoordinator";
import {
confirmProjectFileQueryData,
+ getOptimisticProjectFileQueryData,
setProjectFileQueryData,
useProjectFileQuery,
} from "./projectFilesQueryState";
@@ -27,6 +55,10 @@ interface FilePreviewPanelProps {
cwd: string;
projectName: string;
relativePath: string | null;
+ threadRef: ScopedThreadRef;
+ composerDraftTarget: ScopedThreadRef | DraftId;
+ keybindings: ResolvedKeybindingsConfig;
+ availableEditors: ReadonlyArray<EditorId>;
onOpenFile: (relativePath: string) => void;
onPendingChange: (relativePath: string, pending: boolean) => void;
}
@@ -38,20 +70,22 @@ interface EditableFileSurfaceProps {
environmentId: EnvironmentId;
cwd: string;
relativePath: string;
+ composerDraftTarget: ScopedThreadRef | DraftId;
contents: string;
resolvedTheme: "light" | "dark";
onPendingChange: (relativePath: string, pending: boolean) => void;
}
-function EditableFileSurface({
+function useFileSaveCoordinator({
environmentId,
cwd,
relativePath,
- contents,
- resolvedTheme,
onPendingChange,
-}: EditableFileSurfaceProps) {
- const saveCoordinator = useMemo(
+}: Pick<
+ EditableFileSurfaceProps,
+ "environmentId" | "cwd" | "relativePath" | "onPendingChange"
+>): FileSaveCoordinator {
+ const coordinator = useMemo(
() =>
new FileSaveCoordinator({
debounceMs: FILE_SAVE_DEBOUNCE_MS,
@@ -69,54 +103,270 @@ function EditableFileSurface({
}),
[cwd, environmentId, onPendingChange, relativePath],
);
+
+ useEffect(() => () => coordinator.dispose(), [coordinator]);
+ return coordinator;
+}
+
+function EditableFileSurface({
+ environmentId,
+ cwd,
+ relativePath,
+ composerDraftTarget,
+ contents,
+ resolvedTheme,
+ onPendingChange,
+}: EditableFileSurfaceProps) {
+ const addReviewComment = useComposerDraftStore((store) => store.addReviewComment);
+ const removeReviewComment = useComposerDraftStore((store) => store.removeReviewComment);
+ const [lineAnnotations, setLineAnnotations] = useState<FileCommentLineAnnotation[]>([]);
+ const [selectedRange, setSelectedRange] = useState<SelectedLineRange | null>(null);
+ const surfaceRef = useRef<HTMLDivElement>(null);
+ const saveCoordinator = useFileSaveCoordinator({
+ environmentId,
+ cwd,
+ relativePath,
+ onPendingChange,
+ });
const editor = useMemo(
() =>
- new Editor({
- onChange: (file) => {
+ new Editor<FileCommentAnnotationGroup>({
+ onChange: (file, nextLineAnnotations) => {
setProjectFileQueryData(environmentId, cwd, relativePath, file.contents);
saveCoordinator.change(file.contents);
+ if (nextLineAnnotations) {
+ const remapped = remapFileCommentAnnotations(
+ nextLineAnnotations as FileCommentLineAnnotation[],
+ );
+ setLineAnnotations(remapped);
+ for (const annotation of remapped) {
+ for (const entry of annotation.metadata.entries) {
+ if (entry.kind !== "comment") continue;
+ addReviewComment(
+ composerDraftTarget,
+ buildFileReviewComment({
+ id: entry.id,
+ filePath: relativePath,
+ startLine: entry.startLine,
+ endLine: entry.endLine,
+ text: entry.text,
+ contents: file.contents,
+ }),
+ );
+ }
+ }
+ }
},
}),
- [cwd, environmentId, relativePath, saveCoordinator],
+ [addReviewComment, composerDraftTarget, cwd, environmentId, relativePath, saveCoordinator],
);
useEffect(
() => () => {
editor.cleanUp();
- saveCoordinator.dispose();
},
- [editor, saveCoordinator],
+ [editor],
+ );
+
+ const removeAnnotationEntry = useCallback(
+ (entryId: string) => {
+ setSelectedRange(null);
+ removeReviewComment(composerDraftTarget, entryId);
+ setLineAnnotations((current) => {
+ return current.flatMap((annotation) => {
+ const entries = annotation.metadata.entries.filter((entry) => entry.id !== entryId);
+ return entries.length > 0 ? [{ ...annotation, metadata: { entries } }] : [];
+ });
+ });
+ },
+ [composerDraftTarget, removeReviewComment],
+ );
+
+ const submitAnnotationEntry = useCallback(
+ (entryId: string, text: string) => {
+ setSelectedRange(null);
+ const entry = lineAnnotations
+ .flatMap((annotation) => annotation.metadata.entries)
+ .find((candidate) => candidate.id === entryId);
+ if (entry) {
+ addReviewComment(
+ composerDraftTarget,
+ buildFileReviewComment({
+ id: entry.id,
+ filePath: relativePath,
+ startLine: entry.startLine,
+ endLine: entry.endLine,
+ text,
+ contents,
+ }),
+ );
+ }
+ setLineAnnotations((current) =>
+ current.map((annotation) => ({
+ ...annotation,
+ metadata: {
+ entries: annotation.metadata.entries.map((annotationEntry) =>
+ annotationEntry.id === entryId
+ ? { ...annotationEntry, kind: "comment", text }
+ : annotationEntry,
+ ),
+ },
+ })),
+ );
+ },
+ [addReviewComment, composerDraftTarget, contents, lineAnnotations, relativePath],
+ );
+
+ const beginComment = useCallback((range: SelectedLineRange) => {
+ const { startLine, endLine } = normalizeFileCommentRange(range);
+ const draftEntry: FileCommentAnnotationEntry = {
+ id: nextFileCommentId(),
+ kind: "draft",
+ startLine,
+ endLine,
+ text: "",
+ };
+ setLineAnnotations((current) => {
+ const withoutDraft = current.flatMap((annotation) => {
+ const entries = annotation.metadata.entries.filter((entry) => entry.kind !== "draft");
+ return entries.length > 0 ? [{ ...annotation, metadata: { entries } }] : [];
+ });
+ const existingIndex = withoutDraft.findIndex(
+ (annotation) => annotation.lineNumber === endLine,
+ );
+ if (existingIndex < 0) {
+ return [
+ ...withoutDraft,
+ {
+ lineNumber: endLine,
+ metadata: { entries: [draftEntry] },
+ },
+ ];
+ }
+ return withoutDraft.map((annotation, index) =>
+ index === existingIndex
+ ? {
+ ...annotation,
+ metadata: { entries: [...annotation.metadata.entries, draftEntry] },
+ }
+ : annotation,
+ );
+ });
+ }, []);
+ const hasOpenCommentForm = lineAnnotations.some((annotation) =>
+ annotation.metadata.entries.some((entry) => entry.kind === "draft"),
+ );
+ useEffect(() => {
+ const root = surfaceRef.current;
+ if (!root) return;
+ return installFileEditorDismissal({
+ root,
+ editor,
+ isBlocked: () => hasOpenCommentForm,
+ onDismiss: () => setSelectedRange(null),
+ });
+ }, [editor, hasOpenCommentForm]);
+ const handleLineSelectionEnd = useCallback(
+ (range: SelectedLineRange | null) => {
+ setSelectedRange(range);
+ if (range) {
+ beginComment(range);
+ }
+ },
+ [beginComment],
);
return (
<EditorProvider editor={editor}>
- <Virtualizer
- className="file-preview-virtualizer min-h-0 flex-1 overflow-auto"
- config={{
- overscrollSize: 600,
- intersectionObserverMargin: 1200,
- }}
- >
- <File
- file={{
- name: relativePath,
- contents,
- cacheKey: projectFileCacheKey(cwd, relativePath, contents),
+ <div ref={surfaceRef} className="flex min-h-0 flex-1">
+ <Virtualizer
+ className="file-preview-virtualizer min-h-0 flex-1 overflow-auto"
+ config={{
+ overscrollSize: 600,
+ intersectionObserverMargin: 1200,
}}
- options={{
- disableFileHeader: true,
- overflow: "scroll",
- theme: resolveDiffThemeName(resolvedTheme),
- themeType: resolvedTheme,
- }}
- className="min-h-full"
- contentEditable
- />
- </Virtualizer>
+ >
+ <File<FileCommentAnnotationGroup>
+ file={{
+ name: relativePath,
+ contents,
+ cacheKey: projectFileCacheKey(cwd, relativePath, contents),
+ }}
+ options={{
+ disableFileHeader: true,
+ enableGutterUtility: !hasOpenCommentForm,
+ enableLineSelection: !hasOpenCommentForm,
+ onGutterUtilityClick: setSelectedRange,
+ onLineSelectionChange: setSelectedRange,
+ onLineSelectionEnd: handleLineSelectionEnd,
+ overflow: "scroll",
+ theme: resolveDiffThemeName(resolvedTheme),
+ themeType: resolvedTheme,
+ }}
+ selectedLines={selectedRange}
+ lineAnnotations={lineAnnotations}
+ renderAnnotation={(annotation) => (
+ <div className="py-1">
+ {annotation.metadata.entries.map((entry) => (
+ <LocalCommentAnnotation
+ key={entry.id}
+ kind={entry.kind}
+ rangeLabel={formatFileCommentRange(entry.startLine, entry.endLine)}
+ text={entry.text}
+ onCancel={() => removeAnnotationEntry(entry.id)}
+ onComment={(text) => submitAnnotationEntry(entry.id, text)}
+ onDelete={() => removeAnnotationEntry(entry.id)}
+ />
+ ))}
+ </div>
+ )}
+ className="min-h-full"
+ contentEditable
+ />
+ </Virtualizer>
+ </div>
</EditorProvider>
);
}
+function RenderedMarkdownSurface({
+ environmentId,
+ cwd,
+ relativePath,
+ contents,
+ threadRef,
+ onPendingChange,
+}: Omit<EditableFileSurfaceProps, "resolvedTheme" | "composerDraftTarget"> & {
+ threadRef: ScopedThreadRef;
+}) {
+ const saveCoordinator = useFileSaveCoordinator({
+ environmentId,
+ cwd,
+ relativePath,
+ onPendingChange,
+ });
+
+ return (
+ <ScrollArea className="min-h-0 flex-1">
+ <ChatMarkdown
+ text={contents}
+ cwd={cwd}
+ threadRef={threadRef}
+ className="mx-auto max-w-4xl px-6 py-5"
+ onTaskListChange={({ markerOffset, checked }) => {
+ const currentContents =
+ getOptimisticProjectFileQueryData(environmentId, cwd, relativePath)?.contents ??
+ contents;
+ const nextContents = setMarkdownTaskChecked(currentContents, markerOffset, checked);
+ if (nextContents === currentContents) return;
+ setProjectFileQueryData(environmentId, cwd, relativePath, nextContents);
+ saveCoordinator.change(nextContents);
+ }}
+ />
+ </ScrollArea>
+ );
+}
+
function initialExplorerOpen(): boolean {
try {
return window.localStorage.getItem(FILE_EXPLORER_STORAGE_KEY) !== "false";
@@ -130,13 +380,24 @@ export default function FilePreviewPanel({
cwd,
projectName,
relativePath,
+ threadRef,
+ composerDraftTarget,
+ keybindings,
+ availableEditors,
onOpenFile,
onPendingChange,
}: FilePreviewPanelProps) {
const { resolvedTheme } = useTheme();
+ const primaryEnvironmentId = usePrimaryEnvironmentId();
const file = useProjectFileQuery(environmentId, cwd, relativePath);
const [explorerOpen, setExplorerOpen] = useState(initialExplorerOpen);
+ const [renderedMarkdownPath, setRenderedMarkdownPath] = useState<string | null>(null);
const breadcrumbRef = useRef<HTMLDivElement>(null);
+ const isMarkdown = relativePath ? isMarkdownPreviewFile(relativePath) : false;
+ const renderMarkdown = isMarkdown && renderedMarkdownPath === relativePath;
+ const canOpenInBrowser =
+ relativePath !== null && isPreviewSupportedInRuntime() && isBrowserPreviewFile(relativePath);
+ const absolutePath = relativePath ? resolvePathLinkTarget(relativePath, cwd) : null;
const breadcrumbs = useMemo(
() => (relativePath ? fileBreadcrumbs(projectName, relativePath) : []),
[projectName, relativePath],
@@ -159,6 +420,19 @@ export default function FilePreviewPanel({
});
};
+ const handleOpenInBrowser = () => {
+ if (!absolutePath) return;
+ void openFileInPreview(threadRef, absolutePath).catch((error) => {
+ toastManager.add(
+ stackedThreadToast({
+ type: "error",
+ title: "Unable to open file in browser",
+ description: error instanceof Error ? error.message : "An error occurred.",
+ }),
+ );
+ });
+ };
+
return (
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-background">
{relativePath ? (
@@ -195,6 +469,57 @@ export default function FilePreviewPanel({
))}
</div>
</ScrollArea>
+ {absolutePath && environmentId === primaryEnvironmentId ? (
+ <OpenInPicker
+ keybindings={keybindings}
+ availableEditors={availableEditors}
+ openInCwd={absolutePath}
+ compact
+ enableShortcut={false}
+ />
+ ) : null}
+ {isMarkdown ? (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Toggle
+ className="shrink-0"
+ pressed={renderMarkdown}
+ onPressedChange={(pressed) =>
+ setRenderedMarkdownPath(pressed ? relativePath : null)
+ }
+ aria-label={renderMarkdown ? "Show markdown source" : "Show rendered markdown"}
+ variant="ghost"
+ size="sm"
+ >
+ {renderMarkdown ? <Code2 className="size-3.5" /> : <Eye className="size-3.5" />}
+ </Toggle>
+ }
+ />
+ <TooltipPopup>
+ {renderMarkdown ? "Show markdown source" : "Show rendered markdown"}
+ </TooltipPopup>
+ </Tooltip>
+ ) : null}
+ {canOpenInBrowser ? (
+ <Tooltip>
+ <TooltipTrigger
+ render={
+ <Toggle
+ className="shrink-0"
+ pressed={false}
+ onPressedChange={handleOpenInBrowser}
+ aria-label="Open file in preview browser"
+ variant="ghost"
+ size="sm"
+ >
+ <Globe2 className="size-3.5" />
+ </Toggle>
+ }
+ />
+ <TooltipPopup>Open file in preview browser</TooltipPopup>
+ </Tooltip>
+ ) : null}
<Tooltip>
<TooltipTrigger
render={
@@ -237,7 +562,16 @@ export default function FilePreviewPanel({
<LoaderCircle className="size-5 animate-spin" />
</div>
) : relativePath && file.data ? (
- file.data.truncated ? (
+ isMarkdown && renderMarkdown ? (
+ <RenderedMarkdownSurface
+ environmentId={environmentId}
+ cwd={cwd}
+ relativePath={relativePath}
+ threadRef={threadRef}
+ contents={file.data.contents}
+ onPendingChange={onPendingChange}
+ />
+ ) : file.data.truncated ? (
<Virtualizer
key={`${relativePath}:${resolvedTheme}:${file.data.byteLength}`}
className="file-preview-virtualizer min-h-0 flex-1 overflow-auto"
@@ -267,6 +601,7 @@ export default function FilePreviewPanel({
environmentId={environmentId}
cwd={cwd}
relativePath={relativePath}
+ composerDraftTarget={composerDraftTarget}
contents={file.data.contents}
resolvedTheme={resolvedTheme}
onPendingChange={onPendingChange}
diff --git a/apps/web/src/components/files/LocalCommentAnnotation.tsx b/apps/web/src/components/files/LocalCommentAnnotation.tsx
new file mode 100644
index 000000000..a2765b02d
--- /dev/null
+++ b/apps/web/src/components/files/LocalCommentAnnotation.tsx
@@ -0,0 +1,90 @@
+import { MessageCircle, Trash2 } from "lucide-react";
+import { useState } from "react";
+
+import { Button } from "~/components/ui/button";
+import { Textarea } from "~/components/ui/textarea";
+
+interface LocalCommentAnnotationProps {
+ kind: "draft" | "comment";
+ rangeLabel: string;
+ text: string;
+ onCancel: () => void;
+ onComment: (text: string) => void;
+ onDelete: () => void;
+}
+
+export function LocalCommentAnnotation({
+ kind,
+ rangeLabel,
+ text: savedText,
+ onCancel,
+ onComment,
+ onDelete,
+}: LocalCommentAnnotationProps) {
+ const [text, setText] = useState("");
+
+ if (kind === "comment") {
+ return (
+ <div
+ data-file-comment-annotation
+ className="mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-sm"
+ contentEditable={false}
+ onPointerDown={(event) => event.stopPropagation()}
+ >
+ <div className="flex items-center gap-2">
+ <MessageCircle className="size-4 text-muted-foreground" />
+ <span className="text-xs font-medium">Local comment</span>
+ <span className="ml-auto text-[11px] text-muted-foreground">{rangeLabel}</span>
+ <Button variant="ghost" size="icon-xs" aria-label="Delete comment" onClick={onDelete}>
+ <Trash2 className="size-3.5" />
+ </Button>
+ </div>
+ <p className="mt-2 whitespace-pre-wrap text-sm leading-relaxed text-foreground">
+ {savedText}
+ </p>
+ </div>
+ );
+ }
+
+ return (
+ <div
+ data-file-comment-annotation
+ className="mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 shadow-lg"
+ contentEditable={false}
+ onPointerDown={(event) => event.stopPropagation()}
+ >
+ <div className="flex items-center gap-2">
+ <MessageCircle className="size-4 text-muted-foreground" />
+ <span className="text-sm font-medium">Local comment</span>
+ </div>
+ <div className="mt-1 text-xs text-muted-foreground">Comment on lines {rangeLabel}</div>
+ <Textarea
+ autoFocus
+ className="mt-3"
+ size="sm"
+ value={text}
+ placeholder="Request change"
+ aria-label={`Comment on lines ${rangeLabel}`}
+ onChange={(event) => setText(event.target.value)}
+ onKeyDown={(event) => {
+ if (event.key === "Escape") {
+ event.preventDefault();
+ onCancel();
+ }
+ if ((event.metaKey || event.ctrlKey) && event.key === "Enter" && text.trim()) {
+ event.preventDefault();
+ onComment(text.trim());
+ }
+ }}
+ />
+ <div className="mt-3 flex justify-end gap-2">
+ <Button variant="ghost" size="sm" onClick={onCancel}>
+ Cancel
+ </Button>
+ <Button size="sm" disabled={!text.trim()} onClick={() => onComment(text.trim())}>
+ Comment
+ </Button>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/src/components/files/fileCommentAnnotations.ts b/apps/web/src/components/files/fileCommentAnnotations.ts
new file mode 100644
index 000000000..cbd4394cb
--- /dev/null
+++ b/apps/web/src/components/files/fileCommentAnnotations.ts
@@ -0,0 +1,54 @@
+import type { LineAnnotation, SelectedLineRange } from "@pierre/diffs";
+
+export interface FileCommentAnnotationEntry {
+ id: string;
+ kind: "draft" | "comment";
+ startLine: number;
+ endLine: number;
+ text: string;
+}
+
+export interface FileCommentAnnotationGroup {
+ entries: FileCommentAnnotationEntry[];
+}
+
+export type FileCommentLineAnnotation = LineAnnotation<FileCommentAnnotationGroup>;
+
+let fileCommentSequence = 0;
+
+export function nextFileCommentId(): string {
+ fileCommentSequence += 1;
+ return `file-comment-${Date.now()}-${fileCommentSequence}`;
+}
+
+export function normalizeFileCommentRange(range: SelectedLineRange): {
+ startLine: number;
+ endLine: number;
+} {
+ return {
+ startLine: Math.min(range.start, range.end),
+ endLine: Math.max(range.start, range.end),
+ };
+}
+
+export function formatFileCommentRange(startLine: number, endLine: number): string {
+ return startLine === endLine ? `L${startLine}` : `L${startLine} to L${endLine}`;
+}
+
+export function remapFileCommentAnnotations(
+ annotations: ReadonlyArray<FileCommentLineAnnotation>,
+): FileCommentLineAnnotation[] {
+ return annotations.map((annotation) => ({
+ ...annotation,
+ metadata: {
+ entries: annotation.metadata.entries.map((entry) => {
+ const lineCount = entry.endLine - entry.startLine;
+ return {
+ ...entry,
+ endLine: annotation.lineNumber,
+ startLine: Math.max(1, annotation.lineNumber - lineCount),
+ };
+ }),
+ },
+ }));
+}
diff --git a/apps/web/src/components/files/fileEditorDismissal.ts b/apps/web/src/components/files/fileEditorDismissal.ts
new file mode 100644
index 000000000..1291cfe9a
--- /dev/null
+++ b/apps/web/src/components/files/fileEditorDismissal.ts
@@ -0,0 +1,53 @@
+interface FileEditorDismissalOptions {
+ root: HTMLElement;
+ editor: {
+ setSelections: (selections: []) => void;
+ };
+ isBlocked: () => boolean;
+ onDismiss: () => void;
+}
+
+function dismissFileEditorInteraction({
+ root,
+ editor,
+ onDismiss,
+}: Pick<FileEditorDismissalOptions, "root" | "editor" | "onDismiss">): void {
+ onDismiss();
+ editor.setSelections([]);
+
+ const file = root.querySelector<HTMLElement>("diffs-container");
+ const activeElement = file?.shadowRoot?.activeElement;
+ if (activeElement instanceof HTMLElement) {
+ activeElement.blur();
+ }
+}
+
+function isFileEditorFocused(root: HTMLElement): boolean {
+ const file = root.querySelector<HTMLElement>("diffs-container");
+ return file?.shadowRoot?.activeElement?.hasAttribute("data-content") === true;
+}
+
+export function installFileEditorDismissal({
+ root,
+ editor,
+ isBlocked,
+ onDismiss,
+}: FileEditorDismissalOptions): () => void {
+ const handlePointerDown = (event: PointerEvent) => {
+ if (isBlocked() || event.composedPath().includes(root)) return;
+ dismissFileEditorInteraction({ root, editor, onDismiss });
+ };
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (event.key !== "Escape" || isBlocked() || !isFileEditorFocused(root)) return;
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ dismissFileEditorInteraction({ root, editor, onDismiss });
+ };
+
+ document.addEventListener("pointerdown", handlePointerDown, true);
+ document.addEventListener("keydown", handleKeyDown, true);
+ return () => {
+ document.removeEventListener("pointerdown", handlePointerDown, true);
+ document.removeEventListener("keydown", handleKeyDown, true);
+ };
+}
diff --git a/apps/web/src/components/files/filePreviewMode.ts b/apps/web/src/components/files/filePreviewMode.ts
new file mode 100644
index 000000000..63249dbc7
--- /dev/null
+++ b/apps/web/src/components/files/filePreviewMode.ts
@@ -0,0 +1,18 @@
+export const isMarkdownPreviewFile = (path: string): boolean => /\.(?:md|mdx)$/i.test(path);
+
+export function setMarkdownTaskChecked(
+ markdown: string,
+ markerOffset: number,
+ checked: boolean,
+): string {
+ if (
+ markerOffset < 0 ||
+ markdown[markerOffset] !== "[" ||
+ !/[ xX]/.test(markdown[markerOffset + 1] ?? "") ||
+ markdown[markerOffset + 2] !== "]"
+ ) {
+ return markdown;
+ }
+
+ return `${markdown.slice(0, markerOffset + 1)}${checked ? "x" : " "}${markdown.slice(markerOffset + 2)}`;
+}
diff --git a/apps/web/src/components/files/projectFilesQueryState.test.ts b/apps/web/src/components/files/projectFilesQueryState.test.ts
index 756cdb90b..f9021b5a5 100644
--- a/apps/web/src/components/files/projectFilesQueryState.test.ts
+++ b/apps/web/src/components/files/projectFilesQueryState.test.ts
@@ -19,6 +19,7 @@ import {
confirmProjectFileQueryData,
getProjectEntriesQueryAtom,
getProjectFileQueryAtom,
+ getOptimisticProjectFileQueryData,
resolveProjectFileQueryData,
setProjectFileQueryData,
} from "./projectFilesQueryState";
@@ -104,6 +105,10 @@ describe("project files queries", () => {
setProjectFileQueryData(environmentId, "/repo", "convex.json", '{"nodeVersion":"220"}');
setProjectFileQueryData(environmentId, "/repo", "convex.json", '{"nodeVersion":"22"}');
+ expect(getOptimisticProjectFileQueryData(environmentId, "/repo", "convex.json")?.contents).toBe(
+ '{"nodeVersion":"22"}',
+ );
+
expect(
confirmProjectFileQueryData(environmentId, "/repo", "convex.json", '{"nodeVersion":"220"}'),
).toBe(false);
diff --git a/apps/web/src/components/files/projectFilesQueryState.ts b/apps/web/src/components/files/projectFilesQueryState.ts
index 17c6d9ef8..37a2b2663 100644
--- a/apps/web/src/components/files/projectFilesQueryState.ts
+++ b/apps/web/src/components/files/projectFilesQueryState.ts
@@ -121,6 +121,14 @@ export function setProjectFileQueryData(
});
}
+export function getOptimisticProjectFileQueryData(
+ environmentId: EnvironmentId,
+ cwd: string,
+ relativePath: string,
+): ProjectReadFileResult | null {
+ return optimisticProjectFiles.get(fileKey(environmentId, cwd, relativePath))?.data ?? null;
+}
+
export function confirmProjectFileQueryData(
environmentId: EnvironmentId,
cwd: string,
diff --git a/apps/web/src/composerDraftStore.test.ts b/apps/web/src/composerDraftStore.test.ts
index 37470af4a..1da5dadf7 100644
--- a/apps/web/src/composerDraftStore.test.ts
+++ b/apps/web/src/composerDraftStore.test.ts
@@ -615,6 +615,69 @@ describe("composerDraftStore element contexts", () => {
});
});
+describe("composerDraftStore review comments", () => {
+ const threadId = ThreadId.make("thread-review-comment");
+ const threadRef = scopeThreadRef(TEST_ENVIRONMENT_ID, threadId);
+ const comment = {
+ id: "comment-1",
+ sectionId: "file:src/app.ts",
+ sectionTitle: "File comment",
+ filePath: "src/app.ts",
+ startIndex: 1,
+ endIndex: 2,
+ rangeLabel: "L2 to L3",
+ text: "Keep this configurable.",
+ diff: "@@ -2,2 +2,2 @@\n two\n three",
+ } as const;
+
+ beforeEach(() => {
+ resetComposerDraftStore();
+ });
+
+ it("upserts and removes review comments by id", () => {
+ const store = useComposerDraftStore.getState();
+ store.addReviewComment(threadRef, comment);
+ store.addReviewComment(threadRef, { ...comment, text: "Updated comment." });
+
+ expect(draftFor(threadId, TEST_ENVIRONMENT_ID)?.reviewComments).toEqual([
+ { ...comment, text: "Updated comment." },
+ ]);
+
+ store.removeReviewComment(threadRef, comment.id);
+ expect(draftFor(threadId, TEST_ENVIRONMENT_ID)).toBeUndefined();
+ });
+
+ it("persists review comments and clears them with composer content", () => {
+ const store = useComposerDraftStore.getState();
+ store.addReviewComment(threadRef, comment);
+ const persistApi = useComposerDraftStore.persist as unknown as {
+ getOptions: () => {
+ partialize: (state: ReturnType<typeof useComposerDraftStore.getState>) => unknown;
+ };
+ };
+ const persisted = persistApi.getOptions().partialize(useComposerDraftStore.getState()) as {
+ draftsByThreadKey?: Record<string, { reviewComments?: Array<Record<string, unknown>> }>;
+ };
+
+ expect(
+ persisted.draftsByThreadKey?.[threadKeyFor(threadId, TEST_ENVIRONMENT_ID)]
+ ?.reviewComments?.[0],
+ ).toMatchObject(comment);
+
+ store.clearComposerContent(threadRef);
+ expect(draftFor(threadId, TEST_ENVIRONMENT_ID)).toBeUndefined();
+ });
+
+ it("stores review comments against a new-thread draft id", () => {
+ const draftId = DraftId.make("draft-review-comment");
+ useComposerDraftStore.getState().addReviewComment(draftId, comment);
+
+ expect(useComposerDraftStore.getState().getComposerDraft(draftId)?.reviewComments).toEqual([
+ comment,
+ ]);
+ });
+});
+
describe("composerDraftStore project draft thread mapping", () => {
const projectId = ProjectId.make("project-a");
const otherProjectId = ProjectId.make("project-b");
diff --git a/apps/web/src/composerDraftStore.ts b/apps/web/src/composerDraftStore.ts
index a71c1690c..aaaa94c1d 100644
--- a/apps/web/src/composerDraftStore.ts
+++ b/apps/web/src/composerDraftStore.ts
@@ -50,11 +50,13 @@ import { useShallow } from "zustand/react/shallow";
import { createDebouncedStorage, createMemoryStorage } from "./lib/storage";
import { getDefaultServerModel } from "./providerModels";
import { UnifiedSettings } from "@t3tools/contracts/settings";
+import { ReviewCommentContextSchema, type ReviewCommentContext } from "./reviewCommentContext";
const isRuntimeMode = Schema.is(RuntimeMode);
const isProviderDriverKind = Schema.is(ProviderDriverKind);
+const isReviewCommentContext = Schema.is(ReviewCommentContextSchema);
export const COMPOSER_DRAFT_STORAGE_KEY = "t3code:composer-drafts:v1";
-const COMPOSER_DRAFT_STORAGE_VERSION = 7;
+const COMPOSER_DRAFT_STORAGE_VERSION = 8;
const DraftThreadEnvModeSchema = Schema.Literals(["local", "worktree"]);
export type DraftThreadEnvMode = typeof DraftThreadEnvModeSchema.Type;
@@ -128,6 +130,7 @@ const PersistedComposerThreadDraftState = Schema.Struct({
terminalContexts: Schema.optionalKey(Schema.Array(PersistedTerminalContextDraft)),
elementContexts: Schema.optionalKey(Schema.Array(PersistedElementContextDraft)),
previewAnnotations: Schema.optionalKey(Schema.Array(PreviewAnnotationPayloadSchema)),
+ reviewComments: Schema.optionalKey(Schema.Array(ReviewCommentContextSchema)),
// Keyed by `ProviderInstanceId` (open branded slug) so custom provider
// instances (e.g. `codex_personal`) round-trip alongside the built-in
// `codex` / `claudeAgent` / ... entries. Every prior `ProviderDriverKind`
@@ -256,6 +259,7 @@ export interface ComposerThreadDraftState {
*/
elementContexts: ElementContextDraft[];
previewAnnotations: PreviewAnnotationPayload[];
+ reviewComments: ReviewCommentContext[];
/**
* Per-instance model selection. Keyed by `ProviderInstanceId` (open
* branded slug) so a default `codex` instance and a user-authored
@@ -464,6 +468,12 @@ interface ComposerDraftStoreState {
annotations: ReadonlyArray<PreviewAnnotationPayload>,
) => void;
removePreviewAnnotation: (threadRef: ComposerThreadTarget, annotationId: string) => void;
+ addReviewComment: (threadRef: ComposerThreadTarget, comment: ReviewCommentContext) => void;
+ setReviewComments: (
+ threadRef: ComposerThreadTarget,
+ comments: ReadonlyArray<ReviewCommentContext>,
+ ) => void;
+ removeReviewComment: (threadRef: ComposerThreadTarget, commentId: string) => void;
clearPersistedAttachments: (threadRef: ComposerThreadTarget) => void;
syncPersistedAttachments: (
threadRef: ComposerThreadTarget,
@@ -541,11 +551,13 @@ const EMPTY_PERSISTED_ATTACHMENTS: PersistedComposerImageAttachment[] = [];
const EMPTY_TERMINAL_CONTEXTS: TerminalContextDraft[] = [];
const EMPTY_ELEMENT_CONTEXTS: ElementContextDraft[] = [];
const EMPTY_PREVIEW_ANNOTATIONS: PreviewAnnotationPayload[] = [];
+const EMPTY_REVIEW_COMMENTS: ReviewCommentContext[] = [];
Object.freeze(EMPTY_IMAGES);
Object.freeze(EMPTY_IDS);
Object.freeze(EMPTY_PERSISTED_ATTACHMENTS);
Object.freeze(EMPTY_ELEMENT_CONTEXTS);
Object.freeze(EMPTY_PREVIEW_ANNOTATIONS);
+Object.freeze(EMPTY_REVIEW_COMMENTS);
const EMPTY_MODEL_SELECTION_BY_PROVIDER: Partial<Record<ProviderDriverKind, ModelSelection>> =
Object.freeze({});
const EMPTY_COMPOSER_DRAFT_MODEL_STATE = Object.freeze<ComposerDraftModelState>({
@@ -561,6 +573,7 @@ const EMPTY_THREAD_DRAFT = Object.freeze<ComposerThreadDraftState>({
terminalContexts: EMPTY_TERMINAL_CONTEXTS,
elementContexts: EMPTY_ELEMENT_CONTEXTS,
previewAnnotations: EMPTY_PREVIEW_ANNOTATIONS,
+ reviewComments: EMPTY_REVIEW_COMMENTS,
modelSelectionByProvider: EMPTY_MODEL_SELECTION_BY_PROVIDER,
activeProvider: null,
runtimeMode: null,
@@ -582,6 +595,7 @@ export function createEmptyThreadDraft(): ComposerThreadDraftState {
terminalContexts: [],
elementContexts: [],
previewAnnotations: [],
+ reviewComments: [],
modelSelectionByProvider: {},
activeProvider: null,
runtimeMode: null,
@@ -654,6 +668,7 @@ function shouldRemoveDraft(draft: ComposerThreadDraftState): boolean {
draft.terminalContexts.length === 0 &&
draft.elementContexts.length === 0 &&
draft.previewAnnotations.length === 0 &&
+ draft.reviewComments.length === 0 &&
Object.keys(draft.modelSelectionByProvider).length === 0 &&
draft.activeProvider === null &&
draft.runtimeMode === null &&
@@ -1624,6 +1639,9 @@ function normalizePersistedDraftsByThreadId(
return normalized ? [normalized] : [];
})
: [];
+ const reviewComments = Array.isArray(draftCandidate.reviewComments)
+ ? draftCandidate.reviewComments.filter(isReviewCommentContext)
+ : [];
const runtimeMode = isRuntimeMode(draftCandidate.runtimeMode)
? draftCandidate.runtimeMode
: null;
@@ -1688,6 +1706,7 @@ function normalizePersistedDraftsByThreadId(
attachments.length === 0 &&
terminalContexts.length === 0 &&
elementContexts.length === 0 &&
+ reviewComments.length === 0 &&
!hasModelData &&
!runtimeMode &&
!interactionMode
@@ -1711,6 +1730,7 @@ function normalizePersistedDraftsByThreadId(
attachments,
...(terminalContexts.length > 0 ? { terminalContexts } : {}),
...(elementContexts.length > 0 ? { elementContexts } : {}),
+ ...(reviewComments.length > 0 ? { reviewComments } : {}),
...(hasModelData
? {
modelSelectionByProvider: compactModelSelectionByProvider(modelSelectionByProvider),
@@ -1795,6 +1815,7 @@ function partializeComposerDraftStoreState(
draft.terminalContexts.length === 0 &&
draft.elementContexts.length === 0 &&
draft.previewAnnotations.length === 0 &&
+ draft.reviewComments.length === 0 &&
!hasModelData &&
draft.runtimeMode === null &&
draft.interactionMode === null
@@ -1841,6 +1862,11 @@ function partializeComposerDraftStoreState(
),
}
: {}),
+ ...(draft.reviewComments.length > 0
+ ? {
+ reviewComments: draft.reviewComments.map((comment) => ({ ...comment })),
+ }
+ : {}),
...(hasModelData
? {
modelSelectionByProvider: compactModelSelectionByProvider(
@@ -2083,6 +2109,7 @@ function toHydratedThreadDraft(
})) ?? [],
previewAnnotations:
persistedDraft.previewAnnotations?.map((annotation) => ({ ...annotation })) ?? [],
+ reviewComments: persistedDraft.reviewComments?.map((comment) => ({ ...comment })) ?? [],
modelSelectionByProvider,
activeProvider,
runtimeMode: persistedDraft.runtimeMode ?? null,
@@ -3148,6 +3175,55 @@ const composerDraftStore = create<ComposerDraftStoreState>()(
return { draftsByThreadKey: nextDraftsByThreadKey };
});
},
+ addReviewComment: (threadRef, comment) => {
+ const threadKey = resolveComposerDraftKey(get(), threadRef);
+ if (!threadKey || !isReviewCommentContext(comment)) return;
+ set((state) => {
+ const existing = state.draftsByThreadKey[threadKey] ?? createEmptyThreadDraft();
+ const reviewComments = existing.reviewComments.filter(
+ (entry) => entry.id !== comment.id,
+ );
+ return {
+ draftsByThreadKey: {
+ ...state.draftsByThreadKey,
+ [threadKey]: {
+ ...existing,
+ reviewComments: [...reviewComments, { ...comment }],
+ },
+ },
+ };
+ });
+ },
+ setReviewComments: (threadRef, comments) => {
+ const threadKey = resolveComposerDraftKey(get(), threadRef);
+ if (!threadKey) return;
+ const reviewComments = comments
+ .filter(isReviewCommentContext)
+ .map((comment) => ({ ...comment }));
+ set((state) => {
+ const existing = state.draftsByThreadKey[threadKey] ?? createEmptyThreadDraft();
+ const nextDraft = { ...existing, reviewComments };
+ const nextDraftsByThreadKey = { ...state.draftsByThreadKey };
+ if (shouldRemoveDraft(nextDraft)) delete nextDraftsByThreadKey[threadKey];
+ else nextDraftsByThreadKey[threadKey] = nextDraft;
+ return { draftsByThreadKey: nextDraftsByThreadKey };
+ });
+ },
+ removeReviewComment: (threadRef, commentId) => {
+ const threadKey = resolveComposerDraftKey(get(), threadRef);
+ if (!threadKey || !commentId) return;
+ set((state) => {
+ const current = state.draftsByThreadKey[threadKey];
+ if (!current) return state;
+ const reviewComments = current.reviewComments.filter((entry) => entry.id !== commentId);
+ if (reviewComments.length === current.reviewComments.length) return state;
+ const nextDraft = { ...current, reviewComments };
+ const nextDraftsByThreadKey = { ...state.draftsByThreadKey };
+ if (shouldRemoveDraft(nextDraft)) delete nextDraftsByThreadKey[threadKey];
+ else nextDraftsByThreadKey[threadKey] = nextDraft;
+ return { draftsByThreadKey: nextDraftsByThreadKey };
+ });
+ },
clearPersistedAttachments: (threadRef) => {
const threadKey = resolveComposerDraftKey(get(), threadRef) ?? "";
if (threadKey.length === 0) {
@@ -3222,6 +3298,7 @@ const composerDraftStore = create<ComposerDraftStoreState>()(
terminalContexts: [],
elementContexts: [],
previewAnnotations: [],
+ reviewComments: [],
};
const nextDraftsByThreadKey = { ...state.draftsByThreadKey };
if (shouldRemoveDraft(nextDraft)) {
diff --git a/apps/web/src/reviewCommentContext.test.ts b/apps/web/src/reviewCommentContext.test.ts
index d729bf489..819c6768a 100644
--- a/apps/web/src/reviewCommentContext.test.ts
+++ b/apps/web/src/reviewCommentContext.test.ts
@@ -1,8 +1,15 @@
+import { parsePatchFiles } from "@pierre/diffs/utils/parsePatchFiles";
import { describe, expect, it } from "vite-plus/test";
import {
+ appendReviewCommentsToPrompt,
+ buildDiffReviewComment,
+ buildFileReviewComment,
buildReviewCommentRenderablePatch,
+ formatReviewCommentContext,
+ inferReviewCommentFenceLanguage,
parseReviewCommentMessageSegments,
+ restoreDiffReviewCommentRange,
} from "./reviewCommentContext";
describe("review comment context parsing", () => {
@@ -74,4 +81,195 @@ describe("review comment context parsing", () => {
].join("\n"),
);
});
+
+ it("formats editable file comments with the mobile review-comment contract", () => {
+ const comment = buildFileReviewComment({
+ id: "comment-1",
+ filePath: "src/app.ts",
+ startLine: 2,
+ endLine: 3,
+ text: "Keep this configurable.",
+ contents: ["one", "two", "three", "four"].join("\n"),
+ });
+ const prompt = appendReviewCommentsToPrompt("Please update this.", [comment]);
+ const segments = parseReviewCommentMessageSegments(prompt);
+
+ expect(segments).toHaveLength(2);
+ expect(segments[1]).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({
+ filePath: "src/app.ts",
+ startIndex: 1,
+ endIndex: 2,
+ rangeLabel: "L2 to L3",
+ text: "Keep this configurable.",
+ diff: "two\nthree",
+ fenceLanguage: "ts",
+ }),
+ }),
+ );
+ expect(prompt).toContain("```ts\ntwo\nthree\n```");
+ });
+
+ it("formats mixed diff-side selections with the mobile review-comment contract", () => {
+ const [fileDiff] = parsePatchFiles(
+ [
+ "diff --git a/src/app.ts b/src/app.ts",
+ "--- a/src/app.ts",
+ "+++ b/src/app.ts",
+ "@@ -1,4 +1,4 @@",
+ " one",
+ "-two",
+ "+TWO",
+ " three",
+ " four",
+ ].join("\n"),
+ "review-comment-test",
+ )[0]!.files;
+
+ const comment = buildDiffReviewComment({
+ id: "comment-2",
+ sectionId: "turn:2",
+ sectionTitle: "Turn 2",
+ filePath: "src/app.ts",
+ fileDiff: fileDiff!,
+ range: {
+ start: 2,
+ side: "deletions",
+ end: 2,
+ endSide: "additions",
+ },
+ text: "Keep this compatible.",
+ });
+
+ expect(comment).toEqual(
+ expect.objectContaining({
+ sectionId: "turn:2",
+ sectionTitle: "Turn 2",
+ filePath: "src/app.ts",
+ startIndex: 1,
+ endIndex: 2,
+ rangeLabel: "2",
+ text: "Keep this compatible.",
+ diff: "@@ -2,1 +2,1 @@\n-two\n+TWO",
+ fenceLanguage: "diff",
+ }),
+ );
+ });
+
+ it("uses file extensions for source comments and preserves nested markdown fences", () => {
+ expect(inferReviewCommentFenceLanguage("docs/plan.md")).toBe("md");
+ expect(inferReviewCommentFenceLanguage("src/view.tsx")).toBe("tsx");
+
+ const serialized = formatReviewCommentContext({
+ id: "comment-3",
+ sectionId: "file:docs/plan.md",
+ sectionTitle: "File comment",
+ filePath: "docs/plan.md",
+ startIndex: 0,
+ endIndex: 2,
+ rangeLabel: "L1 to L3",
+ text: "Update this example.",
+ diff: ["# Example", "```ts", "const value = 1;", "```"].join("\n"),
+ fenceLanguage: "md",
+ });
+ const [segment] = parseReviewCommentMessageSegments(serialized);
+
+ expect(serialized).toContain("````md");
+ expect(segment).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({
+ fenceLanguage: "md",
+ diff: ["# Example", "```ts", "const value = 1;", "```"].join("\n"),
+ }),
+ }),
+ );
+ });
+
+ it("round-trips greater-than signs in attributes", () => {
+ const serialized = formatReviewCommentContext({
+ id: "comment-4",
+ sectionId: "turn:4",
+ sectionTitle: "Changes > 5",
+ filePath: "src/app.ts",
+ startIndex: 0,
+ endIndex: 0,
+ rangeLabel: "+1",
+ text: "Check this.",
+ diff: "@@ -0,0 +1,1 @@\n+one",
+ fenceLanguage: "diff",
+ });
+ const [segment] = parseReviewCommentMessageSegments(serialized);
+
+ expect(serialized).toContain('sectionTitle="Changes &gt; 5"');
+ expect(segment).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({ sectionTitle: "Changes > 5" }),
+ }),
+ );
+ });
+
+ it("keeps fenced examples in comment text separate from the final context fence", () => {
+ const text = ["Try this:", "```ts", "const value = 1;", "```", "Then retry."].join("\n");
+ const serialized = formatReviewCommentContext({
+ id: "comment-5",
+ sectionId: "turn:5",
+ sectionTitle: "Turn 5",
+ filePath: "src/app.ts",
+ startIndex: 0,
+ endIndex: 0,
+ rangeLabel: "+1",
+ text,
+ diff: "@@ -0,0 +1,1 @@\n+one",
+ fenceLanguage: "diff",
+ });
+ const [segment] = parseReviewCommentMessageSegments(serialized);
+
+ expect(segment).toEqual(
+ expect.objectContaining({
+ kind: "review-comment",
+ comment: expect.objectContaining({
+ text,
+ diff: "@@ -0,0 +1,1 @@\n+one",
+ fenceLanguage: "diff",
+ }),
+ }),
+ );
+ });
+
+ it("restores Pierre line selections from persisted diff comment row indexes", () => {
+ const fileDiff = parsePatchFiles(
+ [
+ "diff --git a/src/app.ts b/src/app.ts",
+ "--- a/src/app.ts",
+ "+++ b/src/app.ts",
+ "@@ -1,3 +1,3 @@",
+ " one",
+ "-two",
+ "+TWO",
+ " three",
+ ].join("\n"),
+ "restore-review-comment-range",
+ )[0]!.files[0]!;
+ const comment = buildDiffReviewComment({
+ id: "comment-6",
+ sectionId: "turn:6",
+ sectionTitle: "Turn 6",
+ filePath: "src/app.ts",
+ fileDiff,
+ range: { start: 2, side: "deletions", end: 2, endSide: "additions" },
+ text: "Keep both sides.",
+ });
+
+ expect(comment).not.toBeNull();
+ expect(restoreDiffReviewCommentRange(fileDiff, comment!)).toEqual({
+ start: 2,
+ side: "deletions",
+ end: 2,
+ endSide: "additions",
+ });
+ });
});
diff --git a/apps/web/src/reviewCommentContext.ts b/apps/web/src/reviewCommentContext.ts
index 698c5bce4..f3613cee3 100644
--- a/apps/web/src/reviewCommentContext.ts
+++ b/apps/web/src/reviewCommentContext.ts
@@ -1,3 +1,19 @@
+import type { FileDiffMetadata, SelectedLineRange, SelectionSide } from "@pierre/diffs";
+import * as Schema from "effect/Schema";
+
+export const ReviewCommentContextSchema = Schema.Struct({
+ id: Schema.String,
+ sectionId: Schema.String,
+ sectionTitle: Schema.String,
+ filePath: Schema.String,
+ startIndex: Schema.Number,
+ endIndex: Schema.Number,
+ rangeLabel: Schema.String,
+ text: Schema.String,
+ diff: Schema.String,
+ fenceLanguage: Schema.optional(Schema.String),
+});
+
export interface ReviewCommentContext {
readonly id: string;
readonly sectionId: string;
@@ -8,6 +24,14 @@ export interface ReviewCommentContext {
readonly rangeLabel: string;
readonly text: string;
readonly diff: string;
+ readonly fenceLanguage?: string | undefined;
+}
+
+interface DiffReviewLine {
+ readonly change: "context" | "add" | "delete";
+ readonly oldLineNumber: number | null;
+ readonly newLineNumber: number | null;
+ readonly content: string;
}
export type ReviewCommentMessageSegment =
@@ -23,11 +47,20 @@ export type ReviewCommentMessageSegment =
const REVIEW_COMMENT_BLOCK_PATTERN = /<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g;
const REVIEW_COMMENT_ATTRIBUTE_PATTERN = /([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g;
-const REVIEW_COMMENT_DIFF_FENCE_PATTERN = /```diff\s*\n([\s\S]*?)\n```/;
+const REVIEW_COMMENT_FENCE_PATTERN = /(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;
+
+function escapeReviewCommentAttribute(value: string): string {
+ return value
+ .replace(/&/g, "&amp;")
+ .replace(/"/g, "&quot;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;");
+}
function unescapeReviewCommentAttribute(value: string): string {
return value
.replace(/&lt;/g, "<")
+ .replace(/&gt;/g, ">")
.replace(/&quot;/g, '"')
.replace(/&amp;/g, "&");
}
@@ -47,14 +80,19 @@ function readNonNegativeInteger(value: string | undefined): number | null {
return Number(value);
}
-function extractReviewCommentText(rawBody: string): string {
- const fenceIndex = rawBody.indexOf("```diff");
- const commentBody = fenceIndex >= 0 ? rawBody.slice(0, fenceIndex) : rawBody;
- return commentBody.trim();
-}
-
-function extractReviewCommentDiff(rawBody: string): string {
- return rawBody.match(REVIEW_COMMENT_DIFF_FENCE_PATTERN)?.[1]?.trim() ?? "";
+function extractReviewCommentBody(rawBody: string): {
+ text: string;
+ language: string;
+ contents: string;
+} {
+ const matches = Array.from(rawBody.matchAll(REVIEW_COMMENT_FENCE_PATTERN));
+ const match = matches.at(-1);
+ const fenceIndex = match?.index;
+ return {
+ text: rawBody.slice(0, fenceIndex ?? rawBody.length).trim(),
+ language: match?.[2]?.trim() || "diff",
+ contents: match?.[3] ?? "",
+ };
}
function parseReviewCommentContext(
@@ -70,6 +108,7 @@ function parseReviewCommentContext(
if (!filePath || !sectionId || startIndex === null || endIndex === null) {
return null;
}
+ const body = extractReviewCommentBody(rawBody);
return {
id: `review-comment:${index}:${sectionId}:${filePath}:${startIndex}:${endIndex}`,
@@ -79,8 +118,9 @@ function parseReviewCommentContext(
startIndex: Math.min(startIndex, endIndex),
endIndex: Math.max(startIndex, endIndex),
rangeLabel: attributes.rangeLabel?.trim() || "line",
- text: extractReviewCommentText(rawBody),
- diff: extractReviewCommentDiff(rawBody),
+ text: body.text,
+ diff: body.contents,
+ fenceLanguage: body.language,
};
}
@@ -135,7 +175,272 @@ export function hasReviewCommentMessageSegments(value: string): boolean {
);
}
+export function formatReviewCommentFence(language: string, contents: string): string {
+ const longestBacktickRun = Math.max(
+ 0,
+ ...Array.from(contents.matchAll(/`+/g), (match) => match[0].length),
+ );
+ const fence = "`".repeat(Math.max(3, longestBacktickRun + 1));
+ return [`${fence}${language}`, contents.trimEnd(), fence].join("\n");
+}
+
+export function formatReviewCommentContext(comment: ReviewCommentContext): string {
+ return [
+ [
+ "<review_comment",
+ ` sectionId="${escapeReviewCommentAttribute(comment.sectionId)}"`,
+ ` sectionTitle="${escapeReviewCommentAttribute(comment.sectionTitle)}"`,
+ ` filePath="${escapeReviewCommentAttribute(comment.filePath)}"`,
+ ` startIndex="${comment.startIndex}"`,
+ ` endIndex="${comment.endIndex}"`,
+ ` rangeLabel="${escapeReviewCommentAttribute(comment.rangeLabel)}"`,
+ ">",
+ ].join(""),
+ comment.text.trim(),
+ formatReviewCommentFence(comment.fenceLanguage ?? "diff", comment.diff),
+ "</review_comment>",
+ ].join("\n");
+}
+
+export function appendReviewCommentsToPrompt(
+ prompt: string,
+ comments: ReadonlyArray<ReviewCommentContext>,
+): string {
+ const blocks = comments.map(formatReviewCommentContext);
+ if (blocks.length === 0) return prompt;
+ const trimmedPrompt = prompt.trim();
+ return trimmedPrompt.length > 0
+ ? `${trimmedPrompt}\n\n${blocks.join("\n\n")}`
+ : blocks.join("\n\n");
+}
+
+export function buildFileReviewComment(input: {
+ id: string;
+ filePath: string;
+ startLine: number;
+ endLine: number;
+ text: string;
+ contents: string;
+}): ReviewCommentContext {
+ const startLine = Math.max(1, Math.min(input.startLine, input.endLine));
+ const endLine = Math.max(startLine, Math.max(input.startLine, input.endLine));
+ const selectedLines = input.contents.split("\n").slice(startLine - 1, endLine);
+ return {
+ id: input.id,
+ sectionId: `file:${input.filePath}`,
+ sectionTitle: "File comment",
+ filePath: input.filePath,
+ startIndex: startLine - 1,
+ endIndex: endLine - 1,
+ rangeLabel: startLine === endLine ? `L${startLine}` : `L${startLine} to L${endLine}`,
+ text: input.text.trim(),
+ diff: selectedLines.join("\n"),
+ fenceLanguage: inferReviewCommentFenceLanguage(input.filePath),
+ };
+}
+
+export function inferReviewCommentFenceLanguage(filePath: string): string {
+ const normalizedPath = filePath.replaceAll("\\", "/");
+ const fileName = normalizedPath.slice(normalizedPath.lastIndexOf("/") + 1).toLowerCase();
+ const extensionIndex = fileName.lastIndexOf(".");
+ if (extensionIndex > 0 && extensionIndex < fileName.length - 1) {
+ return fileName.slice(extensionIndex + 1);
+ }
+ if (fileName.startsWith(".") && fileName.length > 1) {
+ return fileName.slice(1);
+ }
+ return "text";
+}
+
+function stripTrailingNewline(value: string): string {
+ return value.endsWith("\n") ? value.slice(0, -1) : value;
+}
+
+function buildDiffReviewLines(fileDiff: FileDiffMetadata): ReadonlyArray<DiffReviewLine> {
+ const rows: DiffReviewLine[] = [];
+
+ for (const hunk of fileDiff.hunks) {
+ let oldLineNumber = hunk.deletionStart;
+ let newLineNumber = hunk.additionStart;
+ let deletionLineIndex = hunk.deletionLineIndex;
+ let additionLineIndex = hunk.additionLineIndex;
+
+ for (const segment of hunk.hunkContent) {
+ if (segment.type === "context") {
+ for (let index = 0; index < segment.lines; index += 1) {
+ rows.push({
+ change: "context",
+ oldLineNumber,
+ newLineNumber,
+ content: stripTrailingNewline(
+ fileDiff.additionLines[additionLineIndex] ??
+ fileDiff.deletionLines[deletionLineIndex] ??
+ "",
+ ),
+ });
+ oldLineNumber += 1;
+ newLineNumber += 1;
+ deletionLineIndex += 1;
+ additionLineIndex += 1;
+ }
+ continue;
+ }
+
+ for (let index = 0; index < segment.deletions; index += 1) {
+ rows.push({
+ change: "delete",
+ oldLineNumber,
+ newLineNumber: null,
+ content: stripTrailingNewline(fileDiff.deletionLines[deletionLineIndex] ?? ""),
+ });
+ oldLineNumber += 1;
+ deletionLineIndex += 1;
+ }
+
+ for (let index = 0; index < segment.additions; index += 1) {
+ rows.push({
+ change: "add",
+ oldLineNumber: null,
+ newLineNumber,
+ content: stripTrailingNewline(fileDiff.additionLines[additionLineIndex] ?? ""),
+ });
+ newLineNumber += 1;
+ additionLineIndex += 1;
+ }
+ }
+ }
+
+ return rows;
+}
+
+function getDiffReviewSelectionPoint(
+ line: DiffReviewLine,
+): { lineNumber: number; side: SelectionSide } | null {
+ if (line.change === "delete" && line.oldLineNumber !== null) {
+ return { lineNumber: line.oldLineNumber, side: "deletions" };
+ }
+ if (line.newLineNumber !== null) {
+ return { lineNumber: line.newLineNumber, side: "additions" };
+ }
+ if (line.oldLineNumber !== null) {
+ return { lineNumber: line.oldLineNumber, side: "deletions" };
+ }
+ return null;
+}
+
+export function restoreDiffReviewCommentRange(
+ fileDiff: FileDiffMetadata,
+ comment: ReviewCommentContext,
+): SelectedLineRange | null {
+ const lines = buildDiffReviewLines(fileDiff);
+ const startLine = lines[comment.startIndex];
+ const endLine = lines[comment.endIndex];
+ if (!startLine || !endLine) return null;
+ const start = getDiffReviewSelectionPoint(startLine);
+ const end = getDiffReviewSelectionPoint(endLine);
+ if (!start || !end) return null;
+ return {
+ start: start.lineNumber,
+ side: start.side,
+ end: end.lineNumber,
+ endSide: end.side,
+ };
+}
+
+function findDiffReviewLineIndex(
+ lines: ReadonlyArray<DiffReviewLine>,
+ lineNumber: number,
+ side: SelectionSide | undefined,
+): number {
+ const preferredKey = side === "deletions" ? "oldLineNumber" : "newLineNumber";
+ const preferredIndex = lines.findIndex((line) => line[preferredKey] === lineNumber);
+ if (preferredIndex >= 0) return preferredIndex;
+ const fallbackKey = preferredKey === "oldLineNumber" ? "newLineNumber" : "oldLineNumber";
+ return lines.findIndex((line) => line[fallbackKey] === lineNumber);
+}
+
+function getDiffRange(
+ lines: ReadonlyArray<DiffReviewLine>,
+ key: "oldLineNumber" | "newLineNumber",
+): { start: number; count: number } {
+ const numberedLines = lines.filter((line) => line[key] !== null);
+ return {
+ start: numberedLines[0]?.[key] ?? 0,
+ count: numberedLines.length,
+ };
+}
+
+function getDiffChangeMarker(change: DiffReviewLine["change"]): string {
+ if (change === "add") return "+";
+ if (change === "delete") return "-";
+ return " ";
+}
+
+function formatDiffReviewRangeLabel(lines: ReadonlyArray<DiffReviewLine>): string {
+ const firstLine = lines[0];
+ const lastLine = lines.at(-1);
+ if (!firstLine || !lastLine) return "line";
+ const firstNumber = firstLine.newLineNumber ?? firstLine.oldLineNumber;
+ const lastNumber = lastLine.newLineNumber ?? lastLine.oldLineNumber;
+ if (firstNumber === null || lastNumber === null) {
+ return lines.length === 1 ? "line" : `${lines.length} lines`;
+ }
+
+ const firstMarker = getDiffChangeMarker(firstLine.change).trim();
+ const marker =
+ firstMarker.length > 0 && lines.every((line) => line.change === firstLine.change)
+ ? firstMarker
+ : "";
+ return firstNumber === lastNumber
+ ? `${marker}${firstNumber}`
+ : `${marker}${firstNumber} to ${marker}${lastNumber}`;
+}
+
+export function buildDiffReviewComment(input: {
+ id: string;
+ sectionId: string;
+ sectionTitle: string;
+ filePath: string;
+ fileDiff: FileDiffMetadata;
+ range: SelectedLineRange;
+ text: string;
+}): ReviewCommentContext | null {
+ const lines = buildDiffReviewLines(input.fileDiff);
+ const startIndex = findDiffReviewLineIndex(lines, input.range.start, input.range.side);
+ const endIndex = findDiffReviewLineIndex(
+ lines,
+ input.range.end,
+ input.range.endSide ?? input.range.side,
+ );
+ if (startIndex < 0 || endIndex < 0) return null;
+
+ const normalizedStartIndex = Math.min(startIndex, endIndex);
+ const normalizedEndIndex = Math.max(startIndex, endIndex);
+ const selectedLines = lines.slice(normalizedStartIndex, normalizedEndIndex + 1);
+ const oldRange = getDiffRange(selectedLines, "oldLineNumber");
+ const newRange = getDiffRange(selectedLines, "newLineNumber");
+
+ return {
+ id: input.id,
+ sectionId: input.sectionId,
+ sectionTitle: input.sectionTitle,
+ filePath: input.filePath,
+ startIndex: normalizedStartIndex,
+ endIndex: normalizedEndIndex,
+ rangeLabel: formatDiffReviewRangeLabel(selectedLines),
+ text: input.text.trim(),
+ diff: [
+ `@@ -${oldRange.start},${oldRange.count} +${newRange.start},${newRange.count} @@`,
+ ...selectedLines.map((line) => `${getDiffChangeMarker(line.change)}${line.content}`),
+ ].join("\n"),
+ fenceLanguage: "diff",
+ };
+}
+
export function buildReviewCommentRenderablePatch(comment: ReviewCommentContext): string {
+ if ((comment.fenceLanguage ?? "diff") !== "diff") {
+ return "";
+ }
const diff = comment.diff.trim();
if (diff.length === 0) {
return "";
diff --git a/patches/@pierre%[email protected] b/patches/@pierre%[email protected]
index 7f2619fee..9cecb1b65 100644
--- a/patches/@pierre%[email protected]
+++ b/patches/@pierre%[email protected]
@@ -1,8 +1,56 @@
+diff --git a/dist/editor/editor.js b/dist/editor/editor.js
+index 4346c77a4e43a98c8524ea5186559fdee7433174..bb2a7ecd1d7f497916a5f220215d5191b095575b 100644
+--- a/dist/editor/editor.js
++++ b/dist/editor/editor.js
+@@ -77,16 +77,13 @@ var Editor = class {
+ this.#options = options;
+ }
+ edit(component) {
+- const { useTokenTransformer, enableGutterUtility, enableLineSelection, expandUnchanged, diffStyle, lineHoverHighlight,...rest } = component.options;
+- if (useTokenTransformer !== true || enableGutterUtility === true || enableLineSelection === true || expandUnchanged !== true && Object.hasOwn(component, "fileDiff") || diffStyle === "unified" || lineHoverHighlight !== "disabled") {
++ const { useTokenTransformer, expandUnchanged, diffStyle,...rest } = component.options;
++ if (useTokenTransformer !== true || expandUnchanged !== true && Object.hasOwn(component, "fileDiff") || diffStyle === "unified") {
+ component.setOptions({
+ ...rest,
+ useTokenTransformer: true,
+- enableGutterUtility: false,
+- enableLineSelection: false,
+ expandUnchanged: true,
+- diffStyle: "split",
+- lineHoverHighlight: "disabled"
++ diffStyle: "split"
+ });
+ component.rerender();
+ }
+@@ -481,6 +478,7 @@ var Editor = class {
+ return lineNumber - 1;
+ };
+ this.#editorEventDisposes.push(addEventListener(gutterEl, "pointerdown", (e) => {
++ if (this.#fileInstance?.options.enableLineSelection === true) return;
+ const textDocument = this.#textDocument;
+ const lineIndex = resolveEditableLine(resolveGutterTarget(e.composedPath()[0]));
+ if (lineIndex === void 0 || textDocument === void 0) return;
+diff --git a/dist/react/utils/useFileInstance.js b/dist/react/utils/useFileInstance.js
+index cb8e2026fb5d7a19f489c0a2402efbcb7dff3322..510fad6364d4a2214c7dd65fe2b114f1cce0c815 100644
+--- a/dist/react/utils/useFileInstance.js
++++ b/dist/react/utils/useFileInstance.js
+@@ -92,10 +92,7 @@ function mergeFileOptions({ options, controlledSelection, contentEditable, hasCu
+ };
+ if (needsEditorOptions) merged = {
+ ...merged,
+- useTokenTransformer: true,
+- enableGutterUtility: false,
+- enableLineSelection: false,
+- lineHoverHighlight: "disabled"
++ useTokenTransformer: true
+ };
+ return merged;
+ }
diff --git a/package.json b/package.json
-index b18c94f3f7b40bdb15084ab7cabcb19dd29c61f7..ab96ac589d368e806ef45480283d6e0fa199117f 100644
+index cff9c6b2a955e7568f44279a5b706da164c4f142..3d1f25f8bd1be682549677718d9ed8433872c854 100644
--- a/package.json
+++ b/package.json
-@@ -51,6 +51,18 @@
+@@ -55,6 +55,18 @@
"./worker/worker-portable.js": {
"types": "./dist/worker/worker-portable.d.ts",
"import": "./dist/worker/worker-portable.js"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8e9f507ca..ad811a254 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -70,7 +70,7 @@ patchedDependencies:
hash: 2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8
path: patches/@[email protected]
'@pierre/[email protected]':
- hash: f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b
+ hash: 0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631
path: patches/@pierre%[email protected]
hash: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5
@@ -177,10 +177,10 @@ importers:
dependencies:
'@callstack/liquid-glass':
specifier: ^0.7.1
'@clerk/expo':
specifier: ^3.4.1
'@effect/atom-react':
specifier: 4.0.0-beta.78
version: 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
@@ -189,10 +189,10 @@ importers:
version: 0.4.2
'@expo/ui':
specifier: ~56.0.8
- version: 56.0.15(ab3f255d102c60ba0fd2bbe4e47ba584)
+ version: 56.0.15(961c4aa6f32829b318e3c87ef20ad401)
'@legendapp/list':
specifier: 3.0.0-beta.44
'@noble/curves':
specifier: 'catalog:'
version: 1.9.1
@@ -201,10 +201,10 @@ importers:
version: 1.8.0
'@pierre/diffs':
specifier: 'catalog:'
- version: 1.3.0-beta.4(patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
+ version: 1.3.0-beta.4(patch_hash=0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
'@react-native-menu/menu':
specifier: ^2.0.0
'@shikijs/core':
specifier: 3.23.0
version: 3.23.0
@@ -225,7 +225,7 @@ importers:
version: link:../../packages/contracts
'@t3tools/mobile-markdown-text':
specifier: file:./modules/t3-markdown-text
- version: file:apps/mobile/modules/t3-markdown-text(e909ee9a8f7fbe234da80c739fca4984)
+ version: file:apps/mobile/modules/t3-markdown-text(f0ff241d48c23db461fff5d47e450578)
'@t3tools/mobile-review-diff-native':
specifier: file:./modules/t3-review-diff
version: file:apps/mobile/modules/t3-review-diff
@@ -246,40 +246,40 @@ importers:
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
expo:
specifier: ^56.0.0
expo-asset:
specifier: ~56.0.15
expo-auth-session:
specifier: ~56.0.12
expo-build-properties:
specifier: ~56.0.15
version: 56.0.16([email protected])
expo-camera:
specifier: ~56.0.7
expo-clipboard:
specifier: ~56.0.3
expo-constants:
specifier: ~56.0.16
expo-crypto:
specifier: ~56.0.4
version: 56.0.4([email protected])
expo-dev-client:
specifier: ~56.0.16
expo-file-system:
specifier: ~56.0.7
expo-font:
specifier: ~56.0.5
expo-glass-effect:
specifier: ~56.0.4
expo-haptics:
specifier: ~56.0.3
version: 56.0.3([email protected])
@@ -288,16 +288,16 @@ importers:
version: 56.0.15([email protected])
expo-linking:
specifier: ~56.0.12
expo-notifications:
specifier: ~56.0.14
expo-paste-input:
specifier: ^0.1.15
expo-router:
specifier: ~56.2.7
- version: 56.2.8(c021de11d02907bd585610408f5252e8)
+ version: 56.2.8(5bfdf39b8f760e4dc2d5c3acffc97310)
expo-secure-store:
specifier: ~56.0.4
version: 56.0.4([email protected])
@@ -306,16 +306,16 @@ importers:
expo-symbols:
specifier: ~56.0.5
expo-updates:
specifier: ~56.0.17
expo-web-browser:
specifier: ~56.0.5
expo-widgets:
specifier: ~56.0.15
- version: 56.0.16(ab3f255d102c60ba0fd2bbe4e47ba584)
+ version: 56.0.16(961c4aa6f32829b318e3c87ef20ad401)
punycode:
specifier: ^2.3.1
version: 2.3.1
@@ -327,40 +327,40 @@ importers:
version: 19.2.3([email protected])
react-native:
specifier: 0.85.3
react-native-gesture-handler:
specifier: ~2.31.1
react-native-image-viewing:
specifier: ^0.2.2
react-native-keyboard-controller:
specifier: 1.21.6
react-native-nitro-markdown:
specifier: ^0.5.0
react-native-nitro-modules:
specifier: ^0.35.4
- version: 0.35.9(patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
+ version: 0.35.9(patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-reanimated:
specifier: 4.3.1
react-native-safe-area-context:
specifier: ~5.7.0
react-native-screens:
specifier: 4.25.2
react-native-shiki-engine:
specifier: ^0.3.9
react-native-svg:
specifier: 15.15.4
react-native-worklets:
specifier: 0.8.3
shiki:
specifier: 3.23.0
version: 3.23.0
@@ -369,7 +369,7 @@ importers:
version: 3.6.0
uniwind:
specifier: ^1.6.2
devDependencies:
'@effect/vitest':
specifier: 4.0.0-beta.78
@@ -415,7 +415,7 @@ importers:
version: 1.15.13
'@pierre/diffs':
specifier: 'catalog:'
- version: 1.3.0-beta.4(patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
+ version: 1.3.0-beta.4(patch_hash=0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
effect:
specifier: 4.0.0-beta.78
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
@@ -497,7 +497,7 @@ importers:
'@pierre/diffs':
specifier: 'catalog:'
- version: 1.3.0-beta.4(patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
+ version: 1.3.0-beta.4(patch_hash=0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
'@pierre/trees':
specifier: 1.0.0-beta.4
@@ -10819,10 +10819,10 @@ snapshots:
optionalDependencies:
'@types/react': 19.2.16
dependencies:
react: 19.2.3
'@capsizecss/[email protected]':
dependencies:
@@ -10894,23 +10894,23 @@ snapshots:
- react
- react-dom
dependencies:
base-64: 1.0.0
react: 19.2.3
tslib: 2.8.1
optionalDependencies:
expo-crypto: 56.0.4([email protected])
expo-secure-store: 56.0.4([email protected])
react-dom: 19.2.3([email protected])
@@ -11477,7 +11477,7 @@ snapshots:
'@expo-google-fonts/[email protected]': {}
dependencies:
'@expo/code-signing-certificates': 0.0.6
'@expo/config': 56.0.9([email protected])
@@ -11487,7 +11487,7 @@ snapshots:
'@expo/image-utils': 0.10.1([email protected])
'@expo/inline-modules': 0.0.10([email protected])
'@expo/json-file': 10.2.0
'@expo/metro': 56.0.0([email protected])([email protected])
'@expo/metro-config': 56.0.13(patch_hash=8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46)([email protected])([email protected])([email protected])([email protected])
'@expo/metro-file-map': 56.0.3
@@ -11512,7 +11512,7 @@ snapshots:
connect: 3.7.0
debug: 4.4.3
dnssd-advertise: 1.1.4
expo-server: 56.0.4
fetch-nodeshim: 0.4.10
getenv: 2.0.0
@@ -11538,8 +11538,8 @@ snapshots:
zod: 3.25.76
optionalDependencies:
- expo-router: 56.2.8(c021de11d02907bd585610408f5252e8)
+ expo-router: 56.2.8(5bfdf39b8f760e4dc2d5c3acffc97310)
transitivePeerDependencies:
- '@expo/dom-webview'
- '@expo/metro-runtime'
@@ -11601,18 +11601,18 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
chalk: 4.1.2
optionalDependencies:
react: 19.2.3
dependencies:
react: 19.2.3
dependencies:
@@ -11673,13 +11673,13 @@ snapshots:
- supports-color
- typescript
dependencies:
anser: 1.4.10
react: 19.2.3
stacktrace-parser: 0.1.11
'@expo/[email protected](patch_hash=8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46)([email protected])([email protected])([email protected])([email protected])':
@@ -11709,7 +11709,7 @@ snapshots:
postcss: 8.5.15
resolve-from: 5.0.0
optionalDependencies:
transitivePeerDependencies:
- bufferutil
- supports-color
@@ -11727,14 +11727,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
anser: 1.4.10
pretty-format: 29.7.0
react: 19.2.3
stacktrace-parser: 0.1.11
whatwg-fetch: 3.6.20
optionalDependencies:
@@ -11809,14 +11809,14 @@ snapshots:
dependencies:
debug: 4.4.3
expo-server: 56.0.4
react: 19.2.3
optionalDependencies:
- expo-router: 56.2.8(c021de11d02907bd585610408f5252e8)
+ expo-router: 56.2.8(5bfdf39b8f760e4dc2d5c3acffc97310)
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- supports-color
@@ -11831,18 +11831,18 @@ snapshots:
'@expo/[email protected]': {}
- '@expo/[email protected](ab3f255d102c60ba0fd2bbe4e47ba584)':
+ '@expo/[email protected](961c4aa6f32829b318e3c87ef20ad401)':
dependencies:
react: 19.2.3
sf-symbols-typescript: 2.2.0
optionalDependencies:
'@babel/core': 7.29.7
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- '@types/react'
- '@types/react-dom'
@@ -12103,13 +12103,13 @@ snapshots:
dependencies:
jsbi: 4.3.2
dependencies:
react: 19.2.3
use-sync-external-store: 1.6.0([email protected])
optionalDependencies:
react-dom: 19.2.3([email protected])
dependencies:
@@ -12656,7 +12656,7 @@ snapshots:
'@oxlint/[email protected]': {}
- '@pierre/[email protected](patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])':
+ '@pierre/[email protected](patch_hash=0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631)(@shikijs/[email protected])([email protected]([email protected]))([email protected])':
dependencies:
'@pierre/theme': 1.0.3
@@ -12670,7 +12670,7 @@ snapshots:
transitivePeerDependencies:
- '@shikijs/themes'
- '@pierre/[email protected](patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])':
+ '@pierre/[email protected](patch_hash=0befe84f4202720eeab6fa684d8761a5c0cc7046b58cf2c0b804ad2baa7ce631)(@shikijs/[email protected])([email protected]([email protected]))([email protected])':
dependencies:
'@pierre/theme': 1.0.3
@@ -12932,15 +12932,15 @@ snapshots:
prompts: 2.4.2
tinyexec: 1.2.4
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
'@react-native/[email protected]': {}
@@ -13000,7 +13000,7 @@ snapshots:
tinyglobby: 0.2.17
yargs: 17.7.2
dependencies:
'@react-native/dev-middleware': 0.85.3([email protected])([email protected])
debug: 4.4.3
@@ -13010,7 +13010,7 @@ snapshots:
metro-core: 0.84.4
semver: 7.8.1
optionalDependencies:
- '@react-native/metro-config': 0.85.3(@babel/[email protected])
+ '@react-native/metro-config': 0.85.3(@babel/[email protected])([email protected])([email protected])
transitivePeerDependencies:
- bufferutil
- supports-color
@@ -13058,7 +13058,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@react-native/[email protected](@babel/[email protected])':
dependencies:
'@react-native/js-polyfills': 0.85.3
'@react-native/metro-babel-transformer': 0.85.3(@babel/[email protected])
@@ -13066,16 +13066,18 @@ snapshots:
metro-runtime: 0.84.4
transitivePeerDependencies:
- '@babel/core'
+ - bufferutil
- supports-color
+ - utf-8-validate
'@react-native/[email protected]': {}
dependencies:
invariant: 2.2.4
nullthrows: 1.1.1
react: 19.2.3
optionalDependencies:
'@types/react': 19.2.16
@@ -13481,15 +13483,15 @@ snapshots:
dependencies:
defer-to-connect: 2.0.1
- '@t3tools/mobile-markdown-text@file:apps/mobile/modules/t3-markdown-text(e909ee9a8f7fbe234da80c739fca4984)':
+ '@t3tools/mobile-markdown-text@file:apps/mobile/modules/t3-markdown-text(f0ff241d48c23db461fff5d47e450578)':
dependencies:
expo-haptics: 56.0.3([email protected])
react: 19.2.3
'@t3tools/mobile-review-diff-native@file:apps/mobile/modules/t3-review-diff': {}
@@ -14606,8 +14608,8 @@ snapshots:
react-refresh: 0.14.2
optionalDependencies:
'@babel/runtime': 7.29.7
- expo-widgets: 56.0.16(ab3f255d102c60ba0fd2bbe4e47ba584)
+ expo-widgets: 56.0.16(961c4aa6f32829b318e3c87ef20ad401)
transitivePeerDependencies:
- '@babel/core'
- supports-color
@@ -15480,29 +15482,29 @@ snapshots:
dependencies:
dependencies:
'@expo/image-utils': 0.10.1([email protected])
react: 19.2.3
transitivePeerDependencies:
- supports-color
- typescript
dependencies:
expo-application: 56.0.3([email protected])
expo-crypto: 56.0.4([email protected])
invariant: 2.2.4
react: 19.2.3
transitivePeerDependencies:
- expo
- supports-color
@@ -15510,119 +15512,119 @@ snapshots:
dependencies:
'@expo/schema-utils': 56.0.1
resolve-from: 5.0.0
semver: 7.8.1
dependencies:
barcode-detector: 3.2.0(@types/[email protected])
react: 19.2.3
transitivePeerDependencies:
- '@types/emscripten'
dependencies:
react: 19.2.3
dependencies:
'@expo/env': 2.3.0
transitivePeerDependencies:
- supports-color
dependencies:
dependencies:
expo-dev-menu-interface: 56.0.1([email protected])
expo-manifests: 56.0.4([email protected])
expo-updates-interface: 56.0.2([email protected])
transitivePeerDependencies:
- react-native
dependencies:
'@expo/schema-utils': 56.0.1
expo-manifests: 56.0.4([email protected])
dependencies:
dependencies:
expo-dev-menu-interface: 56.0.1([email protected])
dependencies:
dependencies:
fontfaceobserver: 2.3.0
react: 19.2.3
dependencies:
react: 19.2.3
dependencies:
dependencies:
dependencies:
expo-image-loader: 56.0.3([email protected])
dependencies:
react: 19.2.3
dependencies:
invariant: 2.2.4
react: 19.2.3
transitivePeerDependencies:
- expo
- supports-color
dependencies:
expo-json-utils: 56.0.0
@@ -15635,61 +15637,61 @@ snapshots:
- supports-color
- typescript
dependencies:
'@expo/expo-modules-macros-plugin': 0.0.9
invariant: 2.2.4
react: 19.2.3
optionalDependencies:
dependencies:
dependencies:
'@expo/image-utils': 0.10.1([email protected])
abort-controller: 3.0.0
badgin: 1.2.3
expo-application: 56.0.3([email protected])
react: 19.2.3
transitivePeerDependencies:
- supports-color
- typescript
dependencies:
react: 19.2.3
- [email protected](c021de11d02907bd585610408f5252e8):
+ [email protected](5bfdf39b8f760e4dc2d5c3acffc97310):
dependencies:
'@expo/schema-utils': 56.0.1
- '@expo/ui': 56.0.15(ab3f255d102c60ba0fd2bbe4e47ba584)
+ '@expo/ui': 56.0.15(961c4aa6f32829b318e3c87ef20ad401)
'@radix-ui/react-slot': 1.2.4(@types/[email protected])([email protected])
'@testing-library/jest-dom': 6.9.1
'@testing-library/user-event': 14.6.1(@testing-library/[email protected])
client-only: 0.0.1
color: 4.2.3
debug: 4.4.3
escape-string-regexp: 4.0.0
expo-server: 56.0.4
fast-deep-equal: 3.1.3
invariant: 2.2.4
nanoid: 3.3.12
@@ -15697,18 +15699,18 @@ snapshots:
react: 19.2.3
react-fast-compare: 3.2.2
react-is: 19.2.7
+ react-native-drawer-layout: 4.2.4(0e9729601f58a7a7ae26c76fe6017455)
server-only: 0.0.1
sf-symbols-typescript: 2.2.0
shallowequal: 1.1.0
optionalDependencies:
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- '@babel/core'
- '@testing-library/dom'
@@ -15720,7 +15722,7 @@ snapshots:
dependencies:
@@ -15728,7 +15730,7 @@ snapshots:
dependencies:
'@expo/config-plugins': 56.0.8([email protected])
'@expo/image-utils': 0.10.1([email protected])
xml2js: 0.6.0
transitivePeerDependencies:
- supports-color
@@ -15736,20 +15738,20 @@ snapshots:
dependencies:
'@expo-google-fonts/material-symbols': 0.4.38
react: 19.2.3
sf-symbols-typescript: 2.2.0
dependencies:
dependencies:
'@expo/code-signing-certificates': 0.0.6
'@expo/plist': 0.7.0
@@ -15757,7 +15759,7 @@ snapshots:
arg: 4.1.3
chalk: 4.1.2
debug: 4.4.3
expo-eas-client: 56.0.1
expo-manifests: 56.0.4([email protected])
expo-structured-headers: 56.0.0
@@ -15767,25 +15769,25 @@ snapshots:
ignore: 5.3.2
nullthrows: 1.1.1
react: 19.2.3
resolve-from: 5.0.0
optionalDependencies:
transitivePeerDependencies:
- supports-color
dependencies:
- [email protected](ab3f255d102c60ba0fd2bbe4e47ba584):
+ [email protected](961c4aa6f32829b318e3c87ef20ad401):
dependencies:
'@expo/plist': 0.7.0
- '@expo/ui': 56.0.15(ab3f255d102c60ba0fd2bbe4e47ba584)
+ '@expo/ui': 56.0.15(961c4aa6f32829b318e3c87ef20ad401)
react: 19.2.3
transitivePeerDependencies:
- '@babel/core'
- '@types/react'
@@ -15794,35 +15796,35 @@ snapshots:
- react-native-reanimated
- react-native-worklets
dependencies:
'@babel/runtime': 7.29.7
'@expo/config': 56.0.9([email protected])
'@expo/config-plugins': 56.0.8([email protected])
'@expo/fingerprint': 0.19.3
'@expo/local-build-cache-provider': 56.0.8([email protected])
'@expo/metro': 56.0.0([email protected])([email protected])
'@expo/metro-config': 56.0.13(patch_hash=8cb08b5bb7051ed9d2dbe46a2c293c5a1e17f1bd6ddf30de27909e18c921ff46)([email protected])([email protected])([email protected])([email protected])
'@ungap/structured-clone': 1.3.1
expo-keep-awake: 56.0.3([email protected])([email protected])
expo-modules-autolinking: 56.0.14([email protected])
pretty-format: 29.7.0
react: 19.2.3
react-refresh: 0.14.2
whatwg-url-minimum: 0.1.2
optionalDependencies:
react-dom: 19.2.3([email protected])
transitivePeerDependencies:
- '@babel/core'
@@ -18221,95 +18223,95 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ [email protected](0e9729601f58a7a7ae26c76fe6017455):
dependencies:
color: 4.2.3
react: 19.2.3
use-latest-callback: 0.2.6([email protected])
dependencies:
'@egjs/hammerjs': 2.0.17
'@types/react-test-renderer': 19.1.0
hoist-non-react-statics: 3.3.2
invariant: 2.2.4
react: 19.2.3
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
- react-native-nitro-modules: 0.35.9(patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
+ react-native-nitro-modules: 0.35.9(patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
optionalDependencies:
- [email protected](patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]):
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
semver: 7.8.1
dependencies:
react: 19.2.3
dependencies:
react: 19.2.3
react-freeze: 1.0.4([email protected])
warn-once: 0.1.1
dependencies:
'@shikijs/types': 3.23.0
'@shikijs/vscode-textmate': 10.0.2
react: 19.2.3
dependencies:
css-select: 5.2.2
css-tree: 1.1.3
react: 19.2.3
warn-once: 0.1.1
dependencies:
whatwg-url-without-unicode: 8.0.0-3
dependencies:
'@babel/core': 7.29.7
'@babel/plugin-transform-arrow-functions': 7.29.7(@babel/[email protected])
@@ -18321,23 +18323,23 @@ snapshots:
'@babel/plugin-transform-template-literals': 7.29.7(@babel/[email protected])
'@babel/plugin-transform-unicode-regex': 7.29.7(@babel/[email protected])
'@babel/preset-typescript': 7.29.7(@babel/[email protected])
- '@react-native/metro-config': 0.85.3(@babel/[email protected])
+ '@react-native/metro-config': 0.85.3(@babel/[email protected])([email protected])([email protected])
convert-source-map: 2.0.0
react: 19.2.3
semver: 7.8.1
transitivePeerDependencies:
- supports-color
dependencies:
'@react-native/assets-registry': 0.85.3
'@react-native/codegen': 0.85.3(@babel/[email protected])
- '@react-native/community-cli-plugin': 0.85.3(@react-native/[email protected](@babel/[email protected]))([email protected])([email protected])
+ '@react-native/community-cli-plugin': 0.85.3(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected])([email protected])
'@react-native/gradle-plugin': 0.85.3
'@react-native/js-polyfills': 0.85.3
'@react-native/normalize-colors': 0.85.3
abort-controller: 3.0.0
anser: 1.4.10
ansi-regex: 5.0.1
@@ -19370,14 +19372,14 @@ snapshots:
dependencies:
'@tailwindcss/node': 4.2.1
'@tailwindcss/oxide': 4.2.1
culori: 4.0.2
lightningcss: 1.30.1
react: 19.2.3
tailwindcss: 4.3.0