# GAL CLI

Governance platform for AI coding agents. Discover, centralize, and sync approved configurations for individuals and teams.

## Install

```bash
pnpm add -g @scheduler-systems/gal-run
```

Or via Homebrew:

```bash
brew tap scheduler-systems/tap
brew install gal
```

Windows:

```powershell
winget install SchedulerSystems.GAL
```

Bootstrap scripts:

```bash
curl -fsSL https://gal.run/install.sh | sh
```

```powershell
powershell -NoProfile -ExecutionPolicy Bypass -Command "$script = Join-Path $env:TEMP 'gal-install.ps1'; Invoke-WebRequest -UseBasicParsing -Uri 'https://gal.run/install.ps1' -OutFile $script; & $script; Remove-Item $script -Force"
```

## Usage

```bash
# Authenticate with GitHub
gal auth login

# Pull approved configs
gal sync --pull

# Configure MCP + validate tool discovery
gal mcp setup
gal mcp doctor

# Check sync status
gal sync --status

# Scan org repos for AI agent configs
gal discover
```

### GAL Code

If your org has GAL Code access, the CLI exposes the coding agent under `gal code`.

```bash
# Launch the default OpenCode UI
gal code

# Pass flags and prompts straight through to the default OpenCode runner
gal code --model glm-5 "write a migration plan"

# Select a specific variant explicitly when needed
gal code codex --model gpt-5.4 "fix the failing tests"

# Profile-scoped GAL Code memory sync uses the same GAL-owned runtime home
gal install --platform gal-code --profile work
gal mcp sync-memory --platform gal-code --profile work --pull
gal code --profile work
```

## Supported Platforms

- Claude Code (`.claude/`)
- Cursor (`.cursor/`)
- GitHub Copilot (`.github/`)
- Gemini (`.gemini/`)
- Codex (`.codex/`)
- Windsurf (`.windsurf/`)

## MCP Server

GAL provides an MCP server for AI coding agents. Auto-configured by `gal sync --pull`, or set up directly:

```bash
gal mcp setup
gal mcp doctor
```

Recommended onboarding:

```bash
gal auth login
gal mcp setup
gal mcp doctor
```

Manual config example:

**Claude Code** (`.mcp.json`):
```json
{
  "mcpServers": {
    "gal": {
      "type": "http",
      "transport": "http",
      "url": "https://api.gal.run/mcp"
    }
  }
}
```

**Cursor** (`.cursor/mcp.json`), **Windsurf** (`.windsurf/mcp_config.json`), **Gemini** (`settings.json`):
```json
{
  "mcpServers": {
    "gal": {
      "type": "http",
      "transport": "http",
      "url": "https://api.gal.run/mcp"
    }
  }
}
```

The hosted endpoint `https://api.gal.run/mcp` uses OAuth/Bearer auth.

### Codex Setup

Project-local Codex setup is auto-managed by GAL:

```bash
gal sync --pull
# or
gal install --platform codex
```

That writes managed `.codex/config.toml` and `.codex/hooks.json` entries so Codex can use the local GAL MCP server and mirror shared memory into `.codex/memory/MEMORY.md`.

Manual fallback:

Preferred (OAuth):

```bash
codex mcp add gal --url https://api.gal.run/mcp
codex mcp login gal
```

If OAuth login fails with `Dynamic client registration not supported`, use bearer-token mode:

```bash
export GAL_AUTH_TOKEN="$(node -e 'console.log(JSON.parse(require(\"fs\").readFileSync(process.env.HOME+\"/.gal/config.json\",\"utf8\")).authToken||\"\")')"
codex mcp remove gal
codex mcp add gal --url https://api.gal.run/mcp --bearer-token-env-var GAL_AUTH_TOKEN
```

If `/mcp` shows `Tools: (none)`, verify `GAL_AUTH_TOKEN` is set in the Codex process environment.

## CI/CD Integration

```yaml
- name: Install GAL CLI
  run: pnpm add -g @scheduler-systems/gal-run

- name: Sync configs
  run: gal sync --pull
  env:
    GAL_TOKEN: ${{ secrets.GAL_TOKEN }}
```

## Documentation

- Docs: https://gal.run/docs
- Dashboard: https://app.gal.run
- Release runbook: [docs/release-runbook.md](docs/release-runbook.md)
- Issues: https://github.com/Scheduler-Systems/gal-run/issues

## License

Proprietary - Copyright (c) 2026 Scheduler Systems. All rights reserved.
