repowarden 4.10.1 → 4.10.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/bin/agents CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env bash
2
2
  # Branche le garde-fou repowarden (repowarden garde) dans les agents IA :
3
- # repowarden agents init [--claude] [--opencode] [--projet | --global]
3
+ # repowarden agents init [--claude] [--opencode] [--projet | --global]
4
+ # repowarden agents retirer [--claude] [--opencode] [--projet | --global]
4
5
  # Claude Code hook PreToolUse dans .claude/settings.json
5
6
  # opencode plugin .opencode/plugins/repowarden-garde.js
6
7
  # Sans --claude ni --opencode : les deux. --projet (défaut) : fichiers du dépôt,
7
- # à versionner ; --global : configuration de l'utilisateur. Relançable :
8
- # fichiers existants complétés, jamais écrasés.
8
+ # à versionner ; --global : configuration de l'utilisateur, là où chaque outil
9
+ # la lit (CLAUDE_CONFIG_DIR ; OPENCODE_CONFIG_DIR, sinon XDG_CONFIG_HOME).
10
+ # Relançable : fichiers existants complétés, jamais écrasés ; retirer n'enlève
11
+ # que ce qu'init a écrit.
9
12
  set -euo pipefail
10
13
 
11
14
  ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
@@ -18,8 +21,10 @@ MODELE_OPENCODE="$ROOT/hooks/agents/repowarden-garde.js"
18
21
  COMMANDE_CLAUDE="repowarden garde --format claude"
19
22
  MATCHER_CLAUDE="Edit|Write|MultiEdit|NotebookEdit|Bash"
20
23
 
24
+ action=""
21
25
  case "${1:-}" in
22
- init) shift ;;
26
+ init | retirer) action="$1"; shift ;;
27
+ remove) action=retirer; shift ;;
23
28
  "" | -h | --help) aide; exit 0 ;;
24
29
  *) err_t install.unknown_arg "$1"; aide >&2; exit 1 ;;
25
30
  esac
@@ -44,8 +49,11 @@ if [ "$portee" = projet ]; then
44
49
  fichier_claude="$base/.claude/settings.json"
45
50
  fichier_opencode="$base/.opencode/plugins/repowarden-garde.js"
46
51
  else
47
- fichier_claude="$HOME/.claude/settings.json"
48
- fichier_opencode="$HOME/.config/opencode/plugins/repowarden-garde.js"
52
+ # Réglages utilisateur de Claude Code : $CLAUDE_CONFIG_DIR s'il est défini
53
+ # (code.claude.com/docs/en/settings) ; plugins globaux d'opencode :
54
+ # $OPENCODE_CONFIG_DIR, sinon $XDG_CONFIG_HOME/opencode (opencode.ai/docs/config)
55
+ fichier_claude="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json"
56
+ fichier_opencode="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/plugins/repowarden-garde.js"
49
57
  fi
50
58
 
51
59
  ecrits=()
@@ -92,11 +100,69 @@ init_opencode() {
92
100
  ok_t agents.added opencode "$f"
93
101
  }
94
102
 
