Skip to content

Conversation

leggetter
Copy link
Collaborator

@leggetter leggetter commented Sep 1, 2025

Note: the purpose of this is to be a discussion point. Do we want this level of complexity in the CLI?

Overview

This PR creates a comprehensive new REFERENCE.md file that serves as the complete specification for the Hookdeck CLI. This documentation provides 100% parameter coverage, type-driven validation guidance, and full alignment with the OpenAPI specification, serving as both user documentation and implementation guide.

📝 What This PR Adds

1. Complete Parameter Documentation

  • Added comprehensive parameter lists at the top of each command section
  • Documented all possible arguments and flags for every CLI command
  • Included type-dependent parameter requirements with detailed validation rules
  • Specified positional arguments, optional flags, and required parameters

2. Type-Driven Validation Framework

  • Source Types: 96+ provider types with specific authentication patterns
  • Destination Types: HTTP, CLI, MOCK_API with authentication combinations
  • Issue Triggers: delivery, transformation, backpressure with conditional requirements
  • Connection Creation: Collision resolution using prefixed flags for inline resources

3. OpenAPI Specification Alignment

  • Validated every parameter against Hookdeck Open API spec

📋 Command Coverage

Current Functionality (✅ Complete)

Command Category Parameters Documented Key Features
Authentication --interactive/-i, --all/-a Complete parameter specifications
Projects Positional arguments, --profile Basic listing and switching only
Local Development --path, --no-wss, positional args Complete argument specification
CI/CD Integration --api-key, --name Environment variable defaults
Utilities --shell parameter Complete shell support

Planned Functionality (🚧 Comprehensive Specs)

Command Category Parameters Documented Key Features
Sources 96+ provider types, auth patterns Type-specific validation rules
Destinations HTTP/CLI/MOCK_API, auth combinations OAuth2, API key, basic auth support
Connections Inline resource creation, collision resolution Prefixed flags for complex scenarios
Transformations JavaScript code, environment variables Execution and testing capabilities
Events 15+ filtering options, search Comprehensive event querying
Attempts Advanced filtering, performance metrics Delivery attempt analysis and retry
Issue Triggers Type-driven validation, notification channels delivery/transformation/backpressure types
Bulk Operations Event/request/ignored-event retry JSON query filtering

🔧 Technical Improvements

Parameter Collision Resolution

# Before: Ambiguous parameter usage
hookdeck connection create --type STRIPE --type HTTP  # Collision!

# After: Clear collision resolution
hookdeck connection create --name "stripe-to-api" \
  --source-type STRIPE \
  --source-name "stripe-prod" \
  --webhook-secret "whsec_abc123" \
  --destination-type HTTP \
  --destination-name "my-api" \
  --destination-url "https://api.example.com/webhooks"

Type-Specific Validation

# Issue Trigger Validation Rules
- **delivery type**: Requires `--strategy` and `--connections`
  - `--strategy` values: `first_attempt`, `final_attempt`
  - `--connections` accepts: connection IDs, patterns, or `"*"`
- **transformation type**: Requires `--log-level` and `--transformations`
  - `--log-level` values: `debug`, `info`, `warn`, `error`, `fatal`
- **backpressure type**: Requires `--delay` and `--destinations`
  - `--delay` range: 60000-86400000 milliseconds (1 minute to 1 day)

Comprehensive Filtering & Pagination

# Event List Parameters (15+ options)
--id string              # Filter by event IDs (comma-separated)
--status string          # Filter by status (SUCCESSFUL, FAILED, PENDING)
--webhook-id string      # Filter by webhook ID (connection)
--search-term string     # Search in body/headers/path (minimum 3 characters)
--order-by string        # Sort by: created_at
--dir string             # Sort direction: asc, desc
--limit integer          # Limit number of results (0-255)
--next string            # Next page token for pagination

🛡️ Quality Assurance

OpenAPI Validation Results

  • 96 source types validated against API specification
  • Authentication patterns corrected (PayPal webhook_id fix)
  • Required vs optional parameters aligned with API requirements
  • Parameter constraints documented (limits, enums, formats)

📊 Metrics

