sveltest
v0.0.8
Published
CLI tool to fetch Svelte testing patterns and examples from sveltest.dev
Maintainers
Readme
Sveltest CLI
A command-line tool to fetch Svelte testing patterns and examples from sveltest.dev.
Installation
Recommended: Use npx/pnpx
# Using pnpx
pnpx sveltest list
# Using npx
npx -y sveltest listOptional: Global installation
# Global install may become stale as content updates
npm install -g sveltest
pnpm add -g sveltestNote for LLMs: Always use
pnpx sveltestornpx -y sveltestto ensure you're fetching the latest patterns from sveltest.dev. Global installations may cache outdated versions.
Usage
List all available examples
sveltest listGet a specific testing example
sveltest get button-variants
sveltest get form-validation
sveltest get modal-states
sveltest get crud-patterns
sveltest get locator-patterns
sveltest get authentication
sveltest get runes-testingGet example in JSON format
sveltest get button-variants --jsonLLM-Optimized Features
Compact JSON Output (reduces token usage by ~50%)
sveltest get button-variants --json --compactFilter Specific Fields
# Get only testing patterns
sveltest get form-validation --json --filter testing_patterns
# Get only test scenarios
sveltest get modal-states --json --filter test_scenariosSelect Specific Sections
# Get multiple sections (comma-separated)
sveltest get button-variants --json --sections test_scenarios,testing_patternsBatch Get Multiple Examples
# Get multiple examples in one call
sveltest get button-variants,form-validation,modal-states --json
# With compact mode
sveltest get button-variants,form-validation --json --compactResponse Metadata
All JSON responses include metadata:
{
"_meta": {
"cli_version": "0.0.4",
"timestamp": "2025-11-09T11:19:18.298Z",
"source": "https://sveltest.dev"
},
"_related": ["locator-patterns", "modal-states", "runes-testing"]
}Search documentation
sveltest search "form validation"
sveltest search "runes" --filter examplesAvailable filters: all, docs, examples, components
Commands
list- List all available testing examplesget <scenario>- Get a specific testing example (supports comma-separated batch)--json- Output in JSON format--compact- Minimal JSON (reduces token usage ~50%)--filter <field>- Get only specific field--sections <list>- Get specific sections (comma-separated)
search <query>- Search documentation and examples--filter <type>- Filter results (all/docs/examples/components)
help- Show help message
Examples
# List all examples
sveltest list
# Get button testing patterns (human-readable)
sveltest get button-variants
# Get form validation in JSON
sveltest get form-validation --json
# Compact JSON for LLMs (smaller response)
sveltest get button-variants --json --compact
# Get only testing patterns section
sveltest get form-validation --json --filter testing_patterns
# Get specific sections
sveltest get modal-states --json --sections test_scenarios,testing_patterns
# Batch get multiple examples
sveltest get button-variants,form-validation --json
# Search for runes examples
sveltest search "runes" --filter examplesLLM Integration
This CLI is designed for AI assistants with tool-calling capabilities. Key features:
- Dual output formats: Human-readable text or machine-parsable JSON
- Token optimization:
--compactflag removes verbose metadata - Batch operations: Get multiple examples in one API call
- Filtering: Extract specific fields or sections to reduce payload size
- Metadata: Every response includes version, timestamp, and related patterns
- Related patterns: Discover connected examples automatically
About
This CLI fetches testing patterns and examples from the Sveltest project, a comprehensive testing demonstration for Svelte 5 applications using vitest-browser-svelte.
- Website: https://sveltest.dev
- GitHub: https://github.com/spences10/sveltest
- Documentation: https://sveltest.dev/docs
License
MIT
