claude-dev-env 2.13.0 → 2.14.1
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.md +135 -0
- package/CLAUDE.md +1 -57
- package/_shared/AGENTS.md +15 -0
- package/_shared/CLAUDE.md +1 -15
- package/_shared/advisor/AGENTS.md +22 -0
- package/_shared/advisor/CLAUDE.md +1 -22
- package/_shared/pr-loop/AGENTS.md +27 -0
- package/_shared/pr-loop/CLAUDE.md +1 -27
- package/_shared/pr-loop/scripts/AGENTS.md +35 -0
- package/_shared/pr-loop/scripts/CLAUDE.md +1 -35
- package/_shared/pr-loop/scripts/code_rules_gate_parts/AGENTS.md +42 -0
- package/_shared/pr-loop/scripts/code_rules_gate_parts/CLAUDE.md +1 -42
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/AGENTS.md +26 -0
- package/_shared/pr-loop/scripts/pr_loop_shared_constants/CLAUDE.md +1 -26
- package/_shared/pr-loop/scripts/tests/AGENTS.md +44 -0
- package/_shared/pr-loop/scripts/tests/CLAUDE.md +1 -44
- package/_shared/process-tree/AGENTS.md +41 -0
- package/_shared/process-tree/CLAUDE.md +1 -41
- package/agents/AGENTS.md +26 -0
- package/agents/CLAUDE.md +1 -31
- package/agents/clean-coder.md +6 -6
- package/agents/test_agent_frontmatter.py +11 -11
- package/audit-rubrics/AGENTS.md +43 -0
- package/audit-rubrics/CLAUDE.md +1 -43
- package/audit-rubrics/category_rubrics/AGENTS.md +37 -0
- package/audit-rubrics/category_rubrics/CLAUDE.md +1 -37
- package/audit-rubrics/prompts/AGENTS.md +37 -0
- package/audit-rubrics/prompts/CLAUDE.md +1 -37
- package/bin/AGENTS.md +112 -0
- package/bin/CLAUDE.md +1 -112
- package/bin/ever-shipped-skills.mjs +1 -0
- package/bin/install-constants.mjs +6 -7
- package/bin/install.mjs +24 -5
- package/bin/install.test.mjs +34 -0
- package/commands/AGENTS.md +13 -0
- package/commands/CLAUDE.md +1 -23
- package/docs/AGENTS.md +32 -0
- package/docs/CLAUDE.md +1 -32
- package/docs/CODE_RULES.md +1 -1
- package/docs/imagegen.md +22 -0
- package/docs/references/AGENTS.md +17 -0
- package/docs/references/CLAUDE.md +1 -17
- package/hooks/AGENTS.md +31 -0
- package/hooks/CLAUDE.md +1 -31
- package/hooks/_gh_pr_author_swap_utils.py +14 -0
- package/hooks/advisory/AGENTS.md +16 -0
- package/hooks/advisory/CLAUDE.md +1 -16
- package/hooks/blocking/AGENTS.md +123 -0
- package/hooks/blocking/CLAUDE.md +1 -123
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/AGENTS.md +28 -0
- package/hooks/blocking/claude_md_orphan_file_blocker_parts/CLAUDE.md +1 -28
- package/hooks/blocking/code_rules_banned_identifiers.py +1 -1
- package/hooks/blocking/code_rules_dead_module_constant.py +149 -37
- package/hooks/blocking/code_rules_probe_chains.py +6 -2
- package/hooks/blocking/config/AGENTS.md +10 -0
- package/hooks/blocking/config/CLAUDE.md +1 -10
- package/hooks/blocking/gh_pr_author_restore.py +7 -2
- package/hooks/blocking/intent_only_ending_blocker.py +11 -16
- package/hooks/blocking/inventory_intent_records/AGENTS.md +26 -0
- package/hooks/blocking/inventory_intent_records/CLAUDE.md +1 -26
- package/hooks/blocking/package_inventory_stale_blocker_parts/AGENTS.md +26 -0
- package/hooks/blocking/package_inventory_stale_blocker_parts/CLAUDE.md +1 -26
- package/hooks/blocking/pii_prevention_blocker_parts/AGENTS.md +24 -0
- package/hooks/blocking/pii_prevention_blocker_parts/CLAUDE.md +1 -24
- package/hooks/blocking/tdd_enforcer_parts/AGENTS.md +30 -0
- package/hooks/blocking/tdd_enforcer_parts/CLAUDE.md +1 -30
- package/hooks/blocking/test_claude_md_orphan_file_blocker.py +1 -1
- package/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py +1 -1
- package/hooks/blocking/test_code_rules_enforcer_dead_module_constant.py +171 -0
- package/hooks/blocking/test_code_rules_enforcer_magic_allowlist.py +1 -1
- package/hooks/blocking/test_gh_pr_author_restore.py +2 -1
- package/hooks/blocking/test_intent_only_ending_blocker.py +4 -0
- package/hooks/diagnostic/AGENTS.md +75 -0
- package/hooks/diagnostic/CLAUDE.md +1 -43
- package/hooks/diagnostic/hook_log_extractor.py +2 -2
- package/hooks/diagnostic/hook_log_init.py +2 -2
- package/hooks/diagnostic/migrations/AGENTS.md +16 -0
- package/hooks/diagnostic/migrations/CLAUDE.md +1 -16
- package/hooks/diagnostic/queries/AGENTS.md +19 -0
- package/hooks/diagnostic/queries/CLAUDE.md +1 -19
- package/hooks/diagnostic/test_hook_log_extractor.py +2 -2
- package/hooks/git-hooks/AGENTS.md +31 -0
- package/hooks/git-hooks/CLAUDE.md +1 -31
- package/hooks/git-hooks/git_hooks_constants/AGENTS.md +21 -0
- package/hooks/git-hooks/git_hooks_constants/CLAUDE.md +1 -21
- package/hooks/git-hooks/git_hooks_constants/__init__.py +4 -6
- package/hooks/git-hooks/pre_push.py +47 -34
- package/hooks/git-hooks/test_pre_push.py +111 -7
- package/hooks/hooks_constants/AGENTS.md +104 -0
- package/hooks/hooks_constants/CLAUDE.md +1 -104
- package/hooks/hooks_constants/hook_log_extractor_constants.py +1 -2
- package/hooks/hooks_constants/task_list_loop_starter_constants.py +4 -3
- package/hooks/hooks_constants/working_style_prompt_constants.py +29 -20
- package/hooks/lifecycle/AGENTS.md +18 -0
- package/hooks/lifecycle/CLAUDE.md +1 -18
- package/hooks/observability/AGENTS.md +20 -0
- package/hooks/observability/CLAUDE.md +1 -20
- package/hooks/session/AGENTS.md +33 -0
- package/hooks/session/CLAUDE.md +1 -33
- package/hooks/session/gh_pr_author_session_cleanup.py +7 -2
- package/hooks/session/task_list_loop_starter.py +3 -3
- package/hooks/session/test_gh_pr_author_session_cleanup.py +2 -1
- package/hooks/session/test_task_list_loop_starter.py +10 -2
- package/hooks/session/test_working_style_prompt.py +9 -4
- package/hooks/validation/AGENTS.md +20 -0
- package/hooks/validation/CLAUDE.md +1 -20
- package/hooks/validators/AGENTS.md +51 -0
- package/hooks/validators/CLAUDE.md +1 -51
- package/hooks/validators/health_check.py +52 -19
- package/hooks/validators/python_style_checks.py +1 -1
- package/hooks/validators/test_health_check.py +112 -27
- package/hooks/workflow/AGENTS.md +16 -0
- package/hooks/workflow/CLAUDE.md +1 -16
- package/installable-surfaces.manifest.json +1 -0
- package/output-styles/AGENTS.md +15 -0
- package/output-styles/CLAUDE.md +1 -15
- package/package.json +2 -1
- package/rules/AGENTS.md +61 -0
- package/rules/CLAUDE.md +1 -61
- package/rules/code-standards.md +5 -9
- package/rules/doc-prose-cuts.md +1 -1
- package/scripts/AGENTS.md +62 -0
- package/scripts/CLAUDE.md +1 -62
- package/scripts/codex_compat_materializer.py +4 -0
- package/scripts/dev_env_scripts_constants/AGENTS.md +21 -0
- package/scripts/dev_env_scripts_constants/CLAUDE.md +1 -21
- package/scripts/sync_to_cursor/AGENTS.md +23 -0
- package/scripts/sync_to_cursor/CLAUDE.md +1 -23
- package/scripts/test_active_capability_references.py +2 -2
- package/scripts/test_validate_instruction_pairs.py +90 -0
- package/scripts/test_verify_installable_package.py +5 -1
- package/scripts/tests/AGENTS.md +33 -0
- package/scripts/tests/CLAUDE.md +1 -33
- package/scripts/tests/test_codex_compat_materializer.py +36 -1
- package/scripts/validate_instruction_pairs.py +183 -0
- package/skills/AGENTS.md +72 -0
- package/skills/CLAUDE.md +1 -72
- package/skills/_shared/AGENTS.md +44 -0
- package/skills/_shared/CLAUDE.md +1 -44
- package/skills/_shared/advisor/AGENTS.md +9 -0
- package/skills/_shared/advisor/CLAUDE.md +1 -9
- package/skills/_shared/pr-loop/AGENTS.md +50 -0
- package/skills/_shared/pr-loop/CLAUDE.md +1 -50
- package/skills/_shared/pr-loop/prompts/AGENTS.md +9 -0
- package/skills/_shared/pr-loop/prompts/CLAUDE.md +1 -9
- package/skills/_shared/pr-loop/scripts/AGENTS.md +35 -0
- package/skills/_shared/pr-loop/scripts/CLAUDE.md +1 -35
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/AGENTS.md +24 -0
- package/skills/_shared/pr-loop/scripts/skills_pr_loop_constants/CLAUDE.md +1 -24
- package/skills/anthropic-plan/AGENTS.md +34 -0
- package/skills/anthropic-plan/CLAUDE.md +1 -34
- package/skills/anthropic-plan/SKILL.md +1 -1
- package/skills/anthropic-plan/scripts/AGENTS.md +11 -0
- package/skills/anthropic-plan/scripts/CLAUDE.md +1 -11
- package/skills/anthropic-plan/scripts/anthropic_plan_scripts_constants/AGENTS.md +16 -0
- package/skills/anthropic-plan/scripts/anthropic_plan_scripts_constants/CLAUDE.md +1 -16
- package/skills/anthropic-plan/templates/AGENTS.md +13 -0
- package/skills/anthropic-plan/templates/CLAUDE.md +1 -13
- package/skills/anthropic-plan/test_skill_contract.py +8 -6
- package/skills/anthropic-plan/workflow/AGENTS.md +14 -0
- package/skills/anthropic-plan/workflow/CLAUDE.md +1 -14
- package/skills/auditing-claude-config/AGENTS.md +21 -0
- package/skills/auditing-claude-config/CLAUDE.md +1 -21
- package/skills/autoconverge/AGENTS.md +36 -0
- package/skills/autoconverge/CLAUDE.md +1 -36
- package/skills/autoconverge/reference/AGENTS.md +16 -0
- package/skills/autoconverge/reference/CLAUDE.md +1 -16
- package/skills/autoconverge/workflow/AGENTS.md +26 -0
- package/skills/autoconverge/workflow/CLAUDE.md +1 -26
- package/skills/autoconverge/workflow/autoconverge_report_constants/AGENTS.md +16 -0
- package/skills/autoconverge/workflow/autoconverge_report_constants/CLAUDE.md +1 -16
- package/skills/bugteam/AGENTS.md +30 -0
- package/skills/bugteam/CLAUDE.md +1 -30
- package/skills/bugteam/reference/AGENTS.md +20 -0
- package/skills/bugteam/reference/CLAUDE.md +1 -20
- package/skills/bugteam/reference/obstacles/AGENTS.md +24 -0
- package/skills/bugteam/reference/obstacles/CLAUDE.md +1 -24
- package/skills/bugteam/scripts/AGENTS.md +30 -0
- package/skills/bugteam/scripts/CLAUDE.md +1 -30
- package/skills/bugteam/scripts/bugteam_scripts_constants/AGENTS.md +18 -0
- package/skills/bugteam/scripts/bugteam_scripts_constants/CLAUDE.md +1 -18
- package/skills/closeout/reference/handoff-prompt-template.md +1 -1
- package/skills/codex-review/AGENTS.md +46 -0
- package/skills/codex-review/CLAUDE.md +1 -46
- package/skills/codex-review/reference/AGENTS.md +15 -0
- package/skills/codex-review/reference/CLAUDE.md +1 -15
- package/skills/codex-review/scripts/codex_review_scripts_constants/AGENTS.md +18 -0
- package/skills/codex-review/scripts/codex_review_scripts_constants/CLAUDE.md +1 -18
- package/skills/codex-review/test_skill_scaffold.py +3 -3
- package/skills/copilot-review/AGENTS.md +18 -0
- package/skills/copilot-review/CLAUDE.md +1 -18
- package/skills/everything-search/AGENTS.md +17 -0
- package/skills/everything-search/CLAUDE.md +1 -17
- package/skills/fresh-branch/AGENTS.md +14 -0
- package/skills/fresh-branch/CLAUDE.md +1 -14
- package/skills/grok-spawn/AGENTS.md +28 -0
- package/skills/grok-spawn/CLAUDE.md +1 -28
- package/skills/pr-converge/AGENTS.md +32 -0
- package/skills/pr-converge/CLAUDE.md +1 -32
- package/skills/pr-converge/pr_converge_skill_constants/AGENTS.md +26 -0
- package/skills/pr-converge/pr_converge_skill_constants/CLAUDE.md +1 -26
- package/skills/pr-converge/reference/AGENTS.md +28 -0
- package/skills/pr-converge/reference/CLAUDE.md +1 -28
- package/skills/pr-converge/reference/obstacles/AGENTS.md +23 -0
- package/skills/pr-converge/reference/obstacles/CLAUDE.md +1 -23
- package/skills/pr-converge/scripts/AGENTS.md +46 -0
- package/skills/pr-converge/scripts/CLAUDE.md +1 -46
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/AGENTS.md +18 -0
- package/skills/pr-converge/scripts/pr_converge_scripts_constants/CLAUDE.md +1 -18
- package/skills/pr-converge/workflows/AGENTS.md +16 -0
- package/skills/pr-converge/workflows/CLAUDE.md +1 -16
- package/skills/prototype/SKILL.md +1 -2
- package/skills/prototype/reference/honest-limitations.md +1 -1
- package/skills/prototype/reference/promotion-tasks.md +1 -1
- package/skills/prototype/workflows/promotion.md +1 -1
- package/skills/rebase/AGENTS.md +32 -0
- package/skills/rebase/CLAUDE.md +1 -32
- package/skills/recall/AGENTS.md +30 -0
- package/skills/recall/CLAUDE.md +1 -30
- package/skills/remember/AGENTS.md +31 -0
- package/skills/remember/CLAUDE.md +1 -31
- package/skills/reviews/SKILL.md +1 -1
- package/skills/session-log/AGENTS.md +32 -0
- package/skills/session-log/CLAUDE.md +1 -32
- package/skills/session-tidy/AGENTS.md +36 -0
- package/skills/session-tidy/CLAUDE.md +1 -36
- package/skills/skill-builder/AGENTS.md +49 -0
- package/skills/skill-builder/CLAUDE.md +1 -49
- package/skills/skill-builder/references/AGENTS.md +25 -0
- package/skills/skill-builder/references/CLAUDE.md +1 -25
- package/skills/skill-builder/references/deterministic-elements.md +1 -1
- package/skills/skill-builder/templates/AGENTS.md +14 -0
- package/skills/skill-builder/templates/CLAUDE.md +1 -14
- package/skills/skill-builder/workflows/AGENTS.md +19 -0
- package/skills/skill-builder/workflows/CLAUDE.md +1 -19
- package/skills/task-build/AGENTS.md +29 -0
- package/skills/task-build/CLAUDE.md +1 -29
- package/skills/update/AGENTS.md +38 -0
- package/skills/update/CLAUDE.md +1 -38
- package/system-prompts/AGENTS.md +17 -0
- package/system-prompts/CLAUDE.md +1 -17
- package/system-prompts/software-engineer.xml +3 -3
- package/agents/caveman.md +0 -73
- package/agents/clasp-deployment-orchestrator.md +0 -608
- package/agents/code-advisor.md +0 -23
- package/agents/deep-research.md +0 -152
- package/agents/docs-agent.md +0 -85
- package/commands/commit.md +0 -28
- package/commands/docupdate.md +0 -322
- package/commands/hook-log-extract.md +0 -70
- package/commands/hook-log-init.md +0 -76
- package/commands/implement.md +0 -102
- package/commands/plan.md +0 -14
- package/commands/pr-comments.md +0 -47
- package/commands/review-plan.md +0 -5
- package/commands/right-size.md +0 -15
- package/commands/sum.md +0 -30
- package/skills/imagegen/SKILL.md +0 -21
- package/skills/imagegen/scripts/config/__init__.py +0 -1
- package/skills/imagegen/scripts/config/constants.py +0 -28
- package/skills/imagegen/scripts/imagegen.py +0 -45
- package/skills/imagegen/scripts/imagegen_core.py +0 -528
- package/skills/imagegen/scripts/test_imagegen.py +0 -204
|
@@ -22,9 +22,8 @@ object name is the base when no default-branch ref resolves and when the
|
|
|
22
22
|
pushed branch is the default branch. When every remote object name is zero
|
|
23
23
|
(new branch) or stdin is empty, the gate falls back to the remote's default
|
|
24
24
|
branch symbolic ref. When a default-branch ref resolves and git still reports
|
|
25
|
-
no merge base, the base
|
|
26
|
-
a printed reason
|
|
27
|
-
a rebased tip would re-flag replayed commits.
|
|
25
|
+
no merge base, the base stays pending and the hook reports the infrastructure
|
|
26
|
+
status with a printed reason, preserving the scope boundary for rebased tips.
|
|
28
27
|
|
|
29
28
|
Gate scope: the gate process this hook launches diffs its `--base` against the
|
|
30
29
|
current checkout's HEAD, so the surface is the commits between that base and
|
|
@@ -32,14 +31,13 @@ HEAD. A push whose pushed object is HEAD reads as the branch's own work; a
|
|
|
32
31
|
push of any other object is still scoped to HEAD.
|
|
33
32
|
|
|
34
33
|
Exit codes:
|
|
35
|
-
0 - the push destination is allowed and its commits pass the gate
|
|
36
|
-
|
|
37
|
-
default-branch ref resolved and git still reported no merge base).
|
|
34
|
+
0 - the push destination is allowed and its commits pass the gate, or the
|
|
35
|
+
gate is not installed.
|
|
38
36
|
1 - the push would land a non-protected local branch onto a protected
|
|
39
37
|
remote branch, or a commit introduces a blocking violation.
|
|
40
|
-
2 -
|
|
41
|
-
stdin carried no parseable line,
|
|
42
|
-
|
|
38
|
+
2 - infrastructure attention is required because a subprocess could not
|
|
39
|
+
launch, stdin carried no parseable line, a base could not be resolved,
|
|
40
|
+
or a usable commit name could not be produced.
|
|
43
41
|
"""
|
|
44
42
|
|
|
45
43
|
from __future__ import annotations
|
|
@@ -49,8 +47,9 @@ import sys
|
|
|
49
47
|
from pathlib import Path
|
|
50
48
|
from typing import NamedTuple
|
|
51
49
|
|
|
50
|
+
from gate_utils import is_safe_regular_file, resolve_gate_script_path
|
|
52
51
|
from git_hooks_constants import (
|
|
53
|
-
|
|
52
|
+
ALL_FALLBACK_REMOTE_DEFAULT_BRANCH_NAMES,
|
|
54
53
|
ALL_GIT_MERGE_BASE_COMMAND_PREFIX,
|
|
55
54
|
ALL_GIT_SYMBOLIC_REFERENCE_COMMAND_PREFIX,
|
|
56
55
|
ALL_GIT_VERIFY_REFERENCE_COMMAND_PREFIX,
|
|
@@ -58,6 +57,7 @@ from git_hooks_constants import (
|
|
|
58
57
|
ALL_ZEROS_OBJECT_NAME_CHARACTER,
|
|
59
58
|
BASE_REFERENCE_ARGUMENT,
|
|
60
59
|
DEFAULT_REMOTE_BASE_REFERENCE,
|
|
60
|
+
DEFAULT_REMOTE_NAME,
|
|
61
61
|
GATE_INFRASTRUCTURE_FAILURE_EXIT_CODE,
|
|
62
62
|
GIT_COMMAND_TIMEOUT_SECONDS,
|
|
63
63
|
GIT_COMMAND_UNAVAILABLE_MESSAGE,
|
|
@@ -72,11 +72,10 @@ from git_hooks_constants import (
|
|
|
72
72
|
MALFORMED_STDIN_LINE_MESSAGE,
|
|
73
73
|
NO_PARSEABLE_STDIN_LINES_MESSAGE,
|
|
74
74
|
NO_PARSEABLE_STDIN_LINES_SENTINEL,
|
|
75
|
-
ORIGIN_HEAD_SYMBOLIC_REFERENCE,
|
|
76
|
-
ORIGIN_REMOTE_TRACKING_REFERENCE_PREFIX,
|
|
77
75
|
PRE_PUSH_GATE_SCRIPT_NOT_FOUND_MESSAGE,
|
|
78
76
|
PROTECTED_BRANCH_PUSH_BLOCK_EXIT_CODE,
|
|
79
77
|
PROTECTED_BRANCH_PUSH_BLOCK_MESSAGE,
|
|
78
|
+
REMOTE_BRANCH_REFERENCE_TEMPLATE,
|
|
80
79
|
REMOTE_REFERENCE_FIELD_INDEX,
|
|
81
80
|
STDIN_LINE_FIELD_COUNT,
|
|
82
81
|
STDIN_READ_FAILURE_MESSAGE,
|
|
@@ -84,7 +83,6 @@ from git_hooks_constants import (
|
|
|
84
83
|
UNRESOLVABLE_MERGE_BASE_MESSAGE,
|
|
85
84
|
UNRESOLVABLE_MERGE_BASE_SENTINEL,
|
|
86
85
|
)
|
|
87
|
-
from gate_utils import is_safe_regular_file, resolve_gate_script_path
|
|
88
86
|
from pre_push_base_reference import (
|
|
89
87
|
resolve_remote_name_from_arguments,
|
|
90
88
|
resolve_usable_base_reference,
|
|
@@ -294,24 +292,24 @@ def run_git_reference_query(all_git_arguments: tuple[str, ...]) -> str | None:
|
|
|
294
292
|
return decoded_output.strip() or None
|
|
295
293
|
|
|
296
294
|
|
|
297
|
-
def resolve_default_branch_reference() -> str | None:
|
|
295
|
+
def resolve_default_branch_reference(remote_name: str = DEFAULT_REMOTE_NAME) -> str | None:
|
|
298
296
|
"""Return the remote-tracking ref name of the remote's default branch.
|
|
299
297
|
|
|
300
|
-
The remote's HEAD symbolic ref answers first. When it is unset,
|
|
301
|
-
|
|
298
|
+
The remote's HEAD symbolic ref answers first. When it is unset, the
|
|
299
|
+
supported default-branch tracking refs answer in turn.
|
|
302
300
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
over ``origin/master``, so a repo whose default is another branch beside a
|
|
306
|
-
legacy ``main`` resolves the wrong base ΓÇö the assumption set tracked at
|
|
307
|
-
~/.claude/orchestrator-runs/falsify-first/parked-items.md row 3.
|
|
301
|
+
Args:
|
|
302
|
+
remote_name: Remote whose default branch provides the gate base.
|
|
308
303
|
|
|
309
304
|
Returns:
|
|
310
305
|
A remote-tracking ref name, or None when no default-branch ref
|
|
311
306
|
resolves.
|
|
312
307
|
"""
|
|
308
|
+
remote_head_reference = REMOTE_BRANCH_REFERENCE_TEMPLATE.format(
|
|
309
|
+
remote=remote_name, branch="HEAD"
|
|
310
|
+
)
|
|
313
311
|
symbolic_reference = run_git_reference_query(
|
|
314
|
-
(*ALL_GIT_SYMBOLIC_REFERENCE_COMMAND_PREFIX,
|
|
312
|
+
(*ALL_GIT_SYMBOLIC_REFERENCE_COMMAND_PREFIX, remote_head_reference)
|
|
315
313
|
)
|
|
316
314
|
if symbolic_reference is not None:
|
|
317
315
|
verified_symbolic_target = run_git_reference_query(
|
|
@@ -319,7 +317,10 @@ def resolve_default_branch_reference() -> str | None:
|
|
|
319
317
|
)
|
|
320
318
|
if verified_symbolic_target is not None:
|
|
321
319
|
return symbolic_reference
|
|
322
|
-
for
|
|
320
|
+
for each_branch_name in ALL_FALLBACK_REMOTE_DEFAULT_BRANCH_NAMES:
|
|
321
|
+
each_candidate_reference = REMOTE_BRANCH_REFERENCE_TEMPLATE.format(
|
|
322
|
+
remote=remote_name, branch=each_branch_name
|
|
323
|
+
)
|
|
323
324
|
verified_reference = run_git_reference_query(
|
|
324
325
|
(*ALL_GIT_VERIFY_REFERENCE_COMMAND_PREFIX, each_candidate_reference)
|
|
325
326
|
)
|
|
@@ -360,7 +361,9 @@ def find_branch_update_push(stdin_text: str) -> PushLine | None:
|
|
|
360
361
|
|
|
361
362
|
|
|
362
363
|
def resolve_default_branch_merge_base(
|
|
363
|
-
remote_branch_name: str,
|
|
364
|
+
remote_branch_name: str,
|
|
365
|
+
pushed_object_name: str,
|
|
366
|
+
remote_name: str = DEFAULT_REMOTE_NAME,
|
|
364
367
|
) -> str | None:
|
|
365
368
|
"""Return the merge base of the pushed object and the default branch.
|
|
366
369
|
|
|
@@ -371,6 +374,7 @@ def resolve_default_branch_merge_base(
|
|
|
371
374
|
Args:
|
|
372
375
|
remote_branch_name: The remote branch the push updates.
|
|
373
376
|
pushed_object_name: The object name the push carries.
|
|
377
|
+
remote_name: The remote whose default branch provides the gate base.
|
|
374
378
|
|
|
375
379
|
Returns:
|
|
376
380
|
The merge-base object name; None when no default-branch ref resolves or
|
|
@@ -378,12 +382,13 @@ def resolve_default_branch_merge_base(
|
|
|
378
382
|
no merge base applies; or the unresolvable-merge-base sentinel when a
|
|
379
383
|
default-branch ref resolves and git still reports no merge base.
|
|
380
384
|
"""
|
|
381
|
-
default_branch_reference = resolve_default_branch_reference()
|
|
385
|
+
default_branch_reference = resolve_default_branch_reference(remote_name)
|
|
382
386
|
if default_branch_reference is None:
|
|
383
387
|
return None
|
|
384
|
-
|
|
385
|
-
|
|
388
|
+
default_branch_prefix = REMOTE_BRANCH_REFERENCE_TEMPLATE.format(
|
|
389
|
+
remote=remote_name, branch=""
|
|
386
390
|
)
|
|
391
|
+
default_branch_name = default_branch_reference.removeprefix(default_branch_prefix)
|
|
387
392
|
if remote_branch_name == default_branch_name:
|
|
388
393
|
return None
|
|
389
394
|
# Anchors to the pushed object; deferring to the gate's HEAD-based merge-base would change behavior on non-HEAD pushes.
|
|
@@ -399,7 +404,9 @@ def resolve_default_branch_merge_base(
|
|
|
399
404
|
return merge_base_object_name
|
|
400
405
|
|
|
401
406
|
|
|
402
|
-
def resolve_gate_base_reference(
|
|
407
|
+
def resolve_gate_base_reference(
|
|
408
|
+
stdin_text: str, remote_name: str = DEFAULT_REMOTE_NAME
|
|
409
|
+
) -> str | None:
|
|
403
410
|
"""Return the reference the gate scopes its changed lines to.
|
|
404
411
|
|
|
405
412
|
A branch update reads from the merge base with the remote default branch,
|
|
@@ -414,20 +421,24 @@ def resolve_gate_base_reference(stdin_text: str) -> str | None:
|
|
|
414
421
|
|
|
415
422
|
Args:
|
|
416
423
|
stdin_text: The pre-push stdin payload.
|
|
424
|
+
remote_name: The remote whose default branch provides the gate base.
|
|
417
425
|
|
|
418
426
|
Returns:
|
|
419
427
|
The gate's base reference, the no-parseable-lines sentinel, the
|
|
420
428
|
unresolvable-merge-base sentinel, or None when the push only deletes
|
|
421
429
|
remote branches.
|
|
422
430
|
"""
|
|
423
|
-
return _resolve_gate_base_from_parsed(_parse_push_stdin(stdin_text))
|
|
431
|
+
return _resolve_gate_base_from_parsed(_parse_push_stdin(stdin_text), remote_name)
|
|
424
432
|
|
|
425
433
|
|
|
426
|
-
def _resolve_gate_base_from_parsed(
|
|
434
|
+
def _resolve_gate_base_from_parsed(
|
|
435
|
+
parsed_stdin: ParsedPushStdin, remote_name: str = DEFAULT_REMOTE_NAME
|
|
436
|
+
) -> str | None:
|
|
427
437
|
"""Return the gate's base reference for an already-parsed stdin payload.
|
|
428
438
|
|
|
429
439
|
Args:
|
|
430
440
|
parsed_stdin: The parsed stdin payload.
|
|
441
|
+
remote_name: The remote whose default branch provides the gate base.
|
|
431
442
|
|
|
432
443
|
Returns:
|
|
433
444
|
The merge base with the remote default branch for a branch update, the
|
|
@@ -440,7 +451,9 @@ def _resolve_gate_base_from_parsed(parsed_stdin: ParsedPushStdin) -> str | None:
|
|
|
440
451
|
if branch_update is None:
|
|
441
452
|
return _resolve_base_reference_from_lines(parsed_stdin)
|
|
442
453
|
merge_base_object_name = resolve_default_branch_merge_base(
|
|
443
|
-
branch_update.remote_branch_name,
|
|
454
|
+
branch_update.remote_branch_name,
|
|
455
|
+
branch_update.local_object_name,
|
|
456
|
+
remote_name,
|
|
444
457
|
)
|
|
445
458
|
if merge_base_object_name is None:
|
|
446
459
|
return branch_update.remote_object_name
|
|
@@ -542,7 +555,8 @@ def main() -> int:
|
|
|
542
555
|
file=sys.stderr,
|
|
543
556
|
)
|
|
544
557
|
return 0
|
|
545
|
-
|
|
558
|
+
remote_name = resolve_remote_name_from_arguments(sys.argv)
|
|
559
|
+
base_reference = _resolve_gate_base_from_parsed(parsed_stdin, remote_name)
|
|
546
560
|
if base_reference is None:
|
|
547
561
|
return 0
|
|
548
562
|
if base_reference == no_parseable_stdin_lines_sentinel:
|
|
@@ -550,8 +564,7 @@ def main() -> int:
|
|
|
550
564
|
return gate_infrastructure_failure_exit_code
|
|
551
565
|
if base_reference == unresolvable_merge_base_sentinel:
|
|
552
566
|
print(unresolvable_merge_base_message, file=sys.stderr)
|
|
553
|
-
return
|
|
554
|
-
remote_name = resolve_remote_name_from_arguments(sys.argv)
|
|
567
|
+
return gate_infrastructure_failure_exit_code
|
|
555
568
|
try:
|
|
556
569
|
usable_base_reference = resolve_usable_base_reference(
|
|
557
570
|
base_reference, remote_name, run_git_text_command
|
|
@@ -156,11 +156,10 @@ def test_run_git_reference_query_returns_replaced_text_on_locale_invalid_bytes(
|
|
|
156
156
|
assert resolved_output == expected_replaced_reference
|
|
157
157
|
|
|
158
158
|
|
|
159
|
-
def
|
|
159
|
+
def test_unresolvable_merge_base_message_describes_pending_validation() -> None:
|
|
160
160
|
skip_message = git_hooks_constants.UNRESOLVABLE_MERGE_BASE_MESSAGE
|
|
161
|
-
assert "
|
|
162
|
-
assert "
|
|
163
|
-
assert "merge-base still could not name a shared commit" in skip_message
|
|
161
|
+
assert "CODE_RULES validation is pending" in skip_message
|
|
162
|
+
assert "Restore shared history" in skip_message
|
|
164
163
|
|
|
165
164
|
|
|
166
165
|
def test_run_git_text_command_raises_when_git_cannot_launch(
|
|
@@ -239,6 +238,11 @@ def resolve_remote_head_reference(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
|
239
238
|
return GIT_RESOLVED_EXIT_CODE, RESOLVED_COMMIT_OBJECT_NAME
|
|
240
239
|
|
|
241
240
|
monkeypatch.setattr(pre_push, "run_git_text_command", fake_run_git_text_command)
|
|
241
|
+
monkeypatch.setattr(
|
|
242
|
+
sys,
|
|
243
|
+
"argv",
|
|
244
|
+
[HOOK_INVOCATION_NAME, git_hooks_constants.DEFAULT_REMOTE_NAME, PUSHED_REMOTE_URL],
|
|
245
|
+
)
|
|
242
246
|
|
|
243
247
|
|
|
244
248
|
|
|
@@ -994,6 +998,46 @@ def test_resolve_default_branch_reference_reads_the_origin_head_symbolic_referen
|
|
|
994
998
|
assert pre_push.resolve_default_branch_reference() == ORIGIN_DEFAULT_BRANCH_REFERENCE
|
|
995
999
|
|
|
996
1000
|
|
|
1001
|
+
def test_resolve_default_branch_reference_reads_the_requested_remote_head(
|
|
1002
|
+
tmp_path: Path,
|
|
1003
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1004
|
+
) -> None:
|
|
1005
|
+
repository, default_branch_tip, _topic_branch_tip = _build_default_branch_repository(
|
|
1006
|
+
tmp_path
|
|
1007
|
+
)
|
|
1008
|
+
upstream_reference = "refs/remotes/upstream/main"
|
|
1009
|
+
upstream_head_reference = "refs/remotes/upstream/HEAD"
|
|
1010
|
+
_run_fixture_git(repository, "update-ref", upstream_reference, default_branch_tip)
|
|
1011
|
+
_run_fixture_git(
|
|
1012
|
+
repository, "symbolic-ref", upstream_head_reference, upstream_reference
|
|
1013
|
+
)
|
|
1014
|
+
monkeypatch.chdir(repository)
|
|
1015
|
+
|
|
1016
|
+
assert pre_push.resolve_default_branch_reference("upstream") == upstream_reference
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
def test_resolve_default_branch_merge_base_uses_requested_remote_trunk_fallback(
|
|
1020
|
+
tmp_path: Path,
|
|
1021
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1022
|
+
) -> None:
|
|
1023
|
+
repository, default_branch_tip, topic_branch_tip = _build_default_branch_repository(
|
|
1024
|
+
tmp_path
|
|
1025
|
+
)
|
|
1026
|
+
upstream_trunk_reference = "refs/remotes/upstream/trunk"
|
|
1027
|
+
_run_fixture_git(
|
|
1028
|
+
repository, "update-ref", upstream_trunk_reference, default_branch_tip
|
|
1029
|
+
)
|
|
1030
|
+
monkeypatch.chdir(repository)
|
|
1031
|
+
|
|
1032
|
+
merge_base_object_name = pre_push.resolve_default_branch_merge_base(
|
|
1033
|
+
FEATURE_BRANCH_NAME,
|
|
1034
|
+
topic_branch_tip,
|
|
1035
|
+
"upstream",
|
|
1036
|
+
)
|
|
1037
|
+
|
|
1038
|
+
assert merge_base_object_name == default_branch_tip
|
|
1039
|
+
|
|
1040
|
+
|
|
997
1041
|
def test_resolve_default_branch_reference_returns_none_without_remote_tracking_refs(
|
|
998
1042
|
tmp_path: Path,
|
|
999
1043
|
monkeypatch: pytest.MonkeyPatch,
|
|
@@ -1198,7 +1242,7 @@ def test_main_allows_the_push_when_origin_head_names_an_absent_reference(
|
|
|
1198
1242
|
assert recorded_arguments == ["--base", remote_object_name]
|
|
1199
1243
|
|
|
1200
1244
|
|
|
1201
|
-
def
|
|
1245
|
+
def test_main_keeps_the_gate_pending_when_no_merge_base_resolves(
|
|
1202
1246
|
tmp_path: Path,
|
|
1203
1247
|
monkeypatch: pytest.MonkeyPatch,
|
|
1204
1248
|
capsys: pytest.CaptureFixture[str],
|
|
@@ -1230,13 +1274,73 @@ def test_main_skips_the_gate_when_no_merge_base_resolves(
|
|
|
1230
1274
|
|
|
1231
1275
|
exit_code = pre_push.main()
|
|
1232
1276
|
|
|
1233
|
-
assert exit_code ==
|
|
1277
|
+
assert exit_code == git_hooks_constants.GATE_INFRASTRUCTURE_FAILURE_EXIT_CODE
|
|
1234
1278
|
assert not recorded_arguments_path.exists(), (
|
|
1235
|
-
"the gate
|
|
1279
|
+
"the gate remains pending until the hook verifies a usable base"
|
|
1236
1280
|
)
|
|
1237
1281
|
assert git_hooks_constants.UNRESOLVABLE_MERGE_BASE_MESSAGE in capsys.readouterr().err
|
|
1238
1282
|
|
|
1239
1283
|
|
|
1284
|
+
def test_main_uses_the_pushed_remote_when_origin_has_unrelated_history(
|
|
1285
|
+
tmp_path: Path,
|
|
1286
|
+
monkeypatch: pytest.MonkeyPatch,
|
|
1287
|
+
) -> None:
|
|
1288
|
+
repository, default_branch_tip, topic_branch_tip = _build_default_branch_repository(
|
|
1289
|
+
tmp_path
|
|
1290
|
+
)
|
|
1291
|
+
_run_fixture_git(repository, "checkout", "--orphan", "unrelated-origin")
|
|
1292
|
+
_run_fixture_git(repository, "rm", "-rf", ".")
|
|
1293
|
+
unrelated_origin_tip = _commit_file(repository, "unrelated.txt")
|
|
1294
|
+
_run_fixture_git(repository, "checkout", FEATURE_BRANCH_NAME)
|
|
1295
|
+
_run_fixture_git(
|
|
1296
|
+
repository,
|
|
1297
|
+
"update-ref",
|
|
1298
|
+
ORIGIN_DEFAULT_BRANCH_REFERENCE,
|
|
1299
|
+
unrelated_origin_tip,
|
|
1300
|
+
)
|
|
1301
|
+
_set_origin_head(repository, ORIGIN_DEFAULT_BRANCH_REFERENCE)
|
|
1302
|
+
upstream_reference = "refs/remotes/upstream/main"
|
|
1303
|
+
upstream_head_reference = "refs/remotes/upstream/HEAD"
|
|
1304
|
+
_run_fixture_git(repository, "update-ref", upstream_reference, default_branch_tip)
|
|
1305
|
+
_run_fixture_git(
|
|
1306
|
+
repository, "symbolic-ref", upstream_head_reference, upstream_reference
|
|
1307
|
+
)
|
|
1308
|
+
recorded_arguments_path = tmp_path / "upstream_recorded_arguments.txt"
|
|
1309
|
+
recording_gate_script_path = tmp_path / "upstream_recording_gate.py"
|
|
1310
|
+
recording_gate_script_path.write_text(
|
|
1311
|
+
"import pathlib, sys\n"
|
|
1312
|
+
f'pathlib.Path(r"{recorded_arguments_path}").write_text('
|
|
1313
|
+
"'\\n'.join(sys.argv[1:]), encoding='utf-8')\n"
|
|
1314
|
+
"sys.exit(0)\n",
|
|
1315
|
+
encoding="utf-8",
|
|
1316
|
+
)
|
|
1317
|
+
monkeypatch.setenv("CODE_RULES_GATE_PATH", str(recording_gate_script_path))
|
|
1318
|
+
monkeypatch.chdir(repository)
|
|
1319
|
+
monkeypatch.setattr(
|
|
1320
|
+
sys, "argv", [HOOK_INVOCATION_NAME, PUSHED_REMOTE_NAME, PUSHED_REMOTE_URL]
|
|
1321
|
+
)
|
|
1322
|
+
monkeypatch.setattr(
|
|
1323
|
+
sys,
|
|
1324
|
+
"stdin",
|
|
1325
|
+
io.StringIO(
|
|
1326
|
+
_push_stdin_line(
|
|
1327
|
+
FEATURE_BRANCH_NAME,
|
|
1328
|
+
topic_branch_tip,
|
|
1329
|
+
FEATURE_BRANCH_NAME,
|
|
1330
|
+
NON_ZERO_REMOTE_SHA_ONE,
|
|
1331
|
+
)
|
|
1332
|
+
),
|
|
1333
|
+
)
|
|
1334
|
+
|
|
1335
|
+
exit_code = pre_push.main()
|
|
1336
|
+
|
|
1337
|
+
assert exit_code == 0
|
|
1338
|
+
assert recorded_arguments_path.read_text(encoding="utf-8").splitlines() == [
|
|
1339
|
+
"--base",
|
|
1340
|
+
default_branch_tip,
|
|
1341
|
+
]
|
|
1342
|
+
|
|
1343
|
+
|
|
1240
1344
|
def test_main_allows_default_branch_file_the_rebase_replayed_onto(
|
|
1241
1345
|
tmp_path: Path,
|
|
1242
1346
|
monkeypatch: pytest.MonkeyPatch,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# hooks/hooks_constants
|
|
2
|
+
|
|
3
|
+
Shared constant modules imported by hooks throughout the `hooks/` tree. Each file holds the tunables for one hook or one cross-cutting concern, keeping magic values out of the hook scripts themselves.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
| File | What it holds |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `__init__.py` | Package marker (`# pragma: no-tdd-gate`) |
|
|
10
|
+
| `any_type_config.py` | Config for the `Any`-type escape-hatch check |
|
|
11
|
+
| `ask_user_question_shape.py` | Pure AskUserQuestion lean-block shape analyzer: grades question and option-description prose against shared chat-detail markers and sentence/word caps with no hook I/O |
|
|
12
|
+
| `banned_identifiers_constants.py` | The set of banned short identifiers and banned function-name prefixes |
|
|
13
|
+
| `bash_pre_tool_use_dispatcher_constants.py` | Permission outcomes, tool-name sets, and the ordered hosted-hook roster for the Bash PreToolUse dispatcher (also covers PowerShell-shared gates) |
|
|
14
|
+
| `blocking_check_limits.py` | Max issue counts and preview lengths for blocking hooks |
|
|
15
|
+
| `bot_mention_comment_blocker_constants.py` | Patterns for detecting bot @-mentions in PR comments |
|
|
16
|
+
| `claude_md_orphan_file_blocker_constants.py` | Table patterns, file extensions, scan budget, and block-message text for the CLAUDE.md orphan-file blocker |
|
|
17
|
+
| `code_rules_enforcer_constants.py` | File-extension sets, test-path patterns, advisory line thresholds, boolean-name prefixes |
|
|
18
|
+
| `enter_worktree_prefetch_constants.py` | Tool name, origin-remote ref names, and git-command timeouts for the EnterWorktree origin-prefetch hook |
|
|
19
|
+
| `env_var_table_code_drift_constants.py` | Table patterns, env-var-name and code-file recognizers, scan budget, and block-message text for the env-var-table code-drift blocker |
|
|
20
|
+
| `code_rules_path_utils_constants.py` | Path-matching helpers used by the code-rules check modules |
|
|
21
|
+
| `command_dispatch_constants.py` | Command-word regex, command-key access pattern, tokenization pattern, and anchors for the unanchored command-dispatch meta-gate |
|
|
22
|
+
| `conventional_pr_title_gate_constants.py` | Bash tool name, gh executable basenames and pr create/edit subcommand tokens, title/repo flag names, semantic-title-CI workflow markers, the Conventional Commits type list and title pattern, the semantic-pull-request action `types:` input pattern, and block-message text for the conventional-PR-title gate |
|
|
23
|
+
| `dead_argparse_argument_constants.py` | Patterns for detecting unused argparse arguments |
|
|
24
|
+
| `dead_config_field_constants.py` | Patterns for detecting unused `*Config` / `*Selectors` dataclass fields |
|
|
25
|
+
| `dead_dataclass_field_constants.py` | Patterns for detecting unused dataclass fields |
|
|
26
|
+
| `dead_module_constant_constants.py` | Patterns for detecting unexported `UPPER_SNAKE` constants in `*_constants.py` modules |
|
|
27
|
+
| `destructive_command_segment_constants.py` | The list of destructive shell command patterns the blocker matches |
|
|
28
|
+
| `docstring_rule_gate_count_blocker_constants.py` | Target rule basename, spelled-out-number lookup, count-clause and `check_*` validator patterns, and block-message text for the docstring-rule gate-count staleness blocker |
|
|
29
|
+
| `duplicate_function_body_constants.py` | Hashing and comparison config for the duplicate-body check |
|
|
30
|
+
| `duplicate_rmtree_helper_blocker_constants.py` | Sanctioned Windows-safe rmtree helper names, the definition pattern, and the exempt-path set for the duplicate-rmtree-helper blocker |
|
|
31
|
+
| `dynamic_stderr_handler.py` | `DynamicStderrHandler` — a logging handler that resolves `sys.stderr` at emit time (for testability) |
|
|
32
|
+
| `eli11_reply_enforcer_constants.py` | Reply-shape thresholds (bullet cap, lead-line window, per-list-line word cap, overpacked list-line cap), the bullet / numbered-step / table-row / link-target / word patterns, the imperative instruction verbs, and the user-facing notice for the ELI11 reply-shape Stop hook |
|
|
33
|
+
| `fable_spawn_gate_constants.py` | The spawn tool-name set, the fable model alias and the model-id segment split pattern, the `FABLE-SPAWN-AUTHORIZED` authorization token, the advisor-protocol document path, payload field names, the deny message, and the deny `additionalContext` recovery text for the fable-tier spawn gate |
|
|
34
|
+
| `gh_pr_author_swap_constants.py` | Constants for the PR-author swap enforcement hooks |
|
|
35
|
+
| `hardcoded_user_path_constants.py` | Patterns for detecting hardcoded home-directory paths |
|
|
36
|
+
| `harness_scratchpad_constants.py` | Fixed path components (`claude` / `claude-` user-directory name and prefix, `scratchpad` leaf name), the PreToolUse session-id payload key, and the `CLAUDE_CODE_SESSION_ID` environment variable name that the code-rules and TDD gates use to recognize an existing harness session scratchpad directory |
|
|
37
|
+
| `hedging_uncertainty_constants.py` | Sentence-boundary pattern, explicit uncertainty label patterns, hedge-term list separator, and positive corrective block text for OP-07C sentence-scoped hedging |
|
|
38
|
+
| `hook_block_logger.py` | `log_hook_block()` — shared fail-safe logger every blocking hook calls to append a JSON record of each block decision to `~/.claude/logs/hook-blocks.log` |
|
|
39
|
+
| `hook_log_extractor_constants.py` | Neon table name, offset state file path, timeouts, and outcome-type mapping for the hook-log extractor |
|
|
40
|
+
| `hook_prose_detector_consistency_constants.py` | Trigger patterns and corrective messages for the hook-prose consistency checker |
|
|
41
|
+
| `hosted_hook_runner.py` | `run_hook_capturing_output()` — shared runner that runs one dispatcher-hosted hook in-process via runpy and returns its captured stdout and crash flag |
|
|
42
|
+
| `inline_tuple_string_magic_constants.py` | Patterns for detecting magic strings in inline tuple literals |
|
|
43
|
+
| `js_conventions_constants.py` | Banned identifier set, boolean-prefix pattern, and declaration/JSDoc patterns for the JavaScript convention checks |
|
|
44
|
+
| `local_identity.py` | Loader for local machine values: NAS host, ssh user, and ssh port the ssh enforcer guards (`CLAUDE_NAS_*` / `~/.claude/local-identity.json` with placeholder defaults), the PII commit-scan exempt-repo slug set (`CLAUDE_PII_EXEMPT_REPOS` / `pii_exempt_repositories`), and the per-repository allowlisted-values mapping (`pii_allowlisted_values`, keyed by owner/repo slug) read from the git-ignored local file whose path `CLAUDE_LOCAL_IDENTITY_PATH` may point elsewhere; also composes the ssh enforcer's two deny messages that quote the NAS values |
|
|
45
|
+
| `messages.py` | Short user-facing notice strings shown when a Stop hook redirects agent behavior |
|
|
46
|
+
| `multi_edit_reconstruction.py` | `apply_edits()` / `edits_for_tool()` — shared helpers that reconstruct the post-edit content of an Edit or MultiEdit, imported by the blockers that judge post-edit content |
|
|
47
|
+
| `mypy_integration_constants.py` | Path markers (``.git``, ``.py``, ``pyproject.toml``) for mypy project-root resolution |
|
|
48
|
+
| `mypy_validator_cache_constants.py` | Cache paths and tunables for the mypy_validator per-session caches |
|
|
49
|
+
| `nas_ssh_binary_enforcer_constants.py` | Bash tool name, ssh-family basenames, OpenSSH binary path suffixes, and the batch-mode pattern for the NAS ssh binary enforcer; segment helpers come from `shell_command_segments.py` |
|
|
50
|
+
| `open_questions_in_plans_blocker_constants.py` | Patterns for detecting unresolved open questions in plan documents |
|
|
51
|
+
| `orphan_css_class_constants.py` | Scan radius and selector patterns for the orphan-CSS-class check |
|
|
52
|
+
| `package_inventory_stale_blocker_constants.py` | Inventory document names, production code extensions, backtick token pattern, smallest inventory size, exempt names, scan budget, and block-message text for the package-inventory stale-entry blocker |
|
|
53
|
+
| `paired_test_coverage_constants.py` | Test-directory name, stem-test filename affixes, test-file globs, exempt public-function names, scan budget, coverage threshold, and guidance text for the public-function paired-test coverage check |
|
|
54
|
+
| `path_rewriter_constants.py` | Path rewriting patterns for the Everything-search path rewriter |
|
|
55
|
+
| `pii_prevention_constants.py` | Patterns, allowlists, path exemptions, and deny-message text for `pii_prevention_blocker` |
|
|
56
|
+
| `piped_pytest_blocker_constants.py` | Bash tool name, pytest program basenames and the python-interpreter basename pattern, the pipe and segment-reset operator token sets, and the deny message for the piped-pytest blocker; classification that consumes those program and wrapper constants lives in `pytest_invocation.py` |
|
|
57
|
+
| `pytest_invocation.py` | Pure parsed-segment classifier for pytest runs through interpreters, shims, wrappers, and shell string-exec forms; no pipeline deny decision |
|
|
58
|
+
| `plain_language_blocker_constants.py` | The list of heavy words and their everyday replacements |
|
|
59
|
+
| `prose_matcher_precision_constants.py` | Sample floor, keep/narrow precision floors, matcher ids, label decisions, advisory log path, emit caps, and context fingerprint length for OP-07B prose-matcher advisory telemetry |
|
|
60
|
+
| `pre_tool_use_stdin.py` | `read_hook_input_dictionary_from_stdin()` — shared stdin parser for PreToolUse hooks |
|
|
61
|
+
| `precommit_code_rules_gate_constants.py` | Scope argument and exit-code constants for the precommit gate |
|
|
62
|
+
| project_paths_reader.py | Loads ~/.claude/project-paths.json and finds a home-bounded git root for registry checks |
|
|
63
|
+
| `pyproject_config_discovery_constants.py` | Table names (``tool`` key, ``mypy``, ``ruff``) for resolving a validator's config from a pyproject.toml `[tool.<name>]` table |
|
|
64
|
+
| `pytest_testpaths_orphan_blocker_constants.py` | Marker filename, section and key names, test-file pattern, search budget, and block-message text for the pytest unregistered-test-directory blocker |
|
|
65
|
+
| `python_style_checks_constants.py` | Command-line argument count and blank-line count between top-level functions for the style validator |
|
|
66
|
+
| `ruff_integration_constants.py` | ``NO_COLOR`` / ``FORCE_COLOR`` environment variable names for plain ruff diagnostics |
|
|
67
|
+
| `send_user_file_open_locally_blocker_constants.py` | Tool name, proactive status, and the block message for the open-locally attach blocker |
|
|
68
|
+
| `sensitive_file_protector_constants.py` | Sensitive filename patterns, the committed-template suffixes that earn an exemption, the write/edit tool names, and the deny decision and message template for `sensitive_file_protector` |
|
|
69
|
+
| `session_edit_stage_gate_constants.py` | Tracker filename prefix/suffix, JSON payload key, edit tool name set, session-id sanitize pattern, lock filename suffix and lock-acquire timing, git diff command, commit flag escapes, and deny-message template shared by the session edit stage gate trio |
|
|
70
|
+
| `session_env_cleanup_constants.py` | Stale-age threshold and directory names for the session-env cleanup hook |
|
|
71
|
+
| `session_start_injector.py` | Pure SessionStart context injector: normalize `source` (`startup`/`resume`/`clear`/`compact`), honor enable/timeout, return structured injection results for starter hooks |
|
|
72
|
+
| `session_start_injector_constants.py` | Known SessionStart source values, injection status codes, enable env var, default timeout for the shared injector |
|
|
73
|
+
| `test_session_start_injector.py` | Behavioral tests for every known source, disabled, timeout, and unknown-source paths |
|
|
74
|
+
| `orchestrator_auto_starter_constants.py` | Opt-in env var, enable values, timeout, and SessionStart directive text for the orchestrator auto-starter |
|
|
75
|
+
| `issue_tracker_session_starter_constants.py` | Opt-in env var, enable values, timeout, and SessionStart directive text for the repository-gated issue-tracker starter |
|
|
76
|
+
| `session_handoff_blocker_constants.py` | Trigger phrases for the session-handoff blocker |
|
|
77
|
+
| `setup_project_paths_constants.py` | Encoding policy, BOM marker, and registry meta-key used across multiple hooks |
|
|
78
|
+
| `shell_command_pipeline.py` | Quote-aware shell pipeline parsing: operator-paired segments after line-continuation join, comment strip, heredoc body drop, and parenthesis-group join |
|
|
79
|
+
| `shell_command_segments.py` | Shell tokenization helpers shared by the segment-walking blockers: segment splitting on control operators, a segment's effective leading program, and a token's basename |
|
|
80
|
+
| `shell_substitution_blocker_constants.py` | Tool name, payload keys, the four substitution-detection patterns, the deny decision shape, and the corrective message for the shell-substitution blocker |
|
|
81
|
+
| `stale_comment_reference_blocker_constants.py` | Identifier pattern, comment stopwords, and denial text for the stale-comment-reference blocker |
|
|
82
|
+
| `state_description_blocker_constants.py` | The set of historical/comparative phrases the state-description blocker rejects, plus the docstring-extraction and mention-span patterns for its Python docstring scan |
|
|
83
|
+
| `stop_dispatcher_constants.py` | Ordered hosted-hook roster and Stop block payload field names for the Stop-chain dispatcher |
|
|
84
|
+
| `stuttering_check_config.py` | Config for the stuttering (repeated-phrase) check |
|
|
85
|
+
| `stuttering_import_binding_constants.py` | Import-binding patterns for the stuttering check |
|
|
86
|
+
| `subprocess_budget_completeness_constants.py` | Required argument names for the subprocess-budget completeness check |
|
|
87
|
+
| `sys_path_insert_constants.py` | Patterns for detecting unguarded `sys.path.insert` calls |
|
|
88
|
+
| `task_list_loop_starter_constants.py` | The one-line task-list instruction and the full session-start directive text for the task-list loop starter hook |
|
|
89
|
+
| `test_layout_constants.py` | The named constants for the test-layout write-time checks |
|
|
90
|
+
| `text_stripping.py` | `strip_code_and_quotes()` — shared helper that removes fenced code blocks, inline code, and blockquotes from prose, imported by the Stop-hook prose blockers |
|
|
91
|
+
| `unscoped_search_blocker_constants.py` | Tool names, `find` and listing program basenames, Get-ChildItem option sets, unscoped-root patterns, the flag/value token stride, and the deny message for the unscoped-search blocker |
|
|
92
|
+
| `unused_module_import_constants.py` | Patterns for detecting unused module-level imports |
|
|
93
|
+
| `volatile_path_in_post_blocker_constants.py` | Volatile path markers, affected `gh` post subcommands, MCP body param names, and the corrective message for the volatile-path post blocker |
|
|
94
|
+
| `windows_rmtree_blocker_constants.py` | The unsafe `shutil.rmtree` pattern and the safe replacement pattern |
|
|
95
|
+
| `workflow_substitution_slot_blocker_constants.py` | Per-iteration token patterns for the workflow-slot blocker |
|
|
96
|
+
| `working_style_prompt_constants.py` | The fixed multi-paragraph working-style prompt text for the SessionStart working_style_prompt hook |
|
|
97
|
+
|
|
98
|
+
## Conventions
|
|
99
|
+
|
|
100
|
+
- Most files in this package are pure constants modules — no side effects, no I/O.
|
|
101
|
+
- Hooks import from this package with `from hooks_constants.<module> import <CONSTANT>`.
|
|
102
|
+
- Tests for these modules live beside them as `test_<module>.py`. Run with `python -m pytest hooks_constants/test_<name>.py`.
|
|
103
|
+
- `dynamic_stderr_handler.py`, `pre_tool_use_stdin.py`, `multi_edit_reconstruction.py`, `hosted_hook_runner.py`, and `text_stripping.py` are utility modules (not pure constants) but live here because they hold logic shared across hook surfaces.
|
|
104
|
+
- `local_identity.py` is a loader: it reads the environment or `~/.claude/local-identity.json` (its path overridable via `CLAUDE_LOCAL_IDENTITY_PATH`) to resolve private NAS values (with committed placeholder defaults), the PII commit-scan exempt-repo slug set (`CLAUDE_PII_EXEMPT_REPOS` / `pii_exempt_repositories`), and the per-repository allowlisted-values mapping (`pii_allowlisted_values`).
|
|
@@ -1,104 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Shared constant modules imported by hooks throughout the `hooks/` tree. Each file holds the tunables for one hook or one cross-cutting concern, keeping magic values out of the hook scripts themselves.
|
|
4
|
-
|
|
5
|
-
## Files
|
|
6
|
-
|
|
7
|
-
| File | What it holds |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `__init__.py` | Package marker (`# pragma: no-tdd-gate`) |
|
|
10
|
-
| `any_type_config.py` | Config for the `Any`-type escape-hatch check |
|
|
11
|
-
| `ask_user_question_shape.py` | Pure AskUserQuestion lean-block shape analyzer: grades question and option-description prose against shared chat-detail markers and sentence/word caps with no hook I/O |
|
|
12
|
-
| `banned_identifiers_constants.py` | The set of banned short identifiers and banned function-name prefixes |
|
|
13
|
-
| `bash_pre_tool_use_dispatcher_constants.py` | Permission outcomes, tool-name sets, and the ordered hosted-hook roster for the Bash PreToolUse dispatcher (also covers PowerShell-shared gates) |
|
|
14
|
-
| `blocking_check_limits.py` | Max issue counts and preview lengths for blocking hooks |
|
|
15
|
-
| `bot_mention_comment_blocker_constants.py` | Patterns for detecting bot @-mentions in PR comments |
|
|
16
|
-
| `claude_md_orphan_file_blocker_constants.py` | Table patterns, file extensions, scan budget, and block-message text for the CLAUDE.md orphan-file blocker |
|
|
17
|
-
| `code_rules_enforcer_constants.py` | File-extension sets, test-path patterns, advisory line thresholds, boolean-name prefixes |
|
|
18
|
-
| `enter_worktree_prefetch_constants.py` | Tool name, origin-remote ref names, and git-command timeouts for the EnterWorktree origin-prefetch hook |
|
|
19
|
-
| `env_var_table_code_drift_constants.py` | Table patterns, env-var-name and code-file recognizers, scan budget, and block-message text for the env-var-table code-drift blocker |
|
|
20
|
-
| `code_rules_path_utils_constants.py` | Path-matching helpers used by the code-rules check modules |
|
|
21
|
-
| `command_dispatch_constants.py` | Command-word regex, command-key access pattern, tokenization pattern, and anchors for the unanchored command-dispatch meta-gate |
|
|
22
|
-
| `conventional_pr_title_gate_constants.py` | Bash tool name, gh executable basenames and pr create/edit subcommand tokens, title/repo flag names, semantic-title-CI workflow markers, the Conventional Commits type list and title pattern, the semantic-pull-request action `types:` input pattern, and block-message text for the conventional-PR-title gate |
|
|
23
|
-
| `dead_argparse_argument_constants.py` | Patterns for detecting unused argparse arguments |
|
|
24
|
-
| `dead_config_field_constants.py` | Patterns for detecting unused `*Config` / `*Selectors` dataclass fields |
|
|
25
|
-
| `dead_dataclass_field_constants.py` | Patterns for detecting unused dataclass fields |
|
|
26
|
-
| `dead_module_constant_constants.py` | Patterns for detecting unexported `UPPER_SNAKE` constants in `*_constants.py` modules |
|
|
27
|
-
| `destructive_command_segment_constants.py` | The list of destructive shell command patterns the blocker matches |
|
|
28
|
-
| `docstring_rule_gate_count_blocker_constants.py` | Target rule basename, spelled-out-number lookup, count-clause and `check_*` validator patterns, and block-message text for the docstring-rule gate-count staleness blocker |
|
|
29
|
-
| `duplicate_function_body_constants.py` | Hashing and comparison config for the duplicate-body check |
|
|
30
|
-
| `duplicate_rmtree_helper_blocker_constants.py` | Sanctioned Windows-safe rmtree helper names, the definition pattern, and the exempt-path set for the duplicate-rmtree-helper blocker |
|
|
31
|
-
| `dynamic_stderr_handler.py` | `DynamicStderrHandler` — a logging handler that resolves `sys.stderr` at emit time (for testability) |
|
|
32
|
-
| `eli11_reply_enforcer_constants.py` | Reply-shape thresholds (bullet cap, lead-line window, per-list-line word cap, overpacked list-line cap), the bullet / numbered-step / table-row / link-target / word patterns, the imperative instruction verbs, and the user-facing notice for the ELI11 reply-shape Stop hook |
|
|
33
|
-
| `fable_spawn_gate_constants.py` | The spawn tool-name set, the fable model alias and the model-id segment split pattern, the `FABLE-SPAWN-AUTHORIZED` authorization token, the advisor-protocol document path, payload field names, the deny message, and the deny `additionalContext` recovery text for the fable-tier spawn gate |
|
|
34
|
-
| `gh_pr_author_swap_constants.py` | Constants for the PR-author swap enforcement hooks |
|
|
35
|
-
| `hardcoded_user_path_constants.py` | Patterns for detecting hardcoded home-directory paths |
|
|
36
|
-
| `harness_scratchpad_constants.py` | Fixed path components (`claude` / `claude-` user-directory name and prefix, `scratchpad` leaf name), the PreToolUse session-id payload key, and the `CLAUDE_CODE_SESSION_ID` environment variable name that the code-rules and TDD gates use to recognize an existing harness session scratchpad directory |
|
|
37
|
-
| `hedging_uncertainty_constants.py` | Sentence-boundary pattern, explicit uncertainty label patterns, hedge-term list separator, and positive corrective block text for OP-07C sentence-scoped hedging |
|
|
38
|
-
| `hook_block_logger.py` | `log_hook_block()` — shared fail-safe logger every blocking hook calls to append a JSON record of each block decision to `~/.claude/logs/hook-blocks.log` |
|
|
39
|
-
| `hook_log_extractor_constants.py` | Neon table name, offset state file path, timeouts, and outcome-type mapping for the hook-log extractor |
|
|
40
|
-
| `hook_prose_detector_consistency_constants.py` | Trigger patterns and corrective messages for the hook-prose consistency checker |
|
|
41
|
-
| `hosted_hook_runner.py` | `run_hook_capturing_output()` — shared runner that runs one dispatcher-hosted hook in-process via runpy and returns its captured stdout and crash flag |
|
|
42
|
-
| `inline_tuple_string_magic_constants.py` | Patterns for detecting magic strings in inline tuple literals |
|
|
43
|
-
| `js_conventions_constants.py` | Banned identifier set, boolean-prefix pattern, and declaration/JSDoc patterns for the JavaScript convention checks |
|
|
44
|
-
| `local_identity.py` | Loader for local machine values: NAS host, ssh user, and ssh port the ssh enforcer guards (`CLAUDE_NAS_*` / `~/.claude/local-identity.json` with placeholder defaults), the PII commit-scan exempt-repo slug set (`CLAUDE_PII_EXEMPT_REPOS` / `pii_exempt_repositories`), and the per-repository allowlisted-values mapping (`pii_allowlisted_values`, keyed by owner/repo slug) read from the git-ignored local file whose path `CLAUDE_LOCAL_IDENTITY_PATH` may point elsewhere; also composes the ssh enforcer's two deny messages that quote the NAS values |
|
|
45
|
-
| `messages.py` | Short user-facing notice strings shown when a Stop hook redirects agent behavior |
|
|
46
|
-
| `multi_edit_reconstruction.py` | `apply_edits()` / `edits_for_tool()` — shared helpers that reconstruct the post-edit content of an Edit or MultiEdit, imported by the blockers that judge post-edit content |
|
|
47
|
-
| `mypy_integration_constants.py` | Path markers (``.git``, ``.py``, ``pyproject.toml``) for mypy project-root resolution |
|
|
48
|
-
| `mypy_validator_cache_constants.py` | Cache paths and tunables for the mypy_validator per-session caches |
|
|
49
|
-
| `nas_ssh_binary_enforcer_constants.py` | Bash tool name, ssh-family basenames, OpenSSH binary path suffixes, and the batch-mode pattern for the NAS ssh binary enforcer; segment helpers come from `shell_command_segments.py` |
|
|
50
|
-
| `open_questions_in_plans_blocker_constants.py` | Patterns for detecting unresolved open questions in plan documents |
|
|
51
|
-
| `orphan_css_class_constants.py` | Scan radius and selector patterns for the orphan-CSS-class check |
|
|
52
|
-
| `package_inventory_stale_blocker_constants.py` | Inventory document names, production code extensions, backtick token pattern, smallest inventory size, exempt names, scan budget, and block-message text for the package-inventory stale-entry blocker |
|
|
53
|
-
| `paired_test_coverage_constants.py` | Test-directory name, stem-test filename affixes, test-file globs, exempt public-function names, scan budget, coverage threshold, and guidance text for the public-function paired-test coverage check |
|
|
54
|
-
| `path_rewriter_constants.py` | Path rewriting patterns for the Everything-search path rewriter |
|
|
55
|
-
| `pii_prevention_constants.py` | Patterns, allowlists, path exemptions, and deny-message text for `pii_prevention_blocker` |
|
|
56
|
-
| `piped_pytest_blocker_constants.py` | Bash tool name, pytest program basenames and the python-interpreter basename pattern, the pipe and segment-reset operator token sets, and the deny message for the piped-pytest blocker; classification that consumes those program and wrapper constants lives in `pytest_invocation.py` |
|
|
57
|
-
| `pytest_invocation.py` | Pure parsed-segment classifier for pytest runs through interpreters, shims, wrappers, and shell string-exec forms; no pipeline deny decision |
|
|
58
|
-
| `plain_language_blocker_constants.py` | The list of heavy words and their everyday replacements |
|
|
59
|
-
| `prose_matcher_precision_constants.py` | Sample floor, keep/narrow precision floors, matcher ids, label decisions, advisory log path, emit caps, and context fingerprint length for OP-07B prose-matcher advisory telemetry |
|
|
60
|
-
| `pre_tool_use_stdin.py` | `read_hook_input_dictionary_from_stdin()` — shared stdin parser for PreToolUse hooks |
|
|
61
|
-
| `precommit_code_rules_gate_constants.py` | Scope argument and exit-code constants for the precommit gate |
|
|
62
|
-
| project_paths_reader.py | Loads ~/.claude/project-paths.json and finds a home-bounded git root for registry checks |
|
|
63
|
-
| `pyproject_config_discovery_constants.py` | Table names (``tool`` key, ``mypy``, ``ruff``) for resolving a validator's config from a pyproject.toml `[tool.<name>]` table |
|
|
64
|
-
| `pytest_testpaths_orphan_blocker_constants.py` | Marker filename, section and key names, test-file pattern, search budget, and block-message text for the pytest unregistered-test-directory blocker |
|
|
65
|
-
| `python_style_checks_constants.py` | Command-line argument count and blank-line count between top-level functions for the style validator |
|
|
66
|
-
| `ruff_integration_constants.py` | ``NO_COLOR`` / ``FORCE_COLOR`` environment variable names for plain ruff diagnostics |
|
|
67
|
-
| `send_user_file_open_locally_blocker_constants.py` | Tool name, proactive status, and the block message for the open-locally attach blocker |
|
|
68
|
-
| `sensitive_file_protector_constants.py` | Sensitive filename patterns, the committed-template suffixes that earn an exemption, the write/edit tool names, and the deny decision and message template for `sensitive_file_protector` |
|
|
69
|
-
| `session_edit_stage_gate_constants.py` | Tracker filename prefix/suffix, JSON payload key, edit tool name set, session-id sanitize pattern, lock filename suffix and lock-acquire timing, git diff command, commit flag escapes, and deny-message template shared by the session edit stage gate trio |
|
|
70
|
-
| `session_env_cleanup_constants.py` | Stale-age threshold and directory names for the session-env cleanup hook |
|
|
71
|
-
| `session_start_injector.py` | Pure SessionStart context injector: normalize `source` (`startup`/`resume`/`clear`/`compact`), honor enable/timeout, return structured injection results for starter hooks |
|
|
72
|
-
| `session_start_injector_constants.py` | Known SessionStart source values, injection status codes, enable env var, default timeout for the shared injector |
|
|
73
|
-
| `test_session_start_injector.py` | Behavioral tests for every known source, disabled, timeout, and unknown-source paths |
|
|
74
|
-
| `orchestrator_auto_starter_constants.py` | Opt-in env var, enable values, timeout, and SessionStart directive text for the orchestrator auto-starter |
|
|
75
|
-
| `issue_tracker_session_starter_constants.py` | Opt-in env var, enable values, timeout, and SessionStart directive text for the repository-gated issue-tracker starter |
|
|
76
|
-
| `session_handoff_blocker_constants.py` | Trigger phrases for the session-handoff blocker |
|
|
77
|
-
| `setup_project_paths_constants.py` | Encoding policy, BOM marker, and registry meta-key used across multiple hooks |
|
|
78
|
-
| `shell_command_pipeline.py` | Quote-aware shell pipeline parsing: operator-paired segments after line-continuation join, comment strip, heredoc body drop, and parenthesis-group join |
|
|
79
|
-
| `shell_command_segments.py` | Shell tokenization helpers shared by the segment-walking blockers: segment splitting on control operators, a segment's effective leading program, and a token's basename |
|
|
80
|
-
| `shell_substitution_blocker_constants.py` | Tool name, payload keys, the four substitution-detection patterns, the deny decision shape, and the corrective message for the shell-substitution blocker |
|
|
81
|
-
| `stale_comment_reference_blocker_constants.py` | Identifier pattern, comment stopwords, and denial text for the stale-comment-reference blocker |
|
|
82
|
-
| `state_description_blocker_constants.py` | The set of historical/comparative phrases the state-description blocker rejects, plus the docstring-extraction and mention-span patterns for its Python docstring scan |
|
|
83
|
-
| `stop_dispatcher_constants.py` | Ordered hosted-hook roster and Stop block payload field names for the Stop-chain dispatcher |
|
|
84
|
-
| `stuttering_check_config.py` | Config for the stuttering (repeated-phrase) check |
|
|
85
|
-
| `stuttering_import_binding_constants.py` | Import-binding patterns for the stuttering check |
|
|
86
|
-
| `subprocess_budget_completeness_constants.py` | Required argument names for the subprocess-budget completeness check |
|
|
87
|
-
| `sys_path_insert_constants.py` | Patterns for detecting unguarded `sys.path.insert` calls |
|
|
88
|
-
| `task_list_loop_starter_constants.py` | The one-line task-list instruction and the full session-start directive text for the task-list loop starter hook |
|
|
89
|
-
| `test_layout_constants.py` | The named constants for the test-layout write-time checks |
|
|
90
|
-
| `text_stripping.py` | `strip_code_and_quotes()` — shared helper that removes fenced code blocks, inline code, and blockquotes from prose, imported by the Stop-hook prose blockers |
|
|
91
|
-
| `unscoped_search_blocker_constants.py` | Tool names, `find` and listing program basenames, Get-ChildItem option sets, unscoped-root patterns, the flag/value token stride, and the deny message for the unscoped-search blocker |
|
|
92
|
-
| `unused_module_import_constants.py` | Patterns for detecting unused module-level imports |
|
|
93
|
-
| `volatile_path_in_post_blocker_constants.py` | Volatile path markers, affected `gh` post subcommands, MCP body param names, and the corrective message for the volatile-path post blocker |
|
|
94
|
-
| `windows_rmtree_blocker_constants.py` | The unsafe `shutil.rmtree` pattern and the safe replacement pattern |
|
|
95
|
-
| `workflow_substitution_slot_blocker_constants.py` | Per-iteration token patterns for the workflow-slot blocker |
|
|
96
|
-
| `working_style_prompt_constants.py` | The fixed multi-paragraph working-style prompt text for the SessionStart working_style_prompt hook |
|
|
97
|
-
|
|
98
|
-
## Conventions
|
|
99
|
-
|
|
100
|
-
- Most files in this package are pure constants modules — no side effects, no I/O.
|
|
101
|
-
- Hooks import from this package with `from hooks_constants.<module> import <CONSTANT>`.
|
|
102
|
-
- Tests for these modules live beside them as `test_<module>.py`. Run with `python -m pytest hooks_constants/test_<name>.py`.
|
|
103
|
-
- `dynamic_stderr_handler.py`, `pre_tool_use_stdin.py`, `multi_edit_reconstruction.py`, `hosted_hook_runner.py`, and `text_stripping.py` are utility modules (not pure constants) but live here because they hold logic shared across hook surfaces.
|
|
104
|
-
- `local_identity.py` is a loader: it reads the environment or `~/.claude/local-identity.json` (its path overridable via `CLAUDE_LOCAL_IDENTITY_PATH`) to resolve private NAS values (with committed placeholder defaults), the PII commit-scan exempt-repo slug set (`CLAUDE_PII_EXEMPT_REPOS` / `pii_exempt_repositories`), and the per-repository allowlisted-values mapping (`pii_allowlisted_values`).
|
|
1
|
+
@AGENTS.md
|
|
@@ -123,7 +123,7 @@ SUMMARY_COLUMN_HEADINGS: tuple[str, str, str, str] = (
|
|
|
123
123
|
"top_blocked_command_preview",
|
|
124
124
|
)
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
SUMMARY_ZERO_BLOCKED_EVENTS_MESSAGE: str = "Blocked events recorded in the last 24 hours: 0."
|
|
127
127
|
|
|
128
128
|
QUERY_NO_ROWS_RETURNED_MESSAGE: str = "No rows returned."
|
|
129
129
|
|
|
@@ -231,4 +231,3 @@ WINDOWS_CREATE_NEW_PROCESS_GROUP_FLAG: int = 0x00000200
|
|
|
231
231
|
|
|
232
232
|
LOCK_MAXIMUM_RETRY_COUNT: int = 30
|
|
233
233
|
LOCK_RETRY_SLEEP_SECONDS: float = 0.1
|
|
234
|
-
|
|
@@ -11,8 +11,9 @@ TASK_LIST_MAINTENANCE_INSTRUCTION = "build or update the task list using the tas
|
|
|
11
11
|
|
|
12
12
|
TASK_LIST_LOOP_DIRECTIVE = (
|
|
13
13
|
"TASK LIST MAINTENANCE: Keep this session's task list current on a 10-minute "
|
|
14
|
-
"cadence.
|
|
15
|
-
"
|
|
14
|
+
"cadence. Reuse the active task-list maintenance loop when available. Start "
|
|
15
|
+
"Claude Code's built-in /loop skill with a 10-minute interval when this session "
|
|
16
|
+
"needs its first loop: "
|
|
16
17
|
f'/loop 10m "{TASK_LIST_MAINTENANCE_INSTRUCTION}". Run that instruction once '
|
|
17
|
-
"immediately, then let the loop refresh the list every 10 minutes."
|
|
18
|
+
"immediately when starting the loop, then let the loop refresh the list every 10 minutes."
|
|
18
19
|
)
|