execdiff 0.0.5__tar.gz → 0.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execdiff
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Passive execution tracing for file and package changes.
5
5
  Author-email: Anup Moncy <n93181165@gmail.com>
6
6
  License: Apache License
@@ -217,61 +217,56 @@ Description-Content-Type: text/markdown
217
217
  License-File: LICENSE
218
218
  Dynamic: license-file
219
219
 
220
- # ExecDiff
220
+ # Monitor AI Tool Workspace Changes
221
221
 
222
- See what AI-generated code will change before running it.
222
+ AI coding tools like GitHub Copilot, Cursor, Replit AI, and agentic workflows install dependencies, modify configurations, and run setup commands in a project workspace.
223
223
 
224
- ---
224
+ ## Tracking Changes Beyond Git
225
225
 
226
- ## Problem
226
+ If GitHub Copilot implements a feature like API integration, it may:
227
227
 
228
- AI coding tools and agents today can:
228
+ - Generate code.
229
+ - Install libraries via the terminal.
230
+ - Modify configuration files.
231
+ - Create output files.
229
232
 
230
- - install dependencies
231
- - create files
232
- - modify configs
233
- - run migrations
234
- - delete project files
233
+ But when something breaks after execution, Git only shows code changes — not:
235
234
 
236
- All automatically.
235
+ - newly installed packages
236
+ - runtime-created files
237
+ - deleted files
238
+ - config updates done during execution
237
239
 
238
- When something breaks after execution, tools cannot answer:
240
+ So it’s hard to tell what actually changed after an AI copilot action.
239
241
 
240
- > What exactly changed because of this action?
242
+ Here’s how to capture everything automatically using VS Code (or any IDE with a terminal).
241
243
 
242
- Git tracks source code changes —
243
- but it does **not** track execution side effects like:
244
+ ---
244
245
 
245
- - newly installed Python packages
246
- - runtime-created files
247
- - deleted files
248
- - modified configs
246
+ ## Step 1: Open Your Project in Your IDE
249
247
 
250
- So tools often fall back to:
248
+ Open your project folder in VS Code (or any IDE).
251
249
 
252
- > regenerate and try again
250
+ Now open the integrated terminal: **Terminal → New Terminal**
253
251
 
254
252
  ---
255
253
 
256
- ## Solution
257
-
258
- ExecDiff allows tools to run AI-generated code and observe:
254
+ ## Step 2 (Optional): Create a Project-Level Python Environment
259
255
 
260
- > what changed in the workspace because of that execution
256
+ If you want installs isolated to this project:
261
257
 
262
- It detects:
263
-
264
- - files created
265
- - files modified
266
- - files deleted
267
- - Python packages installed
258
+ ```bash
259
+ python3 -m venv venv
260
+ source venv/bin/activate
261
+ ```
268
262
 
269
- inside a specific workspace
270
- during a specific execution window.
263
+ Otherwise, you can skip this step.
271
264
 
272
265
  ---
273
266
 
274
- ## Installation
267
+ ## Step 3: Install ExecDiff from Terminal
268
+
269
+ Run this inside the terminal:
275
270
 
276
271
  ```bash
277
272
  pip install execdiff
@@ -279,134 +274,106 @@ pip install execdiff
279
274
 
280
275
  ---
281
276
 
282
- ## Example
277
+ ## Step 4: Start Tracing Before Using Your AI Copilot
283
278
 
284
- Create a test script:
279
+ Create a new Python file in your project: `trace_ai.py` with the code below
285
280
 
286
281
  ```python
287
282
  import execdiff
288
- import json
289
- import os
283
+ import time
284
+
285
+ print("\nStarting AI action trace...\n")
286
+ execdiff.start_action_trace(workspace=".")
290
287
 
291
- os.makedirs("workspace", exist_ok=True)
288
+ input("Tracing is ON. Use your AI copilot now.\n\nPress ENTER here once it's done...")
292
289
 
293
- diff = execdiff.run_traced(
294
- "touch workspace/test.txt",
295
- workspace="workspace"
296
- )
290
+ print("\nStopping trace...\n")
291
+ execdiff.stop_action_trace()
297
292
 
