mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-28 04:03:05 +00:00
* feat(app): add pull request panel context actions Attach pull request comments, reviews, and failed check details to chat context. The PR panel now lives in its own module so the activity, query, and context policies have one home. * fix(server): mark capped check details as truncated * fix(app): preserve concurrent PR panel attachments * fix(server): preserve annotation truncation state * fix(app): keep matrix check attachments distinct * fix(app): streamline pull request context attachments * fix(app): simplify pull request feedback rendering * feat(app): group pull request review threads * fix(app): tidy pull request panel boundaries * fix: use worktree cwd for dev services * fix(app): keep git query keys UI-free * feat(app): collapse resolved comments and add chat actions to headers * fix: address PR feedback and Playwright flakes * fix(app): hide check chat action without attachment scope * fix(server): dedupe inline review timeline comments
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import type { PrPaneActivity } from "./data";
|
|
|
|
export function formatPullRequestActivityLocation(activity: PrPaneActivity): string | null {
|
|
if (!activity.location) {
|
|
return null;
|
|
}
|
|
|
|
const parts = [formatPathAndLines(activity.location)];
|
|
const threadState = formatThreadState(activity.location);
|
|
if (threadState) {
|
|
parts.push(...threadState);
|
|
}
|
|
const threadLabel = formatThreadLabel(activity.location.threadId);
|
|
if (threadLabel) {
|
|
parts.push(threadLabel);
|
|
}
|
|
|
|
return parts.join(" · ");
|
|
}
|
|
|
|
function formatPathAndLines(location: NonNullable<PrPaneActivity["location"]>): string {
|
|
if (location.line !== undefined && location.startLine !== undefined) {
|
|
return `${location.path}:${location.startLine}-${location.line}`;
|
|
}
|
|
if (location.line !== undefined) {
|
|
return `${location.path}:${location.line}`;
|
|
}
|
|
return location.path;
|
|
}
|
|
|
|
/** Path-and-line label for a review thread header, e.g. "src/foo.ts:12-14". */
|
|
export function formatPullRequestThreadPath(
|
|
location: NonNullable<PrPaneActivity["location"]>,
|
|
): string {
|
|
return formatPathAndLines(location);
|
|
}
|
|
|
|
function formatThreadState(location: NonNullable<PrPaneActivity["location"]>): string[] | null {
|
|
const state = [];
|
|
if (location.isResolved !== undefined) {
|
|
state.push(location.isResolved ? "resolved" : "unresolved");
|
|
}
|
|
if (location.isOutdated !== undefined) {
|
|
state.push(location.isOutdated ? "outdated" : "current");
|
|
}
|
|
return state.length > 0 ? state : null;
|
|
}
|
|
|
|
function formatThreadLabel(threadId: string | undefined): string | null {
|
|
if (!threadId || threadId.length > 24) {
|
|
return null;
|
|
}
|
|
return `thread ${threadId}`;
|
|
}
|