capt-hook 3.8.0__tar.gz → 3.9.0__tar.gz
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.
- {capt_hook-3.8.0 → capt_hook-3.9.0}/PKG-INFO +1 -1
- capt_hook-3.9.0/captain_hook/packs/go/capt-hook.toml +4 -0
- capt_hook-3.9.0/captain_hook/packs/go/testing.py +87 -0
- capt_hook-3.9.0/captain_hook/packs/go/toolchain.py +46 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/pyproject.toml +1 -1
- {capt_hook-3.8.0 → capt_hook-3.9.0}/LICENSE +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/README.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/.claude-plugin/plugin.json +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/__main__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/app.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/classifiers/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/classifiers/conductor.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/classifiers/droid.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/classifiers/native.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/cli.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/command.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/conditions.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/context.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/decisions.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/dispatch.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/events.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/file.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/llm/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/loader.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/log.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/capt-hook.toml +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/commands.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/docs.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/plans.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/prompts.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/review.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/stewardship.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/general/tasks.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/manager.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/python/capt-hook.toml +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/python/style.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/python/testing.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/packs/python/toolchain.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/commands.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/lint.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/llm.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/nudge.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/primitives/workflow.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/prompt.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/py.typed +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/cli.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/dashboard.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/fix.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/formats.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/judge.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/pipeline.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/repo.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/scan.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/settings.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/store.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/review/sync.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/session.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/settings.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/signals/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/signals/nlp.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/SKILL.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/capt-hook-api.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/pattern-catalog.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/pitfalls.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/testing-hooks.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/bootstrapping-hooks/SKILL.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/scanning-sessions/SKILL.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/scanning-sessions/references/pr-workflow.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/scanning-sessions/references/review-cli.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/translating-styleguides/SKILL.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/translating-styleguides/references/llm-rule-patterns.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/translating-styleguides/references/matcher-reference.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/translating-styleguides/references/tier-rubric.md +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/state.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/style/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/style/matchers.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/style/scope.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/style/types.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/tasks.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/templates/example_hook.py.tmpl +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/testing/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/testing/helpers.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/testing/session_cache.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/testing/types.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/tests/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/tests/helpers.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/types.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/util/__init__.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/util/model_cache.py +0 -0
- {capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/utils.py +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from captain_hook import (
|
|
4
|
+
Allow,
|
|
5
|
+
BaseHookEvent,
|
|
6
|
+
Block,
|
|
7
|
+
CustomCondition,
|
|
8
|
+
Event,
|
|
9
|
+
FilePath,
|
|
10
|
+
Input,
|
|
11
|
+
RanCommand,
|
|
12
|
+
Tool,
|
|
13
|
+
Warn,
|
|
14
|
+
gate,
|
|
15
|
+
nudge,
|
|
16
|
+
)
|
|
17
|
+
from captain_hook.types import Command as CommandCondition
|
|
18
|
+
|
|
19
|
+
nudge(
|
|
20
|
+
"""
|
|
21
|
+
When a test fails, isolate the minimal failing case before retrying. Use a
|
|
22
|
+
`-run TestName/case` regex or a single package path. Broad `go test ./...`
|
|
23
|
+
re-runs after a failure waste cycles and hide the real breakage.
|
|
24
|
+
""",
|
|
25
|
+
only_if=[Tool("Edit|Write"), FilePath("*_test.go")],
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class UserSaid(CustomCondition):
|
|
30
|
+
"""Matches when the user's messages contain any of the given keywords."""
|
|
31
|
+
|
|
32
|
+
def __init__(self, *keywords: str) -> None:
|
|
33
|
+
self.keywords = keywords
|
|
34
|
+
|
|
35
|
+
def check(self, evt: BaseHookEvent) -> bool:
|
|
36
|
+
return evt.ctx.t.user_said(*self.keywords)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AllEditsUnder(CustomCondition):
|
|
40
|
+
"""Matches when every edit this session is under one of the given path prefixes."""
|
|
41
|
+
|
|
42
|
+
def __init__(self, *prefixes: str) -> None:
|
|
43
|
+
self.prefixes = prefixes
|
|
44
|
+
|
|
45
|
+
def check(self, evt: BaseHookEvent) -> bool:
|
|
46
|
+
return bool(files := evt.ctx.t.edited_files) and all(f.under(*self.prefixes) for f in files)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class CommitsGo(CustomCondition):
|
|
50
|
+
"""Matches when the git command explicitly names a Go path."""
|
|
51
|
+
|
|
52
|
+
def check(self, evt: BaseHookEvent) -> bool:
|
|
53
|
+
return bool(cl := evt.command_line) and ".go" in str(cl.primary)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
gate(
|
|
57
|
+
"No `go test` execution found. Run tests before committing Go changes.",
|
|
58
|
+
only_if=[Tool("Bash"), CommandCondition(r"git\s+commit"), CommitsGo()],
|
|
59
|
+
skip_if=[
|
|
60
|
+
RanCommand(r"go test"),
|
|
61
|
+
UserSaid("commit", "just commit"),
|
|
62
|
+
AllEditsUnder("docs/", ".claude/", ".github/"),
|
|
63
|
+
],
|
|
64
|
+
events=Event.PreToolUse,
|
|
65
|
+
tests={
|
|
66
|
+
Input(command="git status"): Allow(),
|
|
67
|
+
Input(command="git commit internal/cli/root.go"): Block(),
|
|
68
|
+
},
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
nudge(
|
|
73
|
+
"No `go test` execution detected in this session. If you changed Go files, run tests "
|
|
74
|
+
"before committing. If this is a docs/config-only change, proceed.",
|
|
75
|
+
only_if=[Tool("Bash"), CommandCondition(r"git\s+commit")],
|
|
76
|
+
skip_if=[
|
|
77
|
+
RanCommand(r"go test"),
|
|
78
|
+
UserSaid("commit", "just commit"),
|
|
79
|
+
AllEditsUnder("docs/", ".claude/", ".github/"),
|
|
80
|
+
CommitsGo(),
|
|
81
|
+
],
|
|
82
|
+
events=Event.PreToolUse,
|
|
83
|
+
tests={
|
|
84
|
+
Input(command="git status"): Allow(),
|
|
85
|
+
Input(command="git commit -m wip"): Warn(),
|
|
86
|
+
},
|
|
87
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from captain_hook import Allow, Block, Event, Input, Tool, block_command, nudge
|
|
6
|
+
from captain_hook.events import PostToolUseFailureEvent
|
|
7
|
+
|
|
8
|
+
block_command(
|
|
9
|
+
r"^gofumpt\b",
|
|
10
|
+
reason="Do not run gofumpt manually — formatting is applied by the commit hook (golangci-lint fmt)",
|
|
11
|
+
hint="See AGENTS.md § Mechanical Linting. The prek hook formats on commit; `task fmt` runs it deliberately.",
|
|
12
|
+
tests={
|
|
13
|
+
Input(command="gofumpt -w ."): Block(),
|
|
14
|
+
Input(command="go build ./..."): Allow(),
|
|
15
|
+
},
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
block_command(
|
|
19
|
+
r"^golangci-lint\b",
|
|
20
|
+
reason="Do not run golangci-lint manually — CI and the commit hook own linting",
|
|
21
|
+
hint="See AGENTS.md § Mechanical Linting. Only fix issues requiring human judgment.",
|
|
22
|
+
tests={
|
|
23
|
+
Input(command="golangci-lint run"): Block(),
|
|
24
|
+
Input(command="golangci-lint fmt"): Block(),
|
|
25
|
+
Input(command="go vet ./..."): Allow(),
|
|
26
|
+
Input(command="uvx prek run --all-files"): Allow(),
|
|
27
|
+
},
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
nudge(
|
|
31
|
+
"MISSING DEPENDENCY: run `go mod tidy` (or `go get <module>`) to resolve it. "
|
|
32
|
+
"Do NOT make the import lazy, delete the importing code, or vendor by hand.",
|
|
33
|
+
events=Event.PostToolUseFailure,
|
|
34
|
+
only_if=[Tool("Bash")],
|
|
35
|
+
when=lambda evt: (
|
|
36
|
+
isinstance(evt, PostToolUseFailureEvent)
|
|
37
|
+
and bool(
|
|
38
|
+
re.search(
|
|
39
|
+
r"no required module provides package|missing go\.sum entry|"
|
|
40
|
+
r"cannot find module|updates to go\.mod needed",
|
|
41
|
+
evt.error,
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
),
|
|
45
|
+
max_fires=2,
|
|
46
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/capt-hook-api.md
RENAMED
|
File without changes
|
|
File without changes
|
{capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/pitfalls.md
RENAMED
|
File without changes
|
{capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/authoring-hooks/references/testing-hooks.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/scanning-sessions/references/pr-workflow.md
RENAMED
|
File without changes
|
{capt_hook-3.8.0 → capt_hook-3.9.0}/captain_hook/skills/scanning-sessions/references/review-cli.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|