298
- print(json.dumps(diff, indent=2))
293
+ print("\nSummary of last AI action:\n")
294
+ print(execdiff.last_action_summary())
299
295
  ```
300
296
 
301
- Run:
297
+ Now run this from the terminal:
302
298
 
303
299
  ```bash
304
- python test.py
300
+ python trace_ai.py
305
301
  ```
306
302
 
303
+ Tracing has now started and you’ll see:
304
+
305
+ ```
306
+ Starting AI action trace...
307
+
308
+ Tracing is ON. Use your AI copilot now.
309
+ Press ENTER here once it's done...
310
+ ```
311
+
312
+ Leave this terminal running.
313
+
307
314
  ---
308
315
 
309
- ## API Reference
316
+ ## Step 5: Use Your AI Copilot Normally
310
317
 
311
- ### `start_action_trace(workspace=".")`
318
+ Now continue development normally inside your IDE using any AI copilot.
312
319
 
313
- Start tracing a workspace for changes. Must be called before any operations.
320
+ For example, ask:
314
321
 
315
- ```python
316
- import execdiff
322
+ > “Create a new feature for loading hello world into a pandas data frame and displaying it. Install the required libraries”
317
323
 
318
- execdiff.start_action_trace(workspace="./my_workspace")
319
- # ... your code that makes changes ...
320
- ```
324
+ Your copilot may now:
321
325
 
322
- ### `stop_action_trace()`
326
+ - generate new code
327
+ - install dependencies
328
+ - modify config files
329
+ - create or delete files
323
330
 
324
- Stop tracing and return a diff of all changes detected. Automatically logs to `.execdiff/logs/actions.jsonl`.
331
+ inside your project workspace.
325
332
 
326
- ```python
327
- diff = execdiff.stop_action_trace()
328
- # Returns: {"files": {...}, "packages": {...}}
329
- ```
333
+ You don’t need to change anything in your workflow.
330
334
 
331
- ### `last_action_summary(workspace=".")`
335
+ Just let your AI copilot run whatever setup it needs internally.
332
336
 
333
- Get a human-readable summary of the last action trace without parsing JSON.
337
+ ---
334
338
 
335
- ```python
336
- summary = execdiff.last_action_summary(workspace=".")
337
- print(summary)
338
- ```
339
+ ## Step 6: Stop the Trace
339
340
 
340
- Output example:
341
- ```
342
- Last AI Action:
341
+ Once it’s done, come back to terminal and press Enter
342
+
343
+ You’ll get:
343
344
 
345
+ ```
346
+ Summary of last AI action:
344
347
  Created:
345
348
  - output.txt
346
349
  - data.json
347
-
350
+ Modified:
351
+ - settings.py
348
352
  Installed:
349
353
  - requests==2.32.0
350
354
  ```
351
355
 
352
- ### `snapshot_workspace_state(workspace)`
356
+ This includes:
353
357
 
354
- Take a full metadata snapshot of the workspace (files with mtime/size, installed packages).
358
+ - filesystem changes
359
+ - installed packages
360
+ - deleted files
361
+ - execution-time config updates
355
362
 
356
- ```python
357
- state = execdiff.snapshot_workspace_state(workspace=".")
358
- # Returns: {"files": {...}, "packages": {...}}
359
- ```
363
+ All changes made during runtime.
360
364
 
361
365
  ---
362
366
 
363
- ## Output Format
364
-
365
- ### Diff Structure
366
-
367
- ```json
368
- {
369
- "files": {
370
- "created": [{"path": "file.txt", "mtime": 123.45, "size": 1024}],
371
- "modified": [{"path": "config.yaml", "before_mtime": 123, "after_mtime": 124, "before_size": 512, "after_size": 1024}],
372
- "deleted": [{"path": "old_file.txt", "mtime": 123.45, "size": 256}]
373
- },
374
- "packages": {
375
- "installed": [{"name": "requests", "version": "2.32.0"}],
376
- "upgraded": [{"name": "django", "before_version": "3.2", "after_version": "4.0"}],
377
- "removed": [{"name": "deprecated_lib", "version": "1.0"}]
378
- }
379
- }
380
- ```
381
-
382
- ### Log File
367
+ ## Automatic Logs
383
368
 
