devzone 0.36.0 → 0.36.1

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.
@@ -0,0 +1,5 @@
1
+ *.password
2
+ *.env.local
3
+ root.env
4
+ sans-docker-hote/
5
+ **/.password
@@ -99,3 +99,9 @@ RUN export UV_TOOL_DIR=/opt/uv/tools UV_TOOL_BIN_DIR=/usr/local/bin \
99
99
  && uv tool install "ruff==${RUFF_VERSION}" \
100
100
  && uv tool install "vulture==${VULTURE_VERSION}" \
101
101
  && uv tool install "pytest==${PYTEST_VERSION}"
102
+
103
+ # devzone scripts inside the image: the Kubernetes workspace pod has no
104
+ # /workspaces/devzone checkout (#503). The Docker devcontainer relinks
105
+ # /usr/local/bin/devzone to the mounted repository in post-create.sh.
106
+ COPY . /usr/local/share/devzone/.devcontainer
107
+ RUN ln -sf /usr/local/share/devzone/.devcontainer/devzone /usr/local/bin/devzone
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # English command names for the devzone CLI (#502).
3
+ #
4
+ # Why: English command names are accepted now; the French names stay valid.
5
+ # Deprecation warnings come with the documentation lot (#502).
6
+ #
7
+ # command_canonical <name>: prints the current internal (French) name for an
8
+ # English name; otherwise the name unchanged (empty stays empty).
9
+
10
+ command_canonical() {
11
+ case "${1:-}" in
12
+ is-enabled) echo actif ;;
13
+ enable) echo activer ;;
14
+ disable) echo desactiver ;;
15
+ help) echo aide ;;
16
+ apply) echo appliquer ;;
17
+ catalog) echo catalogue ;;
18
+ start) echo demarrer ;;
19
+ stop) echo arreter ;;
20
+ status) echo etat ;;
21
+ passwords) echo mots-de-passe ;;
22
+ packages) echo paquets ;;
23
+ platform) echo plateforme ;;
24
+ repair) echo reparer ;;
25
+ use) echo utiliser ;;
26
+ update) echo mettre-a-jour ;;
27
+ uninstall) echo desinstaller ;;
28
+ copy-to) echo copier-vers ;;
29
+ copy-from) echo copier-depuis ;;
30
+ migrate) echo migrer ;;
31
+ revert) echo revenir ;;
32
+ clean-docker) echo nettoyer-docker ;;
33
+ *) echo "${1:-}" ;;
34
+ esac
35
+ }
@@ -55,6 +55,12 @@ MODULES=(ia kubernetes gitlab postgres argocd mysql)
55
55
  # shellcheck source=SCRIPTDIR/cluster.sh
56
56
  # shellcheck disable=SC1091
57
57
  . "$ICI/cluster.sh"
58
+ # English command names are accepted (#502); a copied devzone may miss the file
59
+ # shellcheck source=SCRIPTDIR/command-aliases.sh
60
+ # shellcheck disable=SC1091
61
+ if [ -f "$ICI/command-aliases.sh" ]; then
62
+ . "$ICI/command-aliases.sh"
63
+ fi
58
64
 
59
65
  # Assistants IA, versions figées : mettre à jour ici, puis devzone appliquer
60
66
  # (ou Rebuild Container). Une ligne par paquet, séparées par une ligne qui ne
