devzone 7.4.1 → 7.5.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/devzone +18 -60
- package/.devcontainer/devzone-modules.sh +8 -3
- package/.devcontainer/devzone-services.sh +20 -20
- package/.devcontainer/devzone-status.sh +14 -11
- package/.devcontainer/services-admin.sh +1 -1
- package/.devcontainer/versions.env +5 -0
- package/README.md +2 -2
- package/bin/SHA256SUMS +6 -6
- package/bin/devzone-darwin-amd64 +0 -0
- package/bin/devzone-darwin-arm64 +0 -0
- package/bin/devzone-linux-amd64 +0 -0
- package/bin/devzone-linux-arm64 +0 -0
- package/bin/devzone-windows-amd64.exe +0 -0
- package/bin/devzone-windows-arm64.exe +0 -0
- package/manage/devzone +8 -7
- package/manage/scripts/create-mode.sh +3 -3
- package/manage/scripts/uninstall.sh +3 -4
- package/manage/scripts/workspace/argocd-services.sh +1 -1
- package/manage/workspace.sh +11 -25
- package/package.json +1 -1
- package/.devcontainer/ai/host-check.sh +0 -173
- package/.devcontainer/ai/host-models.sh +0 -200
- package/.devcontainer/devzone-ai-guard.sh +0 -98
- package/.devcontainer/devzone-ai.sh +0 -201
- package/.devcontainer/devzone-repair.sh +0 -85
- package/.devcontainer/devzone-skill.sh +0 -97
- package/.devcontainer/devzone-version.sh +0 -78
- package/.devcontainer/help.sh +0 -44
- package/manage/scripts/create-cluster.sh +0 -107
- package/manage/scripts/devzone-update.sh +0 -237
- package/manage/scripts/docker.sh +0 -43
- package/manage/scripts/workspace/ports-apps.sh +0 -156
- package/manage/scripts/workspace/ports-workspace.sh +0 -235
- package/manage/scripts/workspace/services-workspace.sh +0 -193
- package/manage/scripts/workspace/workspace-clone.sh +0 -12
- package/manage/scripts/workspace/workspace-copies.sh +0 -44
- package/manage/scripts/workspace/workspace-egress.sh +0 -184
- package/manage/scripts/workspace/workspace-update.sh +0 -106
- package/manage/scripts/workspace/workspace-wait.sh +0 -56
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, ai module: opencode config, assistants install, apply.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Marker of the default configuration: first line of opencode.jsonc. The former
|
|
8
|
-
# wording (French, before #722) is still recognised. Byte escapes keep the accent
|
|
9
|
-
# out of the source (English code check).
|
|
10
|
-
OPENCODE_MARKER='// devzone : default opencode configuration'
|
|
11
|
-
|
|
12
|
-
# True if the file carries the default-configuration marker
|
|
13
|
-
opencode_marked() { grep -qF -e "$OPENCODE_MARKER" "$1"; }
|
|
14
|
-
|
|
15
|
-
# Default opencode configuration (versioned model): written at first use,
|
|
16
|
-
# updated while it keeps the devzone marker, customised otherwise. The marker
|
|
17
|
-
# text is written in opencode.jsonc: it is kept as is.
|
|
18
|
-
opencode_config() {
|
|
19
|
-
local model="$ICI/opencode.jsonc" target
|
|
20
|
-
if [ -f "$HOME/.config/opencode/opencode.jsonc" ]; then
|
|
21
|
-
target="$HOME/.config/opencode/opencode.jsonc"
|
|
22
|
-
elif [ -f "$HOME/.config/opencode/opencode.json" ]; then
|
|
23
|
-
target="$HOME/.config/opencode/opencode.json"
|
|
24
|
-
else
|
|
25
|
-
target="$HOME/.config/opencode/opencode.jsonc"
|
|
26
|
-
fi
|
|
27
|
-
mkdir -p "$(dirname "$target")"
|
|
28
|
-
if [ ! -f "$target" ]; then
|
|
29
|
-
cp "$model" "$target"
|
|
30
|
-
echo "opencode : default configuration written"
|
|
31
|
-
elif opencode_marked "$target"; then
|
|
32
|
-
if ! cmp -s "$model" "$target"; then
|
|
33
|
-
cp "$model" "$target"
|
|
34
|
-
echo "opencode : default configuration updated"
|
|
35
|
-
fi
|
|
36
|
-
elif only_schema_key "$target"; then
|
|
37
|
-
cp "$model" "$target"
|
|
38
|
-
echo "opencode : default configuration updated"
|
|
39
|
-
else
|
|
40
|
-
echo "opencode : custom configuration, kept"
|
|
41
|
-
fi
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
# Removes the opencode configuration written by devzone if it still carries its
|
|
45
|
-
# marker and was not changed; a custom configuration (no marker, or changed) is
|
|
46
|
-
# kept. Symmetrical with opencode_config.
|
|
47
|
-
remove_opencode_config() {
|
|
48
|
-
local model target
|
|
49
|
-
model="$ICI/opencode.jsonc"
|
|
50
|
-
if [ -f "$HOME/.config/opencode/opencode.jsonc" ]; then
|
|
51
|
-
target="$HOME/.config/opencode/opencode.jsonc"
|
|
52
|
-
elif [ -f "$HOME/.config/opencode/opencode.json" ]; then
|
|
53
|
-
target="$HOME/.config/opencode/opencode.json"
|
|
54
|
-
else
|
|
55
|
-
return 0
|
|
56
|
-
fi
|
|
57
|
-
if opencode_marked "$target" && cmp -s "$model" "$target"; then
|
|
58
|
-
rm -f "$target"
|
|
59
|
-
echo "opencode : default configuration removed"
|
|
60
|
-
else
|
|
61
|
-
echo "opencode : custom configuration, kept"
|
|
62
|
-
fi
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
# Log of the last npm run (its path is to give on failure), or its folder;
|
|
66
|
-
# timestamped names: the last one in glob order is the most recent
|
|
67
|
-
last_npm_log() {
|
|
68
|
-
local log="" f
|
|
69
|
-
for f in "$HOME"/.npm/_logs/*-debug-0.log; do
|
|
70
|
-
if [ -f "$f" ]; then log="$f"; fi
|
|
71
|
-
done
|
|
72
|
-
echo "${log:-$HOME/.npm/_logs}"
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
# Installs each pinned AI assistant with its own npm command (3 tries each),
|
|
76
|
-
# then checks its binary: npm silently drops a platform binary it failed to
|
|
77
|
-
# download (#194), and one assistant failing must not block the other.
|
|
78
|
-
install_ai() {
|
|
79
|
-
local package binary attempt
|
|
80
|
-
IA_FAILED=()
|
|
81
|
-
for package in "${IA_PAQUETS[@]}"; do
|
|
82
|
-
case "$package" in
|
|
83
|
-
opencode-ai@*) binary=opencode ;;
|
|
84
|
-
*) binary=claude ;;
|
|
85
|
-
esac
|
|
86
|
-
for attempt in 1 2 3; do
|
|
87
|
-
if with_progress npm install -g --no-fund --no-audit --loglevel=error "$package" >/dev/null &&
|
|
88
|
-
"$binary" --version >/dev/null 2>&1; then
|
|
89
|
-
break
|
|
90
|
-
fi
|
|
91
|
-
if [ "$attempt" -lt 3 ]; then
|
|
92
|
-
echo "devzone : installation of ${package%@*} incomplete, retrying ($((attempt + 1))/3)…" >&2
|
|
93
|
-
else
|
|
94
|
-
IA_FAILED+=("$package")
|
|
95
|
-
fi
|
|
96
|
-
done
|
|
97
|
-
done
|
|
98
|
-
[ "${#IA_FAILED[@]}" -eq 0 ]
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
apply_ai() {
|
|
102
|
-
local log tmp detected
|
|
103
|
-
if [ "$1" = on ]; then
|
|
104
|
-
echo "devzone : installing Claude Code and opencode (a few minutes)…"
|
|
105
|
-
if ! install_ai; then
|
|
106
|
-
log="$(last_npm_log)"
|
|
107
|
-
echo "npm log: $log" >"$(failure_marker_file ai)"
|
|
108
|
-
echo "devzone : installation of ${IA_FAILED[*]} failed (npm install -g, 3 tries); npm log: $log; retry: devzone apply" >&2
|
|
109
|
-
return 1
|
|
110
|
-
fi
|
|
111
|
-
rm -f "$(failure_marker_file ai)"
|
|
112
|
-
echo "devzone : Claude Code and opencode installed"
|
|
113
|
-
# repowarden guard (Claude Code PreToolUse hook, opencode plugin): the
|
|
114
|
-
# agent is stopped before changing main/develop, committing without
|
|
115
|
-
# repowarden cc, or bypassing the hooks. Global, in the ~/.claude and
|
|
116
|
-
# ~/.config/opencode volumes: kept across rebuilds; rerun, nothing changes
|
|
117
|
-
if command -v repowarden >/dev/null 2>&1 && repowarden agents init --global >/dev/null 2>&1; then
|
|
118
|
-
echo "devzone : repowarden guard active for Claude Code and opencode"
|
|
119
|
-
else
|
|
120
|
-
echo "devzone : repowarden guard not connected (repowarden 4.10 or later required): repowarden agents init --global" >&2
|
|
121
|
-
fi
|
|
122
|
-
install_docker_guard
|
|
123
|
-
opencode_config
|
|
124
|
-
# Remove the provider of the removed llm module from old configs (#669).
|
|
125
|
-
if [ -f "$HOME/.config/opencode/config.json" ] && command -v jq >/dev/null 2>&1; then
|
|
126
|
-
tmp="$(mktemp)"
|
|
127
|
-
if jq '
|
|
128
|
-
if .provider then del(.provider["devzone-llm"]) | (if .provider == {} then del(.provider) else . end) else . end
|
|
129
|
-
' "$HOME/.config/opencode/config.json" >"$tmp" 2>/dev/null; then
|
|
130
|
-
if [ "$(cat "$tmp")" = "{}" ] || [ "$(jq -c 'del(."$schema") | length' "$tmp" 2>/dev/null)" = 0 ]; then
|
|
131
|
-
rm -f "$tmp" "$HOME/.config/opencode/config.json"
|
|
132
|
-
else
|
|
133
|
-
mv "$tmp" "$HOME/.config/opencode/config.json"
|
|
134
|
-
fi
|
|
135
|
-
else
|
|
136
|
-
rm -f "$tmp"
|
|
137
|
-
fi
|
|
138
|
-
fi
|
|
139
|
-
# opencode provider of the host models (Ollama), live detection:
|
|
140
|
-
# silent and without effect if Ollama does not answer.
|
|
141
|
-
set_provider || true
|
|
142
|
-
# Reports the state of the detection (success in both cases).
|
|
143
|
-
detected="$(modeles 2>/dev/null || true)"
|
|
144
|
-
if [ -n "$detected" ]; then
|
|
145
|
-
printf "devzone : %s model(s) of the host (Ollama) connected\n" "$(printf '%s\n' "$detected" | grep -c .)"
|
|
146
|
-
else
|
|
147
|
-
printf "devzone : no Ollama model detected on %s (host models not connected)\n" "$URL"
|
|
148
|
-
fi
|
|
149
|
-
# devzone skill: installed if missing, updated if unchanged, kept if customised.
|
|
150
|
-
install_devzone_skill
|
|
151
|
-
echo "devzone : ai active: claude (then /login), opencode auth login"
|
|
152
|
-
else
|
|
153
|
-
npm uninstall -g "${IA_NOMS[@]}" >/dev/null 2>&1 || true
|
|
154
|
-
rm -f "$(failure_marker_file ai)"
|
|
155
|
-
# repowarden guard: removed on disable (symmetrical with the enable).
|
|
156
|
-
# repowarden does it itself when present; otherwise removal by jq of only
|
|
157
|
-
# the PreToolUse entries calling the guard, the rest of settings.json
|
|
158
|
-
# intact. The guard is called " repowarden guard " since repowarden
|
|
159
|
-
# 4.17.3; " repowarden garde " is its old name, still an alias on the
|
|
160
|
-
# repowarden side and recognised here.
|
|
161
|
-
if command -v repowarden >/dev/null 2>&1; then
|
|
162
|
-
repowarden agents retirer --global >/dev/null 2>&1 || true
|
|
163
|
-
elif [ -f "$HOME/.claude/settings.json" ]; then
|
|
164
|
-
tmp="$(mktemp)"
|
|
165
|
-
if jq '
|
|
166
|
-
if (.hooks.PreToolUse // null) != null then
|
|
167
|
-
.hooks.PreToolUse = [
|
|
168
|
-
.hooks.PreToolUse[] |
|
|
169
|
-
if (.hooks // null) != null then
|
|
170
|
-
.hooks = [ .hooks[] | select(((.command // "") | (contains("repowarden garde") or contains("repowarden guard"))) | not) ] |
|
|
171
|
-
select((.hooks | length) > 0)
|
|
172
|
-
else
|
|
173
|
-
select(((.command // "") | (contains("repowarden garde") or contains("repowarden guard"))) | not)
|
|
174
|
-
end
|
|
175
|
-
] |
|
|
176
|
-
if (.hooks.PreToolUse | length) == 0 then del(.hooks.PreToolUse) else . end |
|
|
177
|
-
if ((.hooks // {}) | keys | length) == 0 then del(.hooks) else . end
|
|
178
|
-
else . end
|
|
179
|
-
' "$HOME/.claude/settings.json" >"$tmp" 2>/dev/null; then
|
|
180
|
-
mv "$tmp" "$HOME/.claude/settings.json"
|
|
181
|
-
else
|
|
182
|
-
rm -f "$tmp"
|
|
183
|
-
fi
|
|
184
|
-
fi
|
|
185
|
-
# opencode plugin of the guard (also removed by repowarden above)
|
|
186
|
-
rm -f "$HOME/.config/opencode/plugins/repowarden-garde.js" \
|
|
187
|
-
"$HOME/.config/opencode/plugins/repowarden-garde-v2.js"
|
|
188
|
-
# docker guard: only its entries and its plugins are removed.
|
|
189
|
-
remove_docker_guard
|
|
190
|
-
# opencode configuration: removed only if it carries the devzone marker
|
|
191
|
-
# and was not changed; customised -> kept.
|
|
192
|
-
remove_opencode_config
|
|
193
|
-
# Removes the opencode provider of the host models, keeps the rest of the file.
|
|
194
|
-
unset_provider || true
|
|
195
|
-
# devzone skill: removed only if unchanged; customised -> kept.
|
|
196
|
-
remove_devzone_skill
|
|
197
|
-
# devzone agent state: kept in the shared volume (disabling it in one
|
|
198
|
-
# devzone does not remove the state of the others).
|
|
199
|
-
echo "devzone : ai disabled (logins and devzone agent state kept in their volumes; workspace/.agents/ logs kept)"
|
|
200
|
-
fi
|
|
201
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, repair of the workstation.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Lines "package pinned installed" of the outdated tools; fails if the versions.sh
|
|
8
|
-
# script is missing or cannot answer (the state then omits the line)
|
|
9
|
-
outdated_tools() {
|
|
10
|
-
[ -f "$VERSIONS" ] || return 1
|
|
11
|
-
bash "$VERSIONS" --installees 2>/dev/null
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
# Sets repowarden back to the pinned version if it differs (it installs the
|
|
15
|
-
# global git hooks)
|
|
16
|
-
apply_repowarden() {
|
|
17
|
-
local line pinned installed package=repowarden
|
|
18
|
-
[ -f "$VERSIONS" ] || return 0
|
|
19
|
-
line="$(bash "$VERSIONS" --installees 2>/dev/null | awk '$1 == "repowarden"' || true)"
|
|
20
|
-
[ -n "$line" ] || return 0
|
|
21
|
-
read -r _ pinned installed <<<"$line"
|
|
22
|
-
echo "devzone : installing repowarden ${pinned}…"
|
|
23
|
-
npm install -g "$package@$pinned" >/dev/null
|
|
24
|
-
repowarden install --global --lang fr
|
|
25
|
-
echo "devzone : repowarden $installed → $pinned"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
# Paths of the worktrees of the devzone repository and of the workspace
|
|
29
|
-
# repositories absent here: created on the other side (host), a git worktree
|
|
30
|
-
# prune would break them. Read-only: nothing is deleted or repaired.
|
|
31
|
-
missing_worktrees() {
|
|
32
|
-
local repo line path
|
|
33
|
-
{
|
|
34
|
-
[ -e "$RACINE/.git" ] && echo "$RACINE"
|
|
35
|
-
find "$RACINE/workspace" -mindepth 2 -maxdepth 3 -name .git -type d 2>/dev/null | sed 's|/\.git$||'
|
|
36
|
-
} | while IFS= read -r repo; do
|
|
37
|
-
{ git -C "$repo" worktree list --porcelain 2>/dev/null || true; } | while IFS= read -r line; do
|
|
38
|
-
case "$line" in
|
|
39
|
-
"worktree "*)
|
|
40
|
-
path="${line#worktree }"
|
|
41
|
-
[ -d "$path" ] || echo "$path"
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
done
|
|
45
|
-
done || true
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
# Repair (#341): repairs the workstation: relays, watchers, credentials.
|
|
49
|
-
# Each item is really repaired; ✔ or ✖ with the reason.
|
|
50
|
-
repair_item() {
|
|
51
|
-
local name="$1" output code reason
|
|
52
|
-
shift
|
|
53
|
-
if output="$("$@" 2>&1)"; then
|
|
54
|
-
echo "✔ $name"
|
|
55
|
-
else
|
|
56
|
-
code=$?
|
|
57
|
-
reason="$(printf '%s\n' "$output" | sed '/^[[:space:]]*$/d' | tail -1)"
|
|
58
|
-
[ -n "$reason" ] || reason="failed (code $code)"
|
|
59
|
-
echo "✖ $name : $reason"
|
|
60
|
-
repair_failed=1
|
|
61
|
-
fi
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
# Application repairs (#341): active services, ports and credentials; a failure
|
|
65
|
-
# does not stop the following ones.
|
|
66
|
-
repair_workstation() {
|
|
67
|
-
repair_failed=0
|
|
68
|
-
if [ "$(value_of gitlab)" = on ]; then
|
|
69
|
-
repair_item "gitlab name" devzone gitlab host-set
|
|
70
|
-
repair_item "gitlab relay" devzone gitlab relay-start
|
|
71
|
-
fi
|
|
72
|
-
if [ "$(value_of postgres)" = on ]; then
|
|
73
|
-
repair_item "postgres relay" devzone postgres relay-start
|
|
74
|
-
fi
|
|
75
|
-
if [ "$(value_of argocd)" = on ]; then
|
|
76
|
-
repair_item "argocd relay" "$ICI/devzone" argocd relay-start
|
|
77
|
-
fi
|
|
78
|
-
if [ "$(value_of mysql)" = on ]; then
|
|
79
|
-
repair_item "mysql relay" devzone mysql relay-start
|
|
80
|
-
fi
|
|
81
|
-
repair_item "catalog watcher" env DEVZONE_STATE="$ETAT" DEVZONE_CATALOG_REAL=yes devzone catalog-watcher start
|
|
82
|
-
repair_item "credentials" devzone passwords regenerate
|
|
83
|
-
devzone cluster clean || true
|
|
84
|
-
return "$repair_failed"
|
|
85
|
-
}
|
|
@@ -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,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# shellcheck shell=bash
|
|
3
|
-
# devzone, version of the folder and of the published release.
|
|
4
|
-
# Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
|
|
5
|
-
# functions only, shared variables are defined in devzone.
|
|
6
|
-
|
|
7
|
-
# Version of the devzone folder (manifest written by the workstation CLI),
|
|
8
|
-
# nothing if the folder predates the manifest
|
|
9
|
-
folder_version() {
|
|
10
|
-
local v
|
|
11
|
-
[ -f "$RACINE/.devzone.version" ] || return 1
|
|
12
|
-
v="$(sed -n '1s/^version //p' "$RACINE/.devzone.version" 2>/dev/null | head -1 || true)"
|
|
13
|
-
[ -n "$v" ] || return 1
|
|
14
|
-
printf '%s\n' "$v"
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
# True if the first version is newer than the second
|
|
18
|
-
version_is_newer() {
|
|
19
|
-
awk -v a="$1" -v b="$2" 'BEGIN {
|
|
20
|
-
na = split(a, x, ".")
|
|
21
|
-
nb = split(b, y, ".")
|
|
22
|
-
n = (na > nb ? na : nb)
|
|
23
|
-
for (i = 1; i <= n; i++) {
|
|
24
|
-
p = (i <= na ? x[i] : 0) + 0
|
|
25
|
-
q = (i <= nb ? y[i] : 0) + 0
|
|
26
|
-
if (p > q) exit 0
|
|
27
|
-
if (p < q) exit 1
|
|
28
|
-
}
|
|
29
|
-
exit 1
|
|
30
|
-
}'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Version published on npm, at most once a day, cached under
|
|
34
|
-
# ~/.cache/devzone/; 5 s at most, silent offline
|
|
35
|
-
published_version() {
|
|
36
|
-
local cache day npm v tmp pid waited
|
|
37
|
-
cache="$HOME/.cache/devzone/version-publiee"
|
|
38
|
-
day="$(date +%Y-%m-%d)"
|
|
39
|
-
if [ -f "$cache" ] && [ "$(sed -n '1p' "$cache" 2>/dev/null || true)" = "$day" ]; then
|
|
40
|
-
sed -n '2p' "$cache" 2>/dev/null || true
|
|
41
|
-
return 0
|
|
42
|
-
fi
|
|
43
|
-
npm="${DEVZONE_NPM:-npm}"
|
|
44
|
-
v=""
|
|
45
|
-
if command -v "$npm" >/dev/null 2>&1; then
|
|
46
|
-
mkdir -p "$(dirname "$cache")" 2>/dev/null || true
|
|
47
|
-
tmp="$cache.$$"
|
|
48
|
-
"$npm" view devzone version >"$tmp" 2>/dev/null &
|
|
49
|
-
pid=$!
|
|
50
|
-
waited=0
|
|
51
|
-
while kill -0 "$pid" 2>/dev/null; do
|
|
52
|
-
sleep 1
|
|
53
|
-
waited=$((waited + 1))
|
|
54
|
-
if [ "$waited" -ge 5 ]; then
|
|
55
|
-
kill "$pid" 2>/dev/null || true
|
|
56
|
-
break
|
|
57
|
-
fi
|
|
58
|
-
done
|
|
59
|
-
wait "$pid" 2>/dev/null || true
|
|
60
|
-
v="$(sed -n '1p' "$tmp" 2>/dev/null | tr -d '[:space:]' || true)"
|
|
61
|
-
rm -f "$tmp"
|
|
62
|
-
fi
|
|
63
|
-
mkdir -p "$(dirname "$cache")" 2>/dev/null || true
|
|
64
|
-
printf '%s\n%s\n' "$day" "$v" >"$cache" 2>/dev/null || true
|
|
65
|
-
[ -n "$v" ] && printf '%s\n' "$v"
|
|
66
|
-
return 0
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
version_available_line() {
|
|
70
|
-
local folder published
|
|
71
|
-
folder="$(folder_version)" || return 0
|
|
72
|
-
published="$(published_version)" || return 0
|
|
73
|
-
published="${published#v}"
|
|
74
|
-
[ -n "$published" ] || return 0
|
|
75
|
-
if version_is_newer "$published" "$folder"; then
|
|
76
|
-
printf ' ○ devzone %s available: on the workstation, devzone update\n' "$published"
|
|
77
|
-
fi
|
|
78
|
-
}
|
package/.devcontainer/help.sh
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Help of devzone (devzone --help, #557), sourced by devzone : English command
|
|
3
|
-
# names only ; the French names are refused and print the new name (#695).
|
|
4
|
-
# devzone_aide prints the list, indented like the other usage texts.
|
|
5
|
-
devzone_aide() {
|
|
6
|
-
cat <<'AIDE'
|
|
7
|
-
Optional modules of devzone, enabled on demand, without rebuild:
|
|
8
|
-
devzone state of the modules
|
|
9
|
-
devzone --version version of the workspace image (DEVZONE_VERSION)
|
|
10
|
-
devzone platform GitHub (default) or GitLab
|
|
11
|
-
devzone platform github back to GitHub: glab and config removed
|
|
12
|
-
devzone platform gitlab GitLab, [--url URL] (default: gitlab module)
|
|
13
|
-
devzone enable <module> enable and apply at once
|
|
14
|
-
devzone disable <module> [--yes] disable and apply at once (--yes: also deletes the data)
|
|
15
|
-
devzone apply install what is enabled
|
|
16
|
-
devzone repair repair gitlab, postgres, ports, passwords
|
|
17
|
-
devzone catalog [list|apply|sync|resume|json|remove <app>] applications of the catalog
|
|
18
|
-
devzone metrics [context…] | remove [context…] install or remove metrics-server (kubectl top, k9s)
|
|
19
|
-
devzone use CTX [--confirm CTX] switch the kubectl working cluster
|
|
20
|
-
devzone clusters view of the connected clusters (work and services)
|
|
21
|
-
devzone kube saved|choose|save|local|reachable|prompt cluster helpers, in Go
|
|
22
|
-
devzone is-enabled <module> code 0 if enabled
|
|
23
|
-
devzone test-bash32 run the bats tests under bash 3.2 (Docker container)
|
|
24
|
-
devzone test-gitlab end-to-end test of the GitLab module and platform
|
|
25
|
-
devzone agent <folder> <instructions> drive opencode with the instructions file
|
|
26
|
-
devzone ai list the host (Ollama) models detected and the default model
|
|
27
|
-
devzone ticket <n> [--repo devzone|repowarden] ticket worktree (ticket done <n> removes it)
|
|
28
|
-
devzone build <folder> [--tag <name>] build an image in the Kubernetes workspace (BuildKit)
|
|
29
|
-
devzone enable postgres [--context CTX] [--confirm CTX] shared PostgreSQL, cluster of choice
|
|
30
|
-
devzone postgres create <project> database and user of a project (also: list, psql, delete)
|
|
31
|
-
devzone mysql create <project> database and user of a MySQL project (also: list, delete)
|
|
32
|
-
devzone enable llm [--preset light] local code model (llama.cpp), devzone llm status
|
|
33
|
-
devzone llm status | delete-data [--yes] model and reachability | namespace and model removed
|
|
34
|
-
devzone gitlab migrate [--yes] GitLab in the services cluster, then the old kind cluster deleted
|
|
35
|
-
devzone gitlab new-password [root|dev] random password (root or dev) regenerated
|
|
36
|
-
devzone enable argocd Argo CD in the services cluster, access https://127.0.0.1:8443
|
|
37
|
-
devzone argocd status|relay-start|relay-stop Argo CD (argocd module)
|
|
38
|
-
devzone argocd app add <repo url> [path]|list|remove <N> projects deployed by Argo CD (#516)
|
|
39
|
-
devzone cluster [CTX] [--yes] [--confirm CTX] services cluster of devzone, or change it
|
|
40
|
-
devzone port [--close <n>] list or remove a relay of the workstation
|
|
41
|
-
devzone passwords regenerate .password and print its path
|
|
42
|
-
devzone packages [add|remove|apply] … system packages kept after a rebuild
|
|
43
|
-
AIDE
|
|
44
|
-
}
|
|
@@ -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
|
-
}
|