CodeModificationEngine class
Central engine orchestrating AI-Assisted Controlled Code Modification.
Workflow:
- AI analyzes requirement and workspace context
- Creates modification plan
- Shows affected files & checks allowlists/denylists/limits
- Generates proposed patch with unified diffs
- Validates patch structure
- Runs test verification
- Runs analyzer check
- Runs formatter
- Produces change report & requires explicit approval before application
- Supports clean automatic rollback
Invariant: NEVER allow unrestricted "AI edit the entire repository" behavior.
Constructors
- CodeModificationEngine({required String projectRoot, required ProjectContextEngine contextEngine, required AssistantEngine assistantEngine, String? backupDir})
- CodeModificationEngine.withProvider({required String projectRoot, required AiProvider provider, AssistantConfiguration? configuration, String? backupDir})
-
Convenience factory constructing engine with an AiProvider.
factory
Properties
- backupDir → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- projectRoot → String
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
applyModification(
{required CodeModificationProposal proposal, bool explicitApproval = false}) → Future< CodeModificationApplyResult> -
Applies an approved
proposalto the project workspace with automatic backup creation for rollback. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
proposeModification(
CodeModificationPlanRequest request, {DateTime? executionTimestamp}) → Future< CodeModificationProposal> -
Synthesizes and validates a controlled code modification proposal for
request. -
rollbackModification(
{required String proposalId}) → Future< CodeModificationApplyResult> - Rolls back a previously applied proposal using its preserved backup.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited