fix agy setup runtime generation

This commit is contained in:
Mattias Petersson 2026-07-13 03:24:11 +02:00
parent f44448ff9b
commit 6e4ed2b292
2 changed files with 22 additions and 4 deletions

13
setup
View File

@ -992,7 +992,9 @@ link_opencode_skill_dirs() {
create_agy_runtime_root() {
local gstack_dir="$1"
local agy_gstack="$2"
local agy_dir="$gstack_dir/.gemini/config/plugins/gstack/skills"
local agy_version
agy_version="$(tr -d '[:space:]' < "$gstack_dir/VERSION")"
if [ -L "$agy_gstack" ]; then
rm -f "$agy_gstack"
@ -1003,7 +1005,8 @@ create_agy_runtime_root() {
mkdir -p "$agy_gstack" "$agy_gstack/browse" "$agy_gstack/design" "$agy_gstack/gstack-upgrade" "$agy_gstack/review" "$agy_gstack/qa" "$agy_gstack/plan-devex-review" "$agy_gstack/skills"
# Create plugin.json for agy plugin structure
echo '{"name": "gstack", "version": "1.58.5.0", "description": "gstack skills for Google Antigravity", "author": {"name": "gstack"}, "license": "MIT"}' > "$agy_gstack/plugin.json"
printf '{"name": "gstack", "version": "%s", "description": "gstack skills for Google Antigravity", "author": {"name": "gstack"}, "license": "MIT"}\n' \
"$agy_version" > "$agy_gstack/plugin.json"
if [ -d "$gstack_dir/bin" ]; then
_link_or_copy "$gstack_dir/bin" "$agy_gstack/bin"
@ -1045,12 +1048,14 @@ link_agy_skill_dirs() {
local agy_dir="$gstack_dir/.gemini/config/plugins/gstack/skills"
local linked=()
if [ ! -d "$agy_dir" ]; then
# create_agy_runtime_root intentionally replaces the generated plugin tree.
# A directory alone is therefore not proof that skill generation succeeded.
if ! find "$agy_dir" -mindepth 2 -maxdepth 2 -name SKILL.md -print -quit 2>/dev/null | grep -q .; then
echo " Generating .gemini/ skill docs..."
( cd "$gstack_dir" && bun run gen:skill-docs --host agy )
fi
if [ ! -d "$agy_dir" ]; then
if ! find "$agy_dir" -mindepth 2 -maxdepth 2 -name SKILL.md -print -quit 2>/dev/null | grep -q .; then
echo " warning: .gemini/config/plugins/gstack/skills/ generation failed — run 'bun run gen:skill-docs --host agy' manually" >&2
return 1
fi

View File

@ -2441,6 +2441,19 @@ describe('setup script validation', () => {
expect(setupContent).toContain('agy plugin install');
});
test('setup regenerates deleted agy skills and derives the plugin version from VERSION', () => {
const fnStart = setupContent.indexOf('create_agy_runtime_root()');
const fnEnd = setupContent.indexOf('link_agy_skill_dirs()', fnStart);
const runtimeFn = setupContent.slice(fnStart, fnEnd);
const linkFn = setupContent.slice(fnEnd, setupContent.indexOf('# 4. Install for Claude', fnEnd));
expect(runtimeFn).toContain('agy_version="$(tr -d \'[:space:]\' < "$gstack_dir/VERSION")"');
expect(runtimeFn).toContain('"$agy_version" > "$agy_gstack/plugin.json"');
expect(runtimeFn).not.toContain('"version": "1.58.5.0"');
expect(linkFn).toContain('-name SKILL.md');
expect(linkFn).toContain('bun run gen:skill-docs --host agy');
});
test('create_agents_sidecar links runtime assets', () => {
// Sidecar must link bin, browse, review, qa
const fnStart = setupContent.indexOf('create_agents_sidecar()');