claude-dev-env 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/.agents/skills/everything-search/SKILL.md +18 -3
  2. package/.agents/skills/everything-search/scripts/everything_search.py +204 -0
  3. package/.agents/skills/everything-search/scripts/everything_search_command_constants/__init__.py +1 -0
  4. package/.agents/skills/everything-search/scripts/everything_search_command_constants/config/__init__.py +1 -0
  5. package/.agents/skills/everything-search/scripts/everything_search_command_constants/config/constants.py +11 -0
  6. package/.agents/skills/everything-search/scripts/test_everything_search.py +172 -0
  7. package/.agents/skills/syncing-submodules/SKILL.md +101 -0
  8. package/.agents/skills/syncing-submodules/reference/run-tasks.md +9 -0
  9. package/.agents/skills/syncing-submodules/scripts/submodule_sync.py +383 -0
  10. package/.agents/skills/syncing-submodules/scripts/submodule_sync_constants/__init__.py +1 -0
  11. package/.agents/skills/syncing-submodules/scripts/submodule_sync_constants/config/__init__.py +1 -0
  12. package/.agents/skills/syncing-submodules/scripts/submodule_sync_constants/config/constants.py +66 -0
  13. package/.agents/skills/syncing-submodules/scripts/sync_parent_pointer.py +88 -0
  14. package/.agents/skills/syncing-submodules/scripts/test_submodule_sync.py +303 -0
  15. package/.agents/skills/syncing-submodules/scripts/test_sync_parent_pointer.py +83 -0
  16. package/bin/ever-shipped-skills.mjs +1 -0
  17. package/bin/ever-shipped-skills.test.mjs +30 -0
  18. package/bin/git_hooks_installer.mjs +0 -1
  19. package/bin/git_hooks_installer.test.mjs +16 -1
  20. package/bin/install.mjs +5 -2
  21. package/bin/install.prune.test.mjs +95 -24
  22. package/bin/install.test.mjs +7 -0
  23. package/hooks/hooks_constants/bash_pre_tool_use_dispatcher_constants.py +5 -8
  24. package/hooks/hooks_constants/test_bash_pre_tool_use_dispatcher_constants.py +7 -13
  25. package/package.json +1 -1
  26. package/rules/filesystem-search.md +5 -5
  27. package/hooks/blocking/es_exe_path_rewriter.py +0 -159
  28. package/hooks/blocking/test_es_exe_path_rewriter.py +0 -447
  29. package/hooks/git-hooks/post_commit.py +0 -241
  30. package/hooks/git-hooks/test_post_commit.py +0 -298
  31. package/hooks/hooks_constants/path_rewriter_constants.py +0 -13
  32. package/hooks/hooks_constants/test_path_rewriter_constants.py +0 -57
