commet 1.7.0 → 1.8.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.
Files changed (2) hide show
  1. package/dist/index.js +246 -76
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -24,13 +24,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/index.ts
27
- var import_chalk13 = __toESM(require("chalk"));
28
- var import_commander11 = require("commander");
27
+ var import_chalk14 = __toESM(require("chalk"));
28
+ var import_commander12 = require("commander");
29
29
 
30
30
  // package.json
31
31
  var package_default = {
32
32
  name: "commet",
33
- version: "1.7.0",
33
+ version: "1.8.0",
34
34
  description: "Commet CLI - Manage your billing platform from the command line",
35
35
  bin: {
36
36
  commet: "./bin/commet"
@@ -58,6 +58,7 @@ var package_default = {
58
58
  license: "MIT",
59
59
  dependencies: {
60
60
  "@inquirer/prompts": "8.0.1",
61
+ ably: "^2.21.0",
61
62
  chalk: "5.6.2",
62
63
  commander: "14.0.2",
63
64
  "jsonc-parser": "3.3.1",
@@ -164,7 +165,13 @@ function clearProjectConfig() {
164
165
  }
165
166
 
166
167
  // src/utils/api.ts
167
- var BASE_URL = "https://commet.co";
168
+ var BASE_URL = "https://beta.commet.co";
169
+ function bypassHeaders() {
170
+ return {
171
+ Cookie: "_vercel_jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJiZXRhLmNvbW1ldC5jbyIsImJ5cGFzcyI6IjFERUlTcngyczA3YXFjVmhBbVhDUnhjTEdvOHNZaGFTIiwiaWF0IjoxNzc4NjkxNzMxLCJzdWIiOiJwcm90ZWN0aW9uLWJ5cGFzcy1hdXRvbWF0aW9uIn0.ONjvMguLM-7wXfTppY1cQveu9IN05x4VSblB39YpW_A",
172
+ Origin: "https://beta.commet.co"
173
+ };
174
+ }
168
175
  async function apiRequest(endpoint, options = {}) {
169
176
  const auth = loadAuth();
170
177
  if (!auth) {
@@ -175,6 +182,7 @@ async function apiRequest(endpoint, options = {}) {
175
182
  ...options,
176
183
  headers: {
177
184
  ...options.headers,
185
+ ...bypassHeaders(),
178
186
  Authorization: `Bearer ${auth.token}`,
179
187
  "Content-Type": "application/json"
180
188
  }
@@ -224,7 +232,7 @@ async function performLogin() {
224
232
  try {
225
233
  const deviceResponse = await fetch(`${BASE_URL}/api/auth/device/code`, {
226
234
  method: "POST",
227
- headers: { "Content-Type": "application/json" },
235
+ headers: { "Content-Type": "application/json", ...bypassHeaders() },
228
236
  body: JSON.stringify({
229
237
  client_id: "commet-cli",
230
238
  scope: "openid profile email"
@@ -263,7 +271,7 @@ async function performLogin() {
263
271
  try {
264
272
  const tokenResponse = await fetch(`${BASE_URL}/api/auth/device/token`, {
265
273
  method: "POST",
266
- headers: { "Content-Type": "application/json" },
274
+ headers: { "Content-Type": "application/json", ...bypassHeaders() },
267
275
  body: JSON.stringify({
268
276
  grant_type: "urn:ietf:params:oauth:grant-type:device_code",
269
277
  device_code,
@@ -986,14 +994,175 @@ var listCommand = new import_commander4.Command("list").description("List featur
986
994
  }
987
995
  });
988
996
 
989
- // src/commands/login.ts
997
+ // src/commands/listen.ts
998
+ var import_ably = __toESM(require("ably"));
990
999
  var import_chalk7 = __toESM(require("chalk"));
991
1000
  var import_commander5 = require("commander");
992
- var loginCommand = new import_commander5.Command("login").description("Authenticate with Commet").action(async () => {
1001
+ function printEventLine(line) {
1002
+ const time = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false });
1003
+ const eventName = import_chalk7.default.yellow(line.event.padEnd(28));
1004
+ const timing = import_chalk7.default.dim(`(${line.ms}ms)`);
1005
+ if ("error" in line) {
1006
+ console.log(
1007
+ ` ${import_chalk7.default.dim(time)} ${eventName} \u2192 ${import_chalk7.default.red("Error")} ${timing}`
1008
+ );
1009
+ console.log(` ${" ".repeat(12)}${import_chalk7.default.red(line.error)}`);
1010
+ return;
1011
+ }
1012
+ const status = line.statusCode < 400 ? import_chalk7.default.green(`${line.statusCode} OK`) : import_chalk7.default.red(`${line.statusCode} Error`);
1013
+ console.log(` ${import_chalk7.default.dim(time)} ${eventName} \u2192 ${status} ${timing}`);
1014
+ }
1015
+ function isListenMessage(data) {
1016
+ if (typeof data !== "object" || data === null) return false;
1017
+ const obj = data;
1018
+ return typeof obj.payload === "object" && obj.payload !== null && typeof obj.headers === "object" && obj.headers !== null;
1019
+ }
1020
+ 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) => {
1021
+ const auth = loadAuth();
1022
+ if (!auth) {
1023
+ console.log(import_chalk7.default.red("Not authenticated. Run: commet login"));
1024
+ process.exit(1);
1025
+ }
1026
+ const projectConfig = loadProjectConfig();
1027
+ if (!projectConfig) {
1028
+ console.log(import_chalk7.default.red("No project linked. Run: commet link"));
1029
+ process.exit(1);
1030
+ }
1031
+ const port = Number(options.port);
1032
+ if (Number.isNaN(port) || port <= 0 || port > 65535) {
1033
+ console.log(import_chalk7.default.red("Invalid port number"));
1034
+ process.exit(1);
1035
+ }
1036
+ async function fetchTokenRequest() {
1037
+ const result = await apiRequest(
1038
+ `${BASE_URL}/api/cli/listen/start`,
1039
+ {
1040
+ method: "POST",
1041
+ body: JSON.stringify({ organizationId: projectConfig.orgId })
1042
+ }
1043
+ );
1044
+ if (result.error || !result.data) {
1045
+ console.log(import_chalk7.default.red("Failed to start listen session"));
1046
+ if (result.error) {
1047
+ console.log(import_chalk7.default.dim(result.error));
1048
+ }
1049
+ process.exit(1);
1050
+ }
1051
+ return result.data;
1052
+ }
1053
+ const initialSession = await fetchTokenRequest();
1054
+ const { sessionId, channelName, signingSecret, tokenRequest } = initialSession;
1055
+ async function refreshToken() {
1056
+ const result = await apiRequest(
1057
+ `${BASE_URL}/api/cli/listen/refresh`,
1058
+ {
1059
+ method: "POST",
1060
+ body: JSON.stringify({
1061
+ sessionId,
1062
+ organizationId: projectConfig.orgId
1063
+ })
1064
+ }
1065
+ );
1066
+ if (result.error || !result.data) {
1067
+ throw new Error(result.error ?? "Failed to refresh token");
1068
+ }
1069
+ return result.data.tokenRequest;
1070
+ }
1071
+ let isFirstToken = true;
1072
+ const ably = new import_ably.default.Realtime({
1073
+ authCallback: async (_tokenParams, callback) => {
1074
+ try {
1075
+ if (isFirstToken) {
1076
+ isFirstToken = false;
1077
+ callback(null, tokenRequest);
1078
+ return;
1079
+ }
1080
+ const refreshed = await refreshToken();
1081
+ callback(null, refreshed);
1082
+ } catch (error) {
1083
+ callback(
1084
+ error instanceof Error ? error.message : "Token refresh failed",
1085
+ null
1086
+ );
1087
+ }
1088
+ }
1089
+ });
1090
+ let wasConnected = false;
1091
+ ably.connection.on("connected", () => {
1092
+ if (wasConnected) {
1093
+ console.log(import_chalk7.default.green(" \u2713 Reconnected"));
1094
+ }
1095
+ wasConnected = true;
1096
+ });
1097
+ ably.connection.on("disconnected", () => {
1098
+ console.log(import_chalk7.default.yellow("\n \u26A0 Disconnected. Reconnecting..."));
1099
+ });
1100
+ ably.connection.on("failed", () => {
1101
+ console.log(
1102
+ import_chalk7.default.red("\n \u2717 Connection failed. Check your authentication.")
1103
+ );
1104
+ process.exit(1);
1105
+ });
1106
+ const channel = ably.channels.get(channelName);
1107
+ const targetUrl = `http://localhost:${port}${options.path}`;
1108
+ console.log("");
1109
+ console.log(
1110
+ import_chalk7.default.green(` \u2713 Authenticated (org: ${projectConfig.orgName})`)
1111
+ );
1112
+ console.log(import_chalk7.default.green(" \u2713 Connected to Commet webhook stream"));
1113
+ console.log(import_chalk7.default.cyan(` \u27F6 Forwarding to ${targetUrl}`));
1114
+ console.log(import_chalk7.default.dim(` \u27F6 Signing secret: ${signingSecret}`));
1115
+ console.log("");
1116
+ console.log(" Ready! Listening for webhook events...");
1117
+ console.log("");
1118
+ const eventFilter = options.events?.split(",").map((e) => e.trim()).filter(Boolean);
1119
+ channel.subscribe((message) => {
1120
+ if (!message.name || !isListenMessage(message.data)) return;
1121
+ const event = message.name;
1122
+ const { payload, headers } = message.data;
1123
+ if (eventFilter && !eventFilter.includes(event)) return;
1124
+ const start = performance.now();
1125
+ fetch(targetUrl, {
1126
+ method: "POST",
1127
+ headers,
1128
+ body: JSON.stringify(payload)
1129
+ }).then((response) => {
1130
+ const ms = Math.round(performance.now() - start);
1131
+ printEventLine({ event, statusCode: response.status, ms });
1132
+ }).catch((error) => {
1133
+ const ms = Math.round(performance.now() - start);
1134
+ printEventLine({
1135
+ event,
1136
+ error: error instanceof Error ? error.message : "Unknown error",
1137
+ ms
1138
+ });
1139
+ });
1140
+ });
1141
+ let isShuttingDown = false;
1142
+ process.on("SIGINT", async () => {
1143
+ if (isShuttingDown) return;
1144
+ isShuttingDown = true;
1145
+ console.log(import_chalk7.default.dim("\n Disconnecting..."));
1146
+ ably.close();
1147
+ await apiRequest(`${BASE_URL}/api/cli/listen/stop`, {
1148
+ method: "POST",
1149
+ body: JSON.stringify({
1150
+ sessionId,
1151
+ organizationId: projectConfig.orgId
1152
+ })
1153
+ });
1154
+ process.exit(0);
1155
+ });
1156
+ });
1157
+
1158
+ // src/commands/login.ts
1159
+ var import_chalk8 = __toESM(require("chalk"));
1160
+ var import_commander6 = require("commander");
1161
+ var loginCommand = new import_commander6.Command("login").description("Authenticate with Commet").action(async () => {
993
1162
  if (authExists()) {
994
- console.log(import_chalk7.default.yellow("\u26A0 You are already logged in."));
1163
+ console.log(import_chalk8.default.yellow("\u26A0 You are already logged in."));
995
1164
  console.log(
996
- import_chalk7.default.dim(
1165
+ import_chalk8.default.dim(
997
1166
  "Run `commet logout` first if you want to login with a different account."
998
1167
  )
999
1168
  );
@@ -1001,9 +1170,9 @@ var loginCommand = new import_commander5.Command("login").description("Authentic
1001
1170
  }
1002
1171
  const success = await performLogin();
1003
1172
  if (success) {
1004
- console.log(import_chalk7.default.green("\n\u2713 Authentication complete"));
1173
+ console.log(import_chalk8.default.green("\n\u2713 Authentication complete"));
1005
1174
  console.log(
1006
- import_chalk7.default.dim(
1175
+ import_chalk8.default.dim(
1007
1176
  "\nNext steps:\n 1. Run `commet link` to connect a project\n 2. Run `commet pull` to generate types\n"
1008
1177
  )
1009
1178
  );
@@ -1011,22 +1180,22 @@ var loginCommand = new import_commander5.Command("login").description("Authentic
1011
1180
  });
1012
1181
 
1013
1182
  // src/commands/logout.ts
1014
- var import_chalk8 = __toESM(require("chalk"));
1015
- var import_commander6 = require("commander");
1016
- var logoutCommand = new import_commander6.Command("logout").description("Log out of Commet").action(async () => {
1183
+ var import_chalk9 = __toESM(require("chalk"));
1184
+ var import_commander7 = require("commander");
1185
+ var logoutCommand = new import_commander7.Command("logout").description("Log out of Commet").action(async () => {
1017
1186
  if (!authExists()) {
1018
- console.log(import_chalk8.default.yellow("\u26A0 You are not logged in."));
1187
+ console.log(import_chalk9.default.yellow("\u26A0 You are not logged in."));
1019
1188
  return;
1020
1189
  }
1021
1190
  clearAuth();
1022
- console.log(import_chalk8.default.green("\u2713 Successfully logged out"));
1191
+ console.log(import_chalk9.default.green("\u2713 Successfully logged out"));
1023
1192
  });
1024
1193
 
1025
1194
  // src/commands/pull.ts
1026
1195
  var fs6 = __toESM(require("fs"));
1027
1196
  var path6 = __toESM(require("path"));
1028
- var import_chalk9 = __toESM(require("chalk"));
1029
- var import_commander7 = require("commander");
1197
+ var import_chalk10 = __toESM(require("chalk"));
1198
+ var import_commander8 = require("commander");
1030
1199
  var import_ora5 = __toESM(require("ora"));
1031
1200
 
1032
1201
  // src/utils/environment-validator.ts
@@ -1131,23 +1300,23 @@ function updateTsConfig(entry) {
1131
1300
  }
1132
1301
 
1133
1302
  // src/commands/pull.ts
1134
- var pullCommand = new import_commander7.Command("pull").description("Pull type definitions from Commet").action(async () => {
1303
+ var pullCommand = new import_commander8.Command("pull").description("Pull type definitions from Commet").action(async () => {
1135
1304
  if (!authExists()) {
1136
- console.log(import_chalk9.default.red("\u2717 Not authenticated"));
1137
- console.log(import_chalk9.default.dim("Run `commet login` first"));
1305
+ console.log(import_chalk10.default.red("\u2717 Not authenticated"));
1306
+ console.log(import_chalk10.default.dim("Run `commet login` first"));
1138
1307
  return;
1139
1308
  }
1140
1309
  const hasTsConfig = validateTypeScriptProject();
1141
1310
  if (!projectConfigExists()) {
1142
- console.log(import_chalk9.default.red("\u2717 Project not linked"));
1311
+ console.log(import_chalk10.default.red("\u2717 Project not linked"));
1143
1312
  console.log(
1144
- import_chalk9.default.dim("Run `commet link` first to connect to an organization")
1313
+ import_chalk10.default.dim("Run `commet link` first to connect to an organization")
1145
1314
  );
1146
1315
  return;
1147
1316
  }
1148
1317
  const projectConfig = loadProjectConfig();
1149
1318
  if (!projectConfig) {
1150
- console.log(import_chalk9.default.red("\u2717 Invalid project configuration"));
1319
+ console.log(import_chalk10.default.red("\u2717 Invalid project configuration"));
1151
1320
  return;
1152
1321
  }
1153
1322
  const spinner = (0, import_ora5.default)("Fetching type definitions...").start();
@@ -1156,7 +1325,7 @@ var pullCommand = new import_commander7.Command("pull").description("Pull type d
1156
1325
  );
1157
1326
  if (result.error || !result.data) {
1158
1327
  spinner.fail("Failed to fetch types");
1159
- console.error(import_chalk9.default.red("Error:"), result.error);
1328
+ console.error(import_chalk10.default.red("Error:"), result.error);
1160
1329
  return;
1161
1330
  }
1162
1331
  const { seatTypes, features, plans } = result.data;
@@ -1169,52 +1338,52 @@ var pullCommand = new import_commander7.Command("pull").description("Pull type d
1169
1338
  if (hasTsConfig) {
1170
1339
  const tsconfigResult = updateTsConfig(".commet/types.d.ts");
1171
1340
  if (tsconfigResult.success) {
1172
- console.log(import_chalk9.default.green("\u2713 Updated tsconfig.json"));
1341
+ console.log(import_chalk10.default.green("\u2713 Updated tsconfig.json"));
1173
1342
  } else {
1174
- console.log(import_chalk9.default.yellow("\u26A0 Could not update tsconfig.json"));
1343
+ console.log(import_chalk10.default.yellow("\u26A0 Could not update tsconfig.json"));
1175
1344
  console.log(
1176
- import_chalk9.default.dim(
1345
+ import_chalk10.default.dim(
1177
1346
  'Add ".commet/types.d.ts" to your tsconfig.json include array'
1178
1347
  )
1179
1348
  );
1180
1349
  }
1181
1350
  } else {
1182
- console.log(import_chalk9.default.yellow("\u26A0 No tsconfig.json found"));
1351
+ console.log(import_chalk10.default.yellow("\u26A0 No tsconfig.json found"));
1183
1352
  console.log(
1184
- import_chalk9.default.dim(
1353
+ import_chalk10.default.dim(
1185
1354
  'Add ".commet/types.d.ts" to your tsconfig.json to enable types'
1186
1355
  )
1187
1356
  );
1188
1357
  }
1189
1358
  const gitignoreResult = updateGitignore(".commet/");
1190
1359
  if (gitignoreResult.success) {
1191
- console.log(import_chalk9.default.green("\u2713 Updated .gitignore"));
1360
+ console.log(import_chalk10.default.green("\u2713 Updated .gitignore"));
1192
1361
  } else {
1193
- console.log(import_chalk9.default.yellow("\u26A0 No .gitignore found"));
1194
- console.log(import_chalk9.default.dim("Add .commet/ to your .gitignore file"));
1362
+ console.log(import_chalk10.default.yellow("\u26A0 No .gitignore found"));
1363
+ console.log(import_chalk10.default.dim("Add .commet/ to your .gitignore file"));
1195
1364
  }
1196
- console.log(import_chalk9.default.green("\nSuccess!"));
1197
- console.log(import_chalk9.default.dim("\nGenerated types:"));
1365
+ console.log(import_chalk10.default.green("\nSuccess!"));
1366
+ console.log(import_chalk10.default.dim("\nGenerated types:"));
1198
1367
  console.log(
1199
- import_chalk9.default.dim(
1368
+ import_chalk10.default.dim(
1200
1369
  ` Features: ${features.length > 0 ? features.map((f) => f.code).join(", ") : "none"}`
1201
1370
  )
1202
1371
  );
1203
1372
  console.log(
1204
- import_chalk9.default.dim(
1373
+ import_chalk10.default.dim(
1205
1374
  ` Seat types: ${seatTypes.length > 0 ? seatTypes.map((s) => s.code).join(", ") : "none"}`
1206
1375
  )
1207
1376
  );
1208
1377
  console.log(
1209
- import_chalk9.default.dim(
1378
+ import_chalk10.default.dim(
1210
1379
  ` Plans: ${plans.length > 0 ? plans.map((p) => p.code).join(", ") : "none"}`
1211
1380
  )
1212
1381
  );
1213
- console.log(import_chalk9.default.dim(`
1382
+ console.log(import_chalk10.default.dim(`
1214
1383
  Output: ${outputPath}`));
1215
1384
  if (seatTypes.length === 0 && plans.length === 0 && features.length === 0) {
1216
1385
  console.log(
1217
- import_chalk9.default.yellow(
1386
+ import_chalk10.default.yellow(
1218
1387
  "\n\u26A0 No types found. Create features, seat types, and plans in your Commet dashboard."
1219
1388
  )
1220
1389
  );
@@ -1223,19 +1392,19 @@ Output: ${outputPath}`));
1223
1392
 
1224
1393
  // src/commands/switch.ts
1225
1394
  var import_prompts3 = require("@inquirer/prompts");
1226
- var import_chalk10 = __toESM(require("chalk"));
1227
- var import_commander8 = require("commander");
1395
+ var import_chalk11 = __toESM(require("chalk"));
1396
+ var import_commander9 = require("commander");
1228
1397
  var import_ora6 = __toESM(require("ora"));
1229
- var switchCommand = new import_commander8.Command("switch").description("Switch to a different organization").action(async () => {
1398
+ var switchCommand = new import_commander9.Command("switch").description("Switch to a different organization").action(async () => {
1230
1399
  if (!authExists()) {
1231
- console.log(import_chalk10.default.red("\u2717 Not authenticated"));
1232
- console.log(import_chalk10.default.dim("Run `commet login` first"));
1400
+ console.log(import_chalk11.default.red("\u2717 Not authenticated"));
1401
+ console.log(import_chalk11.default.dim("Run `commet login` first"));
1233
1402
  return;
1234
1403
  }
1235
1404
  if (!projectConfigExists()) {
1236
- console.log(import_chalk10.default.yellow("\u26A0 Project not linked"));
1405
+ console.log(import_chalk11.default.yellow("\u26A0 Project not linked"));
1237
1406
  console.log(
1238
- import_chalk10.default.dim("Run `commet link` first to connect to an organization")
1407
+ import_chalk11.default.dim("Run `commet link` first to connect to an organization")
1239
1408
  );
1240
1409
  return;
1241
1410
  }
@@ -1245,13 +1414,13 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
1245
1414
  );
1246
1415
  if (result.error || !result.data) {
1247
1416
  spinner.fail("Failed to fetch organizations");
1248
- console.error(import_chalk10.default.red("Error:"), result.error);
1417
+ console.error(import_chalk11.default.red("Error:"), result.error);
1249
1418
  return;
1250
1419
  }
1251
1420
  const { organizations } = result.data;
1252
1421
  if (organizations.length === 0) {
1253
1422
  spinner.stop();
1254
- console.log(import_chalk10.default.yellow("\u26A0 No organizations found"));
1423
+ console.log(import_chalk11.default.yellow("\u26A0 No organizations found"));
1255
1424
  return;
1256
1425
  }
1257
1426
  spinner.stop();
@@ -1260,18 +1429,18 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
1260
1429
  orgId = await (0, import_prompts3.select)({
1261
1430
  message: "Select organization:",
1262
1431
  choices: organizations.map((org) => ({
1263
- name: `${org.name} ${import_chalk10.default.dim(`(${org.slug}) \xB7 ${org.mode}`)}`,
1432
+ name: `${org.name} ${import_chalk11.default.dim(`(${org.slug}) \xB7 ${org.mode}`)}`,
1264
1433
  value: org.id
1265
1434
  })),
1266
1435
  theme: promptTheme
1267
1436
  });
1268
1437
  } catch (_error) {
1269
- console.log(import_chalk10.default.yellow("\n\u26A0 Switch cancelled"));
1438
+ console.log(import_chalk11.default.yellow("\n\u26A0 Switch cancelled"));
1270
1439
  return;
1271
1440
  }
1272
1441
  const selectedOrg = organizations.find((org) => org.id === orgId);
1273
1442
  if (!selectedOrg) {
1274
- console.log(import_chalk10.default.red("\u2717 Organization not found"));
1443
+ console.log(import_chalk11.default.red("\u2717 Organization not found"));
1275
1444
  return;
1276
1445
  }
1277
1446
  saveProjectConfig({
@@ -1279,55 +1448,55 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
1279
1448
  orgName: selectedOrg.name,
1280
1449
  mode: selectedOrg.mode
1281
1450
  });
1282
- console.log(import_chalk10.default.green("\n\u2713 Switched organization successfully!"));
1451
+ console.log(import_chalk11.default.green("\n\u2713 Switched organization successfully!"));
1283
1452
  console.log(
1284
- import_chalk10.default.dim(`
1453
+ import_chalk11.default.dim(`
1285
1454
  Organization: ${selectedOrg.name} \xB7 ${selectedOrg.mode}`)
1286
1455
  );
1287
1456
  console.log(
1288
- import_chalk10.default.dim(
1457
+ import_chalk11.default.dim(
1289
1458
  "\nRun `commet pull` to update TypeScript types for this organization"
1290
1459
  )
1291
1460
  );
1292
1461
  });
1293
1462
 
1294
1463
  // src/commands/unlink.ts
1295
- var import_chalk11 = __toESM(require("chalk"));
1296
- var import_commander9 = require("commander");
1297
- var unlinkCommand = new import_commander9.Command("unlink").description("Unlink this project from Commet").action(async () => {
1464
+ var import_chalk12 = __toESM(require("chalk"));
1465
+ var import_commander10 = require("commander");
1466
+ var unlinkCommand = new import_commander10.Command("unlink").description("Unlink this project from Commet").action(async () => {
1298
1467
  if (!projectConfigExists()) {
1299
1468
  console.log(
1300
- import_chalk11.default.yellow("\u26A0 This project is not linked to any organization")
1469
+ import_chalk12.default.yellow("\u26A0 This project is not linked to any organization")
1301
1470
  );
1302
1471
  return;
1303
1472
  }
1304
1473
  clearProjectConfig();
1305
- console.log(import_chalk11.default.green("\u2713 Project unlinked successfully"));
1306
- console.log(import_chalk11.default.dim("\u2713 Removed .commet/ directory"));
1474
+ console.log(import_chalk12.default.green("\u2713 Project unlinked successfully"));
1475
+ console.log(import_chalk12.default.dim("\u2713 Removed .commet/ directory"));
1307
1476
  console.log(
1308
- import_chalk11.default.dim("\nRun `commet link` to connect to a different organization")
1477
+ import_chalk12.default.dim("\nRun `commet link` to connect to a different organization")
1309
1478
  );
1310
1479
  });
1311
1480
 
1312
1481
  // src/commands/whoami.ts
1313
- var import_chalk12 = __toESM(require("chalk"));
1314
- var import_commander10 = require("commander");
1315
- var whoamiCommand = new import_commander10.Command("whoami").description("Display current authentication and project status").action(async () => {
1482
+ var import_chalk13 = __toESM(require("chalk"));
1483
+ var import_commander11 = require("commander");
1484
+ var whoamiCommand = new import_commander11.Command("whoami").description("Display current authentication and project status").action(async () => {
1316
1485
  if (!authExists()) {
1317
- console.log(import_chalk12.default.yellow("\u26A0 Not logged in"));
1318
- console.log(import_chalk12.default.dim("Run `commet login` to authenticate"));
1486
+ console.log(import_chalk13.default.yellow("\u26A0 Not logged in"));
1487
+ console.log(import_chalk13.default.dim("Run `commet login` to authenticate"));
1319
1488
  return;
1320
1489
  }
1321
- console.log(import_chalk12.default.green("\u2713 Logged in"));
1490
+ console.log(import_chalk13.default.green("\u2713 Logged in"));
1322
1491
  const projectConfig = loadProjectConfig();
1323
1492
  if (projectConfig) {
1324
- console.log(import_chalk12.default.bold("\nProject:"));
1325
- console.log(import_chalk12.default.dim("Organization:"), projectConfig.orgName);
1326
- console.log(import_chalk12.default.dim("Mode:"), projectConfig.mode);
1493
+ console.log(import_chalk13.default.bold("\nProject:"));
1494
+ console.log(import_chalk13.default.dim("Organization:"), projectConfig.orgName);
1495
+ console.log(import_chalk13.default.dim("Mode:"), projectConfig.mode);
1327
1496
  } else {
1328
- console.log(import_chalk12.default.yellow("\n\u26A0 No project linked"));
1497
+ console.log(import_chalk13.default.yellow("\n\u26A0 No project linked"));
1329
1498
  console.log(
1330
- import_chalk12.default.dim(
1499
+ import_chalk13.default.dim(
1331
1500
  "Run `commet link` to connect this directory to an organization"
1332
1501
  )
1333
1502
  );
@@ -1335,7 +1504,7 @@ var whoamiCommand = new import_commander10.Command("whoami").description("Displa
1335
1504
  });
1336
1505
 
1337
1506
  // src/index.ts
1338
- var program = new import_commander11.Command();
1507
+ var program = new import_commander12.Command();
1339
1508
  program.name("commet").description(
1340
1509
  "Commet CLI - Manage your billing platform from the command line"
1341
1510
  ).version(package_default.version);
@@ -1349,6 +1518,7 @@ program.addCommand(switchCommand);
1349
1518
  program.addCommand(infoCommand);
1350
1519
  program.addCommand(pullCommand);
1351
1520
  program.addCommand(listCommand);
1521
+ program.addCommand(listenCommand);
1352
1522
  program.exitOverride();
1353
1523
  try {
1354
1524
  program.parse(process.argv);
@@ -1358,7 +1528,7 @@ try {
1358
1528
  if (code === "commander.version" || code === "commander.help" || code === "commander.helpDisplayed") {
1359
1529
  process.exit(0);
1360
1530
  }
1361
- console.error(import_chalk13.default.red("Error:"), error.message);
1531
+ console.error(import_chalk14.default.red("Error:"), error.message);
1362
1532
  }
1363
1533
  process.exit(1);
1364
1534
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commet",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Commet CLI - Manage your billing platform from the command line",
5
5
  "bin": {
6
6
  "commet": "./bin/commet"
@@ -20,6 +20,7 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "@inquirer/prompts": "8.0.1",
23
+ "ably": "^2.21.0",
23
24
  "chalk": "5.6.2",
24
25
  "commander": "14.0.2",
25
26
  "jsonc-parser": "3.3.1",