devzone 2.0.0 → 3.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 (90) hide show
  1. package/.devcontainer/agent-errors.sh +6 -6
  2. package/.devcontainer/agent-pod-manifest.sh +4 -4
  3. package/.devcontainer/agent-session.sh +2 -2
  4. package/.devcontainer/agent-state-json.sh +2 -2
  5. package/.devcontainer/agent-workspace.sh +1 -1
  6. package/.devcontainer/agent.sh +7 -7
  7. package/.devcontainer/ai/host-models.sh +2 -2
  8. package/.devcontainer/ai/plugins/devzone-guard-v2.js +3 -3
  9. package/.devcontainer/ai/plugins/devzone-guard.js +3 -3
  10. package/.devcontainer/argocd/argocd.sh +90 -89
  11. package/.devcontainer/argocd/catalog-argocd.sh +2 -2
  12. package/.devcontainer/argocd/services-hook.sh +3 -3
  13. package/.devcontainer/argocd/services.sh +1 -1
  14. package/.devcontainer/catalog/app.sh +114 -116
  15. package/.devcontainer/catalog/catalog-watcher.sh +62 -62
  16. package/.devcontainer/catalog/mysql/app.conf +1 -1
  17. package/.devcontainer/catalog/mysql/install.sh +40 -40
  18. package/.devcontainer/catalog/mysql/mysql.sh +141 -141
  19. package/.devcontainer/catalog/mysql/volume.sh +39 -39
  20. package/.devcontainer/catalog.sh +112 -112
  21. package/.devcontainer/chart-direct.sh +1 -1
  22. package/.devcontainer/cluster.sh +216 -218
  23. package/.devcontainer/clusters.sh +41 -41
  24. package/.devcontainer/devzone +92 -1495
  25. package/.devcontainer/devzone-ai-guard.sh +76 -0
  26. package/.devcontainer/devzone-ai.sh +201 -0
  27. package/.devcontainer/devzone-cluster.sh +210 -0
  28. package/.devcontainer/devzone-modules.sh +126 -0
  29. package/.devcontainer/devzone-platform.sh +189 -0
  30. package/.devcontainer/devzone-repair.sh +94 -0
  31. package/.devcontainer/devzone-services.sh +241 -0
  32. package/.devcontainer/devzone-skill.sh +97 -0
  33. package/.devcontainer/devzone-status.sh +140 -0
  34. package/.devcontainer/devzone-version.sh +78 -0
  35. package/.devcontainer/git-identity.sh +28 -0
  36. package/.devcontainer/gitlab/chart.sh +2 -2
  37. package/.devcontainer/gitlab/gitlab.sh +81 -82
  38. package/.devcontainer/gitlab/installation.sh +109 -109
  39. package/.devcontainer/gitlab/secrets.sh +47 -47
  40. package/.devcontainer/gitlab/seed.sh +77 -77
  41. package/.devcontainer/gitlab/test-gitlab.sh +242 -243
  42. package/.devcontainer/help.sh +1 -1
  43. package/.devcontainer/isolation.sh +30 -30
  44. package/.devcontainer/kind-wrapper.sh +17 -17
  45. package/.devcontainer/kube-account.sh +112 -113
  46. package/.devcontainer/kube-config.sh +45 -46
  47. package/.devcontainer/{invite-kube.sh → kube-prompt.sh} +6 -6
  48. package/.devcontainer/kube-reachable.sh +40 -40
  49. package/.devcontainer/memory.sh +1 -1
  50. package/.devcontainer/metrics-server.sh +2 -2
  51. package/.devcontainer/opencode.jsonc +2 -2
  52. package/.devcontainer/packages.sh +136 -135
  53. package/.devcontainer/password.sh +1 -1
  54. package/.devcontainer/ports-auto.sh +152 -153
  55. package/.devcontainer/ports-json.sh +16 -15
  56. package/.devcontainer/ports.sh +126 -122
  57. package/.devcontainer/post-create.sh +52 -52
  58. package/.devcontainer/postgres/postgres.sh +174 -174
  59. package/.devcontainer/rename-legacy-files.sh +103 -0
  60. package/.devcontainer/services-admin.sh +3 -3
  61. package/.devcontainer/skills/devzone/SKILL.md +40 -41
  62. package/.devcontainer/startup.sh +48 -49
  63. package/.devcontainer/state-gitops.sh +1 -1
  64. package/.devcontainer/state-json.sh +36 -62
  65. package/.devcontainer/state.sh +2 -2
  66. package/.devcontainer/workspace-init.sh +16 -2
  67. package/Makefile +1 -1
  68. package/README.md +195 -194
  69. package/charts/devzone-workspace/templates/statefulset.yaml +1 -1
  70. package/manage/devzone +5 -7
  71. package/manage/scripts/argocd-workspace.sh +1 -1
  72. package/manage/scripts/check-names.sh +6 -5
  73. package/manage/scripts/create-cluster.sh +1 -1
  74. package/manage/scripts/create-mode.sh +2 -2
  75. package/manage/scripts/devzone-create.sh +3 -3
  76. package/manage/scripts/devzone-manifest.sh +1 -1
  77. package/manage/scripts/devzone-update.sh +12 -8
  78. package/manage/scripts/launch.sh +7 -48
  79. package/manage/scripts/migrate-revert.sh +3 -3
  80. package/manage/scripts/migrate.sh +7 -13
  81. package/manage/scripts/ports-apps.sh +1 -1
  82. package/manage/scripts/ports-workspace.sh +7 -7
  83. package/manage/scripts/uninstall.sh +8 -8
  84. package/manage/scripts/workspace-egress.sh +2 -2
  85. package/manage/scripts/workspace-update.sh +5 -2
  86. package/manage/scripts/workspace-wait.sh +2 -2
  87. package/package.json +1 -1
  88. package/.devcontainer/docker-relay.sh +0 -149
  89. package/.devcontainer/docker-without-host.sh +0 -12
  90. package/.devcontainer/git-identite.sh +0 -28
