Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'main' into sync/upstream-main
  • Loading branch information
GeolifyAI authored Apr 17, 2026
commit 0c306aea5c14ccdf1e51e5ebc8726aa0378f8e94
85 changes: 81 additions & 4 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ FACTORY_SKILLS="$HOME/.factory/skills"
FACTORY_GSTACK="$FACTORY_SKILLS/gstack"
OPENCODE_SKILLS="$HOME/.config/opencode/skills"
OPENCODE_GSTACK="$OPENCODE_SKILLS/gstack"
COPILOT_SKILLS="$HOME/.copilot/skills"
COPILOT_GSTACK="$COPILOT_SKILLS/gstack"

IS_WINDOWS=0
case "$(uname -s)" in
Expand All @@ -43,7 +45,7 @@ TEAM_MODE=0
NO_TEAM_MODE=0
while [ $# -gt 0 ]; do
case "$1" in
--host) [ -z "$2" ] && echo "Missing value for --host (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, or auto)" >&2 && exit 1; HOST="$2"; shift 2 ;;
--host) [ -z "$2" ] && echo "Missing value for --host (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, copilot, or auto)" >&2 && exit 1; HOST="$2"; shift 2 ;;
--host=*) HOST="${1#--host=}"; shift ;;
--local) LOCAL_INSTALL=1; shift ;;
--prefix) SKILL_PREFIX=1; SKILL_PREFIX_FLAG=1; shift ;;
Expand All @@ -56,7 +58,7 @@ while [ $# -gt 0 ]; do
done

case "$HOST" in
claude|codex|kiro|factory|opencode|auto) ;;
claude|codex|kiro|factory|opencode|copilot|auto) ;;
openclaw)
echo ""
echo "OpenClaw integration uses a different model — OpenClaw spawns Claude Code"
Expand Down Expand Up @@ -91,7 +93,7 @@ case "$HOST" in
echo "GBrain setup and brain skills ship from the GBrain repo."
echo ""
exit 0 ;;
*) echo "Unknown --host value: $HOST (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, or auto)" >&2; exit 1 ;;
*) echo "Unknown --host value: $HOST (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, copilot, or auto)" >&2; exit 1 ;;
esac

# ─── Resolve skill prefix preference ─────────────────────────
Expand Down Expand Up @@ -155,14 +157,15 @@ INSTALL_CODEX=0
INSTALL_KIRO=0
INSTALL_FACTORY=0
INSTALL_OPENCODE=0
INSTALL_COPILOT=0
if [ "$HOST" = "auto" ]; then
command -v claude >/dev/null 2>&1 && INSTALL_CLAUDE=1
command -v codex >/dev/null 2>&1 && INSTALL_CODEX=1
command -v kiro-cli >/dev/null 2>&1 && INSTALL_KIRO=1
command -v droid >/dev/null 2>&1 && INSTALL_FACTORY=1
command -v opencode >/dev/null 2>&1 && INSTALL_OPENCODE=1
# If none found, default to claude
if [ "$INSTALL_CLAUDE" -eq 0 ] && [ "$INSTALL_CODEX" -eq 0 ] && [ "$INSTALL_KIRO" -eq 0 ] && [ "$INSTALL_FACTORY" -eq 0 ] && [ "$INSTALL_OPENCODE" -eq 0 ]; then
if [ "$INSTALL_CLAUDE" -eq 0 ] && [ "$INSTALL_CODEX" -eq 0 ] && [ "$INSTALL_KIRO" -eq 0 ] && [ "$INSTALL_FACTORY" -eq 0 ] && [ "$INSTALL_OPENCODE" -eq 0 ] && [ "$INSTALL_COPILOT" -eq 0 ]; then
INSTALL_CLAUDE=1
fi
elif [ "$HOST" = "claude" ]; then
Expand All @@ -175,6 +178,8 @@ elif [ "$HOST" = "factory" ]; then
INSTALL_FACTORY=1
elif [ "$HOST" = "opencode" ]; then
INSTALL_OPENCODE=1
elif [ "$HOST" = "copilot" ]; then
INSTALL_COPILOT=1
fi