Metric Current State New Documentation
Command Categories 6 basic commands 14 comprehensive categories
Parameter Documentation Basic usage examples Complete parameter specifications
Source Types General examples 96 specific provider types
Validation Rules None documented Type-driven validation patterns
API Alignment Not systematically verified 100% spec-compliant

🎯 Strategic Impact

For CLI Implementation

  • Complete parameter specifications for all commands enable straightforward implementation
  • Type-driven validation frameworks provide clear conditional logic patterns
  • Collision resolution strategies solve complex multi-resource command scenarios
  • API-compliant mappings ensure runtime compatibility

For Users

  • 100% parameter visibility - no hidden or undocumented functionality
  • Type-specific guidance - clear requirements for each provider/trigger type
  • Progressive complexity - from simple commands to advanced operations
  • Clear status indicators - ✅ current vs 🚧 planned functionality

For Development Planning

  • Comprehensive roadmap with 14 command categories
  • Implementation priorities clearly defined with current vs planned status
  • API validation foundation ensures specification compliance
  • Extensible patterns support future CLI enhancements

🚀 Developer Experience: CLI Quickstart

The comprehensive CLI specification enables developers to get started with Hookdeck using only terminal commands, minimizing external setup steps:

4-Step Quickstart Flow

# Step 1: Authenticate and create account
hookdeck login
# → Interactive flow creates account and authenticates CLI

# Step 2 (Optional): Create dedicated project for organization
hookdeck project create --name "My Dev Project" --description "Local development setup"
# → Creates isolated workspace; can skip and use default project

# Step 3: Create connection to receive Shopify webhooks locally
hookdeck connection create \
  --name "shopify-to-local" \
  --source-type SHOPIFY \
  --source-name "my-shopify-store" \
  --source-webhook-secret "your-shopify-webhook-secret" \
  --destination-type CLI \
  --destination-name "local-dev"

# Step 4: Start local forwarding (assumes local server on port 3000)
hookdeck listen 3000 my-shopify-store
# → Webhooks now forward from Shopify directly to localhost:3000

What This Achieves

  • Zero external setup: No dashboard navigation, no manual resource creation
  • Single authentication: hookdeck login handles both account creation and CLI auth
  • Project-based organization: Optional project creation introduces workspace concepts
  • Immediate local development: From zero to receiving webhooks in 4 commands (3 if skipping project creation)
  • Type-driven guidance: CLI validates Shopify-specific parameters automatically

Current vs. Planned Experience

Step Current CLI Planned CLI (This Spec)
Authentication hookdeck login hookdeck login
Project Management hookdeck project use (switching only) 🚧 hookdeck project create (optional workspace setup)
Resource Creation Requires dashboard 🚧 hookdeck connection create with inline resources
Local Forwarding hookdeck listen 3000 ✅ Enhanced with source selection

This quickstart demonstrates how the comprehensive CLI specification transforms the developer onboarding experience from multi-step, multi-interface setup to a pure terminal workflow, with optional project organization for better resource management.

📝 Documentation Structure

The new REFERENCE.md provides comprehensive parameter documentation with examples like:

# Source list command parameters
--name string         # Filter by name pattern (supports wildcards)
--type string         # Filter by source type (96+ types supported)
--disabled           # Include disabled sources (boolean flag)
--order-by string    # Sort by: name, created_at, updated_at
--dir string         # Sort direction: asc, desc
--limit integer      # Limit number of results (0-255)
--next string        # Next page token for pagination
--prev string        # Previous page token for pagination

# Source create command with type-specific parameters:
# When --type=STRIPE, GITHUB, SHOPIFY, SLACK, TWILIO, etc.:
--webhook-secret string     # Webhook secret for signature verification

# When --type=PAYPAL:
--webhook-id string         # PayPal webhook ID (not webhook_secret)

# When --type=GITLAB, OKTA, MERAKI, etc.:
--api-key string           # API key for authentication

# When --type=EBAY (complex multi-field authentication):
--environment string       # PRODUCTION or SANDBOX
--dev-id string           # Developer ID
--client-id string        # Client ID
--client-secret string    # Client secret
--verification-token string # Verification token

The new REFERENCE.md serves as the definitive specification for the Hookdeck CLI, providing complete parameter coverage, implementation guidance, and user documentation in a single, authoritative source that's fully validated against the actual API specification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant