Set up Haystack verification for your project
npm install @haystackeditor/cliSet up Haystack verification for your project. When PRs are opened, an AI agent spins up your app in a sandbox and verifies changes work correctly.
``bash`
npx @haystackeditor/cli init
This auto-detects your framework, package manager, and ports, then creates:
- .haystack.yml - Configuration for the verification agent.agents/skills/haystack.md
- - Skill file for AI agent discovery
Interactive setup wizard:
`bash`
npx @haystackeditor/cli init # Interactive wizard
npx @haystackeditor/cli init -y # Accept all defaults
Check if your project is configured:
`bash`
npx @haystackeditor/cli status
Authenticate with GitHub (required for secrets management):
`bash`
npx @haystackeditor/cli login
This uses GitHub's device flow - you'll get a code to enter at github.com/login/device.
`bash`Log out (removes stored credentials)
npx @haystackeditor/cli logout
Manage secrets that will be injected into your sandbox environment:
`bashList all secrets (keys only, values are never shown)
npx @haystackeditor/cli secrets list
Secrets are encrypted and stored securely. They're automatically injected as environment variables when the sandbox runs your app.
Scopes: By default, secrets are user-scoped. You can also scope to an org or repo:
`bash
Org-scoped (available to all repos in the org)
npx @haystackeditor/cli secrets set API_KEY xxx --scope org --scope-id myorgRepo-scoped (available only to this repo)
npx @haystackeditor/cli secrets set API_KEY xxx --scope repo --scope-id owner/repo
`Configuration
The
init command creates .haystack.yml:`yaml
version: "1"
name: my-appdev_server:
command: pnpm dev
port: 3000
ready_pattern: "Local:"
env:
SKIP_AUTH: "true"
verification:
commands:
- name: build
run: pnpm build
- name: lint
run: pnpm lint
`$3
| If your app has... | Add this |
|-------------------|----------|
| Login/authentication | Auth bypass env var in
dev_server.env |
| Key user journeys | Flows describing what to verify |
| API calls needing auth | Fixtures to mock responses |See the generated
.agents/skills/haystack.md for full documentation on flows, fixtures, and monorepo configuration.How It Works
1. You run
npx @haystackeditor/cli init` and commit the configMIT