claude-dev-env 8.46.23 → 8.46.25
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/docs/CODE_RULES.md
CHANGED
|
@@ -96,6 +96,8 @@ Open [details](code-rules/design-and-structure.md) when renaming symbols.
|
|
|
96
96
|
|
|
97
97
|
Never swallow a failure into a default unless the caller explicitly opted in at the boundary. Name the specific exception (`except KeyError:`) and propagate the rest. Collapsing every error class to `None` masks programming errors and makes debugging impossible.
|
|
98
98
|
|
|
99
|
+
A member loop catches its declared `*ItemBlocked` type inside the loop and lets a `*RunFatal` pass through, and an `except Exception` in that loop triggers this rule.
|
|
100
|
+
|
|
99
101
|
Open [details](code-rules/design-and-structure.md) when handling batch failures.
|
|
100
102
|
|
|
101
103
|
## 9.8 REMOVE CODE YOU ORPHAN (Dead Code Elimination)
|
package/package.json
CHANGED
|
@@ -333,7 +333,8 @@ def _parser() -> argparse.ArgumentParser:
|
|
|
333
333
|
commands = parser.add_subparsers(dest="action", required=True)
|
|
334
334
|
for each_action in ("choose", "check", "accounts", "limits", "run"):
|
|
335
335
|
command = commands.add_parser(each_action)
|
|
336
|
-
|
|
336
|
+
all_product_choices = [Product.CODEX.value] if each_action == "limits" else [each_product.value for each_product in Product]
|
|
337
|
+
command.add_argument("--product", choices=all_product_choices, required=True)
|
|
337
338
|
if each_action == "choose":
|
|
338
339
|
command.add_argument("--spent", action="append", default=[])
|
|
339
340
|
if each_action == "limits":
|
|
@@ -373,9 +374,7 @@ def _accounts_cli(product: Product) -> int:
|
|
|
373
374
|
return 0
|
|
374
375
|
|
|
375
376
|
|
|
376
|
-
def _limits_cli(
|
|
377
|
-
if product is not Product.CODEX:
|
|
378
|
-
raise BrokerConfigurationError("limits reads Codex accounts only")
|
|
377
|
+
def _limits_cli(parsed: argparse.Namespace) -> int:
|
|
379
378
|
try:
|
|
380
379
|
rate_limit_records = codex_account_meters.read_rate_limit_records(
|
|
381
380
|
codex_account_meters.resolve_codex_path(parsed.codex), parsed.home
|
|
@@ -430,7 +429,7 @@ def main(all_arguments: Sequence[str]) -> int:
|
|
|
430
429
|
if parsed.action == "accounts":
|
|
431
430
|
return _accounts_cli(product)
|
|
432
431
|
if parsed.action == "limits":
|
|
433
|
-
return _limits_cli(
|
|
432
|
+
return _limits_cli(parsed)
|
|
434
433
|
if parsed.action == "run":
|
|
435
434
|
return _run_cli(product, parsed, parser)
|
|
436
435
|
return _choose_cli(product, parsed)
|
|
@@ -805,5 +805,7 @@ def test_should_exit_two_when_the_limits_read_fails(
|
|
|
805
805
|
|
|
806
806
|
|
|
807
807
|
def test_should_refuse_limits_for_claude(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
|
808
|
-
|
|
809
|
-
|
|
808
|
+
with pytest.raises(SystemExit) as exit_info:
|
|
809
|
+
account_broker.main(("limits", "--product", "claude", "--home", str(tmp_path)))
|
|
810
|
+
assert exit_info.value.code == 2
|
|
811
|
+
assert "invalid choice: 'claude'" in capsys.readouterr().err
|
|
@@ -164,7 +164,6 @@ class TestReadCodexMeters:
|
|
|
164
164
|
read_codex_meters(Path("codex"), Path("/h"), broken_exchange)
|
|
165
165
|
|
|
166
166
|
|
|
167
|
-
|
|
168
167
|
class TestReadRateLimitRecords:
|
|
169
168
|
def should_return_every_limit_record_the_reply_carries(self) -> None:
|
|
170
169
|
rate_limit_records = {
|
|
@@ -196,6 +195,7 @@ class TestReadRateLimitRecords:
|
|
|
196
195
|
with pytest.raises(CodexMeterUnreadError, match="no rate-limit reply"):
|
|
197
196
|
read_rate_limit_records(Path("codex"), Path("/h"), lambda *_: [])
|
|
198
197
|
|
|
198
|
+
|
|
199
199
|
FAKE_APP_SERVER = """#!/usr/bin/env python3
|
|
200
200
|
import json, os, sys
|
|
201
201
|
for line in sys.stdin:
|