hookdeck-cli 1.6.0 → 1.7.0

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.
package/README.md CHANGED
@@ -394,7 +394,7 @@ hookdeck logout
394
394
 
395
395
  When forwarding events to an HTTPS URL as the first argument to `hookdeck listen` (e.g., `https://localhost:1234/webhook`), you might encounter SSL validation errors if the destination is using a self-signed certificate.
396
396
 
397
- For local development scenarios, you can instruct the `listen` command to bypass this SSL certificate validation by using its `--insecure` flag. You must provide the full HTTPS URL.
397
+ For local development scenarios, you can instruct the `listen` command to bypass this SSL certificate validation by using its `--insecure` flag. You must provide the full HTTPS URL. This flag also applies to the periodic server health checks that the CLI performs.
398
398
 
399
399
  **This is dangerous and should only be used in trusted local development environments for destinations you control.**
400
400
 
@@ -404,6 +404,14 @@ Example of skipping SSL validation for an HTTPS destination:
404
404
  hookdeck listen --insecure https://<your-ssl-url-or-url:port>/ <source-alias?> <connection-query?>
405
405
  ```
406
406
 
407
+ ### Disable health checks
408
+
409
+ The CLI periodically checks if your local server is reachable and displays warnings if the connection fails. If these health checks cause issues in your environment, you can disable them with the `--no-healthcheck` flag:
410
+
411
+ ```sh
412
+ hookdeck listen --no-healthcheck 3000 <source-alias?>
413
+ ```
414
+
407
415
  ### Version
408
416
 
409
417
  Print your CLI version and whether or not a new version is available.
@@ -1011,6 +1019,46 @@ Then run the locally generated `hookdeck-cli` binary:
1011
1019
  ./hookdeck-cli
1012
1020
  ```
1013
1021
 
1022
+ ### Testing the npm package build
1023
+
1024
+ To test the npm package build process locally (including the wrapper script), you can use the automated test script:
1025
+
1026
+ ```sh
1027
+ # Run the automated test script (recommended)
1028
+ ./test-scripts/test-npm-build.sh
1029
+ ```
1030
+
1031
+ The test script will:
1032
+ - Build all 6 platform binaries using GoReleaser
1033
+ - Verify the binaries directory structure
1034
+ - Test the wrapper script on your current platform
1035
+ - Verify npm pack includes all required files
1036
+
1037
+ **Manual testing (if you prefer step-by-step):**
1038
+
1039
+ ```sh
1040
+ # Install GoReleaser (if not already installed)
1041
+ # Option 1: Using Homebrew (recommended on macOS)
1042
+ brew install goreleaser
1043
+
1044
+ # Option 2: Download binary from GitHub releases
1045
+ # Visit https://github.com/goreleaser/goreleaser/releases/latest
1046
+
1047
+ # Build all platform binaries for npm
1048
+ goreleaser build -f .goreleaser/npm.yml --snapshot --clean
1049
+
1050
+ # Verify binaries directory structure
1051
+ ls -R binaries/
1052
+
1053
+ # Test the wrapper script on your platform
1054
+ node bin/hookdeck.js --version
1055
+
1056
+ # Test npm package creation (dry-run)
1057
+ npm pack --dry-run
1058
+ ```
1059
+
1060
+ This will create the `binaries/` directory with all 6 platform binaries, allowing you to test the wrapper script locally before publishing.
1061
+
1014
1062
  ## Testing
1015
1063
 
1016
1064
  ### Running Acceptance Tests
@@ -1045,6 +1093,36 @@ In CI environments, set the `HOOKDECK_CLI_TESTING_API_KEY` environment variable
1045
1093
 
1046
1094
  For detailed testing documentation and troubleshooting, see [`test/acceptance/README.md`](test/acceptance/README.md).
1047
1095
 