384
- All action traces are automatically persisted to `.execdiff/logs/actions.jsonl`:
369
+ Each AI-driven action is also stored inside:
385
370
 
386
- ```json
387
- {
388
- "timestamp": "2026-02-18T18:19:35.872838",
389
- "workspace": "/path/to/workspace",
390
- "diff": {...}
391
- }
371
+ ```
372
+ .execdiff/logs/actions.jsonl
392
373
  ```
393
374
 
394
- ---
395
-
396
- ## Use Cases
397
-
398
- ExecDiff can help AI coding tools:
399
-
400
- - preview changes before applying generated code
401
- - detect unintended file or dependency changes
402
- - explain execution impact to users
403
- - debug failed automation
404
- - build undo / rollback systems
375
+ Now get a running history of what changed in your project after every AI action.
405
376
 
406
377
  ---
407
378
 
408
- ## License
409
-
410
- MIT
411
-
412
- ````
379
+ You can now continue using any AI copilot inside VS Code (or any IDE) normally while ExecDiff captures everything it changes behind the scenes.
@@ -0,0 +1,160 @@
1
+ # Monitor AI Tool Workspace Changes
2
+
3
+ AI coding tools like GitHub Copilot, Cursor, Replit AI, and agentic workflows install dependencies, modify configurations, and run setup commands in a project workspace.
4
+
5
+ ## Tracking Changes Beyond Git
6
+
7
+ If GitHub Copilot implements a feature like API integration, it may:
8
+
9
+ - Generate code.
10
+ - Install libraries via the terminal.
11
+ - Modify configuration files.
12
+ - Create output files.
13
+
14
+ But when something breaks after execution, Git only shows code changes — not:
15
+
16
+ - newly installed packages
17
+ - runtime-created files
18
+ - deleted files
19
+ - config updates done during execution
20
+
21
+ So it’s hard to tell what actually changed after an AI copilot action.
22
+
23
+ Here’s how to capture everything automatically using VS Code (or any IDE with a terminal).
24
+
25
+ ---
26
+
27
+ ## Step 1: Open Your Project in Your IDE
28
+
29
+ Open your project folder in VS Code (or any IDE).
30
+
31
+ Now open the integrated terminal: **Terminal → New Terminal**
32
+
33
+ ---
34
+
35
+ ## Step 2 (Optional): Create a Project-Level Python Environment
36
+
37
+ If you want installs isolated to this project:
38
+
39
+ ```bash
40
+ python3 -m venv venv
41
+ source venv/bin/activate
42
+ ```
43
+
44
+ Otherwise, you can skip this step.
45
+
46
+ ---
47
+
48
+ ## Step 3: Install ExecDiff from Terminal
49
+
50
+ Run this inside the terminal:
51
+
52
+ ```bash
53
+ pip install execdiff
54
+ ```
55
+
56
+ ---
57
+
58
+ ## Step 4: Start Tracing Before Using Your AI Copilot
59
+
60
+ Create a new Python file in your project: `trace_ai.py` with the code below
61
+
62
+ ```python
63
+ import execdiff
64
+ import time
65
+
66
+ print("\nStarting AI action trace...\n")
67
+ execdiff.start_action_trace(workspace=".")
68
+
69
+ input("Tracing is ON. Use your AI copilot now.\n\nPress ENTER here once it's done...")
70
+
71
+ print("\nStopping trace...\n")
72
+ execdiff.stop_action_trace()
73
+
74
+ print("\nSummary of last AI action:\n")
75
+ print(execdiff.last_action_summary())
76
+ ```
77
+
78
+ Now run this from the terminal:
79
+
80
+ ```bash
81
+ python trace_ai.py
82
+ ```
83
+
84
+ Tracing has now started and you’ll see:
85
+
86
+ ```
87
+ Starting AI action trace...
88
+
89
+ Tracing is ON. Use your AI copilot now.
90
+ Press ENTER here once it's done...
91
+ ```
92
+
93
+ Leave this terminal running.
94
+
95
+ ---
96
+
97
+ ## Step 5: Use Your AI Copilot Normally
98
+
99
+ Now continue development normally inside your IDE using any AI copilot.
100
+
101
+ For example, ask:
102
+
103
+ > “Create a new feature for loading hello world into a pandas data frame and displaying it. Install the required libraries”
104
+
105
+ Your copilot may now:
106
+
107
+ - generate new code
108
+ - install dependencies
109
+ - modify config files
110
+ - create or delete files
111
+
112
+ inside your project workspace.
113
+
114
+ You don’t need to change anything in your workflow.
115
+
116
+ Just let your AI copilot run whatever setup it needs internally.
117
+
118
+ ---
119
+
120
+ ## Step 6: Stop the Trace
121
+
122
+ Once it’s done, come back to terminal and press Enter
123
+
124
+ You’ll get:
125
+
126
+ ```
127
+ Summary of last AI action:
128
+ Created:
129
+ - output.txt
130
+ - data.json
131
+ Modified:
132
+ - settings.py
133
+ Installed:
134
+ - requests==2.32.0
135
+ ```
136
+
137
+ This includes:
138
+
139
+ - filesystem changes
140
+ - installed packages
141
+ - deleted files
142
+ - execution-time config updates
143
+
144
+ All changes made during runtime.
145
+
146
+ ---
147
+
148
+ ## Automatic Logs
149
+
150
+ Each AI-driven action is also stored inside:
151
+
152
+ ```
153
+ .execdiff/logs/actions.jsonl
154
+ ```
155
+
156
+ Now get a running history of what changed in your project after every AI action.
157
+
158
+ ---
159
+
160
+ You can now continue using any AI copilot inside VS Code (or any IDE) normally while ExecDiff captures everything it changes behind the scenes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execdiff
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Passive execution tracing for file and package changes.
5
5
  Author-email: Anup Moncy <n93181165@gmail.com>
6
6
  License: Apache License
@@ -217,61 +217,56 @@ Description-Content-Type: text/markdown
217
217
  License-File: LICENSE
218
218
  Dynamic: license-file
219
219
 
220
- # ExecDiff
220
+ # Monitor AI Tool Workspace Changes
221
221
 
222
- See what AI-generated code will change before running it.
222
+ AI coding tools like GitHub Copilot, Cursor, Replit AI, and agentic workflows install dependencies, modify configurations, and run setup commands in a project workspace.
223
223
 
224
- ---
224
+ ## Tracking Changes Beyond Git
225
225
 
226
- ## Problem
226
+ If GitHub Copilot implements a feature like API integration, it may:
227
227
 
228
- AI coding tools and agents today can:
228
+ - Generate code.
229
+ - Install libraries via the terminal.
230
+ - Modify configuration files.
231
+ - Create output files.
229
232
 
230
- - install dependencies
231
- - create files
232
- - modify configs
233
- - run migrations
234
- - delete project files
233
+ But when something breaks after execution, Git only shows code changes — not:
235
234
 
236
- All automatically.
235
+ - newly installed packages
236
+ - runtime-created files
237
+ - deleted files
238
+ - config updates done during execution
237
239
 
238
- When something breaks after execution, tools cannot answer:
240
+ So it’s hard to tell what actually changed after an AI copilot action.
239
241
 
240
- > What exactly changed because of this action?
242
+ Here’s how to capture everything automatically using VS Code (or any IDE with a terminal).
241
243
 
242
- Git tracks source code changes —
243
- but it does **not** track execution side effects like:
244
+ ---
244
245
 
245
- - newly installed Python packages
246
- - runtime-created files
247
- - deleted files
248
- - modified configs
246
+ ## Step 1: Open Your Project in Your IDE
249
247
 
250
- So tools often fall back to:
248
+ Open your project folder in VS Code (or any IDE).
251
249
 
252
- > regenerate and try again
250
+ Now open the integrated terminal: **Terminal → New Terminal**
253
251
 
254
252
  ---
255
253
 
256
- ## Solution
257
-
258
- ExecDiff allows tools to run AI-generated code and observe:
254
+ ## Step 2 (Optional): Create a Project-Level Python Environment
259
255
 
260
- > what changed in the workspace because of that execution
256
+ If you want installs isolated to this project:
261
257
 
262
- It detects:
263
-
264
- - files created
265
- - files modified
266
- - files deleted
267
- - Python packages installed
258
+ ```bash
259
+ python3 -m venv venv
260
+ source venv/bin/activate
261
+ ```
268
262
 
269
- inside a specific workspace
270
- during a specific execution window.
263
+ Otherwise, you can skip this step.
271
264
 
272
265
  ---
273
266
 
274
- ## Installation
267
+ ## Step 3: Install ExecDiff from Terminal
268
+
269
+ Run this inside the terminal:
275
270
 
276
271
  ```bash
