commet 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/dist/index.js +70 -145
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_commander11 = require("commander");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "commet",
|
|
33
|
-
version: "1.
|
|
33
|
+
version: "1.7.0",
|
|
34
34
|
description: "Commet CLI - Manage your billing platform from the command line",
|
|
35
35
|
bin: {
|
|
36
36
|
commet: "./bin/commet"
|
|
@@ -164,12 +164,7 @@ function clearProjectConfig() {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// src/utils/api.ts
|
|
167
|
-
|
|
168
|
-
if (environment === "production") {
|
|
169
|
-
return "https://commet.co";
|
|
170
|
-
}
|
|
171
|
-
return "https://sandbox.commet.co";
|
|
172
|
-
}
|
|
167
|
+
var BASE_URL = "https://commet.co";
|
|
173
168
|
async function apiRequest(endpoint, options = {}) {
|
|
174
169
|
const auth = loadAuth();
|
|
175
170
|
if (!auth) {
|
|
@@ -200,17 +195,34 @@ async function apiRequest(endpoint, options = {}) {
|
|
|
200
195
|
}
|
|
201
196
|
|
|
202
197
|
// src/utils/login-flow.ts
|
|
203
|
-
var
|
|
198
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
204
199
|
var import_open = __toESM(require("open"));
|
|
205
200
|
var import_ora = __toESM(require("ora"));
|
|
201
|
+
|
|
202
|
+
// src/utils/prompt-theme.ts
|
|
203
|
+
var import_chalk = __toESM(require("chalk"));
|
|
204
|
+
var commetColor = import_chalk.default.hex("#e8a07c");
|
|
205
|
+
var promptTheme = {
|
|
206
|
+
prefix: commetColor("\u276F"),
|
|
207
|
+
style: {
|
|
208
|
+
answer: commetColor,
|
|
209
|
+
message: import_chalk.default.bold,
|
|
210
|
+
error: import_chalk.default.red,
|
|
211
|
+
help: import_chalk.default.dim,
|
|
212
|
+
highlight: commetColor.bold,
|
|
213
|
+
description: import_chalk.default.dim,
|
|
214
|
+
defaultAnswer: import_chalk.default.dim
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
// src/utils/login-flow.ts
|
|
206
219
|
function sleep(ms) {
|
|
207
220
|
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
208
221
|
}
|
|
209
|
-
async function performLogin(
|
|
210
|
-
const baseURL = getBaseURL(environment);
|
|
222
|
+
async function performLogin() {
|
|
211
223
|
const spinner = (0, import_ora.default)("Initiating login flow...").start();
|
|
212
224
|
try {
|
|
213
|
-
const deviceResponse = await fetch(`${
|
|
225
|
+
const deviceResponse = await fetch(`${BASE_URL}/api/auth/device/code`, {
|
|
214
226
|
method: "POST",
|
|
215
227
|
headers: { "Content-Type": "application/json" },
|
|
216
228
|
body: JSON.stringify({
|
|
@@ -230,16 +242,16 @@ async function performLogin(environment) {
|
|
|
230
242
|
interval = 5
|
|
231
243
|
} = deviceData;
|
|
232
244
|
spinner.stop();
|
|
233
|
-
console.log(
|
|
245
|
+
console.log(import_chalk2.default.bold("\n\u{1F510} Commet CLI Login\n"));
|
|
234
246
|
console.log("Visit the following URL in your browser:");
|
|
235
|
-
console.log(
|
|
247
|
+
console.log(commetColor.underline(verification_uri_complete));
|
|
236
248
|
console.log("\nOr enter this code manually:");
|
|
237
|
-
console.log(
|
|
238
|
-
console.log(
|
|
249
|
+
console.log(import_chalk2.default.bold.green(` ${user_code}`));
|
|
250
|
+
console.log(import_chalk2.default.dim("\nOpening browser...\n"));
|
|
239
251
|
try {
|
|
240
252
|
await (0, import_open.default)(verification_uri_complete);
|
|
241
253
|
} catch {
|
|
242
|
-
console.log(
|
|
254
|
+
console.log(import_chalk2.default.yellow("\u26A0 Could not open browser automatically."));
|
|
243
255
|
}
|
|
244
256
|
const pollSpinner = (0, import_ora.default)("Waiting for authorization...").start();
|
|
245
257
|
let pollingInterval = interval;
|
|
@@ -249,7 +261,7 @@ async function performLogin(environment) {
|
|
|
249
261
|
attempts++;
|
|
250
262
|
await sleep(pollingInterval * 1e3);
|
|
251
263
|
try {
|
|
252
|
-
const tokenResponse = await fetch(`${
|
|
264
|
+
const tokenResponse = await fetch(`${BASE_URL}/api/auth/device/token`, {
|
|
253
265
|
method: "POST",
|
|
254
266
|
headers: { "Content-Type": "application/json" },
|
|
255
267
|
body: JSON.stringify({
|
|
@@ -261,8 +273,7 @@ async function performLogin(environment) {
|
|
|
261
273
|
const tokenData = await tokenResponse.json();
|
|
262
274
|
if (tokenData.access_token) {
|
|
263
275
|
const authConfig = {
|
|
264
|
-
token: tokenData.access_token
|
|
265
|
-
environment
|
|
276
|
+
token: tokenData.access_token
|
|
266
277
|
};
|
|
267
278
|
if (tokenData.refresh_token) {
|
|
268
279
|
authConfig.refreshToken = tokenData.refresh_token;
|
|
@@ -304,23 +315,6 @@ async function performLogin(environment) {
|
|
|
304
315
|
}
|
|
305
316
|
}
|
|
306
317
|
|
|
307
|
-
// src/utils/prompt-theme.ts
|
|
308
|
-
var import_chalk2 = __toESM(require("chalk"));
|
|
309
|
-
var commetColor = import_chalk2.default.hex("#5BC0B0");
|
|
310
|
-
var promptTheme = {
|
|
311
|
-
prefix: commetColor("\u276F"),
|
|
312
|
-
style: {
|
|
313
|
-
answer: commetColor,
|
|
314
|
-
message: import_chalk2.default.bold,
|
|
315
|
-
error: import_chalk2.default.red,
|
|
316
|
-
help: import_chalk2.default.dim,
|
|
317
|
-
highlight: commetColor.bold,
|
|
318
|
-
// Selected option in mint
|
|
319
|
-
description: import_chalk2.default.dim,
|
|
320
|
-
defaultAnswer: import_chalk2.default.dim
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
|
|
324
318
|
// src/commands/create.ts
|
|
325
319
|
var GITHUB_REPO = "commet-labs/commet";
|
|
326
320
|
var TEMPLATES = [
|
|
@@ -462,23 +456,19 @@ function copyEnvExample(dest) {
|
|
|
462
456
|
fs2.copyFileSync(examplePath, envPath);
|
|
463
457
|
}
|
|
464
458
|
}
|
|
465
|
-
function writeApiKeyToEnv(dest, apiKey
|
|
459
|
+
function writeApiKeyToEnv(dest, apiKey) {
|
|
466
460
|
const envPath = path2.join(dest, ".env");
|
|
467
461
|
if (!fs2.existsSync(envPath)) return;
|
|
468
462
|
let content = fs2.readFileSync(envPath, "utf-8");
|
|
469
463
|
content = content.replace(/COMMET_API_KEY=.*/, `COMMET_API_KEY=${apiKey}`);
|
|
470
|
-
content = content.replace(
|
|
471
|
-
/COMMET_ENVIRONMENT=.*/,
|
|
472
|
-
`COMMET_ENVIRONMENT=${environment}`
|
|
473
|
-
);
|
|
474
464
|
fs2.writeFileSync(envPath, content);
|
|
475
465
|
}
|
|
476
|
-
function linkProject(dest, orgId, orgName
|
|
466
|
+
function linkProject(dest, orgId, orgName) {
|
|
477
467
|
const commetDir = path2.join(dest, ".commet");
|
|
478
468
|
fs2.mkdirSync(commetDir, { recursive: true });
|
|
479
469
|
fs2.writeFileSync(
|
|
480
470
|
path2.join(commetDir, "config.json"),
|
|
481
|
-
JSON.stringify({ orgId, orgName,
|
|
471
|
+
JSON.stringify({ orgId, orgName, mode: "sandbox" }, null, 2),
|
|
482
472
|
"utf8"
|
|
483
473
|
);
|
|
484
474
|
}
|
|
@@ -562,53 +552,24 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
562
552
|
console.log(import_chalk3.default.dim("Run `commet login` first"));
|
|
563
553
|
return;
|
|
564
554
|
}
|
|
565
|
-
|
|
566
|
-
try {
|
|
567
|
-
environment = await (0, import_prompts.select)({
|
|
568
|
-
message: "Environment:",
|
|
569
|
-
choices: [
|
|
570
|
-
{
|
|
571
|
-
name: `Sandbox ${import_chalk3.default.dim("(Development)")}`,
|
|
572
|
-
value: "sandbox"
|
|
573
|
-
},
|
|
574
|
-
{ name: "Production", value: "production" }
|
|
575
|
-
],
|
|
576
|
-
default: "sandbox",
|
|
577
|
-
theme: promptTheme
|
|
578
|
-
});
|
|
579
|
-
} catch {
|
|
580
|
-
console.log(import_chalk3.default.yellow("\n\u26A0 Cancelled"));
|
|
581
|
-
return;
|
|
582
|
-
}
|
|
583
|
-
const loggedIn = await performLogin(environment);
|
|
555
|
+
const loggedIn = await performLogin();
|
|
584
556
|
if (!loggedIn) {
|
|
585
557
|
return;
|
|
586
558
|
}
|
|
587
559
|
}
|
|
588
|
-
const
|
|
589
|
-
const
|
|
590
|
-
if (auth.environment !== "sandbox") {
|
|
591
|
-
console.log(
|
|
592
|
-
import_chalk3.default.red(
|
|
593
|
-
"\u2717 `commet create` is only available in sandbox environment"
|
|
594
|
-
)
|
|
595
|
-
);
|
|
596
|
-
console.log(
|
|
597
|
-
import_chalk3.default.dim("Run `commet logout` and login to sandbox to use templates")
|
|
598
|
-
);
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
const orgsSpinner = (0, import_ora2.default)("Fetching organizations...").start();
|
|
602
|
-
const orgsResult = await apiRequest(`${baseURL}/api/cli/organizations`);
|
|
560
|
+
const orgsSpinner = (0, import_ora2.default)("Fetching sandbox organizations...").start();
|
|
561
|
+
const orgsResult = await apiRequest(`${BASE_URL}/api/cli/organizations`);
|
|
603
562
|
if (orgsResult.error || !orgsResult.data) {
|
|
604
563
|
orgsSpinner.fail("Failed to fetch organizations");
|
|
605
564
|
console.log(import_chalk3.default.dim(orgsResult.error));
|
|
606
565
|
return;
|
|
607
566
|
}
|
|
608
|
-
const
|
|
567
|
+
const organizations = orgsResult.data.organizations.filter(
|
|
568
|
+
(org) => org.mode === "sandbox"
|
|
569
|
+
);
|
|
609
570
|
orgsSpinner.stop();
|
|
610
571
|
if (organizations.length === 0) {
|
|
611
|
-
console.log(import_chalk3.default.yellow("\u26A0 No organizations found"));
|
|
572
|
+
console.log(import_chalk3.default.yellow("\u26A0 No sandbox organizations found"));
|
|
612
573
|
console.log(
|
|
613
574
|
import_chalk3.default.dim("Create an organization at https://commet.co first")
|
|
614
575
|
);
|
|
@@ -643,7 +604,7 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
643
604
|
}
|
|
644
605
|
try {
|
|
645
606
|
const orgId = await (0, import_prompts.select)({
|
|
646
|
-
message: "
|
|
607
|
+
message: "Sandbox organization:",
|
|
647
608
|
choices: organizations.map((org) => ({
|
|
648
609
|
name: `${org.name} ${import_chalk3.default.dim(`(${org.slug})`)}`,
|
|
649
610
|
value: org.id
|
|
@@ -725,7 +686,7 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
725
686
|
return;
|
|
726
687
|
}
|
|
727
688
|
const planSpinner = (0, import_ora2.default)("Creating plans...").start();
|
|
728
|
-
const templateResult = await apiRequest(`${
|
|
689
|
+
const templateResult = await apiRequest(`${BASE_URL}/api/cli/templates`, {
|
|
729
690
|
method: "POST",
|
|
730
691
|
body: JSON.stringify({
|
|
731
692
|
templateId: template.templateId,
|
|
@@ -741,7 +702,7 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
741
702
|
);
|
|
742
703
|
}
|
|
743
704
|
const keySpinner = (0, import_ora2.default)("Creating API key...").start();
|
|
744
|
-
const keyResult = await apiRequest(`${
|
|
705
|
+
const keyResult = await apiRequest(`${BASE_URL}/api/cli/api-keys`, {
|
|
745
706
|
method: "POST",
|
|
746
707
|
body: JSON.stringify({
|
|
747
708
|
organizationId: selectedOrg.id,
|
|
@@ -753,21 +714,21 @@ var createCommand = new import_commander.Command("create").description("Create a
|
|
|
753
714
|
console.log(import_chalk3.default.dim(keyResult.error));
|
|
754
715
|
console.log(import_chalk3.default.dim("You can create one manually in the dashboard"));
|
|
755
716
|
} else {
|
|
756
|
-
writeApiKeyToEnv(dest, keyResult.data.apiKey
|
|
717
|
+
writeApiKeyToEnv(dest, keyResult.data.apiKey);
|
|
757
718
|
keySpinner.succeed("API key created and saved to .env");
|
|
758
719
|
}
|
|
759
|
-
linkProject(dest, selectedOrg.id, selectedOrg.name
|
|
720
|
+
linkProject(dest, selectedOrg.id, selectedOrg.name);
|
|
760
721
|
if (shouldInstallSkills) {
|
|
761
722
|
await installSkills(dest);
|
|
762
723
|
}
|
|
763
724
|
console.log(import_chalk3.default.green(`
|
|
764
725
|
\u2713 Created ${projectName}`));
|
|
765
726
|
console.log(import_chalk3.default.dim(` Template: ${template.name}`));
|
|
766
|
-
console.log(import_chalk3.default.dim(` Organization: ${selectedOrg.name}`));
|
|
727
|
+
console.log(import_chalk3.default.dim(` Organization: ${selectedOrg.name} \xB7 sandbox`));
|
|
767
728
|
console.log();
|
|
768
|
-
console.log(` ${
|
|
769
|
-
console.log(` ${
|
|
770
|
-
console.log(` ${
|
|
729
|
+
console.log(` ${commetColor("cd")} ${projectName}`);
|
|
730
|
+
console.log(` ${commetColor("npm install")}`);
|
|
731
|
+
console.log(` ${commetColor("npm run dev")}`);
|
|
771
732
|
console.log();
|
|
772
733
|
});
|
|
773
734
|
|
|
@@ -797,7 +758,7 @@ var infoCommand = new import_commander2.Command("info").description("Display inf
|
|
|
797
758
|
console.log(import_chalk4.default.green("\nProject: Linked \u2713"));
|
|
798
759
|
console.log(import_chalk4.default.dim(" Organization:"), projectConfig.orgName);
|
|
799
760
|
console.log(import_chalk4.default.dim(" Organization ID:"), projectConfig.orgId);
|
|
800
|
-
console.log(import_chalk4.default.dim("
|
|
761
|
+
console.log(import_chalk4.default.dim(" Mode:"), projectConfig.mode);
|
|
801
762
|
console.log(
|
|
802
763
|
import_chalk4.default.dim("\nRun `commet pull` to generate type definitions\n")
|
|
803
764
|
);
|
|
@@ -853,7 +814,7 @@ var linkCommand = new import_commander3.Command("link").description("Link this p
|
|
|
853
814
|
const config = loadProjectConfig();
|
|
854
815
|
console.log(import_chalk5.default.yellow("\u26A0 This project is already linked"));
|
|
855
816
|
console.log(
|
|
856
|
-
import_chalk5.default.dim(`Organization: ${config?.orgName}
|
|
817
|
+
import_chalk5.default.dim(`Organization: ${config?.orgName} \xB7 ${config?.mode}`)
|
|
857
818
|
);
|
|
858
819
|
console.log(
|
|
859
820
|
import_chalk5.default.dim(
|
|
@@ -863,15 +824,8 @@ var linkCommand = new import_commander3.Command("link").description("Link this p
|
|
|
863
824
|
return;
|
|
864
825
|
}
|
|
865
826
|
const spinner = (0, import_ora3.default)("Fetching organizations...").start();
|
|
866
|
-
const auth = loadAuth();
|
|
867
|
-
if (!auth) {
|
|
868
|
-
spinner.fail("Authentication error");
|
|
869
|
-
console.log(import_chalk5.default.red("\u2717 Could not load authentication"));
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
const baseURL = getBaseURL(auth.environment);
|
|
873
827
|
const result = await apiRequest(
|
|
874
|
-
`${
|
|
828
|
+
`${BASE_URL}/api/cli/organizations`
|
|
875
829
|
);
|
|
876
830
|
if (result.error || !result.data) {
|
|
877
831
|
spinner.fail("Failed to fetch organizations");
|
|
@@ -893,7 +847,7 @@ var linkCommand = new import_commander3.Command("link").description("Link this p
|
|
|
893
847
|
orgId = await (0, import_prompts2.select)({
|
|
894
848
|
message: "Select organization:",
|
|
895
849
|
choices: organizations.map((org) => ({
|
|
896
|
-
name: `${org.name} ${import_chalk5.default.dim(`(${org.slug})`)}`,
|
|
850
|
+
name: `${org.name} ${import_chalk5.default.dim(`(${org.slug}) \xB7 ${org.mode}`)}`,
|
|
897
851
|
value: org.id
|
|
898
852
|
})),
|
|
899
853
|
theme: promptTheme
|
|
@@ -910,12 +864,13 @@ var linkCommand = new import_commander3.Command("link").description("Link this p
|
|
|
910
864
|
saveProjectConfig({
|
|
911
865
|
orgId: selectedOrg.id,
|
|
912
866
|
orgName: selectedOrg.name,
|
|
913
|
-
|
|
867
|
+
mode: selectedOrg.mode
|
|
914
868
|
});
|
|
915
869
|
const gitignoreResult = updateGitignore(".commet/");
|
|
916
870
|
console.log(import_chalk5.default.green("\n\u2713 Project linked successfully"));
|
|
917
|
-
console.log(
|
|
918
|
-
|
|
871
|
+
console.log(
|
|
872
|
+
import_chalk5.default.dim(`Organization: ${selectedOrg.name} \xB7 ${selectedOrg.mode}`)
|
|
873
|
+
);
|
|
919
874
|
if (gitignoreResult.success) {
|
|
920
875
|
console.log(import_chalk5.default.green("\u2713 Updated .gitignore"));
|
|
921
876
|
} else {
|
|
@@ -959,9 +914,8 @@ var listCommand = new import_commander4.Command("list").description("List featur
|
|
|
959
914
|
return;
|
|
960
915
|
}
|
|
961
916
|
const spinner = (0, import_ora4.default)(`Fetching ${type}...`).start();
|
|
962
|
-
const baseURL = getBaseURL(projectConfig.environment);
|
|
963
917
|
const result = await apiRequest(
|
|
964
|
-
`${
|
|
918
|
+
`${BASE_URL}/api/cli/types?orgId=${projectConfig.orgId}`
|
|
965
919
|
);
|
|
966
920
|
if (result.error || !result.data) {
|
|
967
921
|
spinner.fail(`Failed to fetch ${type}`);
|
|
@@ -1033,7 +987,6 @@ var listCommand = new import_commander4.Command("list").description("List featur
|
|
|
1033
987
|
});
|
|
1034
988
|
|
|
1035
989
|
// src/commands/login.ts
|
|
1036
|
-
var import_prompts3 = require("@inquirer/prompts");
|
|
1037
990
|
var import_chalk7 = __toESM(require("chalk"));
|
|
1038
991
|
var import_commander5 = require("commander");
|
|
1039
992
|
var loginCommand = new import_commander5.Command("login").description("Authenticate with Commet").action(async () => {
|
|
@@ -1046,28 +999,7 @@ var loginCommand = new import_commander5.Command("login").description("Authentic
|
|
|
1046
999
|
);
|
|
1047
1000
|
return;
|
|
1048
1001
|
}
|
|
1049
|
-
|
|
1050
|
-
try {
|
|
1051
|
-
environment = await (0, import_prompts3.select)({
|
|
1052
|
-
message: "Select environment to login:",
|
|
1053
|
-
choices: [
|
|
1054
|
-
{
|
|
1055
|
-
name: `Sandbox ${import_chalk7.default.dim("(Development)")}`,
|
|
1056
|
-
value: "sandbox"
|
|
1057
|
-
},
|
|
1058
|
-
{
|
|
1059
|
-
name: "Production",
|
|
1060
|
-
value: "production"
|
|
1061
|
-
}
|
|
1062
|
-
],
|
|
1063
|
-
default: "sandbox",
|
|
1064
|
-
theme: promptTheme
|
|
1065
|
-
});
|
|
1066
|
-
} catch {
|
|
1067
|
-
console.log(import_chalk7.default.yellow("\n\u26A0 Login cancelled"));
|
|
1068
|
-
return;
|
|
1069
|
-
}
|
|
1070
|
-
const success = await performLogin(environment);
|
|
1002
|
+
const success = await performLogin();
|
|
1071
1003
|
if (success) {
|
|
1072
1004
|
console.log(import_chalk7.default.green("\n\u2713 Authentication complete"));
|
|
1073
1005
|
console.log(
|
|
@@ -1219,9 +1151,8 @@ var pullCommand = new import_commander7.Command("pull").description("Pull type d
|
|
|
1219
1151
|
return;
|
|
1220
1152
|
}
|
|
1221
1153
|
const spinner = (0, import_ora5.default)("Fetching type definitions...").start();
|
|
1222
|
-
const baseURL = getBaseURL(projectConfig.environment);
|
|
1223
1154
|
const result = await apiRequest(
|
|
1224
|
-
`${
|
|
1155
|
+
`${BASE_URL}/api/cli/types?orgId=${projectConfig.orgId}`
|
|
1225
1156
|
);
|
|
1226
1157
|
if (result.error || !result.data) {
|
|
1227
1158
|
spinner.fail("Failed to fetch types");
|
|
@@ -1291,7 +1222,7 @@ Output: ${outputPath}`));
|
|
|
1291
1222
|
});
|
|
1292
1223
|
|
|
1293
1224
|
// src/commands/switch.ts
|
|
1294
|
-
var
|
|
1225
|
+
var import_prompts3 = require("@inquirer/prompts");
|
|
1295
1226
|
var import_chalk10 = __toESM(require("chalk"));
|
|
1296
1227
|
var import_commander8 = require("commander");
|
|
1297
1228
|
var import_ora6 = __toESM(require("ora"));
|
|
@@ -1309,15 +1240,8 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
|
|
|
1309
1240
|
return;
|
|
1310
1241
|
}
|
|
1311
1242
|
const spinner = (0, import_ora6.default)("Fetching organizations...").start();
|
|
1312
|
-
const auth = loadAuth();
|
|
1313
|
-
if (!auth) {
|
|
1314
|
-
spinner.fail("Authentication error");
|
|
1315
|
-
console.log(import_chalk10.default.red("\u2717 Could not load authentication"));
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
const baseURL = getBaseURL(auth.environment);
|
|
1319
1243
|
const result = await apiRequest(
|
|
1320
|
-
`${
|
|
1244
|
+
`${BASE_URL}/api/cli/organizations`
|
|
1321
1245
|
);
|
|
1322
1246
|
if (result.error || !result.data) {
|
|
1323
1247
|
spinner.fail("Failed to fetch organizations");
|
|
@@ -1333,10 +1257,10 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
|
|
|
1333
1257
|
spinner.stop();
|
|
1334
1258
|
let orgId;
|
|
1335
1259
|
try {
|
|
1336
|
-
orgId = await (0,
|
|
1260
|
+
orgId = await (0, import_prompts3.select)({
|
|
1337
1261
|
message: "Select organization:",
|
|
1338
1262
|
choices: organizations.map((org) => ({
|
|
1339
|
-
name: `${org.name} ${import_chalk10.default.dim(`(${org.slug})`)}`,
|
|
1263
|
+
name: `${org.name} ${import_chalk10.default.dim(`(${org.slug}) \xB7 ${org.mode}`)}`,
|
|
1340
1264
|
value: org.id
|
|
1341
1265
|
})),
|
|
1342
1266
|
theme: promptTheme
|
|
@@ -1353,12 +1277,13 @@ var switchCommand = new import_commander8.Command("switch").description("Switch
|
|
|
1353
1277
|
saveProjectConfig({
|
|
1354
1278
|
orgId: selectedOrg.id,
|
|
1355
1279
|
orgName: selectedOrg.name,
|
|
1356
|
-
|
|
1280
|
+
mode: selectedOrg.mode
|
|
1357
1281
|
});
|
|
1358
1282
|
console.log(import_chalk10.default.green("\n\u2713 Switched organization successfully!"));
|
|
1359
|
-
console.log(
|
|
1360
|
-
|
|
1361
|
-
|
|
1283
|
+
console.log(
|
|
1284
|
+
import_chalk10.default.dim(`
|
|
1285
|
+
Organization: ${selectedOrg.name} \xB7 ${selectedOrg.mode}`)
|
|
1286
|
+
);
|
|
1362
1287
|
console.log(
|
|
1363
1288
|
import_chalk10.default.dim(
|
|
1364
1289
|
"\nRun `commet pull` to update TypeScript types for this organization"
|
|
@@ -1398,7 +1323,7 @@ var whoamiCommand = new import_commander10.Command("whoami").description("Displa
|
|
|
1398
1323
|
if (projectConfig) {
|
|
1399
1324
|
console.log(import_chalk12.default.bold("\nProject:"));
|
|
1400
1325
|
console.log(import_chalk12.default.dim("Organization:"), projectConfig.orgName);
|
|
1401
|
-
console.log(import_chalk12.default.dim("
|
|
1326
|
+
console.log(import_chalk12.default.dim("Mode:"), projectConfig.mode);
|
|
1402
1327
|
} else {
|
|
1403
1328
|
console.log(import_chalk12.default.yellow("\n\u26A0 No project linked"));
|
|
1404
1329
|
console.log(
|