devzone 7.4.0 → 7.5.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 (48) hide show
  1. package/.devcontainer/devzone +18 -63
  2. package/.devcontainer/devzone-modules.sh +8 -3
  3. package/.devcontainer/devzone-repair.sh +7 -7
  4. package/.devcontainer/devzone-services.sh +21 -21
  5. package/.devcontainer/devzone-status.sh +12 -9
  6. package/.devcontainer/help.sh +5 -1
  7. package/.devcontainer/versions.env +8 -0
  8. package/.devcontainer/workspace-init.sh +8 -9
  9. package/.gitattributes +8 -0
  10. package/README.md +2 -2
  11. package/bin/SHA256SUMS +6 -6
  12. package/bin/devzone-darwin-amd64 +0 -0
  13. package/bin/devzone-darwin-arm64 +0 -0
  14. package/bin/devzone-linux-amd64 +0 -0
  15. package/bin/devzone-linux-arm64 +0 -0
  16. package/bin/devzone-windows-amd64.exe +0 -0
  17. package/bin/devzone-windows-arm64.exe +0 -0
  18. package/charts/devzone-mysql/values.yaml +1 -1
  19. package/charts/devzone-postgres/values.yaml +1 -1
  20. package/manage/devzone +6 -3
  21. package/manage/scripts/create-mode.sh +3 -3
  22. package/manage/scripts/uninstall.sh +4 -5
  23. package/manage/scripts/workspace/argocd-workspace.sh +2 -2
  24. package/manage/workspace.sh +1 -1
  25. package/package.json +1 -1
  26. package/.devcontainer/ai/host-check.sh +0 -173
  27. package/.devcontainer/ai/host-models.sh +0 -200
  28. package/.devcontainer/catalog/app.sh +0 -202
  29. package/.devcontainer/catalog/catalog-watcher.sh +0 -127
  30. package/.devcontainer/catalog.sh +0 -208
  31. package/.devcontainer/chart-direct.sh +0 -49
  32. package/.devcontainer/cluster.sh +0 -388
  33. package/.devcontainer/clusters.sh +0 -86
  34. package/.devcontainer/devzone-ai-guard.sh +0 -98
  35. package/.devcontainer/devzone-ai.sh +0 -201
  36. package/.devcontainer/devzone-cluster.sh +0 -209
  37. package/.devcontainer/devzone-skill.sh +0 -97
  38. package/.devcontainer/isolation.sh +0 -65
  39. package/.devcontainer/kube-account.sh +0 -107
  40. package/.devcontainer/kube-prompt.sh +0 -42
  41. package/.devcontainer/memory.sh +0 -113
  42. package/.devcontainer/metrics-server.sh +0 -100
  43. package/.devcontainer/packages.sh +0 -228
  44. package/.devcontainer/password.sh +0 -148
  45. package/.devcontainer/ports-json.sh +0 -31
  46. package/.devcontainer/ports.sh +0 -132
  47. package/manage/scripts/create-cluster.sh +0 -107
  48. package/manage/scripts/docker.sh +0 -43
