claude-dev-env 8.6.0 → 8.7.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/.agents/skills/privacy-hygiene/reference/sweep-procedure.md +1 -1
- package/_shared/advisor/scripts/config/advisor_scripts_constants/model_tier_run_validator_constants.py +1 -0
- package/_shared/advisor/scripts/model_tier_run_validator.py +3 -2
- package/_shared/advisor/scripts/tests/test_model_tier_run_validator.py +35 -0
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/terminology_sweep_constants.py +4 -0
- package/_shared/pr-loop/scripts/terminology_sweep.py +155 -18
- package/_shared/pr-loop/scripts/tests/test_terminology_sweep.py +130 -0
- package/bin/install.test.mjs +25 -0
- package/docs/high-trust-agent-delivery.md +132 -0
- package/hooks/advisory/refactor_guard.py +2 -2
- package/hooks/advisory/test_refactor_guard.py +21 -0
- package/hooks/blocking/code_rules_enforcer_test_support.py +10 -0
- package/hooks/blocking/code_rules_shared.py +4 -7
- package/hooks/blocking/conftest.py +22 -0
- package/hooks/blocking/state_description_blocker.py +232 -90
- package/hooks/blocking/test_code_rules_enforcer_duplicate_body.py +2 -11
- package/hooks/blocking/test_code_rules_enforcer_duplicate_body_hook_routing.py +27 -54
- package/hooks/blocking/test_code_rules_enforcer_test_support.py +21 -0
- package/hooks/blocking/test_code_rules_enforcer_zero_payload_alias_hook_routing.py +3 -19
- package/hooks/blocking/test_code_rules_shared.py +18 -0
- package/hooks/blocking/test_conftest.py +35 -0
- package/hooks/blocking/test_state_description_blocker.py +59 -0
- package/hooks/git-hooks/git_hooks_constants/__init__.py +1 -14
- package/hooks/git-hooks/pull_request_handoff.py +2 -2
- package/hooks/git-hooks/test_config.py +10 -3
- package/hooks/git-hooks/test_pull_request_handoff.py +49 -0
- package/hooks/git-hooks/test_verification_notice_state.py +50 -0
- package/hooks/git-hooks/verification_notice_state.py +3 -1
- package/hooks/hooks_constants/code_rules_enforcer_constants.py +13 -5
- package/hooks/hooks_constants/refactor_guard_constants.py +2 -0
- package/hooks/hooks_constants/session_edit_stage_gate_constants.py +3 -4
- package/hooks/hooks_constants/state_description_blocker_constants.py +2 -1
- package/hooks/hooks_constants/test_state_description_blocker_constants.py +87 -0
- package/hooks/validators/exempt_paths.py +3 -18
- package/hooks/validators/test_exempt_paths.py +20 -0
- package/hooks/validators/test_python_antipattern_checks.py +14 -0
- package/package.json +1 -1
- package/rules/agent-merges-its-own-green-pull-request.md +54 -0
- package/rules/archiving-agent-config.md +10 -0
- package/rules/code-standards.md +1 -0
- package/rules/correction-lens.md +134 -0
- package/rules/flag-non-breaking-findings.md +11 -0
- package/rules/no-contrast-framing.md +68 -0
- package/rules/review-closure-is-a-check.md +44 -0
- package/scripts/Invoke-PesterSuites.ps1 +42 -0
- package/scripts/agent_merge_check.py +381 -0
- package/scripts/check.ps1 +12 -1
- package/scripts/ci/install-playtest.mjs +291 -0
- package/scripts/ci/install-playtest.test.mjs +84 -0
- package/scripts/ci/installer-lifecycle.mjs +11 -30
- package/scripts/ci/installer-lifecycle.test.mjs +14 -0
- package/scripts/ci/pstack-command-shim.test.mjs +33 -0
- package/scripts/ci/scratch-home-install.mjs +73 -0
- package/scripts/ci/scratch-home-install.test.mjs +49 -0
- package/scripts/codex_compat_materializer.py +33 -16
- package/scripts/contrast_framing.py +101 -0
- package/scripts/dev_env_scripts_constants/agent_merge_check_constants.py +121 -0
- package/scripts/dev_env_scripts_constants/contrast_framing_constants.py +82 -0
- package/scripts/dev_env_scripts_constants/merge_gate_check_constants.py +23 -0
- package/scripts/dev_env_scripts_constants/review_closure_constants.py +241 -0
- package/scripts/dev_env_scripts_constants/test_code_review_constants.py +12 -0
- package/scripts/dev_env_scripts_constants/test_contrast_framing_constants.py +60 -0
- package/scripts/durable_post_lint.py +30 -4
- package/scripts/followup_cli.py +6 -10
- package/scripts/merge_gate_checks.py +236 -0
- package/scripts/policy_lint/adapter_contrast_framing.py +59 -0
- package/scripts/policy_lint/adapter_detectors.py +1 -1
- package/scripts/policy_lint/adapter_support.py +3 -14
- package/scripts/policy_lint/adapters.py +30 -1
- package/scripts/policy_lint/config/constants.py +2 -0
- package/scripts/policy_lint/registry.py +5 -0
- package/scripts/repository_checks/config/constants.py +12 -0
- package/scripts/repository_checks/config/policy_document.py +28 -2
- package/scripts/repository_checks/followups.py +54 -0
- package/scripts/repository_checks/match_exemptions.py +67 -0
- package/scripts/repository_checks/models.py +46 -2
- package/scripts/repository_checks/reporting.py +23 -7
- package/scripts/repository_checks/tracked_secrets.py +2 -2
- package/scripts/repository_policy.py +4 -2
- package/scripts/review_closure.py +134 -0
- package/scripts/review_closure_github.py +345 -0
- package/scripts/review_closure_model.py +360 -0
- package/scripts/test_agent_merge_check.py +317 -0
- package/scripts/test_durable_post_lint.py +46 -0
- package/scripts/test_followup_cli.py +40 -0
- package/scripts/test_merge_gate_checks.py +92 -0
- package/scripts/tests/test_code_review_constants.py +78 -0
- package/scripts/tests/test_codex_compat_materializer.py +48 -4
- package/scripts/tests/test_contrast_framing.py +117 -0
- package/scripts/tests/test_followups.py +88 -0
- package/scripts/tests/test_match_exemptions.py +291 -0
- package/scripts/tests/test_models.py +67 -2
- package/scripts/tests/test_package_inventory.py +6 -4
- package/scripts/tests/test_pester_suites_run.py +53 -0
- package/scripts/tests/test_policy_document.py +39 -1
- package/scripts/tests/test_policy_lint_rules_contrast_framing.py +68 -0
- package/scripts/tests/test_policy_lint_rules_engine.py +4 -1
- package/scripts/tests/test_reporting.py +18 -0
- package/scripts/tests/test_repository_policy.py +43 -1
- package/scripts/tests/test_review_closure.py +126 -0
- package/scripts/tests/test_review_closure_github.py +240 -0
- package/scripts/tests/test_review_closure_model.py +299 -0
- package/scripts/tests/test_tracked_secrets.py +42 -0
- package/hooks/hooks_constants/precommit_code_rules_gate_constants.py +0 -12
- package/scripts/repository_checks/email_exemptions.py +0 -39
- package/scripts/tests/test_email_exemptions.py +0 -158
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Building a high trust system for agent driven software delivery
|
|
2
|
+
|
|
3
|
+
Source: https://x.com/poteto/status/2102050467505430555/video/1
|
|
4
|
+
|
|
5
|
+
This document carries the model behind [`rules/correction-lens.md`](../rules/correction-lens.md).
|
|
6
|
+
|
|
7
|
+
## The central idea
|
|
8
|
+
|
|
9
|
+
Lauren's 2,000 pull requests came after she built a system that let agents do useful work while she was away.
|
|
10
|
+
|
|
11
|
+
The system had several parts. The codebase showed agents the preferred patterns. Tools let agents run the product and gather evidence. Continuous integration, or CI, checked every proposed change. Rules and review bots caught repeated mistakes. Skills taught agents how to perform work in the team's preferred way. Automations connected incoming problems to agents that could investigate them.
|
|
12
|
+
|
|
13
|
+
These parts created trust over time. An agent earned more freedom by showing that it could make a change, check the result, respond to failures, and open a pull request that met the repository's standards.
|
|
14
|
+
|
|
15
|
+
The goal for a repository is clear. An agent should be able to take a task through the full path to a pull request. The repository should provide enough evidence for a merge decision without requiring a person to inspect every changed line.
|
|
16
|
+
|
|
17
|
+
## Why high volume exposes weak systems
|
|
18
|
+
|
|
19
|
+
When people first work with agents, they often watch every conversation. They correct the agent's approach, stop mistakes, and supply missing context. That works for a small number of tasks. It breaks when many agents work at the same time.
|
|
20
|
+
|
|
21
|
+
A large group of agents multiplies whatever the repository already permits. If the checks are weak, the team receives many noisy pull requests. Regressions and bugs spread faster. The team spends its time repairing agent output, and the product waits.
|
|
22
|
+
|
|
23
|
+
The answer is to build trust before adding more agents. Start with a small workflow that an agent can repeat. Watch the failures. Turn each repeated correction into a stronger control. Increase the number of agents after the controls catch the common mistakes.
|
|
24
|
+
|
|
25
|
+
The high pull request count is the result of this work. The first target is a system that can check changes without waiting for one person.
|
|
26
|
+
|
|
27
|
+
## Verification gives the agent evidence
|
|
28
|
+
|
|
29
|
+
Verification asks whether the code does what the feature needs. A checkout button should complete a checkout. A changed screen should respond to the user's action. A performance change should meet a measured limit.
|
|
30
|
+
|
|
31
|
+
Teach the agent how to start the product, reach a feature, perform the relevant action, and inspect the result. The agent can collect a browser trace, a memory snapshot, a test result, or a performance measurement. The evidence should come from a repeatable procedure.
|
|
32
|
+
|
|
33
|
+
A useful verification setup has two parts. The first is a command line tool that runs the product and collects the required evidence. The second is a feature map that explains how the product works.
|
|
34
|
+
|
|
35
|
+
The command line tool gives every agent session the same procedure. Agents do not invent a new test script for every task. The tool supplies the commands, inputs, and output format. Invest in the important product paths so the tool can handle the work agents perform often.
|
|
36
|
+
|
|
37
|
+
The feature map gives the agent context that a short bug report often lacks. It describes the product's features, the paths a user takes to reach them, the controls that matter, and the expected result. Keep the map with the repository and maintain it as the product changes.
|
|
38
|
+
|
|
39
|
+
The tool and the map work together. The agent can reproduce a report, inspect the product, collect evidence, and explain the result. This turns verification into a shared team capability.
|
|
40
|
+
|
|
41
|
+
Verification does not answer every quality question. It shows that the feature works during the check. It does not by itself show that the code is easy to maintain, that the performance will stay within limits, or that the change follows the team's design rules.
|
|
42
|
+
|
|
43
|
+
Add skills for those questions. A skill can teach an agent how to debug, develop a feature, refactor code, inspect performance, or review a change. Keep the skills in a shared repository. Combine them with verification so the agent can check behavior and code quality.
|
|
44
|
+
|
|
45
|
+
Measured data makes this process stronger. Performance numbers, memory measurements, error counts, and test results give the agent something to inspect. The agent can respond to a number more reliably than to a vague instruction such as "make this faster."
|
|
46
|
+
|
|
47
|
+
## The codebase is part of the control system
|
|
48
|
+
|
|
49
|
+
Agents extend the patterns they find in the files they read. The codebase becomes working memory for the agent. An agent usually adapts an existing structure to a new task. It rarely redesigns the whole system during each pull request.
|
|
50
|
+
|
|
51
|
+
This gives the codebase a direct effect on future changes. One clear pattern reduces guessing. Several conflicting patterns force the agent to choose. The repository should make the safe choice easy to find and easy to repeat.
|
|
52
|
+
|
|
53
|
+
Start with the code structure. Change the design so that a bad pattern cannot be expressed, or so that the preferred pattern is the easiest path. Good data structures and clear boundaries can remove entire classes of errors.
|
|
54
|
+
|
|
55
|
+
Make each feature easy to locate. Define where its code lives. Define how it connects to other parts of the product. Define which parts may import each other. A clear layout gives the agent a smaller search space and fewer decisions.
|
|
56
|
+
|
|
57
|
+
The framework Lauren describes follows this idea. It sets conventions for code location and dependency boundaries. A performance problem caused by code crossing into the wrong process can become impossible through import rules. The method carries. Put team knowledge into code structure so agents find it while they work.
|
|
58
|
+
|
|
59
|
+
Strict conventions may feel inconvenient to people who already know the system. They help agents and new contributors because the repository answers more questions by itself. A designer, product manager, or busy engineer can ask an agent to make a change and still benefit from the same safe paths.
|
|
60
|
+
|
|
61
|
+
## Build controls in layers
|
|
62
|
+
|
|
63
|
+
The controls work best in a clear order. Each layer handles a different kind of mistake.
|
|
64
|
+
|
|
65
|
+
First, make the mistake impossible through the code structure, architecture, or data model. This is the strongest control because the agent cannot choose the bad pattern.
|
|
66
|
+
|
|
67
|
+
Second, add static checks. Linters, compiler diagnostics, type checks, and CI inspect every proposed change. Continuous integration means that the repository runs the required checks for each pull request. When an agent repeats a mistake, turn the mistake into a check that runs every time.
|
|
68
|
+
|
|
69
|
+
Third, add rules, automated review, and skills. These explain how the team wants work done. They help with decisions that are difficult to encode in code or static checks. A rule can describe a preferred pattern. A review bot can point out a problem. A skill can give the agent a repeatable procedure.
|
|
70
|
+
|
|
71
|
+
Fourth, keep human review for judgment that the lower layers cannot express. People can decide whether a change fits the product, whether the design is sound, or whether a tradeoff is acceptable. People should not spend every review repeating the same correction that a check could catch.
|
|
72
|
+
|
|
73
|
+
Every repeated review comment is evidence that a lower layer needs improvement. Move that lesson into the code structure, a static check, CI, an automated review, or a skill. This gives the next agent the lesson without requiring a person to repeat it.
|
|
74
|
+
|
|
75
|
+
## Turn corrections into repository improvements
|
|
76
|
+
|
|
77
|
+
An agent correction should change the system when the same mistake can happen again. Fixing one pull request removes one symptom. Adding a control protects later pull requests.
|
|
78
|
+
|
|
79
|
+
Suppose an agent copies a workaround. Remove the workaround where possible. Add a rule that prevents new copies. Add a skill that explains the preferred solution. Ask an agent to clean the old copies so the repository presents better examples.
|
|
80
|
+
|
|
81
|
+
Lauren gives comments as one example. Comments can explain an edge case or a temporary workaround. In the Cursor codebase, agents began using comments as permission to keep workarounds, and the underlying problem stayed. The team chose to ban comments in Dune so agents would stop copying that pattern.
|
|
82
|
+
|
|
83
|
+
The same reasoning applies to any pattern that creates poor code. When a pattern keeps appearing, decide which control should own the correction. Put the knowledge in the repository, where every later session reads it.
|
|
84
|
+
|
|
85
|
+
This maintenance role is like gardening. Someone needs to look for small workarounds, weak patterns, and new code debt before they spread. That person removes old debt, keeps one conventional path for common work, and adds a check when a bad pattern appears.
|
|
86
|
+
|
|
87
|
+
The standard is simple. Keep the repository in a state that you would want an agent to copy. Every example teaches the next agent what to do.
|
|
88
|
+
|
|
89
|
+
## The inner delivery loop
|
|
90
|
+
|
|
91
|
+
The inner loop is the path from a task to a pull request. A dependable repository gives the agent a repeatable sequence.
|
|
92
|
+
|
|
93
|
+
1. The agent receives a task with enough context to identify the relevant feature and code.
|
|
94
|
+
2. The agent makes the smallest change that solves the task.
|
|
95
|
+
3. The agent runs the product or the relevant tests through the shared verification tools.
|
|
96
|
+
4. The agent collects evidence about behavior, performance, and other required limits.
|
|
97
|
+
5. CI, static checks, repository rules, and automated review inspect the change.
|
|
98
|
+
6. The agent responds to failures, repairs the change, and runs the checks again.
|
|
99
|
+
7. The agent opens or updates the pull request with the evidence.
|
|
100
|
+
8. The repository grants merge permission after the required checks pass and the remaining judgment calls are settled.
|
|
101
|
+
|
|
102
|
+
The agent earns freedom through this loop. The system depends on the agent producing evidence that the repository can inspect.
|
|
103
|
+
|
|
104
|
+
## The outer delivery loop
|
|
105
|
+
|
|
106
|
+
Work can begin outside the code editor. A message, error report, performance alert, or product signal can start the next task.
|
|
107
|
+
|
|
108
|
+
Connect an agent to the tools that hold this information. The talk mentions Slack, an error tracker, performance data, and a database service. The exact tools depend on the repository. The important point is that the agent can gather enough context to decide what happened and what task should follow.
|
|
109
|
+
|
|
110
|
+
A routine can watch a message or an alert and start an agent. The agent can reproduce the problem, make a change, run the checks, and open a pull request. Other bots can call the same verification tools, repository rules, and skills for more complex work.
|
|
111
|
+
|
|
112
|
+
A set of small connections can start useful work. The repository supplies the controls. The agent calls the tools. CI and review inspect the result.
|
|
113
|
+
|
|
114
|
+
## How the pieces compound
|
|
115
|
+
|
|
116
|
+
Each control improves the next one. A clear code pattern gives the agent a safe starting point. The verification tool gives it product evidence. CI catches repeatable mistakes. Automated review finds code quality problems. Skills give the agent procedures for work that needs more judgment. The outer loop supplies new tasks.
|
|
117
|
+
|
|
118
|
+
Together, these controls let many agents work in parallel. The agents do not need a person to approve every small action because the environment checks the work. People can focus on product decisions, system design, and questions that the checks cannot settle.
|
|
119
|
+
|
|
120
|
+
The result is a repository where an agent with limited context can still make a good change. The environment carries the team's knowledge. The agent follows the safe paths. The pull request provides evidence for its merge decision.
|
|
121
|
+
|
|
122
|
+
## A practical way to apply the model
|
|
123
|
+
|
|
124
|
+
Start with one recurring task. Give an agent a fixed way to run the relevant part of the product and collect evidence. Record the expected result. Run the same procedure for several changes and study the failures.
|
|
125
|
+
|
|
126
|
+
When a failure repeats, ask where the correction belongs. Change the code structure if the pattern can be removed. Add a static check or CI step if the problem can be detected. Add a rule, review bot, or skill when the decision needs guidance. Improve human review when the question still needs judgment.
|
|
127
|
+
|
|
128
|
+
Keep the codebase clean as the agent population grows. Remove workarounds. Reduce competing patterns. Add one clear path for common work. Maintain the feature map and verification tools as part of the repository.
|
|
129
|
+
|
|
130
|
+
Then connect incoming signals to the same workflow. Let an agent start from a bug report or alert, reproduce the problem, make the change, run the checks, and open the pull request. Increase parallel work after the system can catch the mistakes that matter.
|
|
131
|
+
|
|
132
|
+
The key lesson is to move knowledge out of individual conversations and into the environment. A person teaches the system once. The repository, checks, tools, and skills carry that lesson into every later pull request.
|
|
@@ -23,14 +23,14 @@ try:
|
|
|
23
23
|
sys.path.insert(0, hooks_root_directory)
|
|
24
24
|
|
|
25
25
|
from hooks_constants.multi_edit_reconstruction import edits_for_tool
|
|
26
|
-
from hooks_constants.precommit_code_rules_gate_constants import GIT_COMMAND_TIMEOUT_SECONDS
|
|
27
26
|
from hooks_constants.refactor_guard_constants import (
|
|
28
27
|
ALL_PYTHON_KEYWORDS,
|
|
29
28
|
CHANGED_SURFACE_MATCH_RATIO,
|
|
29
|
+
GIT_COMMAND_TIMEOUT_SECONDS,
|
|
30
|
+
GIT_EXECUTABLE_TOKEN,
|
|
30
31
|
MAXIMUM_REFACTOR_LINE_DELTA,
|
|
31
32
|
REFACTOR_LINE_DELTA_DIVISOR,
|
|
32
33
|
)
|
|
33
|
-
from hooks_constants.session_edit_stage_gate_constants import GIT_EXECUTABLE_TOKEN
|
|
34
34
|
except ImportError as import_error:
|
|
35
35
|
raise ImportError(
|
|
36
36
|
"refactor_guard: cannot import its sibling modules; "
|
|
@@ -125,3 +125,24 @@ def test_untracked_probe_should_start_without_a_console_window(
|
|
|
125
125
|
|
|
126
126
|
assert refactor_guard.is_new_file(str(tmp_path / "module.py")) is True
|
|
127
127
|
assert all_recorded_keyword_arguments["creationflags"] == EXPECTED_HIDDEN_WINDOW_FLAGS
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_the_git_query_carries_the_advisory_s_own_executable_and_timeout(
|
|
131
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
132
|
+
) -> None:
|
|
133
|
+
"""refactor_guard_constants supplies both names the git call is built from."""
|
|
134
|
+
all_calls: list[tuple[list[str], object]] = []
|
|
135
|
+
|
|
136
|
+
def record_call(
|
|
137
|
+
command: list[str], **keyword_arguments: object
|
|
138
|
+
) -> subprocess.CompletedProcess[str]:
|
|
139
|
+
all_calls.append((command, keyword_arguments["timeout"]))
|
|
140
|
+
return subprocess.CompletedProcess(command, 1, "", "")
|
|
141
|
+
|
|
142
|
+
monkeypatch.setattr(refactor_guard.subprocess, "run", record_call)
|
|
143
|
+
|
|
144
|
+
refactor_guard.is_new_file(str(tmp_path / "module.py"))
|
|
145
|
+
|
|
146
|
+
command, timeout = all_calls[0]
|
|
147
|
+
assert command[:2] == ["git", "ls-files"]
|
|
148
|
+
assert timeout == refactor_guard.GIT_COMMAND_TIMEOUT_SECONDS
|
|
@@ -13,6 +13,16 @@ from pathlib import Path
|
|
|
13
13
|
|
|
14
14
|
_ENFORCER_SCRIPT_PATH = Path(__file__).with_name("code_rules_enforcer.py")
|
|
15
15
|
|
|
16
|
+
STRIP_CODE_AND_QUOTES_SOURCE = (
|
|
17
|
+
"import re\n"
|
|
18
|
+
"\n"
|
|
19
|
+
"def strip_code_and_quotes(text: str) -> str:\n"
|
|
20
|
+
" without_fences = re.sub(r'```.*?```', '', text, flags=re.DOTALL)\n"
|
|
21
|
+
" without_inline = re.sub(r'`[^`]*`', '', without_fences)\n"
|
|
22
|
+
" without_quotes = re.sub(r'(?m)^>.*$', '', without_inline)\n"
|
|
23
|
+
" return without_quotes.strip()\n"
|
|
24
|
+
)
|
|
25
|
+
|
|
16
26
|
|
|
17
27
|
def repository_root() -> Path:
|
|
18
28
|
"""Return the root of the checkout these tests run inside.
|
|
@@ -48,7 +48,7 @@ def get_file_extension(file_path: str) -> str:
|
|
|
48
48
|
def is_hook_infrastructure(file_path: str) -> bool:
|
|
49
49
|
"""Check if file is a Claude Code hook (standalone infrastructure, not project code)."""
|
|
50
50
|
path_lower = "/" + file_path.lower().replace("\\", "/").lstrip("/")
|
|
51
|
-
return any(pattern
|
|
51
|
+
return any(pattern in path_lower for pattern in ALL_HOOK_INFRASTRUCTURE_PATTERNS)
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
def is_agent_home_tooling(file_path: str) -> bool:
|
|
@@ -66,10 +66,7 @@ def is_agent_home_tooling(file_path: str) -> bool:
|
|
|
66
66
|
True when the path sits under a recognized agent home directory.
|
|
67
67
|
"""
|
|
68
68
|
path_lower = "/" + file_path.lower().replace("\\", "/").lstrip("/")
|
|
69
|
-
return any(
|
|
70
|
-
each_pattern.replace("\\", "/") in path_lower
|
|
71
|
-
for each_pattern in ALL_AGENT_HOME_TOOLING_PATTERNS
|
|
72
|
-
)
|
|
69
|
+
return any(each_pattern in path_lower for each_pattern in ALL_AGENT_HOME_TOOLING_PATTERNS)
|
|
73
70
|
|
|
74
71
|
|
|
75
72
|
def is_test_file(file_path: str) -> bool:
|
|
@@ -106,7 +103,7 @@ def is_workflow_registry_file(file_path: str) -> bool:
|
|
|
106
103
|
These are module-level singletons, not misplaced literal constants.
|
|
107
104
|
"""
|
|
108
105
|
path_lower = file_path.lower().replace("\\", "/")
|
|
109
|
-
return any(pattern
|
|
106
|
+
return any(pattern in path_lower for pattern in ALL_WORKFLOW_REGISTRY_PATTERNS)
|
|
110
107
|
|
|
111
108
|
|
|
112
109
|
def is_spec_file(file_path: str) -> bool:
|
|
@@ -523,7 +520,7 @@ def _is_dedicated_constants_module(file_path: str) -> bool:
|
|
|
523
520
|
def is_migration_file(file_path: str) -> bool:
|
|
524
521
|
"""Check if file is a Django migration (must be self-contained)."""
|
|
525
522
|
path_lower = file_path.lower().replace("\\", "/")
|
|
526
|
-
return any(pattern
|
|
523
|
+
return any(pattern in path_lower for pattern in ALL_MIGRATION_PATH_PATTERNS)
|
|
527
524
|
|
|
528
525
|
|
|
529
526
|
def docstring_line_numbers(content: str) -> set[int]:
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"""Add hooks/blocking and hooks/ to sys.path for every test collected under this directory."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import shutil
|
|
4
5
|
import subprocess
|
|
5
6
|
import sys
|
|
7
|
+
import tempfile
|
|
8
|
+
from collections.abc import Iterator
|
|
6
9
|
from pathlib import Path
|
|
7
10
|
from typing import Callable
|
|
8
11
|
|
|
@@ -14,6 +17,25 @@ for each_directory in (_BLOCKING_DIRECTORY, _HOOKS_DIRECTORY):
|
|
|
14
17
|
if each_directory not in sys.path:
|
|
15
18
|
sys.path.insert(0, each_directory)
|
|
16
19
|
|
|
20
|
+
_HOOK_INFRASTRUCTURE_TAIL = Path("packages") / "claude-dev-env" / "hooks" / "blocking"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@pytest.fixture
|
|
24
|
+
def hook_blocking_dir() -> Iterator[Path]:
|
|
25
|
+
"""Build a temporary tree whose tail mirrors a production hook directory.
|
|
26
|
+
|
|
27
|
+
``is_hook_infrastructure`` matches on the path tail, so a target inside
|
|
28
|
+
the yielded directory routes the way a
|
|
29
|
+
``packages/claude-dev-env/hooks/blocking`` target does.
|
|
30
|
+
"""
|
|
31
|
+
base_directory = Path(tempfile.mkdtemp())
|
|
32
|
+
blocking_directory = base_directory / _HOOK_INFRASTRUCTURE_TAIL
|
|
33
|
+
blocking_directory.mkdir(parents=True)
|
|
34
|
+
try:
|
|
35
|
+
yield blocking_directory
|
|
36
|
+
finally:
|
|
37
|
+
shutil.rmtree(base_directory, ignore_errors=False)
|
|
38
|
+
|
|
17
39
|
|
|
18
40
|
@pytest.fixture
|
|
19
41
|
def three_operation_patch() -> str:
|