claude-dev-env 8.46.30 → 8.46.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "8.46.30",
3
+ "version": "8.46.31",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,6 +29,12 @@ from dev_env_scripts_constants.codex_account_constants import (
29
29
  TIER_LUNA,
30
30
  TIER_NORMAL,
31
31
  )
32
+ from dev_env_scripts_constants.shared_tree_constants import (
33
+ CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH,
34
+ CONSTANTS_PACKAGE_ANCHOR_DEPTH,
35
+ PR_LOOP_DIRECTORY_NAME,
36
+ )
37
+ from shared_tree_paths import resolve_shared_scripts_directory
32
38
 
33
39
  ALL_CLAUDE_FLOORS = {
34
40
  "main_weekly_used_ceiling": MAIN_WEEKLY_USED_CEILING_PERCENT,
@@ -63,7 +69,7 @@ def codex_usage_limit_signatures() -> tuple[str, ...]:
63
69
  Raises:
64
70
  ImportError: The marker module cannot be loaded.
65
71
  """
66
- constants_path = Path(__file__).resolve().parents[2] / "_shared" / "pr-loop" / "scripts" / "codex_review_scripts_constants" / "classifier_constants.py"
72
+ constants_path = resolve_shared_scripts_directory(__file__, os.environ, PR_LOOP_DIRECTORY_NAME, CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH, CONSTANTS_PACKAGE_ANCHOR_DEPTH) / CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH
67
73
  loader = importlib.machinery.SourceFileLoader("account_broker_codex_classifier_constants", str(constants_path))
68
74
  module = types.ModuleType(loader.name)
69
75
  try:
@@ -14,6 +14,12 @@ PROCESS_TREE_KILL_MODULE_FILENAME: str = "process_tree_kill.py"
14
14
 
15
15
  ADVISOR_DIRECTORY_NAME: str = "advisor"
16
16
 
17
+ PR_LOOP_DIRECTORY_NAME: str = "pr-loop"
18
+
19
+ CODEX_CLASSIFIER_CONSTANTS_RELATIVE_PATH: str = "codex_review_scripts_constants/classifier_constants.py"
20
+
21
+ CONSTANTS_PACKAGE_ANCHOR_DEPTH: int = 2
22
+
17
23
  TIER_MODEL_IDS_MODULE_FILENAME: str = "tier_model_ids.py"
18
24
 
19
25
  AGENTS_DIRECTORY_SUFFIX: str = ".agents"
@@ -3,6 +3,12 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import dataclasses
6
+ import importlib
7
+ import importlib.util
8
+ import os
9
+ import shutil
10
+ import sys
11
+ import types
6
12
  from datetime import datetime, timedelta, timezone
7
13
  from pathlib import Path
8
14
 
@@ -27,6 +33,8 @@ from dev_env_scripts_constants.codex_account_constants import (
27
33
  NORMAL_TIER_MINIMUM_PERCENT_LEFT,
28
34
  )
29
35
 
36
+ TEMP_TREE_MARKER = "marker-only-in-the-temp-install-tree"
37
+
30
38
 
31
39
  def test_should_keep_claude_floors_tied_to_the_account_ceilings() -> None:
32
40
  assert ALL_CLAUDE_FLOORS == {
@@ -88,3 +96,73 @@ def test_parse_utc_time_converts_an_offset_timestamp() -> None:
88
96
 
89
97
  assert parsed is not None
90
98
  assert parsed.isoformat() == "2026-10-03T11:30:00+00:00"
99
+
100
+ def _create_directory_link(*, from_link: Path, to_target: Path) -> None:
101
+ if sys.platform.startswith("win32"):
102
+ importlib.import_module("_winapi").CreateJunction(
103
+ str(to_target), str(from_link)
104
+ )
105
+ return
106
+ os.symlink(to_target, from_link, target_is_directory=True)
107
+
108
+
109
+ def _build_install_layout(home: Path) -> tuple[Path, Path]:
110
+ agents_constants_directory = (
111
+ home / ".agents" / "scripts" / "dev_env_scripts_constants"
112
+ )
113
+ agents_constants_directory.mkdir(parents=True)
114
+ shutil.copy(
115
+ Path(broker_constants.__file__),
116
+ agents_constants_directory / "account_broker_constants.py",
117
+ )
118
+ classifier_directory = (
119
+ home
120
+ / ".claude"
121
+ / "_shared"
122
+ / "pr-loop"
123
+ / "scripts"
124
+ / "codex_review_scripts_constants"
125
+ )
126
+ classifier_directory.mkdir(parents=True)
127
+ (classifier_directory / "classifier_constants.py").write_text(
128
+ f"ALL_USAGE_LIMIT_MARKERS = ({TEMP_TREE_MARKER!r},)\n", encoding="utf-8"
129
+ )
130
+ _create_directory_link(
131
+ from_link=home / ".claude" / "scripts", to_target=home / ".agents" / "scripts"
132
+ )
133
+ linked_module = (
134
+ home
135
+ / ".claude"
136
+ / "scripts"
137
+ / "dev_env_scripts_constants"
138
+ / "account_broker_constants.py"
139
+ )
140
+ agents_module = agents_constants_directory / "account_broker_constants.py"
141
+ return linked_module, agents_module
142
+
143
+
144
+ def _load_module_from(
145
+ module_file: Path, module_name: str, monkeypatch: pytest.MonkeyPatch
146
+ ) -> types.ModuleType:
147
+ specification = importlib.util.spec_from_file_location(module_name, module_file)
148
+ assert specification is not None and specification.loader is not None
149
+ module = importlib.util.module_from_spec(specification)
150
+ monkeypatch.setitem(sys.modules, module_name, module)
151
+ specification.loader.exec_module(module)
152
+ return module
153
+
154
+
155
+ @pytest.mark.parametrize("entry_point", ("through_scripts_link", "through_agents_path"))
156
+ def test_codex_usage_limit_signatures_finds_shared_tree_beside_the_scripts_link(
157
+ entry_point: str, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
158
+ ) -> None:
159
+ monkeypatch.delenv("CLAUDE_CONFIG_DIR", raising=False)
160
+ linked_module, agents_module = _build_install_layout(tmp_path / "home")
161
+ module_file = (
162
+ linked_module if entry_point == "through_scripts_link" else agents_module
163
+ )
164
+ installed_constants = _load_module_from(
165
+ module_file, f"installed_account_broker_constants_{entry_point}", monkeypatch
166
+ )
167
+
168
+ assert installed_constants.codex_usage_limit_signatures() == (TEMP_TREE_MARKER,)