@@ -1,227 +1,231 @@
1
1
  #!/usr/bin/env bash
2
- # Relais de ports (#290) : applications du conteneur devzone accessibles
3
- # depuis 127.0.0.1 du poste, un conteneur alpine/socat par port.
4
- # ports.sh open <n> ouvre le relais du port <n>
5
- # ports.sh list relais de l'état : port, actif, application
6
- # ports.sh close <n> retire le relais et le port de l'état
7
- # ports.sh restart recrée les relais de l'état vers l'IP actuelle
8
- # ports.sh resume résumé d'une ligne pour le récapitulatif devzone
9
- # L'état est la ligne « ports=8080,3000 » de DEVZONE_ETAT (triée, sans doublon).
10
- # RACINE : un seul dirname depuis ICI (.devcontainer) → racine du dépôt devzone.
2
+ # Port relays (#290): applications of the devzone container reachable from
3
+ # 127.0.0.1 of the workstation, one alpine/socat container per port.
4
+ # ports.sh open <n> opens the relay of port <n>
5
+ # ports.sh list relays of the state: port, active, application
6
+ # ports.sh close <n> removes the relay and the port from the state
7
+ # ports.sh restart recreates the relays of the state toward the current IP
8
+ # ports.sh resume one-line summary for the devzone recap
9
+ # The state is the line "ports=8080,3000" of DEVZONE_STATE (sorted, no duplicate).
10
+ # ROOT: a single dirname from HERE (.devcontainer) = root of the devzone repository.
11
11
  if [ "${BASH_SOURCE[0]}" = "$0" ]; then set -euo pipefail; fi
12
12
 
13
13
  SOCAT_IMAGE=alpine/socat:1.8.0.3
14
14
 
15
- ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
- RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
17
- ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
15
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ ROOT="${DEVZONE_ROOT:-$(dirname "$HERE")}"
17
+ ETAT="${DEVZONE_STATE:-$ROOT/.devzone.modules}"
18
18
  INSTANCE="${DEVZONE_INSTANCE:-devzone}"
19
19
 
20
- # Écriture sûre de l'état (#417) : verrou, temporaire dans l'état, .prec
20
+ # Safe state write (#417): lock, temporary file in the state folder, backup copy
21
21
  # shellcheck source=SCRIPTDIR/state.sh
22
22
  # shellcheck disable=SC1091
23
- . "$ICI/state.sh"
23
+ . "$HERE/state.sh"
24
24
 
25
25
  refuse() { echo "devzone : port : $*" >&2; exit 1; }
26
26
 
27
- # Libellés de l'application derrière un port (liste et JSON) : partagés avec
28
- # ports-auto.sh et ports-json.sh
29
- APP_REPOND="application répond"
30
- APP_AUCUNE="aucune application"
27
+ # Application labels: the list shows them in English. The JSON output keeps its
28
+ # French values (read by the tools, #557): a contract, UTF-8 written as byte escapes.
29
+ APP_RESPONDS="application responds"
30
+ APP_NONE="no application"
31
+ # shellcheck disable=SC2034 # read by ports-json.sh and ports-auto.sh (sourced)
32
+ JSON_APP_RESPONDS=$'application r\303\251pond'
33
+ # shellcheck disable=SC2034 # read by ports-json.sh and ports-auto.sh (sourced)
34
+ JSON_APP_NONE="aucune application"
31
35
 
32
- nom_relais() { echo "devzone-$INSTANCE-port-$1"; }
36
+ relay_name() { echo "devzone-$INSTANCE-port-$1"; }
33
37
 
34
- port_valide() { case "${1:-}" in '' | *[!0-9]*) return 1 ;; esac; [ "$1" -ge 1 ] 2>/dev/null && [ "$1" -le 65535 ] 2>/dev/null; }
38
+ port_valid() { case "${1:-}" in '' | *[!0-9]*) return 1 ;; esac; [ "$1" -ge 1 ] 2>/dev/null && [ "$1" -le 65535 ] 2>/dev/null; }
35
39
 
36
- valider_port() { port_valide "${1:-}" || refuse "port invalide : ${1:-(aucun)} (1-65535)"; }
40
+ validate_port() { port_valid "${1:-}" || refuse "invalid port : ${1:-(none)} (1-65535)"; }
37
41
 