@@ -1,132 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Port relays of the workstation (#290): applications reachable from
3
- # 127.0.0.1 of the workstation, kept in the state of devzone.
4
- # ports.sh list relays of the state: port, active, application
5
- # ports.sh close <n> removes the relay and the port from the state
6
- # ports.sh resume one-line summary for the devzone recap
7
- # The state is the line "ports=8080,3000" of DEVZONE_STATE (sorted, no duplicate).
8
- # ROOT: a single dirname from HERE (.devcontainer) = root of the devzone repository.
9
- if [ "${BASH_SOURCE[0]}" = "$0" ]; then set -euo pipefail; fi
10
-
11
- HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
- ROOT="${DEVZONE_ROOT:-$(dirname "$HERE")}"
13
- ETAT="${DEVZONE_STATE:-$ROOT/.devzone.modules}"
14
- INSTANCE="${DEVZONE_INSTANCE:-devzone}"
15
-
16
- # Safe state write (#417): lock, temporary file in the state folder, backup copy
17
-
18
- refuse() { echo "devzone : port : $*" >&2; exit 1; }
19
-
20
- # Application labels: the list shows them in English. The JSON output keeps its
21
- # French values (read by the tools, #557): a contract, UTF-8 written as byte escapes.
22
- APP_RESPONDS="application responds"
23
- APP_NONE="no application"
24
- # shellcheck disable=SC2034 # read by ports-json.sh (sourced)
25
- JSON_APP_RESPONDS=$'application r\303\251pond'
26
- # shellcheck disable=SC2034 # read by ports-json.sh (sourced)
27
- JSON_APP_NONE="aucune application"
28
-
29
- relay_name() { echo "devzone-$INSTANCE-port-$1"; }
30
-
31
- port_valid() { case "${1:-}" in '' | *[!0-9]*) return 1 ;; esac; [ "$1" -ge 1 ] 2>/dev/null && [ "$1" -le 65535 ] 2>/dev/null; }
32
-
33
- validate_port() { port_valid "${1:-}" || refuse "invalid port : ${1:-(none)} (1-65535)"; }
34
-
35
- read_ports() { grep -E '^ports=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true; }
36
-
37
- sort_ports() {
38
- printf '%s\n' "${1:-}" | tr ',' '\n' | awk 'NF && $0 ~ /^[0-9]+$/ { print }' | sort -n -u | paste -sd, -
39
- }
40
-
41
- # Writes the ports= line of the state (#417: never mv outside Go state command)
42
- write_ports() {
43
- DEVZONE_STATE="$ETAT" bash "$HERE/devzone" state write ports "${1:-}" || { echo "devzone : port : state not saved : $ETAT" >&2; exit 1; }
44
- }
45
-
46
- add_port() {
47
- local port="$1"
48
- write_ports "$(sort_ports "$(read_ports),$port")"
49
- }
50
-
51
- remove_port() {
52
- local port="$1" rest="" p
53
- # shellcheck disable=SC2046 # list of ports separated by commas
54
- for p in $(printf '%s' "$(read_ports)" | tr ',' ' '); do
55
- [ "$p" = "$port" ] || rest="$rest${rest:+,}$p"
56
- done
57
- write_ports "$(sort_ports "$rest")"
58
- }
59
-
60
- relay_active() {
61
- local name
62
- name="$(relay_name "$1")"
63
- command -v docker >/dev/null 2>&1 || return 1
64
- [ -n "$(docker ps --filter "name=^$name$" --format '{{.Names}}' 2>/dev/null |
65
- grep -Fx "$name" || true)" ]
66
- }
67
-
68
- close_port() {
69
- local port="${1:-}"
70
- validate_port "$port"
71
- docker rm -f "$(relay_name "$port")" >/dev/null 2>&1 || true
72
- remove_port "$port"
73
- echo "✔ relay closed: $port"
74
- }
75
-
76
- app_responds() { curl -s -o /dev/null --max-time 2 "http://127.0.0.1:$1" >/dev/null 2>&1; }
77
-
78
- list_ports() {
79
- local ports port mark app
80
- ports="$(sort_ports "$(read_ports)")"
81
- if [ -z "$ports" ]; then
82
- echo "no relay"
83
- return 0
84
- fi
85
- # shellcheck disable=SC2046 # list of ports separated by commas
86
- for port in $(printf '%s' "$ports" | tr ',' ' '); do
87
- if relay_active "$port"; then
88
- mark="● active"
89
- else
90
- mark="○ stopped"
91
- fi
92
- if app_responds "$port"; then
93
- app="$APP_RESPONDS"
94
- else
95
- app="$APP_NONE"
96
- fi
97
- printf ' %-5s %s %s\n' "$port" "$mark" "$app"
98
- done
99
- }
100
-
101
- summary() {
102
- local ports port output=""
103
- ports="$(sort_ports "$(read_ports)")"
104
- if [ -z "$ports" ]; then
105
- echo "none"
106
- return 0
107
- fi
108
- # shellcheck disable=SC2046 # list of ports separated by commas
109
- for port in $(printf '%s' "$ports" | tr ',' ' '); do
110
- if relay_active "$port"; then
111
- output="$output${output:+, }$port ●"
112
- else
113
- output="$output${output:+, }$port ○"
114
- fi
115
- done
116
- echo "$output"
117
- }
118
-
119
- # Machine-readable output of list: a JSON array [{port,active,application,auto}], jq only.
120
- # shellcheck source=SCRIPTDIR/ports-json.sh
121
- # shellcheck disable=SC1091
122
- . "$HERE/ports-json.sh"
123
- if [ "${BASH_SOURCE[0]}" = "$0" ]; then
124
- case "${1:-}" in
125
- '' | list)
126
- if [ "${2:-}" = "--json" ]; then list_json; else list_ports; fi
127
- ;;
128
- close | --close) close_port "${2:-}" ;;
129
- resume) summary ;;
130
- -h | --help) sed -n '2,8p' "$0" | sed 's/^# \{0,1\}//' ;;
131
- esac
132
- fi
@@ -1,107 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Way out of "no cluster" at creation (#653), sourced by create-mode.sh.
3
- # In a terminal, a menu: a remote cluster (a context of the kubeconfig, its name
4
- # typed back to confirm, #326) or a local minikube cluster (profile devzone).
5
- # Without a terminal nothing is asked: the caller prints the failure (no silent
6
- # fallback). devzone never runs a cloud command and never installs minikube: it
7
- # only displays the official command. DEVZONE_TERMINAL=1 forces the terminal
8
- # mode, the answers then come from stdin (tests). Sourced only. Bash 3.2.
9
-
10
- # True in a terminal (or forced for the tests).
11
- create_cluster_terminal() {
12
- [ -n "${DEVZONE_TERMINAL:-}" ] || [ -t 0 ]
13
- }
14
-
15
- # True when the context is a local cluster: never offered as a remote one.
16
- create_cluster_is_local() {
17
- local ctx="$1" server
18
- case "$ctx" in
19
- docker-desktop | desktop-* | minikube | devzone | rancher-desktop | orbstack | colima | kind-* | k3d-*) return 0 ;;
20
- esac
21
- server="$(kubectl config view --minify --context "$ctx" -o 'jsonpath={.clusters[0].cluster.server}' 2>/dev/null || true)"
22
- case "$server" in
23
- *//127.0.0.1* | *//localhost* | *//\[::1\]*) return 0 ;;
24
- esac
25
- return 1
26
- }
27
-
28
- # Remote contexts of the kubeconfig, one per line.
29
- create_cluster_remote_contexts() {
30
- local ctx
31
- kubectl config get-contexts -o name 2>/dev/null | while IFS= read -r ctx; do
32
- [ -n "$ctx" ] || continue
33
- create_cluster_is_local "$ctx" || printf '%s\n' "$ctx"
34
- done
35
- return 0
36
- }
37
-
38
- # Remote cluster: pick a context, type its name back, make it the current one.
39
- create_cluster_remote() {
40
- local list answer ctx i=0
41
- list="$(create_cluster_remote_contexts)"
42
- if [ -z "$list" ]; then
43
- echo "✖ no remote context in your kubeconfig: add one with the command of your provider (aws, gcloud, az), then run the same command again" >&2
44
- return 1
45
- fi
46
- echo "Remote contexts of your kubeconfig:"
47
- while IFS= read -r ctx; do
48
- i=$((i + 1))
49
- printf ' %s) %s (remote)\n' "$i" "$ctx"
50
- done <<<"$list"
51
- printf 'Number of the cluster (empty to cancel): '
52
- read -r answer || answer=""
53
- case "$answer" in
54
- '' | *[!0-9]*) echo "✖ cancelled" >&2; return 1 ;;
55
- esac
56
- ctx="$(printf '%s\n' "$list" | sed -n "${answer}p")"
57
- [ -n "$ctx" ] || { echo "✖ no such cluster: $answer" >&2; return 1; }
58
- echo "remote cluster: $ctx. devzone will install a pod, a volume and the namespace devzone-workspace in it: it needs enough rights and may cost."
59
- printf 'Type its name to confirm: '
60
- read -r answer || answer=""
61
- [ "$answer" = "$ctx" ] || { echo "✖ name not typed back: nothing done" >&2; return 1; }
62
- kubectl config use-context "$ctx" >/dev/null 2>&1 || { echo "✖ cannot select the context $ctx" >&2; return 1; }
63
- echo "✔ current kubectl context: $ctx"
64
- }
65
-
66
- # minikube: displays the official install command when it is missing (never
67
- # runs it); otherwise creates the profile devzone after a confirmation.
68
- create_cluster_minikube() {
69
- local answer
70
- if ! command -v minikube >/dev/null 2>&1; then
71
- echo "minikube is not installed. Official command (devzone does not run it):"
72
- case "$(uname -s)" in
73
- Darwin) echo " brew install minikube" ;;
74
- Linux) echo " curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && sudo install minikube-linux-amd64 /usr/local/bin/minikube" ;;
75
- *) echo " winget install Kubernetes.minikube" ;;
76
- esac
77
- echo "Then run the same command again."
78
- return 1
79
- fi
80
- echo "minikube: devzone will run: minikube start -p devzone (profile devzone, driver chosen by minikube)."
81
- printf 'Create it now? [y/N] '
82
- read -r answer || answer=""
83
- case "$answer" in
84
- y | Y | yes) ;;
85
- *) echo "✖ cancelled" >&2; return 1 ;;
86
- esac
87
- minikube start -p devzone || { echo "✖ minikube start failed: nothing else done" >&2; return 1; }
88
- kubectl config use-context devzone >/dev/null 2>&1 || true
89
- echo "✔ minikube cluster devzone started"
90
- }
91
-
92
- # Offers the choice in a terminal. Returns 0 when a cluster was selected or
93
- # created (the caller checks that it answers), 1 otherwise or without a terminal.
94
- create_cluster_offer() {
95
- local choice
96
- create_cluster_terminal || return 1
97
- echo "No Kubernetes cluster answers. Pick one:"
98
- echo " 1) a remote cluster (AWS, GCP, Azure, other: a context of your kubeconfig)"
99
- echo " 2) a local minikube cluster (profile devzone)"
100
- printf 'Your choice (empty to cancel): '
101
- read -r choice || choice=""
102
- case "$choice" in
103
- 1) create_cluster_remote ;;
104
- 2) create_cluster_minikube ;;
105
- *) echo "✖ cancelled" >&2; return 1 ;;
106
- esac
107
- }
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Checks Docker on the host before any call (sourced by uninstall.sh,
3
- # uninstall.sh and the npm command manage/devzone): without it the user
4
- # would only see the raw devcontainers CLI or docker error.
5
- # DEVZONE_DOCKER: docker command name (tests: simulate its absence).
6
- # Compatible with bash 3.2 (macOS).
7
-
8
- # Returns 0 if Docker responds; otherwise prints the cause (missing, no
9
- # permission, stopped) and what to do on stderr, then asks to run $1 again;
10
- # returns 1. Nothing raw on screen.
11
- docker_ready() {
12
- local command_name="$1" docker_cmd="${DEVZONE_DOCKER:-docker}" err
13
- if ! command -v "$docker_cmd" >/dev/null 2>&1; then
14
- {
15
- echo "✖ Docker not found: devzone needs it to run its container."
16
- echo " Install Docker Desktop (macOS, Windows, Linux): https://docs.docker.com/desktop/"
17
- echo " or, on Linux, Docker Engine: https://docs.docker.com/engine/install/"
18
- echo " then run $command_name again"
19
- } >&2
20
- return 1
21
- fi
22
- err="$("$docker_cmd" info 2>&1 >/dev/null)" && return 0
23
- case "$err" in
24
- *"permission denied"* | *"Permission denied"*)
25
- {
26
- echo "✖ Docker denied access: your account is not in the docker group."
27
- echo " sudo usermod -aG docker \$USER, then open a new session (or newgrp docker),"
28
- echo " then run $command_name again"
29
- } >&2
30
- ;;
31
- *)
32
- {
33
- echo "✖ Docker is installed but does not respond (stopped?)."
34
- echo " Start Docker Desktop (on Linux without Docker Desktop: sudo systemctl start docker),"
35
- echo " then run $command_name again"
36
- } >&2
37
- ;;
38
- esac
39
- return 1
40
- }
41
-
42
- # compatibility alias, removed with lot 4 (#509)
43
- docker_pret() { docker_ready "$@"; }