codeforge-dev 1.13.0 → 1.14.2
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/.devcontainer/CHANGELOG.md +146 -4
- package/.devcontainer/CLAUDE.md +61 -276
- package/.devcontainer/README.md +1 -1
- package/.devcontainer/config/defaults/ccstatusline-settings.json +147 -0
- package/.devcontainer/config/defaults/main-system-prompt.md +6 -1
- package/.devcontainer/config/defaults/rules/spec-workflow.md +1 -55
- package/.devcontainer/config/file-manifest.json +14 -0
- package/.devcontainer/devcontainer.json +19 -1
- package/.devcontainer/docs/optional-features.md +0 -65
- package/.devcontainer/docs/plugins.md +38 -23
- package/.devcontainer/features/ast-grep/devcontainer-feature.json +0 -1
- package/.devcontainer/features/biome/install.sh +13 -0
- package/.devcontainer/features/ccburn/devcontainer-feature.json +0 -6
- package/.devcontainer/features/ccms/devcontainer-feature.json +0 -1
- package/.devcontainer/features/ccms/install.sh +1 -1
- package/.devcontainer/features/ccstatusline/devcontainer-feature.json +0 -1
- package/.devcontainer/features/ccstatusline/install.sh +17 -115
- package/.devcontainer/features/ccusage/devcontainer-feature.json +0 -6
- package/.devcontainer/features/chromaterm/README.md +42 -0
- package/.devcontainer/features/chromaterm/chromaterm.yml +35 -0
- package/.devcontainer/features/chromaterm/devcontainer-feature.json +22 -0
- package/.devcontainer/features/chromaterm/install.sh +113 -0
- package/.devcontainer/features/claude-monitor/devcontainer-feature.json +0 -6
- package/.devcontainer/features/claude-session-dashboard/README.md +2 -2
- package/.devcontainer/features/claude-session-dashboard/devcontainer-feature.json +2 -4
- package/.devcontainer/features/claude-session-dashboard/install.sh +2 -2
- package/.devcontainer/features/kitty-terminfo/README.md +32 -0
- package/.devcontainer/features/kitty-terminfo/devcontainer-feature.json +13 -0
- package/.devcontainer/features/kitty-terminfo/install.sh +72 -0
- package/.devcontainer/features/lsp-servers/devcontainer-feature.json +0 -1
- package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +0 -7
- package/.devcontainer/features/shellcheck/install.sh +6 -2
- package/.devcontainer/features/tree-sitter/devcontainer-feature.json +0 -7
- package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +37 -69
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/.claude-plugin/plugin.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/README.md +197 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/architect.md +3 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/bash-exec.md +3 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/claude-guide.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/debug-logs.md +6 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/dependency-analyst.md +5 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/doc-writer.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/explorer.md +3 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/generalist.md +9 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/git-archaeologist.md +3 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/migrator.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/perf-profiler.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/refactorer.md +5 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/researcher.md +5 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/security-auditor.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/spec-writer.md +3 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/statusline-config.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/agents/test-writer.md +4 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/hooks/hooks.json +23 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/guard-readonly-bash.py +2 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/inject-cwd.py +7 -4
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/task-completed-check.py +166 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/teammate-idle-check.py +81 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/verify-no-regression.py +14 -10
- package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/scripts/verify-tests-pass.py +2 -14
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/README.md +17 -31
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/hooks/hooks.json +5 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-code-quality/scripts/advisory-test-runner.py +9 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/codeforge-lsp/README.md +28 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/README.md +28 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/block-dangerous.py +2 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/README.md +28 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/README.md +28 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected-bash.py +1 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +2 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/.claude-plugin/plugin.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/README.md +140 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/hooks/hooks.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/scripts/commit-reminder.py +3 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/scripts/git-state-injector.py +18 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/session-context/scripts/todo-harvester.py +9 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/.claude-plugin/plugin.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/README.md +158 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/hooks/hooks.json +1 -14
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/scripts/skill-suggester.py +189 -100
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/api-design/SKILL.md +9 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/ast-grep-patterns/SKILL.md +7 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/claude-agent-sdk/SKILL.md +8 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/claude-code-headless/SKILL.md +8 -9
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/debugging/SKILL.md +11 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/dependency-management/SKILL.md +10 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/docker/SKILL.md +8 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/docker-py/SKILL.md +9 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/documentation-patterns/SKILL.md +7 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/fastapi/SKILL.md +9 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/git-forensics/SKILL.md +11 -9
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/migration-patterns/SKILL.md +7 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/performance-profiling/SKILL.md +10 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/pydantic-ai/SKILL.md +8 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/refactoring-patterns/SKILL.md +9 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/security-checklist/SKILL.md +9 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/skill-building/SKILL.md +7 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/sqlite/SKILL.md +9 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/svelte5/SKILL.md +7 -8
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/team/SKILL.md +71 -5
- package/.devcontainer/plugins/devs-marketplace/plugins/skill-engine/skills/testing/SKILL.md +10 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/.claude-plugin/plugin.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/README.md +192 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/hooks/hooks.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/scripts/spec-reminder.py +3 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-build/SKILL.md +9 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-check/SKILL.md +10 -5
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-init/SKILL.md +8 -4
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-new/SKILL.md +8 -4
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-refine/SKILL.md +10 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-review/SKILL.md +10 -6
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/spec-update/SKILL.md +10 -5
- package/.devcontainer/plugins/devs-marketplace/plugins/spec-workflow/skills/specification-writing/SKILL.md +9 -9
- package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/plugin.json +1 -2
- package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/README.md +28 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/hooks/hooks.json +0 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/scripts/ticket-linker.py +9 -1
- package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/README.md +104 -32
- package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/hooks/hooks.json +49 -3
- package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/scripts/guard-workspace-scope.py +269 -56
- package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/scripts/inject-workspace-cwd.py +44 -0
- package/.devcontainer/scripts/setup-aliases.sh +13 -5
- package/.devcontainer/scripts/setup-config.sh +1 -0
- package/README.md +5 -5
- package/package.json +6 -2
- package/setup.js +3 -2
- package/.devcontainer/.env +0 -33
- package/.devcontainer/features/README.md +0 -126
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +0 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/README.md +0 -81
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/hooks/hooks.json +0 -17
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +0 -297
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +0 -7
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/README.md +0 -92
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +0 -17
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +0 -536
- package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
- package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/.claude-plugin/system-prompt.md +0 -184
- package/.devcontainer/plugins/devs-marketplace/plugins/workspace-scope-guard/scripts/__pycache__/guard-workspace-scope.cpython-314.pyc +0 -0
- /package/.devcontainer/plugins/devs-marketplace/plugins/agent-system/{.claude-plugin/commands/debug.md → skills/debug/SKILL.md} +0 -0
- /package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/{.claude-plugin/commands/ticket/357/200/272create-pr.md" → skills/ticketcreate-pr/SKILL.md} +0 -0
- /package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/{.claude-plugin/commands/ticket/357/200/272new.md" → skills/ticketnew/SKILL.md} +0 -0
- /package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/{.claude-plugin/commands/ticket/357/200/272review-commit.md" → skills/ticketreview-commit/SKILL.md} +0 -0
- /package/.devcontainer/plugins/devs-marketplace/plugins/ticket-workflow/{.claude-plugin/commands/ticket/357/200/272work.md" → skills/ticketwork/SKILL.md} +0 -0
package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Unified batch formatter — runs as a Stop hook.
|
|
4
|
-
|
|
5
|
-
Reads file paths collected by collect-edited-files.py during the
|
|
6
|
-
conversation turn, deduplicates them, and formats each based on
|
|
7
|
-
extension:
|
|
8
|
-
.py / .pyi → Ruff format (fallback: Black)
|
|
9
|
-
.go → gofmt
|
|
10
|
-
.js/.jsx/.ts/.tsx/.mjs/.cjs/.mts/.cts → Biome check --write
|
|
11
|
-
.css/.json/.jsonc/.graphql/.gql → Biome check --write
|
|
12
|
-
.html/.vue/.svelte/.astro → Biome check --write
|
|
13
|
-
.sh/.bash/.zsh/.mksh/.bats → shfmt -w
|
|
14
|
-
.md/.markdown → dprint fmt
|
|
15
|
-
.yaml/.yml → dprint fmt
|
|
16
|
-
.toml → dprint fmt
|
|
17
|
-
Dockerfile / .dockerfile → dprint fmt
|
|
18
|
-
.rs → rustfmt
|
|
19
|
-
|
|
20
|
-
Always cleans up the temp file. Always exits 0.
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
import json
|
|
24
|
-
import os
|
|
25
|
-
import subprocess
|
|
26
|
-
import sys
|
|
27
|
-
from pathlib import Path
|
|
28
|
-
|
|
29
|
-
# ── Extension sets ──────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
PYTHON_EXTS = {".py", ".pyi"}
|
|
32
|
-
GO_EXTS = {".go"}
|
|
33
|
-
BIOME_EXTS = {
|
|
34
|
-
".js",
|
|
35
|
-
".jsx",
|
|
36
|
-
".ts",
|
|
37
|
-
".tsx",
|
|
38
|
-
".mjs",
|
|
39
|
-
".cjs",
|
|
40
|
-
".mts",
|
|
41
|
-
".cts",
|
|
42
|
-
".css",
|
|
43
|
-
".json",
|
|
44
|
-
".jsonc",
|
|
45
|
-
".graphql",
|
|
46
|
-
".gql",
|
|
47
|
-
".html",
|
|
48
|
-
".vue",
|
|
49
|
-
".svelte",
|
|
50
|
-
".astro",
|
|
51
|
-
}
|
|
52
|
-
SHELL_EXTS = {".sh", ".bash", ".zsh", ".mksh", ".bats"}
|
|
53
|
-
DPRINT_EXTS = {".md", ".markdown", ".yaml", ".yml", ".toml"}
|
|
54
|
-
RUST_EXTS = {".rs"}
|
|
55
|
-
|
|
56
|
-
# ── Fallback paths ──────────────────────────────────────────────────
|
|
57
|
-
|
|
58
|
-
BLACK_PATH_FALLBACK = "/usr/local/py-utils/bin/black"
|
|
59
|
-
GOFMT_PATH_FALLBACK = "/usr/local/go/bin/gofmt"
|
|
60
|
-
DPRINT_CONFIG = "/usr/local/share/dprint/dprint.json"
|
|
61
|
-
|
|
62
|
-
# ── Tool resolution ─────────────────────────────────────────────────
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def _resolve_tool(name: str, fallback: str = "") -> str | None:
|
|
66
|
-
"""Find tool via PATH first, fall back to hardcoded path."""
|
|
67
|
-
try:
|
|
68
|
-
result = subprocess.run(["which", name], capture_output=True, text=True)
|
|
69
|
-
if result.returncode == 0:
|
|
70
|
-
return result.stdout.strip()
|
|
71
|
-
except Exception:
|
|
72
|
-
pass
|
|
73
|
-
if fallback and os.path.exists(fallback):
|
|
74
|
-
return fallback
|
|
75
|
-
return None
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def find_tool_upward(file_path: str, tool_name: str) -> str | None:
|
|
79
|
-
"""Walk up from file directory looking for node_modules/.bin/<tool>."""
|
|
80
|
-
current = Path(file_path).parent
|
|
81
|
-
for _ in range(20):
|
|
82
|
-
candidate = current / "node_modules" / ".bin" / tool_name
|
|
83
|
-
if candidate.is_file():
|
|
84
|
-
return str(candidate)
|
|
85
|
-
parent = current.parent
|
|
86
|
-
if parent == current:
|
|
87
|
-
break
|
|
88
|
-
current = parent
|
|
89
|
-
return None
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def find_global_tool(tool_name: str) -> str | None:
|
|
93
|
-
"""Check if tool is available globally."""
|
|
94
|
-
try:
|
|
95
|
-
result = subprocess.run(
|
|
96
|
-
["which", tool_name],
|
|
97
|
-
capture_output=True,
|
|
98
|
-
text=True,
|
|
99
|
-
)
|
|
100
|
-
if result.returncode == 0:
|
|
101
|
-
return result.stdout.strip()
|
|
102
|
-
except Exception:
|
|
103
|
-
pass
|
|
104
|
-
return None
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def find_biome(file_path: str) -> str | None:
|
|
108
|
-
"""Find biome binary: project-local first, then global."""
|
|
109
|
-
local = find_tool_upward(file_path, "biome")
|
|
110
|
-
if local:
|
|
111
|
-
return local
|
|
112
|
-
return find_global_tool("biome")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# ── Formatters ──────────────────────────────────────────────────────
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def format_python(file_path: str) -> None:
|
|
119
|
-
"""Format with Ruff (preferred) or Black (fallback)."""
|
|
120
|
-
ruff = _resolve_tool("ruff")
|
|
121
|
-
if ruff:
|
|
122
|
-
try:
|
|
123
|
-
subprocess.run(
|
|
124
|
-
[ruff, "format", "--quiet", file_path],
|
|
125
|
-
capture_output=True,
|
|
126
|
-
timeout=10,
|
|
127
|
-
)
|
|
128
|
-
return
|
|
129
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
130
|
-
pass
|
|
131
|
-
|
|
132
|
-
# Fallback to Black
|
|
133
|
-
black = _resolve_tool("black", BLACK_PATH_FALLBACK)
|
|
134
|
-
if not black:
|
|
135
|
-
return
|
|
136
|
-
try:
|
|
137
|
-
subprocess.run(
|
|
138
|
-
[black, "--quiet", file_path],
|
|
139
|
-
capture_output=True,
|
|
140
|
-
timeout=10,
|
|
141
|
-
)
|
|
142
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
143
|
-
pass
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def format_go(file_path: str) -> None:
|
|
147
|
-
"""Format with gofmt."""
|
|
148
|
-
gofmt = _resolve_tool("gofmt", GOFMT_PATH_FALLBACK)
|
|
149
|
-
if not gofmt:
|
|
150
|
-
return
|
|
151
|
-
try:
|
|
152
|
-
subprocess.run(
|
|
153
|
-
[gofmt, "-w", file_path],
|
|
154
|
-
capture_output=True,
|
|
155
|
-
timeout=10,
|
|
156
|
-
)
|
|
157
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
158
|
-
pass
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def format_biome(file_path: str) -> None:
|
|
162
|
-
"""Format with Biome in safe mode (no --unsafe)."""
|
|
163
|
-
biome = find_biome(file_path)
|
|
164
|
-
if not biome:
|
|
165
|
-
return
|
|
166
|
-
try:
|
|
167
|
-
subprocess.run(
|
|
168
|
-
[biome, "check", "--write", file_path],
|
|
169
|
-
capture_output=True,
|
|
170
|
-
timeout=12,
|
|
171
|
-
)
|
|
172
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
173
|
-
pass
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
def format_shell(file_path: str) -> None:
|
|
177
|
-
"""Format with shfmt."""
|
|
178
|
-
shfmt = _resolve_tool("shfmt")
|
|
179
|
-
if not shfmt:
|
|
180
|
-
return
|
|
181
|
-
try:
|
|
182
|
-
subprocess.run(
|
|
183
|
-
[shfmt, "-w", file_path],
|
|
184
|
-
capture_output=True,
|
|
185
|
-
timeout=10,
|
|
186
|
-
)
|
|
187
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
188
|
-
pass
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
def format_dprint(file_path: str) -> None:
|
|
192
|
-
"""Format with dprint using the global config."""
|
|
193
|
-
dprint = _resolve_tool("dprint")
|
|
194
|
-
if not dprint:
|
|
195
|
-
return
|
|
196
|
-
if not os.path.isfile(DPRINT_CONFIG):
|
|
197
|
-
return
|
|
198
|
-
try:
|
|
199
|
-
subprocess.run(
|
|
200
|
-
[dprint, "fmt", "--config", DPRINT_CONFIG, file_path],
|
|
201
|
-
capture_output=True,
|
|
202
|
-
timeout=10,
|
|
203
|
-
)
|
|
204
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
205
|
-
pass
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
def format_rust(file_path: str) -> None:
|
|
209
|
-
"""Format with rustfmt (conditional — only if installed)."""
|
|
210
|
-
rustfmt = _resolve_tool("rustfmt")
|
|
211
|
-
if not rustfmt:
|
|
212
|
-
return
|
|
213
|
-
try:
|
|
214
|
-
subprocess.run(
|
|
215
|
-
[rustfmt, file_path],
|
|
216
|
-
capture_output=True,
|
|
217
|
-
timeout=10,
|
|
218
|
-
)
|
|
219
|
-
except (subprocess.TimeoutExpired, OSError):
|
|
220
|
-
pass
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
# ── Dispatch ────────────────────────────────────────────────────────
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
def format_file(file_path: str) -> None:
|
|
227
|
-
"""Dispatch to the correct formatter based on extension / filename."""
|
|
228
|
-
path = Path(file_path)
|
|
229
|
-
ext = path.suffix.lower()
|
|
230
|
-
name = path.name
|
|
231
|
-
|
|
232
|
-
if ext in PYTHON_EXTS:
|
|
233
|
-
format_python(file_path)
|
|
234
|
-
elif ext in GO_EXTS:
|
|
235
|
-
format_go(file_path)
|
|
236
|
-
elif ext in BIOME_EXTS:
|
|
237
|
-
format_biome(file_path)
|
|
238
|
-
elif ext in SHELL_EXTS:
|
|
239
|
-
format_shell(file_path)
|
|
240
|
-
elif ext in DPRINT_EXTS:
|
|
241
|
-
format_dprint(file_path)
|
|
242
|
-
elif ext in RUST_EXTS:
|
|
243
|
-
format_rust(file_path)
|
|
244
|
-
elif name == "Dockerfile" or ext == ".dockerfile":
|
|
245
|
-
format_dprint(file_path)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
# ── Main ────────────────────────────────────────────────────────────
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
def main():
|
|
252
|
-
try:
|
|
253
|
-
input_data = json.load(sys.stdin)
|
|
254
|
-
except (json.JSONDecodeError, ValueError):
|
|
255
|
-
sys.exit(0)
|
|
256
|
-
|
|
257
|
-
# Prevent infinite loops if Stop hook triggers another stop
|
|
258
|
-
if input_data.get("stop_hook_active"):
|
|
259
|
-
sys.exit(0)
|
|
260
|
-
|
|
261
|
-
session_id = input_data.get("session_id", "")
|
|
262
|
-
if not session_id:
|
|
263
|
-
sys.exit(0)
|
|
264
|
-
|
|
265
|
-
tmp_path = f"/tmp/claude-edited-files-{session_id}"
|
|
266
|
-
|
|
267
|
-
try:
|
|
268
|
-
with open(tmp_path) as f:
|
|
269
|
-
raw_paths = f.read().splitlines()
|
|
270
|
-
except FileNotFoundError:
|
|
271
|
-
sys.exit(0)
|
|
272
|
-
except OSError:
|
|
273
|
-
sys.exit(0)
|
|
274
|
-
finally:
|
|
275
|
-
# Always clean up the temp file
|
|
276
|
-
try:
|
|
277
|
-
os.unlink(tmp_path)
|
|
278
|
-
except OSError:
|
|
279
|
-
pass
|
|
280
|
-
|
|
281
|
-
# Deduplicate while preserving order, filter to existing files
|
|
282
|
-
seen: set[str] = set()
|
|
283
|
-
paths: list[str] = []
|
|
284
|
-
for p in raw_paths:
|
|
285
|
-
p = p.strip()
|
|
286
|
-
if p and p not in seen and os.path.isfile(p):
|
|
287
|
-
seen.add(p)
|
|
288
|
-
paths.append(p)
|
|
289
|
-
|
|
290
|
-
for path in paths:
|
|
291
|
-
format_file(path)
|
|
292
|
-
|
|
293
|
-
sys.exit(0)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if __name__ == "__main__":
|
|
297
|
-
main()
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# auto-linter
|
|
2
|
-
|
|
3
|
-
Claude Code plugin that batch-lints edited files when Claude finishes responding. Reads file paths collected by the `code-directive` plugin's `collect-edited-files.py` hook and lints each file using the appropriate tool. Lint results are returned as advisory context — never blocking.
|
|
4
|
-
|
|
5
|
-
## What It Does
|
|
6
|
-
|
|
7
|
-
When Claude stops responding, the plugin reads the session's list of edited files, lints each one, and injects any warnings as `additionalContext` so Claude sees them on its next response.
|
|
8
|
-
|
|
9
|
-
| Language / File Type | Linter(s) |
|
|
10
|
-
|----------------------|-----------|
|
|
11
|
-
| Python (`.py`, `.pyi`) | [pyright](https://github.com/microsoft/pyright) (type checking) + [ruff check](https://docs.astral.sh/ruff/) (style/correctness) |
|
|
12
|
-
| JS/TS/CSS/GraphQL (`.js`, `.jsx`, `.ts`, `.tsx`, `.css`, `.graphql`, `.gql`) | [biome lint](https://biomejs.dev/) |
|
|
13
|
-
| Shell (`.sh`, `.bash`, `.zsh`, `.mksh`, `.bats`) | [shellcheck](https://github.com/koalaman/shellcheck) |
|
|
14
|
-
| Go (`.go`) | go vet (bundled with Go) |
|
|
15
|
-
| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
|
|
16
|
-
| Rust (`.rs`) | [clippy](https://doc.rust-lang.org/clippy/) (via cargo) |
|
|
17
|
-
|
|
18
|
-
All linting is non-blocking. Missing tools are silently skipped. The plugin always exits 0 and returns warnings as `additionalContext` — it will never interrupt Claude.
|
|
19
|
-
|
|
20
|
-
## How It Works
|
|
21
|
-
|
|
22
|
-
### Hook Lifecycle
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
code-directive's collect-edited-files.py (PostToolUse on Edit/Write)
|
|
26
|
-
│
|
|
27
|
-
└─→ Appends edited file path to /tmp/claude-lint-files-{session_id}
|
|
28
|
-
│
|
|
29
|
-
│ ... Claude keeps working ...
|
|
30
|
-
│
|
|
31
|
-
Claude stops responding (Stop event)
|
|
32
|
-
│
|
|
33
|
-
└─→ lint-file.py reads the temp file, deduplicates paths,
|
|
34
|
-
lints each file by extension, groups results by linter,
|
|
35
|
-
injects warnings as additionalContext, then cleans up
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Dependency on code-directive
|
|
39
|
-
|
|
40
|
-
This plugin relies on the `code-directive` plugin's `collect-edited-files.py` PostToolUse hook to write edited file paths to `/tmp/claude-lint-files-{session_id}`. Both plugins must be enabled for linting to work.
|
|
41
|
-
|
|
42
|
-
### Output Format
|
|
43
|
-
|
|
44
|
-
Lint results are grouped by linter and returned as `additionalContext`. Each file shows up to 5 issues with severity, line number, and message:
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
[Auto-linter] Pyright results:
|
|
48
|
-
example.py: 2 issue(s)
|
|
49
|
-
✗ Line 15: Cannot assign type "str" to declared type "int"
|
|
50
|
-
! Line 42: Variable "x" is not defined
|
|
51
|
-
|
|
52
|
-
[Auto-linter] Ruff results:
|
|
53
|
-
example.py: 1 issue(s)
|
|
54
|
-
! Line 8: [F401] `os` imported but unused
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Biome Discovery
|
|
58
|
-
|
|
59
|
-
Biome is resolved in this order:
|
|
60
|
-
1. **Project-local**: walks up from the edited file looking for `node_modules/.bin/biome`
|
|
61
|
-
2. **Global**: checks PATH via `which biome`
|
|
62
|
-
|
|
63
|
-
### Timeouts
|
|
64
|
-
|
|
65
|
-
| Scope | Timeout |
|
|
66
|
-
|-------|---------|
|
|
67
|
-
| Entire Stop hook | 60s |
|
|
68
|
-
| Individual tool invocation | 10s |
|
|
69
|
-
|
|
70
|
-
## Conflict Warning
|
|
71
|
-
|
|
72
|
-
Do **not** enable this plugin alongside `auto-code-quality`. That plugin bundles its own linter with the same functionality. Enabling both won't corrupt data (different temp file prefixes: `claude-lint-files-*` vs `claude-cq-*`), but files would be linted twice.
|
|
73
|
-
|
|
74
|
-
## Plugin Structure
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
auto-linter/
|
|
78
|
-
├── .claude-plugin/
|
|
79
|
-
│ └── plugin.json # Plugin metadata
|
|
80
|
-
├── hooks/
|
|
81
|
-
│ └── hooks.json # Stop hook registration
|
|
82
|
-
├── scripts/
|
|
83
|
-
│ └── lint-file.py # Batch linter (Stop)
|
|
84
|
-
└── README.md # This file
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Requirements
|
|
88
|
-
|
|
89
|
-
- Python 3.11+
|
|
90
|
-
- Claude Code with plugin hook support
|
|
91
|
-
- `code-directive` plugin enabled (provides the file path collector)
|
|
92
|
-
- Install the linting tools for the languages you work with — everything is optional
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Batch-lint collected files when Claude stops responding",
|
|
3
|
-
"hooks": {
|
|
4
|
-
"Stop": [
|
|
5
|
-
{
|
|
6
|
-
"matcher": "",
|
|
7
|
-
"hooks": [
|
|
8
|
-
{
|
|
9
|
-
"type": "command",
|
|
10
|
-
"command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/lint-file.py",
|
|
11
|
-
"timeout": 60
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|