fix: address review findings (#5055)
This commit is contained in:
@@ -4476,7 +4476,7 @@ function ChecksTab({
|
||||
title={translate('auto.components.PullRequestPage.a053bdd082', 'Fix Broken Checks With AI')}
|
||||
description={translate(
|
||||
'auto.components.PullRequestPage.ddfd42f460',
|
||||
'Choose the agent and edit the full command input before launch.'
|
||||
'Review the prompt before starting an agent.'
|
||||
)}
|
||||
baseCommandInput={fixChecksComposerPrompt ?? ''}
|
||||
connectionId={repo?.connectionId ?? null}
|
||||
|
||||
@@ -165,7 +165,11 @@ export function ChecksPanelReviewHeader({
|
||||
<button
|
||||
type="button"
|
||||
className="rounded px-0.5 text-[12px] font-semibold text-foreground underline decoration-border underline-offset-2 hover:text-foreground hover:decoration-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
title={translate("auto.components.right.sidebar.ChecksPanel.5c88c6db07", "Open on {{value0}}", { value0: reviewHostLabel })}
|
||||
title={translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.5c88c6db07',
|
||||
'Open on {{value0}}',
|
||||
{ value0: reviewHostLabel }
|
||||
)}
|
||||
onClick={onOpenReview}
|
||||
>
|
||||
{reviewNumberLabel}
|
||||
@@ -181,7 +185,7 @@ export function ChecksPanelReviewHeader({
|
||||
<div className="flex-1" />
|
||||
<button
|
||||
className="cursor-pointer rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-50"
|
||||
title={translate("auto.components.right.sidebar.ChecksPanel.7f4489f370", "Refresh")}
|
||||
title={translate('auto.components.right.sidebar.ChecksPanel.7f4489f370', 'Refresh')}
|
||||
onClick={onRefresh}
|
||||
disabled={isRefreshing}
|
||||
>
|
||||
@@ -194,8 +198,14 @@ export function ChecksPanelReviewHeader({
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-xs"
|
||||
aria-label={translate("auto.components.right.sidebar.ChecksPanel.653c105ecc", "More PR actions")}
|
||||
title={translate("auto.components.right.sidebar.ChecksPanel.653c105ecc", "More PR actions")}
|
||||
aria-label={translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.653c105ecc',
|
||||
'More PR actions'
|
||||
)}
|
||||
title={translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.653c105ecc',
|
||||
'More PR actions'
|
||||
)}
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<Ellipsis className="size-3.5" />
|
||||
@@ -204,10 +214,12 @@ export function ChecksPanelReviewHeader({
|
||||
<DropdownMenuContent align="end" className="w-44">
|
||||
<DropdownMenuItem disabled={!canUnlinkPullRequest} onSelect={onUnlinkPullRequest}>
|
||||
<Unlink className="size-3.5" />
|
||||
{translate("auto.components.right.sidebar.ChecksPanel.7202f4a40a", "unlink PR")}</DropdownMenuItem>
|
||||
{translate('auto.components.right.sidebar.ChecksPanel.7202f4a40a', 'unlink PR')}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem onSelect={onLinkAnotherPullRequest}>
|
||||
<Link className="size-3.5" />
|
||||
{translate("auto.components.right.sidebar.ChecksPanel.07871c0589", "Link another PR")}</DropdownMenuItem>
|
||||
{translate('auto.components.right.sidebar.ChecksPanel.07871c0589', 'Link another PR')}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)}
|
||||
@@ -1721,7 +1733,12 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
}
|
||||
if (!ok) {
|
||||
setComments(previousComments)
|
||||
toast.error(translate("auto.components.right.sidebar.ChecksPanel.5788d1059d", "Could not update review thread. Check the GitHub API budget."))
|
||||
toast.error(
|
||||
translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.5788d1059d',
|
||||
'Could not update review thread. Check the GitHub API budget.'
|
||||
)
|
||||
)
|
||||
}
|
||||
return ok
|
||||
},
|
||||
@@ -1826,9 +1843,12 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
return
|
||||
}
|
||||
const confirmed = await confirm({
|
||||
title: translate("auto.components.right.sidebar.ChecksPanel.ea9b649ce3", "Delete comment?"),
|
||||
description: translate("auto.components.right.sidebar.ChecksPanel.3b203c62f8", "This will permanently remove the comment from the PR."),
|
||||
confirmLabel: translate("auto.components.right.sidebar.ChecksPanel.786e3c143f", "Delete"),
|
||||
title: translate('auto.components.right.sidebar.ChecksPanel.ea9b649ce3', 'Delete comment?'),
|
||||
description: translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.3b203c62f8',
|
||||
'This will permanently remove the comment from the PR.'
|
||||
),
|
||||
confirmLabel: translate('auto.components.right.sidebar.ChecksPanel.786e3c143f', 'Delete'),
|
||||
confirmVariant: 'destructive'
|
||||
})
|
||||
if (!confirmed) {
|
||||
@@ -1907,8 +1927,14 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
const conflictFiles = activeConflictReview.conflictSummary?.files ?? []
|
||||
setAgentComposerState({
|
||||
actionId: 'resolveConflicts',
|
||||
title: translate("auto.components.right.sidebar.ChecksPanel.4ede779461", "Resolve Review Conflicts With AI"),
|
||||
description: translate("auto.components.right.sidebar.ChecksPanel.abf59262fb", "Review and edit the full command input before starting an agent."),
|
||||
title: translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.4ede779461',
|
||||
'Resolve Review Conflicts With AI'
|
||||
),
|
||||
description: translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.abf59262fb',
|
||||
'Review the prompt before starting an agent.'
|
||||
),
|
||||
prompt: buildResolvePullRequestConflictsPrompt({
|
||||
reviewKind: activeConflictReview.provider === 'gitlab' ? 'MR' : 'PR',
|
||||
baseRef: activeConflictReview.conflictSummary?.baseRef,
|
||||
@@ -1925,7 +1951,12 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
}
|
||||
const broken = getBrokenChecks(checks)
|
||||
if (broken.length === 0) {
|
||||
toast.message(translate("auto.components.right.sidebar.ChecksPanel.5594400d73", "No broken checks to fix."))
|
||||
toast.message(
|
||||
translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.5594400d73',
|
||||
'No broken checks to fix.'
|
||||
)
|
||||
)
|
||||
return
|
||||
}
|
||||
const requestKey = stateRequestKey
|
||||
@@ -1978,7 +2009,12 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
launchSource: 'task_page'
|
||||
})
|
||||
if (started) {
|
||||
toast.success(translate("auto.components.right.sidebar.ChecksPanel.2ef90c9819", "Started an AI agent for the broken checks."))
|
||||
toast.success(
|
||||
translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.2ef90c9819',
|
||||
'Started an AI agent for the broken checks.'
|
||||
)
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
setIsFixingChecksWithAI(false)
|
||||
@@ -2381,17 +2417,33 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
if (!activeWorktree) {
|
||||
return (
|
||||
<div className="px-4 py-6">
|
||||
<div className="text-sm font-medium text-foreground">{translate("auto.components.right.sidebar.ChecksPanel.a4ef4e0832", "No workspace selected")}</div>
|
||||
<div className="mt-1 text-xs text-muted-foreground">{translate("auto.components.right.sidebar.ChecksPanel.b5dd73a105", "Select a workspace to view checks")}</div>
|
||||
<div className="text-sm font-medium text-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.a4ef4e0832',
|
||||
'No workspace selected'
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-1 text-xs text-muted-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.b5dd73a105',
|
||||
'Select a workspace to view checks'
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (isFolder) {
|
||||
return (
|
||||
<div className="px-4 py-6">
|
||||
<div className="text-sm font-medium text-foreground">{translate("auto.components.right.sidebar.ChecksPanel.976cefd02f", "Checks unavailable")}</div>
|
||||
<div className="text-sm font-medium text-foreground">
|
||||
{translate('auto.components.right.sidebar.ChecksPanel.976cefd02f', 'Checks unavailable')}
|
||||
</div>
|
||||
<div className="mt-1 text-xs text-muted-foreground">
|
||||
{translate("auto.components.right.sidebar.ChecksPanel.dda5924a40", "Checks require a Git branch and hosted review context")}</div>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.dda5924a40',
|
||||
'Checks require a Git branch and hosted review context'
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -2468,7 +2520,15 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
disabled={isPublishingBranch || isRemoteOperationActive}
|
||||
onClick={handlePublishBranch}
|
||||
>
|
||||
{isPublishingBranch ? translate("auto.components.right.sidebar.ChecksPanel.fdb27637f2", "Publishing…") : translate("auto.components.right.sidebar.ChecksPanel.6633c7a1fb", "Publish Branch")}
|
||||
{isPublishingBranch
|
||||
? translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.fdb27637f2',
|
||||
'Publishing…'
|
||||
)
|
||||
: translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.6633c7a1fb',
|
||||
'Publish Branch'
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
{(canCreate || canPushCreate) && (
|
||||
@@ -2480,8 +2540,16 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
}}
|
||||
>
|
||||
{canPushCreate
|
||||
? translate("auto.components.right.sidebar.ChecksPanel.98f4c37b33", "Push & Create {{value0}}", { value0: emptyReviewShortLabel })
|
||||
: translate("auto.components.right.sidebar.ChecksPanel.889cdfba04", "Create {{value0}}", { value0: emptyReviewShortLabel })}
|
||||
? translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.98f4c37b33',
|
||||
'Push & Create {{value0}}',
|
||||
{ value0: emptyReviewShortLabel }
|
||||
)
|
||||
: translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.889cdfba04',
|
||||
'Create {{value0}}',
|
||||
{ value0: emptyReviewShortLabel }
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
@@ -2498,7 +2566,9 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
})
|
||||
}}
|
||||
>
|
||||
{emptyRefreshing ? translate("auto.components.right.sidebar.ChecksPanel.71026ca2cb", "Refreshing…") : translate("auto.components.right.sidebar.ChecksPanel.7f4489f370", "Refresh")}
|
||||
{emptyRefreshing
|
||||
? translate('auto.components.right.sidebar.ChecksPanel.71026ca2cb', 'Refreshing…')
|
||||
: translate('auto.components.right.sidebar.ChecksPanel.7f4489f370', 'Refresh')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -2540,7 +2610,7 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
/>
|
||||
<button
|
||||
className="cursor-pointer rounded p-1 text-emerald-500 transition-colors hover:bg-accent hover:text-emerald-400 disabled:cursor-default disabled:opacity-50"
|
||||
title={translate("auto.components.right.sidebar.ChecksPanel.2ab7fd4b6d", "Save")}
|
||||
title={translate('auto.components.right.sidebar.ChecksPanel.2ab7fd4b6d', 'Save')}
|
||||
onClick={() => void handleSaveTitle()}
|
||||
disabled={titleSaving}
|
||||
>
|
||||
@@ -2552,7 +2622,7 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
</button>
|
||||
<button
|
||||
className="cursor-pointer rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-50"
|
||||
title={translate("auto.components.right.sidebar.ChecksPanel.058039787c", "Cancel")}
|
||||
title={translate('auto.components.right.sidebar.ChecksPanel.058039787c', 'Cancel')}
|
||||
onClick={handleCancelEdit}
|
||||
disabled={titleSaving}
|
||||
>
|
||||
@@ -2574,7 +2644,9 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
{/* Updated at */}
|
||||
{activeReview.updatedAt && (
|
||||
<div className="text-[10px] text-muted-foreground/60">
|
||||
{reviewShortLabel} {translate("auto.components.right.sidebar.ChecksPanel.34464d00b9", "updated")}{new Date(activeReview.updatedAt).toLocaleString()}
|
||||
{reviewShortLabel}{' '}
|
||||
{translate('auto.components.right.sidebar.ChecksPanel.34464d00b9', 'updated')}
|
||||
{new Date(activeReview.updatedAt).toLocaleString()}
|
||||
</div>
|
||||
)}
|
||||
{queueBadges.length > 0 ? (
|
||||
@@ -2658,7 +2730,10 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
}
|
||||
}}
|
||||
actionId={agentComposerState?.actionId ?? 'fixChecks'}
|
||||
title={agentComposerState?.title ?? translate("auto.components.right.sidebar.ChecksPanel.7fad8509fe", "Fix With AI")}
|
||||
title={
|
||||
agentComposerState?.title ??
|
||||
translate('auto.components.right.sidebar.ChecksPanel.7fad8509fe', 'Fix With AI')
|
||||
}
|
||||
description={agentComposerState?.description ?? ''}
|
||||
baseCommandInput={agentComposerState?.prompt ?? ''}
|
||||
worktreeId={activeWorktreeId}
|
||||
@@ -2700,9 +2775,19 @@ export default function ChecksPanel(): React.JSX.Element {
|
||||
onSaveAgentDefault={saveLaunchActionDefault}
|
||||
onLaunched={() => {
|
||||
if (agentComposerState?.actionId === 'resolveConflicts') {
|
||||
toast.success(translate("auto.components.right.sidebar.ChecksPanel.a0181a8d76", "Started an AI agent for the conflicts."))
|
||||
toast.success(
|
||||
translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.a0181a8d76',
|
||||
'Started an AI agent for the conflicts.'
|
||||
)
|
||||
)
|
||||
} else {
|
||||
toast.success(translate("auto.components.right.sidebar.ChecksPanel.2ef90c9819", "Started an AI agent for the broken checks."))
|
||||
toast.success(
|
||||
translate(
|
||||
'auto.components.right.sidebar.ChecksPanel.2ef90c9819',
|
||||
'Started an AI agent for the broken checks.'
|
||||
)
|
||||
)
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,6 @@ export function SourceControlAgentActionDialog(
|
||||
actionId,
|
||||
title,
|
||||
description,
|
||||
baseCommandInput,
|
||||
savedCommandInputTemplate,
|
||||
onOpenSettings,
|
||||
startLabel = 'Start agent',
|
||||
@@ -71,6 +70,7 @@ export function SourceControlAgentActionDialog(
|
||||
statusCopy,
|
||||
agentArgs,
|
||||
commandTemplate,
|
||||
saveLaunchRecipe,
|
||||
saveTargetValue,
|
||||
saveTargets,
|
||||
settings,
|
||||
@@ -81,14 +81,15 @@ export function SourceControlAgentActionDialog(
|
||||
onSelectedAgentChange,
|
||||
onAgentArgsChange,
|
||||
onCommandTemplateChange,
|
||||
onSaveLaunchRecipeChange,
|
||||
onSaveAgentDefaultChange,
|
||||
handleStart
|
||||
} = useSourceControlAgentActionDialog(props)
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleOpenChange}>
|
||||
<DialogContent className="min-w-0 overflow-x-hidden sm:max-w-2xl">
|
||||
<DialogHeader>
|
||||
<DialogContent className="flex h-[70vh] min-w-0 flex-col overflow-hidden sm:max-w-2xl">
|
||||
<DialogHeader className="shrink-0">
|
||||
<DialogTitle className="text-sm">{title}</DialogTitle>
|
||||
<DialogDescription className="text-xs">{description}</DialogDescription>
|
||||
</DialogHeader>
|
||||
@@ -102,7 +103,7 @@ export function SourceControlAgentActionDialog(
|
||||
agentArgs={agentArgs}
|
||||
commandTemplate={commandTemplate}
|
||||
savedCommandInputTemplate={savedCommandInputTemplate}
|
||||
baseCommandInput={baseCommandInput}
|
||||
saveLaunchRecipe={saveLaunchRecipe}
|
||||
saveTargetValue={saveTargetValue}
|
||||
saveTargets={saveTargets}
|
||||
settings={settings}
|
||||
@@ -115,8 +116,10 @@ export function SourceControlAgentActionDialog(
|
||||
onSelectedAgentChange={onSelectedAgentChange}
|
||||
onAgentArgsChange={onAgentArgsChange}
|
||||
onCommandTemplateChange={onCommandTemplateChange}
|
||||
onSaveLaunchRecipeChange={onSaveLaunchRecipeChange}
|
||||
onSaveAgentDefaultChange={onSaveAgentDefaultChange}
|
||||
onOpenSettings={onOpenSettings}
|
||||
onCancel={() => handleOpenChange(false)}
|
||||
onStart={() => void handleStart()}
|
||||
/>
|
||||
</DialogContent>
|
||||
|
||||
@@ -17,7 +17,6 @@ import { cn } from '@/lib/utils'
|
||||
import type { SourceControlLaunchActionId } from '../../../../shared/source-control-ai-actions'
|
||||
import type { SourceControlAiWriteTarget } from '../../../../shared/source-control-ai-recipe-save'
|
||||
import type { GlobalSettings, Repo, TuiAgent } from '../../../../shared/types'
|
||||
import { SourceControlActionVariableChips } from '../source-control/SourceControlActionVariableChips'
|
||||
import { sourceControlActionRecipeMatchesTarget } from './source-control-action-recipe-match'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
|
||||
@@ -36,7 +35,7 @@ type SourceControlAgentActionDialogFormProps = {
|
||||
agentArgs: string
|
||||
commandTemplate: string
|
||||
savedCommandInputTemplate?: string | null
|
||||
baseCommandInput: string
|
||||
saveLaunchRecipe: boolean
|
||||
saveTargetValue: string
|
||||
saveTargets: { value: string; label: string }[]
|
||||
settings: GlobalSettings | null
|
||||
@@ -49,8 +48,10 @@ type SourceControlAgentActionDialogFormProps = {
|
||||
onSelectedAgentChange: (agent: TuiAgent | null) => void
|
||||
onAgentArgsChange: (value: string) => void
|
||||
onCommandTemplateChange: (value: string) => void
|
||||
onSaveLaunchRecipeChange: (value: boolean) => void
|
||||
onSaveAgentDefaultChange: (value: string) => void
|
||||
onOpenSettings?: () => void
|
||||
onCancel: () => void
|
||||
onStart: () => void
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ export function SourceControlAgentActionDialogForm({
|
||||
agentArgs,
|
||||
commandTemplate,
|
||||
savedCommandInputTemplate,
|
||||
baseCommandInput,
|
||||
saveLaunchRecipe,
|
||||
saveTargetValue,
|
||||
saveTargets,
|
||||
settings,
|
||||
@@ -90,10 +91,14 @@ export function SourceControlAgentActionDialogForm({
|
||||
onSelectedAgentChange,
|
||||
onAgentArgsChange,
|
||||
onCommandTemplateChange,
|
||||
onSaveLaunchRecipeChange,
|
||||
onSaveAgentDefaultChange,
|
||||
onOpenSettings,
|
||||
onCancel,
|
||||
onStart
|
||||
}: SourceControlAgentActionDialogFormProps): React.JSX.Element {
|
||||
const defaultCommandTemplate = savedCommandInputTemplate ?? '{basePrompt}'
|
||||
const commandTemplateIncludesBasePrompt = commandTemplate.includes('{basePrompt}')
|
||||
const selectedRecipe = selectedAgent
|
||||
? {
|
||||
agentId: selectedAgent,
|
||||
@@ -118,12 +123,25 @@ export function SourceControlAgentActionDialogForm({
|
||||
)
|
||||
)
|
||||
const showSaveLaunchRecipe = canSaveAgentDefault && selectedAgent && !allLaunchRecipesAlreadySaved
|
||||
const saveScopeTargets = saveTargets.filter((target) => target.value !== 'none')
|
||||
const effectiveStartLabel =
|
||||
showSaveLaunchRecipe && saveLaunchRecipe
|
||||
? translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.5421a96acb',
|
||||
'Save & start agent'
|
||||
)
|
||||
: startLabel
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="min-w-0 space-y-4">
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-4">
|
||||
<div className="min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto pr-1 scrollbar-sleek">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs">{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.15c5d85706", "Agent")}</Label>
|
||||
<Label className="text-xs">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.15c5d85706',
|
||||
'Agent'
|
||||
)}
|
||||
</Label>
|
||||
{hasEnabledAgents || selectedAgent ? (
|
||||
<AgentCombobox
|
||||
agents={agentOptions}
|
||||
@@ -134,11 +152,25 @@ export function SourceControlAgentActionDialogForm({
|
||||
/>
|
||||
) : (
|
||||
<div className="flex items-center justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground">
|
||||
<span>{detecting ? translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.c7ff8cef11", "Detecting agents...") : translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.1d47db9bf0", "No enabled agents")}</span>
|
||||
<span>
|
||||
{detecting
|
||||
? translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.c7ff8cef11',
|
||||
'Detecting agents...'
|
||||
)
|
||||
: translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.1d47db9bf0',
|
||||
'No enabled agents'
|
||||
)}
|
||||
</span>
|
||||
{onOpenSettings ? (
|
||||
<Button type="button" variant="ghost" size="xs" onClick={onOpenSettings}>
|
||||
<Settings className="size-3.5" />
|
||||
{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.b99c33cec5", "Settings")}</Button>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.b99c33cec5',
|
||||
'Settings'
|
||||
)}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
@@ -152,63 +184,131 @@ export function SourceControlAgentActionDialogForm({
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="source-control-agent-cli-args" className="text-xs">
|
||||
{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.bc8dc39f4b", "CLI arguments")}</Label>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.bc8dc39f4b',
|
||||
'CLI arguments'
|
||||
)}
|
||||
</Label>
|
||||
<Input
|
||||
id="source-control-agent-cli-args"
|
||||
value={agentArgs}
|
||||
spellCheck={false}
|
||||
placeholder={translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.fe119187bb", "--model sonnet")}
|
||||
placeholder={translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.fe119187bb',
|
||||
'--model sonnet'
|
||||
)}
|
||||
onChange={(event) => onAgentArgsChange(event.target.value)}
|
||||
className="h-8 font-mono text-xs"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<Label htmlFor="source-control-agent-command-input" className="text-xs">
|
||||
{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.f4f3c9ca4a", "Command template")}</Label>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<Label htmlFor="source-control-agent-command-input" className="text-xs">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.f4f3c9ca4a',
|
||||
'Prompt template'
|
||||
)}
|
||||
</Label>
|
||||
<p className="mt-1 text-[11px] leading-4 text-muted-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.1bb611240f',
|
||||
"Use {basePrompt} for Orca's default prompt."
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
onClick={() => onCommandTemplateChange(savedCommandInputTemplate ?? '{basePrompt}')}
|
||||
disabled={commandTemplate === defaultCommandTemplate}
|
||||
onClick={() => onCommandTemplateChange(defaultCommandTemplate)}
|
||||
>
|
||||
<RotateCcw className="size-3.5" />
|
||||
{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.7ec6abbf2a", "Reset")}</Button>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.7ec6abbf2a',
|
||||
'Reset'
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
<textarea
|
||||
id="source-control-agent-command-input"
|
||||
rows={12}
|
||||
rows={10}
|
||||
value={commandTemplate}
|
||||
onChange={(event) => onCommandTemplateChange(event.target.value)}
|
||||
className="box-border min-h-[14rem] min-w-0 w-full max-w-full resize-y rounded-md border border-border bg-background px-2.5 py-2 font-mono text-xs text-foreground outline-none placeholder:text-muted-foreground/70 focus-visible:ring-1 focus-visible:ring-ring"
|
||||
/>
|
||||
<SourceControlActionVariableChips
|
||||
actionId={actionId}
|
||||
variablePreviews={{ basePrompt: baseCommandInput }}
|
||||
onInsert={(variable) => {
|
||||
const separator =
|
||||
commandTemplate.endsWith('\n') || commandTemplate.length === 0 ? '' : ' '
|
||||
onCommandTemplateChange(`${commandTemplate}${separator}{${variable}}`)
|
||||
}}
|
||||
className="box-border min-h-[7.75rem] min-w-0 w-full max-w-full resize-y rounded-md border border-border bg-background px-2.5 py-2 font-mono text-xs text-foreground outline-none placeholder:text-muted-foreground/70 focus-visible:ring-1 focus-visible:ring-ring"
|
||||
/>
|
||||
<p className="text-[11px] leading-4 text-muted-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.d8f40128ee',
|
||||
"{basePrompt} is Orca's default prompt."
|
||||
)}
|
||||
</p>
|
||||
{!commandTemplateIncludesBasePrompt ? (
|
||||
<p className="flex items-start gap-1.5 rounded-md border border-destructive/30 bg-destructive/5 px-2.5 py-2 text-[11px] leading-4 text-destructive">
|
||||
<TriangleAlert className="mt-px size-3 shrink-0" />
|
||||
<span>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.23280cbab1',
|
||||
"This template does not include {basePrompt}, so the agent will not receive Orca's default prompt."
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{showSaveLaunchRecipe ? (
|
||||
<div className="space-y-2">
|
||||
<Label className="text-xs">{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.f84657c925", "Save launch recipe")}</Label>
|
||||
<Select value={saveTargetValue} onValueChange={onSaveAgentDefaultChange}>
|
||||
<SelectTrigger size="sm" className="h-8 w-full text-xs">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{saveTargets.map((target) => (
|
||||
<SelectItem key={target.value} value={target.value}>
|
||||
{target.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div
|
||||
className={cn(
|
||||
'space-y-2 rounded-md border border-border bg-background p-3',
|
||||
saveLaunchRecipe && 'border-foreground shadow-[inset_0_0_0_1px_var(--foreground)]'
|
||||
)}
|
||||
>
|
||||
<label className="grid cursor-pointer grid-cols-[1rem_1fr] items-start gap-2.5">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={saveLaunchRecipe}
|
||||
onChange={(event) => onSaveLaunchRecipeChange(event.target.checked)}
|
||||
className="mt-0.5 size-3.5 accent-foreground"
|
||||
/>
|
||||
<span>
|
||||
<span className="block text-xs font-semibold">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.c29f9cf266',
|
||||
"Save this prompt and don't show this review next time"
|
||||
)}
|
||||
</span>
|
||||
<span className="mt-0.5 block text-[11px] leading-4 text-muted-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.6cefcdfba1',
|
||||
'You can change it later in Source Control AI settings.'
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
{saveLaunchRecipe ? (
|
||||
<div className="grid grid-cols-[5.5rem_1fr] items-center gap-2 border-t border-border pt-2">
|
||||
<span className="text-[11px] text-muted-foreground">
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.013c9ac04a',
|
||||
'Save for'
|
||||
)}
|
||||
</span>
|
||||
<Select value={saveTargetValue} onValueChange={onSaveAgentDefaultChange}>
|
||||
<SelectTrigger size="sm" className="h-8 w-full text-xs">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{saveScopeTargets.map((target) => (
|
||||
<SelectItem key={target.value} value={target.value}>
|
||||
{target.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -233,7 +333,11 @@ export function SourceControlAgentActionDialogForm({
|
||||
<span>{deliveryPlan.summary}</span>
|
||||
</div>
|
||||
<div className="truncate font-mono text-[11px]">
|
||||
{translate("auto.components.right.sidebar.SourceControlAgentActionDialogForm.1bc0bdbb5e", "Launch:")}{deliveryPlan.commandLabel}
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.1bc0bdbb5e',
|
||||
'Launch:'
|
||||
)}
|
||||
{deliveryPlan.commandLabel}
|
||||
</div>
|
||||
<div className="text-[11px]">{deliveryPlan.caveat}</div>
|
||||
</div>
|
||||
@@ -243,15 +347,21 @@ export function SourceControlAgentActionDialogForm({
|
||||
</div>
|
||||
|
||||
<DialogFooter className="flex-wrap gap-2 sm:justify-end">
|
||||
<Button type="button" variant="secondary" size="sm" onClick={onCancel}>
|
||||
{translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialogForm.ea4788705e',
|
||||
'Cancel'
|
||||
)}
|
||||
</Button>
|
||||
<Button type="button" size="sm" disabled={!canStart} onClick={onStart}>
|
||||
{isStarting ? (
|
||||
<RefreshCw className="size-4 animate-spin" />
|
||||
) : (
|
||||
<Sparkles className="size-4" />
|
||||
)}
|
||||
{startLabel}
|
||||
{effectiveStartLabel}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ export type UseSourceControlAgentActionDialogResult = {
|
||||
statusCopy: string | null
|
||||
agentArgs: string
|
||||
commandTemplate: string
|
||||
saveLaunchRecipe: boolean
|
||||
saveTargetValue: string
|
||||
saveTargets: { value: string; label: string }[]
|
||||
settings: ReturnType<typeof useAppStore.getState>['settings']
|
||||
@@ -23,6 +24,7 @@ export type UseSourceControlAgentActionDialogResult = {
|
||||
onSelectedAgentChange: (agent: TuiAgent | null) => void
|
||||
onAgentArgsChange: (value: string) => void
|
||||
onCommandTemplateChange: (value: string) => void
|
||||
onSaveLaunchRecipeChange: (value: boolean) => void
|
||||
onSaveAgentDefaultChange: (value: string) => void
|
||||
handleStart: () => Promise<void>
|
||||
}
|
||||
|
||||
+5
-2
@@ -33,13 +33,16 @@ export function buildSourceControlAgentSaveTargets(repoId?: string | null): {
|
||||
value: 'repo',
|
||||
label: translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialog.808cfe0a3b',
|
||||
'Save for this repository only'
|
||||
'This repository'
|
||||
)
|
||||
})
|
||||
}
|
||||
targets.push({
|
||||
value: 'global',
|
||||
label: repoId ? 'Save as default for all repositories' : 'Save as global default'
|
||||
label: translate(
|
||||
'auto.components.right.sidebar.SourceControlAgentActionDialog.38b899cc02',
|
||||
'All repositories'
|
||||
)
|
||||
})
|
||||
return targets
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ export function useSourceControlAgentActionDialog({
|
||||
})
|
||||
const [isStarting, setIsStarting] = useState(false)
|
||||
const saveTargets = useMemo(() => buildSourceControlAgentSaveTargets(repoId), [repoId])
|
||||
const [saveLaunchRecipe, setSaveLaunchRecipe] = useState(true)
|
||||
const [saveTargetValue, setSaveTargetValue] = useState(DEFAULT_SAVE_TARGET_VALUE)
|
||||
|
||||
const disabledAgents = settings?.disabledTuiAgents
|
||||
@@ -86,6 +87,7 @@ export function useSourceControlAgentActionDialog({
|
||||
setCommandTemplate(savedCommandInputTemplate ?? '{basePrompt}')
|
||||
setAgentArgs(savedAgentArgs ?? '')
|
||||
setSelectedAgent(savedAgentId ?? null)
|
||||
setSaveLaunchRecipe(true)
|
||||
setSaveTargetValue(DEFAULT_SAVE_TARGET_VALUE)
|
||||
let stale = false
|
||||
void refreshDetectedAgents().then((nextAgents) => {
|
||||
@@ -121,6 +123,7 @@ export function useSourceControlAgentActionDialog({
|
||||
(nextOpen: boolean) => {
|
||||
if (!nextOpen) {
|
||||
setDeliveryPlan({ status: 'idle' })
|
||||
setSaveLaunchRecipe(true)
|
||||
setSaveTargetValue(DEFAULT_SAVE_TARGET_VALUE)
|
||||
}
|
||||
onOpenChange(nextOpen)
|
||||
@@ -202,7 +205,7 @@ export function useSourceControlAgentActionDialog({
|
||||
trimmedCommandInput,
|
||||
agentArgs,
|
||||
commandTemplate,
|
||||
saveTargetValue,
|
||||
saveTargetValue: saveLaunchRecipe ? saveTargetValue : 'none',
|
||||
actionId,
|
||||
repoId,
|
||||
settings,
|
||||
@@ -238,6 +241,7 @@ export function useSourceControlAgentActionDialog({
|
||||
refreshDetectedAgents,
|
||||
repo,
|
||||
repoId,
|
||||
saveLaunchRecipe,
|
||||
saveTargetValue,
|
||||
settings,
|
||||
selectedAgent,
|
||||
@@ -265,6 +269,10 @@ export function useSourceControlAgentActionDialog({
|
||||
setCommandTemplate(value)
|
||||
setDeliveryPlan({ status: 'idle' })
|
||||
}, [])
|
||||
const onSaveLaunchRecipeChange = useCallback((value: boolean) => {
|
||||
setSaveLaunchRecipe(value)
|
||||
setDeliveryPlan({ status: 'idle' })
|
||||
}, [])
|
||||
|
||||
return {
|
||||
handleOpenChange,
|
||||
@@ -275,6 +283,7 @@ export function useSourceControlAgentActionDialog({
|
||||
statusCopy,
|
||||
agentArgs,
|
||||
commandTemplate,
|
||||
saveLaunchRecipe,
|
||||
saveTargetValue,
|
||||
saveTargets,
|
||||
settings,
|
||||
@@ -285,6 +294,7 @@ export function useSourceControlAgentActionDialog({
|
||||
onSelectedAgentChange,
|
||||
onAgentArgsChange,
|
||||
onCommandTemplateChange,
|
||||
onSaveLaunchRecipeChange,
|
||||
onSaveAgentDefaultChange: setSaveTargetValue,
|
||||
handleStart
|
||||
}
|
||||
|
||||
@@ -1034,7 +1034,7 @@
|
||||
"3912daf310": "This pull request has no reported checks yet.",
|
||||
"45877f5089": "No checks found",
|
||||
"85e62c5266": "Started an AI agent for the broken checks.",
|
||||
"ddfd42f460": "Choose the agent and edit the full command input before launch.",
|
||||
"ddfd42f460": "Review the prompt before starting an agent.",
|
||||
"a053bdd082": "Fix Broken Checks With AI",
|
||||
"1b14d0a69c": "Open in GitHub",
|
||||
"1550675e5f": "No inline output is available for this check.",
|
||||
@@ -7159,7 +7159,7 @@
|
||||
"b5dd73a105": "Select a workspace to view checks",
|
||||
"a4ef4e0832": "No workspace selected",
|
||||
"5594400d73": "No broken checks to fix.",
|
||||
"abf59262fb": "Review and edit the full command input before starting an agent.",
|
||||
"abf59262fb": "Review the prompt before starting an agent.",
|
||||
"4ede779461": "Resolve Review Conflicts With AI",
|
||||
"3b203c62f8": "This will permanently remove the comment from the PR.",
|
||||
"ea9b649ce3": "Delete comment?",
|
||||
@@ -7401,7 +7401,7 @@
|
||||
"37a81f29ad": "Generating commit message. Click to stop.",
|
||||
"b94112eb9e": "Commit message",
|
||||
"0d0a8359d3": "Message",
|
||||
"15b7f210d7": "Choose the agent and edit the full command input before launch.",
|
||||
"15b7f210d7": "Review the prompt before starting an agent.",
|
||||
"054ead86b1": "Fix Commit Failure With AI",
|
||||
"9e5ccd00aa": "Commit failure context unavailable",
|
||||
"f0a2dc9e46": "Customize launch...",
|
||||
@@ -7428,7 +7428,7 @@
|
||||
"1a6a6e0bc5": "Generate Hosted Review Details",
|
||||
"6b122529d4": "Generate Commit Message",
|
||||
"e48caaf0dd": "Started an AI agent for the conflicts.",
|
||||
"901140f47d": "Review and edit the full command input before starting an agent.",
|
||||
"901140f47d": "Review the prompt before starting an agent.",
|
||||
"19652ddd76": "Resolve Conflicts With AI",
|
||||
"c9ad22888e": "Pick the branch compare target for this repository.",
|
||||
"574d2f4413": "Clear Notes",
|
||||
@@ -7506,14 +7506,22 @@
|
||||
"SourceControlAgentActionDialog": {
|
||||
"8e856842d1": "Could not start the selected agent.",
|
||||
"c075d00de1": "Unable to resolve the workspace connection.",
|
||||
"808cfe0a3b": "Save for this repository only",
|
||||
"38b899cc02": "All repositories",
|
||||
"808cfe0a3b": "This repository",
|
||||
"994cddd1f7": "Don't save"
|
||||
},
|
||||
"SourceControlAgentActionDialogForm": {
|
||||
"1bc0bdbb5e": "Launch:",
|
||||
"f84657c925": "Save launch recipe",
|
||||
"013c9ac04a": "Save for",
|
||||
"1bb611240f": "Use {basePrompt} for Orca's default prompt.",
|
||||
"23280cbab1": "This template does not include {basePrompt}, so the agent will not receive Orca's default prompt.",
|
||||
"5421a96acb": "Save & start agent",
|
||||
"6cefcdfba1": "You can change it later in Source Control AI settings.",
|
||||
"c29f9cf266": "Save this prompt and don't show this review next time",
|
||||
"d8f40128ee": "{basePrompt} is Orca's default prompt.",
|
||||
"ea4788705e": "Cancel",
|
||||
"7ec6abbf2a": "Reset",
|
||||
"f4f3c9ca4a": "Command template",
|
||||
"f4f3c9ca4a": "Prompt template",
|
||||
"1bc0bdbb5e": "Launch:",
|
||||
"fe119187bb": "--model sonnet",
|
||||
"bc8dc39f4b": "CLI arguments",
|
||||
"b99c33cec5": "Settings",
|
||||
|
||||
Reference in New Issue
Block a user