claude-dev-env 8.120.0 → 8.122.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/bin/ever-registered-hooks.mjs +2 -0
- package/docs/rule-guides/question-presentation.md +4 -0
- package/hooks/advisory/auto_mode_denial_quick_fix.py +275 -27
- package/hooks/advisory/auto_mode_rule_flow_eval/auto_mode_rule_flow_cases.json +3475 -0
- package/hooks/advisory/auto_mode_rule_flow_eval/auto_mode_rule_flow_runner.py +849 -0
- package/hooks/advisory/auto_mode_rule_flow_eval/stub_allow_hook.py +20 -0
- package/hooks/advisory/auto_mode_rule_flow_eval/stub_hold_hook.py +54 -0
- package/hooks/advisory/auto_mode_rule_flow_eval/test_auto_mode_rule_flow_runner.py +143 -0
- package/hooks/advisory/test_auto_mode_denial_quick_fix.py +533 -9
- package/hooks/auto_mode_question_transcript.py +215 -0
- package/hooks/auto_mode_refusal_ledger.py +481 -0
- package/hooks/auto_mode_refusal_ledger_files.py +336 -0
- package/hooks/auto_mode_rule_steps.py +177 -0
- package/hooks/blocking/auto_mode_refusal_stop_gate.py +384 -0
- package/hooks/blocking/sent_file_question_detector.py +340 -0
- package/hooks/blocking/sent_file_question_gate.py +307 -0
- package/hooks/blocking/sent_file_scan.py +209 -0
- package/hooks/blocking/test_auto_mode_refusal_stop_gate.py +484 -0
- package/hooks/blocking/test_sent_file_question_detector.py +68 -0
- package/hooks/blocking/test_sent_file_question_gate.py +688 -0
- package/hooks/blocking/test_sent_file_scan.py +71 -0
- package/hooks/blocking/test_user_step_wording.py +46 -0
- package/hooks/blocking/user_step_wording.py +113 -15
- package/hooks/features/README.md +1 -1
- package/hooks/features/conduct-gates.md +3 -0
- package/hooks/features/session-context.md +5 -2
- package/hooks/hooks.json +15 -0
- package/hooks/hooks_constants/auto_mode_denial_quick_fix_constants.py +51 -3
- package/hooks/hooks_constants/auto_mode_refusal_ledger_constants.py +85 -0
- package/hooks/hooks_constants/auto_mode_refusal_stop_gate_constants.py +80 -0
- package/hooks/hooks_constants/auto_mode_rule_flow_runner_constants.py +225 -0
- package/hooks/hooks_constants/auto_mode_rule_steps_constants.py +82 -0
- package/hooks/hooks_constants/sent_file_question_gate_constants.py +261 -0
- package/hooks/hooks_constants/user_step_wording_constants.py +4 -0
- package/hooks/test_auto_mode_question_transcript.py +113 -0
- package/hooks/test_auto_mode_refusal_ledger.py +398 -0
- package/hooks/test_auto_mode_refusal_ledger_files.py +155 -0
- package/hooks/test_auto_mode_rule_steps.py +210 -0
- package/package.json +1 -1
- package/scripts/policy_lint/adapter_configuration.py +10 -0
- package/scripts/policy_lint/config/constants.py +2 -0
- package/scripts/tests/test_adapter_configuration.py +16 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
import sent_file_question_detector
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize(
|
|
9
|
+
("file_text", "expected_question"),
|
|
10
|
+
[
|
|
11
|
+
("Checks passed. Should I merge it?\n", "Should I merge it?"),
|
|
12
|
+
("Three dates fit. What release date works best?\n", "What release date works best?"),
|
|
13
|
+
("The run is done.\n\n- Did you run the tests?\n", "Did you run the tests?"),
|
|
14
|
+
("- [ ] Should I archive the old branches?\n", "Should I archive the old branches?"),
|
|
15
|
+
(
|
|
16
|
+
"- Did you run the tests?\n- Keep the cache or clear it?\n",
|
|
17
|
+
"Keep the cache or clear it?",
|
|
18
|
+
),
|
|
19
|
+
],
|
|
20
|
+
)
|
|
21
|
+
def test_question_for_user_should_return_the_question_the_text_asks(
|
|
22
|
+
file_text: str, expected_question: str
|
|
23
|
+
) -> None:
|
|
24
|
+
assert (
|
|
25
|
+
sent_file_question_detector.question_for_user(file_text, is_html=False) == expected_question
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@pytest.mark.parametrize(
|
|
30
|
+
"file_text",
|
|
31
|
+
[
|
|
32
|
+
"The build passed.\n",
|
|
33
|
+
"## Checklist\n\n- Did you run the tests?\n- Did you update the changelog?\n",
|
|
34
|
+
"- [ ] Did you run the tests?\n",
|
|
35
|
+
"Which Python version works best? Python 3.12.\n",
|
|
36
|
+
],
|
|
37
|
+
)
|
|
38
|
+
def test_question_for_user_should_return_none_for_text_that_asks_nothing(file_text: str) -> None:
|
|
39
|
+
assert sent_file_question_detector.question_for_user(file_text, is_html=False) is None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@pytest.mark.parametrize(
|
|
43
|
+
"file_text",
|
|
44
|
+
[
|
|
45
|
+
"# T" + " " * 3000 + "x",
|
|
46
|
+
"**a**" + " " * 50000,
|
|
47
|
+
"**a**" + " " * 50000 + "x",
|
|
48
|
+
"## Open" + " " * 50000 + "questions #" + " " * 50000 + "x",
|
|
49
|
+
],
|
|
50
|
+
)
|
|
51
|
+
def test_question_for_user_should_read_long_space_runs_in_linear_time(file_text: str) -> None:
|
|
52
|
+
started_at = time.perf_counter()
|
|
53
|
+
sent_file_question_detector.question_for_user(file_text, is_html=False)
|
|
54
|
+
assert time.perf_counter() - started_at < 1
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@pytest.mark.parametrize(
|
|
58
|
+
"file_text",
|
|
59
|
+
[
|
|
60
|
+
"Q: one?\n" * 20000,
|
|
61
|
+
"word\n" * 100000,
|
|
62
|
+
("Should I " + "x " * 400 + "go? ") * 300,
|
|
63
|
+
],
|
|
64
|
+
)
|
|
65
|
+
def test_question_for_user_should_read_many_units_in_linear_time(file_text: str) -> None:
|
|
66
|
+
started_at = time.perf_counter()
|
|
67
|
+
sent_file_question_detector.question_for_user(file_text, is_html=False)
|
|
68
|
+
assert time.perf_counter() - started_at < 2
|