login
Authenticate with the Prompts.dev platform using OAuth.Flags
OAuth provider to use for authentication. Supported values:
github, googleHow it works
The login command:- Generates a random state parameter for CSRF protection (see main.go:90-93)
- Starts a local callback server on
127.0.0.1:9876(see main.go:110) - Opens your browser to the OAuth provider’s login page (see main.go:135)
- Receives the authentication token via callback (see main.go:111-127)
- Stores the token in
~/.prompts/config.jsonwith0o600permissions (see main.go:395-403)
Examples
Expected output
The login flow times out after 2 minutes (see main.go:149-151).
init
Scaffold a new prompt package with the required file structure.Arguments
The name of the prompt package to create. This will be used as the directory name.
Flags
Overwrite existing files if they already exist
Generated files
Theinit command creates three files (see main.go:175-179):
prompt.yaml - Package manifest
prompt.yaml - Package manifest
prompt.md - Template content
prompt.md - Template content
{{variable}} syntax.README.md - Documentation
README.md - Documentation
Examples
Expected output
publish
Publish the current prompt package to the registry.Requirements
- Must be run from a directory containing
prompt.yaml - Must be authenticated (run
prompt loginfirst) - Manifest must have valid
nameandversionfields (see main.go:417-425)
How it works
The publish command:- Loads and validates
prompt.yaml(see main.go:205-211) - Creates the prompt in the registry or finds the existing one (see main.go:218-224)
- Creates a tarball of the current directory (see main.go:226-230)
- Uploads the tarball as a new version (see main.go:236-238)
Examples
Expected output
If a prompt with the same name already exists, you’ll get an error:
prompt already exists; fetch prompt id and publish a new version (see main.go:223)install
Install a prompt package from the registry.Arguments
The prompt package identifier. Format:
owner/name or owner/name@version- If version is omitted, installs the latest version (see main.go:270-279)
- Version is fetched from the API if not specified
Installation location
Prompts are installed to.prompts/[name]/ in the current directory (see main.go:286).
Examples
Expected output
run
Render a prompt template with provided variables.Arguments
The name of the installed prompt to run (from
.prompts/[name]/)Flags
Template variables to inject. Can be specified multiple times.Required variables are validated against the manifest (see main.go:318-324).
How it works
The run command:- Loads the manifest from
.prompts/[name]/prompt.yaml(see main.go:309-312) - Reads the template from
.prompts/[name]/prompt.md(see main.go:313-316) - Validates all required inputs are provided (see main.go:318-324)
- Performs simple string replacement:
{{key}}→ value (see main.go:326-329) - Prints the rendered prompt to stdout
Examples
Expected output
The rendered prompt text with variables replaced:search
Search for prompts in the registry.Arguments
Search query to find prompts by name, description, or tags
How it works
Results are:- Fetched from the API (see main.go:348)
- Sorted alphabetically by name (see main.go:353)
- Displayed in a formatted table (see main.go:354-359)
Examples
Expected output
Global behavior
Environment loading
The CLI automatically loads.env files from the current directory or any parent directory (see main.go:60-82).
Config directory
All commands ensure~/.prompts/ exists before running (see main.go:47-49).
Error handling
Errors are written to stderr and exit with code 1 (see main.go:54-57).Next steps
Workflow Guide
See these commands in action with real-world examples
API Reference
Learn about the underlying API used by the CLI