@the-bearded-bear/claude-craft 9.2.1-next.14f0d71 → 9.2.1-next.56cd1d3
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/Dev/i18n/base/Common/hooks/scripts/block-dangerous-commands.sh +1 -1
- package/Dev/i18n/base/Common/hooks/scripts/guard-network.sh +1 -1
- package/Dev/i18n/base/Common/hooks/scripts/notify-slack.sh +1 -1
- package/Dev/i18n/base/Common/hooks/scripts/output-filter.sh +2 -2
- package/Dev/i18n/base/Common/hooks/scripts/output-size-hint.sh +3 -3
- package/Dev/i18n/base/Common/hooks/scripts/post-edit-lint.sh +3 -3
- package/Dev/i18n/base/Common/hooks/scripts/post-tool-failure.sh +2 -2
- package/Dev/i18n/base/Common/hooks/scripts/pre-commit-check.sh +7 -7
- package/Dev/i18n/base/Common/hooks/scripts/pre-compact.sh +8 -8
- package/Dev/i18n/base/Common/hooks/scripts/protect-sensitive-files.sh +2 -2
- package/Dev/i18n/base/Common/hooks/scripts/quality-gate.sh +10 -10
- package/Dev/i18n/base/Common/hooks/scripts/session-end.sh +3 -3
- package/Dev/i18n/base/Common/hooks/scripts/session-init.sh +8 -8
- package/Dev/scripts/lib/install-tech-common.sh +39 -39
- package/Dev/scripts/tcl-common.sh +23 -23
- package/Infra/install-ansible-rules.sh +26 -26
- package/Infra/install-coolify-rules.sh +26 -26
- package/Infra/install-docker-rules.sh +26 -26
- package/Infra/install-frankenphp-rules.sh +26 -26
- package/Infra/install-hcloud-rules.sh +26 -26
- package/Infra/install-kubernetes-rules.sh +26 -26
- package/Infra/install-opentofu-rules.sh +26 -26
- package/Infra/install-pgbouncer-rules.sh +26 -26
- package/Project/install-project-commands.sh +9 -9
- package/README.md +4 -0
- package/Tools/ProjectConfig/claude-projects.sh +2 -2
- package/Tools/RTK/install-rtk.sh +1 -1
- package/Tools/Ralph/hooks/lib/ralph-common.sh +3 -3
- package/Tools/Ralph/hooks/pre-tool-context.sh +2 -2
- package/Tools/Ralph/hooks/session-restore.sh +8 -8
- package/Tools/Ralph/hooks/stop-dod-gate.sh +6 -6
- package/Tools/Ralph/lib/metrics-exporter.sh +3 -3
- package/Tools/Ralph/lib/parallel-manager.sh +1 -1
- package/Tools/Ralph/lib/recovery-engine.sh +2 -1
- package/cli/kanban/client/dist/assets/{BurndownView-Dk1mfbJc.js → BurndownView-s2wpjiqE.js} +1 -1
- package/cli/kanban/client/dist/assets/{DepsView-76dCn6dU.js → DepsView-Bo8sRS7i.js} +1 -1
- package/cli/kanban/client/dist/assets/{DocsView-DhqiPmYN.js → DocsView-QjjjfhpV.js} +1 -1
- package/cli/kanban/client/dist/assets/{SprintsView-D0cZZhvI.js → SprintsView-BSh9XshU.js} +1 -1
- package/cli/kanban/client/dist/assets/{actions-CnvXl3Kr.js → actions-D0g4C88h.js} +1 -1
- package/cli/kanban/client/dist/assets/index-CdlYlxD5.js +2 -0
- package/cli/kanban/client/dist/assets/{palette.svelte-BjYi22Ct.js → palette.svelte-BymgBiMI.js} +1 -1
- package/cli/kanban/client/dist/assets/router.svelte-CKx0fx-k.js +1 -0
- package/cli/kanban/client/dist/index.html +3 -3
- package/cli/kanban/client/src/app.css +1 -1
- package/cli/kanban/client/src/lib/board-nav.js +1 -1
- package/cli/kanban/client/src/lib/i18n/translate.js +3 -1
- package/cli/kanban/client/src/lib/markdown.js +15 -2
- package/cli/kanban/client/src/lib/optimistic.js +2 -1
- package/cli/kanban/client/src/lib/query.js +8 -5
- package/cli/kanban/client/src/lib/sprint-actions.svelte.js +1 -1
- package/cli/kanban/client/src/lib/story-form.js +4 -1
- package/cli/kanban/server/services/frontmatter.js +21 -6
- package/cli/kanban/server/services/sprint-ops.js +28 -6
- package/cli/kanban/server/services/status-store.js +3 -2
- package/cli/kanban/server/services/story-files.js +23 -8
- package/cli/lib/doctor.js +4 -4
- package/cli/lib/installer.js +2 -2
- package/package.json +1 -1
- package/cli/kanban/client/dist/assets/index-CheCLe3m.js +0 -2
- package/cli/kanban/client/dist/assets/router.svelte-Dj-4eOGr.js +0 -1
|
@@ -13,7 +13,7 @@ set -u
|
|
|
13
13
|
hook_require_parser
|
|
14
14
|
hook_input
|
|
15
15
|
CMD=$(hook_get tool_input.command)
|
|
16
|
-
[ -n "$CMD" ] || exit 0
|
|
16
|
+
[[ -n "$CMD" ]] || exit 0
|
|
17
17
|
|
|
18
18
|
# Corps de heredoc retirés, puis un segment par ligne (hook_shell_segments) : le texte
|
|
19
19
|
# cité est une donnée, sauf après sh -c / eval et dans $(…) / `…`. Un segment "|"
|
|
@@ -11,10 +11,10 @@ hook_has_parser || exit 0
|
|
|
11
11
|
hook_input
|
|
12
12
|
OUT=$(hook_get tool_response.stdout)
|
|
13
13
|
LEN=${#OUT}
|
|
14
|
-
[ "$LEN" -gt 50000 ] || exit 0
|
|
14
|
+
[[ "$LEN" -gt 50000 ]] || exit 0
|
|
15
15
|
|
|
16
16
|
INTERRUPTED=false
|
|
17
|
-
[ "$(hook_get tool_response.interrupted)" != true ] || INTERRUPTED=true
|
|
17
|
+
[[ "$(hook_get tool_response.interrupted)" != true ]] || INTERRUPTED=true
|
|
18
18
|
HEAD=$(printf '%s' "$OUT" | head -c 8000)
|
|
19
19
|
hook_replace_bash_output \
|
|
20
20
|
"[output truncated by the output-filter hook: ${LEN} chars total, first 8000 shown. Re-run with a narrower command (grep/head/tail) to see more.]
|
|
@@ -8,12 +8,12 @@ set -u
|
|
|
8
8
|
hook_has_parser || exit 0
|
|
9
9
|
hook_input
|
|
10
10
|
OUT=$(hook_get tool_response.stdout)
|
|
11
|
-
[ -n "$OUT" ] || OUT=$(hook_get tool_response)
|
|
11
|
+
[[ -n "$OUT" ]] || OUT=$(hook_get tool_response)
|
|
12
12
|
LEN=${#OUT}
|
|
13
13
|
|
|
14
|
-
if [ "$LEN" -gt 50000 ]; then
|
|
14
|
+
if [[ "$LEN" -gt 50000 ]]; then
|
|
15
15
|
hook_context PostToolUse "Output very large (${LEN} chars). Summarize key findings only; do not repeat output verbatim."
|
|
16
|
-
elif [ "$(hook_get tool_name)" = "Bash" ] && [ "$LEN" -gt 10000 ]; then
|
|
16
|
+
elif [[ "$(hook_get tool_name)" = "Bash" ]] && [[ "$LEN" -gt 10000 ]]; then
|
|
17
17
|
hook_context PostToolUse "Output: $(printf '%s\n' "$OUT" | wc -l | tr -d ' ') lines. Extract only relevant information."
|
|
18
18
|
fi
|
|
19
19
|
exit 0
|
|
@@ -8,18 +8,18 @@ set -u
|
|
|
8
8
|
hook_has_parser || exit 0
|
|
9
9
|
hook_input
|
|
10
10
|
FILE_PATH=$(hook_get tool_input.file_path)
|
|
11
|
-
[ -n "$FILE_PATH" ] || exit 0
|
|
11
|
+
[[ -n "$FILE_PATH" ]] || exit 0
|
|
12
12
|
|
|
13
13
|
have() { command -v "$1" >/dev/null 2>&1; }
|
|
14
14
|
|
|
15
15
|
case "${FILE_PATH##*.}" in
|
|
16
16
|
js | jsx | ts | tsx)
|
|
17
|
-
if have npx && [ -f package.json ]; then npx --no-install eslint --fix "$FILE_PATH" >/dev/null 2>&1 || true; fi
|
|
17
|
+
if have npx && [[ -f package.json ]]; then npx --no-install eslint --fix "$FILE_PATH" >/dev/null 2>&1 || true; fi
|
|
18
18
|
;;
|
|
19
19
|
php)
|
|
20
20
|
if have php-cs-fixer; then
|
|
21
21
|
php-cs-fixer fix "$FILE_PATH" --quiet >/dev/null 2>&1 || true
|
|
22
|
-
elif [ -x vendor/bin/php-cs-fixer ]; then
|
|
22
|
+
elif [[ -x vendor/bin/php-cs-fixer ]]; then
|
|
23
23
|
vendor/bin/php-cs-fixer fix "$FILE_PATH" --quiet >/dev/null 2>&1 || true
|
|
24
24
|
fi
|
|
25
25
|
;;
|
|
@@ -12,7 +12,7 @@ hook_input
|
|
|
12
12
|
TOOL=$(hook_get tool_name)
|
|
13
13
|
ERROR=$(hook_get error)
|
|
14
14
|
CWD=$(hook_get cwd)
|
|
15
|
-
[ -z "$CWD" ] || cd "$CWD" 2>/dev/null || true
|
|
15
|
+
[[ -z "$CWD" ]] || cd "$CWD" 2>/dev/null || true
|
|
16
16
|
|
|
17
17
|
has() { printf '%s' "$ERROR" | grep -qiE -e "$1"; }
|
|
18
18
|
|
|
@@ -46,5 +46,5 @@ printf '[%s] [%s] [%s] %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$severity" "$TOOL
|
|
|
46
46
|
"$(printf '%s' "$ERROR" | tr '\n' ' ' | cut -c1-300)" >>.claude/logs/tool-failures.log 2>/dev/null
|
|
47
47
|
|
|
48
48
|
HINT=$(recovery_hint)
|
|
49
|
-
[ -z "$HINT" ] || hook_context PostToolUseFailure "$HINT"
|
|
49
|
+
[[ -z "$HINT" ]] || hook_context PostToolUseFailure "$HINT"
|
|
50
50
|
exit 0
|
|
@@ -12,9 +12,9 @@ set -u
|
|
|
12
12
|
hook_require_parser
|
|
13
13
|
hook_input
|
|
14
14
|
CMD=$(hook_get tool_input.command)
|
|
15
|
-
[ -n "$CMD" ] || exit 0
|
|
15
|
+
[[ -n "$CMD" ]] || exit 0
|
|
16
16
|
cwd=$(hook_get cwd)
|
|
17
|
-
[ -z "$cwd" ] || cd "$cwd" 2>/dev/null || exit 0
|
|
17
|
+
[[ -z "$cwd" ]] || cd "$cwd" 2>/dev/null || exit 0
|
|
18
18
|
|
|
19
19
|
# Lignes émises : `commit`, `all` (commit -a), `add` (git add), `dir <chemin>` (git -C).
|
|
20
20
|
facts=$(printf '%s\n' "$CMD" | hook_strip_heredocs | tr "'\"" ' ' | awk '
|
|
@@ -41,7 +41,7 @@ facts=$(printf '%s\n' "$CMD" | hook_strip_heredocs | tr "'\"" ' ' | awk '
|
|
|
41
41
|
case "$facts" in *commit*) ;; *) exit 0 ;; esac
|
|
42
42
|
|
|
43
43
|
dir=$(printf '%s\n' "$facts" | sed -n 's/^dir //p' | head -n 1)
|
|
44
|
-
[ -z "$dir" ] || cd "$dir" 2>/dev/null || exit 0
|
|
44
|
+
[[ -z "$dir" ]] || cd "$dir" 2>/dev/null || exit 0
|
|
45
45
|
top=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
|
|
46
46
|
cd "$top" || exit 0
|
|
47
47
|
|
|
@@ -50,19 +50,19 @@ if printf '%s\n' "$facts" | grep -qxE 'add|all'; then
|
|
|
50
50
|
files=$(printf '%s\n%s\n%s\n' "$files" "$(git diff --name-only HEAD 2>/dev/null)" "$(git ls-files -o --exclude-standard 2>/dev/null)")
|
|
51
51
|
fi
|
|
52
52
|
files=$(printf '%s\n' "$files" | sed '/^$/d' | sort -u)
|
|
53
|
-
[ -n "$files" ] || exit 0
|
|
53
|
+
[[ -n "$files" ]] || exit 0
|
|
54
54
|
|
|
55
55
|
existing=()
|
|
56
56
|
while IFS= read -r f; do
|
|
57
57
|
if is_sensitive_path "$f"; then hook_block "Attempting to commit a sensitive file: $f"; fi
|
|
58
|
-
[ -f "$f" ] && existing+=("$f")
|
|
58
|
+
[[ -f "$f" ]] && existing+=("$f")
|
|
59
59
|
done <<EOF
|
|
60
60
|
$files
|
|
61
61
|
EOF
|
|
62
|
-
[ ${#existing[@]} -gt 0 ] || exit 0
|
|
62
|
+
[[ ${#existing[@]} -gt 0 ]] || exit 0
|
|
63
63
|
|
|
64
64
|
for p in '-----BEGIN [A-Z ]*PRIVATE KEY-----' 'AKIA[0-9A-Z]{16}' 'ghp_[A-Za-z0-9]{36}' 'xox[baprs]-[A-Za-z0-9-]{10,}'; do
|
|
65
65
|
hit=$(grep -lIE -e "$p" -- "${existing[@]}" 2>/dev/null | head -n 1)
|
|
66
|
-
[ -z "$hit" ] || hook_block "Potential secret detected in $hit"
|
|
66
|
+
[[ -z "$hit" ]] || hook_block "Potential secret detected in $hit"
|
|
67
67
|
done
|
|
68
68
|
exit 0
|
|
@@ -11,7 +11,7 @@ set -u
|
|
|
11
11
|
hook_has_parser || exit 0
|
|
12
12
|
hook_input
|
|
13
13
|
CWD=$(hook_get cwd)
|
|
14
|
-
[ -z "$CWD" ] || cd "$CWD" 2>/dev/null || true
|
|
14
|
+
[[ -z "$CWD" ]] || cd "$CWD" 2>/dev/null || true
|
|
15
15
|
SESSION_ID=$(hook_get session_id)
|
|
16
16
|
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
17
17
|
STAMP=$(date -u +%Y%m%d%H%M%S)
|
|
@@ -28,25 +28,25 @@ prune() {
|
|
|
28
28
|
local f i=0
|
|
29
29
|
while IFS= read -r f; do
|
|
30
30
|
i=$((i + 1))
|
|
31
|
-
[ "$i" -le 10 ] || rm -f "$f"
|
|
31
|
+
[[ "$i" -le 10 ]] || rm -f "$f"
|
|
32
32
|
done < <(ls -t "$1"/*.yaml 2>/dev/null)
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
log "Context compaction triggered (session: ${SESSION_ID:-unknown})"
|
|
36
36
|
SAVED=""
|
|
37
|
-
if [ -f .bmad/sprint-status.yaml ]; then
|
|
37
|
+
if [[ -f .bmad/sprint-status.yaml ]]; then
|
|
38
38
|
backup .bmad/sprint-status.yaml .bmad/backups sprint-status && SAVED="$SAVED .bmad/sprint-status.yaml"
|
|
39
39
|
fi
|
|
40
|
-
if [ -f .bmad/current-story.yaml ]; then
|
|
40
|
+
if [[ -f .bmad/current-story.yaml ]]; then
|
|
41
41
|
backup .bmad/current-story.yaml .bmad/backups current-story && SAVED="$SAVED .bmad/current-story.yaml"
|
|
42
42
|
fi
|
|
43
|
-
if [ -d .recette/sessions ]; then
|
|
43
|
+
if [[ -d .recette/sessions ]]; then
|
|
44
44
|
ACTIVE=$(find .recette/sessions -name '*.yaml' -mmin -60 2>/dev/null | head -n 1)
|
|
45
|
-
[ -z "$ACTIVE" ] || backup "$ACTIVE" .recette/backups "$(basename "$ACTIVE" .yaml)"
|
|
45
|
+
[[ -z "$ACTIVE" ]] || backup "$ACTIVE" .recette/backups "$(basename "$ACTIVE" .yaml)"
|
|
46
46
|
fi
|
|
47
47
|
for d in .bmad/backups .recette/backups; do
|
|
48
|
-
[ ! -d "$d" ] || prune "$d"
|
|
48
|
+
[[ ! -d "$d" ]] || prune "$d"
|
|
49
49
|
done
|
|
50
50
|
|
|
51
|
-
[ -z "$SAVED" ] || printf 'When compacting, keep the current BMAD sprint and story context (backed up:%s).\n' "$SAVED"
|
|
51
|
+
[[ -z "$SAVED" ]] || printf 'When compacting, keep the current BMAD sprint and story context (backed up:%s).\n' "$SAVED"
|
|
52
52
|
exit 0
|
|
@@ -8,9 +8,9 @@ set -u
|
|
|
8
8
|
hook_require_parser
|
|
9
9
|
hook_input
|
|
10
10
|
FILE=$(hook_get tool_input.file_path)
|
|
11
|
-
[ -n "$FILE" ] || FILE=$(hook_get tool_input.notebook_path)
|
|
11
|
+
[[ -n "$FILE" ]] || FILE=$(hook_get tool_input.notebook_path)
|
|
12
12
|
|
|
13
|
-
if [ -n "$FILE" ] && is_sensitive_path "$FILE"; then
|
|
13
|
+
if [[ -n "$FILE" ]] && is_sensitive_path "$FILE"; then
|
|
14
14
|
hook_block "Cannot modify sensitive file: $FILE"
|
|
15
15
|
fi
|
|
16
16
|
exit 0
|
|
@@ -11,29 +11,29 @@ set -u
|
|
|
11
11
|
|
|
12
12
|
hook_has_parser || exit 0
|
|
13
13
|
hook_input
|
|
14
|
-
[ "$(hook_get stop_hook_active)" = "true" ] && exit 0
|
|
14
|
+
[[ "$(hook_get stop_hook_active)" = "true" ]] && exit 0
|
|
15
15
|
cwd=$(hook_get cwd)
|
|
16
|
-
[ -z "$cwd" ] || cd "$cwd" 2>/dev/null || exit 0
|
|
16
|
+
[[ -z "$cwd" ]] || cd "$cwd" 2>/dev/null || exit 0
|
|
17
17
|
|
|
18
18
|
# Commande de test du projet (vide si aucun framework détecté).
|
|
19
19
|
detect_cmd() {
|
|
20
|
-
if [ -n "${QUALITY_GATE_CMD:-}" ]; then printf '%s' "$QUALITY_GATE_CMD"; return; fi
|
|
21
|
-
if [ -f package.json ]; then
|
|
20
|
+
if [[ -n "${QUALITY_GATE_CMD:-}" ]]; then printf '%s' "$QUALITY_GATE_CMD"; return; fi
|
|
21
|
+
if [[ -f package.json ]]; then
|
|
22
22
|
local saved=$HOOK_INPUT script
|
|
23
23
|
HOOK_INPUT=$(cat package.json)
|
|
24
24
|
script=$(hook_get scripts.test)
|
|
25
25
|
HOOK_INPUT=$saved
|
|
26
26
|
case "$script" in "" | *"no test specified"*) ;; *) printf 'npm test'; return ;; esac
|
|
27
27
|
fi
|
|
28
|
-
if [ -f composer.json ] && [ -x vendor/bin/phpunit ]; then printf 'vendor/bin/phpunit'
|
|
29
|
-
elif { [ -f pyproject.toml ] || [ -f setup.py ]; } && command -v pytest >/dev/null 2>&1; then printf 'pytest -q'
|
|
30
|
-
elif [ -f pubspec.yaml ] && command -v flutter >/dev/null 2>&1; then printf 'flutter test'
|
|
31
|
-
elif [ -f go.mod ] && command -v go >/dev/null 2>&1; then printf 'go test ./...'
|
|
28
|
+
if [[ -f composer.json ]] && [[ -x vendor/bin/phpunit ]]; then printf 'vendor/bin/phpunit'
|
|
29
|
+
elif { [[ -f pyproject.toml ]] || [[ -f setup.py ]]; } && command -v pytest >/dev/null 2>&1; then printf 'pytest -q'
|
|
30
|
+
elif [[ -f pubspec.yaml ]] && command -v flutter >/dev/null 2>&1; then printf 'flutter test'
|
|
31
|
+
elif [[ -f go.mod ]] && command -v go >/dev/null 2>&1; then printf 'go test ./...'
|
|
32
32
|
fi
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
cmd=$(detect_cmd)
|
|
36
|
-
[ -n "$cmd" ] || exit 0
|
|
36
|
+
[[ -n "$cmd" ]] || exit 0
|
|
37
37
|
|
|
38
38
|
# Empreinte de l'arbre de travail (hors journaux) : vide hors dépôt git => pas de cache.
|
|
39
39
|
fingerprint=""
|
|
@@ -41,7 +41,7 @@ if git rev-parse --git-dir >/dev/null 2>&1; then
|
|
|
41
41
|
fingerprint=$({ git status --porcelain -- . ':!.claude/logs'; git diff HEAD -- . ':!.claude/logs'; } 2>/dev/null | cksum)
|
|
42
42
|
fi
|
|
43
43
|
ok_file=.claude/logs/quality-gate.ok
|
|
44
|
-
if [ -n "$fingerprint" ] && [ -f "$ok_file" ] && [ "$(cat "$ok_file")" = "$fingerprint" ]; then
|
|
44
|
+
if [[ -n "$fingerprint" ]] && [[ -f "$ok_file" ]] && [[ "$(cat "$ok_file")" = "$fingerprint" ]]; then
|
|
45
45
|
exit 0
|
|
46
46
|
fi
|
|
47
47
|
|
|
@@ -9,7 +9,7 @@ set -u
|
|
|
9
9
|
hook_has_parser || exit 0
|
|
10
10
|
hook_input
|
|
11
11
|
CWD=$(hook_get cwd)
|
|
12
|
-
[ -z "$CWD" ] || cd "$CWD" 2>/dev/null || true
|
|
12
|
+
[[ -z "$CWD" ]] || cd "$CWD" 2>/dev/null || true
|
|
13
13
|
SESSION_ID=$(hook_get session_id)
|
|
14
14
|
REASON=$(hook_get reason)
|
|
15
15
|
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
@@ -24,13 +24,13 @@ FILES=$(git status --porcelain -- . ':!.claude' 2>/dev/null | wc -l | tr -d ' ')
|
|
|
24
24
|
|
|
25
25
|
# Échecs d'outils du jour ; `|| true` : grep -c affiche déjà 0 et sort en 1 sans correspondance.
|
|
26
26
|
FAILURES=0
|
|
27
|
-
if [ -f .claude/logs/tool-failures.log ]; then
|
|
27
|
+
if [[ -f .claude/logs/tool-failures.log ]]; then
|
|
28
28
|
FAILURES=$(grep -c "^\[$(date -u +%Y-%m-%d)" .claude/logs/tool-failures.log) || true
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
31
|
STORY=none
|
|
32
32
|
STATUS=unknown
|
|
33
|
-
if [ -f .bmad/current-story.yaml ]; then
|
|
33
|
+
if [[ -f .bmad/current-story.yaml ]]; then
|
|
34
34
|
STORY=$(grep '^id:' .bmad/current-story.yaml | head -n 1 | cut -d' ' -f2) || true
|
|
35
35
|
STATUS=$(grep '^status:' .bmad/current-story.yaml | head -n 1 | cut -d' ' -f2) || true
|
|
36
36
|
fi
|
|
@@ -9,12 +9,12 @@ set -u
|
|
|
9
9
|
hook_has_parser || exit 0
|
|
10
10
|
hook_input
|
|
11
11
|
CWD=$(hook_get cwd)
|
|
12
|
-
[ -z "$CWD" ] || cd "$CWD" 2>/dev/null || true
|
|
12
|
+
[[ -z "$CWD" ]] || cd "$CWD" 2>/dev/null || true
|
|
13
13
|
|
|
14
14
|
# Variables sûres de .env.local, au format `export NAME=valeur`. Valeurs limitées à
|
|
15
15
|
# [A-Za-z0-9_.:/-] : CLAUDE_ENV_FILE est sourcé par le shell, pas de métacaractères.
|
|
16
16
|
# DATABASE_URL est exclue (identifiants possibles) ; commentaires et lignes vides ignorés.
|
|
17
|
-
if [ -n "${CLAUDE_ENV_FILE:-}" ] && [ -f .env.local ]; then
|
|
17
|
+
if [[ -n "${CLAUDE_ENV_FILE:-}" ]] && [[ -f .env.local ]]; then
|
|
18
18
|
sed -n -E 's#^(NODE_ENV|APP_ENV|APP_DEBUG|DATABASE_HOST|DATABASE_PORT|LOG_LEVEL|PORT|HOST)=([A-Za-z0-9_.:/-]*)$#export \1=\2#p' \
|
|
19
19
|
.env.local >>"$CLAUDE_ENV_FILE" 2>/dev/null
|
|
20
20
|
fi
|
|
@@ -29,18 +29,18 @@ json_field() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
CONTEXT=""
|
|
32
|
-
add() { [ -z "$2" ] || CONTEXT="$CONTEXT$1 $2, "; }
|
|
32
|
+
add() { [[ -z "$2" ]] || CONTEXT="$CONTEXT$1 $2, "; }
|
|
33
33
|
|
|
34
|
-
if [ -f composer.json ]; then
|
|
34
|
+
if [[ -f composer.json ]]; then
|
|
35
35
|
add Symfony "$(json_field composer.json 'require.symfony/framework-bundle')"
|
|
36
36
|
add PHP "$(json_field composer.json require.php)"
|
|
37
37
|
fi
|
|
38
|
-
if [ -f package.json ]; then
|
|
38
|
+
if [[ -f package.json ]]; then
|
|
39
39
|
add React "$(json_field package.json dependencies.react)"
|
|
40
40
|
add Next.js "$(json_field package.json dependencies.next)"
|
|
41
41
|
fi
|
|
42
|
-
[ ! -f pubspec.yaml ] || CONTEXT="${CONTEXT}Flutter/Dart, "
|
|
43
|
-
[ ! -f pyproject.toml ] || CONTEXT="${CONTEXT}Python, "
|
|
42
|
+
[[ ! -f pubspec.yaml ]] || CONTEXT="${CONTEXT}Flutter/Dart, "
|
|
43
|
+
[[ ! -f pyproject.toml ]] || CONTEXT="${CONTEXT}Python, "
|
|
44
44
|
|
|
45
45
|
# Services déclarés dans les fichiers Compose (noms canoniques et historiques).
|
|
46
46
|
COMPOSE=$(cat compose.yaml compose.yml docker-compose.yaml docker-compose.yml 2>/dev/null)
|
|
@@ -49,5 +49,5 @@ for svc in postgres:PostgreSQL mysql:MySQL redis:Redis; do
|
|
|
49
49
|
done
|
|
50
50
|
|
|
51
51
|
CONTEXT=${CONTEXT%, }
|
|
52
|
-
[ -z "$CONTEXT" ] || hook_context SessionStart "Project stack: $CONTEXT"
|
|
52
|
+
[[ -z "$CONTEXT" ]] || hook_context SessionStart "Project stack: $CONTEXT"
|
|
53
53
|
exit 0
|
|
@@ -161,18 +161,18 @@ verify_source_files() {
|
|
|
161
161
|
for rule in "${TECH_RULES[@]}"; do
|
|
162
162
|
local rule_file="${src_dir}/rules/${rule}"
|
|
163
163
|
local base_rule_file="$I18N_DIR/base/$TECH_NAME/rules/${rule}"
|
|
164
|
-
if [ ! -f "$rule_file" ] && [ ! -f "$base_rule_file" ]; then
|
|
164
|
+
if [[ ! -f "$rule_file" ]] && [[ ! -f "$base_rule_file" ]]; then
|
|
165
165
|
log_error "Missing source file: rules/${rule}"
|
|
166
166
|
missing=1
|
|
167
167
|
fi
|
|
168
168
|
done
|
|
169
169
|
local verify_file="${src_dir}/${TECH_VERIFY_FILE}"
|
|
170
170
|
local base_verify_file="$I18N_DIR/base/$TECH_NAME/${TECH_VERIFY_FILE}"
|
|
171
|
-
if [ ! -f "$verify_file" ] && [ ! -f "$base_verify_file" ]; then
|
|
171
|
+
if [[ ! -f "$verify_file" ]] && [[ ! -f "$base_verify_file" ]]; then
|
|
172
172
|
log_error "Missing source file: ${TECH_VERIFY_FILE}"
|
|
173
173
|
missing=1
|
|
174
174
|
fi
|
|
175
|
-
if [ $missing -eq 1 ]; then exit 1; fi
|
|
175
|
+
if [[ $missing -eq 1 ]]; then exit 1; fi
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
# ============================================================================
|
|
@@ -180,10 +180,10 @@ verify_source_files() {
|
|
|
180
180
|
# ============================================================================
|
|
181
181
|
detect_installation() {
|
|
182
182
|
local target_dir="$1"
|
|
183
|
-
if [ -d "${target_dir}/.claude" ]; then
|
|
184
|
-
if [ -d "${target_dir}/.claude/references/${TECH_NAMESPACE}" ]; then
|
|
183
|
+
if [[ -d "${target_dir}/.claude" ]]; then
|
|
184
|
+
if [[ -d "${target_dir}/.claude/references/${TECH_NAMESPACE}" ]]; then
|
|
185
185
|
echo "tcl"
|
|
186
|
-
elif [ -f "${target_dir}/.claude/rules/00-project-context.md" ]; then
|
|
186
|
+
elif [[ -f "${target_dir}/.claude/rules/00-project-context.md" ]]; then
|
|
187
187
|
echo "legacy"
|
|
188
188
|
else
|
|
189
189
|
echo "partial"
|
|
@@ -197,8 +197,8 @@ create_backup() {
|
|
|
197
197
|
local target_dir="$1"
|
|
198
198
|
local dry_run="$2"
|
|
199
199
|
local backup_dir="${target_dir}/.claude-backup-$(date +%Y%m%d-%H%M%S)"
|
|
200
|
-
if [ -d "${target_dir}/.claude" ]; then
|
|
201
|
-
if [ "$dry_run" = "true" ]; then
|
|
200
|
+
if [[ -d "${target_dir}/.claude" ]]; then
|
|
201
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
202
202
|
log_dry_run "Backup: ${backup_dir}"
|
|
203
203
|
else
|
|
204
204
|
cp -r "${target_dir}/.claude" "${backup_dir}"
|
|
@@ -239,7 +239,7 @@ copy_generic_skills() {
|
|
|
239
239
|
for skill_name in "${!skill_names[@]}"; do
|
|
240
240
|
local dest_dir="${target_dir}/.claude/skills/${skill_name}"
|
|
241
241
|
|
|
242
|
-
if [ "$dry_run" = "true" ]; then
|
|
242
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
243
243
|
log_dry_run "Copy skill: skills/${skill_name}/"
|
|
244
244
|
else
|
|
245
245
|
mkdir -p "$dest_dir"
|
|
@@ -250,7 +250,7 @@ copy_generic_skills() {
|
|
|
250
250
|
((count++)) || true
|
|
251
251
|
done
|
|
252
252
|
|
|
253
|
-
if [ "$dry_run" = "false" ] && [ $count -gt 0 ]; then
|
|
253
|
+
if [[ "$dry_run" = "false" ]] && [[ $count -gt 0 ]]; then
|
|
254
254
|
log_success "$count generic skills copied from Common/"
|
|
255
255
|
fi
|
|
256
256
|
}
|
|
@@ -283,7 +283,7 @@ copy_tech_skills() {
|
|
|
283
283
|
for skill_name in "${!skill_names[@]}"; do
|
|
284
284
|
local dest_dir="${target_dir}/.claude/skills/${skill_name}"
|
|
285
285
|
|
|
286
|
-
if [ "$dry_run" = "true" ]; then
|
|
286
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
287
287
|
log_dry_run "Copy skill: skills/${skill_name}/"
|
|
288
288
|
else
|
|
289
289
|
mkdir -p "$dest_dir"
|
|
@@ -293,7 +293,7 @@ copy_tech_skills() {
|
|
|
293
293
|
((count++)) || true
|
|
294
294
|
done
|
|
295
295
|
|
|
296
|
-
if [ "$dry_run" = "false" ] && [ $count -gt 0 ]; then
|
|
296
|
+
if [[ "$dry_run" = "false" ]] && [[ $count -gt 0 ]]; then
|
|
297
297
|
log_success "$count ${TECH_DISPLAY_NAME}-specific skills copied"
|
|
298
298
|
fi
|
|
299
299
|
}
|
|
@@ -304,14 +304,14 @@ copy_templates() {
|
|
|
304
304
|
local dest="${target_dir}/.claude/templates"
|
|
305
305
|
|
|
306
306
|
if i18n_dir_exists "$TECH_NAME/templates"; then
|
|
307
|
-
if [ "$dry_run" = "true" ]; then
|
|
307
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
308
308
|
log_dry_run "Copy: templates/*.md"
|
|
309
309
|
else
|
|
310
310
|
copy_i18n_files "$TECH_NAME/templates" "$dest" "*.md"
|
|
311
311
|
log_success "Templates copied"
|
|
312
312
|
fi
|
|
313
|
-
elif [ -d "${SCRIPT_DIR}/templates" ]; then
|
|
314
|
-
if [ "$dry_run" = "true" ]; then
|
|
313
|
+
elif [[ -d "${SCRIPT_DIR}/templates" ]]; then
|
|
314
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
315
315
|
log_dry_run "Copy: templates/*.md"
|
|
316
316
|
else
|
|
317
317
|
cp "${SCRIPT_DIR}/templates/"*.md "$dest/" 2>/dev/null || true
|
|
@@ -326,14 +326,14 @@ copy_checklists() {
|
|
|
326
326
|
local dest="${target_dir}/.claude/checklists"
|
|
327
327
|
|
|
328
328
|
if i18n_dir_exists "$TECH_NAME/checklists"; then
|
|
329
|
-
if [ "$dry_run" = "true" ]; then
|
|
329
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
330
330
|
log_dry_run "Copy: checklists/*.md"
|
|
331
331
|
else
|
|
332
332
|
copy_i18n_files "$TECH_NAME/checklists" "$dest" "*.md"
|
|
333
333
|
log_success "Checklists copied"
|
|
334
334
|
fi
|
|
335
|
-
elif [ -d "${SCRIPT_DIR}/checklists" ]; then
|
|
336
|
-
if [ "$dry_run" = "true" ]; then
|
|
335
|
+
elif [[ -d "${SCRIPT_DIR}/checklists" ]]; then
|
|
336
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
337
337
|
log_dry_run "Copy: checklists/*.md"
|
|
338
338
|
else
|
|
339
339
|
cp "${SCRIPT_DIR}/checklists/"*.md "$dest/" 2>/dev/null || true
|
|
@@ -348,7 +348,7 @@ copy_commands() {
|
|
|
348
348
|
local dest="${target_dir}/.claude/commands/${TECH_NAMESPACE}"
|
|
349
349
|
|
|
350
350
|
if i18n_dir_exists "$TECH_NAME/commands"; then
|
|
351
|
-
if [ "$dry_run" = "true" ]; then
|
|
351
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
352
352
|
log_dry_run "Copy: commands/${TECH_NAMESPACE}/*.md"
|
|
353
353
|
else
|
|
354
354
|
copy_i18n_files "$TECH_NAME/commands" "$dest" "*.md"
|
|
@@ -356,8 +356,8 @@ copy_commands() {
|
|
|
356
356
|
count=$(find "$dest" -name "*.md" -type f 2>/dev/null | wc -l)
|
|
357
357
|
log_success "${count} commands copied (/${TECH_NAMESPACE}:*)"
|
|
358
358
|
fi
|
|
359
|
-
elif [ -d "${SCRIPT_DIR}/claude-commands/${TECH_NAMESPACE}" ]; then
|
|
360
|
-
if [ "$dry_run" = "true" ]; then
|
|
359
|
+
elif [[ -d "${SCRIPT_DIR}/claude-commands/${TECH_NAMESPACE}" ]]; then
|
|
360
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
361
361
|
log_dry_run "Copy: commands/${TECH_NAMESPACE}/*.md"
|
|
362
362
|
else
|
|
363
363
|
cp "${SCRIPT_DIR}/claude-commands/${TECH_NAMESPACE}/"*.md "$dest/" 2>/dev/null || true
|
|
@@ -375,7 +375,7 @@ copy_checks() {
|
|
|
375
375
|
local dest="${target_dir}/.claude/references/${TECH_NAMESPACE}/checks"
|
|
376
376
|
|
|
377
377
|
if i18n_dir_exists "$TECH_NAME/checks"; then
|
|
378
|
-
if [ "$dry_run" = "true" ]; then
|
|
378
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
379
379
|
log_dry_run "Copy: references/${TECH_NAMESPACE}/checks/*.md"
|
|
380
380
|
else
|
|
381
381
|
mkdir -p "$dest"
|
|
@@ -391,14 +391,14 @@ copy_agents() {
|
|
|
391
391
|
local dest="${target_dir}/.claude/agents"
|
|
392
392
|
|
|
393
393
|
if i18n_dir_exists "$TECH_NAME/agents"; then
|
|
394
|
-
if [ "$dry_run" = "true" ]; then
|
|
394
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
395
395
|
log_dry_run "Copy: agents/*.md"
|
|
396
396
|
else
|
|
397
397
|
copy_i18n_files "$TECH_NAME/agents" "$dest" "*.md"
|
|
398
398
|
log_success "Agents copied"
|
|
399
399
|
fi
|
|
400
|
-
elif [ -d "${SCRIPT_DIR}/claude-agents" ]; then
|
|
401
|
-
if [ "$dry_run" = "true" ]; then
|
|
400
|
+
elif [[ -d "${SCRIPT_DIR}/claude-agents" ]]; then
|
|
401
|
+
if [[ "$dry_run" = "true" ]]; then
|
|
402
402
|
log_dry_run "Copy: agents/*.md"
|
|
403
403
|
else
|
|
404
404
|
cp "${SCRIPT_DIR}/claude-agents/"*.md "$dest/" 2>/dev/null || true
|
|
@@ -443,7 +443,7 @@ install_tcl() {
|
|
|
443
443
|
create_tcl_directory_structure "$target_dir" "$TECH_NAMESPACE" "$dry_run"
|
|
444
444
|
|
|
445
445
|
# 2. Copy base references (universal principles)
|
|
446
|
-
if [ "$skip_common" = "false" ]; then
|
|
446
|
+
if [[ "$skip_common" = "false" ]]; then
|
|
447
447
|
copy_base_references "$target_dir" "$I18N_DIR" "$lang" "$dry_run"
|
|
448
448
|
fi
|
|
449
449
|
|
|
@@ -451,7 +451,7 @@ install_tcl() {
|
|
|
451
451
|
copy_tech_references "$target_dir" "$src_dir" "$TECH_NAMESPACE" "$dry_run" "${TECH_RULE_MAPPINGS[@]}"
|
|
452
452
|
|
|
453
453
|
# 3b. Copy 2026 feature references (if any)
|
|
454
|
-
if [[ ${#TECH_2026_REFS[@]} -gt 0 ]] && [ "$dry_run" = "false" ]; then
|
|
454
|
+
if [[ ${#TECH_2026_REFS[@]} -gt 0 ]] && [[ "$dry_run" = "false" ]]; then
|
|
455
455
|
local refs_2026_src="${TECH_2026_REFS_SRC_DIR:-${SCRIPT_DIR}/../../.claude/references/${TECH_NAMESPACE}}"
|
|
456
456
|
local refs_2026_dst="${target_dir}/.claude/references/${TECH_NAMESPACE}"
|
|
457
457
|
# Skip if source and destination resolve to the same directory
|
|
@@ -459,29 +459,29 @@ install_tcl() {
|
|
|
459
459
|
resolved_src="$(cd "$refs_2026_src" 2>/dev/null && pwd)" || resolved_src=""
|
|
460
460
|
resolved_dst="$(cd "$refs_2026_dst" 2>/dev/null && pwd)" || resolved_dst=""
|
|
461
461
|
local count_2026=0
|
|
462
|
-
if [ -n "$resolved_src" ] && [ "$resolved_src" = "$resolved_dst" ]; then
|
|
462
|
+
if [[ -n "$resolved_src" ]] && [[ "$resolved_src" = "$resolved_dst" ]]; then
|
|
463
463
|
log_success "2026 feature references already in place (same directory)"
|
|
464
464
|
else
|
|
465
465
|
for ref_file in "${TECH_2026_REFS[@]}"; do
|
|
466
|
-
if [ -f "${refs_2026_src}/${ref_file}" ]; then
|
|
466
|
+
if [[ -f "${refs_2026_src}/${ref_file}" ]]; then
|
|
467
467
|
cp "${refs_2026_src}/${ref_file}" "${refs_2026_dst}/"
|
|
468
468
|
((count_2026++)) || true
|
|
469
469
|
fi
|
|
470
470
|
done
|
|
471
471
|
fi
|
|
472
|
-
if [ $count_2026 -gt 0 ]; then
|
|
472
|
+
if [[ $count_2026 -gt 0 ]]; then
|
|
473
473
|
log_success "${count_2026} 2026 feature references copied"
|
|
474
474
|
fi
|
|
475
475
|
fi
|
|
476
476
|
|
|
477
477
|
# 4. Copy project context template (base + lang fallback)
|
|
478
|
-
if [ "$dry_run" = "false" ]; then
|
|
478
|
+
if [[ "$dry_run" = "false" ]]; then
|
|
479
479
|
local ctx_template
|
|
480
480
|
ctx_template=$(resolve_i18n_file "$TECH_NAME/rules/00-project-context.md.template")
|
|
481
481
|
if [[ -z "$ctx_template" ]]; then
|
|
482
482
|
ctx_template="${src_dir}/rules/00-project-context.md.template"
|
|
483
483
|
fi
|
|
484
|
-
if [ -f "$ctx_template" ]; then
|
|
484
|
+
if [[ -f "$ctx_template" ]]; then
|
|
485
485
|
local sed_args=(-e "s#{{PROJECT_NAME}}#${project_name}#g" -e "s#{{TECH_STACK}}#${tech_stack}#g")
|
|
486
486
|
if [[ ${#TECH_EXTRA_SED_ARGS[@]} -gt 0 ]]; then
|
|
487
487
|
sed_args+=("${TECH_EXTRA_SED_ARGS[@]}")
|
|
@@ -492,7 +492,7 @@ install_tcl() {
|
|
|
492
492
|
fi
|
|
493
493
|
|
|
494
494
|
# 5. Copy skills
|
|
495
|
-
if [ "$skip_common" = "false" ]; then
|
|
495
|
+
if [[ "$skip_common" = "false" ]]; then
|
|
496
496
|
copy_generic_skills "$target_dir" "$dry_run"
|
|
497
497
|
fi
|
|
498
498
|
copy_tech_skills "$target_dir" "$dry_run"
|
|
@@ -558,7 +558,7 @@ main() {
|
|
|
558
558
|
|
|
559
559
|
verify_source_files
|
|
560
560
|
|
|
561
|
-
if [ -z "$mode" ]; then
|
|
561
|
+
if [[ -z "$mode" ]]; then
|
|
562
562
|
case $(detect_installation "$target_dir") in
|
|
563
563
|
tcl) log_info "Existing TCL installation -> update mode"; mode="update" ;;
|
|
564
564
|
legacy) log_info "Legacy installation detected -> TCL migration"; mode="install" ;;
|
|
@@ -566,17 +566,17 @@ main() {
|
|
|
566
566
|
esac
|
|
567
567
|
fi
|
|
568
568
|
|
|
569
|
-
[ "$backup" = "true" ] || [ "$force" = "true" ] && create_backup "$target_dir" "$dry_run"
|
|
569
|
+
[[ "$backup" = "true" ]] || [[ "$force" = "true" ]] && create_backup "$target_dir" "$dry_run"
|
|
570
570
|
|
|
571
571
|
case $mode in
|
|
572
572
|
install)
|
|
573
|
-
[ "$interactive" = "true" ] && prompt_project_info || { PROJECT_NAME="${PROJECT_NAME:-MyProject}"; TECH_STACK="${TECH_STACK:-${DEFAULT_STACK}}"; }
|
|
573
|
+
[[ "$interactive" = "true" ]] && prompt_project_info || { PROJECT_NAME="${PROJECT_NAME:-MyProject}"; TECH_STACK="${TECH_STACK:-${DEFAULT_STACK}}"; }
|
|
574
574
|
install_tcl "$target_dir" "$PROJECT_NAME" "$TECH_STACK" "$dry_run" "$preserve_config" "$skip_common"
|
|
575
575
|
;;
|
|
576
576
|
update)
|
|
577
|
-
if [ "$force" = "true" ]; then
|
|
577
|
+
if [[ "$force" = "true" ]]; then
|
|
578
578
|
log_warning "Force mode: ALL files will be overwritten"
|
|
579
|
-
[ "$interactive" = "true" ] && prompt_project_info || { PROJECT_NAME="${PROJECT_NAME:-MyProject}"; TECH_STACK="${TECH_STACK:-${DEFAULT_STACK}}"; }
|
|
579
|
+
[[ "$interactive" = "true" ]] && prompt_project_info || { PROJECT_NAME="${PROJECT_NAME:-MyProject}"; TECH_STACK="${TECH_STACK:-${DEFAULT_STACK}}"; }
|
|
580
580
|
install_tcl "$target_dir" "$PROJECT_NAME" "$TECH_STACK" "$dry_run" "$preserve_config" "$skip_common"
|
|
581
581
|
else
|
|
582
582
|
log_info "Updating references..."
|
|
@@ -587,7 +587,7 @@ main() {
|
|
|
587
587
|
;;
|
|
588
588
|
esac
|
|
589
589
|
|
|
590
|
-
if [ "$dry_run" = "false" ]; then
|
|
590
|
+
if [[ "$dry_run" = "false" ]]; then
|
|
591
591
|
show_tcl_summary "$target_dir" "$TECH_DISPLAY_NAME" "$TECH_NAMESPACE"
|
|
592
592
|
else
|
|
593
593
|
log_dry_run "End of simulation"
|