277
272
  pip install execdiff
@@ -279,134 +274,106 @@ pip install execdiff
279
274
 
280
275
  ---
281
276
 
282
- ## Example
277
+ ## Step 4: Start Tracing Before Using Your AI Copilot
283
278
 
284
- Create a test script:
279
+ Create a new Python file in your project: `trace_ai.py` with the code below
285
280
 
286
281
  ```python
287
282
  import execdiff
288
- import json
289
- import os
283
+ import time
284
+
285
+ print("\nStarting AI action trace...\n")
286
+ execdiff.start_action_trace(workspace=".")
290
287
 
291
- os.makedirs("workspace", exist_ok=True)
288
+ input("Tracing is ON. Use your AI copilot now.\n\nPress ENTER here once it's done...")
292
289
 
293
- diff = execdiff.run_traced(
294
- "touch workspace/test.txt",
295
- workspace="workspace"
296
- )
290
+ print("\nStopping trace...\n")
291
+ execdiff.stop_action_trace()
297
292
 
298
- print(json.dumps(diff, indent=2))
293
+ print("\nSummary of last AI action:\n")
294
+ print(execdiff.last_action_summary())
299
295
  ```
300
296
 
301
- Run:
297
+ Now run this from the terminal:
302
298
 
303
299
  ```bash
304
- python test.py
300
+ python trace_ai.py
305
301
  ```