38
- lire_ports() { grep -E '^ports=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true; }
42
+ read_ports() { grep -E '^ports=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true; }
39
43
 
40
- trier_ports() {
44
+ sort_ports() {
41
45
  printf '%s\n' "${1:-}" | tr ',' '\n' | awk 'NF && $0 ~ /^[0-9]+$/ { print }' | sort -n -u | paste -sd, -
42
46
  }
43
47
 
44
- # Écrit la ligne ports= de l'état (#417 : jamais de mv hors de state.sh)
45
- ecrire_ports() {
46
- state_write ports "${1:-}" || { echo "devzone : port : état non enregistré : $ETAT" >&2; exit 1; }
48
+ # Writes the ports= line of the state (#417: never mv outside state.sh)
49
+ write_ports() {
50
+ state_write ports "${1:-}" || { echo "devzone : port : state not saved : $ETAT" >&2; exit 1; }
47
51
  }
48
52
 
49
- ajouter_port() {
53
+ add_port() {
50
54
  local port="$1"
51
- ecrire_ports "$(trier_ports "$(lire_ports),$port")"
55
+ write_ports "$(sort_ports "$(read_ports),$port")"
52
56
  }
53
57
 
54
- retirer_port() {
55
- local port="$1" reste="" p
56
- # shellcheck disable=SC2046 # liste de ports séparés par des virgules
57
- for p in $(printf '%s' "$(lire_ports)" | tr ',' ' '); do
58
- [ "$p" = "$port" ] || reste="$reste${reste:+,}$p"
58
+ remove_port() {
59
+ local port="$1" rest="" p
60
+ # shellcheck disable=SC2046 # list of ports separated by commas
61
+ for p in $(printf '%s' "$(read_ports)" | tr ',' ' '); do
62
+ [ "$p" = "$port" ] || rest="$rest${rest:+,}$p"
59
63
  done
60
- ecrire_ports "$(trier_ports "$reste")"
64
+ write_ports "$(sort_ports "$rest")"
61
65
  }
62
66
 
63
- # Réseau et adresse du conteneur devzone, lus sur le Docker de l'hôte : le
64
- # relais tourne sur ce Docker et doit joindre le conteneur par son IP.
65
- reseau_ip() {
66
- local ligne
67
+ # Network and address of the devzone container, read on the host's Docker: the
68
+ # relay runs there and must reach the container by its IP.
69
+ network_ip() {
70
+ local line
67
71
  command -v docker >/dev/null 2>&1 || return 1
68
- ligne="$(docker inspect "$(hostname)" \
72
+ line="$(docker inspect "$(hostname)" \
69
73
  --format '{{range $nom, $r := .NetworkSettings.Networks}}{{$nom}} {{$r.IPAddress}}{{"\n"}}{{end}}' 2>/dev/null |
70
74
  awk 'NF >= 2 && $2 != "" { print; exit }')" || return 1
71
- [ -n "$ligne" ] || return 1
72
- RESEAU="${ligne%% *}"
73
- IP="${ligne#* }"
74
- [ -n "$RESEAU" ] && [ -n "$IP" ]
75
+ [ -n "$line" ] || return 1
76
+ NETWORK="${line%% *}"
77
+ IP="${line#* }"
78
+ [ -n "$NETWORK" ] && [ -n "$IP" ]
75
79
  }
76
80
 
77
- relais_existe() {
78
- local nom
79
- nom="$(nom_relais "$1")"
81
+ relay_exists() {
82
+ local name
83
+ name="$(relay_name "$1")"
80
84
  command -v docker >/dev/null 2>&1 || return 1
81
- [ -n "$(docker ps -a --filter "name=^$nom$" --format '{{.Names}}' 2>/dev/null |
82
- grep -Fx "$nom" || true)" ]
85
+ [ -n "$(docker ps -a --filter "name=^$name$" --format '{{.Names}}' 2>/dev/null |
86
+ grep -Fx "$name" || true)" ]
83
87
  }
84
88
 
85
- relais_actif() {
86
- local nom
87
- nom="$(nom_relais "$1")"
89
+ relay_active() {
90
+ local name
91
+ name="$(relay_name "$1")"
88
92
  command -v docker >/dev/null 2>&1 || return 1
89
- [ -n "$(docker ps --filter "name=^$nom$" --format '{{.Names}}' 2>/dev/null |
90
- grep -Fx "$nom" || true)" ]
93
+ [ -n "$(docker ps --filter "name=^$name$" --format '{{.Names}}' 2>/dev/null |
94
+ grep -Fx "$name" || true)" ]
91
95
  }
92
96
 
93
- # Lance le relais ; en cas d'échec, message clair et code 1 (l'état n'est pas
94
- # modifié par cette fonction)
95
- lancer() {
96
- local port="$1" reseau="$2" ip="$3" nom sortie
97
- nom="$(nom_relais "$port")"
98
- if sortie="$(docker run -d --restart unless-stopped \
99
- --name "$nom" \
97
+ # Launches the relay; on failure, a clear message and code 1 (this function does
98
+ # not change the state)
99
+ launch() {
100
+ local port="$1" network="$2" ip="$3" name output
101
+ name="$(relay_name "$port")"
102
+ if output="$(docker run -d --restart unless-stopped \
103
+ --name "$name" \
100
104
  --label "devzone.instance=$INSTANCE" \
101
105
  --label "devzone.port=$port" \
102
- --network "$reseau" \
106
+ --network "$network" \
103
107
  -p "127.0.0.1:$port:$port" \
104
108
  "$SOCAT_IMAGE" \
105
109
  "tcp-listen:$port,fork,reuseaddr" "tcp-connect:$ip:$port" 2>&1)"; then
106
110
  return 0
107
111
  fi
108
- case "$sortie" in
112
+ case "$output" in
109
113
  *"port is already allocated"* | *"address already in use"*)
110
- echo "devzone : port : port déjà utilisé sur le poste : $port" >&2
114
+ echo "devzone : port : port already in use on the workstation : $port" >&2
111
115
  ;;
112
116
  *)
113
- echo "devzone : port : échec du relais $port : $sortie" >&2
117
+ echo "devzone : port : relay on port $port failed : $output" >&2
114
118
  ;;
115
119
  esac
116
120
  return 1
117
121
  }
118
122
 
119
- ouvrir() {
123
+ open_port() {
120
124
  local port="${1:-}"
121
- valider_port "$port"
122
- if relais_actif "$port"; then
123
- ajouter_port "$port"
124
- echo "✔ relais déjà ouvert : 127.0.0.1:$port du poste → $port du conteneur"
125
+ validate_port "$port"
126
+ if relay_active "$port"; then
127
+ add_port "$port"
128
+ echo "✔ relay already open: 127.0.0.1:$port on the workstation → $port in the container"
125
129
  return 0
126
130
  fi
127
- reseau_ip || refuse "conteneur devzone introuvable : Docker de l'hôte injoignable ?"
128
- docker rm -f "$(nom_relais "$port")" >/dev/null 2>&1 || true
129
- lancer "$port" "$RESEAU" "$IP" || exit 1
130
- ajouter_port "$port"
131
- echo "✔ 127.0.0.1:$port du poste → $port du conteneur (relais $(nom_relais "$port"))"
131
+ network_ip || refuse "devzone container not found: host Docker unreachable?"
132
+ docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
133
+ launch "$port" "$NETWORK" "$IP" || exit 1
134
+ add_port "$port"
135
+ echo "✔ 127.0.0.1:$port on the workstation → $port in the container (relay $(relay_name "$port"))"
132
136
  }
133
137
 
134
- fermer() {
138
+ close_port() {
135
139
  local port="${1:-}"
136
- valider_port "$port"
137
- docker rm -f "$(nom_relais "$port")" >/dev/null 2>&1 || true
138
- retirer_port "$port"
139
- echo "✔ relais fermé : $port"
140
+ validate_port "$port"
141
+ docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
142
+ remove_port "$port"
143
+ echo "✔ relay closed: $port"
140
144
  }
141
145
 
142
- application_repond() { curl -s -o /dev/null --max-time 2 "http://127.0.0.1:$1" >/dev/null 2>&1; }
146
+ app_responds() { curl -s -o /dev/null --max-time 2 "http://127.0.0.1:$1" >/dev/null 2>&1; }
143
147
 
144
- liste() {
145
- local ports port marque app
146
- ports="$(trier_ports "$(lire_ports)")"
148
+ list_ports() {
149
+ local ports port mark app
150
+ ports="$(sort_ports "$(read_ports)")"
147
151
  if [ -z "$ports" ]; then
148
- echo "aucun relais (devzone port <n>)"
152
+ echo "no relay (devzone port <n>)"
149
153
  return 0
150
154
  fi
151
- # shellcheck disable=SC2046 # liste de ports séparés par des virgules
155
+ # shellcheck disable=SC2046 # list of ports separated by commas
152
156
  for port in $(printf '%s' "$ports" | tr ',' ' '); do
153
- if relais_actif "$port"; then
154
- marque="● actif"
157
+ if relay_active "$port"; then
158
+ mark="● active"
155
159
  else
156
- marque="○ arrêté"
160
+ mark="○ stopped"
157
161
  fi
158
- if application_repond "$port"; then
159
- app="$APP_REPOND"
162
+ if app_responds "$port"; then
163
+ app="$APP_RESPONDS"
160
164
  else
161
- app="$APP_AUCUNE"
165
+ app="$APP_NONE"
162
166
  fi
163
- printf ' %-5s %s %s\n' "$port" "$marque" "$app"
167
+ printf ' %-5s %s %s\n' "$port" "$mark" "$app"
164
168
  done
165
- bash "$ICI/ports-auto.sh" liste_auto 2>/dev/null || true
169
+ bash "$HERE/ports-auto.sh" list_auto 2>/dev/null || true
166
170
  }
167
171
 
168
- resume() {
169
- local ports port sortie=""
170
- ports="$(trier_ports "$(lire_ports)")"
172
+ summary() {
173
+ local ports port output=""
174
+ ports="$(sort_ports "$(read_ports)")"
171
175
  if [ -z "$ports" ]; then
172
176
  echo "none (devzone port <n>)"
173
177
  return 0
174
178
  fi
175
- # shellcheck disable=SC2046 # liste de ports séparés par des virgules
179
+ # shellcheck disable=SC2046 # list of ports separated by commas
176
180
  for port in $(printf '%s' "$ports" | tr ',' ' '); do
177
- if relais_actif "$port"; then
178
- sortie="$sortie${sortie:+, }$port ●"
181
+ if relay_active "$port"; then
182
+ output="$output${output:+, }$port ●"
179
183
  else
180
- sortie="$sortie${sortie:+, }$port ○"
184
+ output="$output${output:+, }$port ○"
181
185
  fi
182
186
  done
183
- echo "$sortie"
187
+ echo "$output"
184
188
  }
185
189
 
186
- relancer() {
190
+ restart_relays() {
187
191
  local ports port rc=0
188
- ports="$(trier_ports "$(lire_ports)")"
192
+ ports="$(sort_ports "$(read_ports)")"
189
193
  [ -n "$ports" ] || return 0
190
- if ! reseau_ip; then
191
- echo "devzone : port : relais non relancés : conteneur devzone introuvable (Docker de l'hôte injoignable ?)" >&2
194
+ if ! network_ip; then
195
+ echo "devzone : port : relays not restarted: devzone container not found (host Docker unreachable?)" >&2
192
196
  return 1
193
197
  fi
194
- # shellcheck disable=SC2046 # liste de ports séparés par des virgules
198
+ # shellcheck disable=SC2046 # list of ports separated by commas
195
199
  for port in $(printf '%s' "$ports" | tr ',' ' '); do
196
- if ! port_valide "$port"; then
197
- echo "devzone : port : port invalide dans l'état, ignoré : $port" >&2
200
+ if ! port_valid "$port"; then
201
+ echo "devzone : port : invalid port in the state, ignored: $port" >&2
198
202
  rc=1
199
203
  continue
200
204
  fi
201
- # L'IP du conteneur change à chaque démarrage : le relais est recréé
202
- docker rm -f "$(nom_relais "$port")" >/dev/null 2>&1 || true
203
- lancer "$port" "$RESEAU" "$IP" || rc=1
205
+ # The container IP changes at each start: the relay is recreated
206
+ docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
207
+ launch "$port" "$NETWORK" "$IP" || rc=1
204
208
  done
205
209
  return "$rc"
206
210
  }
207
211
 
208
- # Sortie lisible par machine de liste : tableau JSON [{port,actif,application}], via jq seul.
212
+ # Machine-readable output of list: a JSON array [{port,active,application,auto}], jq only.
209
213
  # shellcheck source=SCRIPTDIR/ports-json.sh
210
214
  # shellcheck disable=SC1091
211
- . "$ICI/ports-json.sh"
215
+ . "$HERE/ports-json.sh"
212
216
  if [ "${BASH_SOURCE[0]}" = "$0" ]; then
213
217
  case "${1:-}" in
214
218
  '' | list)
215
- if [ "${2:-}" = "--json" ]; then liste_json; else liste; fi
219
+ if [ "${2:-}" = "--json" ]; then list_json; else list_ports; fi
216
220
  ;;
217
- open) ouvrir "${2:-}" ;;
218
- close | --close) fermer "${2:-}" ;;
219
- restart) relancer ;;
220
- resume) resume ;;
221
- auto) bash "$ICI/ports-auto.sh" auto "${2:-}" "${3:-}" ;;
222
- exclude) bash "$ICI/ports-auto.sh" exclude "${2:-}" ;;
223
- include) bash "$ICI/ports-auto.sh" include "${2:-}" ;;
221
+ open) open_port "${2:-}" ;;
222
+ close | --close) close_port "${2:-}" ;;
223
+ restart) restart_relays ;;
224
+ resume) summary ;;
225
+ auto) bash "$HERE/ports-auto.sh" auto "${2:-}" "${3:-}" ;;
226
+ exclude) bash "$HERE/ports-auto.sh" exclude "${2:-}" ;;
227
+ include) bash "$HERE/ports-auto.sh" include "${2:-}" ;;
224
228
  -h | --help | aide) sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//' ;;
