Surflet

CLI Tool

Command-line tool usage guide

Installation

The CLI tool is installed alongside the Python SDK:

pip install surflet

Once installed, the surflet command is available.

Configuration

Configure your API connection via environment variables:

export SURFLET_API_KEY=sk_live_...
export SURFLET_API_URL=https://api.surflet.app

For local development:

export SURFLET_API_KEY=sk_test_surflet123
export SURFLET_API_URL=http://localhost:3001

Command Reference

publish — Publish a Page

# Simple publish
surflet publish --title "Deploy Report" --content "Build #456 deployed successfully"

# Publish from a file
surflet publish --title "Analysis Report" --file ./report.md

# Specify type and notification
surflet publish \
  --title "Refund Approval" \
  --type approval \
  --content "Please review the refund request" \
  --notify "slack:#cs-approvals"

# Publish from a JSON payload
surflet publish --payload ./approval-payload.json

Parameters:

ParameterDescriptionRequired
--titlePage titleYes
--contentMarkdown contentOne of --file/--payload
--fileRead content from a Markdown fileOne of --content/--payload
--payloadRead the full payload from a JSON fileOne of --content/--file
--typePage type (briefing/approval/review/form/dashboard)No
--notifyNotification channel (e.g. slack:#channel)No
--accessAccess mode (public/authenticated)No
--jsonOutput result as JSONNo

inbox — View Inbox

# View all pending items
surflet inbox

# Filter by status
surflet inbox --status pending
surflet inbox --status completed

# Pagination
surflet inbox --page 2 --per-page 20

# JSON output
surflet inbox --json

Parameters:

ParameterDescriptionDefault
--statusFilter by status (pending/completed/all)all
--pagePage number1
--per-pageItems per page10
--jsonJSON outputNo

approve — Approve

surflet approve pg_xxx --comment "Looks good"

Parameters:

ParameterDescriptionRequired
page_idPage ID (positional argument)Yes
--commentApproval commentNo

reject — Reject

surflet reject pg_xxx --comment "Need more details about the damage"

Parameters:

ParameterDescriptionRequired
page_idPage ID (positional argument)Yes
--commentRejection reasonNo (but recommended)

get — View a Page

# View page details
surflet get pg_xxx

# JSON output
surflet get pg_xxx --json

revoke — Revoke a Page

surflet revoke pg_xxx

status — View Approval Status

surflet status pg_xxx

Outputs the current state of the approval chain, including the approvers, status, and timestamp for each step.

Piping and Script Integration

The CLI supports --json output for easy integration with other tools:

# Publish and extract the URL
PAGE_URL=$(surflet publish --title "Report" --content "..." --json | jq -r '.pageUrl')
echo "Published: $PAGE_URL"

# Batch-check pending items
surflet inbox --status pending --json | jq '.items[] | .title'

# Use in CI/CD
surflet publish \
  --title "Deploy Approval: $CI_COMMIT_SHA" \
  --type approval \
  --file ./deploy-summary.md \
  --notify "slack:#deploys" \
  --json

Exit Codes

Exit CodeMeaning
0Success
1General error
2Authentication failed (invalid API Key)
3Page not found
4Insufficient permissions