1Your task is to map a step from the conversation above to operations on symbols inside the provided source files.
2
3Guidelines:
4- There's no need to describe *what* to do, just *where* to do it.
5- If creating a file, assume any subsequent updates are included at the time of creation.
6- Don't create and then update a file.
7- We'll create it in one shot.
8- Prefer updating symbols lower in the syntax tree if possible.
9- Never include operations on a parent symbol and one of its children in the same <operations> block.
10- Never nest an operation with another operation or include CDATA or other content. All operations are leaf nodes.
11- Include a description attribute for each operation with a brief, one-line description of the change to perform.
12- Descriptions are required for all operations except delete.
13- When generating multiple operations, ensure the descriptions are specific to each individual operation.
14- Avoid referring to the location in the description. Focus on the change to be made, not the location where it's made. That's implicit with the symbol you provide.
15- Don't generate multiple operations at the same location. Instead, combine them together in a single operation with a succinct combined description.
16
17The available operation types are:
18
191. <update>: Modify an existing symbol in a file.
202. <create_file>: Create a new file.
213. <insert_sibling_after>: Add a new symbol as sibling after an existing symbol in a file.
224. <append_child>: Add a new symbol as the last child of an existing symbol in a file.
235. <prepend_child>: Add a new symbol as the first child of an existing symbol in a file.
246. <delete>: Remove an existing symbol from a file. The `description` attribute is invalid for delete, but required for other ops.
25
26All operations *require* a path.
27Operations that *require* a symbol: <update>, <insert_sibling_after>, <delete>
28Operations that don't allow a symbol: <create>
29Operations that have an *optional* symbol: <prepend_child>, <append_child>
30
31Example 1:
32
33User:
34 ```rs src/rectangle.rs
35 struct Rectangle {
36 width: f64,
37 height: f64,
38 }
39
40 impl Rectangle {
41 fn new(width: f64, height: f64) -> Self {
42 Rectangle { width, height }
43 }
44 }
45 ```
46
47 Symbols for src/rectangle.rs:
48 - struct Rectangle
49 - impl Rectangle
50 - impl Rectangle fn new
51
52 <step>Add new methods 'calculate_area' and 'calculate_perimeter' to the Rectangle struct</step>
53 <step>Implement the 'Display' trait for the Rectangle struct</step>
54
55 What are the operations for the step: <step>Add a new method 'calculate_area' to the Rectangle struct</step>
56
57Assistant (wrong):
58<operations>
59 <append_child path="src/shapes.rs" symbol="impl Rectangle" description="Add calculate_area method" />
60 <append_child path="src/shapes.rs" symbol="impl Rectangle" description="Add calculate_perimeter method" />
61</operations>
62
63This demonstrates what NOT to do. NEVER append multiple children at the same location.
64
65Assistant (corrected):
66<operations>
67 <append_child path="src/shapes.rs" symbol="impl Rectangle" description="Add calculate area and perimeter methods" />
68</operations>
69
70User:
71What are the operations for the step: <step>Implement the 'Display' trait for the Rectangle struct</step>
72
73Assistant:
74<operations>
75 <insert_sibling_after path="src/shapes.rs" symbol="impl Rectangle" description="Implement Display trait for Rectangle"/>
76</operations>
77
78Example 2:
79
80User:
81```rs src/user.rs
82struct User {
83 pub name: String,
84 age: u32,
85 email: String,
86}
87
88impl User {
89 fn new(name: String, age: u32, email: String) -> Self {
90 User { name, age, email }
91 }
92
93 pub fn print_info(&self) {
94 println!("Name: {}, Age: {}, Email: {}", self.name, self.age, self.email);
95 }
96}
97```
98
99Symbols for src/user.rs:
100- struct User
101- struct User pub name
102- struct User age
103- struct User email
104- impl User
105- impl User fn new
106- impl User pub fn print_info
107
108<step>Update the 'print_info' method to use formatted output</step>
109<step>Remove the 'email' field from the User struct</step>
110
111What are the operations for the step: <step>Update the 'print_info' method to use formatted output</step>
112
113Assistant:
114<operations>
115 <update path="src/user.rs" symbol="impl User fn print_info" description="Use formatted output" />
116</operations>
117
118User:
119What are the operations for the step: <step>Remove the 'email' field from the User struct</step>
120
121Assistant:
122<operations>
123 <delete path="src/user.rs" symbol="struct User email" description="Remove the email field" />
124</operations>
125
126Example 3:
127
128User:
129```rs src/vehicle.rs
130struct Vehicle {
131 make: String,
132 model: String,
133 year: u32,
134}
135
136impl Vehicle {
137 fn new(make: String, model: String, year: u32) -> Self {
138 Vehicle { make, model, year }
139 }
140
141 fn print_year(&self) {
142 println!("Year: {}", self.year);
143 }
144}
145```
146
147Symbols for src/vehicle.rs:
148- struct Vehicle
149- struct Vehicle make
150- struct Vehicle model
151- struct Vehicle year
152- impl Vehicle
153- impl Vehicle fn new
154- impl Vehicle fn print_year
155
156<step>Add a 'use std::fmt;' statement at the beginning of the file</step>
157<step>Add a new method 'start_engine' in the Vehicle impl block</step>
158
159What are the operations for the step: <step>Add a 'use std::fmt;' statement at the beginning of the file</step>
160
161Assistant:
162<operations>
163 <prepend_child path="src/vehicle.rs" description="Add 'use std::fmt' statement" />
164</operations>
165
166User:
167What are the operations for the step: <step>Add a new method 'start_engine' in the Vehicle impl block</step>
168
169Assistant:
170<operations>
171 <insert_sibling_after path="src/vehicle.rs" symbol="impl Vehicle fn new" description="Add start_engine method"/>
172</operations>
173
174Example 4:
175
176User:
177```rs src/employee.rs
178struct Employee {
179 name: String,
180 position: String,
181 salary: u32,
182 department: String,
183}
184
185impl Employee {
186 fn new(name: String, position: String, salary: u32, department: String) -> Self {
187 Employee { name, position, salary, department }
188 }
189
190 fn print_details(&self) {
191 println!("Name: {}, Position: {}, Salary: {}, Department: {}",
192 self.name, self.position, self.salary, self.department);
193 }
194
195 fn give_raise(&mut self, amount: u32) {
196 self.salary += amount;
197 }
198}
199```
200
201Symbols for src/employee.rs:
202- struct Employee
203- struct Employee name
204- struct Employee position
205- struct Employee salary
206- struct Employee department
207- impl Employee
208- impl Employee fn new
209- impl Employee fn print_details
210- impl Employee fn give_raise
211
212<step>Make salary an f32</step>
213
214What are the operations for the step: <step>Make salary an f32</step>
215
216A (wrong):
217 <operations>
218 <update path="src/employee.rs" symbol="struct Employee" description="Change the type of salary to an f32" />
219 <update path="src/employee.rs" symbol="struct Employee salary" description="Change the type to an f32" />
220 </operations>
221
222This example demonstrates what not to do. `struct Employee salary` is a child of `struct Employee`.
223
224A (corrected):
225 <operations>
226 <update path="src/employee.rs" symbol="struct Employee salary" description="Change the type to an f32" />
227 </operations>
228
229User:
230 What are the correct operations for the step: <step>Remove the 'department' field and update the 'print_details' method</step>
231
232A:
233 <operations>
234 <delete path="src/employee.rs" symbol="struct Employee department" />
235 <update path="src/employee.rs" symbol="impl Employee fn print_details" description="Don't print the 'department' field" />
236 </operations>
237
238Now generate the operations for the following step.
239Output only valid XML containing valid operations with their required attributes.
240NEVER output code or any other text inside <operation> tags. If you do, you will replaced with another model.
241Your response *MUST* begin with <operations> and end with </operations>: