commet 0.5.2 → 0.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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/dist/index.js +16 -10
  3. package/package.json +3 -4
package/README.md CHANGED
@@ -43,8 +43,8 @@ commet login
43
43
  Prompts you to select an environment (Sandbox or Production), then opens your browser to authenticate. Creates `~/.commet/auth.json` with your credentials.
44
44
 
45
45
  **Important:** Sandbox and Production are completely isolated platforms with separate accounts:
46
- - **Sandbox**: `sandbox.commet.co` - Development and testing
47
- - **Production**: `billing.commet.co` - Live billing operations
46
+ - **Sandbox**: `api.sandbox.commet.co` - Development and testing
47
+ - **Production**: `api.commet.co` - Live billing operations
48
48
 
49
49
  Make sure to login to the correct environment for your needs.
50
50
 
@@ -210,8 +210,8 @@ Add `.commet/` to `.gitignore` if different developers use different organizatio
210
210
 
211
211
  Commet supports two completely isolated environments:
212
212
 
213
- - **Sandbox** (`sandbox.commet.co`): Development and testing with separate data
214
- - **Production** (`billing.commet.co`): Live billing operations with real customers
213
+ - **Sandbox** (`api.sandbox.commet.co`): Development and testing with separate data
214
+ - **Production** (`api.commet.co`): Live billing operations with real customers
215
215
 
216
216
  **Important:** Each environment requires separate authentication because they are independent platforms. To work with both:
217
217
 
package/dist/index.js CHANGED
@@ -135,12 +135,18 @@ var import_commander2 = require("commander");
135
135
  var import_ora = __toESM(require("ora"));
136
136
 
137
137
  // src/utils/api.ts
138
- function getBaseURL(environment) {
138
+ function getWebBaseURL(environment) {
139
139
  if (environment === "production") {
140
140
  return "https://billing.commet.co";
141
141
  }
142
142
  return "https://sandbox.commet.co";
143
143
  }
144
+ function getApiBaseURL(environment) {
145
+ if (environment === "production") {
146
+ return "https://api.commet.co";
147
+ }
148
+ return "https://api.sandbox.commet.co";
149
+ }
144
150
  async function apiRequest(endpoint, options = {}) {
145
151
  const auth = loadAuth();
146
152
  if (!auth) {
@@ -247,9 +253,9 @@ var linkCommand = new import_commander2.Command("link").description("Link this p
247
253
  console.log(import_chalk3.default.red("\u2717 Could not load authentication"));
248
254
  return;
249
255
  }
250
- const baseURL = getBaseURL(auth.environment);
256
+ const baseURL = getApiBaseURL(auth.environment);
251
257
  const result = await apiRequest(
252
- `${baseURL}/api/cli/organizations`
258
+ `${baseURL}/cli/organizations`
253
259
  );
254
260
  if (result.error || !result.data) {
255
261
  spinner.fail("Failed to fetch organizations");
@@ -333,9 +339,9 @@ var listCommand = new import_commander3.Command("list").description("List event
333
339
  return;
334
340
  }
335
341
  const spinner = (0, import_ora2.default)(`Fetching ${type}...`).start();
336
- const baseURL = getBaseURL(projectConfig.environment);
342
+ const baseURL = getApiBaseURL(projectConfig.environment);
337
343
  const result = await apiRequest(
338
- `${baseURL}/api/cli/types?orgId=${projectConfig.orgId}`
344
+ `${baseURL}/cli/types?orgId=${projectConfig.orgId}`
339
345
  );
340
346
  if (result.error || !result.data) {
341
347
  spinner.fail(`Failed to fetch ${type}`);
@@ -427,7 +433,7 @@ var loginCommand = new import_commander4.Command("login").description("Authentic
427
433
  return;
428
434
  }
429
435
  const spinner = (0, import_ora3.default)("Initiating login flow...").start();
430
- const baseURL = getBaseURL(environment);
436
+ const baseURL = getWebBaseURL(environment);
431
437
  try {
432
438
  const deviceResponse = await fetch(`${baseURL}/api/auth/device/code`, {
433
439
  method: "POST",
@@ -700,9 +706,9 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
700
706
  return;
701
707
  }
702
708
  const spinner = (0, import_ora4.default)("Fetching type definitions...").start();
703
- const baseURL = getBaseURL(projectConfig.environment);
709
+ const baseURL = getApiBaseURL(projectConfig.environment);
704
710
  const result = await apiRequest(
705
- `${baseURL}/api/cli/types?orgId=${projectConfig.orgId}`
711
+ `${baseURL}/cli/types?orgId=${projectConfig.orgId}`
706
712
  );
707
713
  if (result.error || !result.data) {
708
714
  spinner.fail("Failed to fetch types");
@@ -791,9 +797,9 @@ var switchCommand = new import_commander7.Command("switch").description("Switch
791
797
  console.log(import_chalk8.default.red("\u2717 Could not load authentication"));
792
798
  return;
793
799
  }
794
- const baseURL = getBaseURL(auth.environment);
800
+ const baseURL = getApiBaseURL(auth.environment);
795
801
  const result = await apiRequest(
796
- `${baseURL}/api/cli/organizations`
802
+ `${baseURL}/cli/organizations`
797
803
  );
798
804
  if (result.error || !result.data) {
799
805
  spinner.fail("Failed to fetch organizations");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commet",
3
- "version": "0.5.2",
3
+ "version": "0.7.0",
4
4
  "description": "Commet CLI - Manage your billing platform from the command line",
5
5
  "bin": {
6
6
  "commet": "./bin/commet"
@@ -25,10 +25,9 @@
25
25
  "jsonc-parser": "^3.3.1",
26
26
  "open": "^10.0.0",
27
27
  "ora": "^7.0.1",
28
- "@commet/node": "0.6.1"
28
+ "@commet/node": "0.7.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@biomejs/biome": "^1.9.4",
32
31
  "@types/node": "^20.10.0",
33
32
  "tsup": "^8.0.1",
34
33
  "typescript": "^5.3.3"
@@ -49,7 +48,7 @@
49
48
  "build": "tsup",
50
49
  "dev": "tsup --watch",
51
50
  "lint": "biome lint src/",
52
- "lint:fix": "biome lint --apply src/",
51
+ "lint:fix": "biome lint --write src/",
53
52
  "typecheck": "tsc --noEmit"
54
53
  }
55
54
  }