@chrono-meta/fh-gate 3.34.0 → 3.35.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 (39) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/docs/USER_GUIDE.md +7 -3
  3. package/package.json +2 -1
  4. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  5. package/plugins/fh-commons/agents/a11y-lens.md +11 -0
  6. package/plugins/fh-commons/agents/be-dev-lens.md +11 -0
  7. package/plugins/fh-commons/agents/designer-lens.md +11 -0
  8. package/plugins/fh-commons/agents/fe-dev-lens.md +11 -0
  9. package/plugins/fh-commons/agents/qa-lens.md +11 -0
  10. package/plugins/fh-commons/agents/ux-writer-lens.md +11 -0
  11. package/plugins/fh-commons/skills/deliberation/SKILL.md +1 -9
  12. package/plugins/fh-commons/skills/deliberation/SKILL_detail.md +19 -0
  13. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +8 -80
  14. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +107 -0
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +16 -0
  17. package/plugins/fh-meta/agents/fact-checker.md +11 -0
  18. package/plugins/fh-meta/agents/hub-persona-auditor.md +13 -0
  19. package/plugins/fh-meta/agents/persona-innovator.md +12 -0
  20. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +6 -103
  21. package/plugins/fh-meta/skills/auto-decorrelation/SKILL_detail.md +132 -0
  22. package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL.md +3 -20
  23. package/plugins/fh-meta/skills/cross-ecosystem-synergy-detection/SKILL_detail.md +36 -0
  24. package/plugins/fh-meta/skills/install-doctor/SKILL.md +4 -25
  25. package/plugins/fh-meta/skills/install-doctor/SKILL_detail.md +44 -0
  26. package/plugins/fh-meta/skills/verify-bidirectional/SKILL.md +7 -51
  27. package/plugins/fh-meta/skills/verify-bidirectional/SKILL_detail.md +75 -0
  28. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  29. package/plugins/fh-preprep/skills/preprep/SKILL.md +7 -207
  30. package/plugins/fh-preprep/skills/preprep/SKILL_detail.md +235 -0
  31. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  32. package/scripts/degrade_direction_scan.sh +87 -1
  33. package/scripts/pr_merge_verified.sh +20 -3
  34. package/scripts/selfcheck.sh +155 -7
  35. package/scripts/test_degrade_scan_shell_probes.sh +63 -0
  36. package/scripts/test_pr_merge_verified_lanes.sh +33 -0
  37. package/scripts/test_selfcheck_shard_lanes.sh +135 -0
  38. package/templates/.git-hooks/pre-commit +1 -1
  39. package/templates/degrade_direction_scan.sh +87 -1
@@ -26,11 +26,97 @@
26
26
  #
27
27
  # Usage:
28
28
  # bash scripts/degrade_direction_scan.sh [path ...] # scan dirs/files (default: .)
29
+ # bash scripts/degrade_direction_scan.sh --staged [path ...] # scan the INDEX content (commit-time callers)
29
30
  # git diff --name-only main..HEAD -- '*.py' | xargs bash scripts/degrade_direction_scan.sh
30
31
  # Exit: 0 = no smells found; 2 = smells found (ADVISORY signal — do not hard-block on it)
31
32
  set -uo pipefail
32
33
 
34
+ # --staged (2026-10-31, harness-doctor S-4): scan the INDEX content, not the working tree. A commit-time
35
+ # caller (templates/.git-hooks/pre-commit) must judge what will be committed; `git add` then an edit
36
+ # leaves the two different, and a working-tree read lets a staged smell pass (or flags a fixed one).
37
+ # Targets, if given, narrow the staged set (exact path or directory prefix). Default behaviour is unchanged.
38
+ STAGED=0
39
+ if [ "${1:-}" = "--staged" ]; then STAGED=1; shift; fi
33
40
  TARGETS=("$@")