1096
+ ### Testing npm package and wrapper script
1097
+
1098
+ The npm package includes a wrapper script (`bin/hookdeck.js`) that detects the platform and executes the correct binary.
1099
+
1100
+ **Quick test (using automated script):**
1101
+
1102
+ ```sh
1103
+ ./test-scripts/test-npm-build.sh
1104
+ ```
1105
+
1106
+ **Manual testing:**
1107
+
1108
+ ```sh
1109
+ # Ensure GoReleaser is installed (see "Testing the npm package build" section above)
1110
+
1111
+ # Build all platform binaries
1112
+ goreleaser build -f .goreleaser/npm.yml --snapshot --clean
1113
+
1114
+ # Test wrapper script on current platform
1115
+ node bin/hookdeck.js version
1116
+
1117
+ # Verify wrapper script can find binary
1118
+ node bin/hookdeck.js --help
1119
+
1120
+ # Test npm pack includes all files
1121
+ npm pack --dry-run | grep -E "(bin/hookdeck.js|binaries/)"
1122
+ ```
1123
+
1124
+ **Note:** The wrapper script expects binaries in `binaries/{platform}-{arch}/hookdeck[.exe]`. When building locally, ensure all platforms are built or the wrapper will fail for missing platforms.
1125
+
1048
1126
  ### Testing against a local API
1049
1127
 
1050
1128
  When testing against a non-production Hookdeck API, you can use the
@@ -1067,40 +1145,59 @@ docker run --rm -it \
1067
1145
 
1068
1146
  ## Releasing
1069
1147
 
1070
- This section describes the branching strategy and release process for the Hookdeck CLI.
1148
+ This section describes the release process for the Hookdeck CLI.
1071
1149
 
1072
- ### Branching Strategy
1150
+ ## Release Process
1073
1151
 
1074
- The project uses two primary branches:
1152
+ The release workflow supports tagging from **ANY branch** - it automatically detects which branch contains the tag. This means you can create beta releases directly from feature branches for testing before merging to `main`.
1075
1153
 
1076
- - **`main`** - The stable, production-ready branch. All production releases are created from this branch.
1077
- - **`next`** - The beta/pre-release branch. All new features are merged here first for testing before being promoted to `main`.
1154
+ ### Stable Release (Preferred Method: GitHub UI)
1078
1155
 
1079
- ### Beta Releases
1156
+ 1. Ensure all tests pass on `main`
1157
+ 2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
1158
+ 3. Click "Draft a new release"
1159
+ 4. Create a new tag with a stable version (e.g., `v1.3.0`)
1160
+ 5. Target the `main` branch
1161
+ 6. Generate release notes or write them manually
1162
+ 7. Publish the release
1080
1163
 
1081
- Beta releases allow you to publish pre-release versions for testing without blocking the `main` branch or affecting stable releases.
1164
+ The GitHub Actions workflow will automatically:
1165
+ - Build binaries for all platforms
1166
+ - Create a stable GitHub release
1167
+ - Publish to NPM with the `latest` tag
1168
+ - Update package managers:
1169
+ - Homebrew: `hookdeck` formula
1170
+ - Scoop: `hookdeck` package
1171
+ - Docker: Updates both the version tag and `latest`
1082
1172
 
1083
- **Process:**
1173
+ **Alternative (Command Line):**
1174
+ ```bash
1175
+ git checkout main
1176
+ git tag v1.3.0
1177
+ git push origin v1.3.0
1178
+ # Then create release notes on GitHub Releases page
1179
+ ```
1084
1180
 
1085
- 1. Ensure all desired features are merged into the `next` branch
1086
- 2. Pull the latest changes locally:
1087
- ```sh
1088
- git checkout next
1089
- git pull origin next
1090
- ```
1091
- 3. Create and push a beta tag with a pre-release identifier:
1092
- ```sh
1093
- git tag v1.2.3-beta.0
1094
- git push origin v1.2.3-beta.0
1095
- ```
1096
- 4. The GitHub Actions workflow will automatically:
1097
- - Build binaries for all platforms (macOS, Linux, Windows)
1098
- - Create a GitHub pre-release (marked as "Pre-release")
1099
- - Publish to NPM with the `beta` tag
1100
- - Create beta packages:
1101
- - Homebrew: `hookdeck-beta` formula
1102
- - Scoop: `hookdeck-beta` package
1103
- - Docker: Tagged with the version (e.g., `v1.2.3-beta.0`), but not `latest`
1181
+ ### Pre-release from Main (General Beta Testing)
1182
+
1183
+ For general beta testing of features that have been merged to `main`:
1184
+
1185
+ **Preferred Method: GitHub UI**
1186
+ 1. Ensure `main` branch is in the desired state
1187
+ 2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
1188
+ 3. Click "Draft a new release"
1189
+ 4. Create a new tag with pre-release version (e.g., `v1.3.0-beta.1`)
1190
+ 5. Target the `main` branch
1191
+ 6. Check "Set as a pre-release"
1192
+ 7. Publish the release
1193
+ 8. GitHub Actions will build and publish with npm tag `beta`
1194
+
1195
+ **Alternative (Command Line):**
1196
+ ```bash
1197
+ git checkout main
1198
+ git tag v1.3.0-beta.1
1199
+ git push origin v1.3.0-beta.1
1200
+ ```
1104
1201
 
