devzone 4.3.0 → 6.0.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 (45) hide show
  1. package/.devcontainer/Dockerfile +1 -1
  2. package/.devcontainer/agent-errors.sh +13 -13
  3. package/.devcontainer/agent-local.sh +18 -18
  4. package/.devcontainer/agent-model.messages +7 -7
  5. package/.devcontainer/agent-model.sh +46 -46
  6. package/.devcontainer/agent-pod-manifest.sh +1 -1
  7. package/.devcontainer/agent-pod.sh +7 -7
  8. package/.devcontainer/agent-rights.sh +31 -31
  9. package/.devcontainer/agent-session.sh +22 -22
  10. package/.devcontainer/agent-state-json.sh +21 -21
  11. package/.devcontainer/agent-workspace.sh +8 -8
  12. package/.devcontainer/agent.sh +30 -30
  13. package/.devcontainer/ai/host-check.sh +2 -2
  14. package/.devcontainer/ai/host-models.sh +4 -4
  15. package/.devcontainer/ai/plugins/devzone-guard-v2.js +1 -1
  16. package/.devcontainer/ai/plugins/devzone-guard.js +1 -1
  17. package/.devcontainer/catalog/mysql/app.conf +1 -1
  18. package/.devcontainer/cluster.sh +1 -1
  19. package/.devcontainer/command-aliases.sh +34 -4
  20. package/.devcontainer/devzone +2 -2
  21. package/.devcontainer/devzone-ai.sh +4 -4
  22. package/.devcontainer/devzone-modules.sh +1 -1
  23. package/.devcontainer/devzone-skill.sh +1 -1
  24. package/.devcontainer/opencode.jsonc +1 -1
  25. package/.devcontainer/packages.sh +1 -1
  26. package/.devcontainer/post-create.sh +2 -0
  27. package/.devcontainer/rename-legacy-files.sh +71 -14
  28. package/.devcontainer/skills/devzone/SKILL.md +7 -7
  29. package/.devcontainer/state-json.sh +1 -1
  30. package/.devcontainer/state.sh +6 -6
  31. package/.devcontainer/workspace-init.sh +1 -1
  32. package/README.md +6 -6
  33. package/bin/SHA256SUMS +6 -6
  34. package/bin/devzone-darwin-amd64 +0 -0
  35. package/bin/devzone-darwin-arm64 +0 -0
  36. package/bin/devzone-linux-amd64 +0 -0
  37. package/bin/devzone-linux-arm64 +0 -0
  38. package/bin/devzone-windows-amd64.exe +0 -0
  39. package/bin/devzone-windows-arm64.exe +0 -0
  40. package/manage/devzone +17 -11
  41. package/manage/scripts/devzone-update.sh +4 -4
  42. package/manage/scripts/workspace/ports-apps.sh +1 -1
  43. package/manage/scripts/workspace/ports-workspace.sh +15 -15
  44. package/manage/scripts/workspace/workspace-clone.sh +2 -2
  45. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
- # Machine output of devzone agent etat (--json): sessions, exclusions, rights alerts.
3
- # Keys (schema, sessions, ecarts, fin, alertes_droits...) and values are a public
4
- # format: they keep their French names.
2
+ # Machine output of devzone agent state (--json): sessions, exclusions, rights alerts.
3
+ # Public format, schema 2: the keys are English names; the values stored in the
4
+ # state files (causes such as pays, quota, muet) keep their stored names.
5
5
  set -euo pipefail
6
6
 
7
7
  SOURCE="${BASH_SOURCE[0]}"
@@ -26,9 +26,9 @@ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
26
26
  # shellcheck disable=SC1091
27
27
  . "$ICI/agent-session.sh"
28
28
 
29
- AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
29
+ AGENT_STATE="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
30
30
 