@@ -1,298 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import os
4
- import subprocess
5
- from pathlib import Path
6
-
7
- import post_commit
8
- import pytest
9
- from git_hooks_constants import GIT_EXECUTABLE_NAME
10
-
11
-
12
- def build_fixture_git_environment() -> dict[str, str]:
13
- """Copy the process environment without inherited Git state overrides."""
14
- return {
15
- each_name: each_value
16
- for each_name, each_value in os.environ.items()
17
- if not each_name.upper().startswith("GIT_")
18
- }
19
-
20
-
21
- def clear_inherited_git_environment(monkeypatch: pytest.MonkeyPatch) -> None:
22
- """Remove inherited Git state overrides from the current test process."""
23
- for each_name in list(os.environ):
24
- if each_name.upper().startswith("GIT_"):
25
- monkeypatch.delenv(each_name, raising=False)
26
-
27
-
28
- def test_fixture_git_environment_preserves_process_execution_path(
29
- monkeypatch: pytest.MonkeyPatch,
30
- ) -> None:
31
- """The fixture environment keeps PATH while removing Git overrides."""
32
- monkeypatch.setenv("PATH", "fixture-execution-path")
33
- monkeypatch.setenv("GIT_DIR", "unrelated-repository")
34
-
35
- fixture_environment = build_fixture_git_environment()
36
-
37
- assert fixture_environment["PATH"] == "fixture-execution-path"
38
- assert all(not each_name.upper().startswith("GIT_") for each_name in fixture_environment)
39
-
40
-
41
- def run_fixture_git(repository_path: Path, *arguments: str) -> str:
42
- """Run Git in a fixture repository and return standard output."""
43
- completed_process = subprocess.run(
44
- [GIT_EXECUTABLE_NAME, *arguments],
45
- cwd=repository_path,
46
- check=False,
47
- capture_output=True,
48
- text=True,
49
- env=build_fixture_git_environment(),
50
- )
51
- assert completed_process.returncode == 0, completed_process.stderr
52
- return completed_process.stdout.strip()
53
-
54
-
55
- def configure_fixture_identity(repository_path: Path) -> None:
56
- """Configure a stable identity for a fixture repository."""
57
- run_fixture_git(repository_path, "config", "user.name", "Fixture User")
58
- run_fixture_git(
59
- repository_path,
60
- "config",
61
- "user.email",
62
- "fixture@example.invalid",
63
- )
64
- run_fixture_git(repository_path, "config", "commit.gpgsign", "false")
65
- fixture_hooks_directory = repository_path / ".fixture-hooks"
66
- fixture_hooks_directory.mkdir(exist_ok=True)
67
- run_fixture_git(
68
- repository_path,
69
- "config",
70
- "core.hooksPath",
71
- str(fixture_hooks_directory),
72
- )
73
-
74
-
75
- def initialize_fixture_repository(repository_path: Path) -> None:
76
- """Create and configure a fixture Git repository."""
77
- repository_path.mkdir()
78
- run_fixture_git(repository_path, "init", "-b", "main")
79
- configure_fixture_identity(repository_path)
80
-
81
-
82
- def test_native_submodule_commit_records_parent_pointer(
83
- tmp_path: Path,
84
- monkeypatch: pytest.MonkeyPatch,
85
- ) -> None:
86
- """A real submodule commit creates the matching parent pointer commit."""
87
- unrelated_repository = tmp_path / "unrelated-repository"
88
- initialize_fixture_repository(unrelated_repository)
89
- monkeypatch.setenv("GIT_DIR", str(unrelated_repository / ".git"))
90
-
91
- source_repository = tmp_path / "source-repository"
92
- parent_repository = tmp_path / "parent-repository"
93
- initialize_fixture_repository(source_repository)
94
- (source_repository / "README.md").write_text("fixture source\n", encoding="utf-8")
95
- run_fixture_git(source_repository, "add", "README.md")
96
- run_fixture_git(source_repository, "commit", "-m", "Create fixture source")
97
-
98
- initialize_fixture_repository(parent_repository)
99
- (parent_repository / "README.md").write_text("fixture parent\n", encoding="utf-8")
100
- run_fixture_git(parent_repository, "add", "README.md")
101
- run_fixture_git(parent_repository, "commit", "-m", "Create fixture parent")
102
- run_fixture_git(
103
- parent_repository,
104
- "-c",
105
- "protocol.file.allow=always",
106
- "submodule",
107
- "add",
108
- str(source_repository),
109
- "nested/sub[module]",
110
- )
111
- run_fixture_git(parent_repository, "commit", "-am", "Add fixture submodule")
112
-
113
- submodule_repository = parent_repository / "nested" / "sub[module]"
114
- configure_fixture_identity(submodule_repository)
115
- (parent_repository / "staged-note.txt").write_text("keep staged\n", encoding="utf-8")
116
- run_fixture_git(parent_repository, "add", "staged-note.txt")
117
- (submodule_repository / "change.txt").write_text("fixture change\n", encoding="utf-8")
118
- run_fixture_git(submodule_repository, "add", "change.txt")
119
- run_fixture_git(submodule_repository, "commit", "-m", "Record fixture change")
120
- clear_inherited_git_environment(monkeypatch)
121
- monkeypatch.chdir(submodule_repository)
122
- assert post_commit.main() == 0
123
-
124
- submodule_commit_hash = run_fixture_git(submodule_repository, "rev-parse", "HEAD")
125
- parent_commit_subject = run_fixture_git(parent_repository, "log", "-1", "--pretty=%s")
126
- parent_commit_body = run_fixture_git(parent_repository, "log", "-1", "--pretty=%B")
127
- recorded_pointer_hash = run_fixture_git(
128
- parent_repository,
129
- "rev-parse",
130
- "HEAD:nested/sub[module]",
131
- )
132
-
133
- assert recorded_pointer_hash == submodule_commit_hash
134
- assert parent_commit_subject == (
135
- f"chore: update sub[module] submodule to {submodule_commit_hash}"
136
- )
137
- assert "Submodule commit: Record fixture change" in parent_commit_body
138
- assert run_fixture_git(parent_repository, "status", "--short") == "A staged-note.txt"
139
-
140
-
141
- def test_parent_update_returns_git_diagnostic_for_failed_add(
142
- tmp_path: Path,
143
- monkeypatch: pytest.MonkeyPatch,
144
- ) -> None:
145
- """A failed parent add returns the Git diagnostic and literal pathspec."""
146
- parent_repository = tmp_path / "parent-repository"
147
- submodule_repository = parent_repository / "sub[module]"
148
- submodule_repository.mkdir(parents=True)
149
- recorded_commands: list[tuple[str, ...]] = []
150
-
151
- def fail_git_add(*arguments: str, cwd: Path) -> subprocess.CompletedProcess[str]:
152
- recorded_commands.append(arguments)
153
- return subprocess.CompletedProcess(
154
- ["git", *arguments],
155
- 1,
156
- "",
157
- "fatal: fixture add failure",
158
- )
159
-
160
- monkeypatch.setattr(post_commit, "execute_git", fail_git_add)
161
-
162
- parent_update = post_commit.update_parent_pointer(
163
- parent_repository,
164
- submodule_repository,
165
- "a" * 40,
166
- "Fixture commit",
167
- )
168
-
169
- assert parent_update == (
170
- post_commit.ParentPointerStatus.FAILED,
171
- "fatal: fixture add failure",
172
- )
173
- assert recorded_commands == [("add", "--", ":(literal)sub[module]")]
174
-
175
-
176
- def test_main_prints_git_failure_diagnostic(
177
- tmp_path: Path,
178
- monkeypatch: pytest.MonkeyPatch,
179
- capsys: pytest.CaptureFixture[str],
180
- ) -> None:
181
- """The hook prints the Git diagnostic when the parent update fails."""
182
- submodule_repository = tmp_path / "submodule"
183
- parent_repository = tmp_path / "parent"
184
- submodule_repository.mkdir()
185
- parent_repository.mkdir()
186
- monkeypatch.setattr(
187
- post_commit,
188
- "run_git_from_current_directory",
189
- lambda *arguments: str(submodule_repository),
190
- )
191
- monkeypatch.setattr(post_commit, "find_parent_repo", lambda repo: parent_repository)
192
- monkeypatch.setattr(post_commit, "run_git", lambda *arguments, cwd: "a" * 40)
193
- monkeypatch.setattr(
194
- post_commit,
195
- "update_parent_pointer",
196
- lambda *arguments: (
197
- post_commit.ParentPointerStatus.FAILED,
198
- "fatal: fixture commit failure",
199
- ),
200
- )
201
-
202
- assert post_commit.main() == 0
203
- assert "Git diagnostic: fatal: fixture commit failure" in capsys.readouterr().out
204
-
205
-
206
- @pytest.mark.parametrize(
207
- "completed_process",
208
- [
209
- subprocess.CompletedProcess(["gh"], 1, "", "no pull request"),
210
- subprocess.CompletedProcess(["gh"], 1, "", "auth failed"),
211
- ],
212
- )
213
- def test_pull_request_reminder_is_silent_without_successful_url(
214
- tmp_path: Path,
215
- monkeypatch: pytest.MonkeyPatch,
216
- capsys: pytest.CaptureFixture[str],
217
- completed_process: subprocess.CompletedProcess[str],
218
- ) -> None:
219
- monkeypatch.setattr(post_commit.subprocess, "run", lambda *args, **kwargs: completed_process)
220
-
221
- post_commit.print_pull_request_reminder(tmp_path)
222
-
223
- assert capsys.readouterr().out == ""
224
-
225
-
226
- def test_pull_request_reminder_prints_url(
227
- tmp_path: Path,
228
- monkeypatch: pytest.MonkeyPatch,
229
- capsys: pytest.CaptureFixture[str],
230
- ) -> None:
231
- monkeypatch.setattr(
232
- post_commit.subprocess,
233
- "run",
234
- lambda *args, **kwargs: subprocess.CompletedProcess(
235
- ["gh"], 0, "https://github.com/example/repo/pull/1\n", ""
236
- ),
237
- )
238
-
239
- post_commit.print_pull_request_reminder(tmp_path)
240
-
241
- output = capsys.readouterr().out
242
- assert output.startswith("Review this pull request: https://github.com/example/repo/pull/1\n")
243
- assert "<PR link>" not in output
244
- assert "Do not use the branch name, commit message, labels, current title" in output
245
- assert (
246
- "Before writing, inventory every independently observable behavior in the full diff."
247
- in output
248
- and "Lead with the central behavior for readability, then give every other behavior its own short paragraph or bullet."
249
- in output
250
- and "For each behavior, state the trigger or observer, the Before -> After result" in output
251
- and "OVERRIDE:" not in output
252
- )
253
- assert "gh pr edit https://github.com/example/repo/pull/1" in output
254
- assert output.rstrip().endswith("Report the saved result.")
255
-
256
-
257
- @pytest.mark.parametrize("exception", [FileNotFoundError(), subprocess.TimeoutExpired("gh", 5)])
258
- def test_pull_request_reminder_ignores_missing_gh_and_timeout(
259
- tmp_path: Path,
260
- monkeypatch: pytest.MonkeyPatch,
261
- capsys: pytest.CaptureFixture[str],
262
- exception: Exception,
263
- ) -> None:
264
- def raise_exception(*args: object, **kwargs: object) -> None:
265
- raise exception
266
-
267
- monkeypatch.setattr(post_commit.subprocess, "run", raise_exception)
268
-
269
- post_commit.print_pull_request_reminder(tmp_path)
270
-
271
- assert capsys.readouterr().out == ""
272
-
273
-
274
- def test_main_runs_pull_request_reminder_after_parent_update(
275
- tmp_path: Path,
276
- monkeypatch: pytest.MonkeyPatch,
277
- ) -> None:
278
- events: list[str] = []
279
- repo = tmp_path / "repo"
280
- parent = tmp_path / "parent"
281
- repo.mkdir()
282
- parent.mkdir()
283
- monkeypatch.setattr(post_commit, "run_git_from_current_directory", lambda *args: str(repo))
284
- monkeypatch.setattr(post_commit, "find_parent_repo", lambda repo_dir: parent)
285
- monkeypatch.setattr(post_commit, "run_git", lambda *args, cwd: "a" * 40)
286
- monkeypatch.setattr(
287
- post_commit,
288
- "update_parent_pointer",
289
- lambda *args: events.append("parent") or (post_commit.ParentPointerStatus.UPDATED, ""),
290
- )
291
- monkeypatch.setattr(
292
- post_commit,
293
- "print_pull_request_reminder",
294
- lambda repo_dir: events.append("reminder"),
295
- )
296
-
297
- assert post_commit.main() == 0
298
- assert events == ["parent", "reminder"]
@@ -1,13 +0,0 @@
1
- """Configuration constants for the es_exe_path_rewriter PreToolUse hook."""
2
-
3
- import re
4
-
5
- BASH_TOOL_NAME = "Bash"
6
-
7
- HOOK_EVENT_NAME = "PreToolUse"
8
-
9
- PERMISSION_ALLOW = "allow"
10
-
11
- PLACEHOLDER_TOKEN_PATTERN = re.compile(
12
- r"""(?:(?<=\s)|^)['"]?(?<!\$)\{([^}]+)\}['"]?(?=\s|$)""",
13
- )
@@ -1,57 +0,0 @@
1
- """Pin tests for path_rewriter_constants — values consumed by es_exe_path_rewriter."""
2
-
3
- import sys
4
- from pathlib import Path
5
-
6
- _HOOKS_ROOT = Path(__file__).resolve().parent.parent
7
- if str(_HOOKS_ROOT) not in sys.path:
8
- sys.path.insert(0, str(_HOOKS_ROOT))
9
-
10
- from hooks_constants.path_rewriter_constants import (
11
- BASH_TOOL_NAME,
12
- HOOK_EVENT_NAME,
13
- PERMISSION_ALLOW,
14
- PLACEHOLDER_TOKEN_PATTERN,
15
- )
16
-
17
-
18
- def test_bash_tool_name_is_bash() -> None:
19
- assert BASH_TOOL_NAME == "Bash"
20
-
21
-
22
- def test_hook_event_name_is_pre_tool_use() -> None:
23
- assert HOOK_EVENT_NAME == "PreToolUse"
24
-
25
-
26
- def test_permission_allow_is_allow() -> None:
27
- assert PERMISSION_ALLOW == "allow"
28
-
29
-
30
- def test_placeholder_token_pattern_matches_curly_brace_form() -> None:
31
- match = PLACEHOLDER_TOKEN_PATTERN.match("{my-repo}")
32
- assert match is not None
33
- assert match.group(1) == "my-repo"
34
-
35
-
36
- def test_placeholder_token_pattern_matches_double_quoted_form() -> None:
37
- match = PLACEHOLDER_TOKEN_PATTERN.match('"{my-repo}"')
38
- assert match is not None
39
- assert match.group(1) == "my-repo"
40
-
41
-
42
- def test_placeholder_token_pattern_matches_single_quoted_form() -> None:
43
- match = PLACEHOLDER_TOKEN_PATTERN.match("'{my-repo}'")
44
- assert match is not None
45
- assert match.group(1) == "my-repo"
46
-
47
-
48
- def test_placeholder_token_pattern_does_not_match_shell_parameter_expansion() -> None:
49
- assert PLACEHOLDER_TOKEN_PATTERN.search("${myrepo}") is None
50
-
51
-
52
- def test_placeholder_token_pattern_does_not_match_embedded_in_flag() -> None:
53
- assert PLACEHOLDER_TOKEN_PATTERN.search("--flag={my-repo}") is None
54
-
55
-
56
- def test_placeholder_token_pattern_does_not_match_embedded_in_token() -> None:
57
- assert PLACEHOLDER_TOKEN_PATTERN.search("foo{my-repo}bar") is None