Line

You are reading the unreleased docs (next). See latest (v0.9)

ui/client/features/pages-editor/hooks/useQuickFix

Cockpit client (features), next. Source: ui/client/features/pages-editor/hooks/useQuickFix.tsx.

Functions#

useQuickFix()#

useQuickFix(feature, file, draft, onApply): object

Defined in: ui/client/features/pages-editor/hooks/useQuickFix.tsx:13

— Mechanical (the rule's own deterministic transform) or AI (a model call scoped to the one violation), previewed as a reviewable diff before it is applied to the editor's draft. Never writes to disk itself — applying a fix only replaces the in-memory buffer the caller already owns.

Parameters#

feature

string

file

string

draft

string

onApply

(fixed) => void

Returns#

object

active

active: boolean

busy

busy: boolean

closeMenu

closeMenu: () => void

Returns

void

confirm

confirm: () => void

Returns

void

error

error: string | null

fixedSource

fixedSource: string | null

hunks

hunks: DiffHunk[]

mode

mode: QuickFixMode | null

openMenu

openMenu: (diagnostic) => void

Parameters
diagnostic

SourceDiagnostic

Returns

void

requestFix

requestFix: (nextMode) => Promise<void>

Parameters
nextMode

QuickFixMode

Returns

Promise<void>

rule

rule: string | null