claude-dev-env 8.98.8 → 8.98.10

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,38 +0,0 @@
1
- #!/usr/bin/env python3
2
- """UserPromptSubmit hook that records each prompt for the open tasks Stop gate.
3
-
4
- A prompt that asks for work becomes ``#ask-N`` in
5
- ``~/.claude/open-task-asks/<session id>.json``. The gate then holds the turn
6
- until a reply closes it with ``Done: #ask-N``, or with
7
- ``Dropped: #ask-N - "<the user's words>"`` quoting a later prompt. The hook
8
- prints nothing and always exits 0.
9
- """
10
-
11
- from __future__ import annotations
12
-
13
- import sys
14
- from pathlib import Path
15
-
16
- hooks_root_directory = str(Path(__file__).resolve().parent.parent)
17
- if hooks_root_directory not in sys.path:
18
- sys.path.insert(0, hooks_root_directory)
19
-
20
- from hooks_constants.open_tasks_stop_gate_constants import (
21
- ALLOW_EXIT_CODE,
22
- PROMPT_KEY,
23
- SESSION_ID_KEY,
24
- )
25
- from hooks_constants.pre_tool_use_stdin import read_hook_input_dictionary_from_stdin
26
- from open_task_asks import record_prompt
27
-
28
-
29
- def main() -> int:
30
- hook_input = read_hook_input_dictionary_from_stdin()
31
- prompt_value = hook_input.get(PROMPT_KEY) if hook_input is not None else None
32
- if hook_input is not None and isinstance(prompt_value, str):
33
- record_prompt(hook_input.get(SESSION_ID_KEY), prompt_value)
34
- return ALLOW_EXIT_CODE
35
-
36
-
37
- if __name__ == "__main__":
38
- sys.exit(main())
@@ -1,57 +0,0 @@
1
- import json
2
- import subprocess
3
- import sys
4
- from pathlib import Path
5
-
6
- RECORDER_PATH = Path(__file__).resolve().parent / "open_task_ask_recorder.py"
7
- SESSION_ID = "s-123"
8
-
9
-
10
- def submit_prompt(home_directory: Path, prompt_text: str) -> subprocess.CompletedProcess[str]:
11
- hook_input = {
12
- "hook_event_name": "UserPromptSubmit",
13
- "session_id": SESSION_ID,
14
- "prompt": prompt_text,
15
- }
16
- return subprocess.run(
17
- [sys.executable, str(RECORDER_PATH)],
18
- input=json.dumps(hook_input),
19
- capture_output=True,
20
- text=True,
21
- env={
22
- "HOME": str(home_directory),
23
- "USERPROFILE": str(home_directory),
24
- "PATH": "",
25
- },
26
- check=False,
27
- )
28
-
29
-
30
- def recorded_ask_ids(home_directory: Path) -> list[str]:
31
- asks_path = home_directory / ".claude" / "open-task-asks" / f"{SESSION_ID}.json"
32
- all_prompts = json.loads(asks_path.read_text(encoding="utf-8"))["prompts"]
33
- return [each_prompt["ask_id"] for each_prompt in all_prompts if each_prompt["ask_id"]]
34
-
35
-
36
- def test_should_record_each_ask_outside_the_task_store_and_stay_silent(
37
- tmp_path: Path,
38
- ) -> None:
39
- first_process = submit_prompt(tmp_path, "Export the OneUI8 and OneUI9 APKs and submit them")
40
- submit_prompt(tmp_path, "did the export fail?")
41
- submit_prompt(tmp_path, "<task-notification>\n<task-id>b1</task-id>\n</task-notification>")
42
- submit_prompt(tmp_path, "can you check the release dates in neon?")
43
- assert (first_process.returncode, first_process.stdout) == (0, "")
44
- assert recorded_ask_ids(tmp_path) == ["ask-1", "ask-2"]
45
- assert not (tmp_path / ".claude" / "tasks").exists()
46
-
47
-
48
- def test_should_allow_malformed_input(tmp_path: Path) -> None:
49
- completed_process = subprocess.run(
50
- [sys.executable, str(RECORDER_PATH)],
51
- input="not json",
52
- capture_output=True,
53
- text=True,
54
- env={"HOME": str(tmp_path), "USERPROFILE": str(tmp_path), "PATH": ""},
55
- check=False,
56
- )
57
- assert (completed_process.returncode, completed_process.stdout) == (0, "")