@spike-forms/cli
v0.2.5
Published
Command-line interface for the Spike Forms API
Maintainers
Readme
Spike Forms CLI
Command-line interface for managing Spike Forms - forms, submissions, projects, and teams.
Installation
npm install -g @spike-forms/cliQuick Start
# Authenticate via browser
spike login
# Create a form with live preview
spike forms create-page --name "Contact Form" --preview
# Edit and save changes
spike forms save
# List your forms
spike forms listAuthentication
Browser Login (Recommended)
The login command opens your browser to authenticate and automatically saves your API key:
spike loginOptions:
--timeout <seconds>- Set login timeout (default: 120s)--no-browser- Display URL instead of opening browser automatically
Manual Configuration
# Set API key directly
spike config set api-key <your-api-key>
# View current config
spike config get api-keyForms Management
Basic Operations
# List all forms
spike forms list
spike forms list --limit 10 --format json
# Get form details
spike forms get <form-id>
# Create a form
spike forms create --name "Contact Form"
# Update a form
spike forms update <form-id> --name "New Name"
spike forms update <form-id> --is-active false
# Delete a form
spike forms delete <form-id>Live Preview Workflow
Edit forms locally with instant browser refresh. HTML is stored on the server (S3).
# Edit existing form with live preview (fetches HTML from server)
spike forms edit <form-id>
# Run preview server in background
spike forms edit <form-id> --background
# Save local changes back to server
spike forms save
spike forms save <form-id> --file ./my-form.html
# Stop background preview server
spike forms stop-previewThe preview server:
- Fetches HTML from server (S3) when you start editing
- Watches your local HTML file for changes
- Auto-refreshes the browser via Server-Sent Events
- Runs on
http://127.0.0.1with a dynamic port
Create Form Page (Beta)
Create a new form and generate an HTML template in one command:
# Create form and HTML file (saves to server automatically)
spike forms create-page --name "Contact Form"
# Create and start preview immediately
spike forms create-page --name "Contact Form" --preview
# Save to custom path
spike forms create-page --name "Contact Form" --file ./contact.htmlThe generated HTML includes:
- Responsive form layout with basic styling
- Form action pointing to your form's submission endpoint (
/f/{slug}) - Name, email, and message fields (customize as needed)
Complete Edit Workflow
Start editing:
spike forms edit <form-id>- Fetches HTML from server (S3)
- Saves to local file (
./form.html) - Starts live preview server
- Opens browser
Make changes: Edit
./form.htmlin your editor- Browser auto-refreshes on save
Save to server:
spike forms save- Uploads HTML back to server (S3)
- Dashboard iframe will show updated form
Stop preview: Press
Ctrl+Cor runspike forms stop-preview
Submissions
# List submissions for a form
spike submissions list --form-id <form-id>
# Get submission details
spike submissions get <submission-id>
# Delete a submission
spike submissions delete <submission-id>Projects & Teams
# Projects
spike projects list
spike projects create --name "Website Forms"
spike projects get <project-id>
# Teams
spike teams list
spike teams create --name "Marketing"
spike teams get <team-id>AI Agent Integration
Launch OpenCode with Spike Forms knowledge:
# Launch OpenCode (must be installed)
spike agent
# Install OpenCode if not present
spike agent --install
# Use specific model
spike agent --model gpt-4The agent command installs a skill file that teaches OpenCode about all CLI commands.
Configuration
Config file location: ~/.spike/config.json
# Set values
spike config set api-key <key>
spike config set base-url <url>
# Get values
spike config get api-key
spike config get base-urlEnvironment Variables
SPIKE_API_KEYorSPIKE_TOKEN- API key for authenticationSPIKE_API_URL- Custom API base URLSPIKE_DASHBOARD_URL- Custom dashboard URL for login
How It Works
Form HTML Storage
Form HTML templates are stored in S3:
spike forms editfetches HTML from API → API fetches from S3 → returns to CLIspike forms saveuploads HTML to API → API stores in S3- Dashboard iframe loads HTML from S3 URL stored in form's
html_urlfield
Form Submission Flow
- User visits form page (HTML served from S3 or embedded)
- Form action points to
/f/{slug}on the Spike API - Submissions are stored in database
- View submissions via CLI or dashboard
Login Flow
- CLI generates a secure state token
- Opens browser to dashboard consent page
- User approves CLI access
- Dashboard creates API key and redirects to CLI callback
- CLI saves the API key to config