31
- # UTC ISO-8601 date of an epoch, GNU then BSD date: the fin field of the exclusions.
31
+ # UTC ISO-8601 date of an epoch, GNU then BSD date: the end field of the exclusions.
32
32
  iso() {
33
33
  if date -u -d "@$1" '+%Y-%m-%dT%H:%M:%SZ' >/dev/null 2>&1; then
34
34
  date -u -d "@$1" '+%Y-%m-%dT%H:%M:%SZ'
@@ -38,7 +38,7 @@ iso() {
38
38
  }
39
39
 
40
40
  # Agent state in JSON: reuses the data of agent_state, agent_exclusions and
41
- # droits_alertes, without copying their logic.
41
+ # rights_alerts, without copying their logic.
42
42
  agent_state_json() {
43
43
  local sessions_json='[]' exclusions_json='[]' alerts_json='[]'
44
44
  local f journal model start last project running name
@@ -50,7 +50,7 @@ agent_state_json() {
50
50
  session_model_start "$f"
51
51
  session_request "$f"
52
52
  model="$MODEL_SESSION"
53
- [ -n "$model" ] || model="inconnu"
53
+ [ -n "$model" ] || model="unknown"
54
54
  start="$START_SESSION"
55
55
  last="$(utc_time "$(mtime "$f")")"
56
56
  project="${journal%.log}"
@@ -63,12 +63,12 @@ agent_state_json() {
63
63
  --arg last "$last" \
64
64
  --arg request "$REQUEST_SESSION" \
65
65
  --argjson running "$running" \
66
- '. + [{journal:$journal,modele:$model,debut:(if $start=="" then null else $start end),dernier_ecrit:(if $last=="" then null else $last end),demande:(if $request=="" then null else $request end),en_cours:$running}]' \
66
+ '. + [{journal:$journal,model:$model,start:(if $start=="" then null else $start end),last_written:(if $last=="" then null else $last end),requested:(if $request=="" then null else $request end),running:$running}]' \
67
67
  <<<"$sessions_json")"
68
68
  done
69
69
 
70
70
  now="$(date +%s)"
71
- for f in "$AGENT_ETAT"/ecart-*; do
71
+ for f in "$AGENT_STATE"/ecart-*; do
72
72
  [ -e "$f" ] || continue
73
73
  model="${f##*/ecart-}"
74
74
  read -r e cause d <<<"$(cat "$f" 2>/dev/null || true)"
@@ -77,13 +77,13 @@ agent_state_json() {
77
77
  [ "$now" -lt "$end" ] || continue
78
78
  end_iso="$(iso "$end")"
79
79
  exclusions_json="$(jq -c \
80
- --arg modele "$model" \
80
+ --arg model "$model" \
81
81
  --arg cause "${cause:-autre}" \
82
- --arg fin "$end_iso" \
83
- '. + [{modele:$modele,cause:$cause,fin:$fin}]' \
82
+ --arg end "$end_iso" \
83
+ '. + [{model:$model,cause:$cause,end:$end}]' \
84
84
  <<<"$exclusions_json")"
85
85
  done
86
- for f in "$AGENT_ETAT"/muet-*; do
86
+ for f in "$AGENT_STATE"/muet-*; do
87
87
  [ -e "$f" ] || continue
88
88
  model="${f##*/muet-}"
89
89
  e="$(cat "$f" 2>/dev/null || true)"
@@ -92,14 +92,14 @@ agent_state_json() {
92
92
  [ "$now" -lt "$end" ] || continue
93
93
  end_iso="$(iso "$end")"
94
94
  exclusions_json="$(jq -c \
95
- --arg modele "$model" \
95
+ --arg model "$model" \
96
96
  --arg cause "muet" \
97
- --arg fin "$end_iso" \
98
- '. + [{modele:$modele,cause:$cause,fin:$fin}]' \
97
+ --arg end "$end_iso" \
98
+ '. + [{model:$model,cause:$cause,end:$end}]' \
99
99
  <<<"$exclusions_json")"
100
100
  done
101
101
 
102
- for f in "$AGENT_ETAT"/droits-*.alerte; do
102
+ for f in "$AGENT_STATE"/droits-*.alerte; do
103
103
  [ -e "$f" ] || continue
104
104
  name="${f##*/droits-}"
105
105
  name="${name%.alerte}"
@@ -107,11 +107,11 @@ agent_state_json() {
107
107
  done
108
108
 
109
109
  jq -n \
110
- --argjson schema 1 \
110
+ --argjson schema 2 \
111
111
  --argjson sessions "$sessions_json" \
112
- --argjson ecarts "$exclusions_json" \
113
- --argjson alertes "$alerts_json" \
114
- '{schema:$schema,sessions:$sessions,ecarts:$ecarts,alertes_droits:$alertes}'
112
+ --argjson exclusions "$exclusions_json" \
113
+ --argjson alerts "$alerts_json" \
114
+ '{schema:$schema,sessions:$sessions,exclusions:$exclusions,rights_alerts:$alerts}'
115
115
  }
116
116
 
117
117
  agent_state_json
@@ -27,7 +27,7 @@ opencode_launch() {
27
27
  if agent_in_pod; then
28
28
  # In the pod, the limited service account is the only access: no workstation
29
29
  # kubeconfig enters the environment of opencode.
30
- (cd "$folder" && env -u KUBECONFIG DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "$(modele_ref "$m")" "$(cat "$brief")" </dev/null >>"$journal" 2>&1) &
30
+ (cd "$folder" && env -u KUBECONFIG DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "$(model_ref "$m")" "$(cat "$brief")" </dev/null >>"$journal" 2>&1) &
31
31
  else
32
32
  if [ -f "$HOME/.kube/config" ]; then
33
33
  (umask 077; KUBECONFIG="$HOME/.kube/config" kubectl config view --minify --flatten --context devzone >"$agent_kube") 2>/dev/null || : >"$agent_kube"
@@ -36,7 +36,7 @@ opencode_launch() {
36
36
  else
37
37
  : >"$agent_kube"
38
38
  fi
39
- (cd "$folder" && KUBECONFIG="$agent_kube" DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "$(modele_ref "$m")" "$(cat "$brief")" </dev/null >>"$journal" 2>&1) &
39
+ (cd "$folder" && KUBECONFIG="$agent_kube" DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "$(model_ref "$m")" "$(cat "$brief")" </dev/null >>"$journal" 2>&1) &
40
40
  fi
41
41
  }
42
42
 
@@ -73,7 +73,7 @@ agent_workspace() {
73
73
  echo "devzone agent: Kubernetes workspace (pod devzone-workspace-0, $in_pod); --local for the container"
74
74
  agent_kc cp "$brief" "devzone-workspace-0:/tmp/devzone-agent-$name.md" -c workspace
75
75
  # shellcheck disable=SC2016 # the pod shell expands MODEL_OPT, not this one
76
- agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_ROOT="$pod_root" MODEL_OPT="$MODELE_LISTE" bash -lc 'devzone agent ${MODEL_OPT:+--modele "$MODEL_OPT"} "$1" "$2"' _ "$in_pod" "/tmp/devzone-agent-$name.md" || code=$?
76
+ agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_ROOT="$pod_root" MODEL_OPT="$MODEL_LIST" bash -lc 'devzone agent ${MODEL_OPT:+--model "$MODEL_OPT"} "$1" "$2"' _ "$in_pod" "/tmp/devzone-agent-$name.md" || code=$?
77
77
  journal="$(journal_of "$name")"
78
78
  mkdir -p "$(dirname "$journal")"
79
79
  if ! agent_kc exec devzone-workspace-0 -c workspace -- cat "$pod_root/workspace/.agents/$name.log" >>"$journal"; then
@@ -82,16 +82,16 @@ agent_workspace() {
82
82
  return "$code"
83
83
  }
84
84
 
85
- agent_aide() {
85
+ agent_help() {
86
86
  cat <<'AGENTEOF2'
87
- usage: devzone agent [--modele <m>[,<m2>…]] [--local] <folder> <brief-file>
87
+ usage: devzone agent [--model <m>[,<m2>…]] [--local] <folder> <brief-file>
88
88
  runs opencode on the brief, free models in rotation
89
- --modele: models tried first, in order, then the rotation
89
+ --model: models tried first, in order, then the rotation
90
90
  Kubernetes workspace first if it runs; --local: this container
91
91
  a /workspaces/projets/... path absent from here is a folder of the pod, without copy
92
- devzone agent etat
92
+ devzone agent state [--json]
93
93
  known sessions and excluded models
94
- devzone agent liberer [<model>|--tous]
94
+ devzone agent release [<model>|--all]
95
95
  lifts a model exclusion
96
96
  AGENTEOF2
97
97
  }
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # Drives opencode on a brief: rotation, silence at start, resume.
3
- # ia module (#221). devzone agent <folder> <brief> | etat | liberer.
3
+ # ai module (#221). devzone agent <folder> <brief> | state | release.
4
4
  # shellcheck disable=SC2034 # RACINE, FREE_MODELS, PAUSE_RANK: read by the sourced agent-*.sh
5
5
  set -euo pipefail
6
6
  # Folder of the script, symbolic links followed by hand: readlink -f does not exist
@@ -30,12 +30,12 @@ RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
30
30
  . "$ICI/agent-model.sh"
31
31
  FREE_MODELS=(big-pickle deepseek-v4.1-flash-free hy4-flash-free nemotron-3.5-super-vl-free
32
32
  nemotron-3.5-lightning-free mimo-v2.6-flash-free beam-free flint-40b-free longcat-2.5-free)
33
- # Session pod ephemere (#222)
33
+ # Ephemeral session pod (#222)
34
34
  # shellcheck source=agent-pod.sh disable=SC1091
35
35
  . "$ICI/agent-pod.sh"
36
36
  SILENCE="${DEVZONE_AGENT_SILENCE:-45}"
37
37
  FROZEN="${DEVZONE_AGENT_FROZEN:-600}"
38
- AGENT_ETAT="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
38
+ AGENT_STATE="${DEVZONE_AGENT_STATE:-$HOME/.local/state/oc-lancer}"
39
39
  # Pause between read and write of the rank (tests only): active only when
40
40
  # DEVZONE_AGENT_PAUSE_RANK is set under bats; never a pause by default.
41
41
  PAUSE_RANK=0
@@ -54,17 +54,17 @@ agent_launch() {
54
54
  [ -r "$brief" ] || refuse "brief not found: $brief (searched from $(pwd))"
55
55
  folder="$(cd "$folder" && pwd -P)"
56
56
  brief="$(cd "$(dirname "$brief")" && pwd -P)/$(basename "$brief")"
57
- # ia module required: without assistants, nothing to drive.
58
- if ! bash "$ICI/devzone" is-enabled ia >/dev/null 2>&1; then
59
- refuse "ia module disabled: devzone enable ia"
57
+ # ai module required: without assistants, nothing to drive.
58
+ if ! bash "$ICI/devzone" is-enabled ai >/dev/null 2>&1; then
59
+ refuse "ai module disabled: devzone enable ai"
60
60
  fi
61
- configurer
61
+ configure
62
62
  journal="$(journal_of "$folder")"
63
63
  export AGENT_JOURNAL="$journal"
64
- state="$AGENT_ETAT"
64
+ state="$AGENT_STATE"
65
65
  mkdir -p "$(dirname "$journal")" "$state"
66
- droits_photo "$folder"
67
- modeles_charger "$journal"
66
+ rights_snapshot "$folder"
67
+ models_load "$journal"
68
68
  local_charge
69
69
  start="$(rank_take "$state" "$journal")" || refuse "model rank locked: retry later"
70
70
  brief_current="$brief"
@@ -79,17 +79,17 @@ agent_launch() {
79
79
  printf '\n\nRESUME: a previous session was interrupted. Read git status, git diff and git log in the folder, check this work against the brief above, fix what deviates from it and finish what is missing.\n' >>"$c"
80
80
  brief_current="$c"
81
81
  }
82
- modele_ordre "$start"
82
+ model_order "$start"
83
83
  i=0
84
- while [ "$i" -lt "${#ORDRE[@]}" ]; do
85
- m="${ORDRE[$i]}"
84
+ while [ "$i" -lt "${#ORDER[@]}" ]; do
85
+ m="${ORDER[$i]}"
86
86
  if [ "$m" != "$network_for" ]; then network_for="$m"; network_n=0; fi
87
87
  if model_excluded "$m"; then
88
- modele_demande_ecart "$m" "$(modele_ecart_cause "$m")" "$journal"
88
+ model_requested_excluded "$m" "$(model_exclusion_cause "$m")" "$journal"
89
89
  i=$(( i + 1 ))
90
90
  continue
91
91
  fi
92
- modele_demande_choisi "$m" "$journal"
92
+ model_requested_chosen "$m" "$journal"
93
93
  echo "=== model opencode/$m start $(date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$journal"
94
94
  offset="$(wc -c <"$journal")"
95
95
  opencode_launch "$folder" "$m" "$brief_current" "$journal" "$state"
@@ -111,10 +111,10 @@ agent_launch() {
111
111
  pkill -P "$pid" 2>/dev/null || true
112
112
  kill "$pid" 2>/dev/null || true
113
113
  wait "$pid" 2>/dev/null || true
114
- droits_verifier "$folder"
114
+ rights_verify "$folder"
115
115
  echo "=== opencode/$m silent at start: excluded 1 h, next model" >>"$journal"
116
116
  model_exclude "$m" mute
117
- modele_demande_ecart "$m" mute "$journal"
117
+ model_requested_excluded "$m" mute "$journal"
118
118
  resume
119
119
  i=$(( i + 1 ))
120
120
  continue
@@ -137,7 +137,7 @@ agent_launch() {
137
137
  pkill -P "$pid" 2>/dev/null || true
138
138
  kill "$pid" 2>/dev/null || true
139
139
  wait "$pid" 2>/dev/null || true
140
- droits_verifier "$folder"
140
+ rights_verify "$folder"
141
141
  freeze=1
142
142
  break
143
143
  fi
@@ -152,7 +152,7 @@ agent_launch() {
152
152
  fi
153
153
  code=0
154
154
  wait "$pid" || code=$?
155
- droits_verifier "$folder"
155
+ rights_verify "$folder"
156
156
  # Only the output of this attempt counts: an error of a previous model must not
157
157
  # condemn the next one. Only its last 30 lines are read, and only when the exit
158
158
  # code is non-zero or opencode wrote its own error line: a printed "Free usage
@@ -185,7 +185,7 @@ agent_launch() {
185
185
  echo "=== opencode/$m error, no exclusion: next model" >>"$journal"
186
186
  else
187
187
  model_exclude "$m" "$cause"
188
- modele_demande_ecart "$m" "$cause" "$journal"
188
+ model_requested_excluded "$m" "$cause" "$journal"
189
189
  echo "=== opencode/$m excluded ($(cause_label "$cause"), $(exclusion_label "$cause")): next model" >>"$journal"
190
190
  fi
191
191
  resume
@@ -207,26 +207,26 @@ agent_launch() {
207
207
  }
208
208
  case "${1:-}" in
209
209
  status) agent_pod_status ;;
210
- etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-state-json.sh"; else agent_state; fi ;;
211
- liberer)
212
- [ -n "${2:-}" ] || { agent_aide >&2; exit 2; }
210
+ state) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-state-json.sh"; else agent_state; fi ;;
211
+ release)
212
+ [ -n "${2:-}" ] || { agent_help >&2; exit 2; }
213
213
  exclusion_clear "$2"
214
214
  ;;
215
- -h | --help | aide) agent_aide ;;
215
+ -h | --help | help) agent_help ;;
216
216
  "")
217
- agent_aide
217
+ agent_help
218
218
  exit 2
219
219
  ;;
220
220
  *)
221
- if [ "${1:-}" = "--modele" ]; then [ -n "${2:-}" ] || { agent_aide >&2; exit 2; }; MODELE_LISTE="$2"; shift 2; fi
221
+ if [ "${1:-}" = "--model" ]; then [ -n "${2:-}" ] || { agent_help >&2; exit 2; }; MODEL_LIST="$2"; shift 2; fi
222
222
  if [ "${1:-}" = "--pod" ]; then
223
- [ -z "$MODELE_LISTE" ] || refuse "--modele is not supported with --pod"
223
+ [ -z "$MODEL_LIST" ] || refuse "--model is not supported with --pod"
224
224
  shift
225
225
  if [ -z "${1:-}" ] || [ -z "${2:-}" ]; then
226
- agent_aide >&2
226
+ agent_help >&2
227
227
  exit 2
228
228
  fi
229
- agent_pod_lancer "$1" "$2"
229
+ agent_pod_launch "$1" "$2"
230
230
  fi
231
231
  local_mode=0
232
232
  if [ "${1:-}" = "--local" ]; then
@@ -234,7 +234,7 @@ case "${1:-}" in
234
234
  shift
235
235
  fi
236
236
  if [ "$#" -lt 2 ]; then
237
- agent_aide >&2
237
+ agent_help >&2
238
238
  exit 2
239
239
  fi
240
240
  if [ "$local_mode" = 0 ] && workspace_available; then
@@ -86,8 +86,8 @@ etat_modele() {
86
86
  # Prints "reussite tok_s" for a model, empty when it has no measurement.
87
87
  mesure_pour() {
88
88
  local nom="$1" data
89
- [ -f "$MESURES" ] || return 0
90
- data="$(cat "$MESURES" 2>/dev/null)" || return 0
89
+ [ -f "$MEASURES" ] || return 0
90
+ data="$(cat "$MEASURES" 2>/dev/null)" || return 0
91
91
  [ -n "$data" ] || return 0
92
92
  printf '%s' "$data" | jq -r --arg nom "$nom" '
93
93
  .[$nom] | if . == null then empty else "\(.reussite // 0) \(.tok_s // 0)" end
@@ -9,7 +9,7 @@
9
9
  # host-models.sh check update check of each model (delegates to host-check.sh)
10
10
  # host-models.sh rapport report (delegates to host-check.sh)
11
11
  # Default URL: http://host.docker.internal:11434, overridable with DEVZONE_OLLAMA_URL.
12
- # Measurements: DEVZONE_AI_MEASURES, else ~/.config/devzone/ia-mesures.json
12
+ # Measurements: DEVZONE_AI_MEASURES, else ~/.config/devzone/ai-measures.json
13
13
  # ({"<model>": {"reussite": 0..1, "tok_s": n, "date": "..."}}).
14
14
  # Short timeout; exits 0 and writes nothing when Ollama does not answer.
15
15
  # bash 3.2 (macOS). Code and comments in English.
@@ -18,7 +18,7 @@ set -euo pipefail
18
18
  URL="${DEVZONE_OLLAMA_URL:-http://host.docker.internal:11434}"
19
19
  URL="${URL%/}"
20
20
  FILE="$HOME/.config/opencode/config.json"
21
- MESURES="${DEVZONE_AI_MEASURES:-$HOME/.config/devzone/ia-mesures.json}"
21
+ MEASURES="${DEVZONE_AI_MEASURES:-$HOME/.config/devzone/ai-measures.json}"
22
22
 
23
23
  # True when a model is an embedding model (Ollama details.type, or a name
24
24
  # containing "embed", case-insensitive).
@@ -81,8 +81,8 @@ infos() {
81
81
  # or no detected model is measured.
82
82
  mesure_choix() {
83
83
  local liste="$1" data
84
- [ -f "$MESURES" ] || return 0
85
- data="$(cat "$MESURES" 2>/dev/null)" || return 0
84
+ [ -f "$MEASURES" ] || return 0
85
+ data="$(cat "$MEASURES" 2>/dev/null)" || return 0
86
86
  [ -n "$data" ] || return 0
87
87
  printf '%s' "$data" | jq -r --arg liste "$liste" '
88
88
  ($liste | split("\n") | map(select(length > 0))) as $d
@@ -1,7 +1,7 @@
1
1
  // Guard for opencode 2.x: blocks Docker commands in devzone (Kubernetes-first).
2
2
  // Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
3
3
  // to the agent with stderr message. Script absent or failing: nothing blocked.
4
- // The installed copy (devzone enable ia) replaces the placeholder below with
4
+ // The installed copy (devzone enable ai) replaces the placeholder below with
5
5
  // the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
6
6
  // from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
7
7
  // opencode 1.x also loads default exports with an id; without ctx.tool.hook the
@@ -1,7 +1,7 @@
1
1
  // Guard for opencode 1.x: blocks Docker commands in devzone (Kubernetes-first).
2
2
  // Each shell tool call is checked by docker-guard.sh. Exit code 2: error shown
3
3
  // to the agent with stderr message. Script absent or failing: nothing blocked.
4
- // The installed copy (devzone enable ia) replaces the placeholder below with
4
+ // The installed copy (devzone enable ai) replaces the placeholder below with
5
5
  // the script path; DEVZONE_DOCKER_GUARD overrides it. The script is resolved
6
6
  // from the plugin location itself (.devcontainer/ai/plugins -> ../docker-guard.sh).
7
7
  import { spawnSync } from "node:child_process"
@@ -2,7 +2,7 @@
2
2
  # du workspace, installé dans le cluster des services de devzone.
3
3
  # Mémoire et taille du volume : 1 Gi et 5Gi par défaut, modifiables ici.
4
4
  name=mysql
5
- description=MySQL partagé, une base par projet
5
+ description=Shared MySQL, one database per project
6
6
  image=mysql:8.4
7
7
  port=3306
8
8
  memoire=1Gi
@@ -29,7 +29,7 @@ export KUBECONFIG
29
29
  : "${ETAT:=${DEVZONE_STATE:-$HOME/.devzone.modules}}"
30
30
 
31
31
  # Safe state write (#417): lock, temporary file in the state folder, backup copy
32
- # .prec — shared by devzone, ports and ports-auto
32
+ # .prev — shared by devzone, ports and ports-auto
33
33
  # shellcheck source=SCRIPTDIR/state.sh
34
34
  # shellcheck disable=SC1091
35
35
  . "$(dirname "${BASH_SOURCE[0]}")/state.sh"
@@ -1,13 +1,15 @@
1
1
  #!/usr/bin/env bash
2
2
  # Renamed names of the devzone CLI (#695): the French names of the commands,
3
3
  # subcommands and options are no longer accepted, they are refused. Each old
4
- # name prints « ✖ « old » a été renommé : devzone new » on stderr, exits with
4
+ # name prints « ✖ « old » was renamed: devzone new » on stderr, exits with
5
5
  # code 1 and does nothing (no folder is created: « devzone stop » creates ./stop,
6
6
  # « devzone mettre-a-jour » must not create ./mettre-a-jour).
7
7
  #
8
8
  # renamed_command <name> : English name of a renamed command, or 1
9
9
  # renamed_subcommand <command> <name> : English name of a renamed subcommand, or 1
10
10
  # renamed_option <option> : English name of a renamed option, or 1
11
+ # renamed_module <name> : new name of a renamed module (argument of
12
+ # enable, disable, is-enabled, apply), or 1
11
13
  # reject_renamed <command> <args...> : refuses the first renamed name of a call
12
14
  # (command, first word that is not an
13
15
  # option, then each option); 0 if none
@@ -132,6 +134,14 @@ renamed_subcommand() {
132
134
  *) return 1 ;;
133
135
  esac
134
136
  ;;
137
+ agent)
138
+ case "$word" in
139
+ etat) echo state ;;
140
+ liberer) echo release ;;
141
+ aide) echo help ;;
142
+ *) return 1 ;;
143
+ esac
144
+ ;;
135
145
  *) return 1 ;;
136
146
  esac
137
147
  }
@@ -145,6 +155,18 @@ renamed_option() {
145
155
  --oui) echo --yes ;;
146
156
  --confirmer) echo --confirm ;;
147
157
  --contexte) echo --context ;;
158
+ --modele) echo --model ;;
159
+ --tous) echo --all ;;
160
+ --sans-reconstruire) echo --no-rebuild ;;
161
+ *) return 1 ;;
162
+ esac
163
+ }
164
+
165
+ # New name of a renamed module, or return 1. Modules are not commands: the
166
+ # message names the module only (« ia » was renamed: ai).
167
+ renamed_module() {
168
+ case "${1:-}" in
169
+ ia) echo ai ;;
148
170
  *) return 1 ;;
149
171
  esac
150
172
  }
@@ -171,7 +193,7 @@ reject_renamed() {
171
193
  case "$command" in
172
194
  copier-vers | copier-depuis) new="workspace $new" ;;
173
195
  esac
174
- printf '✖ « %s » a été renommé : devzone %s\n' "$command" "$new" >&2
196
+ printf '✖ « %s » was renamed: devzone %s\n' "$command" "$new" >&2
175
197
  return 1
176
198
  fi
177
199
  for word in "$@"; do
@@ -183,8 +205,16 @@ reject_renamed() {
183
205
  migrer | revenir | nettoyer-docker) removed_notice; return 1 ;;
184
206
  esac
185
207
  fi
208
+ case "$command" in
209
+ enable | disable | is-enabled | apply)
210
+ if new="$(renamed_module "$word")"; then
211
+ printf '✖ « %s » was renamed: %s\n' "$word" "$new" >&2
212
+ return 1
213
+ fi
214
+ ;;
215
+ esac
186
216
  if new="$(renamed_subcommand "$command" "$word")"; then
187
- printf '✖ « %s » a été renommé : devzone %s %s\n' "$word" "$command" "$new" >&2
217
+ printf '✖ « %s » was renamed: devzone %s %s\n' "$word" "$command" "$new" >&2
188
218
  return 1
189
219
  fi
190
220
  break
@@ -194,7 +224,7 @@ reject_renamed() {
194
224
  --rapatrier) removed_notice; return 1 ;;
195
225
  -*)
196
226
  if new="$(renamed_option "$word")"; then
197
- printf '✖ « %s » a été renommé : %s\n' "$word" "$new" >&2
227
+ printf '✖ « %s » was renamed: %s\n' "$word" "$new" >&2
198
228
  return 1
199
229
  fi
200
230
  ;;
@@ -28,7 +28,7 @@ VERSIONS="$ICI/../manage/scripts/ci/versions.sh"
28
28
  RACINE="${DEVZONE_ROOT:-$(dirname "$ICI")}"