225
- *) ouvrir "$1" ;;
229
+ *) open_port "$1" ;;
226
230
  esac
227
231
  fi
@@ -1,42 +1,42 @@
1
1
  #!/usr/bin/env bash
2
- # Étapes qui ne peuvent pas être dans l'image (Dockerfile) :
3
- # - volumes montés au démarrage seulement
4
- # - npm fourni par la feature node, ajoutée après le Dockerfile
2
+ # Steps that cannot be in the image (Dockerfile):
3
+ # - volumes mounted at startup only
4
+ # - npm provided by the node feature, added after the Dockerfile
5
5
  set -euo pipefail
6
- # Jamais de question : le CLI devcontainer lance cette étape sous terminal,
7
- # sortie envoyée dans .devzone.log par make, donc invisible ; une question
8
- # (repowarden install propose « repowarden bots » dans un dépôt GitHub dont
9
- # gh est administrateur) attendrait indéfiniment. Entrée vide : chaque outil
10
- # passe en mode non interactif (bots : « plus tard, repowarden bots »)
6
+ # Never a question: the devcontainer CLI runs this step under a terminal, output
7
+ # sent to .devzone.log by make, so invisible; a question (repowarden install
8
+ # proposes « repowarden bots » in a GitHub repository whose gh is administrator)
9
+ # would wait forever. Empty input: each tool switches to non-interactive mode
10
+ # (bots: « later, repowarden bots »)
11
11
  exec </dev/null
