oh-my-customcode 0.82.0 → 0.84.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.
- package/dist/cli/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/.claude/hooks/hooks.json +20 -0
- package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
- package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
- package/templates/manifest.json +1 -1
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -165,6 +165,16 @@
|
|
|
165
165
|
}
|
|
166
166
|
],
|
|
167
167
|
"description": "Lightweight project profile staleness check for adaptive harness (#831)"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"matcher": "*",
|
|
171
|
+
"hooks": [
|
|
172
|
+
{
|
|
173
|
+
"type": "command",
|
|
174
|
+
"command": "bash .claude/hooks/scripts/session-autofix.sh"
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"description": "Auto-detect and fix previous session issues at start (#838)"
|
|
168
178
|
}
|
|
169
179
|
],
|
|
170
180
|
"UserPromptSubmit": [
|
|
@@ -177,6 +187,16 @@
|
|
|
177
187
|
}
|
|
178
188
|
],
|
|
179
189
|
"description": "Advisory pre-processing of user input — skill matching hints and intent analysis"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"matcher": "*",
|
|
193
|
+
"hooks": [
|
|
194
|
+
{
|
|
195
|
+
"type": "prompt",
|
|
196
|
+
"command": "bash .claude/hooks/scripts/session-autofix-prompt.sh"
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"description": "Inject session auto-fix findings into first user prompt (#838)"
|
|
180
200
|
}
|
|
181
201
|
],
|
|
182
202
|
"SubagentStart": [
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Session Auto-Fix Prompt — UserPromptSubmit prompt hook (#838)
|
|
3
|
+
# One-shot: reads SessionStart findings and injects into first user prompt.
|
|
4
|
+
# Protocol: stdout text -> injected into model context
|
|
5
|
+
|
|
6
|
+
FIXES_FILE="/tmp/.claude-session-fixes-${PPID}"
|
|
7
|
+
|
|
8
|
+
# Only fire if findings exist (one-shot)
|
|
9
|
+
if [ ! -f "$FIXES_FILE" ]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
# Read and remove (one-shot: prevent repeated injection)
|
|
14
|
+
FINDINGS=$(cat "$FIXES_FILE")
|
|
15
|
+
rm -f "$FIXES_FILE"
|
|
16
|
+
|
|
17
|
+
ISSUE_COUNT=$(echo "$FINDINGS" | jq -r '.issue_count // 0' 2>/dev/null)
|
|
18
|
+
|
|
19
|
+
if [ "$ISSUE_COUNT" -gt 0 ]; then
|
|
20
|
+
echo "[Session Auto-Fix] Previous session left ${ISSUE_COUNT} issue(s):"
|
|
21
|
+
echo "$FINDINGS" | jq -r '.issues[]' 2>/dev/null | while IFS= read -r issue; do
|
|
22
|
+
type="${issue%%:*}"
|
|
23
|
+
msg="${issue#*:}"
|
|
24
|
+
echo " - [${type}] ${msg}"
|
|
25
|
+
done
|
|
26
|
+
FIX_COUNT=$(echo "$FINDINGS" | jq -r '.fix_count // 0' 2>/dev/null)
|
|
27
|
+
if [ "$FIX_COUNT" -gt 0 ]; then
|
|
28
|
+
echo "Auto-fixed: ${FIX_COUNT} item(s)."
|
|
29
|
+
fi
|
|
30
|
+
echo ""
|
|
31
|
+
echo "Consider addressing remaining issues before starting new work."
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
exit 0
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Session Auto-Fix — SessionStart command hook (#838)
|
|
3
|
+
# Detects previous session issues: uncommitted changes, template sync,
|
|
4
|
+
# CLAUDE.md counts, gitignore blocking, wiki staleness, broken skill refs.
|
|
5
|
+
# Protocol: stdin JSON -> stdout pass-through, exit 0 always
|
|
6
|
+
# Time budget: <3s
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
FIXES_FILE="/tmp/.claude-session-fixes-${PPID}"
|
|
10
|
+
LOG_DIR=".claude/outputs/session-fixes"
|
|
11
|
+
ISSUES=()
|
|
12
|
+
FIXES=()
|
|
13
|
+
ISSUE_COUNT=0
|
|
14
|
+
FIX_COUNT=0
|
|
15
|
+
|
|
16
|
+
# Utility: add issue
|
|
17
|
+
add_issue() {
|
|
18
|
+
ISSUES+=("$1")
|
|
19
|
+
ISSUE_COUNT=$((ISSUE_COUNT + 1))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
add_fix() {
|
|
23
|
+
FIXES+=("$1")
|
|
24
|
+
FIX_COUNT=$((FIX_COUNT + 1))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# ─── Check 1: Uncommitted changes ───
|
|
28
|
+
uncommitted=$(git status --porcelain 2>/dev/null | head -20)
|
|
29
|
+
if [ -n "$uncommitted" ]; then
|
|
30
|
+
count=$(echo "$uncommitted" | wc -l | tr -d ' ')
|
|
31
|
+
add_issue "uncommitted:${count} uncommitted changes detected"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# ─── Check 2: Template sync (lightweight count comparison) ───
|
|
35
|
+
if [ -d "templates/.claude/agents" ] && [ -d ".claude/agents" ]; then
|
|
36
|
+
src_agents=$(ls .claude/agents/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
37
|
+
tpl_agents=$(ls templates/.claude/agents/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
38
|
+
if [ "$src_agents" != "$tpl_agents" ]; then
|
|
39
|
+
add_issue "template-sync:Agent count mismatch (source:${src_agents} vs template:${tpl_agents})"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
src_skills=$(find .claude/skills -name "SKILL.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
43
|
+
tpl_skills=$(find templates/.claude/skills -name "SKILL.md" 2>/dev/null | wc -l | tr -d ' ')
|
|
44
|
+
if [ "$src_skills" != "$tpl_skills" ]; then
|
|
45
|
+
add_issue "template-sync:Skill count mismatch (source:${src_skills} vs template:${tpl_skills})"
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
src_rules=$(ls .claude/rules/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
49
|
+
tpl_rules=$(ls templates/.claude/rules/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
50
|
+
if [ "$src_rules" != "$tpl_rules" ]; then
|
|
51
|
+
add_issue "template-sync:Rule count mismatch (source:${src_rules} vs template:${tpl_rules})"
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
src_guides=$(find guides -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
|
|
55
|
+
tpl_guides=$(find templates/guides -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')
|
|
56
|
+
if [ "$src_guides" != "$tpl_guides" ]; then
|
|
57
|
+
add_issue "template-sync:Guide count mismatch (source:${src_guides} vs template:${tpl_guides})"
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# ─── Check 3: CLAUDE.md count validation ───
|
|
62
|
+
if [ -f "CLAUDE.md" ]; then
|
|
63
|
+
actual_agents=$(ls .claude/agents/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
64
|
+
doc_agents=$(grep -oE '[0-9]+ 파일\)' CLAUDE.md | head -1 | grep -oE '[0-9]+' || echo "0")
|
|
65
|
+
if [ "$actual_agents" != "$doc_agents" ] && [ "$doc_agents" != "0" ]; then
|
|
66
|
+
add_issue "claude-md:Agent count in CLAUDE.md ($doc_agents) != actual ($actual_agents)"
|
|
67
|
+
fi
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# ─── Check 4: Gitignore blocking new .claude/ files ───
|
|
71
|
+
new_files=$(git ls-files --others --exclude-standard .claude/ 2>/dev/null | head -5)
|
|
72
|
+
ignored_new=""
|
|
73
|
+
if [ -n "$new_files" ]; then
|
|
74
|
+
while IFS= read -r f; do
|
|
75
|
+
if git check-ignore --quiet "$f" 2>/dev/null; then
|
|
76
|
+
ignored_new="${ignored_new}${f}\n"
|
|
77
|
+
fi
|
|
78
|
+
done <<< "$new_files"
|
|
79
|
+
fi
|
|
80
|
+
if [ -n "$ignored_new" ]; then
|
|
81
|
+
add_issue "gitignore:New .claude/ files blocked by .gitignore"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# ─── Check 5: Wiki staleness (lightweight) ───
|
|
85
|
+
if [ -d "wiki" ]; then
|
|
86
|
+
missing_wiki=0
|
|
87
|
+
for agent in .claude/agents/*.md; do
|
|
88
|
+
name=$(basename "$agent" .md)
|
|
89
|
+
if [ ! -f "wiki/agents/${name}.md" ]; then
|
|
90
|
+
missing_wiki=$((missing_wiki + 1))
|
|
91
|
+
fi
|
|
92
|
+
done
|
|
93
|
+
if [ "$missing_wiki" -gt 0 ]; then
|
|
94
|
+
add_issue "wiki-stale:${missing_wiki} agent(s) missing wiki pages"
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# ─── Check 6: Broken skill references (lightweight) ───
|
|
99
|
+
broken_refs=0
|
|
100
|
+
for agent in .claude/agents/*.md; do
|
|
101
|
+
skills_line=$(grep -E '^skills:' "$agent" 2>/dev/null | head -1)
|
|
102
|
+
if [ -n "$skills_line" ]; then
|
|
103
|
+
skills=$(echo "$skills_line" | sed 's/skills: *\[//;s/\]//;s/,/ /g;s/"//g' | tr -d "'")
|
|
104
|
+
for skill in $skills; do
|
|
105
|
+
skill=$(echo "$skill" | tr -d ' ')
|
|
106
|
+
if [ -n "$skill" ] && [ ! -f ".claude/skills/${skill}/SKILL.md" ]; then
|
|
107
|
+
broken_refs=$((broken_refs + 1))
|
|
108
|
+
fi
|
|
109
|
+
done
|
|
110
|
+
fi
|
|
111
|
+
done
|
|
112
|
+
if [ "$broken_refs" -gt 0 ]; then
|
|
113
|
+
add_issue "broken-refs:${broken_refs} broken skill reference(s) in agent frontmatter"
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# ─── Report ───
|
|
117
|
+
if [ "$ISSUE_COUNT" -gt 0 ]; then
|
|
118
|
+
echo "[Session Auto-Fix] ${ISSUE_COUNT} issue(s) detected:" >&2
|
|
119
|
+
for issue in "${ISSUES[@]}"; do
|
|
120
|
+
type="${issue%%:*}"
|
|
121
|
+
msg="${issue#*:}"
|
|
122
|
+
echo " ⚠ [${type}] ${msg}" >&2
|
|
123
|
+
done
|
|
124
|
+
if [ "$FIX_COUNT" -gt 0 ]; then
|
|
125
|
+
echo "[Session Auto-Fix] Auto-fixed ${FIX_COUNT} item(s):" >&2
|
|
126
|
+
for fix in "${FIXES[@]}"; do
|
|
127
|
+
echo " ✓ ${fix}" >&2
|
|
128
|
+
done
|
|
129
|
+
fi
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# ─── Write findings for prompt hook ───
|
|
133
|
+
if command -v jq >/dev/null 2>&1; then
|
|
134
|
+
issues_json=$(printf '%s\n' "${ISSUES[@]}" | jq -R . | jq -s .)
|
|
135
|
+
fixes_json=$(printf '%s\n' "${FIXES[@]}" | jq -R . | jq -s .)
|
|
136
|
+
echo "{\"issue_count\":${ISSUE_COUNT},\"fix_count\":${FIX_COUNT},\"issues\":${issues_json},\"fixes\":${fixes_json}}" > "$FIXES_FILE"
|
|
137
|
+
else
|
|
138
|
+
echo "{\"issue_count\":${ISSUE_COUNT},\"fix_count\":${FIX_COUNT}}" > "$FIXES_FILE"
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
# ─── JSONL log ───
|
|
142
|
+
mkdir -p "$LOG_DIR" 2>/dev/null
|
|
143
|
+
echo "{\"date\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"issue_count\":${ISSUE_COUNT},\"fix_count\":${FIX_COUNT}}" >> "${LOG_DIR}/$(date +%Y-%m-%d).jsonl" 2>/dev/null
|
|
144
|
+
|
|
145
|
+
echo "$input"
|
|
146
|
+
exit 0
|
package/templates/manifest.json
CHANGED