migrate_direct_codex_install() {
Expand Down Expand Up @@ -284,6 +289,13 @@ if [ "$INSTALL_OPENCODE" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then
cd "$SOURCE_GSTACK_DIR"
bun install --frozen-lockfile 2>/dev/null || bun install
bun run gen:skill-docs --host opencode
# 1d. Generate .copilot/ Copilot skill docs
if [ "$INSTALL_COPILOT" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then
log "Generating .copilot/ skill docs..."
(
cd "$SOURCE_GSTACK_DIR"
bun install --frozen-lockfile 2>/dev/null || bun install
bun run gen:skill-docs --host copilot
)
fi

Expand Down Expand Up @@ -899,6 +911,71 @@ if [ "$INSTALL_OPENCODE" -eq 1 ]; then
echo "gstack ready (opencode)."
echo " browse: $BROWSE_BIN"
echo " opencode skills: $OPENCODE_SKILLS"
# 6c. Install for Copilot
if [ "$INSTALL_COPILOT" -eq 1 ]; then
COPILOT_DIR="$SOURCE_GSTACK_DIR/.copilot/skills"
mkdir -p "$COPILOT_SKILLS"

# Create runtime root with symlinked assets
if [ -L "$COPILOT_GSTACK" ]; then
rm -f "$COPILOT_GSTACK"
elif [ -d "$COPILOT_GSTACK" ] && [ "$COPILOT_GSTACK" != "$SOURCE_GSTACK_DIR" ]; then
rm -rf "$COPILOT_GSTACK"
fi

mkdir -p "$COPILOT_GSTACK" "$COPILOT_GSTACK/browse" "$COPILOT_GSTACK/gstack-upgrade" "$COPILOT_GSTACK/review"

if [ -f "$COPILOT_DIR/gstack/SKILL.md" ]; then
ln -snf "$COPILOT_DIR/gstack/SKILL.md" "$COPILOT_GSTACK/SKILL.md"
fi
if [ -d "$SOURCE_GSTACK_DIR/bin" ]; then
ln -snf "$SOURCE_GSTACK_DIR/bin" "$COPILOT_GSTACK/bin"
fi
if [ -d "$SOURCE_GSTACK_DIR/browse/dist" ]; then
ln -snf "$SOURCE_GSTACK_DIR/browse/dist" "$COPILOT_GSTACK/browse/dist"
fi
if [ -d "$SOURCE_GSTACK_DIR/browse/bin" ]; then
ln -snf "$SOURCE_GSTACK_DIR/browse/bin" "$COPILOT_GSTACK/browse/bin"
fi
if [ -f "$COPILOT_DIR/gstack-upgrade/SKILL.md" ]; then
ln -snf "$COPILOT_DIR/gstack-upgrade/SKILL.md" "$COPILOT_GSTACK/gstack-upgrade/SKILL.md"
fi
for f in checklist.md design-checklist.md greptile-triage.md TODOS-format.md; do
if [ -f "$SOURCE_GSTACK_DIR/review/$f" ]; then
ln -snf "$SOURCE_GSTACK_DIR/review/$f" "$COPILOT_GSTACK/review/$f"
fi
done
if [ -f "$SOURCE_GSTACK_DIR/ETHOS.md" ]; then
ln -snf "$SOURCE_GSTACK_DIR/ETHOS.md" "$COPILOT_GSTACK/ETHOS.md"
fi

# Link generated copilot-format skills
if [ ! -d "$COPILOT_DIR" ]; then
echo " Generating .copilot/ skill docs..."
( cd "$SOURCE_GSTACK_DIR" && bun run gen:skill-docs --host copilot )
fi
if [ -d "$COPILOT_DIR" ]; then
local_linked=()
for skill_dir in "$COPILOT_DIR"/gstack*/; do
[ -f "$skill_dir/SKILL.md" ] || continue
skill_name="$(basename "$skill_dir")"
[ "$skill_name" = "gstack" ] && continue
target="$COPILOT_SKILLS/$skill_name"
if [ -L "$target" ] || [ ! -e "$target" ]; then
ln -snf "$skill_dir" "$target"
local_linked+=("$skill_name")
fi
done
if [ ${#local_linked[@]} -gt 0 ]; then
echo " linked skills: ${local_linked[*]}"
fi
else
echo " warning: .copilot/skills/ generation failed — run 'bun run gen:skill-docs --host copilot' manually" >&2
fi

echo "gstack ready (copilot)."
echo " browse: $BROWSE_BIN"
echo " copilot skills: $COPILOT_SKILLS"
fi

# 7. Create .agents/ sidecar symlinks for the real Codex skill target.
Expand Down
4 changes: 2 additions & 2 deletions test/gen-skill-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2115,9 +2115,9 @@ describe('setup script validation', () => {
expect(fnBody).toContain('rm -f "$target"');
});

test('setup supports --host auto|claude|codex|kiro|opencode', () => {
test('setup supports --host auto|claude|codex|kiro|opencode|copilot', () => {
expect(setupContent).toContain('--host');
expect(setupContent).toContain('claude|codex|kiro|factory|opencode|auto');
expect(setupContent).toContain('claude|codex|kiro|factory|opencode|copilot|auto');
});

test('auto mode detects claude, codex, kiro, and opencode binaries', () => {
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.