12
12
 
13
- # Volumes nommés créés en root → rendre au user vscode
14
- # (et ~/.config, créé par Docker pour monter ~/.config/opencode)
13
+ # Named volumes created as root → give back to the vscode user
14
+ # (and ~/.config, created by Docker to mount ~/.config/opencode)
15
15
  sudo chown -R vscode:vscode /home/vscode/.m2 /home/vscode/.gradle /home/vscode/.local /home/vscode/.claude \
16
16
  /home/vscode/.config/opencode /home/vscode/.config/gh /home/vscode/.config/git \
17
17
  /home/vscode/.config/devzone /home/vscode/.local/state/oc-lancer
18
18
  sudo chown vscode:vscode /home/vscode/.config
19
19
 
20
- # Git : dépôts du conteneur déclarés sûrs (leur propriétaire peut différer de
21
- # l'utilisateur qui lance git : volumes, Docker Desktop, outils lancés à part),
22
- # et accès à GitHub par le jeton de gh, conservé dans son volume (https, même
23
- # pour les remotes en git@github.com:, sans clé ssh à recopier)
24
- # Réglages de la machine dans ~/.gitconfig du conteneur (recréé à chaque
25
- # rebuild) : sans ce fichier, git config --global (et repowarden install)
26
- # écriraient dans ~/.config/git/config, le volume de l'identité, où ils
27
- # s'accumuleraient d'un rebuild à l'autre
20
+ # Git: the container's repositories declared safe (their owner may differ from
21
+ # the user running git: volumes, Docker Desktop, tools run separately), and
22
+ # GitHub access by the gh token, kept in its volume (https, even for the
23
+ # git@github.com: remotes, without an ssh key to copy)
24
+ # Machine settings in the container's ~/.gitconfig (recreated at each rebuild):
25
+ # without this file, git config --global (and repowarden install) would write
26
+ # into ~/.config/git/config, the identity volume, where they would pile up from
27
+ # one rebuild to the next
28
28
  touch "$HOME/.gitconfig"
