forked from garrytan/gstack
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
Latest commit
executable file
·82 lines (76 loc) · 3.31 KB
/
Copy pathsetup
File metadata and controls
executable file
·82 lines (76 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
# Compatibility entrypoint for the optional GStack 2 runtime.
# Skill discovery and host placement belong to the Agent Skills installer.
set -euo pipefail
umask 077
SOURCE="${BASH_SOURCE[0]}"
while [ -L"$SOURCE" ];do
SOURCE_DIR="$(cd -P "$(dirname "$SOURCE")">/dev/null 2>&1&& pwd)"
LINK="$(readlink "$SOURCE")"
case"$LINK"in
/*) SOURCE="$LINK" ;;
*) SOURCE="$SOURCE_DIR/$LINK" ;;
esac
done
ROOT="$(cd -P "$(dirname "$SOURCE")">/dev/null 2>&1&& pwd)"
# Keep the legacy setup flags harmless during the compatibility window. They
# used to control host-specific skill placement, which now belongs to the
# standard Agent Skills installer; the optional runtime itself is always a
# single per-user local install.
ARGS=()
forargin"$@";do
case"$arg"in
-h|--help)
printf'%s\n' \
'Usage: ./setup [--capabilities <list>] [--replace-capabilities] [--dry-run|--install-now [--yes]|--install-later]' \
' [--browser managed|installed [--browser-path <absolute-path>]]' \
' [--home <path>] [--version <version>] [--json] [--quiet]' \
'' \
'Optional capabilities: browser, ios (iOS is macOS-only).' \
'Registers the Stop verification gate. Remove it with:' \
' bin/gstack-settings-hook remove-source --source verify-gate' \
'Without --install-now, non-interactive use previews and installs nothing.' \
'--dry-run and --install-later never modify runtime state or host setup.' \
'Installs only the optional host-neutral runtime and selected local capabilities.' \
'Skills are installed separately with: npx skills add time-attack/gstack/skills'
exit 0
;;
--local|--team|--no-team)
echo"gstack setup: $arg is deprecated; skill placement is delegated to: npx skills add time-attack/gstack/skills">&2
;;
*) ARGS+=("$arg") ;;
esac
done
NODE_COMMAND="${GSTACK_NODE:-node}"
if!command -v "$NODE_COMMAND">/dev/null 2>&1;then
echo"gstack setup: Node 18+ is required by the managed runtime launchers.">&2
echo"Install Node from https://nodejs.org, or install judgment-only skills with:">&2
echo" npx skills add time-attack/gstack/skills">&2
exit 1
fi
if!"$NODE_COMMAND" -e 'process.exit(Number(process.versions.node.split(".")[0]) >= 18 ? 0 : 1)'>/dev/null 2>&1;then
echo"gstack setup: Node 18+ is required by the managed runtime launchers.">&2
exit 1
fi
# Stop-hook verification gate. Registered through the existing settings-hook
# helper, which validates the Stop event, backs up settings.json, and dedupes
# by source. Skipped for previews. Best effort: never blocks setup. Silent on
# success so --json and --quiet output stay clean.
case"${ARGS[*]-}"in
*" --dry-run "*|*" --install-later "*) ;;
*)
if [ -x"$ROOT/bin/gstack-settings-hook" ];then
"$ROOT/bin/gstack-settings-hook" add-event \
--event Stop \
--command "$ROOT/bin/gstack-verify-gate" \
--source verify-gate \
--timeout 600 >/dev/null 2>&1||
echo"gstack setup: could not register the Stop verification gate; skipped.">&2
fi
;;
esac
if [ "${#ARGS[@]}"-gt 0 ];then
exec"$NODE_COMMAND""$ROOT/runtime/install.js" --source "$ROOT""${ARGS[@]}"
else
exec"$NODE_COMMAND""$ROOT/runtime/install.js" --source "$ROOT"
fi