Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ NO_TEAM_MODE=0
PLAN_TUNE_HOOKS_MODE="" # "" = resolve from env/config/prompt; "yes"/"no" = explicit
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, cursor, slate, openclaw, hermes, gbrain, 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 @@ -101,7 +101,7 @@ while [ $# -gt 0 ]; do
done

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

# ─── Resolve skill prefix preference ─────────────────────────
Expand Down
45 changes: 45 additions & 0 deletions test/setup-host-validation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { describe, test, expect } from 'bun:test';
import { spawnSync } from 'child_process';
import * as path from 'path';
import * as os from 'os';
import * as fs from 'fs';

const ROOT = path.resolve(import.meta.dir, '..');
const SETUP_SCRIPT = path.join(ROOT, 'setup');

function runSetupHost(host: string): { stderr: string; status: number | null; timedOut: boolean } {
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gstack-setup-host-'));
const r = spawnSync('bash', [SETUP_SCRIPT, '--host', host], {
cwd: ROOT,
encoding: 'utf-8',
input: '',
timeout: 3000,
env: { ...process.env, HOME: tmpDir },
});
fs.rmSync(tmpDir, { recursive: true, force: true });
return {
stderr: r.stderr || '',
status: r.status,
timedOut: r.signal === 'SIGTERM',
};
}

describe('setup: --host validation accepts all registered hosts', () => {
test('--host cursor is accepted (not rejected as unknown)', () => {
const r = runSetupHost('cursor');
expect(r.stderr).not.toContain('Unknown --host value');
expect(r.status).not.toBe(1);
});

test('--host slate is accepted (not rejected as unknown)', () => {
const r = runSetupHost('slate');
expect(r.stderr).not.toContain('Unknown --host value');
expect(r.status).not.toBe(1);
});

test('--host nonexistent is still rejected', () => {
const r = runSetupHost('nonexistent');
expect(r.stderr).toContain('Unknown --host value');
expect(r.status).toBe(1);
});
});
Loading