41
+ if [ "$STAGED" -eq 1 ]; then
42
+ _sroot=$(git rev-parse --show-toplevel 2>/dev/null); _src=$?
43
+ if [ "$_src" -ne 0 ] || [ -z "$_sroot" ]; then
44
+ echo "degrade-scan: --staged needs a git work tree — NOT measured, not clean"; exit 2
45
+ fi
46
+ _stmp=$(mktemp -d) || { echo "degrade-scan: mktemp failed — NOT measured, not clean"; exit 2; }
47
+ trap 'rm -rf "$_stmp"' EXIT
48
+ # -z: without it git quotes non-ASCII / tab / quote names ("\355\225\234.sh"), which then match no
49
+ # target and fail `git show` (codex R1 #1). NUL list goes to a file so the git exit code survives.
50
+ git -C "$_sroot" diff --cached --name-only -z --diff-filter=ACMR > "$_stmp/.staged_list" 2>/dev/null; _src=$?
51
+ if [ "$_src" -ne 0 ]; then
52
+ echo "degrade-scan: could not list staged files (git exit $_src) — NOT measured, not clean"; exit 2
53
+ fi
54
+ # Targets are normalised to repo-relative paths the way a filesystem target would resolve
55
+ # (codex R1 #3): absolute paths under the repo root, `./` and `.`, and paths relative to a subdir cwd.
56
+ _spfx=$(git rev-parse --show-prefix 2>/dev/null)
57
+ _ntg=()
58
+ for _tg in ${TARGETS[@]+"${TARGETS[@]}"}; do
59
+ # An existing path is resolved physically first (macOS /tmp -> /private/tmp, `..`, `sub/./a`,
60
+ # `a//b` — codex R2 #2 #3); a path that does not exist on disk is normalised as a string only.
61
+ if [ -e "$_tg" ]; then
62
+ if [ -d "$_tg" ]; then _tg=$(cd "$_tg" 2>/dev/null && pwd -P)
63
+ else _tg="$(cd "$(dirname "$_tg")" 2>/dev/null && pwd -P)/$(basename "$_tg")"; fi
64
+ fi
65
+ case "$_tg" in
66
+ "$_sroot") _tg="." ;;
67
+ "$_sroot"/*) _tg="${_tg#"$_sroot"/}" ;;
68
+ /*) _tg="//outside//" ;; # absolute path outside the repo: matches nothing
69
+ *) _tg="${_spfx}${_tg}" ;;
70
+ esac
71
+ while [ "${_tg#./}" != "$_tg" ]; do _tg="${_tg#./}"; done
72
+ _tg="${_tg%/}"; _tg="${_tg%/.}"
73
+ [ -z "$_tg" ] && _tg="."
74
+ _ntg+=("$_tg")
75
+ done
76
+ _tmatch=()
77
+ for _tg in ${_ntg[@]+"${_ntg[@]}"}; do _tmatch+=(0); done
78
+ _copied=()
79
+ _sn=0
80
+ mkdir -p "$_stmp/t"
81
+ while IFS= read -r -d '' _sp; do
82
+ [ -z "$_sp" ] && continue
83
+ if [ ${#_ntg[@]} -gt 0 ]; then
84
+ _hit=0; _ti=0
85
+ for _tg in "${_ntg[@]}"; do
86
+ case "$_sp" in "$_tg"|"$_tg"/*) _hit=1; _tmatch[$_ti]=1 ;; esac
87
+ [ "$_tg" = "." ] && { _hit=1; _tmatch[$_ti]=1; }
88
+ _ti=$((_ti+1))
89
+ done
90
+ [ "$_hit" -eq 1 ] || continue
91
+ fi
92
+ mkdir -p "$_stmp/t/$(dirname "$_sp")"
93
+ if ! git -C "$_sroot" show ":$_sp" > "$_stmp/t/$_sp" 2>/dev/null; then
94
+ echo "degrade-scan: could not read staged content of $_sp — NOT measured, not clean"; exit 2
95
+ fi
96
+ _sn=$((_sn+1)); _copied+=("$_sp")
97
+ done < "$_stmp/.staged_list"
98
+ # Every NAMED target must select at least one staged file — one unmatched target among matched ones
99
+ # is still an omission, and the aggregate count cannot see it (codex R2 #3).
100
+ _ti=0
101
+ for _tg in ${_ntg[@]+"${_ntg[@]}"}; do
102
+ if [ "${_tmatch[$_ti]}" -eq 0 ]; then
103
+ echo "degrade-scan: target '$_tg' matched no staged file — COULD NOT BE MEASURED, not clean"; exit 2
104
+ fi
105
+ _ti=$((_ti+1))
106
+ done
107
+ if [ "$_sn" -eq 0 ]; then
108
+ if [ ${#_ntg[@]} -gt 0 ]; then
109
+ # Named targets that select no staged file are a caller/path mismatch, not a clean result —
110
+ # the hook must not print its clean checkmark here (codex R1 #2).
111
+ echo "degrade-scan: ${#_ntg[@]} target(s) matched no staged file — COULD NOT BE MEASURED, not clean"; exit 2
112
+ fi
113
+ echo "degrade-scan: no staged files — nothing measured (exit 0 = no input, not a verdict)"; exit 0
114
+ fi
115
+ cd "$_stmp/t" || exit 2 # relative paths in output = real repo paths
116
+ # Pass the copied FILES, not ".": directory discovery silently drops unsupported file types, while an
117
+ # explicit file target reports them as OUTSIDE the scannable set (codex R2 #1).
118
+ TARGETS=("${_copied[@]}")
119
+ fi
34
120
  [ ${#TARGETS[@]} -eq 0 ] && TARGETS=(".")
35
121
 
36
122
  # Permissive values a verdict/gate surface must never land on by *default* / fall-through.
@@ -96,7 +182,7 @@ command -v awk >/dev/null 2>&1 || { _S1B_OK=0; _FORCE_NONCLEAN=2; }
96
182
  # 하지 않아 정상 폴백은 100% 실패하고, 반대로 공격자가 그 이름에 심링크를 심어두면 **성공해서
97
183
  # 레포 밖에 쓴다**(실증됨). 즉 "공격받을 때만 동작하는 코드" 였다.
98
184
  _MD_TMP="$(mktemp -d 2>/dev/null)" || { _MD_TMP=""; _MD_OK=0; }
99
- trap '[ -n "$_MD_TMP" ] && rm -rf "$_MD_TMP"' EXIT
185
+ trap '[ -n "$_MD_TMP" ] && rm -rf "$_MD_TMP"; [ -n "${_stmp:-}" ] && rm -rf "$_stmp"' EXIT # also the --staged copy (this trap replaces the one set above)
100
186
  # LANGUAGE-SPLIT shadows (2026-08-12). The first version extracted only ```bash-family fences, and
101
187
  # extending it to ```python by widening the same regex would have written python source into a `.sh`
102
188
  # shadow — where `is_sh` is decided by the extension, so the SHELL probes would run on python and the