@@ -877,13 +883,13 @@ outils_retard() {
877
883
  # Remet repowarden à la version figée s'il en diffère, comme post-create.sh
878
884
  # (il installe les hooks git globaux)
879
885
  appliquer_repowarden() {
880
- local ligne figee installee
886
+ local ligne figee installee paquet=repowarden
881
887
  [ -f "$VERSIONS" ] || return 0
882
888
  ligne="$(bash "$VERSIONS" --installees 2>/dev/null | awk '$1 == "repowarden"' || true)"
883
889
  [ -n "$ligne" ] || return 0
884
890
  read -r _ figee installee <<<"$ligne"
885
891
  echo "devzone : installation de repowarden $figee…"
886
- npm install -g "repowarden@$figee" >/dev/null
892
+ npm install -g "$paquet@$figee" >/dev/null
887
893
  repowarden install --global --lang fr
888
894
  echo "devzone : repowarden $installee → $figee"
889
895
  }
@@ -1294,6 +1300,13 @@ if [ -f "$ICI/etat-json.sh" ]; then
1294
1300
  . "$ICI/etat-json.sh"
1295
1301
  fi
1296
1302
 
1303
+ # English command name of the first argument becomes the French one (#502);
1304
+ # without any argument, nothing changes
1305
+ if [ "$#" -gt 0 ]; then
1306
+ canon="$(command_canonical "$1" 2>/dev/null)" || canon="$1"
1307
+ set -- "$canon" "${@:2}"
1308
+ fi
1309
+
1297
1310
  case "${1:-}" in
1298
1311
  "" | etat | modules) if [ "${2:-}" = "--json" ]; then etat_json; else etat; fi ;;
1299
1312
  activer) changer on "${2:-}" "${@:3}" ;;
@@ -44,10 +44,12 @@ git config --global --replace-all credential.https://github.com.helper ''
44
44
  git config --global --add credential.https://github.com.helper '!gh auth git-credential'
45
45
  git config --global url.https://github.com/.insteadOf git@github.com:
46
46
 
47
- # repowarden, version figée (il installe des hooks git globaux) ; mettre à jour
48
- # en changeant la version ici, puis Rebuild Container
47
+ # repowarden, pinned version (it installs global git hooks); update
48
+ # .devcontainer/versions.env, then Rebuild Container
49
49
  echo "devzone : installation de repowarden…"
50
- npm install -g repowarden@4.17.1
50
+ # shellcheck source=SCRIPTDIR/versions.env
51
+ . "$(dirname "${BASH_SOURCE[0]}")/versions.env"
52
+ npm install -g "repowarden@$REPOWARDEN_VERSION"
51
53
  repowarden install --global --lang fr
52
54
 
53
55
  # Modules facultatifs (assistants IA, Kubernetes) : commande devzone, état
@@ -0,0 +1,2 @@
1
+ # Single source for the repowarden version used by post-create.sh and workspace-init.sh.
2
+ REPOWARDEN_VERSION=4.17.1
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env bash
2
+ # Why: post-create.sh and demarrage.sh never run in the Kubernetes workspace
3
+ # pod (#503). This script installs the devzone tools when the container starts.
4
+ # Each step logs one "devzone init:" line, and a failure never stops the next
5
+ # step. No Docker socket is used and no kubeconfig is fabricated.
6
+ set -uo pipefail
7
+
8
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+ VERSIONS_ENV="$HERE/versions.env"
10
+ PROMPT_START="# >>> devzone prompt >>>"
11
+
12
+ log() {
13
+ echo "devzone init: $*"
14
+ }
15
+
16
+ init_safe_directory() {
17
+ local current
18
+ current="$(git config --global --get-all safe.directory 2>/dev/null || true)"
19
+ if printf '%s\n' "$current" | grep -qxF '/workspaces/projets/*'; then
20
+ log "safe.directory /workspaces/projets/* already set"
21
+ return 0
22
+ fi
23
+ if git config --global --add safe.directory '/workspaces/projets/*' 2>/dev/null; then
24
+ log "safe.directory /workspaces/projets/* added"
25
+ else
26
+ log "safe.directory: failed"
27
+ fi
28
+ }
29
+
30
+ init_repowarden() {
31
+ local installed
32
+ if [ ! -f "$VERSIONS_ENV" ]; then
33
+ log "repowarden: $VERSIONS_ENV missing"
34
+ return 0
35
+ fi
36
+ # shellcheck source=SCRIPTDIR/versions.env
37
+ . "$VERSIONS_ENV"
38
+ installed="$(repowarden --version 2>/dev/null || true)"
39
+ if [ "$installed" = "${REPOWARDEN_VERSION:-}" ]; then
40
+ log "repowarden $installed already installed"
41
+ elif npm install -g "repowarden@${REPOWARDEN_VERSION:-}" 2>&1; then
42
+ log "repowarden ${REPOWARDEN_VERSION:-} installed"
43
+ else
44
+ log "repowarden: npm install failed"
45
+ fi
46
+ if repowarden install --global --lang fr 2>&1; then
47
+ log "repowarden global hooks installed"
48
+ else
49
+ log "repowarden: install --global failed"
50
+ fi
51
+ }
52
+
53
+ init_modules() {
54
+ if devzone appliquer 2>&1; then
55
+ log "modules applied"
56
+ else
57
+ log "modules incomplete"
58
+ fi
59
+ }
60
+
61
+ init_prompt() {
62
+ local bashrc="$HOME/.bashrc"
63
+ if ! touch "$bashrc" 2>/dev/null; then
64
+ log "prompt: cannot write $bashrc"
65
+ return 0
66
+ fi
67
+ if grep -qF "$PROMPT_START" "$bashrc" 2>/dev/null; then
68
+ log "prompt block already present"
69
+ return 0
70
+ fi
71
+ cat >>"$bashrc" <<'PROMPT'
72
+ # >>> devzone prompt >>>
73
+ # shellcheck source=/dev/null
74
+ . /usr/local/share/devzone/.devcontainer/invite-kube.sh
75
+ PS1='$(devzone_invite_kube) '"$PS1"
76
+ # <<< devzone prompt <<<
77
+ PROMPT
78
+ log "prompt block added to $bashrc"
79
+ }
80
+
81
+ init_safe_directory
82
+ init_repowarden
83
+ init_modules
84
+ init_prompt
85
+ log "done"
@@ -147,6 +147,15 @@ spec:
147
147
  # Repère du workspace Kubernetes : devzone agent lance opencode ici (#431)
