Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
268 changes: 268 additions & 0 deletions hosts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,271 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

## Follow-up: `setup --host pi` support landed

This branch now patches the real `setup` script so `./setup --host pi` works,
not just `bun run gen:skill-docs --host pi`.

### What changed

- Added Pi-specific setup paths in the installer.
- Updated `--host` validation/help text to include `pi`.
- Extended setup handling so the Pi host is recognized by the real install flow.

For the exact implementation details, see the commit or PR that introduced this
change rather than duplicating the full patch in this README.
done

case "$HOST" in
- claude|codex|kiro|factory|opencode|auto) ;;
+ claude|codex|kiro|factory|opencode|pi|auto) ;;
openclaw)
echo ""
echo "OpenClaw integration uses a different model — OpenClaw spawns Claude Code"
@@ -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, pi, openclaw, hermes, gbrain, or auto)" >&2; exit 1 ;;
esac

# ─── Resolve skill prefix preference ─────────────────────────
@@ -155,14 +157,16 @@ INSTALL_CODEX=0
INSTALL_KIRO=0
INSTALL_FACTORY=0
INSTALL_OPENCODE=0
+INSTALL_PI=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
+ command -v pi >/dev/null 2>&1 && INSTALL_PI=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_PI" -eq 0 ]; then
INSTALL_CLAUDE=1
fi
elif [ "$HOST" = "claude" ]; then
@@ -175,6 +179,8 @@ elif [ "$HOST" = "factory" ]; then
INSTALL_FACTORY=1
elif [ "$HOST" = "opencode" ]; then
INSTALL_OPENCODE=1
+elif [ "$HOST" = "pi" ]; then
+ INSTALL_PI=1
fi

