commet 1.8.1 → 1.9.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 (2) hide show
  1. package/dist/index.js +32 -10
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var import_commander12 = require("commander");
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "commet",
33
- version: "1.8.1",
33
+ version: "1.9.1",
34
34
  description: "Commet CLI - Manage your billing platform from the command line",
35
35
  bin: {
36
36
  commet: "./bin/commet"
@@ -57,17 +57,17 @@ var package_default = {
57
57
  author: "Commet Team",
58
58
  license: "MIT",
59
59
  dependencies: {
60
- "@inquirer/prompts": "8.0.1",
60
+ "@inquirer/prompts": "8.4.3",
61
61
  ably: "^2.21.0",
62
62
  chalk: "5.6.2",
63
- commander: "14.0.2",
63
+ commander: "14.0.3",
64
64
  "jsonc-parser": "3.3.1",
65
65
  open: "11.0.0",
66
- ora: "9.0.0",
66
+ ora: "9.4.0",
67
67
  tar: "^7.5.13"
68
68
  },
69
69
  devDependencies: {
70
- "@types/node": "24.10.1",
70
+ "@types/node": "24.12.4",
71
71
  tsup: "8.5.1",
72
72
  typescript: "5.9.3"
73
73
  },
@@ -1010,7 +1010,26 @@ function isListenMessage(data) {
1010
1010
  const obj = data;
1011
1011
  return typeof obj.payload === "object" && obj.payload !== null && typeof obj.headers === "object" && obj.headers !== null;
1012
1012
  }
1013
- var listenCommand = new import_commander5.Command("listen").description("Forward webhook events to your local server").requiredOption("--port <number>", "Local port to forward to").option("--events <types>", "Comma-separated event types to filter").option("--path <path>", "Path within localhost", "/").action(async (options) => {
1013
+ function resolveTargetUrl(input2) {
1014
+ if (/^\d+$/.test(input2)) {
1015
+ return `http://localhost:${input2}/`;
1016
+ }
1017
+ const withProtocol = input2.startsWith("http://") || input2.startsWith("https://") ? input2 : `http://${input2}`;
1018
+ const parsed = new URL(withProtocol);
1019
+ if (!parsed.port) {
1020
+ throw new Error(
1021
+ `Missing port in "${input2}". Example: commet listen localhost:3000/webhooks`
1022
+ );
1023
+ }
1024
+ if (!parsed.pathname.endsWith("/")) {
1025
+ parsed.pathname += "/";
1026
+ }
1027
+ return parsed.toString();
1028
+ }
1029
+ var listenCommand = new import_commander5.Command("listen").description("Forward webhook events to your local server").argument(
1030
+ "<url>",
1031
+ "URL to forward to (e.g. localhost:3000, local.commet.co:3010/webhooks, or just a port)"
1032
+ ).option("--events <types>", "Comma-separated event types to filter").action(async (url, options) => {
1014
1033
  const auth = loadAuth();
1015
1034
  if (!auth) {
1016
1035
  console.log(import_chalk7.default.red("Not authenticated. Run: commet login"));
@@ -1021,9 +1040,13 @@ var listenCommand = new import_commander5.Command("listen").description("Forward
1021
1040
  console.log(import_chalk7.default.red("No project linked. Run: commet link"));
1022
1041
  process.exit(1);
1023
1042
  }
1024
- const port = Number(options.port);
1025
- if (Number.isNaN(port) || port <= 0 || port > 65535) {
1026
- console.log(import_chalk7.default.red("Invalid port number"));
1043
+ let targetUrl;
1044
+ try {
1045
+ targetUrl = resolveTargetUrl(url);
1046
+ } catch (error) {
1047
+ console.log(
1048
+ import_chalk7.default.red(error instanceof Error ? error.message : "Invalid URL")
1049
+ );
1027
1050
  process.exit(1);
1028
1051
  }
1029
1052
  async function fetchTokenRequest() {
@@ -1097,7 +1120,6 @@ var listenCommand = new import_commander5.Command("listen").description("Forward
1097
1120
  process.exit(1);
1098
1121
  });
1099
1122
  const channel = ably.channels.get(channelName);
1100
- const targetUrl = `http://localhost:${port}${options.path}`;
1101
1123
  console.log("");
1102
1124
  console.log(
1103
1125
  import_chalk7.default.green(` \u2713 Authenticated (org: ${projectConfig.orgName})`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commet",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "description": "Commet CLI - Manage your billing platform from the command line",
5
5
  "bin": {
6
6
  "commet": "./bin/commet"
@@ -19,17 +19,17 @@
19
19
  "author": "Commet Team",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@inquirer/prompts": "8.0.1",
22
+ "@inquirer/prompts": "8.4.3",
23
23
  "ably": "^2.21.0",
24
24
  "chalk": "5.6.2",
25
- "commander": "14.0.2",
25
+ "commander": "14.0.3",
26
26
  "jsonc-parser": "3.3.1",
27
27
  "open": "11.0.0",
28
- "ora": "9.0.0",
28
+ "ora": "9.4.0",
29
29
  "tar": "^7.5.13"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "24.10.1",
32
+ "@types/node": "24.12.4",
33
33
  "tsup": "8.5.1",
34
34
  "typescript": "5.9.3"
35
35
  },