mirror of https://github.com/garrytan/gstack.git
fix(setup): install Factory skills in documented root
This commit is contained in:
parent
a3259400a3
commit
8d060670c7
17
setup
17
setup
|
|
@ -912,7 +912,7 @@ link_factory_skill_dirs() {
|
||||||
local gstack_dir="$1"
|
local gstack_dir="$1"
|
||||||
local skills_dir="$2"
|
local skills_dir="$2"
|
||||||
local factory_dir="$gstack_dir/.factory/skills"
|
local factory_dir="$gstack_dir/.factory/skills"
|
||||||
local linked=()
|
local installed=()
|
||||||
|
|
||||||
if [ ! -d "$factory_dir" ]; then
|
if [ ! -d "$factory_dir" ]; then
|
||||||
echo " Generating .factory/ skill docs..."
|
echo " Generating .factory/ skill docs..."
|
||||||
|
|
@ -929,14 +929,17 @@ link_factory_skill_dirs() {
|
||||||
skill_name="$(basename "$skill_dir")"
|
skill_name="$(basename "$skill_dir")"
|
||||||
[ "$skill_name" = "gstack" ] && continue
|
[ "$skill_name" = "gstack" ] && continue
|
||||||
target="$skills_dir/$skill_name"
|
target="$skills_dir/$skill_name"
|
||||||
if [ -L "$target" ] || [ ! -e "$target" ]; then
|
# Factory documents ~/.factory/skills as its user-level skill root. Keep
|
||||||
_link_or_copy "$skill_dir" "$target"
|
# the install self-contained there and use a real directory so Droid does
|
||||||
linked+=("$skill_name")
|
# not have to follow a directory symlink during discovery. These gstack-*
|
||||||
fi
|
# paths are installer-owned and are refreshed on every setup run.
|
||||||
|
rm -rf "$target"
|
||||||
|
cp -R "$skill_dir" "$target"
|
||||||
|
installed+=("$skill_name")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ${#linked[@]} -gt 0 ]; then
|
if [ ${#installed[@]} -gt 0 ]; then
|
||||||
echo " linked skills: ${linked[*]}"
|
echo " installed skills: ${installed[*]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2450,6 +2450,19 @@ describe('setup script validation', () => {
|
||||||
expect(fnBody).not.toContain('_link_or_copy "$gstack_dir" "$codex_gstack"');
|
expect(fnBody).not.toContain('_link_or_copy "$gstack_dir" "$codex_gstack"');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Factory installs real skill directories only in its documented user root', () => {
|
||||||
|
const fnStart = setupContent.indexOf('link_factory_skill_dirs()');
|
||||||
|
const fnEnd = setupContent.indexOf('\nlink_opencode_skill_dirs()', fnStart);
|
||||||
|
const fnBody = setupContent.slice(fnStart, fnEnd);
|
||||||
|
|
||||||
|
expect(fnBody).toContain('target="$skills_dir/$skill_name"');
|
||||||
|
expect(fnBody).toContain('rm -rf "$target"');
|
||||||
|
expect(fnBody).toContain('cp -R "$skill_dir" "$target"');
|
||||||
|
expect(fnBody).not.toContain('.agents');
|
||||||
|
expect(fnBody).not.toContain('.skill-lock.json');
|
||||||
|
expect(fnBody).not.toContain('_link_or_copy "$skill_dir" "$target"');
|
||||||
|
});
|
||||||
|
|
||||||
test('direct Codex installs are migrated out of ~/.codex/skills/gstack', () => {
|
test('direct Codex installs are migrated out of ~/.codex/skills/gstack', () => {
|
||||||
expect(setupContent).toContain('migrate_direct_codex_install');
|
expect(setupContent).toContain('migrate_direct_codex_install');
|
||||||
expect(setupContent).toContain('$HOME/.gstack/repos/gstack');
|
expect(setupContent).toContain('$HOME/.gstack/repos/gstack');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue