claude-dev-env 8.69.1 → 8.71.0
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.
- package/.agents/skills/correction/SKILL.md +28 -6
- package/.agents/skills/correction/references/filing.md +33 -0
- package/.agents/skills/correction/scripts/correction_filing.py +327 -0
- package/.agents/skills/correction/scripts/correction_filing_constants/__init__.py +0 -0
- package/.agents/skills/correction/scripts/correction_filing_constants/config/__init__.py +0 -0
- package/.agents/skills/correction/scripts/correction_filing_constants/config/constants.py +56 -0
- package/.agents/skills/correction/scripts/pytest.ini +4 -0
- package/.agents/skills/correction/scripts/test_correction_filing.py +155 -0
- package/docs/templates/html-plan/README.md +36 -0
- package/docs/templates/html-plan/house.css +26 -0
- package/hooks/blocking/image_read_size_gate.py +167 -0
- package/hooks/blocking/test_image_read_size_gate.py +79 -0
- package/hooks/features/README.md +1 -0
- package/hooks/features/read-gates.md +20 -0
- package/hooks/features/session-context.md +2 -2
- package/hooks/hooks.json +10 -0
- package/hooks/hooks_constants/artifact_template_pointer_constants.py +9 -3
- package/hooks/hooks_constants/image_read_size_gate_constants.py +41 -0
- package/hooks/hooks_constants/test_artifact_template_pointer_constants.py +9 -1
- package/hooks/session/artifact_template_pointer.py +10 -4
- package/hooks/session/test_artifact_template_pointer.py +8 -2
- package/package.json +1 -1
- package/scripts/agent_image_copy.py +155 -0
- package/scripts/dev_env_scripts_constants/agent_image_copy_constants.py +11 -0
- package/scripts/policy_lint/config/constants.py +1 -0
- package/scripts/test_agent_image_copy.py +76 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Behavior tests for the agent image copy script."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from PIL import Image
|
|
9
|
+
|
|
10
|
+
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
11
|
+
|
|
12
|
+
import agent_image_copy
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_capped_size_should_keep_the_aspect_ratio() -> None:
|
|
16
|
+
assert agent_image_copy.capped_size(1440, 2560) == (288, 512)
|
|
17
|
+
assert agent_image_copy.capped_size(2000, 1000) == (512, 256)
|
|
18
|
+
assert agent_image_copy.capped_size(300, 200) == (300, 200)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_visual_tokens_should_count_28_pixel_patches() -> None:
|
|
22
|
+
assert agent_image_copy.visual_tokens(1440, 2560) == 4784
|
|
23
|
+
assert agent_image_copy.visual_tokens(288, 512) == 209
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_parse_crop_box_should_refuse_three_numbers() -> None:
|
|
27
|
+
assert agent_image_copy.parse_crop_box("0,0,10,20") == (0, 0, 10, 20)
|
|
28
|
+
with pytest.raises(argparse.ArgumentTypeError):
|
|
29
|
+
agent_image_copy.parse_crop_box("0,0,10")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_write_agent_copy_should_write_a_capped_newer_file(tmp_path: Path) -> None:
|
|
33
|
+
source_path = tmp_path / "preview.png"
|
|
34
|
+
Image.new("RGB", (1440, 2560), "white").save(source_path)
|
|
35
|
+
copy_path = agent_image_copy.write_agent_copy(source_path, None)
|
|
36
|
+
assert copy_path.name == "preview.agent.png"
|
|
37
|
+
with Image.open(copy_path) as copy_image:
|
|
38
|
+
assert copy_image.size == (288, 512)
|
|
39
|
+
assert copy_path.stat().st_mtime >= source_path.stat().st_mtime
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_write_agent_copy_should_crop_before_scaling(tmp_path: Path) -> None:
|
|
43
|
+
source_path = tmp_path / "preview.png"
|
|
44
|
+
Image.new("RGB", (1440, 2560), "white").save(source_path)
|
|
45
|
+
copy_path = agent_image_copy.write_agent_copy(source_path, (0, 0, 720, 640))
|
|
46
|
+
with Image.open(copy_path) as copy_image:
|
|
47
|
+
assert copy_image.size == (512, 455)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_write_agent_copy_should_write_a_cmyk_jpeg_as_rgb(tmp_path: Path) -> None:
|
|
51
|
+
source_path = tmp_path / "print.jpg"
|
|
52
|
+
Image.new("CMYK", (1000, 800)).save(source_path)
|
|
53
|
+
copy_path = agent_image_copy.write_agent_copy(source_path, None)
|
|
54
|
+
with Image.open(copy_path) as copy_image:
|
|
55
|
+
assert copy_image.mode == "RGB"
|
|
56
|
+
assert copy_image.size == (512, 410)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_write_agent_copy_should_follow_the_exif_orientation(tmp_path: Path) -> None:
|
|
60
|
+
source_path = tmp_path / "phone.jpg"
|
|
61
|
+
source_image = Image.new("RGB", (1000, 600), "white")
|
|
62
|
+
all_exif_tags = source_image.getexif()
|
|
63
|
+
all_exif_tags[0x0112] = 6
|
|
64
|
+
source_image.save(source_path, exif=all_exif_tags)
|
|
65
|
+
copy_path = agent_image_copy.write_agent_copy(source_path, None)
|
|
66
|
+
with Image.open(copy_path) as copy_image:
|
|
67
|
+
assert copy_image.size == (307, 512)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_main_should_print_the_copy_path(
|
|
71
|
+
tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
72
|
+
) -> None:
|
|
73
|
+
source_path = tmp_path / "shot.png"
|
|
74
|
+
Image.new("RGB", (1600, 900), "white").save(source_path)
|
|
75
|
+
assert agent_image_copy.main([str(source_path)]) == 0
|
|
76
|
+
assert "shot.agent.png 512x288 about 209 tokens" in capsys.readouterr().out
|