Change one handler with an explicit AI scope
Use Ask, Explain, Build, Fix and Review on a disposable greeting app, with complete expected code and recovery checks.
Step 1Open the known-good project#
Download the complete first-app project. Extract it separately and open HelloForms.mcbproj. Run Check, then Run. Ada must produce Hello, Ada; blank input must produce Enter a name. Stop the running app and save a baseline.
Step 2Configure review before applying#
Configure a working provider in AI Provider Settings. Set Apply AI changes to Ask me first and leave automatic plugin/migration approval off. Open AI Chat with Shift–Command–L. In Code, place the insertion point inside cmdGreet_Click, then Control-click and choose Add Procedure to Chat. Inspect the target-marked chip and Show exact content.
Step 3Ask and explain without editing#
/ask Which event starts the greeting in this project?
/explain Explain the empty-input guard in the scoped procedure. Do not change it.Keep the persistent mode in Build and use these one-message commands. Check the sent tags. Read the response and verify the source is unchanged.
Step 4Request one exact behavioral change#
/build In cmdGreet_Click only, change the nonempty greeting from "Hello, " to "Welcome, ". Keep trimming and the empty-input guard unchanged. Do not change the layout, another procedure, a dependency or any other file.Answer any clarification directly. If a permission card requests unrelated targets, choose No. Do not approve a whole-document rewrite merely to make the exercise proceed.
Step 5Compare the complete handler before Apply#
Private Sub cmdGreet_Click()
Dim name As String
name = Trim$(txtName.Text)
If Len(name) = 0 Then
lblGreeting.Caption = "Enter a name."
Exit Sub
End If
lblGreeting.Caption = "Welcome, " & name
End SubThe only behavioral edit is the nonempty greeting string. Preserve cmdDetails_Click and the rest of the Form. In the full document, confirm that End Sub and the next Private Sub are on separate lines. Build 823 restores a missing trailing line break during a procedure replacement; it does not excuse other syntax errors. Discard the first proposal to practice rejection, confirm the baseline remains, then resend and apply only a matching checked change.
Step 6Run the acceptance cases and exercise Undo#
| Input | Expected caption |
|---|---|
| Ada | Welcome, Ada |
| Ada | Welcome, Ada |
| Empty or only spaces | Enter a name. |
Run each case. Also open Details with the existing Details button and confirm its unchanged handler still works. Stop the app, undo the applied change, and confirm the old Hello, Ada behavior returns. Redo only after reviewing it. Save the accepted version.
Step 7Practice diagnostic repair and selected review#
In the disposable copy only, change Len(name) to Len(missingName) and run Check. Send /fix Restore the empty-name test using the existing local variable name; change only the scoped procedure. Compare the repaired candidate with the complete handler above before applying. Next send /review Review the scoped greeting for input-validation defects; do not change anything yet. Read any findings; tick only a correction you actually want and use Apply selected. A clean review need not invent a finding.
20f4bfed6b · Build manifestSources & maintenance
Original web explanation, reviewed against these repository sources. API tables and example files follow the implementation.
docs/manual/16-working-with-the-ai-assistant.mdsamples/HelloForms.mcbproj/Forms/frmMain.bassrc/McBasic.Build/AiChatRequest.cssrc/McBasic.Build/AiScope.cssrc/McBasic.Build/ProcedurePatchValidationService.csmacos/McBasicIDE/Sources/AIContextRecipe.swiftmacos/McBasicIDE/Sources/AIProviderController.swift