devzone 5.0.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.
@@ -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
@@ -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"
@@ -157,6 +157,7 @@ renamed_option() {
157
157
  --contexte) echo --context ;;
158
158
  --modele) echo --model ;;
159
159
  --tous) echo --all ;;
160
+ --sans-reconstruire) echo --no-rebuild ;;
160
161
  *) return 1 ;;
161
162
  esac
162
163
  }
@@ -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}"
@@ -2,7 +2,9 @@
2
2
  # shellcheck shell=bash
3
3
  # Renames the files and folders that devzone wrote under their former French
4
4
  # names to their English names (#733, lot 3), and the state keys plateforme= to
5
- # platform= (lot 4) and ia= to ai= (#774, lot 3). Called by the pod startup, by the workspace init, and on the
5
+ # platform= (lot 4) and ia= to ai= (#774, lot 3). #774, lot 4 adds the folders of the
6
+ # port watcher, the state backup, the AI measures file and the packages marker.
7
+ # Called by the pod startup, by the workspace init, and on the
6
8
  # workstation by devzone update and workspace update.
7
9
  # Idempotent: a name is renamed only when the old one exists and the new one
8
10
  # does not, so a second run does nothing. Two folders with both names are
@@ -93,6 +95,48 @@ migrate_root() {
93
95
  migrate_markers
94
96
  # Failure marker of the AI module, renamed with it (#774)
95
97
  rename_legacy "$ROOT/.devzone.modules-failed-ia" "$ROOT/.devzone.modules-failed-ai"
98
+ # Backup of the previous state (#774, lot 4)
99
+ rename_legacy "$ROOT/.devzone.modules.prec" "$ROOT/.devzone.modules.prev"
100
+ migrate_ports
101
+ }
102
+
103
+ # is_watcher PID: true when PID is a live port watcher (its command line names
104
+ # ports-workspace.sh), so a pid file left by a dead watcher never makes us
105
+ # signal an unrelated process that reuses the number
106
+ is_watcher() {
107
+ [ -n "${1:-}" ] || return 1
108
+ kill -0 "$1" 2>/dev/null || return 1
109
+ ps -p "$1" -o command= 2>/dev/null | grep -q 'ports-workspace\.sh'
110
+ }
111
+
112
+ # Folders of the workstation port watcher (#774, lot 4): relais/ becomes
113
+ # relays/, pris/ taken/ and verrou lock. A watcher that is running keeps the
114
+ # old folders and creates them again at each round, so it is stopped first:
115
+ # SIGTERM, and its own handler removes its relays, its lock and its pid. It is
116
+ # not restarted here (the files of the package are replaced after this
117
+ # script): devzone workspace start, or devzone workspace ports start, starts
118
+ # the new one. If it does not stop within 2 s, nothing is renamed.
119
+ migrate_ports() {
120
+ local d="$ROOT/.devzone.workspace-ports" pid
121
+ is_real_dir "$d" || return 0
122
+ [ -e "$d/relais" ] || [ -L "$d/relais" ] || [ -e "$d/pris" ] || [ -L "$d/pris" ] ||
123
+ [ -e "$d/verrou" ] || [ -L "$d/verrou" ] || return 0
124
+ pid="$(cat "$d/pid" 2>/dev/null || true)"
125
+ if is_watcher "$pid"; then
126
+ kill "$pid" 2>/dev/null || true
127
+ for _ in 1 2 3 4 5 6 7 8 9 10; do
128
+ is_watcher "$pid" || break
129
+ sleep 0.2
130
+ done
131
+ if is_watcher "$pid"; then
132
+ echo "devzone : port watcher (pid $pid) still running, $d folders kept under their old names" >&2
133
+ return 0
134
+ fi
135
+ echo "devzone : port watcher stopped to rename its folders, restart it: devzone workspace ports start"
136
+ fi
137
+ rename_legacy "$d/relais" "$d/relays"
138
+ rename_legacy "$d/pris" "$d/taken"
139
+ rename_legacy "$d/verrou" "$d/lock"
96
140
  }
97
141
 
98
142
  # Fingerprint of the devzone skill, next to its SKILL.md in each assistant folder
@@ -102,11 +146,15 @@ migrate_skills() {
102
146
  for d in "$HOME/.claude/skills/devzone" "$HOME/.config/opencode/skills/devzone"; do
103
147
  rename_legacy "$d/.devzone-empreinte" "$d/.devzone-fingerprint"
104
148
  done
149
+ # Measures of the host models (#774, lot 4); DEVZONE_AI_MEASURES points to
150
+ # a file of the user, never renamed
151
+ rename_legacy "$HOME/.config/devzone/ia-mesures.json" "$HOME/.config/devzone/ai-measures.json"
105
152
  }
106
153
 
107
154
  # Markers written in the temporary folder by the packages check
108
155
  migrate_tmp() {
109
156
  rename_legacy "$TMP_DIR/devzone-paquets.echec" "$TMP_DIR/devzone-packages.failed"
157
+ rename_legacy "$TMP_DIR/devzone-paquets.maj" "$TMP_DIR/devzone-packages.updated"
110
158
  }
111
159
 
112
160
  # Key of the state file: the line <old>=<v> becomes <new>=<v>. When a <new>=
@@ -3,7 +3,7 @@
3
3
  # or removes a line of $ETAT. A mkdir lock prevents two simultaneous writes,
4
4
  # the temporary file is created in the state folder (the mv stays atomic: the
5
5
  # file is never missing or incomplete for a reader) and a backup copy
6
- # $ETAT.prec precedes each replacement. The same file creates the state when
6
+ # $ETAT.prev precedes each replacement. The same file creates the state when
7
7
  # it is missing: former global state taken over once, backup copy restored,
8
8
  # state rebuilt from the services cluster, otherwise first installation.
9
9
  # Sourced library: the caller defines ETAT (file name kept: shared by callers).
@@ -29,7 +29,7 @@ state_abort() {
29
29
  # Backup copy of the current state, before replacement
30
30
  state_backup() {
31
31
  [ -f "$ETAT" ] || return 0
32
- cp "$ETAT" "${ETAT}.prec"
32
+ cp "$ETAT" "${ETAT}.prev"
33
33
  }
34
34
 
35
35
  # The state without the line $1, written to the temporary file $2
@@ -41,7 +41,7 @@ state_filter() {
41
41
  return 0
42
42
  }
43
43
 
44
- # Under lock: replaces the whole state with a file, $ETAT.prec backed up
44
+ # Under lock: replaces the whole state with a file, $ETAT.prev backed up
45
45
  state_replace() {
46
46
  local src="$1" tmp
47
47
  [ -f "$src" ] || return 1
@@ -191,7 +191,7 @@ state_init() {
191
191
  return 0
192
192
  fi
193
193
  # 1. Backup copy left by the last write (#417)
194
- if [ -f "${ETAT}.prec" ] && state_replace "${ETAT}.prec"; then
194
+ if [ -f "${ETAT}.prev" ] && state_replace "${ETAT}.prev"; then
195
195
  echo "devzone : state restored from the backup copy: $ETAT (confirm with devzone apply)" >&2
196
196
  state_recovery_mark
197
197
  state_lock_release
package/README.md CHANGED
@@ -225,7 +225,7 @@ cd mon-devzone
225
225
  npx devzone@latest update
226
226
  ```
227
227
 
228
- The command shows the folder's version and the package's, and does nothing if they are equal. Otherwise, it backs up the replaced or deleted files to `.devzone.backup/<date>/`, lists the locally modified files and asks for confirmation (`--yes` for a script; without a terminal, `--yes` is required), replaces the package files, removes the old trees (`core/`, `scripts/`), completes `.gitignore` without overwriting it, then proposes `make rebuild`. `--sans-reconstruire` skips this proposal; without a terminal, the rebuild is never launched.
228
+ The command shows the folder's version and the package's, and does nothing if they are equal. Otherwise, it backs up the replaced or deleted files to `.devzone.backup/<date>/`, lists the locally modified files and asks for confirmation (`--yes` for a script; without a terminal, `--yes` is required), replaces the package files, removes the old trees (`core/`, `scripts/`), completes `.gitignore` without overwriting it, then proposes `make rebuild`. `--no-rebuild` skips this proposal; without a terminal, the rebuild is never launched.
229
229
 
230
230
  `workspace/`, `.devzone.modules`, `.devzone.packages`, `.password`, `.app`, `.devzone.log` and the Docker volumes are never touched.
231
231
 
package/bin/SHA256SUMS CHANGED
@@ -1,6 +1,6 @@
1
- 72879cffd6abeeff3e2ee0eb3906553e46b39a80d19a66ed97d3b6d4a7132576 devzone-linux-amd64
2
- f0c72c92a844412de236b4d5f282df225bfb356eb3d8364b801b4bf2f41446e2 devzone-linux-arm64
3
- 05ef857ccdcce462e6b813d7be99bdde2d1c7d91ff45f91176fa9392a24ce3b8 devzone-darwin-amd64
4
- a9590a551d5233762014e0a33bf14e6976f32bcecf0e68b5b3f6f2cbb35b2774 devzone-darwin-arm64
5
- 8fb2d79ef2d433028318bbab2e9d5cb0921ab0309777e4202cb4e8b848e5da05 devzone-windows-amd64.exe
6
- 0a1d6c8b17f33ce61ccdf7bcd9a00f40cff9a77aeb09cc8e293498ac890ef4a7 devzone-windows-arm64.exe
1
+ 756592afb5d1379ce666ae3eaa32c0976552a23bb4291b8d59708d110e3666d4 devzone-linux-amd64
2
+ f55f915f65873574d660a7700c110e91d7f8465e4d49da752101c459c270a9e8 devzone-linux-arm64
3
+ d33ee662669989fb19cc2c4539e07cd8014be61719fc182f0c7351eac42a94ee devzone-darwin-amd64
4
+ dbc3bf55a5c35e49d939b4dbc115b90729100b4cfcbd315c7ca8ad777ee4921b devzone-darwin-arm64
5
+ 28dba34a40454d4d28efa494e686cf4122d99b35b9556d691e7c0ce8ac64897e devzone-windows-amd64.exe
6
+ 0567a2b01f6ef942af62422b5da6aa1e72550ca37e62b51a02e54a382dc2ba45 devzone-windows-arm64.exe
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # Update of a devzone (devzone update [--yes] [--sans-reconstruire]): replaces
2
+ # Update of a devzone (devzone update [--yes] [--no-rebuild]): replaces
3
3
  # the files of the package, backs up the replaced or removed ones, removes the
4
4
  # old layout, then offers the rebuild. Sourced by manage/devzone, after
5
5
  # devzone-manifest.sh, which provides the manifest helpers.
@@ -12,9 +12,9 @@ update_workstation() {
12
12
  for arg in "$@"; do
13
13
  case "$arg" in
14
14
  --yes) assume_yes=1 ;;
15
- --sans-reconstruire) no_rebuild=1 ;;
15
+ --no-rebuild) no_rebuild=1 ;;
16
16
  *)
17
- echo "✖ option inconnue : $arg (devzone update [--yes] [--sans-reconstruire])" >&2
17
+ echo "✖ unknown option: $arg (devzone update [--yes] [--no-rebuild])" >&2
18
18
  exit 1
19
19
  ;;
20
20
  esac
@@ -202,7 +202,7 @@ update_workstation() {
202
202
  return 0
203
203
  fi
204
204
  if [ -n "$no_rebuild" ]; then
205
- echo "Reconstruction non lancée (--sans-reconstruire)."
205
+ echo "Reconstruction non lancée (--no-rebuild)."
206
206
  return 0
207
207
  fi
208
208
  if [ ! -t 0 ]; then
@@ -140,7 +140,7 @@ pa_status() {
140
140
  for f in "$d"/apps/*; do
141
141
  [ -e "$f" ] || continue
142
142
  loc="$(cat "$f")"
143
- pw_alive "$(cat "$d/relais/$loc" 2>/dev/null)" || continue
143
+ pw_alive "$(cat "$d/relays/$loc" 2>/dev/null)" || continue
144
144
  key="$(basename "$f")"
145
145
  rest="${key#*.}"
146
146
  echo " http://127.0.0.1:$loc ${key%%.*}/${rest%%.*}:${rest#*.}"
@@ -91,16 +91,16 @@ pw_taken() {
91
91
  pw_relay() {
92
92
  local port="$1" ns="$2" target="$3" remote="${4:-$1}" d pid
93
93
  d="$(pw_dir)"
94
- pid="$(cat "$d/relais/$port" 2>/dev/null || true)"
94
+ pid="$(cat "$d/relays/$port" 2>/dev/null || true)"
95
95
  pw_alive "$pid" && return 0
96
96
  if pw_taken "$port"; then
97
- [ -e "$d/pris/$port" ] || { : >"$d/pris/$port"; echo "⚠ port $port already in use on the workstation, not relayed"; }
97
+ [ -e "$d/taken/$port" ] || { : >"$d/taken/$port"; echo "⚠ port $port already in use on the workstation, not relayed"; }
98
98
  return 0
99
99
  fi
100
100
  # shellcheck disable=SC2046
101
101
  kubectl $(pw_ctx) --namespace "$ns" port-forward --address 127.0.0.1 "$target" "$port:$remote" </dev/null >/dev/null 2>&1 &
102
- echo $! >"$d/relais/$port"
103
- rm -f "$d/pris/$port"
102
+ echo $! >"$d/relays/$port"
103
+ rm -f "$d/taken/$port"
104
104
  echo "→ port $port relayed on 127.0.0.1"
105
105
  }
106
106
 
@@ -108,16 +108,16 @@ pw_relay() {
108
108
  pw_remove() {
109
109
  local d pid
110
110
  d="$(pw_dir)"
111
- pid="$(cat "$d/relais/$1" 2>/dev/null || true)"
111
+ pid="$(cat "$d/relays/$1" 2>/dev/null || true)"
112
112
  if pw_alive "$pid"; then kill "$pid" 2>/dev/null || true; fi
113
- rm -f "$d/relais/$1" "$d/pris/$1"
113
+ rm -f "$d/relays/$1" "$d/taken/$1"
114
114
  }
115
115
 
116
116
  # One watcher round: relay new ports, remove those that disappeared.
117
117
  pw_round() {
118
118
  local d wanted="" p ns target remote l f
119
119
  d="$(pw_dir)"
120
- mkdir -p "$d/relais" "$d/pris"
120
+ mkdir -p "$d/relays" "$d/taken"
121
121
  while IFS='|' read -r p ns target remote; do
122
122
  [ -n "$p" ] || continue
123
123
  wanted="$wanted $p "
@@ -133,7 +133,7 @@ pw_round() {
133
133
  wanted="$wanted $p "
134
134
  pw_relay "$p" "$ns" "$target" "$remote"
135
135
  done <<<"$(pa_round "$wanted")"
136
- for f in "$d"/relais/* "$d"/pris/*; do
136
+ for f in "$d"/relays/* "$d"/taken/*; do
137
137
  [ -e "$f" ] || continue
138
138
  l="$(basename "$f")"
139
139
  case "$wanted" in *" $l "*) ;; *) pw_remove "$l" ;; esac
@@ -143,7 +143,7 @@ pw_round() {
143
143
  # Removes all relays from the state folder.
144
144
  pw_remove_all() {
145
145
  local f
146
- for f in "$(pw_dir)"/relais/*; do
146
+ for f in "$(pw_dir)"/relays/*; do
147
147
  if [ -e "$f" ]; then pw_remove "$(basename "$f")"; fi
148
148
  done
149
149
  }
@@ -152,7 +152,7 @@ pw_remove_all() {
152
152
  pw_loop() {
153
153
  local d
154
154
  d="$(pw_dir)"
155
- trap 'pw_remove_all; rm -rf "$d/verrou" "$d/pid"; exit 0' TERM INT
155
+ trap 'pw_remove_all; rm -rf "$d/lock" "$d/pid"; exit 0' TERM INT
156
156
  while :; do
157
157
  pw_round || true
158
158
  sleep "${DEVZONE_PORTS_WORKSPACE_STEP:-3}" &
@@ -172,8 +172,8 @@ ports_start() {
172
172
  echo "Workspace ports: watcher already running (pid $pid)"
173
173
  return 0
174
174
  fi
175
- rm -rf "$d/verrou"
176
- mkdir "$d/verrou" 2>/dev/null || return 0
175
+ rm -rf "$d/lock"
176
+ mkdir "$d/lock" 2>/dev/null || return 0
177
177
  nohup bash "${BASH_SOURCE[0]}" loop >>"$d/journal.log" 2>&1 &
178
178
  echo $! >"$d/pid"
179
179
  disown 2>/dev/null || true
@@ -190,7 +190,7 @@ ports_stop() {
190
190
  for _ in 1 2 3 4 5 6 7 8 9 10; do pw_alive "$pid" || break; sleep 0.2; done
191
191
  fi
192
192
  pw_remove_all
193
- rm -rf "$d/verrou" "$d/pid"
193
+ rm -rf "$d/lock" "$d/pid"
194
194
  }
195
195
 
196
196
  # Shows status: watcher, relayed ports, reported taken ports.
@@ -199,10 +199,10 @@ ports_status() {
199
199
  d="$(pw_dir)"
200
200
  pid="$(cat "$d/pid" 2>/dev/null || true)"
201
201
  if pw_alive "$pid"; then echo "Port watcher: running (pid $pid)"; else echo "Port watcher: stopped"; fi
202
- for f in "$d"/relais/*; do
202
+ for f in "$d"/relays/*; do
203
203
  if [ -e "$f" ] && pw_alive "$(cat "$f")"; then echo " 127.0.0.1:$(basename "$f") relayed"; fi
204
204
  done
205
- for f in "$d"/pris/*; do
205
+ for f in "$d"/taken/*; do
206
206
  if [ -e "$f" ]; then echo " ⚠ port $(basename "$f") already in use on the workstation, not relayed"; fi
207
207
  done
208
208
  pa_status
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
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": {