29
29
  # Default state of the instance; DEVZONE_STATE takes precedence (tests, CI)
30
30
  ETAT="${DEVZONE_STATE:-$RACINE/.devzone.modules}"
31
- MODULES=(ia kubernetes gitlab postgres argocd mysql)
31
+ MODULES=(ai kubernetes gitlab postgres argocd mysql)
32
32
  # shellcheck source=SCRIPTDIR/cluster.sh
33
33
  # shellcheck disable=SC1091
34
34
  . "$ICI/cluster.sh"
@@ -136,7 +136,7 @@ case "${1:-}" in
136
136
  # may uninstall again
137
137
  state_recovery_confirm
138
138
  apply_repowarden
139
- [ "$(value_of ia)" = off ] || apply_ia on
139
+ [ "$(value_of ai)" = off ] || apply_ai on
140
140
  # gitlab, postgres, argocd: installed from the workstation in the
141
141
  # Kubernetes workspace pod (#528), by their installer elsewhere
142
142
  [ "$(value_of gitlab)" = off ] || apply_service gitlab
@@ -98,17 +98,17 @@ install_ai() {
98
98
  [ "${#IA_FAILED[@]}" -eq 0 ]
99
99
  }
100
100
 
101
- apply_ia() {
101
+ apply_ai() {
102
102
  local log tmp detected
103
103
  if [ "$1" = on ]; then
104
104
  echo "devzone : installing Claude Code and opencode (a few minutes)…"
105
105
  if ! install_ai; then
106
106
  log="$(last_npm_log)"
107
- echo "npm log: $log" >"$(failure_marker_file ia)"
107
+ echo "npm log: $log" >"$(failure_marker_file ai)"
108
108
  echo "devzone : installation of ${IA_FAILED[*]} failed (npm install -g, 3 tries); npm log: $log; retry: devzone apply" >&2
109
109
  return 1
110
110
  fi
111
- rm -f "$(failure_marker_file ia)"
111
+ rm -f "$(failure_marker_file ai)"
112
112
  echo "devzone : Claude Code and opencode installed"
113
113
  # repowarden guard (Claude Code PreToolUse hook, opencode plugin): the
114
114
  # agent is stopped before changing main/develop, committing without
@@ -151,7 +151,7 @@ apply_ia() {
151
151
  echo "devzone : ai active: claude (then /login), opencode auth login"
152
152
  else
153
153
  npm uninstall -g "${IA_NOMS[@]}" >/dev/null 2>&1 || true
154
- rm -f "$(failure_marker_file ia)"
154
+ rm -f "$(failure_marker_file ai)"
155
155
  # repowarden guard: removed on disable (symmetrical with the enable).
156
156
  # repowarden does it itself when present; otherwise removal by jq of only
157
157
  # the PreToolUse entries calling the guard, the rest of settings.json
@@ -6,7 +6,7 @@
6
6
 
7
7
  description() {
8
8
  case "$1" in
9
- ia) echo "AI assistants: Claude Code, opencode" ;;
9
+ ai) echo "AI assistants: Claude Code, opencode" ;;
10
10
  kubernetes) echo "connection to the host cluster and metrics-server at startup" ;;
11
11
  gitlab) echo "test GitLab in the services cluster" ;;
