hookdeck-cli 1.1.0 → 1.2.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +437 -2
  2. package/bin/hookdeck +0 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,8 @@ Hookdeck for development is completely free, and we monetize the platform with o
14
14
 
15
15
  For a complete reference, see the [CLI reference](https://hookdeck.com/docs/cli?ref=github-hookdeck-cli).
16
16
 
17
- https://github.com/user-attachments/assets/5fca7842-9c41-411c-8cd6-2f32f84fa907
17
+ https://github.com/user-attachments/assets/7a333c5b-e4cb-45bb-8570-29fafd137bd2
18
+
18
19
 
19
20
  ## Installation
20
21
 
@@ -28,6 +29,12 @@ Hookdeck CLI is distributed as an NPM package:
28
29
  npm install hookdeck-cli -g
29
30
  ```
30
31
 
32
+ To install a beta (pre-release) version:
33
+
34
+ ```sh
35
+ npm install hookdeck-cli@beta -g
36
+ ```
37
+
31
38
  ### macOS
32
39
 
33
40
  Hookdeck CLI is available on macOS via [Homebrew](https://brew.sh/):
@@ -36,6 +43,12 @@ Hookdeck CLI is available on macOS via [Homebrew](https://brew.sh/):
36
43
  brew install hookdeck/hookdeck/hookdeck
37
44
  ```
38
45
 
46
+ To install a beta (pre-release) version:
47
+
48
+ ```sh
49
+ brew install hookdeck/hookdeck/hookdeck-beta
50
+ ```
51
+
39
52
  ### Windows
40
53
 
41
54
  Hookdeck CLI is available on Windows via the [Scoop](https://scoop.sh/) package manager:
@@ -45,6 +58,12 @@ scoop bucket add hookdeck https://github.com/hookdeck/scoop-hookdeck-cli.git
45
58
  scoop install hookdeck
46
59
  ```
47
60
 
61
+ To install a beta (pre-release) version:
62
+
63
+ ```sh
64
+ scoop install hookdeck-beta
65
+ ```
66
+
48
67
  ### Linux Or without package managers
49
68
 
50
69
  To install the Hookdeck CLI on Linux without a package manager:
@@ -53,6 +72,8 @@ To install the Hookdeck CLI on Linux without a package manager:
53
72
  2. Unzip the file: tar -xvf hookdeck_X.X.X_linux_amd64.tar.gz
54
73
  3. Run the executable: ./hookdeck
55
74
 
75
+ For beta (pre-release) versions, download the `.deb` or `.rpm` packages from the [GitHub releases page](https://github.com/hookdeck/hookdeck-cli/releases) (look for releases marked as "Pre-release").
76
+
56
77
  ### Docker
57
78
 
58
79
  The CLI is also available as a Docker image: [`hookdeck/hookdeck-cli`](https://hub.docker.com/r/hookdeck/hookdeck-cli).
@@ -62,6 +83,14 @@ docker run --rm -it hookdeck/hookdeck-cli version
62
83
  hookdeck version x.y.z (beta)
63
84
  ```
64
85
 
86
+ To use a specific version (including beta releases), specify the version tag:
87
+
88
+ ```sh
89
+ docker run --rm -it hookdeck/hookdeck-cli:v1.2.3-beta.1 version
90
+ ```
91
+
92
+ Note: Beta releases do not update the `latest` tag. Only stable releases update `latest`.
93
+
65
94
  If you want to login to your Hookdeck account with the CLI and persist
66
95
  credentials, you can bind mount the `~/.config/hookdeck` directory:
67
96
 
@@ -111,7 +140,16 @@ hookdeck login --interactive
111
140
  Start a session to forward your events to an HTTP server.
112
141
 
113
142
  ```sh
114
- hookdeck listen <port-or-URL> <source-alias?> <connection-query?> [--path?] [--output?]
143
+ hookdeck listen <port-or-URL> <source-alias?> <connection-query?> [flags]
144
+
145
+ Flags:
146
+ --path string Sets the path to which events are forwarded (e.g., /webhooks or /api/stripe)
147
+ --output string Output mode: interactive (full UI), compact (simple logs), quiet (only fatal errors) (default "interactive")
148
+ --max-connections int Maximum concurrent connections to local endpoint (default: 50, increase for high-volume testing)
149
+ --filter-body string Filter events by request body using Hookdeck filter syntax (JSON)
150
+ --filter-headers string Filter events by request headers using Hookdeck filter syntax (JSON)
151
+ --filter-query string Filter events by query parameters using Hookdeck filter syntax (JSON)
152
+ --filter-path string Filter events by request path using Hookdeck filter syntax (JSON)
115
153
  ```
116
154
 
117
155
  Hookdeck works by routing events received for a given `source` (i.e., Shopify, Github, etc.) to its defined `destination` by connecting them with a `connection` to a `destination`. The CLI allows you to receive events for any given connection and forward them to your localhost at the specified port or any valid URL.
@@ -410,6 +448,27 @@ Events • [↑↓] Navigate ─────────────────
410
448
  > ✓ Last event succeeded with status 200 | [r] Retry • [o] Open in dashboard • [d] Show data
411
449
  ```
412
450
 
451
+ ### Manage connections
452
+
453
+ Create and manage webhook connections between sources and destinations with inline resource creation, authentication, processing rules, and lifecycle management. For detailed examples with authentication, filters, retry rules, and rate limiting, see the complete [connection management](#manage-connections) section below.
454
+
455
+ ```sh
456
+ hookdeck connection [command]
457
+
458
+ # Available commands
459
+ hookdeck connection list # List all connections
460
+ hookdeck connection get # Get connection details
461
+ hookdeck connection create # Create a new connection
462
+ hookdeck connection upsert # Create or update a connection (idempotent)
463
+ hookdeck connection delete # Delete a connection
464
+ hookdeck connection enable # Enable a connection
465
+ hookdeck connection disable # Disable a connection
466
+ hookdeck connection pause # Pause a connection
467
+ hookdeck connection unpause # Unpause a connection
468
+ hookdeck connection archive # Archive a connection
469
+ hookdeck connection unarchive # Unarchive a connection
470
+ ```
471
+
413
472
  ### Manage active project
414
473
 
415
474
  If you are a part of multiple projects, you can switch between them using our project management commands.
@@ -476,6 +535,264 @@ hookdeck project use [<organization_name> [<project_name>]]
476
535
  Upon successful selection, you will generally see a confirmation message like:
477
536
  `Successfully set active project to: [<organization_name>] <project_name>`
478
537
 
538
+ ### Manage connections
539
+
540
+ Connections link sources to destinations and define how events are processed. You can create connections, including source/destination definitions, configure authentication, add processing rules (retry, filter, transform, delay, deduplicate), and manage their lifecycle.
541
+
542
+ #### Create a connection
543
+
544
+ Create a new connection between a source and destination. You can create the source and destination inline or reference existing resources:
545
+
546
+ ```sh
547
+ # Basic connection with inline source and destination
548
+ $ hookdeck connection create \
549
+ --source-name "github-repo" \
550
+ --source-type GITHUB \
551
+ --destination-name "ci-system" \
552
+ --destination-type HTTP \
553
+ --destination-url "https://api.example.com/webhooks"
554
+
555
+ ✔ Connection created successfully
556
+ Connection: github-repo-to-ci-system (conn_abc123)
557
+ Source: github-repo (src_xyz789)
558
+ Source URL: https://hkdk.events/src_xyz789
559
+ Destination: ci-system (dst_def456)
560
+
561
+ # Using existing source and destination
562
+ $ hookdeck connection create \
563
+ --source "existing-source-name" \
564
+ --destination "existing-dest-name" \
565
+ --name "new-connection" \
566
+ --description "Connects existing resources"
567
+ ```
568
+
569
+ #### Add source authentication
570
+
571
+ Verify webhooks from providers like Stripe, GitHub, or Shopify by adding source authentication:
572
+
573
+ ```sh
574
+ # Stripe webhook signature verification
575
+ $ hookdeck connection create \
576
+ --source-name "stripe-prod" \
577
+ --source-type STRIPE \
578
+ --source-webhook-secret "whsec_abc123xyz" \
579
+ --destination-name "payment-api" \
580
+ --destination-type HTTP \
581
+ --destination-url "https://api.example.com/webhooks/stripe"
582
+
583
+ # GitHub webhook signature verification
584
+ $ hookdeck connection create \
585
+ --source-name "github-webhooks" \
586
+ --source-type GITHUB \
587
+ --source-webhook-secret "ghp_secret123" \
588
+ --destination-name "ci-system" \
589
+ --destination-type HTTP \
590
+ --destination-url "https://ci.example.com/webhook"
591
+ ```
592
+
593
+ #### Add destination authentication
594
+
595
+ Secure your destination endpoint with bearer tokens, API keys, or basic authentication:
596
+
597
+ ```sh
598
+ # Destination with bearer token
599
+ $ hookdeck connection create \
600
+ --source-name "webhook-source" \
601
+ --source-type HTTP \
602
+ --destination-name "secure-api" \
603
+ --destination-type HTTP \
604
+ --destination-url "https://api.example.com/webhooks" \
605
+ --destination-bearer-token "bearer_token_xyz"
606
+
607
+ # Destination with API key
608
+ $ hookdeck connection create \
609
+ --source-name "webhook-source" \
610
+ --source-type HTTP \
611
+ --destination-name "api-endpoint" \
612
+ --destination-type HTTP \
613
+ --destination-url "https://api.example.com/webhooks" \
614
+ --destination-api-key "your_api_key"
615
+
616
+ # Destination with custom headers
617
+ $ hookdeck connection create \
618
+ --source-name "webhook-source" \
619
+ --source-type HTTP \
620
+ --destination-name "custom-api" \
621
+ --destination-type HTTP \
622
+ --destination-url "https://api.example.com/webhooks"
623
+ ```
624
+
625
+ #### Configure retry rules
626
+
627
+ Add automatic retry logic with exponential or linear backoff:
628
+
629
+ ```sh
630
+ # Exponential backoff retry strategy
631
+ $ hookdeck connection create \
632
+ --source-name "payment-webhooks" \
633
+ --source-type STRIPE \
634
+ --destination-name "payment-api" \
635
+ --destination-type HTTP \
636
+ --destination-url "https://api.example.com/payments" \
637
+ --rule-retry-strategy exponential \
638
+ --rule-retry-count 5 \
639
+ --rule-retry-interval 60000
640
+ ```
641
+
642
+ #### Add event filters
643
+
644
+ Filter events based on request body, headers, path, or query parameters:
645
+
646
+ ```sh
647
+ # Filter by event type in body
648
+ $ hookdeck connection create \
649
+ --source-name "events" \
650
+ --source-type HTTP \
651
+ --destination-name "processor" \
652
+ --destination-type HTTP \
653
+ --destination-url "https://api.example.com/process" \
654
+ --rule-filter-body '{"event_type":"payment.succeeded"}'
655
+
656
+ # Combined filtering
657
+ $ hookdeck connection create \
658
+ --source-name "shopify-webhooks" \
659
+ --source-type SHOPIFY \
660
+ --destination-name "order-processor" \
661
+ --destination-type HTTP \
662
+ --destination-url "https://api.example.com/orders" \
663
+ --rule-filter-body '{"type":"order"}' \
664
+ --rule-retry-strategy exponential \
665
+ --rule-retry-count 3
666
+ ```
667
+
668
+ #### Configure rate limiting
669
+
670
+ Control the rate of event delivery to your destination:
671
+
672
+ ```sh
673
+ # Limit to 100 requests per minute
674
+ $ hookdeck connection create \
675
+ --source-name "high-volume-source" \
676
+ --source-type HTTP \
677
+ --destination-name "rate-limited-api" \
678
+ --destination-type HTTP \
679
+ --destination-url "https://api.example.com/endpoint" \
680
+ --destination-rate-limit 100 \
681
+ --destination-rate-limit-period minute
682
+ ```
683
+
684
+ #### Upsert connections
685
+
686
+ Create or update connections idempotently based on connection name - perfect for CI/CD and infrastructure-as-code workflows:
687
+
688
+ ```sh
689
+ # Create if doesn't exist, update if it does
690
+ $ hookdeck connection upsert my-connection \
691
+ --source-name "stripe-prod" \
692
+ --source-type STRIPE \
693
+ --destination-name "api-prod" \
694
+ --destination-type HTTP \
695
+ --destination-url "https://api.example.com"
696
+
697
+ # Partial update of existing connection
698
+ $ hookdeck connection upsert my-connection \
699
+ --description "Updated description" \
700
+ --rule-retry-count 5
701
+
702
+ # Preview changes without applying (dry-run)
703
+ $ hookdeck connection upsert my-connection \
704
+ --description "New description" \
705
+ --dry-run
706
+
707
+ -- Dry Run: UPDATE --
708
+ Connection 'my-connection' (conn_123) will be updated with the following changes:
709
+ - Description: "New description"
710
+ ```
711
+
712
+ #### List and filter connections
713
+
714
+ View all connections with flexible filtering options:
715
+
716
+ ```sh
717
+ # List all connections
718
+ $ hookdeck connection list
719
+
720
+ # Filter by source or destination
721
+ $ hookdeck connection list --source src_abc123
722
+ $ hookdeck connection list --destination dest_xyz789
723
+
724
+ # Filter by name pattern
725
+ $ hookdeck connection list --name "production-*"
726
+
727
+ # Include disabled or paused connections
728
+ $ hookdeck connection list --disabled
729
+ $ hookdeck connection list --paused
730
+
731
+ # Output as JSON
732
+ $ hookdeck connection list --output json
733
+ ```
734
+
735
+ #### Get connection details
736
+
737
+ View detailed information about a specific connection:
738
+
739
+ ```sh
740
+ # Get by ID
741
+ $ hookdeck connection get conn_123abc
742
+
743
+ # Get by name
744
+ $ hookdeck connection get "my-connection"
745
+
746
+ # Get as JSON
747
+ $ hookdeck connection get conn_123abc --output json
748
+ ```
749
+
750
+ #### Connection lifecycle management
751
+
752
+ Control connection state and event processing behavior:
753
+
754
+ ```sh
755
+ # Disable a connection (stops receiving events entirely)
756
+ $ hookdeck connection disable conn_123abc
757
+
758
+ # Enable a disabled connection
759
+ $ hookdeck connection enable conn_123abc
760
+
761
+ # Pause a connection (queues events without forwarding)
762
+ $ hookdeck connection pause conn_123abc
763
+
764
+ # Resume a paused connection
765
+ $ hookdeck connection unpause conn_123abc
766
+
767
+ # Archive a connection (hide from main lists)
768
+ $ hookdeck connection archive conn_123abc
769
+
770
+ # Restore an archived connection
771
+ $ hookdeck connection unarchive conn_123abc
772
+ ```
773
+
774
+ **State differences:**
775
+ - **Disabled**: Connection stops receiving events entirely
776
+ - **Paused**: Connection queues events but doesn't forward them (useful during maintenance)
777
+ - **Archived**: Connection is hidden from main lists but can be restored
778
+
779
+ #### Delete a connection
780
+
781
+ Delete a connection permanently:
782
+
783
+ ```sh
784
+ # Delete with confirmation prompt
785
+ $ hookdeck connection delete conn_123abc
786
+
787
+ # Delete by name
788
+ $ hookdeck connection delete "my-connection"
789
+
790
+ # Skip confirmation
791
+ $ hookdeck connection delete conn_123abc --force
792
+ ```
793
+
794
+ For complete flag documentation and all examples, see the [CLI reference](https://hookdeck.com/docs/cli?ref=github-hookdeck-cli).
795
+
479
796
  ## Configuration files
480
797
 
481
798
  The Hookdeck CLI uses configuration files to store the your keys, project settings, profiles, and other configurations.
@@ -613,6 +930,40 @@ Then run the locally generated `hookdeck-cli` binary:
613
930
  ./hookdeck-cli
614
931
  ```
615
932
 
933
+ ## Testing
934
+
935
+ ### Running Acceptance Tests
936
+
937
+ The Hookdeck CLI includes comprehensive acceptance tests written in Go. These tests verify end-to-end functionality by executing the CLI and validating outputs.
938
+
939
+ **Local testing:**
940
+
941
+ ```bash
942
+ # Run all acceptance tests
943
+ go test ./test/acceptance/... -v
944
+
945
+ # Run specific test
946
+ go test ./test/acceptance/... -v -run TestCLIBasics
947
+
948
+ # Skip acceptance tests (short mode)
949
+ go test ./test/acceptance/... -short
950
+ ```
951
+
952
+ **Environment setup:**
953
+
954
+ For local testing, create a `.env` file in `test/acceptance/`:
955
+
956
+ ```bash
957
+ # test/acceptance/.env
958
+ HOOKDECK_CLI_TESTING_API_KEY=your_api_key_here
959
+ ```
960
+
961
+ **CI/CD:**
962
+
963
+ In CI environments, set the `HOOKDECK_CLI_TESTING_API_KEY` environment variable directly in your workflow configuration or repository secrets.
964
+
965
+ For detailed testing documentation and troubleshooting, see [`test/acceptance/README.md`](test/acceptance/README.md).
966
+
616
967
  ### Testing against a local API
617
968
 
618
969
  When testing against a non-production Hookdeck API, you can use the
@@ -633,6 +984,90 @@ docker run --rm -it \
633
984
  http://host.docker.internal:1234
634
985
  ```
635
986
 
987
+ ## Releasing
988
+
989
+ This section describes the branching strategy and release process for the Hookdeck CLI.
990
+
991
+ ### Branching Strategy
992
+
993
+ The project uses two primary branches:
994
+
995
+ - **`main`** - The stable, production-ready branch. All production releases are created from this branch.
996
+ - **`next`** - The beta/pre-release branch. All new features are merged here first for testing before being promoted to `main`.
997
+
998
+ ### Beta Releases
999
+
1000
+ Beta releases allow you to publish pre-release versions for testing without blocking the `main` branch or affecting stable releases.
1001
+
1002
+ **Process:**
1003
+
1004
+ 1. Ensure all desired features are merged into the `next` branch
1005
+ 2. Pull the latest changes locally:
1006
+ ```sh
1007
+ git checkout next
1008
+ git pull origin next
1009
+ ```
1010
+ 3. Create and push a beta tag with a pre-release identifier:
1011
+ ```sh
1012
+ git tag v1.2.3-beta.0
1013
+ git push origin v1.2.3-beta.0
1014
+ ```
1015
+ 4. The GitHub Actions workflow will automatically:
1016
+ - Build binaries for all platforms (macOS, Linux, Windows)
1017
+ - Create a GitHub pre-release (marked as "Pre-release")
1018
+ - Publish to NPM with the `beta` tag
1019
+ - Create beta packages:
1020
+ - Homebrew: `hookdeck-beta` formula
1021
+ - Scoop: `hookdeck-beta` package
1022
+ - Docker: Tagged with the version (e.g., `v1.2.3-beta.0`), but not `latest`
1023
+
1024
+ **Installing beta releases:**
1025
+
1026
+ ```sh
1027
+ # NPM
1028
+ npm install hookdeck-cli@beta -g
1029
+
1030
+ # Homebrew
1031
+ brew install hookdeck/hookdeck/hookdeck-beta
1032
+
1033
+ # Scoop
1034
+ scoop install hookdeck-beta
1035
+
1036
+ # Docker
1037
+ docker run hookdeck/hookdeck-cli:v1.2.3-beta.0 version
1038
+ ```
1039
+
1040
+ ### Production Releases
1041
+
1042
+ Production releases are created from the `main` branch using GitHub's release interface.
1043
+
1044
+ **Process:**
1045
+
1046
+ 1. Merge the `next` branch into `main`:
1047
+ ```sh
1048
+ git checkout main
1049
+ git pull origin main
1050
+ git merge next
1051
+ git push origin main
1052
+ ```
1053
+ 2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
1054
+ 3. Click "Draft a new release"
1055
+ 4. Create a new tag with a stable version (e.g., `v1.3.0`)
1056
+ 5. Target the `main` branch
1057
+ 6. Generate release notes or write them manually
1058
+ 7. Publish the release
1059
+
1060
+ The GitHub Actions workflow will automatically:
1061
+ - Build binaries for all platforms
1062
+ - Create a stable GitHub release
1063
+ - Publish to NPM with the `latest` tag
1064
+ - Update package managers:
1065
+ - Homebrew: `hookdeck` formula
1066
+ - Scoop: `hookdeck` package
1067
+ - Docker: Updates both the version tag and `latest`
1068
+
1069
+ **Note:** Only stable releases (without pre-release identifiers) will update the `latest` tags across all distribution channels.
1070
+
636
1071
  ## License
637
1072
 
638
1073
  Copyright (c) Hookdeck. All rights reserved.
package/bin/hookdeck CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hookdeck-cli",
3
- "version": "1.1.0",
3
+ "version": "1.2.0-beta.1",
4
4
  "description": "Hookdeck CLI",
5
5
  "repository": {
6
6
  "type": "git",