langctl 0.1.2 → 0.2.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/.github/ISSUE_TEMPLATE/bug_report.md +26 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/CONTRIBUTING.md +33 -0
- package/LICENSE +1 -1
- package/README.md +52 -11
- package/dist/api.d.ts +20 -0
- package/dist/api.js +75 -0
- package/dist/auth.d.ts +3 -2
- package/dist/auth.js +21 -27
- package/dist/commands/auth.js +2 -10
- package/dist/commands/config.js +1 -0
- package/dist/commands/debug.js +45 -41
- package/dist/commands/export.d.ts +1 -2
- package/dist/commands/export.js +70 -60
- package/dist/commands/import.d.ts +1 -0
- package/dist/commands/import.js +51 -72
- package/dist/commands/init.js +0 -10
- package/dist/commands/keys.js +122 -224
- package/dist/commands/org.js +43 -72
- package/dist/commands/projects.d.ts +3 -0
- package/dist/commands/projects.js +146 -223
- package/dist/commands/pull.js +40 -95
- package/dist/commands/team.js +115 -130
- package/dist/config.d.ts +1 -0
- package/dist/index.js +3 -3
- package/package.json +2 -3
- package/NEXT_PHASE.md +0 -618
- package/WORKING_INSTRUCTIONS.md +0 -1389
- package/dist/supabase.d.ts +0 -14
- package/dist/supabase.js +0 -30
package/dist/commands/org.js
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
|
-
import { isAuthenticated
|
|
4
|
-
|
|
3
|
+
import { isAuthenticated } from '../auth.js';
|
|
4
|
+
import { getApiClient } from '../api.js';
|
|
5
|
+
import { config } from '../config.js';
|
|
5
6
|
/**
|
|
6
7
|
* Get organization information
|
|
7
8
|
*/
|
|
8
9
|
export async function orgInfoCommand() {
|
|
9
10
|
if (!isAuthenticated()) {
|
|
10
11
|
console.log(chalk.red('✗ Not authenticated. Please run "langctl auth <api-key>" first.\n'));
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const orgId = config.get('organizationId');
|
|
16
|
+
if (!orgId) {
|
|
17
|
+
console.log(chalk.red('✗ No organization configured. Please run "langctl init" first.\n'));
|
|
18
|
+
process.exitCode = 1;
|
|
11
19
|
return;
|
|
12
20
|
}
|
|
13
|
-
const apiKey = getApiKey();
|
|
14
21
|
const spinner = ora('Fetching organization info...').start();
|
|
15
22
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
headers: {
|
|
19
|
-
'Content-Type': 'application/json',
|
|
20
|
-
'X-API-Key': apiKey
|
|
21
|
-
},
|
|
22
|
-
body: JSON.stringify({
|
|
23
|
-
action: 'info'
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
const data = await response.json();
|
|
27
|
-
if (!data.success) {
|
|
28
|
-
throw new Error(data.error);
|
|
29
|
-
}
|
|
23
|
+
const api = getApiClient();
|
|
24
|
+
const org = await api.get(`/orgs/${orgId}`);
|
|
30
25
|
spinner.stop();
|
|
31
|
-
const org = data.organization;
|
|
32
26
|
console.log(chalk.blue.bold('\n🏢 Organization Information\n'));
|
|
33
27
|
console.log(chalk.white.bold(org.name));
|
|
34
28
|
console.log(chalk.gray(`ID: ${org.id}`));
|
|
35
29
|
console.log(chalk.gray(`Slug: ${org.slug}`));
|
|
36
|
-
if (org.description) {
|
|
37
|
-
console.log(chalk.gray(`Description: ${org.description}`));
|
|
38
|
-
}
|
|
39
30
|
console.log(chalk.gray(`Plan: ${org.plan}`));
|
|
40
|
-
console.log(chalk.gray(`Created: ${new Date(org.
|
|
31
|
+
console.log(chalk.gray(`Created: ${new Date(org.createdAt).toLocaleDateString()}`));
|
|
41
32
|
console.log('');
|
|
42
33
|
}
|
|
43
34
|
catch (error) {
|
|
44
35
|
spinner.fail(chalk.red('Failed to fetch organization info'));
|
|
45
36
|
console.error(chalk.red(`Error: ${error.message}\n`));
|
|
37
|
+
process.exitCode = 1;
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
40
|
/**
|
|
@@ -51,53 +43,38 @@ export async function orgInfoCommand() {
|
|
|
51
43
|
export async function orgStatsCommand() {
|
|
52
44
|
if (!isAuthenticated()) {
|
|
53
45
|
console.log(chalk.red('✗ Not authenticated. Please run "langctl auth <api-key>" first.\n'));
|
|
46
|
+
process.exitCode = 1;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const orgId = config.get('organizationId');
|
|
50
|
+
if (!orgId) {
|
|
51
|
+
console.log(chalk.red('✗ No organization configured. Please run "langctl init" first.\n'));
|
|
52
|
+
process.exitCode = 1;
|
|
54
53
|
return;
|
|
55
54
|
}
|
|
56
|
-
const apiKey = getApiKey();
|
|
57
55
|
const spinner = ora('Fetching organization statistics...').start();
|
|
58
56
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
headers: {
|
|
62
|
-
'Content-Type': 'application/json',
|
|
63
|
-
'X-API-Key': apiKey
|
|
64
|
-
},
|
|
65
|
-
body: JSON.stringify({
|
|
66
|
-
action: 'stats'
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
const data = await response.json();
|
|
70
|
-
if (!data.success) {
|
|
71
|
-
throw new Error(data.error);
|
|
72
|
-
}
|
|
57
|
+
const api = getApiClient();
|
|
58
|
+
const stats = await api.get(`/orgs/${orgId}/stats`);
|
|
73
59
|
spinner.stop();
|
|
74
|
-
const stats = data.stats;
|
|
75
60
|
console.log(chalk.blue.bold('\n📊 Organization Statistics\n'));
|
|
76
61
|
console.log(chalk.white.bold('Team'));
|
|
77
|
-
console.log(chalk.gray(` Members: ${stats.
|
|
62
|
+
console.log(chalk.gray(` Members: ${stats.memberCount}`));
|
|
78
63
|
console.log('');
|
|
79
64
|
console.log(chalk.white.bold('Projects'));
|
|
80
|
-
console.log(chalk.gray(` Total Projects: ${stats.
|
|
65
|
+
console.log(chalk.gray(` Total Projects: ${stats.projectCount}`));
|
|
81
66
|
console.log('');
|
|
82
67
|
console.log(chalk.white.bold('Translation Keys'));
|
|
83
|
-
console.log(chalk.gray(` Total Keys: ${stats.
|
|
84
|
-
console.log(chalk.green(` Published: ${stats.published_keys}`));
|
|
85
|
-
console.log(chalk.yellow(` Unpublished: ${stats.unpublished_keys}`));
|
|
86
|
-
console.log('');
|
|
87
|
-
console.log(chalk.white.bold('Languages'));
|
|
88
|
-
console.log(chalk.gray(` Total Languages: ${stats.languages}`));
|
|
89
|
-
if (stats.language_codes && stats.language_codes.length > 0) {
|
|
90
|
-
console.log(chalk.gray(` Codes: ${stats.language_codes.join(', ')}`));
|
|
91
|
-
}
|
|
68
|
+
console.log(chalk.gray(` Total Keys: ${stats.totalKeys}`));
|
|
92
69
|
console.log('');
|
|
93
70
|
console.log(chalk.white.bold('Resources'));
|
|
94
|
-
console.log(chalk.gray(` API Keys: ${stats.
|
|
95
|
-
console.log(chalk.gray(` Webhooks: ${stats.webhooks}`));
|
|
71
|
+
console.log(chalk.gray(` API Keys: ${stats.apiKeyCount}`));
|
|
96
72
|
console.log('');
|
|
97
73
|
}
|
|
98
74
|
catch (error) {
|
|
99
75
|
spinner.fail(chalk.red('Failed to fetch statistics'));
|
|
100
76
|
console.error(chalk.red(`Error: ${error.message}\n`));
|
|
77
|
+
process.exitCode = 1;
|
|
101
78
|
}
|
|
102
79
|
}
|
|
103
80
|
/**
|
|
@@ -106,42 +83,36 @@ export async function orgStatsCommand() {
|
|
|
106
83
|
export async function orgPlanCommand() {
|
|
107
84
|
if (!isAuthenticated()) {
|
|
108
85
|
console.log(chalk.red('✗ Not authenticated. Please run "langctl auth <api-key>" first.\n'));
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const orgId = config.get('organizationId');
|
|
90
|
+
if (!orgId) {
|
|
91
|
+
console.log(chalk.red('✗ No organization configured. Please run "langctl init" first.\n'));
|
|
92
|
+
process.exitCode = 1;
|
|
109
93
|
return;
|
|
110
94
|
}
|
|
111
|
-
const apiKey = getApiKey();
|
|
112
95
|
const spinner = ora('Fetching plan information...').start();
|
|
113
96
|
try {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
headers: {
|
|
117
|
-
'Content-Type': 'application/json',
|
|
118
|
-
'X-API-Key': apiKey
|
|
119
|
-
},
|
|
120
|
-
body: JSON.stringify({
|
|
121
|
-
action: 'plan'
|
|
122
|
-
})
|
|
123
|
-
});
|
|
124
|
-
const data = await response.json();
|
|
125
|
-
if (!data.success) {
|
|
126
|
-
throw new Error(data.error);
|
|
127
|
-
}
|
|
97
|
+
const api = getApiClient();
|
|
98
|
+
const org = await api.get(`/orgs/${orgId}`);
|
|
128
99
|
spinner.stop();
|
|
129
|
-
const limits = data.limits;
|
|
130
100
|
console.log(chalk.blue.bold('\n💎 Subscription Plan\n'));
|
|
131
|
-
console.log(chalk.white.bold(`Current Plan: ${
|
|
101
|
+
console.log(chalk.white.bold(`Current Plan: ${org.plan.toUpperCase()}`));
|
|
132
102
|
console.log('');
|
|
133
103
|
console.log(chalk.white.bold('Plan Limits'));
|
|
134
104
|
// Display limits with "Unlimited" for -1 or null values
|
|
135
105
|
const formatLimit = (value) => (value === -1 || value === null) ? chalk.green('Unlimited') : chalk.gray(value.toString());
|
|
136
|
-
console.log(chalk.gray(` Max Members: ${formatLimit(
|
|
137
|
-
console.log(chalk.gray(` Max Projects: ${formatLimit(
|
|
138
|
-
console.log(chalk.gray(` Max Keys per Project: ${formatLimit(
|
|
139
|
-
console.log(chalk.gray(` Max API Keys: ${formatLimit(
|
|
106
|
+
console.log(chalk.gray(` Max Members: ${formatLimit(org.maxMembers)}`));
|
|
107
|
+
console.log(chalk.gray(` Max Projects: ${formatLimit(org.maxProjects)}`));
|
|
108
|
+
console.log(chalk.gray(` Max Keys per Project: ${formatLimit(org.maxKeysPerProject)}`));
|
|
109
|
+
console.log(chalk.gray(` Max API Keys: ${formatLimit(org.maxApiKeys)}`));
|
|
140
110
|
console.log('');
|
|
141
111
|
}
|
|
142
112
|
catch (error) {
|
|
143
113
|
spinner.fail(chalk.red('Failed to fetch plan information'));
|
|
144
114
|
console.error(chalk.red(`Error: ${error.message}\n`));
|
|
115
|
+
process.exitCode = 1;
|
|
145
116
|
}
|
|
146
117
|
}
|
|
147
118
|
//# sourceMappingURL=org.js.map
|