12
12
  postgres) echo "shared PostgreSQL, one database per project" ;;
@@ -8,7 +8,7 @@
8
8
  # Skill marker: the file is installed if missing, updated while it carries the
9
9
  # marker and is unchanged, kept if customised (#161, opencode rule). The marker
10
10
  # text is the one written in SKILL.md: it is kept as is.
11
- SKILL_MARKER='<!-- devzone : skill set by devzone enable ia -->'
11
+ SKILL_MARKER='<!-- devzone : skill set by devzone enable ai -->'
12
12
  # Fingerprint of the installed version, next to SKILL.md: it tells an unchanged
13
13
  # skill from a customised one that still carries the marker.
14
14
  SKILL_FINGERPRINT='.devzone-fingerprint'
@@ -1,4 +1,4 @@
1
- // devzone : default opencode configuration (devzone enable ia keeps it up to date; remove this line to customise it)
1
+ // devzone : default opencode configuration (devzone enable ai keeps it up to date; remove this line to customise it)
2
2
  {
3
3
  "$schema": "https://opencode.ai/config.json",
4
4
  // Modèles gratuits de la version d'opencode fixée par devzone.
@@ -16,7 +16,7 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
16
16
  ROOT="${DEVZONE_ROOT:-$(dirname "$HERE")}"
17
17
  LIST="${ROOT}/.devzone.packages"
18
18
  MARK="${DEVZONE_PACKAGES_MARKER:-/tmp/devzone-packages.failed}"
19
- UPDATED="${DEVZONE_PACKAGES_UPDATE:-/tmp/devzone-paquets.maj}"
19
+ UPDATED="${DEVZONE_PACKAGES_UPDATE:-/tmp/devzone-packages.updated}"
20
20
  SUDO="${DEVZONE_PACKAGES_SUDO-sudo}"
21
21
  APT="${DEVZONE_PACKAGES_APT:-apt-get}"
22
22
  APTCACHE="${DEVZONE_PACKAGES_APTCACHE:-apt-cache}"
@@ -60,6 +60,8 @@ sudo ln -sf /workspaces/devzone/.devcontainer/devzone /usr/local/bin/devzone
60
60
  # Access to the workstation cluster (hote.config) before the modules that depend
61
61
  # on it (#370); a failure does not stop the creation, the startup runs it again
62
62
  bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : kube configuration incomplete, retry: devzone start" >&2
63
+ # Former names (state key ia=) renamed before the first read of the state (#774)
64
+ bash /workspaces/devzone/.devcontainer/rename-legacy-files.sh || echo "devzone : legacy names not renamed, retry: devzone repair" >&2
63
65
  devzone apply || echo "devzone : modules incomplete (details above), retry: devzone apply" >&2
64
66
  # Guarded system packages (#351): reinstalled at each creation; a failure does not stop the creation
65
67
  devzone packages apply || echo "devzone : packages failed, retry: devzone packages" >&2