306
302
 
303
+ Tracing has now started and you’ll see:
304
+
305
+ ```
306
+ Starting AI action trace...
307
+
308
+ Tracing is ON. Use your AI copilot now.
309
+ Press ENTER here once it's done...
310
+ ```
311
+
312
+ Leave this terminal running.
313
+
307
314
  ---
308
315
 
309
- ## API Reference
316
+ ## Step 5: Use Your AI Copilot Normally
310
317
 
311
- ### `start_action_trace(workspace=".")`
318
+ Now continue development normally inside your IDE using any AI copilot.
312
319
 
313
- Start tracing a workspace for changes. Must be called before any operations.
320
+ For example, ask:
314
321
 
315
- ```python
316
- import execdiff
322
+ > “Create a new feature for loading hello world into a pandas data frame and displaying it. Install the required libraries”
317
323
 
318
- execdiff.start_action_trace(workspace="./my_workspace")
319
- # ... your code that makes changes ...
320
- ```
324
+ Your copilot may now:
321
325
 
322
- ### `stop_action_trace()`
326
+ - generate new code
327
+ - install dependencies
328
+ - modify config files
329
+ - create or delete files
323
330
 
324
- Stop tracing and return a diff of all changes detected. Automatically logs to `.execdiff/logs/actions.jsonl`.
331
+ inside your project workspace.
325
332
 
326
- ```python
327
- diff = execdiff.stop_action_trace()
328
- # Returns: {"files": {...}, "packages": {...}}
329
- ```
333
+ You don’t need to change anything in your workflow.
330
334
 
331
- ### `last_action_summary(workspace=".")`
335
+ Just let your AI copilot run whatever setup it needs internally.
332
336
 
333
- Get a human-readable summary of the last action trace without parsing JSON.
337
+ ---
334
338
 
335
- ```python
336
- summary = execdiff.last_action_summary(workspace=".")
337
- print(summary)
338
- ```
339
+ ## Step 6: Stop the Trace
339
340
 
340
- Output example:
341
- ```
342
- Last AI Action:
341
+ Once it’s done, come back to terminal and press Enter
342
+
343
+ You’ll get:
343
344
 
345
+ ```
346
+ Summary of last AI action:
344
347
  Created:
345
348
  - output.txt
346
349
  - data.json
347
-
350
+ Modified:
351
+ - settings.py
348
352
  Installed:
349
353
  - requests==2.32.0