148
148
  - name: DEVZONE_WORKSPACE
149
149
  value: kubernetes
150
+ # Root of the devzone projects in the Kubernetes workspace (#503)
151
+ - name: DEVZONE_RACINE
152
+ value: /workspaces/projets
153
+ # Global npm prefix, stored on the mounted etat volume (#503)
154
+ - name: NPM_CONFIG_PREFIX
155
+ value: /home/vscode/.local/npm
156
+ # Image PATH plus the npm global bin, installed at startup (#503)
157
+ - name: PATH
158
+ value: /home/vscode/.local/npm/bin:/usr/local/share/nvm/current/bin:/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
150
159
  # Testcontainers et docker parlent a kubedock, et buildctl a BuildKit.
151
160
  # Ryuk est coupe : kubedock nettoie les conteneurs de test lui-meme.
152
161
  - name: DOCKER_HOST
@@ -43,9 +43,11 @@ buildkit:
43
43
  # Conteneur workspace et volume de ses projets (#399) : le PVC workspace est
44
44
  # monte sur /workspaces/projets, ou le conteneur demarre (workingDir).
45
45
  workspace:
46
- # Commande : il reste en vie (sleep infinity, comme VS Code pour un
47
- # devcontainer). Vide = commande par defaut de l'image.
48
- command: ["sleep", "infinity"]
46
+ # Command: run workspace-init.sh in the foreground first, then keep the pod
47
+ # alive with sleep infinity (like VS Code for a devcontainer) (#503). The init
48
+ # script runs before exec, its errors are ignored (|| true) and its journal is
49
+ # ~/.local/state/devzone/init.log. Empty = image default command.
50
+ command: ["bash", "-c", "mkdir -p \"$HOME/.local/state/devzone\"; bash /usr/local/share/devzone/.devcontainer/workspace-init.sh >>\"$HOME/.local/state/devzone/init.log\" 2>&1 || true; exec sleep infinity"]
49
51
  # Taille du volume des projets.
50
52
  taille: 20Gi
51
53
  storageClass: ""
@@ -75,6 +77,8 @@ persistence:
75
77
  - .m2
76
78
  - .gradle
77
79
  - .local/share/pnpm
80
+ - .local/npm
81
+ - .local/state/devzone
78
82
 