103
+ # Hook PreToolUse : seules les commandes « repowarden garde » retirées ; une
104
+ # entrée vidée disparaît, et le fichier s'il ne reste plus rien
105
+ retirer_claude() {
106
+ local f="$fichier_claude" tmp
107
+ if [ ! -f "$f" ] || ! grep -q "repowarden garde" "$f"; then
108
+ ok_t agents.absent "Claude Code" "$f"
109
+ return 0
110
+ fi
111
+ has jq || { err_t agents.no_jq "$f"; return 1; }
112
+ jq -e . "$f" >/dev/null 2>&1 || { err_t agents.bad_json "Claude Code" "$f"; return 1; }
113
+ tmp="$(mktemp)"
114
+ jq '(.hooks.PreToolUse // []) as $p
115
+ | .hooks.PreToolUse = [$p[] | .hooks = [(.hooks // [])[] | select((.command // "") | test("repowarden garde") | not)]
116
+ | select(.hooks | length > 0)]
117
+ | if (.hooks.PreToolUse | length) == 0 then del(.hooks.PreToolUse) else . end
118
+ | if (.hooks | length) == 0 then del(.hooks) else . end' "$f" >"$tmp"
119
+ if [ "$(jq -c . "$tmp")" = "{}" ]; then
120
+ rm -f "$f"
121
+ else
122
+ cat "$tmp" >"$f"
123
+ fi
124
+ rm -f "$tmp"
125
+ ok_t agents.removed "Claude Code" "$f"
126
+ }
127
+
128
+ # Plugin opencode : supprimé s'il est celui du modèle ; modifié, gardé et signalé
129
+ retirer_opencode() {
130
+ local f="$fichier_opencode"
131
+ if [ ! -f "$f" ]; then
132
+ ok_t agents.absent opencode "$f"
133
+ elif cmp -s "$f" "$MODELE_OPENCODE"; then
134
+ rm -f "$f"
135
+ ok_t agents.removed opencode "$f"
136
+ else
137
+ attention_t agents.kept_remove opencode "$f"
138
+ fi
139
+ }
140
+
95
141
  statut=0
142
+ if [ "$action" = retirer ]; then
143
+ [ -z "$claude" ] || retirer_claude || statut=1
144
+ [ -z "$opencode" ] || retirer_opencode || statut=1
145
+ exit "$statut"
146
+ fi
96
147
  [ -z "$claude" ] || init_claude || statut=1
97
148
  [ -z "$opencode" ] || init_opencode || statut=1
98
149
 
99
150
  has repowarden || attention_t agents.no_repowarden
151
+ # Hooks repowarden inactifs : le garde-fou refusera les commits, autant le
152
+ # dire maintenant (dossier de hooks repowarden : commit-msg et lib/common.sh)
153
+ if [ "$portee" = projet ]; then
154
+ hp="$(git config --get core.hooksPath 2>/dev/null || true)"
155
+ # Absolu : /…, ou C:/… et C:\… (git pour Windows)
156
+ case "$hp" in "" | /* | [A-Za-z]:[/\\]* | \~/*) ;; *) hp="$base/$hp" ;; esac
157
+ lieu="$base" commande="repowarden install"
158
+ else
159
+ hp="$(git config --global --get core.hooksPath 2>/dev/null || true)"
160
+ lieu="(--global)" commande="repowarden install --global"
161
+ fi
162
+ case "$hp" in \~/*) hp="$HOME/${hp#\~/}" ;; esac
163
+ if [ -z "$hp" ] || [ ! -f "$hp/commit-msg" ] || [ ! -f "$hp/lib/common.sh" ]; then
164
+ attention_t agents.sans_hooks "$lieu" "$commande"
165
+ fi
100
166
  if [ "$portee" = projet ] && [ ${#ecrits[@]} -gt 0 ]; then
101
167
  info_t agents.versionner "${ecrits[*]#"$base/"}"
102
168
  fi
package/bin/commit CHANGED
@@ -222,9 +222,15 @@ if [ -z "$first_commit" ] && [ -z "$DRY_RUN" ] && ! skipped protect-branch &&
222
222
  suggestion="$type/${scope:-$REPLY}"
223
223
  t cc.protected_hint "$branch"
224
224
  printf '\n %s%s%s\n' "$B" "$REPLY" "$N" >&2
225
+ # Sans question (-m : scripts, agents) : jamais de branche créée à la place
226
+ # de l'appelant ; la commande à lancer, plutôt qu'un abandon muet
227
+ if [ -n "$BATCH" ]; then
228
+ t cc.protected_batch "$suggestion"
229
+ printf '%s\n' "$REPLY" >&2
230
+ exit 1
231
+ fi
225
232
  while :; do
226
233
  t cc.new_branch_prompt "$suggestion"
227
- ANSWER=n # sans question : jamais de branche créée à la place de l'utilisateur
228
234
  ask "$REPLY"
229
235
  name="${REPLY:-$suggestion}"
230
236
  # Réponse incomplète ou approximative : complétée (« feat » → feat/<scope>,
package/bin/garde CHANGED
@@ -40,10 +40,13 @@ cwd="$(jq -r '.cwd // ""' <<<"$entree")"
40
40
  args="$(jq -c ".$a // {}" <<<"$entree")"
41
41
  [ -n "$cwd" ] && [ -d "$cwd" ] || cwd="$PWD"
42
42
 
43
- # Refus : raison et commande à lancer, puis code 2
43
+ # Refus : raison et commande à lancer, puis code 2. Ligne shell de plusieurs
44
+ # commandes (LIGNE_MULTIPLE) : refusée en bloc, ce que l'agent doit savoir
45
+ LIGNE_MULTIPLE=""
44
46
  refuser() {
45
47
  _tr "$@"
46
48
  printf '✖ repowarden : %b\n' "$_T" >&2
49
+ [ -z "$LIGNE_MULTIPLE" ] || { _tr garde.ligne_entiere; printf '%b\n' "$_T" >&2; }
47
50
  exit 2
48
51
  }
49
52
 
@@ -55,18 +58,57 @@ dossier_r() {
55
58
  REPLY="$p"
56
59
  }
57
60
 
61
+ # Vrai si les hooks repowarden sont actifs dans le dépôt courant : le
62
+ # core.hooksPath en vigueur (local, sinon global) est un dossier de hooks
63
+ # repowarden. Chemin relatif : depuis la racine du dépôt, comme git
64
+ hooks_actifs() {
65
+ local hp
66
+ hp="$(git config --get core.hooksPath 2>/dev/null || true)"
67
+ [ -n "$hp" ] || return 1
68
+ # Absolu : /…, ou C:/… et C:\… (git pour Windows : Git Bash convertit
69
+ # le chemin passé à git config)
70
+ case "$hp" in
71
+ \~/*) hp="$HOME/${hp#\~/}" ;;
72
+ /* | [A-Za-z]:[/\\]*) ;;
73
+ *) hp="$(git rev-parse --show-toplevel)/$hp" ;;
74
+ esac
75
+ [ -f "$hp/commit-msg" ] && [ -f "$hp/lib/common.sh" ] && [ -f "$hp/lib/tickets.sh" ]
76
+ }
77
+
58
78
  # Vrai si le dossier courant est dans un dépôt repowarden : .repowarden.conf,
59
79
  # réglage repowarden.*, ou hooks repowarden actifs. Charge sa configuration.
60
80
  depot_repowarden() {
61
- local hp
62
81
  git rev-parse --show-toplevel >/dev/null 2>&1 || return 1
63
82
  cfg_load
64
83
  i18n_init
65
84
  # shellcheck disable=SC2034 # cache de tickets_managed (tickets.sh), propre à ce dépôt
66
85
  TICKETS_MANAGED=""
67
86
  [ -n "$CFG_FILE$CFG_GIT" ] && return 0
68
- hp="$(git config --get core.hooksPath 2>/dev/null || true)"
69
- [ -n "$hp" ] && [ -f "$hp/lib/tickets.sh" ] && [ -f "$hp/lib/common.sh" ]
87
+ hooks_actifs
88
+ }
89
+
90
+ # Commit (repowarden cc, git commit) : hooks actifs, et pas sur une branche
91
+ # protégée (le commit y serait refusé ; sans terminal, cc ne crée pas de
92
+ # branche à la place de l'agent)
93
+ verifier_commit() {
94
+ local b
95
+ hooks_actifs || refuser garde.sans_hooks "$1"
96
+ b="$(git symbolic-ref -q --short HEAD 2>/dev/null || true)"
97
+ if [ -n "$b" ] && protegee "$b"; then
98
+ tickets_managed && refuser garde.commit_protegee "$1" "$b"
99
+ refuser garde.commit_protegee_libre "$1" "$b"
100
+ fi
101
+ }
102
+
103
+ # repowarden cc / commit (ou git cc), lancé depuis le dossier $dir
104
+ verifier_cc() {
105
+ dossier_r "$dir"
106
+ (
107
+ cd "$REPLY" 2>/dev/null || exit 0
108
+ depot_repowarden || exit 0
109
+ verifier_commit "$1"
110
+ exit 0
111
+ ) || exit $?
70
112
  }
71
113
 
72
114
  # Branche protégée : protectedBranches (défaut main master) ou branche d'intégration
@@ -136,9 +178,13 @@ verifier_git() {
136
178
  -[!-]*) [[ "$mot" != *n* ]] || refuser garde.no_verify "$ligne" ;;
137
179
  esac
138
180
  done
181
+ hooks_actifs || refuser garde.sans_hooks "$ligne"
139
182
  [ -n "$amend" ] && [ -n "$noedit" ] && exit 0
140
183
  refuser garde.commit "$ligne"
141
184
  ;;
185
+ cc)
186
+ verifier_commit "$ligne"
187
+ ;;
142
188
  add)
143
189
  for mot in ${args_git[@]+"${args_git[@]}"}; do
144
190
  case "$mot" in
@@ -190,6 +236,8 @@ verifier_shell() {
190
236
  lignes="${lignes//;/$nl}"
191
237
  lignes="${lignes//|/$nl}"
192
238
  lignes="${lignes//&/$nl}"
239
+ # Plusieurs commandes : un refus vaut pour toute la ligne (dit à l'agent)
240
+ [ "$(grep -c '[^[:space:]]' <<<"$lignes")" -le 1 ] || LIGNE_MULTIPLE=1
193
241
  while IFS= read -r segment; do
194
242
  # shellcheck disable=SC2162 # les antislashs restent tels quels, comme dans la commande
195
243
  read -a mots <<<"$segment" || true
@@ -215,6 +263,9 @@ verifier_shell() {
215
263
  shift
216
264
  verifier_git "${@//[\"\']/}"
217
265
  ;;
266
+ repowarden | */repowarden)
267
+ case "${2//[\"\']/}" in cc | commit) verifier_cc "repowarden ${2//[\"\']/}" ;; esac
268
+ ;;
218
269
  esac