29
- # Volume touché par une version antérieure : seuls ces réglages en sont
30
- # retirés, l'identité et tout autre réglage sont conservés
29
+ # Volume touched by a previous version: only these settings are removed from it,
30
+ # the identity and any other setting are kept
31
31
  volume="$HOME/.config/git/config"
32
32
  if [ -f "$volume" ]; then
33
- retirer() { git config --file "$volume" --unset-all "$@" 2>/dev/null || true; }
34
- retirer safe.directory '^/workspaces/devzone'
35
- retirer credential.https://github.com.helper
36
- retirer url.https://github.com/.insteadOf
37
- retirer core.hooksPath 'repowarden'
38
- retirer alias.cc 'repowarden'
39
- retirer repowarden.lang
33
+ remove() { git config --file "$volume" --unset-all "$@" 2>/dev/null || true; }
34
+ remove safe.directory '^/workspaces/devzone'
35
+ remove credential.https://github.com.helper
36
+ remove url.https://github.com/.insteadOf
37
+ remove core.hooksPath 'repowarden'
38
+ remove alias.cc 'repowarden'
39
+ remove repowarden.lang
40
40
  fi
41
41
  git config --global --add safe.directory /workspaces/devzone
42
42
  git config --global --add safe.directory '/workspaces/devzone/workspace/*'
@@ -46,44 +46,44 @@ git config --global url.https://github.com/.insteadOf git@github.com:
46
46
 
47
47
  # repowarden, pinned version (it installs global git hooks); update
48
48
  # .devcontainer/versions.env, then Rebuild Container
49
- echo "devzone : installation de repowarden…"
49
+ echo "devzone : installing repowarden…"
50
50
  # shellcheck source=SCRIPTDIR/versions.env
51
51
  . "$(dirname "${BASH_SOURCE[0]}")/versions.env"
52
52
  npm install -g "repowarden@$REPOWARDEN_VERSION"
53
53
  repowarden install --global --lang fr
54
54
 
55
- # Modules facultatifs (assistants IA, Kubernetes) : commande devzone, état
56
- # gardé dans le dossier de l'instance ($RACINE/.devzone.modules) ; installe
57
- # ce qui est actif. Un module en échec n'arrête pas la création : le conteneur
58
- # reste utilisable et l'état (devzone, à chaque démarrage) le montre « en échec »
55
+ # Optional modules (AI assistants, Kubernetes): devzone command, state kept in
56
+ # the instance folder ($RACINE/.devzone.modules); installs what is enabled. A
57
+ # failing module does not stop the creation: the container stays usable and the
58
+ # state (devzone, at each startup) shows it as « in failure »
59
59
  sudo ln -sf /workspaces/devzone/.devcontainer/devzone /usr/local/bin/devzone
60
- # Accès au cluster du poste (hote.config) avant les modules qui en dépendent
61
- # (#370) ; un échec n'arrête pas la création, le démarrage la relance
62
- bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : configuration kube incomplète, réessayer : devzone start" >&2
63
- # Sans la feature docker-outside-of-docker (option docker-hote=off, #432),
64
- # docker n'est pas installé : un message clair renvoie au workspace Kubernetes
65
- if ! command -v docker >/dev/null 2>&1; then
66
- sudo install -m 0755 /workspaces/devzone/.devcontainer/docker-without-host.sh /usr/local/bin/docker
67
- fi
68
- devzone apply || echo "devzone : modules incomplets (détail ci-dessus), réessayer : devzone apply" >&2
69
- # Paquets systeme gardes (#351) : reinstallees a chaque creation ; un echec n arrete pas la creation
70
- devzone packages apply || echo "devzone : paquets en echec, reessayer : devzone packages" >&2
60
+ # Access to the workstation cluster (hote.config) before the modules that depend
61
+ # on it (#370); a failure does not stop the creation, the startup runs it again
62
+ bash /workspaces/devzone/.devcontainer/kube-config.sh || echo "devzone : kube configuration incomplete, retry: devzone start" >&2
63
+ devzone apply || echo "devzone : modules incomplete (details above), retry: devzone apply" >&2
64
+ # Guarded system packages (#351): reinstalled at each creation; a failure does not stop the creation
65
+ devzone packages apply || echo "devzone : packages failed, retry: devzone packages" >&2
71
66
 
72
- # Invite Kubernetes du shell (#337) : prefixe PS1, une seule fois
73
- if ! grep -qF 'invite-kube.sh' "$HOME/.bashrc" 2>/dev/null; then
74
- cat >>"$HOME/.bashrc" <<'INVITE'
67
+ # Kubernetes prompt of the shell (#337): prefixes PS1, only once. The check also
68
+ # accepts the block written before the rename to kube-prompt.sh (invite-kube.sh)
69
+ if grep -qE 'invite-kube\.sh|devzone_invite_kube' "$HOME/.bashrc" 2>/dev/null; then
70
+ sed -i -e 's#/\.devcontainer/invite-kube\.sh#/.devcontainer/kube-prompt.sh#' \
71
+ -e 's#devzone_invite_kube#devzone_kube_prompt#' "$HOME/.bashrc"
72
+ fi
73
+ if ! grep -qE 'kube-prompt.sh|invite-kube.sh' "$HOME/.bashrc" 2>/dev/null; then
74
+ cat >>"$HOME/.bashrc" <<'PROMPT'
75
75
  # >>> devzone invite >>>
76
76
  # shellcheck source=/dev/null
77
- . /workspaces/devzone/.devcontainer/invite-kube.sh
78
- PS1='$(devzone_invite_kube) '"$PS1"
77
+ . /workspaces/devzone/.devcontainer/kube-prompt.sh
78
+ PS1='$(devzone_kube_prompt) '"$PS1"
79
79
  # <<< devzone invite <<<
80
- INVITE
80
+ PROMPT
81
81
  fi
82
82
 
83
- # Ce qui reste à faire (identité git, GitHub, modules) : récapitulatif de
84
- # devzone, affiché à chaque démarrage (startup.sh)
83
+ # What remains to be done (git identity, GitHub, modules): devzone summary,
84
+ # displayed at each startup (startup.sh)
85
85
 
86
86
  recap="java $(java -version 2>&1 | head -1 | cut -d'"' -f2), node $(node -v), python $(python3 --version | cut -d' ' -f2), repowarden $(repowarden --version)"
87
87
  ! command -v claude >/dev/null || recap+=", claude $(claude --version | cut -d' ' -f1)"
88
88
  ! command -v opencode >/dev/null || recap+=", opencode $(opencode --version)"
89
- echo "devzone prêt : $recap"
89
+ echo "devzone up : $recap"