### Typical Niteshift setup script Source: https://docs.niteshift.dev/environment-configuration/setup-script A realistic Niteshift setup script that installs dependencies, brings up backing services, runs migrations, and starts the dev server. It uses pnpm with a frozen lockfile, starts Postgres and Redis via Docker Compose, runs database migrations and seeding, then launches the dev server. ```bash #!/usr/bin/env bash set -euo pipefail pnpm install --frozen-lockfile # Bring up backing services (Postgres, Redis, etc.) docker compose up -d pnpm db:migrate pnpm db:seed pnpm dev ``` -------------------------------- ### Bash setup script .niteshift/setup Source: https://docs.niteshift.dev/environment-configuration/setup-and-resume Runs automatically when Niteshift prepares a fresh environment. Installs dependencies, starts the database, runs migrations, and seeds data. Uses a shebang and set -euo pipefail. The script polls until Postgres is ready before migrating. ```bash #!/usr/bin/env bash set -euo pipefail pnpm install --frozen-lockfile # Start the declared database early so migrations can run. `ns services start` # returns as soon as the process launches, so poll until Postgres accepts # connections before migrating. ns services start postgres timeout 30 bash -c 'until docker compose exec postgres pg_isready --quiet; do sleep 1; done' pnpm db:migrate pnpm db:seed ``` -------------------------------- ### Example SKILL.md for deploy skill Source: https://docs.niteshift.dev/customizing-agents/skills Example SKILL.md file with frontmatter (`name`, `description`) and instructions. The `name` becomes a slash command (`/deploy` in Claude Code, `/prompts:deploy` in Codex). The `description` is read by the agent to decide when to apply the skill. ```markdown --- name: deploy description: Cut a release. Use when the user says "deploy", "ship", or "cut a release". --- 1. Verify `main` is green: `gh run list --branch main --limit 1`. 2. Bump the version in `package.json`. 3. Tag the commit: `git tag v$(jq -r .version package.json)`. 4. Push the tag: `git push origin --tags`. 5. The release workflow handles the rest. ``` -------------------------------- ### Conditional setup on provision vs resume with NITESHIFT_LIFECYCLE_RESUME Source: https://docs.niteshift.dev/environment-configuration/setup-script Use this script to conditionally run setup steps only on the first start (when NITESHIFT_LIFECYCLE_RESUME is unset) and always start backing services and the dev server. The script's stdout and stderr stream into $NITESHIFT_LOG_FILE, which the task workspace logs tab reads. ```bash if [ -z "${NITESHIFT_LIFECYCLE_RESUME:-}" ]; then pnpm install --frozen-lockfile pnpm db:migrate pnpm db:seed fi # Backing services and the dev server start on every run docker compose up -d pnpm dev ``` -------------------------------- ### Define services and tunnels in .niteshift/services.yaml Source: https://docs.niteshift.dev/environment-configuration/services Declares supervised services (postgres, web, storybook) and a tunnel. Services start automatically after setup, restart on resume, and restart on failure. The web service sets environment variables, including a secret reference. The storybook service has autostart set to false. ```yaml services: - name: postgres command: docker compose up postgres - name: web command: pnpm dev cwd: apps/web port: 3000 environment: - name: DATABASE_URL value: postgres://localhost:5432/app - name: STRIPE_KEY secret: STRIPE_KEY - name: storybook command: pnpm storybook port: 6006 autostart: false tunnels: - name: stripe-webhooks port: 3001 ``` -------------------------------- ### Install missing packages with apt-get Source: https://docs.niteshift.dev/environment-configuration/setup-script Use this command to install additional packages that are not pre-baked into the Ubuntu 24.04 environment. The environment already includes Docker, Node.js 22, pnpm, npm, Python 3, uv, Go 1.24, gh, AWS CLI, ripgrep, jq, build-essential, and unzip. ```bash apt-get update && apt-get install -y postgresql-client redis-tools ``` -------------------------------- ### Run migrations and seed data on a new branch Source: https://docs.niteshift.dev/environment-configuration/database-branches Commands to run migrations and seed data against the new branch before the agent starts work. The connection string is injected as an environment variable (default DATABASE_URL). ```bash pnpm db:migrate pnpm db:seed ``` -------------------------------- ### Preview URL format for HTTP ports Source: https://docs.niteshift.dev/environment-configuration/setup-script Each bound HTTP port gets a secure URL with this format. The URL is scoped to your organization and requires an authenticated Niteshift session to view. ```text https://ns-{port}-{previewId}.preview.niteshift.dev ``` -------------------------------- ### ns CLI service management commands Source: https://docs.niteshift.dev/environment-configuration/services Use these commands to inspect and drive services from the terminal tab or agent. The first shows setup result and service states, the second fetches the last 100 lines of the web service logs, and the third restarts the web service. ```bash ns services status # setup result and every service's state ns services logs web -n 100 ns services restart web ``` -------------------------------- ### Trigger a task from a pull request with /niteshift Source: https://docs.niteshift.dev/interfaces/github Use on a pull request you authored to start a task scoped to that PR. Only the PR author can trigger this command. A bare /niteshift with no prompt runs autofix against the PR's current state. ```text /niteshift fix the failing tests ``` -------------------------------- ### Custom instruction to encourage browser usage Source: https://docs.niteshift.dev/browser-automation Add this instruction to your environment settings to encourage agents to use the browser for testable changes. It requires the /browser, /screenshots, and /demo slash commands. ```text If a change is testable via a browser (e.g. a UI change to web app) you must use /browser /screenshots and /demo ``` -------------------------------- ### Trigger a task from a GitHub issue with /niteshift Source: https://docs.niteshift.dev/interfaces/github Use on a GitHub issue to start a task from it. Any organization member can trigger from an issue, with no author restriction. The task starts on the repository's default branch with the issue title, description, and your comment as its prompt. ```text /niteshift add a retry with backoff here ``` -------------------------------- ### API key headers for custom MCP server Source: https://docs.niteshift.dev/customizing-agents/mcp Use this header format when adding a custom MCP server with API key authentication. Reference secrets stored as Agent env vars using ${ENV_VAR} syntax. ```txt Authorization=Bearer ${ACME_MCP_TOKEN} X-Workspace=${ACME_WORKSPACE_ID} ```