219
270
  done <<<"$lignes"
220
271
  }
package/bin/repowarden CHANGED
@@ -22,6 +22,7 @@
22
22
  # repowarden app init GitHub App des workflows (une fois)
23
23
  # repowarden bot [init|rapport] bot d'organisation (dépôt de pilotage)
24
24
  # repowarden agents init [--claude] [--opencode] garde-fou des agents IA
25
+ # repowarden agents retirer le retire
25
26
  # repowarden garde [--format claude|opencode] vérifie une action d'agent
26
27
  # repowarden --version
27
28
  set -euo pipefail
@@ -72,6 +72,7 @@ _msg_en() {
72
72
  cc.yn_invalid) _M="Answer y (yes) or n (no)." ;;
73
73
  cc.topic_default) _M="change" ;;
74
74
  cc.protected_hint) _M="You are on \"%s\", which is protected: a commit would be refused there. It will go to a new branch (your changes follow)." ;;
75
+ cc.protected_batch) _M="Without questions, no branch is created for you: nothing was committed.\n → git switch -c %s (your changes follow), then run repowarden cc again." ;;
75
76
  cc.new_branch_prompt) _M="New branch (\"n\" to cancel) [%s]: " ;;
76
77
  cc.branch_exists) _M="Branch \"%s\" already exists: choose another name." ;;
77
78
  cc.branch_fixed) _M="\"%s\": expected <type>/<topic> in lowercase. Suggested: %s (Enter to accept)." ;;
@@ -108,7 +109,7 @@ _msg_en() {
108
109
  help.alias.feat) _M="(branch: feature/ accepted)" ;;
109
110
  help.alias.fix) _M="(branch: bugfix/, hotfix/ accepted)" ;;
110
111
  # Help texts for commands (--help): single source shown by bin/repowarden
111
- help.main) _M="Usage: repowarden <command> [options] · detailed help: repowarden <command> --help\n\n repowarden post status and next step\n repowarden statut (same)\n repowarden install [--global] [--lang fr|en] activate hooks (install.sh)\n repowarden uninstall [--global] [--purge] remove them (before npm uninstall -g)\n repowarden bots GitHub repo bots (CI, releases, tickets…)\n repowarden cc commit assistant\n repowarden code-mort new dead code in branch\n repowarden ticket ticket of the current branch\n repowarden ticket <n> branch of ticket (created, linked if needed)\n repowarden ticket nouveau \"<title>\" new ticket\n repowarden ticket comment <n> \"<text>\" add a comment\n repowarden ticket label <n> <label> [--remove] manage ticket labels\n repowarden pr label <n> <label> [--remove] manage PR labels\n repowarden pr checks <n> show PR checks\n repowarden run rerun <id|--failed|--workflow> rerun a workflow\n repowarden run list [--workflow <name>] list recent runs\n repowarden tickets init set up ticket tracking (GitHub)\n repowarden tickets sync my assigned tickets → local branches\n repowarden proteger [options] protect GitHub branches\n repowarden migrer [--pr] [--hooks] migrate from repogarde to repowarden\n repowarden npm-publication automate npm publication\n repowarden app init GitHub App for workflows (once)\n repowarden bot [init|rapport] org bot (pilot repo)\n repowarden agents init [--claude] [--opencode] AI agent guard (Claude Code, opencode)\n repowarden garde checks an agent action (called by its hook)\n repowarden --version installed version" ;;
112
+ help.main) _M="Usage: repowarden <command> [options] · detailed help: repowarden <command> --help\n\n repowarden post status and next step\n repowarden statut (same)\n repowarden install [--global] [--lang fr|en] activate hooks (install.sh)\n repowarden uninstall [--global] [--purge] remove them (before npm uninstall -g)\n repowarden bots GitHub repo bots (CI, releases, tickets…)\n repowarden cc commit assistant\n repowarden code-mort new dead code in branch\n repowarden ticket ticket of the current branch\n repowarden ticket <n> branch of ticket (created, linked if needed)\n repowarden ticket nouveau \"<title>\" new ticket\n repowarden ticket comment <n> \"<text>\" add a comment\n repowarden ticket label <n> <label> [--remove] manage ticket labels\n repowarden pr label <n> <label> [--remove] manage PR labels\n repowarden pr checks <n> show PR checks\n repowarden run rerun <id|--failed|--workflow> rerun a workflow\n repowarden run list [--workflow <name>] list recent runs\n repowarden tickets init set up ticket tracking (GitHub)\n repowarden tickets sync my assigned tickets → local branches\n repowarden proteger [options] protect GitHub branches\n repowarden migrer [--pr] [--hooks] migrate from repogarde to repowarden\n repowarden npm-publication automate npm publication\n repowarden app init GitHub App for workflows (once)\n repowarden bot [init|rapport] org bot (pilot repo)\n repowarden agents init [--claude] [--opencode] AI agent guard (Claude Code, opencode)\n repowarden agents retirer removes the AI agent guard\n repowarden garde checks an agent action (called by its hook)\n repowarden --version installed version" ;;
112
113
  help.statut) _M="Usage: repowarden statut (or repowarden, no args)\n\nRead-only status of repowarden on this machine and in the current repo,\nplus the next command to run (like \"gh auth status\" or \"brew doctor\")." ;;
113
114
  help.install) _M="Usage: repowarden install [--global] [--lang fr|en] [--bots | --sans-bots]\n\nActivate repowarden hooks (install.sh).\n --global all repos (and commit assistant: git cc)\n --lang fr|en message language (asked once if unset)\n --bots then propose repo bots (repowarden bots)\n --sans-bots never propose bots" ;;
114
115
  help.uninstall) _M="Usage: repowarden uninstall [--global] [--purge] [--scan FOLDER]\n\nRemove repowarden hooks (only if owned). Do before npm uninstall -g.\n --global also remove global installation\n --purge remove caches and list repos still pointing to repowarden\n --scan FOLDER check repos in FOLDER still using repowarden (with --purge)" ;;
@@ -123,8 +124,8 @@ _msg_en() {
123
124
  help.proteger) _M="Usage: repowarden proteger [--repo owner/name] [--checks \"repowarden,tests (ubuntu-latest)\"]\n [--relecteurs N] [--codeowners] [--environnement NAME] [--approbateurs \"login …\"]\n [--sans-tags] [--dry-run] [--verifier]\n\nProtects GitHub repo per .repowarden.conf: required PR, required checks,\nno force push/deletion, ruleset, squash merges, v* tags reserved to\nworkflows, optional human approvals. --verifier checks online rules\nwithout changes. Needs gh and admin rights." ;;