1105
1202
  **Installing beta releases:**
1106
1203
 
@@ -1118,39 +1215,77 @@ brew install hookdeck/hookdeck/hookdeck-beta
1118
1215
  scoop install hookdeck-beta
1119
1216
 
1120
1217
  # Docker
1121
- docker run hookdeck/hookdeck-cli:v1.2.3-beta.0 version
1218
+ docker run hookdeck/hookdeck-cli:v1.3.0-beta.1 version
1122
1219
  ```
1123
1220
 
1124
- ### Production Releases
1125
-
1126
- Production releases are created from the `main` branch using GitHub's release interface.
1221
+ ### Pre-release from Feature Branch (Feature-Specific Testing)
1127
1222
 
1128
- **Process:**
1223
+ For testing a specific feature in isolation before merging to main:
1129
1224
 
1130
- 1. Merge the `next` branch into `main`:
1131
- ```sh
1132
- git checkout main
1133
- git pull origin main
1134
- git merge next
1135
- git push origin main
1136
- ```
1225
+ **Preferred Method: GitHub UI**
1226
+ 1. Ensure your feature branch is pushed to origin
1137
1227
  2. Go to the [GitHub Releases page](https://github.com/hookdeck/hookdeck-cli/releases)
1138
1228
  3. Click "Draft a new release"
1139
- 4. Create a new tag with a stable version (e.g., `v1.3.0`)
1140
- 5. Target the `main` branch
1141
- 6. Generate release notes or write them manually
1142
- 7. Publish the release
1229
+ 4. Create a new tag with pre-release version (e.g., `v1.3.0-beta.1`)
1230
+ 5. Target your feature branch (e.g., `feat/my-feature`)
1231
+ 6. Check "Set as a pre-release"
1232
+ 7. Add notes about what's being tested
1233
+ 8. Publish the release
1234
+ 9. GitHub Actions will automatically detect the branch and build from it
1235
+
1236
+ **Alternative (Command Line):**
1237
+ ```bash
1238
+ git checkout feat/my-feature
1239
+ git tag v1.3.0-beta.1
1240
+ git push origin v1.3.0-beta.1
1241
+ # Then create release notes on GitHub Releases page
1242
+ ```
1143
1243
 
1144
- The GitHub Actions workflow will automatically:
1145
- - Build binaries for all platforms
1146
- - Create a stable GitHub release
1147
- - Publish to NPM with the `latest` tag
1148
- - Update package managers:
1149
- - Homebrew: `hookdeck` formula
1150
- - Scoop: `hookdeck` package
1151
- - Docker: Updates both the version tag and `latest`
1244
+ **Installing beta releases:**
1245
+
1246
+ ```sh
1247
+ # NPM
1248
+ npm install hookdeck-cli@beta -g
1249
+
1250
+ # Homebrew
1251
+ brew install hookdeck/hookdeck/hookdeck-beta
1252
+
1253
+ # To force the symlink update and overwrite all conflicting files:
1254
+ # brew link --overwrite hookdeck-beta
1255
+
1256
+ # Scoop
1257
+ scoop install hookdeck-beta
1258
+
1259
+ # Docker
1260
+ docker run hookdeck/hookdeck-cli:v1.3.0-beta.1 version
1261
+ ```
1262
+
1263
+ **Note:** Only stable releases (without pre-release identifiers like `-beta`, `-alpha`) will update the `latest` tags across all distribution channels.
1264
+
1265
+ ## Repository Setup
1266
+
1267
+ ### GitHub Repository Settings
1268
+
1269
+ To maintain code quality and protect the main branch, configure the following settings in your GitHub repository:
1270
+
1271
+ **Default Branch:**
1272
+ 1. Go to Settings → Branches
1273
+ 2. Set default branch to `main` (if not already set)
1274
+
1275
+ **Branch Protection Rules for `main`:**
1276
+ 1. Go to Settings → Branches → Branch protection rules
1277
+ 2. Add rule for `main` branch
1278
+ 3. Enable the following settings:
1279
+ - **Require a pull request before merging**
1280
+ - Require approvals: 1 (or as needed for your team)
1281
+ - **Require status checks to pass before merging**
1282
+ - Require branches to be up to date before merging
1283
+ - Add status check: `build-linux`, `build-mac`, `build-windows` (from test workflow)
1284
+ - **Do not allow bypassing the above settings**
1285
+ - **Restrict force pushes** (recommended)
1286
+ - **Restrict deletions** (recommended)
1152
1287
 
1153
- **Note:** Only stable releases (without pre-release identifiers) will update the `latest` tags across all distribution channels.
1288
+ These settings ensure that all changes to `main` go through proper review and testing before being merged.
1154
1289
 
1155
1290
  ## License
1156
1291
 
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require('child_process');
3
+ const { existsSync } = require('fs');
4
+ const path = require('path');
5
+
6
+ const platform = process.platform; // 'darwin', 'linux', 'win32'
7
+ const arch = process.arch; // 'x64', 'arm64', 'ia32'
8
+
9
+ // Map Node.js arch to Go arch naming
10
+ const archMap = {
11
+ 'x64': 'amd64',
12
+ 'arm64': 'arm64',
13
+ 'ia32': '386'
14
+ };
15
+ const goArch = archMap[arch] || arch;
16
+
17
+ // Determine binary directory name and executable name
18
+ const binaryDir = `${platform}-${goArch}`;
19
+ const binaryName = platform === 'win32' ? 'hookdeck.exe' : 'hookdeck';
20
+
21
+ // Path to the binary relative to this script
22
+ const binaryPath = path.join(__dirname, '..', 'binaries', binaryDir, binaryName);
23
+
24
+ if (!existsSync(binaryPath)) {
25
+ console.error(`Error: Unsupported platform: ${platform}-${arch}`);
26
+ console.error(`Expected binary at: ${binaryPath}`);
27
+ console.error(`Please report this issue at https://github.com/hookdeck/hookdeck-cli/issues`);
28
+ process.exit(1);
29
+ }
30
+
31
+ try {
32
+ execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
33
+ } catch (error) {
34
+ // execFileSync will exit with the same code as the binary
35
+ // If there's an error executing, exit with code 1
36
+ process.exit(error.status ?? 1);
37
+ }
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hookdeck-cli",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Hookdeck CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,19 +16,12 @@
16
16
  },
17
17
  "homepage": "https://github.com/hookdeck/hookdeck-cli#readme",
18
18
  "bin": {
19
- "hookdeck": "./bin/hookdeck"
19
+ "hookdeck": "./bin/hookdeck.js"
20
20
  },
21
- "files": [],
22
- "scripts": {
23
- "postinstall": "go-npm install",
24
- "preuninstall": "go-npm uninstall"
25
- },
26
- "goBinary": {
27
- "name": "hookdeck",
28
- "path": "./bin",
29
- "url": "https://github.com/hookdeck/hookdeck-cli/releases/download/v{{version}}/hookdeck_{{version}}_{{platform}}_{{arch}}.tar.gz"
30
- },
31
- "dependencies": {
32
- "go-npm-next": "^1.1.0"
33
- }
21
+ "files": [
22
+ "bin/",
23
+ "binaries/"
24
+ ],
25
+ "scripts": {},
26
+ "dependencies": {}
34
27
  }