devzone 7.4.1 → 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.
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck shell=bash
3
- # devzone, ai module: the devzone skill of the assistants.
4
- # Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
5
- # functions only, shared variables are defined in devzone.
6
-
7
-
8
- # Skill marker: the file is installed if missing, updated while it carries the
9
- # marker and is unchanged, kept if customised (#161, opencode rule). The marker
10
- # text is the one written in SKILL.md: it is kept as is.
11
- SKILL_MARKER='<!-- devzone : skill set by devzone enable ai -->'
12
- # Fingerprint of the installed version, next to SKILL.md: it tells an unchanged
13
- # skill from a customised one that still carries the marker.
14
- SKILL_FINGERPRINT='.devzone-fingerprint'
15
-
16
- # True if the file carries the devzone marker
17
- has_skill_marker() { grep -qF -e "$SKILL_MARKER" "$1"; }
18
-
19
- # Folders of the devzone skill, in the volumes of Claude Code and opencode.
20
- skill_dirs() {
21
- echo "$HOME/.claude/skills/devzone"
22
- echo "$HOME/.config/opencode/skills/devzone"
23
- }
24
-
25
- # sha256 sum of a file (sha256sum on Linux, shasum on macOS).
26
- skill_checksum() {
27
- if command -v sha256sum >/dev/null 2>&1; then
28
- sha256sum "$1" | cut -d' ' -f1
29
- else
30
- shasum -a 256 "$1" | cut -d' ' -f1
31
- fi
32
- }
33
-
34
- # True if the target skill is still the installed one: recorded fingerprint,
35
- # or else content identical to the model.
36
- skill_unchanged() {
37
- local target="$1" fingerprint="$2" model="$3"
38
- if [ -n "$fingerprint" ]; then
39
- [ "$(skill_checksum "$target")" = "$fingerprint" ]
40
- else
41
- cmp -s "$model" "$target"
42
- fi
43
- }
44
-
45
- # Installs the devzone skill (versioned model): written if missing, updated
46
- # while it keeps the marker and the installed fingerprint, kept if customised.
47
- install_devzone_skill() {
48
- local model="$ICI/skills/devzone/SKILL.md" target d fingerprint
49
- for d in $(skill_dirs); do
50
- mkdir -p "$d"
51
- target="$d/SKILL.md"
52
- if [ ! -f "$target" ]; then
53
- cp "$model" "$target"
54
- skill_checksum "$target" >"$d/$SKILL_FINGERPRINT"
55
- echo "devzone : devzone skill installed in $d"
56
- continue
57
- fi
58
- fingerprint=""
59
- if [ -f "$d/$SKILL_FINGERPRINT" ]; then
60
- fingerprint="$(cat "$d/$SKILL_FINGERPRINT")"
61
- fi
62
- if has_skill_marker "$target" && skill_unchanged "$target" "$fingerprint" "$model"; then
63
- if ! cmp -s "$model" "$target"; then
64
- cp "$model" "$target"
65
- echo "devzone : devzone skill updated in $d"
66
- fi
67
- skill_checksum "$target" >"$d/$SKILL_FINGERPRINT"
68
- else
69
- echo "devzone : customised devzone skill in $d, kept"
70
- fi
71
- done
72
- }
73
-
74
- # Removes the devzone skill written by devzone if it still carries its marker
75
- # and was not changed; a customised skill is kept. Symmetrical with
76
- # install_devzone_skill.
77
- remove_devzone_skill() {
78
- local model target d fingerprint
79
- model="$ICI/skills/devzone/SKILL.md"
80
- for d in $(skill_dirs); do
81
- target="$d/SKILL.md"
82
- if [ ! -f "$target" ]; then
83
- rm -f "$d/$SKILL_FINGERPRINT"
84
- continue
85
- fi
86
- fingerprint=""
87
- if [ -f "$d/$SKILL_FINGERPRINT" ]; then
88
- fingerprint="$(cat "$d/$SKILL_FINGERPRINT")"
89
- fi
90
- if has_skill_marker "$target" && skill_unchanged "$target" "$fingerprint" "$model"; then
91
- rm -f "$target" "$d/$SKILL_FINGERPRINT"
92
- echo "devzone : devzone skill removed from $d"
93
- else
94
- echo "devzone : customised devzone skill in $d, kept"
95
- fi
96
- done
97
- }
@@ -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 "$@"; }