From 6e4ed2b292f874bd52547cb1b00473aa76a40da0 Mon Sep 17 00:00:00 2001 From: Mattias Petersson Date: Mon, 13 Jul 2026 03:24:11 +0200 Subject: [PATCH] fix agy setup runtime generation --- setup | 13 +++++++++---- test/gen-skill-docs.test.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/setup b/setup index c96a31181..dfd0e160b 100755 --- a/setup +++ b/setup @@ -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 diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index d4ec1f035..5e580b7d2 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -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()');