xtrm-tools 2.1.5 → 2.1.7
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/README.md +9 -3
- package/cli/dist/index.cjs +991 -908
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +4 -1
- package/config/hooks.json +5 -0
- package/hooks/README.md +19 -0
- package/hooks/beads-stop-gate.mjs +1 -0
- package/hooks/main-guard-post-push.mjs +71 -0
- package/hooks/main-guard.mjs +10 -1
- package/package.json +17 -5
- package/project-skills/{ts-quality-gate → quality-gates}/.claude/hooks/quality-check.cjs +36 -1
- package/project-skills/{py-quality-gate → quality-gates}/.claude/hooks/quality-check.py +15 -2
- package/project-skills/{py-quality-gate → quality-gates}/.claude/settings.json +10 -0
- package/project-skills/quality-gates/.claude/skills/using-quality-gates/SKILL.md +254 -0
- package/project-skills/quality-gates/README.md +109 -0
- package/project-skills/quality-gates/evals/evals.json +181 -0
- package/project-skills/quality-gates/workspace/iteration-1/FINAL-EVAL-SUMMARY.md +75 -0
- package/project-skills/quality-gates/workspace/iteration-1/edge-case-auto-fix-verification/with_skill/outputs/response.md +59 -0
- package/project-skills/quality-gates/workspace/iteration-1/edge-case-mixed-language-project/with_skill/outputs/response.md +60 -0
- package/project-skills/quality-gates/workspace/iteration-1/eval-summary.md +105 -0
- package/project-skills/quality-gates/workspace/iteration-1/partial-install-python-only/with_skill/outputs/response.md +93 -0
- package/project-skills/quality-gates/workspace/iteration-1/python-refactor-request/with_skill/outputs/response.md +104 -0
- package/project-skills/quality-gates/workspace/iteration-1/quality-gate-error-fix/with_skill/outputs/response.md +74 -0
- package/project-skills/quality-gates/workspace/iteration-1/should-not-trigger-general-chat/with_skill/outputs/response.md +18 -0
- package/project-skills/quality-gates/workspace/iteration-1/should-not-trigger-math-question/with_skill/outputs/response.md +18 -0
- package/project-skills/quality-gates/workspace/iteration-1/should-not-trigger-unrelated-coding/with_skill/outputs/response.md +56 -0
- package/project-skills/quality-gates/workspace/iteration-1/tdd-guard-blocking-confusion/with_skill/outputs/response.md +67 -0
- package/project-skills/quality-gates/workspace/iteration-1/typescript-feature-with-tests/with_skill/outputs/response.md +97 -0
- package/project-skills/service-skills-set/install-service-skills.py +41 -11
- package/project-skills/tdd-guard/.claude/hooks/tdd-guard-pretool-bridge.cjs +0 -1
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test-data.ts +199 -0
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.test.ts +302 -0
- package/project-skills/tdd-guard/reporters/jest/src/JestReporter.ts +201 -0
- package/project-skills/tdd-guard/reporters/jest/src/index.ts +4 -0
- package/project-skills/tdd-guard/reporters/jest/src/types.ts +42 -0
- package/project-skills/tdd-guard/reporters/jest/tsconfig.json +11 -0
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test-data.ts +85 -0
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.test.ts +446 -0
- package/project-skills/tdd-guard/reporters/vitest/src/VitestReporter.ts +110 -0
- package/project-skills/tdd-guard/reporters/vitest/src/index.ts +4 -0
- package/project-skills/tdd-guard/reporters/vitest/src/types.ts +39 -0
- package/project-skills/tdd-guard/reporters/vitest/tsconfig.json +11 -0
- package/hooks/__pycache__/agent_context.cpython-314.pyc +0 -0
- package/project-skills/py-quality-gate/.claude/skills/using-py-quality-gate/SKILL.md +0 -112
- package/project-skills/py-quality-gate/README.md +0 -147
- package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/doc_reminder.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/skill_staleness.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/creating-service-skills/scripts/__pycache__/bootstrap.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/updating-service-skills/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/cataloger.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/skill_activator.cpython-314.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/__pycache__/test_skill_activator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/project-skills/service-skills-set/.claude/skills/using-service-skills/scripts/test_skill_activator.py +0 -58
- package/project-skills/service-skills-set/__pycache__/install-service-skills.cpython-314.pyc +0 -0
- package/project-skills/ts-quality-gate/.claude/settings.json +0 -16
- package/project-skills/ts-quality-gate/.claude/skills/using-ts-quality-gate/SKILL.md +0 -81
- package/project-skills/ts-quality-gate/README.md +0 -115
- package/skills/documenting/scripts/__pycache__/drift_detector.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/__pycache__/orchestrator.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/__pycache__/validate_metadata.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/add_entry.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/bump_release.cpython-314.pyc +0 -0
- package/skills/documenting/scripts/changelog/__pycache__/validate_changelog.cpython-314.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_changelog.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_drift_detector.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_orchestrator.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/__pycache__/test_validate_metadata.cpython-314-pytest-9.0.2.pyc +0 -0
- package/skills/documenting/tests/integration_test.sh +0 -70
- package/skills/documenting/tests/test_changelog.py +0 -201
- package/skills/documenting/tests/test_drift_detector.py +0 -80
- package/skills/documenting/tests/test_orchestrator.py +0 -52
- package/skills/documenting/tests/test_validate_metadata.py +0 -64
- /package/project-skills/{ts-quality-gate → quality-gates}/.claude/hooks/hook-config.json +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# Using PY Quality Gate
|
|
2
|
-
|
|
3
|
-
**PY Quality Gate** enforces Python code quality with ruff (linting/formatting) and mypy (type checking). Runs automatically on every file edit.
|
|
4
|
-
|
|
5
|
-
## What It Does
|
|
6
|
-
|
|
7
|
-
- **Ruff linting** - Fast Python linting (10-100x faster than flake8)
|
|
8
|
-
- **Ruff formatting** - Code formatting (Black-compatible)
|
|
9
|
-
- **Mypy type checking** - Static type validation
|
|
10
|
-
- **Auto-fix** - Automatically fixes issues when possible
|
|
11
|
-
- **Fast feedback** - Runs in <1s for most files
|
|
12
|
-
|
|
13
|
-
## How It Works
|
|
14
|
-
|
|
15
|
-
When you edit a Python file:
|
|
16
|
-
|
|
17
|
-
1. PostToolUse hook fires after Write/Edit
|
|
18
|
-
2. Runs `quality-check.py` with the file path
|
|
19
|
-
3. Checks ruff lint, ruff format, mypy types
|
|
20
|
-
4. Auto-fixes issues if configured
|
|
21
|
-
5. Returns exit code 2 if blocking errors found
|
|
22
|
-
|
|
23
|
-
## Requirements
|
|
24
|
-
|
|
25
|
-
- Python 3.8+
|
|
26
|
-
- ruff installed (`pip install ruff`)
|
|
27
|
-
- mypy installed (`pip install mypy`) - optional
|
|
28
|
-
|
|
29
|
-
## Installation
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Install project skill
|
|
33
|
-
xtrm install project py-quality-gate
|
|
34
|
-
|
|
35
|
-
# Install dependencies
|
|
36
|
-
pip install ruff mypy
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Configuration
|
|
40
|
-
|
|
41
|
-
Configure via environment variables in your shell or `.env`:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
# Enable/disable checks
|
|
45
|
-
export CLAUDE_HOOKS_RUFF_ENABLED=true
|
|
46
|
-
export CLAUDE_HOOKS_MYPY_ENABLED=true
|
|
47
|
-
|
|
48
|
-
# Auto-fix settings
|
|
49
|
-
export CLAUDE_HOOKS_AUTOFIX=true
|
|
50
|
-
|
|
51
|
-
# Debug mode
|
|
52
|
-
export CLAUDE_HOOKS_DEBUG=true
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Ruff Configuration
|
|
56
|
-
|
|
57
|
-
Create `pyproject.toml` or `ruff.toml` in your project:
|
|
58
|
-
|
|
59
|
-
```toml
|
|
60
|
-
[tool.ruff]
|
|
61
|
-
line-length = 88
|
|
62
|
-
target-version = "py38"
|
|
63
|
-
|
|
64
|
-
[tool.ruff.lint]
|
|
65
|
-
select = ["E", "F", "W", "I", "N", "UP", "B", "C4"]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Mypy Configuration
|
|
69
|
-
|
|
70
|
-
Create `mypy.ini` or `pyproject.toml`:
|
|
71
|
-
|
|
72
|
-
```ini
|
|
73
|
-
[mypy]
|
|
74
|
-
python_version = 3.8
|
|
75
|
-
warn_return_any = True
|
|
76
|
-
warn_unused_configs = True
|
|
77
|
-
disallow_untyped_defs = False
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Exit Codes
|
|
81
|
-
|
|
82
|
-
| Code | Meaning |
|
|
83
|
-
|------|---------|
|
|
84
|
-
| 0 | All checks passed |
|
|
85
|
-
| 1 | Fatal error (hook crashed) |
|
|
86
|
-
| 2 | Blocking errors found (Claude must fix) |
|
|
87
|
-
|
|
88
|
-
## Troubleshooting
|
|
89
|
-
|
|
90
|
-
**"ruff: command not found"**
|
|
91
|
-
- Install: `pip install ruff` or `pipx install ruff`
|
|
92
|
-
|
|
93
|
-
**"mypy: command not found"**
|
|
94
|
-
- Install: `pip install mypy`
|
|
95
|
-
- Or set `CLAUDE_HOOKS_MYPY_ENABLED=false`
|
|
96
|
-
|
|
97
|
-
**Hook not running**
|
|
98
|
-
- Verify PostToolUse hook in `.claude/settings.json`
|
|
99
|
-
- Check Python path is correct
|
|
100
|
-
|
|
101
|
-
## Test Suggestions
|
|
102
|
-
|
|
103
|
-
The hook automatically suggests running pytest if related test files exist:
|
|
104
|
-
- `test_<filename>.py`
|
|
105
|
-
- `<filename>_test.py`
|
|
106
|
-
- `__tests__/test_<filename>.py`
|
|
107
|
-
|
|
108
|
-
## See Also
|
|
109
|
-
|
|
110
|
-
- Full documentation: `.claude/docs/py-quality-gate-readme.md`
|
|
111
|
-
- Ruff docs: https://docs.astral.sh/ruff/
|
|
112
|
-
- Mypy docs: https://mypy.readthedocs.io/
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# PY Quality Gate
|
|
2
|
-
|
|
3
|
-
**Python quality gate** for Claude Code. Runs ruff (linting/formatting) and mypy (type checking) automatically on every file edit.
|
|
4
|
-
|
|
5
|
-
## What It Does
|
|
6
|
-
|
|
7
|
-
PY Quality Gate enforces Python code quality standards in real-time:
|
|
8
|
-
|
|
9
|
-
| Check | Description | Auto-fix |
|
|
10
|
-
|-------|-------------|----------|
|
|
11
|
-
| **Ruff lint** | Code style, best practices, errors | Yes |
|
|
12
|
-
| **Ruff format** | Black-compatible formatting | Yes |
|
|
13
|
-
| **Mypy types** | Static type checking | No |
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Install project skill
|
|
19
|
-
xtrm install project py-quality-gate
|
|
20
|
-
|
|
21
|
-
# Install Python dependencies
|
|
22
|
-
pip install ruff mypy
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## How It Works
|
|
26
|
-
|
|
27
|
-
The quality gate runs as a `PostToolUse` hook:
|
|
28
|
-
|
|
29
|
-
1. You edit a Python file
|
|
30
|
-
2. After the edit completes, the hook fires
|
|
31
|
-
3. `quality-check.py` validates the file
|
|
32
|
-
4. Issues are reported with auto-fix when possible
|
|
33
|
-
5. Exit code 2 blocks if critical errors found
|
|
34
|
-
|
|
35
|
-
## Configuration
|
|
36
|
-
|
|
37
|
-
### Environment Variables
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# Enable/disable checks
|
|
41
|
-
export CLAUDE_HOOKS_RUFF_ENABLED=true
|
|
42
|
-
export CLAUDE_HOOKS_MYPY_ENABLED=true
|
|
43
|
-
|
|
44
|
-
# Auto-fix settings
|
|
45
|
-
export CLAUDE_HOOKS_AUTOFIX=true
|
|
46
|
-
|
|
47
|
-
# Debug mode
|
|
48
|
-
export CLAUDE_HOOKS_DEBUG=true
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Ruff Configuration
|
|
52
|
-
|
|
53
|
-
Create `pyproject.toml` in your project:
|
|
54
|
-
|
|
55
|
-
```toml
|
|
56
|
-
[tool.ruff]
|
|
57
|
-
line-length = 88
|
|
58
|
-
target-version = "py38"
|
|
59
|
-
|
|
60
|
-
[tool.ruff.lint]
|
|
61
|
-
select = ["E", "F", "W", "I", "N", "UP", "B", "C4"]
|
|
62
|
-
ignore = ["E501"] # Line length (handled by formatter)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Mypy Configuration
|
|
66
|
-
|
|
67
|
-
Create `mypy.ini` in your project:
|
|
68
|
-
|
|
69
|
-
```ini
|
|
70
|
-
[mypy]
|
|
71
|
-
python_version = 3.8
|
|
72
|
-
warn_return_any = True
|
|
73
|
-
warn_unused_configs = True
|
|
74
|
-
disallow_untyped_defs = False
|
|
75
|
-
ignore_missing_imports = True
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Features
|
|
79
|
-
|
|
80
|
-
### Ruff Linting
|
|
81
|
-
- 10-100x faster than flake8
|
|
82
|
-
- Auto-fixes supported
|
|
83
|
-
- 500+ built-in rules
|
|
84
|
-
- Compatible with Black
|
|
85
|
-
|
|
86
|
-
### Ruff Formatting
|
|
87
|
-
- Black-compatible formatter
|
|
88
|
-
- Fast and consistent
|
|
89
|
-
- Auto-fixes formatting issues
|
|
90
|
-
|
|
91
|
-
### Mypy Type Checking
|
|
92
|
-
- Static type validation
|
|
93
|
-
- Catches type errors before runtime
|
|
94
|
-
- Configurable strictness
|
|
95
|
-
|
|
96
|
-
### Smart Test Suggestions
|
|
97
|
-
- Detects related test files
|
|
98
|
-
- Suggests running pytest
|
|
99
|
-
- Supports multiple test naming conventions
|
|
100
|
-
|
|
101
|
-
## Exit Codes
|
|
102
|
-
|
|
103
|
-
| Code | Meaning |
|
|
104
|
-
|------|---------|
|
|
105
|
-
| 0 | All checks passed |
|
|
106
|
-
| 1 | Fatal error (hook crashed) |
|
|
107
|
-
| 2 | Blocking errors found |
|
|
108
|
-
|
|
109
|
-
## Troubleshooting
|
|
110
|
-
|
|
111
|
-
**Ruff not found**
|
|
112
|
-
```bash
|
|
113
|
-
pip install ruff
|
|
114
|
-
# or
|
|
115
|
-
pipx install ruff
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
**Mypy not found**
|
|
119
|
-
```bash
|
|
120
|
-
pip install mypy
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**Hook not running**
|
|
124
|
-
- Verify PostToolUse hook in `.claude/settings.json`
|
|
125
|
-
- Check Python path: `which python3`
|
|
126
|
-
|
|
127
|
-
**False positives from dependencies**
|
|
128
|
-
- Add to `mypy.ini`: `ignore_missing_imports = True`
|
|
129
|
-
- Add to `pyproject.toml`: exclude patterns
|
|
130
|
-
|
|
131
|
-
## Quick Commands
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
# Run ruff manually
|
|
135
|
-
ruff check .
|
|
136
|
-
ruff format .
|
|
137
|
-
|
|
138
|
-
# Run mypy manually
|
|
139
|
-
mypy .
|
|
140
|
-
|
|
141
|
-
# Run pytest
|
|
142
|
-
pytest
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## Reference
|
|
146
|
-
|
|
147
|
-
Inspired by: https://github.com/bartolli/claude-code-typescript-hooks
|
package/project-skills/service-skills-set/.claude/git-hooks/__pycache__/doc_reminder.cpython-314.pyc
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"""Tests for skill_activator.py — load_registry integration."""
|
|
2
|
-
import io
|
|
3
|
-
import json
|
|
4
|
-
import sys
|
|
5
|
-
import unittest
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
from unittest.mock import patch
|
|
8
|
-
|
|
9
|
-
scripts_dir = Path(__file__).parent
|
|
10
|
-
sys.path.insert(0, str(scripts_dir))
|
|
11
|
-
sys.path.insert(0, str(scripts_dir.parent.parent / "creating-service-skills" / "scripts"))
|
|
12
|
-
|
|
13
|
-
import skill_activator
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
REGISTRY_WITH_VERSION = {
|
|
17
|
-
"version": "1.0",
|
|
18
|
-
"services": {
|
|
19
|
-
"my-service": {
|
|
20
|
-
"territory": ["src/my-service/**"],
|
|
21
|
-
"name": "My Service",
|
|
22
|
-
"skill_path": ".claude/skills/my-service/SKILL.md",
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
HOOK_INPUT = json.dumps({
|
|
28
|
-
"tool_name": "Write",
|
|
29
|
-
"tool_input": {"file_path": "src/my-service/foo.py"},
|
|
30
|
-
"hook_event_name": "PreToolUse",
|
|
31
|
-
"session_id": "test",
|
|
32
|
-
"cwd": "/fake/project",
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class TestMainWithVersionedRegistry(unittest.TestCase):
|
|
37
|
-
def test_main_does_not_crash_when_registry_has_version_key(self):
|
|
38
|
-
"""main() must not crash with AttributeError when load_registry returns
|
|
39
|
-
{"version": ..., "services": {...}} — the full registry dict.
|
|
40
|
-
It should output valid JSON context for the matched service.
|
|
41
|
-
"""
|
|
42
|
-
with patch("skill_activator.load_registry", return_value=REGISTRY_WITH_VERSION), \
|
|
43
|
-
patch("skill_activator.get_project_root", return_value="/fake/project"), \
|
|
44
|
-
patch("sys.stdin", io.StringIO(HOOK_INPUT)), \
|
|
45
|
-
patch("sys.stdout", new_callable=io.StringIO) as mock_stdout:
|
|
46
|
-
try:
|
|
47
|
-
skill_activator.main()
|
|
48
|
-
except SystemExit:
|
|
49
|
-
pass
|
|
50
|
-
output = mock_stdout.getvalue()
|
|
51
|
-
|
|
52
|
-
self.assertTrue(output, "Expected JSON output but got nothing")
|
|
53
|
-
result = json.loads(output)
|
|
54
|
-
self.assertIn("hookSpecificOutput", result)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if __name__ == "__main__":
|
|
58
|
-
unittest.main()
|
package/project-skills/service-skills-set/__pycache__/install-service-skills.cpython-314.pyc
DELETED
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"hooks": {
|
|
3
|
-
"PostToolUse": [
|
|
4
|
-
{
|
|
5
|
-
"matcher": "Write|Edit|MultiEdit|mcp__serena__rename_symbol|mcp__serena__replace_symbol_body|mcp__serena__insert_after_symbol|mcp__serena__insert_before_symbol",
|
|
6
|
-
"hooks": [
|
|
7
|
-
{
|
|
8
|
-
"type": "command",
|
|
9
|
-
"command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/quality-check.cjs\"",
|
|
10
|
-
"timeout": 30
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# Using TS Quality Gate
|
|
2
|
-
|
|
3
|
-
**TS Quality Gate** enforces TypeScript, ESLint, and Prettier quality checks on every file edit. It provides immediate feedback and auto-fixes issues when possible.
|
|
4
|
-
|
|
5
|
-
## What It Does
|
|
6
|
-
|
|
7
|
-
- **TypeScript compilation check** - Catches type errors immediately
|
|
8
|
-
- **ESLint validation** - Enforces code style and best practices
|
|
9
|
-
- **Prettier formatting** - Ensures consistent code formatting
|
|
10
|
-
- **Auto-fix** - Automatically fixes issues when possible
|
|
11
|
-
- **Fast feedback** - Runs in <1s for most files
|
|
12
|
-
|
|
13
|
-
## How It Works
|
|
14
|
-
|
|
15
|
-
When you edit a TypeScript/JavaScript file:
|
|
16
|
-
|
|
17
|
-
1. PostToolUse hook fires after Write/Edit
|
|
18
|
-
2. Runs `quality-check.js` with the file path
|
|
19
|
-
3. Checks TypeScript compilation, ESLint, Prettier
|
|
20
|
-
4. Auto-fixes issues if configured
|
|
21
|
-
5. Returns exit code 2 if blocking errors found
|
|
22
|
-
|
|
23
|
-
## Configuration
|
|
24
|
-
|
|
25
|
-
The quality gate is configured via `.claude/hooks/hook-config.json`:
|
|
26
|
-
|
|
27
|
-
```json
|
|
28
|
-
{
|
|
29
|
-
"typescript": {
|
|
30
|
-
"enabled": true,
|
|
31
|
-
"showDependencyErrors": false
|
|
32
|
-
},
|
|
33
|
-
"eslint": {
|
|
34
|
-
"enabled": true,
|
|
35
|
-
"autofix": true
|
|
36
|
-
},
|
|
37
|
-
"prettier": {
|
|
38
|
-
"enabled": true,
|
|
39
|
-
"autofix": true
|
|
40
|
-
},
|
|
41
|
-
"general": {
|
|
42
|
-
"autofixSilent": true,
|
|
43
|
-
"debug": false
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Requirements
|
|
49
|
-
|
|
50
|
-
- Node.js 18+
|
|
51
|
-
- TypeScript installed in project
|
|
52
|
-
- ESLint installed in project (optional)
|
|
53
|
-
- Prettier installed in project (optional)
|
|
54
|
-
|
|
55
|
-
## Installation
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
# Install project skill
|
|
59
|
-
xtrm install project ts-quality-gate
|
|
60
|
-
|
|
61
|
-
# Ensure dependencies are installed in your project
|
|
62
|
-
npm install --save-dev typescript eslint prettier
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Troubleshooting
|
|
66
|
-
|
|
67
|
-
**"ESLint not found"**
|
|
68
|
-
- Install ESLint: `npm install --save-dev eslint`
|
|
69
|
-
- Or disable in hook-config.json: `"eslint": { "enabled": false }`
|
|
70
|
-
|
|
71
|
-
**"Prettier not found"**
|
|
72
|
-
- Install Prettier: `npm install --save-dev prettier`
|
|
73
|
-
- Or disable in hook-config.json: `"prettier": { "enabled": false }`
|
|
74
|
-
|
|
75
|
-
**TypeScript errors from dependencies**
|
|
76
|
-
- Set `"showDependencyErrors": false` in hook-config.json
|
|
77
|
-
|
|
78
|
-
## See Also
|
|
79
|
-
|
|
80
|
-
- Full documentation: `.claude/docs/ts-quality-gate-readme.md`
|
|
81
|
-
- Reference: https://github.com/bartolli/claude-code-typescript-hooks
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
# TS Quality Gate
|
|
2
|
-
|
|
3
|
-
**TypeScript/ESLint/Prettier quality gate** for Claude Code. Runs automatically on every file edit to ensure code quality.
|
|
4
|
-
|
|
5
|
-
## What It Does
|
|
6
|
-
|
|
7
|
-
TS Quality Gate enforces code quality standards in real-time:
|
|
8
|
-
|
|
9
|
-
| Check | Description | Auto-fix |
|
|
10
|
-
|-------|-------------|----------|
|
|
11
|
-
| **TypeScript** | Compilation errors, type safety | No |
|
|
12
|
-
| **ESLint** | Code style, best practices, rules | Yes (if enabled) |
|
|
13
|
-
| **Prettier** | Code formatting consistency | Yes (if enabled) |
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Install project skill
|
|
19
|
-
xtrm install project ts-quality-gate
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Post-install:** Ensure your project has the required dependencies:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install --save-dev typescript eslint prettier
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## How It Works
|
|
29
|
-
|
|
30
|
-
The quality gate runs as a `PostToolUse` hook:
|
|
31
|
-
|
|
32
|
-
1. You edit a TypeScript/JavaScript file
|
|
33
|
-
2. After the edit completes, the hook fires
|
|
34
|
-
3. `quality-check.cjs` validates the file
|
|
35
|
-
4. Issues are reported with auto-fix when possible
|
|
36
|
-
5. Exit code 2 blocks if critical errors found
|
|
37
|
-
|
|
38
|
-
## Configuration
|
|
39
|
-
|
|
40
|
-
Edit `.claude/hooks/hook-config.json` to customize:
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"typescript": {
|
|
45
|
-
"enabled": true,
|
|
46
|
-
"showDependencyErrors": false
|
|
47
|
-
},
|
|
48
|
-
"eslint": {
|
|
49
|
-
"enabled": true,
|
|
50
|
-
"autofix": true
|
|
51
|
-
},
|
|
52
|
-
"prettier": {
|
|
53
|
-
"enabled": true,
|
|
54
|
-
"autofix": true
|
|
55
|
-
},
|
|
56
|
-
"general": {
|
|
57
|
-
"autofixSilent": true
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Environment Variable Overrides
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
export CLAUDE_HOOKS_TYPESCRIPT_ENABLED=false
|
|
66
|
-
export CLAUDE_HOOKS_ESLINT_AUTOFIX=true
|
|
67
|
-
export CLAUDE_HOOKS_PRETTIER_ENABLED=false
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Features
|
|
71
|
-
|
|
72
|
-
### TypeScript Checking
|
|
73
|
-
- Uses project's tsconfig.json
|
|
74
|
-
- Checks only edited file (fast)
|
|
75
|
-
- Optionally shows dependency errors
|
|
76
|
-
|
|
77
|
-
### ESLint Integration
|
|
78
|
-
- Auto-discovers .eslintrc or eslint.config.js
|
|
79
|
-
- Auto-fixes when `autofix: true`
|
|
80
|
-
- Reports errors and warnings
|
|
81
|
-
|
|
82
|
-
### Prettier Formatting
|
|
83
|
-
- Auto-discovers .prettierrc
|
|
84
|
-
- Auto-formats when `autofix: true`
|
|
85
|
-
- Supports all Prettier options
|
|
86
|
-
|
|
87
|
-
### Smart File Detection
|
|
88
|
-
- Skips non-source files
|
|
89
|
-
- Detects test files, CLI files, services
|
|
90
|
-
- Applies file-type-specific rules
|
|
91
|
-
|
|
92
|
-
## Exit Codes
|
|
93
|
-
|
|
94
|
-
| Code | Meaning |
|
|
95
|
-
|------|---------|
|
|
96
|
-
| 0 | All checks passed |
|
|
97
|
-
| 1 | Fatal error (hook crashed) |
|
|
98
|
-
| 2 | Blocking errors found (Claude must fix) |
|
|
99
|
-
|
|
100
|
-
## Troubleshooting
|
|
101
|
-
|
|
102
|
-
**Hook not running**
|
|
103
|
-
- Verify PostToolUse hook in `.claude/settings.json`
|
|
104
|
-
- Check hook path is correct
|
|
105
|
-
|
|
106
|
-
**TypeScript errors from node_modules**
|
|
107
|
-
- Set `showDependencyErrors: false`
|
|
108
|
-
|
|
109
|
-
**ESLint/Prettier not found**
|
|
110
|
-
- Install in project: `npm install --save-dev eslint prettier`
|
|
111
|
-
- Or disable in config
|
|
112
|
-
|
|
113
|
-
## Reference
|
|
114
|
-
|
|
115
|
-
Based on: https://github.com/bartolli/claude-code-typescript-hooks
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/skills/documenting/tests/__pycache__/test_drift_detector.cpython-314-pytest-9.0.2.pyc
DELETED
|
Binary file
|
|
Binary file
|
package/skills/documenting/tests/__pycache__/test_validate_metadata.cpython-314-pytest-9.0.2.pyc
DELETED
|
Binary file
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Integration test for documenting skill workflows
|
|
3
|
-
|
|
4
|
-
set -e # Exit on error
|
|
5
|
-
|
|
6
|
-
TEST_DIR=$(mktemp -d)
|
|
7
|
-
echo "Test directory: $TEST_DIR"
|
|
8
|
-
|
|
9
|
-
# Ensure we are in the skill root (skills/documenting)
|
|
10
|
-
cd "$(dirname "$0")/.."
|
|
11
|
-
SKILL_ROOT=$(pwd)
|
|
12
|
-
echo "Skill root: $SKILL_ROOT"
|
|
13
|
-
|
|
14
|
-
# Test 1: Initialize CHANGELOG
|
|
15
|
-
echo "Test 1: Initialize CHANGELOG"
|
|
16
|
-
python3 -m scripts.changelog.init_changelog "$TEST_DIR/CHANGELOG.md"
|
|
17
|
-
python3 -m scripts.changelog.validate_changelog "$TEST_DIR/CHANGELOG.md"
|
|
18
|
-
echo "✅ CHANGELOG initialization passed"
|
|
19
|
-
|
|
20
|
-
# Test 2: Add entries
|
|
21
|
-
echo ""
|
|
22
|
-
echo "Test 2: Add entries to CHANGELOG"
|
|
23
|
-
python3 -m scripts.changelog.add_entry "$TEST_DIR/CHANGELOG.md" Added "Feature A"
|
|
24
|
-
python3 -m scripts.changelog.add_entry "$TEST_DIR/CHANGELOG.md" Fixed "Bug B"
|
|
25
|
-
python3 -m scripts.changelog.add_entry "$TEST_DIR/CHANGELOG.md" Changed "Refactor C"
|
|
26
|
-
python3 -m scripts.changelog.validate_changelog "$TEST_DIR/CHANGELOG.md"
|
|
27
|
-
echo "✅ Entry addition passed"
|
|
28
|
-
|
|
29
|
-
# Test 3: Bump release
|
|
30
|
-
echo ""
|
|
31
|
-
echo "Test 3: Bump release version"
|
|
32
|
-
python3 -m scripts.changelog.bump_release "$TEST_DIR/CHANGELOG.md" "1.0.0"
|
|
33
|
-
python3 -m scripts.changelog.validate_changelog "$TEST_DIR/CHANGELOG.md"
|
|
34
|
-
|
|
35
|
-
# Verify [Unreleased] is empty and [1.0.0] has entries
|
|
36
|
-
# Check 3 lines after Unreleased (header, empty line, next header)
|
|
37
|
-
if grep -A 2 "\[Unreleased\]" "$TEST_DIR/CHANGELOG.md" | grep -q "^- "; then
|
|
38
|
-
echo "❌ [Unreleased] should be empty after bump"
|
|
39
|
-
cat "$TEST_DIR/CHANGELOG.md"
|
|
40
|
-
exit 1
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
if ! grep -A 10 "\[1.0.0\]" "$TEST_DIR/CHANGELOG.md" | grep -q "Feature A"; then
|
|
44
|
-
echo "❌ [1.0.0] should contain Feature A"
|
|
45
|
-
exit 1
|
|
46
|
-
fi
|
|
47
|
-
echo "✅ Release bump passed"
|
|
48
|
-
|
|
49
|
-
# Test 4: Orchestrator
|
|
50
|
-
echo ""
|
|
51
|
-
echo "Test 4: Orchestrator workflow"
|
|
52
|
-
mkdir -p "$TEST_DIR/.serena/memories"
|
|
53
|
-
cp "$TEST_DIR/CHANGELOG.md" "$TEST_DIR/CHANGELOG.md.backup"
|
|
54
|
-
|
|
55
|
-
python3 -m scripts.orchestrator "$TEST_DIR" feature "Orchestrator test feature" --scope=test --category=testing
|
|
56
|
-
|
|
57
|
-
# Verify CHANGELOG updated
|
|
58
|
-
if ! grep -q "Orchestrator test feature" "$TEST_DIR/CHANGELOG.md"; then
|
|
59
|
-
echo "❌ Orchestrator should have updated CHANGELOG"
|
|
60
|
-
exit 1
|
|
61
|
-
fi
|
|
62
|
-
echo "✅ Orchestrator passed"
|
|
63
|
-
|
|
64
|
-
# Cleanup
|
|
65
|
-
rm -rf "$TEST_DIR"
|
|
66
|
-
|
|
67
|
-
echo ""
|
|
68
|
-
echo "========================================="
|
|
69
|
-
echo "✅ All integration tests passed!"
|
|
70
|
-
echo "========================================="
|