migrate_direct_codex_install() {
@@ -321,6 +327,16 @@ if [ "$INSTALL_OPENCODE" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then
)
fi

+# 1e. Generate .pi/ Pi skill docs
+if [ "$INSTALL_PI" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then
+ log "Generating .pi/ skill docs..."
+ (
+ cd "$SOURCE_GSTACK_DIR"
+ bun install --frozen-lockfile 2>/dev/null || bun install
+ bun run gen:skill-docs --host pi
+ )
+fi
+
# 2. Ensure Playwright's Chromium is available
if ! ensure_playwright_browser; then
echo "Installing Playwright Chromium..."
@@ -763,6 +779,107 @@ link_opencode_skill_dirs() {
fi
}

+create_pi_runtime_root() {
+ local gstack_dir="$1"
+ local pi_gstack="$2"
+ local pi_dir="$gstack_dir/.pi/skills"
+
+ if [ -L "$pi_gstack" ]; then
+ rm -f "$pi_gstack"
+ elif [ -d "$pi_gstack" ] && [ "$pi_gstack" != "$gstack_dir" ]; then
+ rm -rf "$pi_gstack"
+ fi
+
+ mkdir -p "$pi_gstack" "$pi_gstack/browse" "$pi_gstack/design" "$pi_gstack/gstack-upgrade" "$pi_gstack/review" "$pi_gstack/qa" "$pi_gstack/plan-devex-review"
+
+ if [ -f "$pi_dir/gstack/SKILL.md" ]; then
+ ln -snf "$pi_dir/gstack/SKILL.md" "$pi_gstack/SKILL.md"
+ fi
+ if [ -d "$gstack_dir/bin" ]; then
+ ln -snf "$gstack_dir/bin" "$pi_gstack/bin"
+ fi
+ if [ -d "$gstack_dir/browse/dist" ]; then
+ ln -snf "$gstack_dir/browse/dist" "$pi_gstack/browse/dist"
+ fi
+ if [ -d "$gstack_dir/browse/bin" ]; then
+ ln -snf "$gstack_dir/browse/bin" "$pi_gstack/browse/bin"
+ fi
+ if [ -d "$gstack_dir/design/dist" ]; then
+ ln -snf "$gstack_dir/design/dist" "$pi_gstack/design/dist"
+ fi
+ if [ -f "$pi_dir/gstack-upgrade/SKILL.md" ]; then
+ ln -snf "$pi_dir/gstack-upgrade/SKILL.md" "$pi_gstack/gstack-upgrade/SKILL.md"
+ fi
+ for f in checklist.md design-checklist.md greptile-triage.md TODOS-format.md; do
+ if [ -f "$gstack_dir/review/$f" ]; then
+ ln -snf "$gstack_dir/review/$f" "$pi_gstack/review/$f"
+ fi
+ done
+ if [ -d "$gstack_dir/review/specialists" ]; then
+ ln -snf "$gstack_dir/review/specialists" "$pi_gstack/review/specialists"
+ fi
+ if [ -d "$gstack_dir/qa/templates" ]; then
+ ln -snf "$gstack_dir/qa/templates" "$pi_gstack/qa/templates"
+ fi
+ if [ -d "$gstack_dir/qa/references" ]; then
+ ln -snf "$gstack_dir/qa/references" "$pi_gstack/qa/references"
+ fi
+ if [ -f "$gstack_dir/plan-devex-review/dx-hall-of-fame.md" ]; then
+ ln -snf "$gstack_dir/plan-devex-review/dx-hall-of-fame.md" "$pi_gstack/plan-devex-review/dx-hall-of-fame.md"
+ fi
+ if [ -f "$gstack_dir/ETHOS.md" ]; then
+ ln -snf "$gstack_dir/ETHOS.md" "$pi_gstack/ETHOS.md"
+ fi
+}
+
+link_pi_skill_dirs() {
+ local gstack_dir="$1"
+ local skills_dir="$2"
+ local pi_dir="$gstack_dir/.pi/skills"
+ local linked=()
+
+ if [ ! -d "$pi_dir" ]; then
+ echo " Generating .pi/ skill docs..."
+ ( cd "$gstack_dir" && bun run gen:skill-docs --host pi )
+ fi
+
+ if [ ! -d "$pi_dir" ]; then
+ echo " warning: .pi/skills/ generation failed — run 'bun run gen:skill-docs --host pi' manually" >&2
+ return 1
+ fi
+
+ for skill_dir in "$pi_dir"/gstack*/; do
+ if [ -f "$skill_dir/SKILL.md" ]; then
+ skill_name="$(basename "$skill_dir")"
+ [ "$skill_name" = "gstack" ] && continue
+ target="$skills_dir/$skill_name"
+ if [ -L "$target" ] || [ ! -e "$target" ]; then
+ ln -snf "$skill_dir" "$target"
+ linked+=("$skill_name")
+ fi
+ fi
+ done
+
+ if [ -d "$pi_dir/gstack-office-hours" ]; then
+ local repo_office_hours_alias="$pi_dir/office-hours"
+ if [ -L "$repo_office_hours_alias" ] || [ ! -e "$repo_office_hours_alias" ]; then
+ ln -snf "$pi_dir/gstack-office-hours" "$repo_office_hours_alias"
+ fi
+ fi
+
+ if [ -d "$skills_dir/gstack-office-hours" ]; then
+ local office_hours_alias="$skills_dir/office-hours"
+ if [ -L "$office_hours_alias" ] || [ ! -e "$office_hours_alias" ]; then
+ ln -snf "$skills_dir/gstack-office-hours" "$office_hours_alias"
+ linked+=("office-hours")
+ fi
+ fi
+
+ if [ ${#linked[@]} -gt 0 ]; then
+ echo " linked skills: ${linked[*]}"
+ fi
+}
+
# 4. Install for Claude (default)
SKILLS_BASENAME="$(basename "$INSTALL_SKILLS_DIR")"
SKILLS_PARENT_BASENAME="$(basename "$(dirname "$INSTALL_SKILLS_DIR")")"
@@ -935,6 +1052,16 @@ if [ "$INSTALL_OPENCODE" -eq 1 ]; then
echo " opencode skills: $OPENCODE_SKILLS"
fi

+# 6d. Install for Pi
+if [ "$INSTALL_PI" -eq 1 ]; then
+ mkdir -p "$PI_SKILLS"
+ create_pi_runtime_root "$SOURCE_GSTACK_DIR" "$PI_GSTACK"
+ link_pi_skill_dirs "$SOURCE_GSTACK_DIR" "$PI_SKILLS"
+ echo "gstack ready (pi)."
+ echo " browse: $BROWSE_BIN"
+ echo " pi skills: $PI_SKILLS"
+fi
+
# 7. Create .agents/ sidecar symlinks for the real Codex skill target.
# The root Codex skill ends up pointing at $SOURCE_GSTACK_DIR/.agents/skills/gstack,
# so the runtime assets must live there for both global and repo-local installs.

diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts
index 7249a448..be0c3a6c 100644
--- a/test/gen-skill-docs.test.ts
+++ b/test/gen-skill-docs.test.ts
@@ -2245,9 +2245,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|pi', () => {
expect(setupContent).toContain('--host');
- expect(setupContent).toContain('claude|codex|kiro|factory|opencode|auto');
+ expect(setupContent).toContain('claude|codex|kiro|factory|opencode|pi|auto');
});

test('auto mode detects claude, codex, kiro, and opencode binaries', () => {
@@ -2296,6 +2296,18 @@ describe('setup script validation', () => {
expect(setupContent).toContain('dx-hall-of-fame.md');
});

+ test('setup supports --host pi with Pi skill path vars and runtime assets', () => {
+ expect(setupContent).toContain('INSTALL_PI=');
+ expect(setupContent).toContain('PI_SKILLS="$HOME/.pi/agent/skills"');
+ expect(setupContent).toContain('PI_GSTACK="$PI_SKILLS/gstack"');
+ expect(setupContent).toContain('create_pi_runtime_root');
+ expect(setupContent).toContain('bun run gen:skill-docs --host pi');
+ expect(setupContent).toContain('review/specialists');
+ expect(setupContent).toContain('qa/templates');
+ expect(setupContent).toContain('qa/references');
+ expect(setupContent).toContain('office-hours');
+ });
+
test('create_agents_sidecar links runtime assets', () => {
// Sidecar must link bin, browse, review, qa
const fnStart = setupContent.indexOf('create_agents_sidecar()');

diff --git a/test/host-config.test.ts b/test/host-config.test.ts
index 57705703..7b59db0f 100644
--- a/test/host-config.test.ts
+++ b/test/host-config.test.ts
@@ -22,6 +22,7 @@ import {
slate,
cursor,
openclaw,
+ pi,
} from '../hosts/index';
import { HOST_PATHS } from '../scripts/resolvers/types';

@@ -30,8 +31,8 @@ const ROOT = path.resolve(import.meta.dir, '..');
// ─── hosts/index.ts ─────────────────────────────────────────

describe('hosts/index.ts', () => {
- test('ALL_HOST_CONFIGS has 10 hosts', () => {
- expect(ALL_HOST_CONFIGS.length).toBe(10);
+ test('ALL_HOST_CONFIGS has 11 hosts', () => {
+ expect(ALL_HOST_CONFIGS.length).toBe(11);
});

test('ALL_HOST_NAMES matches config names', () => {
@@ -48,6 +49,7 @@ describe('hosts/index.ts', () => {
expect(opencode.name).toBe('opencode');
expect(slate.name).toBe('slate');
expect(cursor.name).toBe('cursor');
expect(openclaw.name).toBe('openclaw');
+ expect(pi.name).toBe('pi');
});
```
Loading
Loading