Skip to content
Skills Library
DevOps & cloud · Automation

preview-env

/preview-env

Spin up, observe, and tear down Matrix OS preview environments — per-PR preview VPSes, platform Cloud Run preview revisions, HMR staging slots — and query their centralized logs. Use when a change needs to be seen running (shell/gateway/onboarding/CLI/macOS features), when asked to deploy a branch for testing, or when you need logs from any preview, staging, or fleet VPS.

Repository
matrix-os ↗
Licence
AGPL-3.0
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

AGPL-3.0, copyleft: przeróbki udostępniane innym muszą mieć tę samą licencję.

What it does and when to use it

Spin up, observe, and tear down Matrix OS preview environments — per-PR preview VPSes, platform Cloud Run preview revisions, HMR staging slots — and query their centralized logs. Use when a change needs to be seen running (shell/gateway/onboarding/CLI/macOS features), when asked to deploy a branch for testing, or when you need logs from any preview, staging, or fleet VPS.

Original author description

Spin up, observe, and tear down Matrix OS preview environments — per-PR preview VPSes, platform Cloud Run preview revisions, HMR staging slots — and query their centralized logs. Use when a change needs to be seen running (shell/gateway/onboarding/CLI/macOS features), when asked to deploy a branch for testing, or when you need logs from any preview, staging, or fleet VPS.

How it works

  1. Pick the surface
  2. Staging slots (inner loop)
  3. Preview VPS (verify loop)
  4. Logs — one interface for everything
  5. Rules
Original SKILL.md headings · 70 lines, 433 words
SKILL.md preview
---
name: preview-env
description: Spin up, observe, and tear down Matrix OS preview environments — per-PR preview VPSes, platform Cloud Run preview revisions, HMR staging slots — and query their centralized logs. Use when a change needs to be seen running (shell/gateway/onboarding/CLI/macOS features), when asked to deploy a branch for testing, or when you need logs from any preview, staging, or fleet VPS.
---

# Preview Environments

Production Matrix OS is VPS-native + Cloud Run; previews mirror that. Full
reference: `docs/dev/preview-environments.md`. Spec: `specs/093-preview-environments/`.

## Pick the surface

| You changed | Use | How |
|---|---|---|
| Shell/gateway/kernel UI, fast iteration | **Staging slot** (HMR, seconds per change) | `./scripts/staging-slot.sh up <worktree>` |
| Shell/gateway/kernel, production-shaped verify; onboarding (needs virgin VPS) | **Preview VPS** | add the `preview-vps` label to the PR |
| Platform (packages/platform) | **Platform preview revision** | add the `preview-platform` label to the PR |
| Organization collaboration (pre-merge gate) | **Collaboration preview** | labels `preview-vps`, `preview-collaboration` and `preview-platform`, then the `connect_collaboration_preview` dispatch (docs, "Collaboration previews") |
| macOS app | CI artifact + any preview VPS via `app.matrix-os.com/vm/<handle>` | build artifact from `macos-086.yml` |
| CLI | npm dist-tag paired with a preview VPS profile | see docs |

## Staging slots (inner loop)

Run from the ops VPS, repo root or any checkout:

```bash
./scripts/staging-slot.sh up ~/matrix-os.worktrees/<branch>   # claims slot N
# -> https://staging-<N>.matrix-os.com (HMR: edits in the worktree hot-reload)
./scripts/staging-slot.sh status            # who owns what
./scripts/staging-slot.sh down <N>          # release when done — slots are shared!
```

4 slots max. Always `down` your slot when finished; `status --reap` frees slots
idle past TTL.

## Preview VPS (verify loop)

Label the PR `preview-vps`. CI builds bundle `v<YYYY.MM.DD>-pr<N>-<run>-<attempt>-<sha7>`,
registers it **without any channel** (it can never reach real users), provisions VPS `pr-<N>`,
deploys, and comments the URL. Closed PR ⇒ VPS deleted (daily reaper as backstop,
72h TTL). Manual run: `gh workflow run preview-vps.yml -f pr=<N>`.

The shared `pr-<N>` VPS cannot use personal Integrations or Custom MCP. To test a PR
against your own connected accounts, an internal member runs `matrix preview start <N>`
for an owner-only Private Preview (see `docs/dev/preview-environments.md`).

## Logs — one interface for everything

```bash
./scripts/preview-logs.sh --handle pr-123 [--unit matrix-gateway] [--grep ERROR] [--since 1h]
./scripts/preview-logs.sh --slot 2 --since 30m
./scripts/preview-logs.sh --selector '{env="preview"}' --grep "unhandled"
```

Runs against the central Loki (loopback on the ops VPS). Slot logs ship
automatically (promtail docker discovery). A preview/fleet VPS ships logs after
one-time enrollment:

```bash
PLATFORM_SECRET=... LOGS_INGEST_USER=fleet LOGS_INGEST_PASSWORD=... \
  ./scripts/enable-vps-logship.sh pr-123 preview
```

(`LOGS_INGEST_*` live in `~/matrix-os/.env` on the ops VPS.)

## Rules

- Never promote a preview bundle to a channel; never deploy channel-wide from a PR.
- Never point a preview at production secrets or the production platform service.
- Tear down what you spin up: `staging-slot.sh down`, close the PR, or delete the
  VPS via `DELETE /vps/<machineId>` — never directly in Hetzner.
- Browser-level inspection: drive the preview URL with Playwright/chrome-devtools
  MCP; passive browser-log forwarding is deferred (spec 093).

Versions

RepositoryScoreLicence
This page · hamedmp/matrix-os100AGPL-3.0
ctxpipe-ai/ctxpipe100MIT

Database snapshot: 13.11.2026 · package version 02cbf94d4145 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100algolia-multi-env-setup
    Design isolated Algolia development, staging, preview, and production targets with explicit promotion rules. Use when environments share credentials or index names, or previews need bounded search data. Trigger with "Algolia environments", "Algolia staging setup", or "preview index".
  • 100rainbow-env
    Interact with Rainbow Machine PR preview environments for Lightdash (`rainbow.toml`, rainbowmachine MCP). Use when an agent needs to create or redeploy a preview env, run commands or call the API or database inside one, or verify a change on it.
  • 100matrix-onboarding
    Set up, authenticate, diagnose, and recover a Matrix OS cloud computer. Use when Matrix CLI login, cloud profile selection, VPS provisioning, instance readiness, coding-agent authentication, GitHub authentication, terminal-tab attachment, or Matrix recovery needs attention.
  • 90infra-preview
    Creates, resets, cleans up or audits per-change preview environments through the project's preview lifecycle, keeping each instance isolated, bounded by capacity and removed when its change ends. Use for any preview operation and to find orphaned previews.
  • 100environment-setup
    Configure and manage development, staging, and production environments. Use when setting up environment variables, managing configurations, or separating environments. Handles .env files, config management, and environment-specific settings.
  • 100test-environments
    Design environment strategy for testing across dev, CI, preview, staging, and production — Docker Compose test infrastructure, multi-stage Dockerfiles, seed-data lifecycle, per-PR preview environments, production parity, and external-dependency stubbing at the HTTP boundary. Use…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.