79
83
  serviceAccount:
80
84
  name: devzone-workspace
package/manage/devzone CHANGED
@@ -478,10 +478,34 @@ commande_du_conteneur() {
478
478
  demarrer | desactiver | etat | gitlab | metrics | modules | mots-de-passe | \
479
479
  mysql | paquets | plateforme | port | postgres | reparer | test-bash32 | \
480
480
  test-gitlab | utiliser) return 0 ;;
481
+ # English names of the container commands (#502)
482
+ is-enabled | enable | disable | apply | catalog | start | status | \
483
+ passwords | packages | platform | repair | use) return 0 ;;
481
484
  *) return 1 ;;
482
485
  esac
483
486
  }
484
487
 
488
+ # English command names are accepted, French ones unchanged (#502).
489
+ # A copied devzone may miss the aliases file: then no normalization.
490
+ # On the host, translate only to a known host or container command; any other
491
+ # name stays as typed (so « devzone stop » creates ./stop, not ./arreter).
492
+ # shellcheck source=SCRIPTDIR/../.devcontainer/command-aliases.sh
493
+ # shellcheck disable=SC1091
494
+ if [ -f "$PAQUET/.devcontainer/command-aliases.sh" ]; then
495
+ . "$PAQUET/.devcontainer/command-aliases.sh"
496
+ if [ "$#" -gt 0 ]; then
497
+ canon="$(command_canonical "$1")"
498
+ case "$canon" in
499
+ mettre-a-jour | desinstaller | aide | workspace) set -- "$canon" "${@:2}" ;;
500
+ *)
501
+ if commande_du_conteneur "$canon"; then
502
+ set -- "$canon" "${@:2}"
503
+ fi
504
+ ;;
505
+ esac
506
+ fi
507
+ fi
508
+
485
509
  case "${1:-}" in
486
510
  "" | -h | --help | aide) aide ;;
487
511
  -v | --version) version ;;
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bash
2
+ # CI check: the files listed in .english must be written in English (#502).
3
+ # A file fails when one of its lines contains a French accented letter or one
4
+ # of the frequent French words, whole word, case-insensitive. Each fault is
5
+ # printed as "path:line: text" and the run exits 1; otherwise it prints
6
+ # "english check: N files ok" and exits 0. A listed file that is missing is
7
+ # an error too.
8
+
9
+ set -u
10
+
11
+ ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ ROOT="$(cd "$ICI/../.." && pwd)"
13
+ LIST="$ROOT/.english"
14
+
15
+ # Byte escapes and split fragments, so this file never matches its own rules
16
+ # (a literal accented letter or whole word here would be reported).
17
+ ACCENTS="$(printf '[\303\305][\200\202\204\206\207\210\211\212\213\216\217\222\223\224\226\231\233\234\240\242\244\246\247\250\251\252\253\256\257\264\266\270\271\273\274\277]')"
18
+ WORDS="$(printf 'le_s|de_s|un_e|po_ur|av_ec|sa_ns|da_ns|fich_ier|doss_ier' | tr -d '_')"
19
+ PATTERN="$ACCENTS|\\b($WORDS)\\b"
20
+
21
+ # Byte matching only: the accents are matched as UTF-8 byte sequences
22
+ LC_ALL=C
23
+ export LC_ALL
24
+
25
+ if [ ! -f "$LIST" ]; then
26
+ echo "check-english: list not found: $LIST" >&2
27
+ exit 1
28
+ fi
29
+
30
+ fails=0
31
+ count=0
32
+ while IFS= read -r f; do
33
+ case "$f" in
34
+ '' | '#'*) continue ;;
35
+ esac
36
+ file="$ROOT/$f"
37
+ if [ ! -f "$file" ]; then
38
+ echo "check-english: file listed but missing: $f" >&2
39
+ fails=1
40
+ continue
41
+ fi
42
+ count=$((count + 1))
43
+ matches="$(grep -Ein -- "$PATTERN" "$file")" || matches=""
44
+ while IFS= read -r m; do
45
+ [ -n "$m" ] || continue
46
+ n="${m%%:*}"
47
+ printf '%s:%s: %s\n' "$f" "$n" "${m#*:}"
48
+ fails=1
49
+ done <<EOF
50
+ $matches
51
+ EOF
52
+ done <"$LIST"
53
+
54
+ if [ "$fails" -ne 0 ]; then
55
+ exit 1
56
+ fi
57
+ echo "english check: $count files ok"
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Versions figées du conteneur : compare repowarden (post-create.sh) et les
2
+ # Versions figées du conteneur : compare repowarden (versions.env) et les
3
3
  # assistants IA (lignes IA_…, devzone) à la dernière version npm, ou applique