350
354
  ```
351
355
 
352
- ### `snapshot_workspace_state(workspace)`
356
+ This includes:
353
357
 
354
- Take a full metadata snapshot of the workspace (files with mtime/size, installed packages).
358
+ - filesystem changes
359
+ - installed packages
360
+ - deleted files
361
+ - execution-time config updates
355
362
 
356
- ```python
357
- state = execdiff.snapshot_workspace_state(workspace=".")
358
- # Returns: {"files": {...}, "packages": {...}}
359
- ```
363
+ All changes made during runtime.
360
364
 
361
365
  ---
362
366
 
363
- ## Output Format
364
-
365
- ### Diff Structure
366
-
367
- ```json
368
- {
369
- "files": {
370
- "created": [{"path": "file.txt", "mtime": 123.45, "size": 1024}],
371
- "modified": [{"path": "config.yaml", "before_mtime": 123, "after_mtime": 124, "before_size": 512, "after_size": 1024}],
372
- "deleted": [{"path": "old_file.txt", "mtime": 123.45, "size": 256}]
373
- },
374
- "packages": {
375
- "installed": [{"name": "requests", "version": "2.32.0"}],
376
- "upgraded": [{"name": "django", "before_version": "3.2", "after_version": "4.0"}],
377
- "removed": [{"name": "deprecated_lib", "version": "1.0"}]
378
- }
379
- }
380
- ```
381
-
382
- ### Log File
367
+ ## Automatic Logs
383
368
 
384
- All action traces are automatically persisted to `.execdiff/logs/actions.jsonl`:
369
+ Each AI-driven action is also stored inside:
385
370
 
386
- ```json
387
- {
388
- "timestamp": "2026-02-18T18:19:35.872838",
389
- "workspace": "/path/to/workspace",
390
- "diff": {...}
391
- }
371
+ ```
372
+ .execdiff/logs/actions.jsonl
392
373
  ```
393
374
 
394
- ---
395
-
396
- ## Use Cases
397
-
398
- ExecDiff can help AI coding tools:
399
-
400
- - preview changes before applying generated code
401
- - detect unintended file or dependency changes
402
- - explain execution impact to users
403
- - debug failed automation
404
- - build undo / rollback systems
375
+ Now get a running history of what changed in your project after every AI action.
405
376
 
406
377
  ---
407
378
 
408
- ## License
409
-
410
- MIT
411
-
412
- ````
379
+ You can now continue using any AI copilot inside VS Code (or any IDE) normally while ExecDiff captures everything it changes behind the scenes.
@@ -5,4 +5,5 @@ execdiff/__init__.py
5
5
  execdiff.egg-info/PKG-INFO
6
6
  execdiff.egg-info/SOURCES.txt
7
7
  execdiff.egg-info/dependency_links.txt
8
+ execdiff.egg-info/entry_points.txt
8
9
  execdiff.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ execdiff = execdiff.cli:main
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "execdiff"
7
- version = "0.0.5"
7
+ version = "0.0.7"
8
8
  description = "Passive execution tracing for file and package changes."
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -23,6 +23,9 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3.12"
24
24
  ]
25
25
 
26
+ [project.scripts]
27
+ execdiff = "execdiff.cli:main"
28
+
26
29
  [tool.setuptools.packages.find]
27
30
  where = ["."]
28
31
  include = ["execdiff*"]
