feat(github): configurable quick-action presets and PR branch checkout (#689)
* feat(github): configurable quick-action presets and PR branch checkout - Add workspace-scoped action presets (icon, label, hint, prompt template) for PRs and Issues, editable from GitHub settings with reset-to-defaults. - When starting a task from a PR, check out the PR head branch directly in the worktree instead of branching off main. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(github): extract action-preset service to keep service.go under line limit Splits the preset CRUD methods out of the oversized service.go and applies prettier formatting to three frontend files flagged by CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(github): address review feedback on action presets - Prevent infinite refetch loop when fetching presets fails by tracking attempted workspaces in a ref instead of re-entering the effect on every loading-state change. - Drop unused savePR/saveIssue helpers from the hook; only save() is consumed. - Reorder the init spread in updateGitHubActionPresets/resetGitHubActionPresets so callers can't accidentally overwrite method/body. - Tighten the GitHubActionPreset.icon type with string & {} so known icon keys keep autocomplete. - Sharpen the eye-icon test to assert the exact IconEye mapping. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(github): address second round of review feedback - Seed preset editor drafts from current store state via lazy initializers so a warm mount shows the user's saved customisations instead of silently reverting to defaults when Save is clicked. - Guard Reset button with its own in-flight state to prevent double-firing. - Stop freezing resolved defaults into the stored row on a partial update; persist only what the store has for the untouched kind so future default improvements still reach those workspaces. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * refactor(github): tighten quick-actions editor UI Replace the stacked PR/Issue editors and multi-line preset cards with a tabbed layout and single-line rows. Each row shows icon · label · hint inline; an "Edit prompt" toggle reveals the template textarea only when needed. Drops the redundant section headings, up/down reorder buttons, and verbose template helper label (hint moved into the textarea placeholder). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * fix(github): widen icon select trigger so the icon is visible The icon select trigger had a fixed 40px width which the SelectTrigger's built-in chevron, padding, and icon gap all competed for, clipping the icon out of view. Drop the width override so the trigger sizes to its content. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -24,7 +24,13 @@ import { SavePresetDialog } from "@/components/github/my-github/save-preset-dial
|
||||
import {
|
||||
QuickTaskLauncher,
|
||||
type LaunchPayload,
|
||||
type TaskPreset,
|
||||
} from "@/components/github/my-github/quick-task-launcher";
|
||||
import {
|
||||
resolvePRPresets,
|
||||
resolveIssuePresets,
|
||||
} from "@/components/github/my-github/action-presets";
|
||||
import { useGitHubActionPresets } from "@/hooks/domains/github/use-github-action-presets";
|
||||
|
||||
type GitHubPageClientProps = {
|
||||
workspaceId?: string;
|
||||
@@ -91,12 +97,16 @@ function ResultsList({
|
||||
items,
|
||||
loading,
|
||||
error,
|
||||
prPresets,
|
||||
issuePresets,
|
||||
onStartTask,
|
||||
}: {
|
||||
selection: SidebarSelection;
|
||||
items: Array<GitHubPR | GitHubIssue>;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
prPresets: TaskPreset[];
|
||||
issuePresets: TaskPreset[];
|
||||
onStartTask: (payload: LaunchPayload) => void;
|
||||
}) {
|
||||
if (selection.kind === "pr") {
|
||||
@@ -105,6 +115,7 @@ function ResultsList({
|
||||
items={items as GitHubPR[]}
|
||||
loading={loading}
|
||||
error={error}
|
||||
presets={prPresets}
|
||||
onStartTask={onStartTask}
|
||||
/>
|
||||
);
|
||||
@@ -114,6 +125,7 @@ function ResultsList({
|
||||
items={items as GitHubIssue[]}
|
||||
loading={loading}
|
||||
error={error}
|
||||
presets={issuePresets}
|
||||
onStartTask={onStartTask}
|
||||
/>
|
||||
);
|
||||
@@ -245,10 +257,14 @@ function useGitHubPageState() {
|
||||
function AuthenticatedLayout({
|
||||
workspaceId,
|
||||
state,
|
||||
prPresets,
|
||||
issuePresets,
|
||||
onStartTask,
|
||||
}: {
|
||||
workspaceId: string | undefined;
|
||||
state: GitHubPageState;
|
||||
prPresets: TaskPreset[];
|
||||
issuePresets: TaskPreset[];
|
||||
onStartTask: (payload: LaunchPayload) => void;
|
||||
}) {
|
||||
const { selection, search, repoOptions, title } = state;
|
||||
@@ -286,6 +302,8 @@ function AuthenticatedLayout({
|
||||
items={search.items}
|
||||
loading={search.loading}
|
||||
error={search.error}
|
||||
prPresets={prPresets}
|
||||
issuePresets={issuePresets}
|
||||
onStartTask={onStartTask}
|
||||
/>
|
||||
</div>
|
||||
@@ -309,6 +327,9 @@ export function GitHubPageClient({
|
||||
const { status, loaded } = useGitHubStatus();
|
||||
const [launchPayload, setLaunchPayload] = useState<LaunchPayload | null>(null);
|
||||
const state = useGitHubPageState();
|
||||
const { presets: storedPresets } = useGitHubActionPresets(workspaceId ?? null);
|
||||
const prPresets = useMemo(() => resolvePRPresets(storedPresets), [storedPresets]);
|
||||
const issuePresets = useMemo(() => resolveIssuePresets(storedPresets), [storedPresets]);
|
||||
|
||||
// Drop the module-level repo accumulator on page unmount so a later visit
|
||||
// doesn't inherit a stale set from the previous navigation.
|
||||
@@ -328,7 +349,13 @@ export function GitHubPageClient({
|
||||
</div>
|
||||
)}
|
||||
{loaded && authed && (
|
||||
<AuthenticatedLayout workspaceId={workspaceId} state={state} onStartTask={onStartTask} />
|
||||
<AuthenticatedLayout
|
||||
workspaceId={workspaceId}
|
||||
state={state}
|
||||
prPresets={prPresets}
|
||||
issuePresets={issuePresets}
|
||||
onStartTask={onStartTask}
|
||||
/>
|
||||
)}
|
||||
<QuickTaskLauncher
|
||||
workspaceId={workspaceId ?? null}
|
||||
|
||||
Reference in New Issue
Block a user