agentic-devtools 0.2.642__py3-none-any.whl → 0.2.643__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.
- agentic_devtools/_version.py +2 -2
- agentic_devtools/cli/checks/pre_push_budget.py +92 -15
- {agentic_devtools-0.2.642.dist-info → agentic_devtools-0.2.643.dist-info}/METADATA +1 -1
- {agentic_devtools-0.2.642.dist-info → agentic_devtools-0.2.643.dist-info}/RECORD +7 -7
- {agentic_devtools-0.2.642.dist-info → agentic_devtools-0.2.643.dist-info}/WHEEL +0 -0
- {agentic_devtools-0.2.642.dist-info → agentic_devtools-0.2.643.dist-info}/entry_points.txt +0 -0
- {agentic_devtools-0.2.642.dist-info → agentic_devtools-0.2.643.dist-info}/licenses/LICENSE +0 -0
agentic_devtools/_version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.643'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 643)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -8,10 +8,11 @@ import subprocess
|
|
|
8
8
|
import sys
|
|
9
9
|
import threading
|
|
10
10
|
import time
|
|
11
|
-
from collections.abc import Callable, Mapping, Sequence
|
|
12
|
-
from contextlib import ExitStack, suppress
|
|
11
|
+
from collections.abc import Callable, Iterator, Mapping, Sequence
|
|
12
|
+
from contextlib import ExitStack, contextmanager, suppress
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from threading import Thread
|
|
15
|
+
from typing import Any, cast
|
|
15
16
|
|
|
16
17
|
DEFAULT_BUDGET_SECONDS = 600
|
|
17
18
|
TERM_GRACE_SECONDS = 10
|
|
@@ -20,24 +21,100 @@ OUTPUT_DRAIN_SECONDS = 1
|
|
|
20
21
|
MAX_PENDING_STDOUT_BYTES = 65536
|
|
21
22
|
|
|
22
23
|
|
|
24
|
+
def _restore_signal_handlers(installed: list[tuple[int, object]], primary_error: BaseException | None) -> None:
|
|
25
|
+
restoration_errors = []
|
|
26
|
+
for signum, previous_handler in reversed(installed):
|
|
27
|
+
try:
|
|
28
|
+
signal.signal(signum, cast(Any, previous_handler))
|
|
29
|
+
except BaseException as exc:
|
|
30
|
+
restoration_errors.append((signum, exc))
|
|
31
|
+
if primary_error is not None:
|
|
32
|
+
for signum, error in restoration_errors:
|
|
33
|
+
primary_error.add_note(f"Signal restoration failed for {signum}: {error!r}")
|
|
34
|
+
elif restoration_errors:
|
|
35
|
+
raise restoration_errors[0][1]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _eligible_signal_handlers(
|
|
39
|
+
is_posix: Callable[[], bool],
|
|
40
|
+
is_main_thread: Callable[[], bool],
|
|
41
|
+
get_handler: Callable[[int], object],
|
|
42
|
+
) -> list[tuple[int, object]]:
|
|
43
|
+
candidates: tuple[str, ...] = ("SIGTERM", "SIGHUP")
|
|
44
|
+
if not is_posix() or not is_main_thread():
|
|
45
|
+
candidates = ()
|
|
46
|
+
return [
|
|
47
|
+
(signum, previous_handler)
|
|
48
|
+
for name in candidates
|
|
49
|
+
if (signum := getattr(signal, name, None)) is not None
|
|
50
|
+
if (previous_handler := get_handler(signum)) is not None
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@contextmanager
|
|
23
55
|
def _temporary_signal_handlers(
|
|
24
56
|
*,
|
|
25
57
|
is_posix: Callable[[], bool] = lambda: os.name == "posix",
|
|
26
58
|
is_main_thread: Callable[[], bool] = lambda: threading.current_thread() is threading.main_thread(),
|
|
27
59
|
get_handler: Callable[[int], object] = signal.getsignal,
|
|
28
|
-
) ->
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
60
|
+
) -> Iterator[Any]:
|
|
61
|
+
"""Yield lifecycle state; callers catch Interrupted through begin_cleanup().
|
|
62
|
+
|
|
63
|
+
Call begin_cleanup() before cleanup work. first_signum remains inspectable
|
|
64
|
+
after exit; signals are no longer intercepted once handlers are restored.
|
|
65
|
+
Reentrant handler calls are ignored while capture is active. CPython
|
|
66
|
+
dispatches pending signal handlers in signum order, so first_signum reflects
|
|
67
|
+
handler invocation order, not kernel arrival order.
|
|
68
|
+
"""
|
|
69
|
+
eligible = _eligible_signal_handlers(is_posix, is_main_thread, get_handler)
|
|
70
|
+
|
|
71
|
+
class Lifecycle:
|
|
72
|
+
class Interrupted(BaseException):
|
|
73
|
+
"""First body signal; catch only inside the with body."""
|
|
74
|
+
|
|
75
|
+
phase = "installing"
|
|
76
|
+
first_signum: int | None = None
|
|
77
|
+
restoration_started = False
|
|
78
|
+
interrupted = False
|
|
79
|
+
_handling_lock = threading.Lock()
|
|
80
|
+
|
|
81
|
+
def handle(self, signum: int, frame: object) -> None:
|
|
82
|
+
if not self._handling_lock.acquire(blocking=False):
|
|
83
|
+
return
|
|
84
|
+
try:
|
|
85
|
+
if self.first_signum is None:
|
|
86
|
+
self.first_signum = signum
|
|
87
|
+
if all((self.phase == "body", not self.restoration_started, not self.interrupted)):
|
|
88
|
+
self.interrupted = True
|
|
89
|
+
raise self.Interrupted()
|
|
90
|
+
finally:
|
|
91
|
+
self._handling_lock.release()
|
|
92
|
+
|
|
93
|
+
def begin_body(self) -> None:
|
|
94
|
+
self.phase = "body"
|
|
95
|
+
if self.first_signum is not None:
|
|
96
|
+
self.handle(self.first_signum, None)
|
|
97
|
+
|
|
98
|
+
def begin_cleanup(self) -> None:
|
|
99
|
+
self.phase = "cleanup"
|
|
100
|
+
|
|
101
|
+
lifecycle = Lifecycle()
|
|
102
|
+
installed: list[tuple[int, object]] = []
|
|
103
|
+
primary_error = None
|
|
104
|
+
try:
|
|
105
|
+
for signum, previous_handler in eligible:
|
|
106
|
+
signal.signal(signum, lifecycle.handle)
|
|
107
|
+
installed.append((signum, previous_handler))
|
|
108
|
+
try:
|
|
109
|
+
yield lifecycle
|
|
110
|
+
finally:
|
|
111
|
+
lifecycle.restoration_started, lifecycle.phase = True, "restoring"
|
|
112
|
+
except BaseException as exc:
|
|
113
|
+
primary_error = exc
|
|
114
|
+
raise
|
|
115
|
+
finally:
|
|
116
|
+
lifecycle.restoration_started, lifecycle.phase = True, "restoring"
|
|
117
|
+
_restore_signal_handlers(installed, primary_error)
|
|
41
118
|
|
|
42
119
|
|
|
43
120
|
def resolve_budget_seconds(environ: Mapping[str, str]) -> int:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
agentic_devtools/__init__.py,sha256=gvLzsZ6L3Abr4sPHr4OJ_rdZDD8cFzXacaV0LGs8dVc,539
|
|
2
|
-
agentic_devtools/_version.py,sha256=
|
|
2
|
+
agentic_devtools/_version.py,sha256=EKFRcGP8KFFAOItiT4BQTB6iE3p9iwPnU3HZq3H21h4,524
|
|
3
3
|
agentic_devtools/agdt_gitignore.py,sha256=vVVqTjBZ_ijn6U3Lnh_JGrARLschYVN-fFal9jDk0Ak,2694
|
|
4
4
|
agentic_devtools/background_tasks.py,sha256=sFgmqOnCdCjclABJ8V__yDwBXDyi45b1Z-MVv3G2zB8,17664
|
|
5
5
|
agentic_devtools/config.py,sha256=DEVxTVZhsQbVQwO9qdB_1h19aBpjMzF6xJY_ePYLGLs,15629
|
|
@@ -217,7 +217,7 @@ agentic_devtools/cli/checks/coverage_pool.py,sha256=I8lvSDABhVGopukLGsrXIsL9SbQZ
|
|
|
217
217
|
agentic_devtools/cli/checks/customization_quality.py,sha256=VLZQW5WNUSTr40ngxI9gHUY7fK0P0Mm3PsMn3HYajj4,47864
|
|
218
218
|
agentic_devtools/cli/checks/file_length.py,sha256=K1v6Bkn6dbVoBppjdigcpuPqYcxwmWanE3FtDwq78FA,4139
|
|
219
219
|
agentic_devtools/cli/checks/lint.py,sha256=DLXWJpAJ8GfLYpBUF1sf2ArPnEdIkuQ2ksYv44wWJ5M,8568
|
|
220
|
-
agentic_devtools/cli/checks/pre_push_budget.py,sha256=
|
|
220
|
+
agentic_devtools/cli/checks/pre_push_budget.py,sha256=6ZCJag2gFFOW9hpp8H-34SIgiJe7_egU5e2jtxZ9ip8,11224
|
|
221
221
|
agentic_devtools/cli/checks/quality_baseline.py,sha256=PbSYAiJdWwEDP8SGGUXNpJVxkswGi-whveLOav7J2y4,2967
|
|
222
222
|
agentic_devtools/cli/checks/setup_drift.py,sha256=bVR0F4wpwt8rOl829tGXKqI1PDUbg9JsXTShgYaJSSM,7666
|
|
223
223
|
agentic_devtools/cli/checks/setup_drift_changed_files.py,sha256=73IuzquyLDKhWderCvFE5TXnHuBxBcQTSbg2p15-wKE,3719
|
|
@@ -1336,8 +1336,8 @@ agentic_devtools/_bundled_skills/skills/speckit-plan/SKILL.md,sha256=qYLpzgLCIZ6
|
|
|
1336
1336
|
agentic_devtools/_bundled_skills/skills/speckit-specify/SKILL.md,sha256=HbHRbdphMqbtNw6fL6NcYCj6sSFmUyk2S4U0bZ9p_l4,13681
|
|
1337
1337
|
agentic_devtools/_bundled_skills/skills/write-github-commit-message/SKILL.md,sha256=Ep1lR8NDN117Iytj172VZgqazFiLpJ56Z7RXgaTnxR8,2626
|
|
1338
1338
|
agentic_devtools/_bundled_skills/skills/write-github-commit-message/commit-types.md,sha256=bTy_t68ZD6R87rFIzq9wybTu8Wudoahb7nB9IWC4bFo,1839
|
|
1339
|
-
agentic_devtools-0.2.
|
|
1340
|
-
agentic_devtools-0.2.
|
|
1341
|
-
agentic_devtools-0.2.
|
|
1342
|
-
agentic_devtools-0.2.
|
|
1343
|
-
agentic_devtools-0.2.
|
|
1339
|
+
agentic_devtools-0.2.643.dist-info/METADATA,sha256=O3-6jQjHwlDolIe-GbxvlWnXOyim6wTQe8uH8z42eqw,35594
|
|
1340
|
+
agentic_devtools-0.2.643.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
1341
|
+
agentic_devtools-0.2.643.dist-info/entry_points.txt,sha256=oHUiF-YvDtXSMTUh0E2bwYKGn4hZlIVbBRaQGSFXASc,13696
|
|
1342
|
+
agentic_devtools-0.2.643.dist-info/licenses/LICENSE,sha256=yBEDdICksxhBYLWoERKp9MTqwGnUF6Ryj9BTLwXTc6k,1082
|
|
1343
|
+
agentic_devtools-0.2.643.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|