devzone 0.35.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.
- package/.devcontainer/.dockerignore +5 -0
- package/.devcontainer/Dockerfile +6 -0
- package/.devcontainer/agent-workspace.sh +81 -0
- package/.devcontainer/agent.sh +15 -28
- package/.devcontainer/command-aliases.sh +35 -0
- package/.devcontainer/devzone +15 -2
- package/.devcontainer/post-create.sh +5 -3
- package/.devcontainer/versions.env +2 -0
- package/.devcontainer/workspace-init.sh +85 -0
- package/charts/devzone-workspace/templates/statefulset.yaml +12 -0
- package/charts/devzone-workspace/values.yaml +7 -3
- package/manage/devzone +24 -0
- package/manage/scripts/check-english.sh +57 -0
- package/manage/scripts/versions.sh +11 -8
- package/manage/workspace.sh +11 -0
- package/package.json +1 -1
package/.devcontainer/Dockerfile
CHANGED
|
@@ -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,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pourquoi : hors du pod, devzone agent lance opencode dans le workspace
|
|
3
|
+
# Kubernetes deja demarre (projets et journaux du pod), ou localement avec
|
|
4
|
+
# --local ; le journal du pod est rapatrie dans celui du poste (#431).
|
|
5
|
+
# Bibliothèque sourcée par agent.sh : aucune commande n'est lancée ici.
|
|
6
|
+
|
|
7
|
+
# Vrai dans le conteneur workspace du cluster, qui porte le repere du chart.
|
|
8
|
+
agent_dans_pod() {
|
|
9
|
+
[ "${DEVZONE_WORKSPACE:-}" = kubernetes ]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
# kubectl du poste : contexte devzone s'il existe, puis namespace du workspace.
|
|
13
|
+
agent_kc() {
|
|
14
|
+
if kubectl config get-contexts -o name 2>/dev/null | grep -qx devzone; then
|
|
15
|
+
kubectl --context devzone --namespace devzone-workspace "$@"
|
|
16
|
+
else
|
|
17
|
+
kubectl --namespace devzone-workspace "$@"
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# Pourquoi : lancer opencode est commun à chaque tentative de modèle, et la
|
|
22
|
+
# préparation de la kubeconfig dépend du workspace Kubernetes ; ce bloc vit ici
|
|
23
|
+
# avec le reste du pod (#431), agent.sh ne garde que la boucle des modèles.
|
|
24
|
+
opencode_lancer() {
|
|
25
|
+
local dossier="$1" m="$2" consigne="$3" journal="$4" etat="$5"
|
|
26
|
+
local agent_kube="$etat/kubeconfig"
|
|
27
|
+
if agent_dans_pod; then
|
|
28
|
+
# Dans le pod, le compte de service limité est le seul accès : aucun
|
|
29
|
+
# kubeconfig du poste n'entre dans l'environnement d'opencode.
|
|
30
|
+
(cd "$dossier" && env -u KUBECONFIG DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "opencode/$m" "$(cat "$consigne")" </dev/null >>"$journal" 2>&1) &
|
|
31
|
+
else
|
|
32
|
+
if [ -f "$HOME/.kube/config" ]; then
|
|
33
|
+
(umask 077; KUBECONFIG="$HOME/.kube/config" kubectl config view --minify --flatten --context devzone >"$agent_kube") 2>/dev/null || : >"$agent_kube"
|
|
34
|
+
chmod 600 "$agent_kube"
|
|
35
|
+
[ -s "$agent_kube" ] || echo "=== kubernetes : aucun contexte devzone, session sans accès" >>"$journal"
|
|
36
|
+
else
|
|
37
|
+
: >"$agent_kube"
|
|
38
|
+
fi
|
|
39
|
+
(cd "$dossier" && KUBECONFIG="$agent_kube" DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "opencode/$m" "$(cat "$consigne")" </dev/null >>"$journal" 2>&1) &
|
|
40
|
+
fi
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
# Vrai si le pod du workspace tourne et que la commande vient du poste.
|
|
44
|
+
workspace_disponible() {
|
|
45
|
+
if agent_dans_pod; then return 1; fi
|
|
46
|
+
local phase
|
|
47
|
+
phase="$(agent_kc get pod devzone-workspace-0 -o jsonpath='{.status.phase}' --request-timeout=5s 2>/dev/null)" || return 1
|
|
48
|
+
[ "$phase" = Running ]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Lance la consigne dans le pod, puis rapatrie son journal même en échec.
|
|
52
|
+
agent_workspace() {
|
|
53
|
+
local dossier="$1" consigne="$2" nom journal code=0
|
|
54
|
+
local racine_pod=/home/vscode/.local/share/devzone
|
|
55
|
+
[ -d "$dossier" ] || refuse "dossier introuvable : $dossier (cherché depuis $(pwd))"
|
|
56
|
+
nom="$(basename "$(cd "$dossier" && pwd -P)")"
|
|
57
|
+
if ! agent_kc exec devzone-workspace-0 -c workspace -- test -d "/workspaces/projets/$nom" 2>/dev/null; then
|
|
58
|
+
refuse "projet $nom absent du workspace Kubernetes : devzone workspace copier-vers $dossier (sur la machine), ou --local"
|
|
59
|
+
fi
|
|
60
|
+
echo "devzone agent : workspace Kubernetes (pod devzone-workspace-0, /workspaces/projets/$nom) ; --local pour le conteneur"
|
|
61
|
+
agent_kc cp "$consigne" "devzone-workspace-0:/tmp/devzone-agent-$nom.md" -c workspace
|
|
62
|
+
agent_kc exec devzone-workspace-0 -c workspace -- env DEVZONE_RACINE="$racine_pod" bash -lc 'devzone agent "$1" "$2"' _ "/workspaces/projets/$nom" "/tmp/devzone-agent-$nom.md" || code=$?
|
|
63
|
+
journal="$(journal_de "$dossier")"
|
|
64
|
+
mkdir -p "$(dirname "$journal")"
|
|
65
|
+
if ! agent_kc exec devzone-workspace-0 -c workspace -- cat "$racine_pod/workspace/.agents/$nom.log" >>"$journal"; then
|
|
66
|
+
echo "=== journal du pod introuvable" >>"$journal"
|
|
67
|
+
fi
|
|
68
|
+
return "$code"
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
agent_aide() {
|
|
72
|
+
cat <<'AGENTEOF2'
|
|
73
|
+
usage : devzone agent [--local] <dossier> <fichier-consigne>
|
|
74
|
+
lance opencode sur la consigne, modèles gratuits en rotation
|
|
75
|
+
workspace Kubernetes d'abord s'il tourne ; --local : ce conteneur
|
|
76
|
+
devzone agent etat
|
|
77
|
+
sessions connues et modèles écartés
|
|
78
|
+
devzone agent liberer [<modèle>|--tous]
|
|
79
|
+
lève un écart de modèle
|
|
80
|
+
AGENTEOF2
|
|
81
|
+
}
|
package/.devcontainer/agent.sh
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
# Au premier plan ; & ou nohup pour plusieurs sessions en parallèle, une par
|
|
9
9
|
# dossier (le journal et le rang des modèles sont partagés par instance).
|
|
10
10
|
set -euo pipefail
|
|
11
|
-
|
|
12
11
|
# Dossier du script, liens symboliques suivis à la main : readlink -f n'existe
|
|
13
12
|
# pas sur macOS (tests sous bash 3.2).
|
|
14
13
|
SOURCE="${BASH_SOURCE[0]}"
|
|
@@ -23,7 +22,6 @@ done
|
|
|
23
22
|
ICI="$(cd -P "$(dirname "$SOURCE")" && pwd)"
|
|
24
23
|
# shellcheck disable=SC2034 # lue par agent-session.sh
|
|
25
24
|
RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
|
|
26
|
-
|
|
27
25
|
# Écarts de modèles et attente du réseau (#328)
|
|
28
26
|
# shellcheck source=agent-erreurs.sh
|
|
29
27
|
# shellcheck disable=SC1091
|
|
@@ -36,7 +34,10 @@ RACINE="${DEVZONE_RACINE:-$(dirname "$ICI")}"
|
|
|
36
34
|
# shellcheck source=agent-session.sh
|
|
37
35
|
# shellcheck disable=SC1091
|
|
38
36
|
. "$ICI/agent-session.sh"
|
|
39
|
-
|
|
37
|
+
# Workspace Kubernetes : projet et journal dans le pod (#431)
|
|
38
|
+
# shellcheck source=agent-workspace.sh
|
|
39
|
+
# shellcheck disable=SC1091
|
|
40
|
+
. "$ICI/agent-workspace.sh"
|
|
40
41
|
# Liste de secours si « opencode models opencode » ne répond pas : même ordre
|
|
41
42
|
# que la configuration opencode livrée par devzone.
|
|
42
43
|
FREE_MODELS=(big-pickle deepseek-v4.1-flash-free glm-5.3-flash-free nemotron-3.5-super-vl-free
|
|
@@ -50,9 +51,7 @@ PAUSE_RANG=0
|
|
|
50
51
|
if [ -n "${DEVZONE_AGENT_PAUSE_RANG:-}" ] && [ -n "${BATS_TEST_TMPDIR:-}" ]; then PAUSE_RANG="$DEVZONE_AGENT_PAUSE_RANG"; fi
|
|
51
52
|
# Relances d'une même session pour cause réseau, par modèle, avant le modèle suivant
|
|
52
53
|
RELANCES_RESEAU=3
|
|
53
|
-
|
|
54
54
|
refuse() { echo "devzone agent : $*" >&2; exit 2; }
|
|
55
|
-
|
|
56
55
|
agent_lancer() {
|
|
57
56
|
local dossier="$1" consigne="$2"
|
|
58
57
|
local journal etat debut m i pid code offset taille demarre freeze discard nouveau
|
|
@@ -85,7 +84,6 @@ agent_lancer() {
|
|
|
85
84
|
echo $(( debut + 1 )) >"$etat/rang"
|
|
86
85
|
verrou_lacher
|
|
87
86
|
echo "=== rang $(( debut + 1 ))/${#FREE_MODELS[@]}" >>"$journal"
|
|
88
|
-
|
|
89
87
|
consigne_courante="$consigne"
|
|
90
88
|
# Reprise : une session neuve repart du travail déjà présent (git status,
|
|
91
89
|
# diff, log), sans historique de conversation.
|
|
@@ -98,7 +96,6 @@ agent_lancer() {
|
|
|
98
96
|
printf '\n\nREPRISE : une session précédente a été interrompue. Lis git status, git diff et git log dans le dossier, vérifie ce travail contre la consigne ci-dessus, corrige ce qui s en écarte et termine ce qui manque.\n' >>"$c"
|
|
99
97
|
consigne_courante="$c"
|
|
100
98
|
}
|
|
101
|
-
|
|
102
99
|
i=0
|
|
103
100
|
while [ "$i" -lt "${#FREE_MODELS[@]}" ]; do
|
|
104
101
|
m="${FREE_MODELS[$(( (debut + i) % ${#FREE_MODELS[@]} ))]}"
|
|
@@ -109,15 +106,7 @@ agent_lancer() {
|
|
|
109
106
|
fi
|
|
110
107
|
echo "=== modèle opencode/$m début $(date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$journal"
|
|
111
108
|
offset="$(wc -c <"$journal")"
|
|
112
|
-
|
|
113
|
-
if [ -f "$HOME/.kube/config" ]; then
|
|
114
|
-
(umask 077; KUBECONFIG="$HOME/.kube/config" kubectl config view --minify --flatten --context devzone >"$agent_kube") 2>/dev/null || : >"$agent_kube"
|
|
115
|
-
chmod 600 "$agent_kube"
|
|
116
|
-
[ -s "$agent_kube" ] || echo "=== kubernetes : aucun contexte devzone, session sans accès" >>"$journal"
|
|
117
|
-
else
|
|
118
|
-
: >"$agent_kube"
|
|
119
|
-
fi
|
|
120
|
-
(cd "$dossier" && KUBECONFIG="$agent_kube" DEVZONE_AGENT_SESSION=1 opencode run --print-logs --log-level ERROR --auto -m "opencode/$m" "$(cat "$consigne_courante")" </dev/null >>"$journal" 2>&1) &
|
|
109
|
+
opencode_lancer "$dossier" "$m" "$consigne_courante" "$journal" "$etat"
|
|
121
110
|
pid=$!
|
|
122
111
|
demarre=0
|
|
123
112
|
discard=0
|
|
@@ -230,18 +219,6 @@ agent_lancer() {
|
|
|
230
219
|
echo "=== aucun modèle gratuit disponible" >>"$journal"
|
|
231
220
|
exit 3
|
|
232
221
|
}
|
|
233
|
-
|
|
234
|
-
agent_aide() {
|
|
235
|
-
cat <<'AGENTEOF2'
|
|
236
|
-
usage : devzone agent <dossier> <fichier-consigne>
|
|
237
|
-
lance opencode sur la consigne, modèles gratuits en rotation
|
|
238
|
-
devzone agent etat
|
|
239
|
-
sessions connues et modèles écartés
|
|
240
|
-
devzone agent liberer [<modèle>|--tous]
|
|
241
|
-
lève un écart de modèle
|
|
242
|
-
AGENTEOF2
|
|
243
|
-
}
|
|
244
|
-
|
|
245
222
|
case "${1:-}" in
|
|
246
223
|
etat) if [ "${2:-}" = "--json" ]; then exec bash "$ICI/agent-etat-json.sh"; else agent_etat; fi ;;
|
|
247
224
|
liberer)
|
|
@@ -254,10 +231,20 @@ case "${1:-}" in
|
|
|
254
231
|
exit 2
|
|
255
232
|
;;
|
|
256
233
|
*)
|
|
234
|
+
mode_local=0
|
|
235
|
+
if [ "${1:-}" = "--local" ]; then
|
|
236
|
+
mode_local=1
|
|
237
|
+
shift
|
|
238
|
+
fi
|
|
257
239
|
if [ "$#" -lt 2 ]; then
|
|
258
240
|
agent_aide >&2
|
|
259
241
|
exit 2
|
|
260
242
|
fi
|
|
243
|
+
if [ "$mode_local" = 0 ] && workspace_disponible; then
|
|
244
|
+
code=0
|
|
245
|
+
agent_workspace "$1" "$2" || code=$?
|
|
246
|
+
exit "$code"
|
|
247
|
+
fi
|
|
261
248
|
agent_lancer "$1" "$2"
|
|
262
249
|
;;
|
|
263
250
|
esac
|
|
@@ -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
|
+
}
|
package/.devcontainer/devzone
CHANGED
|
@@ -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 "
|
|
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
|
|
48
|
-
#
|
|
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
|
-
|
|
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,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"
|
|
@@ -144,6 +144,18 @@ spec:
|
|
|
144
144
|
# les chemins montes depuis le volume etat (et non dans le home de root).
|
|
145
145
|
- name: HOME
|
|
146
146
|
value: /home/vscode
|
|
147
|
+
# Repère du workspace Kubernetes : devzone agent lance opencode ici (#431)
|
|
148
|
+
- name: DEVZONE_WORKSPACE
|
|
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
|
|
147
159
|
# Testcontainers et docker parlent a kubedock, et buildctl a BuildKit.
|
|
148
160
|
# Ryuk est coupe : kubedock nettoie les conteneurs de test lui-meme.
|
|
149
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
|
-
#
|
|
47
|
-
#
|
|
48
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
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="$
|
|
132
|
-
grep -
|
|
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
|
|
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 }' ||
|
package/manage/workspace.sh
CHANGED
|
@@ -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 ;;
|