4
4
  # une montée.
5
5
  # bash manage/scripts/versions.sh
@@ -14,15 +14,18 @@
14
14
  set -euo pipefail
15
15
 
16
16
  ICI="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
17
- POST_CREATE="$ICI/.devcontainer/post-create.sh"
17
+ VERSIONS_ENV="$ICI/.devcontainer/versions.env"
18
18
  DEVZONE="$ICI/.devcontainer/devzone"
19
19
 
20
20
  # Liste « paquet version » des versions figées dans les deux fichiers ; dans
21
21
  # devzone, une ligne IA_<NOM>=<paquet>@<version> par assistant IA
22
22
  figees() {
23
- local ligne element
24
- ligne="$(sed -nE 's/.*npm install -g (repowarden)@([^[:space:]]+).*/\1 \2/p' "$POST_CREATE" | head -1)"
25
- [ -z "$ligne" ] || echo "$ligne"
23
+ local element
24
+ if [ -f "$VERSIONS_ENV" ]; then
25
+ # shellcheck disable=SC1090
26
+ . "$VERSIONS_ENV"
27
+ [ -z "${REPOWARDEN_VERSION:-}" ] || echo "repowarden $REPOWARDEN_VERSION"
28
+ fi
26
29
  while read -r element; do
27
30
  case "$element" in
28
31
  ?*@*) echo "${element%@*} ${element##*@}" ;;
@@ -128,11 +131,11 @@ appliquer() {
128
131
  ;;
129
132
  esac
130
133
  if [ "$paquet" = repowarden ]; then
131
- fichier="$POST_CREATE"
132
- grep -qF 'npm install -g repowarden@' "$fichier" ||
134
+ fichier="$VERSIONS_ENV"
135
+ grep -qE '^REPOWARDEN_VERSION=' "$fichier" ||
133
136
  { echo "versions : paquet inconnu : $paquet" >&2; exit 1; }
134
137
  tmp="$(mktemp)"
135
- sed -E "s|(npm install -g repowarden@)[^[:space:]]+|\1${version}|" "$fichier" >"$tmp"
138
+ sed -E "s|^(REPOWARDEN_VERSION=)[^[:space:]]+$|\1${version}|" "$fichier" >"$tmp"
136
139
  else
137
140
  fichier="$DEVZONE"
138
141
  figees | awk -v p="$paquet" '$1 == p { trouve = 1 } END { exit trouve ? 0 : 1 }' ||
@@ -207,6 +207,17 @@ copier_depuis() {
207
207
  # shellcheck source=scripts/ports-workspace.sh
208
208
  . "$ICI/scripts/ports-workspace.sh"
209
209
 
210
+ # English command names are accepted, French ones unchanged (#502).
211
+ # A copied devzone may miss the aliases file: then no normalization.
212
+ # shellcheck source=../.devcontainer/command-aliases.sh
213
+ # shellcheck disable=SC1091
214
+ if [ -f "$RACINE/.devcontainer/command-aliases.sh" ]; then
215
+ . "$RACINE/.devcontainer/command-aliases.sh"
216
+ if [ "$#" -gt 0 ]; then
217
+ set -- "$(command_canonical "$1")" "${@:2}"
218
+ fi
219
+ fi
220
+
210
221
  case "${1:-}" in
211
222
  demarrer) demarrer "${@:2}" ;;
212
223
  arreter) arreter ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {