mycode-cli 0.2.1__py3-none-any.whl → 0.3.0__py3-none-any.whl
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.
- mycode/cli/render.py +18 -12
- mycode/core/tools.py +271 -188
- mycode/server/static/assets/EditDiff-B-xuc0_M.js +12 -0
- mycode/server/static/assets/{index-CGtO7YrK.js → index--b2yTD3D.js} +59 -59
- mycode/server/static/assets/{index-DSy61xeD.css → index-BgNwRXPa.css} +1 -1
- mycode/server/static/index.html +2 -2
- {mycode_cli-0.2.1.dist-info → mycode_cli-0.3.0.dist-info}/METADATA +1 -1
- {mycode_cli-0.2.1.dist-info → mycode_cli-0.3.0.dist-info}/RECORD +11 -11
- mycode/server/static/assets/EditDiff-COEpHWbJ.js +0 -12
- {mycode_cli-0.2.1.dist-info → mycode_cli-0.3.0.dist-info}/WHEEL +0 -0
- {mycode_cli-0.2.1.dist-info → mycode_cli-0.3.0.dist-info}/entry_points.txt +0 -0
- {mycode_cli-0.2.1.dist-info → mycode_cli-0.3.0.dist-info}/licenses/LICENSE +0 -0
mycode/cli/render.py
CHANGED
|
@@ -563,20 +563,26 @@ class ReplyRenderer:
|
|
|
563
563
|
lower = name.lower()
|
|
564
564
|
|
|
565
565
|
if lower == "edit":
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
if isinstance(old_text, str) and isinstance(new_text, str):
|
|
566
|
+
edits = args.get("edits")
|
|
567
|
+
if isinstance(edits, list):
|
|
569
568
|
added = 0
|
|
570
569
|
removed = 0
|
|
571
|
-
for
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
570
|
+
for entry in edits:
|
|
571
|
+
if not isinstance(entry, dict):
|
|
572
|
+
continue
|
|
573
|
+
old_text = entry.get("oldText")
|
|
574
|
+
new_text = entry.get("newText")
|
|
575
|
+
if not isinstance(old_text, str) or not isinstance(new_text, str):
|
|
576
|
+
continue
|
|
577
|
+
for tag, old_start, old_end, new_start, new_end in SequenceMatcher(
|
|
578
|
+
None,
|
|
579
|
+
old_text.splitlines(),
|
|
580
|
+
new_text.splitlines(),
|
|
581
|
+
).get_opcodes():
|
|
582
|
+
if tag in {"replace", "delete"}:
|
|
583
|
+
removed += old_end - old_start
|
|
584
|
+
if tag in {"replace", "insert"}:
|
|
585
|
+
added += new_end - new_start
|
|
580
586
|
parts.append(f"+{added}", style="green")
|
|
581
587
|
parts.append(f" −{removed}", style="red")
|
|
582
588
|
elif lower == "read":
|