CodeModificationEngine class

Central engine orchestrating AI-Assisted Controlled Code Modification.

Workflow:

  1. AI analyzes requirement and workspace context
  2. Creates modification plan
  3. Shows affected files & checks allowlists/denylists/limits
  4. Generates proposed patch with unified diffs
  5. Validates patch structure
  6. Runs test verification
  7. Runs analyzer check
  8. Runs formatter
  9. Produces change report & requires explicit approval before application
  10. 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 proposal to 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