124
125
  help.migrer) _M="Usage: repowarden migrer [--pr] [--hooks]\n\nMigrates from repogarde to repowarden (docs/migration-v4.md): configs,\nworkflows, renames, lists manual steps left. Safe to rerun.\n --pr on chore/migration-repowarden-vN: commit, push and PR\n --hooks also move leftover lefthook hooks to .git/hooks-lefthook/" ;;
125
126
  help.npm-publication) _M="Usage: repowarden npm-publication [--repo owner/name] [--workflow release.yml]\n [--environnement NAME] [--dry-run]\n\nSets up automatic npm publishing per release via OIDC (trusted publishing,\nprovenance). Needs npm logged in, package exists; if interrupted resumes.\nWorkflow: release.yml publishes via npm-publish.yml." ;;
126
- help.garde) _M="Usage: repowarden garde [--format claude|opencode] (reads the action on standard input)\n\nAI agent guard, called by the agent's hook before each action (repowarden\nagents init wires it): exit code 0 allowed, 2 refused with the command to\nrun. In a repowarden repository: no change on a detached HEAD, on a\nprotected branch, or outside a ticket branch when the repository tracks its\ntickets; branches created by repowarden ticket <n>, commits by repowarden\ncc; no --no-verify, no git add . / -A / --all. Requires jq." ;;
127
- help.agents) _M="Usage: repowarden agents init [--claude] [--opencode] [--projet | --global]\n\nWires the guard (repowarden garde) into AI agents: Claude Code PreToolUse\nhook (.claude/settings.json), opencode plugin\n(.opencode/plugins/repowarden-garde.js). Without --claude or --opencode:\nboth. --projet (default): repository files, to commit; --global: user\nconfiguration. Re-runnable: existing files are completed, never\noverwritten." ;;
127
+ help.garde) _M="Usage: repowarden garde [--format claude|opencode] (reads the action on standard input)\n\nAI agent guard, called by the agent's hook before each action (repowarden\nagents init wires it): exit code 0 allowed, 2 refused with the command to\nrun. In a repowarden repository: no change on a detached HEAD, on a\nprotected branch, or outside a ticket branch when the repository tracks its\ntickets; branches created by repowarden ticket <n>, commits by repowarden\ncc (repowarden hooks active, off protected branches); no --no-verify, no\ngit add . / -A / --all. Requires jq." ;;
128
+ help.agents) _M="Usage: repowarden agents init [--claude] [--opencode] [--projet | --global]\n repowarden agents retirer [--claude] [--opencode] [--projet | --global]\n\nWires the guard (repowarden garde) into AI agents: Claude Code PreToolUse\nhook (.claude/settings.json), opencode plugin\n(.opencode/plugins/repowarden-garde.js). Without --claude or --opencode:\nboth. --projet (default): repository files, to commit; --global: user\nconfiguration (\$CLAUDE_CONFIG_DIR, ~/.claude by default;\n\$OPENCODE_CONFIG_DIR, else \$XDG_CONFIG_HOME/opencode, ~/.config/opencode by\ndefault). Re-runnable: existing files are completed, never overwritten.\nretirer (or remove): removes only what init wrote." ;;
128
129
  help.app) _M="Usage: repowarden app init [--repo owner/name] [--nom NAME] [--administration]\n repowarden app init --bot\n\nCreates/sets up a GitHub App for repowarden workflows (Actions token doesn't\ntrigger other workflows; App token does). Browser-based manifest, minimal\npermissions, credentials stored securely, installed on repo. --bot for org\nbot (pilot repo). Needs gh and node. Rerunnable." ;;
129
130
  # Hooks and language plugins
130
131
  hook.pre_commit.1) _M="Commit refused: branch name does not follow the convention." ;;
@@ -690,6 +691,10 @@ _msg_en() {
690
691
  garde.commit) _M="command refused: \"%s\"; commits go through the assistant (only --amend --no-edit is allowed).\n → repowarden cc -m \"<description>\" --refs \"Ticket : #<n>\"" ;;
691
692
  garde.no_verify) _M="command refused: \"%s\" bypasses the repowarden hooks.\n → Run it again without --no-verify and fix what the hooks report." ;;
692
693
  garde.add_tout) _M="command refused: \"%s\" adds the whole repository.\n → Add files one by one: git add <files>" ;;
694
+ garde.sans_hooks) _M="command refused: \"%s\"; the repowarden hooks are not active in this repository (messages, secrets and formatting would not be checked).\n → Activate them: repowarden install (or repowarden install --global), then run it again." ;;
695
+ garde.commit_protegee) _M="command refused: \"%s\"; \"%s\" is a protected branch, the commit would be refused there.\n → Work on a ticket's branch: repowarden ticket <n>, then run it again." ;;
696
+ garde.commit_protegee_libre) _M="command refused: \"%s\"; \"%s\" is a protected branch, the commit would be refused there.\n → Create a work branch (your changes follow): git switch -c <type>/<topic>, then run it again." ;;
697
+ garde.ligne_entiere) _M=" Nothing on this line was run, not even the other commands: run them separately." ;;
693
698
  agents.added) _M="%s: guard added (%s)." ;;
694
699
  agents.present) _M="%s: guard already in place (%s)." ;;
695
700
  agents.kept) _M="%s: %s exists and differs from the template; kept as is (template: %s)." ;;
@@ -697,6 +702,10 @@ _msg_en() {
697
702
  agents.no_jq) _M="jq is required to update %s (https://jqlang.org)." ;;
698
703
  agents.versionner) _M="To commit: git add %s" ;;
699
704
  agents.no_repowarden) _M="The guard calls \"repowarden garde\": repowarden must be on the PATH (npm install -g repowarden)." ;;
705
+ agents.sans_hooks) _M="repowarden hooks inactive %s: the guard will refuse commits. Activate them: %s" ;;
706
+ agents.removed) _M="%s: guard removed (%s)." ;;
707
+ agents.absent) _M="%s: no guard to remove (%s)." ;;
708
+ agents.kept_remove) _M="%s: %s differs from the template; kept (remove it by hand if no longer wanted)." ;;
700
709
  *) _M="" ;;
701
710
  esac
702
711
  }
@@ -72,6 +72,7 @@ _msg_fr() {
72
72
  cc.yn_invalid) _M="Réponds o (oui) ou n (non)." ;;
73
73
  cc.topic_default) _M="modification" ;;
74
74
  cc.protected_hint) _M="Tu es sur « %s », protégée : un commit y serait refusé. Il ira sur une nouvelle branche (tes modifications suivent)." ;;
75
+ cc.protected_batch) _M="Sans question, aucune branche n'est créée à ta place : rien n'a été commité.\n → git switch -c %s (tes modifications suivent), puis relance repowarden cc." ;;
75
76
  cc.new_branch_prompt) _M="Nouvelle branche (« n » pour abandonner) [%s] : " ;;
76
77
  cc.branch_exists) _M="La branche « %s » existe déjà : choisis un autre nom." ;;
77
78
  cc.branch_fixed) _M="« %s » : nom attendu <type>/<sujet> en minuscules. Proposé : %s (Entrée pour l'accepter)." ;;
@@ -227,7 +228,7 @@ _msg_fr() {
227
228
  help.alias.fix) _M="(branche : bugfix/, hotfix/ acceptés)" ;;
228
229
  # Aide des commandes (repowarden <commande> --help) : source unique,
229
230
  # affichée par bin/repowarden avant toute action (printf '%b\n' → \n)
230
- help.main) _M="Usage : repowarden <commande> [options] · aide détaillée : repowarden <commande> --help\n\n repowarden état du poste et étape suivante\n repowarden statut (idem)\n repowarden install [--global] [--lang fr|en] active les hooks (install.sh)\n repowarden uninstall [--global] [--purge] les retire (avant npm uninstall -g)\n repowarden bots bots du dépôt GitHub (CI, releases, tickets…)\n repowarden cc assistant de commit\n repowarden code-mort nouveau code mort de la branche\n repowarden ticket ticket de la branche courante\n repowarden ticket <n> branche du ticket (créée, liée, si besoin)\n repowarden ticket nouveau \"<titre>\" nouveau ticket\n repowarden ticket comment <n> \"<texte>\" commentaire sur un ticket\n repowarden ticket label <n> <label> [--remove] gère les labels d'un ticket\n repowarden pr label <n> <label> [--remove] gère les labels d'une PR\n repowarden pr checks <n> vérifie les checks d'une PR\n repowarden run rerun <id|--failed|--workflow> relance un workflow\n repowarden run list [--workflow <nom>] liste les runs récents\n repowarden tickets init suivi des tickets (GitHub)\n repowarden tickets sync mes tickets assignés → leurs branches locales\n repowarden proteger [options] protection des branches (GitHub)\n repowarden migrer [--pr] [--hooks] passage de repogarde à repowarden\n repowarden npm-publication publication npm automatique\n repowarden app init GitHub App des workflows (une fois)\n repowarden bot [init|rapport] bot d'organisation (dépôt de pilotage)\n repowarden agents init [--claude] [--opencode] garde-fou des agents IA (Claude Code, opencode)\n repowarden garde vérifie une action d'agent (appelé par son hook)\n repowarden --version version installée" ;;
231
+ help.main) _M="Usage : repowarden <commande> [options] · aide détaillée : repowarden <commande> --help\n\n repowarden état du poste et étape suivante\n repowarden statut (idem)\n repowarden install [--global] [--lang fr|en] active les hooks (install.sh)\n repowarden uninstall [--global] [--purge] les retire (avant npm uninstall -g)\n repowarden bots bots du dépôt GitHub (CI, releases, tickets…)\n repowarden cc assistant de commit\n repowarden code-mort nouveau code mort de la branche\n repowarden ticket ticket de la branche courante\n repowarden ticket <n> branche du ticket (créée, liée, si besoin)\n repowarden ticket nouveau \"<titre>\" nouveau ticket\n repowarden ticket comment <n> \"<texte>\" commentaire sur un ticket\n repowarden ticket label <n> <label> [--remove] gère les labels d'un ticket\n repowarden pr label <n> <label> [--remove] gère les labels d'une PR\n repowarden pr checks <n> vérifie les checks d'une PR\n repowarden run rerun <id|--failed|--workflow> relance un workflow\n repowarden run list [--workflow <nom>] liste les runs récents\n repowarden tickets init suivi des tickets (GitHub)\n repowarden tickets sync mes tickets assignés → leurs branches locales\n repowarden proteger [options] protection des branches (GitHub)\n repowarden migrer [--pr] [--hooks] passage de repogarde à repowarden\n repowarden npm-publication publication npm automatique\n repowarden app init GitHub App des workflows (une fois)\n repowarden bot [init|rapport] bot d'organisation (dépôt de pilotage)\n repowarden agents init [--claude] [--opencode] garde-fou des agents IA (Claude Code, opencode)\n repowarden agents retirer retire le garde-fou des agents IA\n repowarden garde vérifie une action d'agent (appelé par son hook)\n repowarden --version version installée" ;;
231
232
  help.statut) _M="Usage : repowarden statut (ou repowarden, sans argument)\n\nÉtat de repowarden sur ce poste et dans le dépôt courant, puis la commande\nsuivante à lancer (l'équivalent de « gh auth status » ou « brew doctor »).\nLecture seule : rien n'est modifié." ;;
232
233
  help.install) _M="Usage : repowarden install [--global] [--lang fr|en] [--bots | --sans-bots]\n\nActive les hooks repowarden (install.sh).\n --global tous les dépôts (et l'assistant de commit : git cc)\n --lang fr|en langue des messages (demandée une fois sinon)\n --bots propose ensuite les bots du dépôt GitHub (repowarden bots)\n --sans-bots ne plus jamais les proposer" ;;
233
234
  help.uninstall) _M="Usage : repowarden uninstall [--global] [--purge] [--scan DOSSIER]\n\nRetire les hooks repowarden (seulement s'ils sont les tiens), avant\nnpm uninstall -g.\n --global retire aussi l'installation globale\n --purge retire les caches et liste les dépôts encore branchés\n --scan DOSSIER dépôts de DOSSIER encore branchés sur repowarden (avec --purge)" ;;
@@ -242,8 +243,8 @@ _msg_fr() {
242
243
  help.proteger) _M="Usage : repowarden proteger [--repo propriétaire/nom] [--checks \"repowarden,tests (ubuntu-latest)\"]\n [--relecteurs N] [--codeowners] [--environnement NOM] [--approbateurs \"login …\"]\n [--sans-tags] [--dry-run] [--verifier]\n\nProtège le dépôt GitHub courant d'après .repowarden.conf (relançable sans\nrisque) : PR obligatoire, vérifications exigées, ni suppression ni push forcé\n(ruleset « repowarden »), merge squash, tags v* réservés aux workflows,\nvalidation humaine optionnelle. --verifier compare les règles en ligne sans\nrien modifier. Réglages équivalents dans .repowarden.conf. Demande gh et les\ndroits d'administration du dépôt." ;;
243
244
  help.migrer) _M="Usage : repowarden migrer [--pr] [--hooks]\n\nPassage de repogarde à repowarden dans le projet courant\n(docs/migration-v4.md) : configuration (.repowarden.conf, .repowarden/),\nworkflows (uses: vers le dépôt repowarden et sa version majeure, anciens\nnoms), puis la liste de ce qui reste à faire à la main. Relançable : rien\nn'est fait deux fois.\n --pr sur la branche chore/migration-repowarden-vN : commit, push et PR\n --hooks déplace aussi les hooks lefthook résiduels dans .git/hooks-lefthook/" ;;
244
245
  help.npm-publication) _M="Usage : repowarden npm-publication [--repo propriétaire/nom] [--workflow release.yml]\n [--environnement NOM] [--dry-run]\n\nPublication npm automatique mise en place en une commande : chaque release\npublie le paquet (workflow npm-publish.yml), sans jeton (publication de\nconfiance OIDC, provenance jointe) : connexion npm, paquet existant, puis\nrelation de confiance. Interrompue, la commande reprend où elle en était." ;;
