claude-dev-env 2.3.0 → 2.4.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.
Files changed (136) hide show
  1. package/CLAUDE.md +3 -2
  2. package/agents/CLAUDE.md +1 -0
  3. package/agents/code-verifier.md +3 -3
  4. package/agents/skill-writer-agent.md +84 -0
  5. package/audit-rubrics/category_rubrics/category-o-docstring-vs-impl-drift.md +141 -41
  6. package/audit-rubrics/prompts/category-o-docstring-vs-impl-drift.md +29 -13
  7. package/docs/CLAUDE.md +1 -0
  8. package/docs/references/CLAUDE.md +1 -0
  9. package/docs/references/code-review-enforcement.md +97 -0
  10. package/docs/wsl-docker-cowork-starter-matrix.md +89 -0
  11. package/hooks/blocking/CLAUDE.md +8 -1
  12. package/hooks/blocking/code_review_enforcement_config_bootstrap.py +53 -0
  13. package/hooks/blocking/code_review_gate_deny.py +74 -0
  14. package/hooks/blocking/code_review_pr_create_gate.py +194 -0
  15. package/hooks/blocking/code_review_push_gate.py +140 -0
  16. package/hooks/blocking/code_review_stamp_directory_write_blocker.py +340 -0
  17. package/hooks/blocking/code_review_stamp_store.py +233 -0
  18. package/hooks/blocking/code_review_stamp_write_blocker_parts/__init__.py +7 -0
  19. package/hooks/blocking/code_review_stamp_write_blocker_parts/conftest.py +15 -0
  20. package/hooks/blocking/code_review_stamp_write_blocker_parts/obfuscated_stamp_path_reference.py +212 -0
  21. package/hooks/blocking/code_review_stamp_write_blocker_parts/split_directory_change_into_stamp.py +138 -0
  22. package/hooks/blocking/code_review_stamp_write_blocker_parts/test_obfuscated_stamp_path_reference.py +49 -0
  23. package/hooks/blocking/code_review_stamp_write_blocker_parts/test_split_directory_change_into_stamp.py +38 -0
  24. package/hooks/blocking/code_verifier_spawn_preflight_gate.py +39 -27
  25. package/hooks/blocking/config/code_review_enforcement_constants.py +110 -0
  26. package/hooks/blocking/config/test_code_review_enforcement_constants.py +108 -0
  27. package/hooks/blocking/config/verified_commit_constants.py +13 -9
  28. package/hooks/blocking/conftest.py +2 -0
  29. package/hooks/blocking/convergence_gate_blocker.py +112 -23
  30. package/hooks/blocking/destructive_command_blocker.py +19 -6
  31. package/hooks/blocking/pr_description_proof_of_work.py +52 -34
  32. package/hooks/blocking/test_bash_pre_tool_use_dispatcher.py +4 -1
  33. package/hooks/blocking/test_code_review_enforcement_config_bootstrap.py +62 -0
  34. package/hooks/blocking/test_code_review_gate_deny.py +54 -0
  35. package/hooks/blocking/test_code_review_pr_create_gate.py +185 -0
  36. package/hooks/blocking/test_code_review_push_gate.py +189 -0
  37. package/hooks/blocking/test_code_review_stamp_directory_write_blocker.py +180 -0
  38. package/hooks/blocking/test_code_review_stamp_store.py +205 -0
  39. package/hooks/blocking/test_code_verifier_spawn_preflight_gate.py +124 -2
  40. package/hooks/blocking/test_convergence_gate_blocker.py +153 -5
  41. package/hooks/blocking/test_destructive_command_blocker.py +1 -1
  42. package/hooks/blocking/test_destructive_command_blocker_deny_mode.py +45 -0
  43. package/hooks/blocking/test_pr_description_proof_of_work.py +151 -0
  44. package/hooks/blocking/test_pre_tool_use_dispatcher.py +8 -8
  45. package/hooks/blocking/test_verification_verdict_store.py +920 -903
  46. package/hooks/blocking/test_volatile_path_in_post_blocker.py +114 -2
  47. package/hooks/blocking/verification_verdict_store.py +27 -5
  48. package/hooks/blocking/verified_commit_gate_parts/gated_invocations.py +29 -17
  49. package/hooks/blocking/verified_commit_gate_parts/tests/test_gated_invocations.py +35 -0
  50. package/hooks/blocking/volatile_path_in_post_blocker.py +69 -8
  51. package/hooks/git-hooks/git_hooks_constants/__init__.py +6 -0
  52. package/hooks/git-hooks/pre_push.py +89 -2
  53. package/hooks/git-hooks/test_pre_push.py +103 -0
  54. package/hooks/hooks.json +16 -1
  55. package/hooks/hooks_constants/CLAUDE.md +1 -0
  56. package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +8 -0
  57. package/hooks/hooks_constants/code_rules_path_utils_constants.py +1 -0
  58. package/hooks/hooks_constants/code_verifier_spawn_preflight_gate_constants.py +26 -11
  59. package/hooks/hooks_constants/convergence_gate_blocker_constants.py +20 -3
  60. package/hooks/hooks_constants/destructive_command_segment_constants.py +3 -1
  61. package/hooks/hooks_constants/pr_description_proof_of_work_constants.py +0 -4
  62. package/hooks/hooks_constants/pre_tool_use_dispatcher_constants.py +4 -0
  63. package/hooks/hooks_constants/pyproject_config_discovery_constants.py +16 -0
  64. package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +24 -0
  65. package/hooks/hooks_constants/test_pre_tool_use_dispatcher_constants.py +6 -0
  66. package/hooks/hooks_constants/volatile_path_in_post_blocker_constants.py +8 -1
  67. package/hooks/validators/CLAUDE.md +1 -0
  68. package/hooks/validators/mypy_integration.py +63 -50
  69. package/hooks/validators/pyproject_config_discovery.py +101 -0
  70. package/hooks/validators/ruff_integration.py +211 -23
  71. package/hooks/validators/run_all_validators.py +21 -14
  72. package/hooks/validators/test_mypy_integration.py +32 -0
  73. package/hooks/validators/test_pyproject_config_discovery.py +94 -0
  74. package/hooks/validators/test_ruff_integration.py +68 -1
  75. package/hooks/validators/test_run_all_validators.py +25 -0
  76. package/hooks/validators/test_run_all_validators_config_discovery.py +123 -0
  77. package/package.json +1 -1
  78. package/rules/docstring-prose-matches-implementation.md +20 -43
  79. package/rules/durable-post-artifacts.md +7 -0
  80. package/scripts/codec_forwarding_test_support.py +83 -0
  81. package/scripts/conftest.py +8 -0
  82. package/scripts/dev_env_scripts_constants/CLAUDE.md +1 -1
  83. package/scripts/dev_env_scripts_constants/claude_chain_constants.py +44 -1
  84. package/scripts/dev_env_scripts_constants/code_review_constants.py +129 -12
  85. package/scripts/dev_env_scripts_constants/test_code_review_constants.py +55 -0
  86. package/scripts/invoke_code_review.py +550 -38
  87. package/scripts/resolve_worker_spawn.py +8 -1
  88. package/scripts/test_invoke_code_review.py +298 -4
  89. package/scripts/test_invoke_code_review_codec.py +77 -0
  90. package/scripts/test_resolve_worker_spawn_codec.py +101 -0
  91. package/skills/autoconverge/SKILL.md +9 -3
  92. package/skills/autoconverge/reference/convergence.md +2 -1
  93. package/skills/autoconverge/reference/multi-pr.md +6 -1
  94. package/skills/autoconverge/reference/stop-conditions.md +16 -10
  95. package/skills/autoconverge/workflow/converge.clean-audit.test.mjs +1 -1
  96. package/skills/autoconverge/workflow/converge.codex-gate.test.mjs +175 -3
  97. package/skills/autoconverge/workflow/converge.contract.test.mjs +19 -0
  98. package/skills/autoconverge/workflow/converge.mjs +24 -8
  99. package/skills/autoconverge/workflow/converge_multi.mjs +7 -3
  100. package/skills/autoconverge/workflow/converge_multi.run-input.test.mjs +5 -0
  101. package/skills/fresh-branch/CLAUDE.md +2 -0
  102. package/skills/fresh-branch/SKILL.md +2 -0
  103. package/skills/fresh-branch/scripts/create_fresh_branch.py +78 -180
  104. package/skills/fresh-branch/scripts/fresh_branch_git_commands.py +285 -0
  105. package/skills/fresh-branch/scripts/fresh_branch_scripts_constants/fresh_branch_cli_constants.py +1 -0
  106. package/skills/fresh-branch/scripts/pytest.ini +4 -0
  107. package/skills/fresh-branch/scripts/test_create_fresh_branch.py +98 -0
  108. package/skills/fresh-branch/scripts/test_fresh_branch_git_commands.py +310 -0
  109. package/skills/prototype/SKILL.md +86 -0
  110. package/skills/prototype/reference/honest-limitations.md +23 -0
  111. package/skills/prototype/reference/promotion-tasks.md +23 -0
  112. package/skills/prototype/scripts/build_sandbox_settings.py +249 -0
  113. package/skills/prototype/scripts/conftest.py +15 -0
  114. package/skills/prototype/scripts/launch_sandbox.py +205 -0
  115. package/skills/prototype/scripts/probe_sandbox_safety.py +311 -0
  116. package/skills/prototype/scripts/prototype_scripts_constants/__init__.py +1 -0
  117. package/skills/prototype/scripts/prototype_scripts_constants/config/__init__.py +0 -0
  118. package/skills/prototype/scripts/prototype_scripts_constants/config/build_sandbox_settings_constants.py +41 -0
  119. package/skills/prototype/scripts/prototype_scripts_constants/config/launch_sandbox_constants.py +23 -0
  120. package/skills/prototype/scripts/prototype_scripts_constants/config/probe_sandbox_safety_constants.py +45 -0
  121. package/skills/prototype/scripts/prototype_scripts_constants/config/prototype_common_constants.py +10 -0
  122. package/skills/prototype/scripts/test_build_sandbox_settings.py +275 -0
  123. package/skills/prototype/scripts/test_launch_sandbox.py +303 -0
  124. package/skills/prototype/scripts/test_probe_sandbox_safety.py +284 -0
  125. package/skills/prototype/workflows/promotion.md +27 -0
  126. package/skills/prototype/workflows/sandbox.md +35 -0
  127. package/skills/skill-builder/CLAUDE.md +3 -3
  128. package/skills/skill-builder/SKILL.md +5 -5
  129. package/skills/skill-builder/references/CLAUDE.md +1 -1
  130. package/skills/skill-builder/references/delegation-map.md +3 -3
  131. package/skills/skill-builder/references/description-field.md +1 -1
  132. package/skills/skill-builder/references/skill-modularity.md +2 -3
  133. package/skills/skill-builder/workflows/CLAUDE.md +1 -1
  134. package/skills/skill-builder/workflows/improve-skill.md +1 -1
  135. package/skills/skill-builder/workflows/new-skill.md +2 -2
  136. package/skills/team-advisor/SKILL.md +2 -2