execdiff-0.0.5/README.md DELETED
@@ -1,193 +0,0 @@
1
- # ExecDiff
2
-
3
- See what AI-generated code will change before running it.
4
-
5
- ---
6
-
7
- ## Problem
8
-
9
- AI coding tools and agents today can:
10
-
11
- - install dependencies
12
- - create files
13
- - modify configs
14
- - run migrations
15
- - delete project files
16
-
17
- All automatically.
18
-
19
- When something breaks after execution, tools cannot answer:
20
-
21
- > What exactly changed because of this action?
22
-
23
- Git tracks source code changes —
24
- but it does **not** track execution side effects like:
25
-
26
- - newly installed Python packages
27
- - runtime-created files
28
- - deleted files
29
- - modified configs
30
-
31
- So tools often fall back to:
32
-
33
- > regenerate and try again
34
-
35
- ---
36
-
37
- ## Solution
38
-
39
- ExecDiff allows tools to run AI-generated code and observe:
40
-
41
- > what changed in the workspace because of that execution
42
-
43
- It detects:
44
-
45
- - files created
46
- - files modified
47
- - files deleted
48
- - Python packages installed
49
-
50
- inside a specific workspace
51
- during a specific execution window.
52
-
53
- ---
54
-
55
- ## Installation
56
-
57
- ```bash
58
- pip install execdiff
59
- ```
60
-
61
- ---
62
-
63
- ## Example
64
-
65
- Create a test script:
66
-
67
- ```python
68
- import execdiff
69
- import json
70
- import os
71
-
72
- os.makedirs("workspace", exist_ok=True)
73
-
74
- diff = execdiff.run_traced(
75
- "touch workspace/test.txt",
76
- workspace="workspace"
77
- )
78
-
79
- print(json.dumps(diff, indent=2))
80
- ```
81
-
82
- Run:
83
-
84
- ```bash
85
- python test.py
86
- ```
87
-
88
- ---
89
-
90
- ## API Reference
91
-
92
- ### `start_action_trace(workspace=".")`
93
-
94
- Start tracing a workspace for changes. Must be called before any operations.
95
-
96
- ```python
97
- import execdiff
98
-
99
- execdiff.start_action_trace(workspace="./my_workspace")
100
- # ... your code that makes changes ...
101
- ```
102
-
103
- ### `stop_action_trace()`
104
-
105
- Stop tracing and return a diff of all changes detected. Automatically logs to `.execdiff/logs/actions.jsonl`.
106
-
107
- ```python
108
- diff = execdiff.stop_action_trace()
109
- # Returns: {"files": {...}, "packages": {...}}
110
- ```
111
-
112
- ### `last_action_summary(workspace=".")`
113
-
114
- Get a human-readable summary of the last action trace without parsing JSON.
115
-
116
- ```python
117
- summary = execdiff.last_action_summary(workspace=".")
118
- print(summary)
119
- ```
120
-
121
- Output example:
122
- ```
123
- Last AI Action:
124
-
125
- Created:
126
- - output.txt
127
- - data.json
128
-
129
- Installed:
130
- - requests==2.32.0
131
- ```
132
-
133
- ### `snapshot_workspace_state(workspace)`
134
-
135
- Take a full metadata snapshot of the workspace (files with mtime/size, installed packages).
136
-
137
- ```python
138
- state = execdiff.snapshot_workspace_state(workspace=".")
139
- # Returns: {"files": {...}, "packages": {...}}
140
- ```
141
-
142
- ---
143
-
144
- ## Output Format
145
-
146
- ### Diff Structure
147
-
148
- ```json
149
- {
150
- "files": {
151
- "created": [{"path": "file.txt", "mtime": 123.45, "size": 1024}],
152
- "modified": [{"path": "config.yaml", "before_mtime": 123, "after_mtime": 124, "before_size": 512, "after_size": 1024}],
153
- "deleted": [{"path": "old_file.txt", "mtime": 123.45, "size": 256}]
154
- },
155
- "packages": {
156
- "installed": [{"name": "requests", "version": "2.32.0"}],
157
- "upgraded": [{"name": "django", "before_version": "3.2", "after_version": "4.0"}],
158
- "removed": [{"name": "deprecated_lib", "version": "1.0"}]
159
- }
160
- }
161
- ```
162
-
163
- ### Log File
164
-
165
- All action traces are automatically persisted to `.execdiff/logs/actions.jsonl`:
166
-
167
- ```json
168
- {
169
- "timestamp": "2026-02-18T18:19:35.872838",
170
- "workspace": "/path/to/workspace",
171
- "diff": {...}
172
- }
173
- ```
174
-
175
- ---
176
-
177
- ## Use Cases
178
-
179
- ExecDiff can help AI coding tools:
180
-
181
- - preview changes before applying generated code
182
- - detect unintended file or dependency changes
183
- - explain execution impact to users
184
- - debug failed automation
185
- - build undo / rollback systems
186
-
187
- ---
188
-
189
- ## License
190
-
191
- MIT
192
-
193
- ````
File without changes
File without changes
File without changes