245
- help.garde) _M="Usage : repowarden garde [--format claude|opencode] (lit l'action sur l'entrée standard)\n\nGarde-fou des agents IA, appelé par leur hook avant chaque action\n(repowarden agents init le branche) : code 0 permis, code 2 refusé avec la\ncommande à lancer. Dans un dépôt repowarden : pas de modification en HEAD\ndétaché, sur une branche protégée, ni hors branche de ticket si le dépôt\nsuit ses tickets ; branche créée par repowarden ticket <n>, commit par\nrepowarden cc ; ni --no-verify ni git add . / -A / --all. Demande jq." ;;
246
- help.agents) _M="Usage : repowarden agents init [--claude] [--opencode] [--projet | --global]\n\nBranche le garde-fou (repowarden garde) dans les agents IA : hook PreToolUse\nde Claude Code (.claude/settings.json), plugin opencode\n(.opencode/plugins/repowarden-garde.js). Sans --claude ni --opencode : les\ndeux. --projet (défaut) : fichiers du dépôt, à versionner ; --global :\nconfiguration de l'utilisateur. Relançable : fichiers existants complétés,\njamais écrasés." ;;
246
+ help.garde) _M="Usage : repowarden garde [--format claude|opencode] (lit l'action sur l'entrée standard)\n\nGarde-fou des agents IA, appelé par leur hook avant chaque action\n(repowarden agents init le branche) : code 0 permis, code 2 refusé avec la\ncommande à lancer. Dans un dépôt repowarden : pas de modification en HEAD\ndétaché, sur une branche protégée, ni hors branche de ticket si le dépôt\nsuit ses tickets ; branche créée par repowarden ticket <n>, commit par\nrepowarden cc (hooks repowarden actifs, hors branche protégée) ; ni\n--no-verify ni git add . / -A / --all. Demande jq." ;;
247
+ help.agents) _M="Usage : repowarden agents init [--claude] [--opencode] [--projet | --global]\n repowarden agents retirer [--claude] [--opencode] [--projet | --global]\n\nBranche le garde-fou (repowarden garde) dans les agents IA : hook PreToolUse\nde Claude Code (.claude/settings.json), plugin opencode\n(.opencode/plugins/repowarden-garde.js). Sans --claude ni --opencode : les\ndeux. --projet (défaut) : fichiers du dépôt, à versionner ; --global :\nconfiguration de l'utilisateur (\$CLAUDE_CONFIG_DIR, ~/.claude par défaut ;\n\$OPENCODE_CONFIG_DIR, sinon \$XDG_CONFIG_HOME/opencode, ~/.config/opencode par\ndéfaut). Relançable : fichiers existants complétés, jamais écrasés.\nretirer : enlève seulement ce qu'init a écrit." ;;
247
248
  help.app) _M="Usage : repowarden app init [--repo propriétaire/nom] [--nom NOM] [--administration]\n repowarden app init --bot\n\nGitHub App du dépôt : identité d'automatisation des workflows repowarden (le\njeton des Actions ne déclenche aucun workflow, un jeton de l'App, si).\nCréation dans le navigateur (flux « manifest »), permissions minimales,\nidentifiants rangés sans être affichés, installation sur le dépôt. --bot :\nApp du bot d'organisation, dans le dépôt de pilotage. Relançable ; demande\ngh et node." ;;
248
249
  # CI et protection
249
250
  ci.check.2) _M="Pas de base : vérification ignorée." ;;
@@ -691,6 +692,10 @@ _msg_fr() {
691
692
  garde.commit) _M="commande refusée : « %s » ; les commits passent par l'assistant (seul --amend --no-edit est permis).\n → repowarden cc -m \"<description>\" --refs \"Ticket : #<n>\"" ;;
692
693
  garde.no_verify) _M="commande refusée : « %s » contourne les hooks repowarden.\n → Relancer sans --no-verify et corriger ce que les hooks signalent." ;;
693
694
  garde.add_tout) _M="commande refusée : « %s » ajoute tout le dépôt.\n → Ajouter les fichiers un par un : git add <fichiers>" ;;
695
+ garde.sans_hooks) _M="commande refusée : « %s » ; les hooks repowarden ne sont pas actifs dans ce dépôt (messages, secrets et formatage ne seraient pas vérifiés).\n → Les activer : repowarden install (ou repowarden install --global), puis relancer." ;;
696
+ garde.commit_protegee) _M="commande refusée : « %s » ; « %s » est une branche protégée, le commit y serait refusé.\n → Travailler sur la branche d'un ticket : repowarden ticket <n>, puis relancer." ;;
697
+ garde.commit_protegee_libre) _M="commande refusée : « %s » ; « %s » est une branche protégée, le commit y serait refusé.\n → Créer une branche de travail (les modifications suivent) : git switch -c <type>/<sujet>, puis relancer." ;;
698
+ garde.ligne_entiere) _M=" Rien de cette ligne n'a été lancé, pas même les autres commandes : les relancer à part." ;;
694
699
  agents.added) _M="%s : garde-fou ajouté (%s)." ;;
695
700
  agents.present) _M="%s : garde-fou déjà en place (%s)." ;;
696
701
  agents.kept) _M="%s : %s existe et diffère du modèle ; gardé tel quel (modèle : %s)." ;;
@@ -698,6 +703,10 @@ _msg_fr() {
698
703
  agents.no_jq) _M="jq est requis pour compléter %s (https://jqlang.org)." ;;
699
704
  agents.versionner) _M="À versionner : git add %s" ;;
700
705
  agents.no_repowarden) _M="Le garde-fou appelle « repowarden garde » : repowarden doit être dans le PATH (npm install -g repowarden)." ;;
706
+ agents.sans_hooks) _M="Hooks repowarden inactifs %s : le garde-fou refusera les commits. Les activer : %s" ;;
707
+ agents.removed) _M="%s : garde-fou retiré (%s)." ;;
708
+ agents.absent) _M="%s : pas de garde-fou à retirer (%s)." ;;
709
+ agents.kept_remove) _M="%s : %s diffère du modèle ; gardé (à retirer à la main s'il n'est plus voulu)." ;;
701
710
  *) _M="" ;;
702
711
  esac
703
712
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repowarden",
3
- "version": "4.10.1",
3
+ "version": "4.10.2",
4
4
  "description": "Hooks git et CI multi-langages : messages de commit, nommage des branches, secrets, formatage, tests ciblés, code mort, releases.",
5
5
  "keywords": [
6
6
  "git-hooks",