@@ -1,27 +1,76 @@
1
1
  """Named constants for the host-aware `/code-review` invoker.
2
2
 
3
- `invoke_code_review.py` imports every scalar and structural constant it
4
- needs from this module (and shared flag tokens from
5
- `grok_worker_constants`) so the prompt, model alias, and JSON keys are
6
- never hardcoded twice.
3
+ ::
4
+
5
+ ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER
6
+ ok: ("low", "medium", "high", "xhigh", "max")
7
+ flag: "ultra" (rejected; needs an interactive terminal)
8
+ RECORD_STAMP_FLAG
9
+ ok: "--record-stamp"
10
+
11
+ Effort tokens re-export the hooks enforcement constants (single source).
12
+ Scalar flags, JSON keys, and mint-loop messages live here for the invoker.
7
13
  """
8
14
 
9
15
  from __future__ import annotations
10
16
 
17
+ import importlib.util
18
+ import sys
19
+ from pathlib import Path
20
+ from types import ModuleType
21
+
22
+
23
+ def _load_enforcement_constants_module() -> ModuleType:
24
+ """Load the hooks enforcement constants by explicit file path.
25
+
26
+ Binds a private module name so a foreign ``config`` package on
27
+ ``sys.path`` cannot win the import and drift the effort token set.
28
+ """
29
+ package_root_directory = Path(__file__).resolve().parent.parent.parent
30
+ constants_file_path = (
31
+ package_root_directory
32
+ / "hooks"
33
+ / "blocking"
34
+ / "config"
35
+ / "code_review_enforcement_constants.py"
36
+ )
37
+ module_name = "_code_review_enforcement_constants_for_scripts"
38
+ cached_module = sys.modules.get(module_name)
39
+ if cached_module is not None:
40
+ return cached_module
41
+ module_spec = importlib.util.spec_from_file_location(
42
+ module_name,
43
+ constants_file_path,
44
+ )
45
+ if module_spec is None or module_spec.loader is None:
46
+ raise ImportError(
47
+ f"could not load code-review enforcement constants from {constants_file_path}"
48
+ )
49
+ constants_module = importlib.util.module_from_spec(module_spec)
50
+ sys.modules[module_name] = constants_module
51
+ module_spec.loader.exec_module(constants_module)
52
+ return constants_module
53
+
54
+
55
+ _ENFORCEMENT_CONSTANTS = _load_enforcement_constants_module()
56
+
57
+ ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER: tuple[str, ...] = (
58
+ _ENFORCEMENT_CONSTANTS.ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER
59
+ )
60
+ """Effort tokens ordered low to max; single source from enforcement constants."""
61
+
62
+ RECORD_STAMP_FLAG: str = _ENFORCEMENT_CONSTANTS.SANCTIONED_STAMP_MINTER_FLAG
63
+ """CLI flag that forces chain mode and mints a clean stamp on a stable pass."""
64
+
65
+ DEFAULT_CODE_REVIEW_EFFORT: str = "high"
66
+ """Default effort when the caller omits the positional effort token."""
67
+
11
68
  CODE_REVIEW_SLASH_COMMAND: str = "/code-review"
12
69
  """Built-in Claude Code slash command that runs the repository review."""
13
70
 
14
- CODE_REVIEW_EFFORT: str = "xhigh"
15
- """Effort level passed to the built-in review slash command."""
16
-
17
71
  CODE_REVIEW_FIX_FLAG: str = "--fix"
18
72
  """Slash-command flag that applies automatic fixes for review findings."""
19
73
 
20
- CODE_REVIEW_PROMPT: str = (
21
- f"{CODE_REVIEW_SLASH_COMMAND} {CODE_REVIEW_EFFORT} {CODE_REVIEW_FIX_FLAG}"
22
- )
23
- """Single-turn prompt that runs the built-in review slash command with fixes."""
24
-
25
74
  CODE_REVIEW_MODEL_ALIAS: str = "opus"
26
75
  """CLI `--model` short alias the review always pins to."""
27
76
 
@@ -69,3 +118,71 @@ HOST_PROFILE_ERROR_RETURNCODE: int = 1
69
118
 
70
119
  SUCCESSFUL_REVIEW_RETURNCODE: int = 0
71
120
  """Return code required before a clean stamp may advance past CODE_REVIEW."""
121
+
122
+ RESULT_KEY_STAMP_MINTED: str = "stamp_minted"
123
+ """JSON result key holding whether a clean stamp was written this run."""
124
+
125
+ RESULT_KEY_PASS_COUNT: str = "pass_count"
126
+ """JSON result key holding how many review passes the mint loop ran."""
127
+
128
+ RESULT_KEY_BOUND_HASH: str = "bound_hash"
129
+ """JSON result key holding the surface hash bound into a minted stamp, or null."""
130
+
131
+ CLI_EFFORT_METAVAR: str = "effort"
132
+ """Argparse metavar for the positional effort token."""
133
+
134
+ CLI_EFFORT_HELP: str = (
135
+ "Review effort token: low, medium, high, xhigh, or max "
136
+ "(ultra is rejected; default high)."
137
+ )
138
+ """Help text for the positional effort argument."""
139
+
140
+ CLI_RECORD_STAMP_HELP: str = (
141
+ "Force chain mode, loop a capped number of review passes, and mint a "
142
+ "clean stamp only when a pass exits 0 with a stable surface hash."
143
+ )
144
+ """Help text for the --record-stamp flag."""
145
+
146
+ INVALID_EFFORT_RETURNCODE: int = 2
147
+ """Return code when the caller passes an unknown or unsupported effort token."""
148
+
149
+ STAMP_DID_NOT_CONVERGE_RETURNCODE: int = 1
150
+ """Return code when the mint loop hits its pass cap without a stable clean pass."""
151
+
152
+ MAXIMUM_STAMP_MINT_PASSES: int = 3
153
+ """Cap on review passes under --record-stamp before the invoker gives up."""
154
+
155
+ EFFORT_TOKEN_LIST_SEPARATOR: str = ", "
156
+ """Separator used when listing allowed effort tokens in error messages."""
157
+
158
+ INVALID_EFFORT_MESSAGE: str = (
159
+ "invalid effort {effort!r}: must be one of {allowed}; "
160
+ "'ultra' is rejected because it requires an interactive terminal"
161
+ )
162
+ """Stderr template when the caller supplies an unknown or ultra effort token."""
163
+
164
+ STAMP_DID_NOT_CONVERGE_MESSAGE: str = (
165
+ "code-review stamp minting did not converge after {pass_count} passes "
166
+ "(surface kept changing or review return codes stayed non-zero); no stamp written"
167
+ )
168
+ """Stderr template when the mint loop hits the pass cap without minting."""
169
+
170
+ STAMP_STORE_IMPORT_FAILURE_MESSAGE: str = (
171
+ "code-review stamp store could not be imported for --record-stamp: {error}"
172
+ )
173
+ """Stderr template when --record-stamp cannot load the stamp store module."""
174
+
175
+ STAMP_STORE_MODULE_FILE_NAME: str = "code_review_stamp_store.py"
176
+ """File name of the stamp store module under hooks/blocking."""
177
+
178
+ STAMP_STORE_MODULE_NAME: str = "code_review_stamp_store"
179
+ """Import name of the stamp store module."""
180
+
181
+ STAMP_STORE_LIVE_SURFACE_HASH_NAME: str = "live_surface_hash"
182
+ """Attribute name of the live surface-hash helper on the stamp store module."""
183
+
184
+ STAMP_STORE_RECORD_CLEAN_STAMP_NAME: str = "record_clean_stamp"
185
+ """Attribute name of the stamp-mint helper on the stamp store module."""
186
+
187
+ STAMP_STORE_RESOLVE_REPO_ROOT_NAME: str = "resolve_repo_root"
188
+ """Attribute name of the repo-root resolver on the stamp store module."""
@@ -0,0 +1,55 @@
1
+ """Behavioral tests for the host-aware code-review invoker constants module.
2
+
3
+ These assert the single-source wiring: the effort tokens and the record-stamp
4
+ flag the invoker exposes are the exact values the hooks enforcement module
5
+ holds, so a threshold change in one place cannot drift the other.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import importlib.util
11
+ from pathlib import Path
12
+ from types import ModuleType
13
+
14
+ from dev_env_scripts_constants import code_review_constants as review_constants
15
+
16
+ _PACKAGE_ROOT = Path(__file__).resolve().parent.parent.parent
17
+ _ENFORCEMENT_CONSTANTS_PATH = (
18
+ _PACKAGE_ROOT
19
+ / "hooks"
20
+ / "blocking"
21
+ / "config"
22
+ / "code_review_enforcement_constants.py"
23
+ )
24
+
25
+
26
+ def _load_enforcement_module() -> ModuleType:
27
+ module_spec = importlib.util.spec_from_file_location(
28
+ "code_review_enforcement_constants_under_test", _ENFORCEMENT_CONSTANTS_PATH
29
+ )
30
+ assert module_spec is not None
31
+ assert module_spec.loader is not None
32
+ enforcement_module = importlib.util.module_from_spec(module_spec)
33
+ module_spec.loader.exec_module(enforcement_module)
34
+ return enforcement_module
35
+
36
+
37
+ def test_effort_tokens_reexport_the_enforcement_source() -> None:
38
+ enforcement_module = _load_enforcement_module()
39
+ assert review_constants.ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER == getattr(
40
+ enforcement_module, "ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER"
41
+ )
42
+
43
+
44
+ def test_record_stamp_flag_matches_sanctioned_minter_flag() -> None:
45
+ enforcement_module = _load_enforcement_module()
46
+ assert review_constants.RECORD_STAMP_FLAG == getattr(
47
+ enforcement_module, "SANCTIONED_STAMP_MINTER_FLAG"
48
+ )
49
+
50
+
51
+ def test_default_effort_is_a_known_token() -> None:
52
+ assert (
53
+ review_constants.DEFAULT_CODE_REVIEW_EFFORT
54
+ in review_constants.ALL_EFFORT_TOKENS_IN_ASCENDING_ORDER
55
+ )