@basictech/cli 0.0.21 → 0.0.24
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/commands/account.d.ts +2 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +18 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/debug.d.ts +2 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +6 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +111 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +20 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +7 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/projects.d.ts +2 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +90 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/pull.d.ts +2 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +366 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +403 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +385 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/teams.d.ts +2 -0
- package/dist/commands/teams.d.ts.map +1 -0
- package/dist/commands/teams.js +164 -0
- package/dist/commands/teams.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +76 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/version.d.ts +2 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +21 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/components/Form.d.ts +15 -0
- package/dist/components/Form.d.ts.map +1 -0
- package/dist/components/Form.js +69 -0
- package/dist/components/Form.js.map +1 -0
- package/dist/components/InitForm.d.ts +17 -0
- package/dist/components/InitForm.d.ts.map +1 -0
- package/dist/components/InitForm.js +358 -0
- package/dist/components/InitForm.js.map +1 -0
- package/dist/components/Spinner.d.ts +7 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +15 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Table.d.ts +24 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +69 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/TeamForm.d.ts +10 -0
- package/dist/components/TeamForm.d.ts.map +1 -0
- package/dist/components/TeamForm.js +193 -0
- package/dist/components/TeamForm.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +243 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +23 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +133 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/auth.d.ts +17 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +288 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/config-templates.d.ts +9 -0
- package/dist/lib/config-templates.d.ts.map +1 -0
- package/dist/lib/config-templates.js +117 -0
- package/dist/lib/config-templates.js.map +1 -0
- package/dist/lib/constants.d.ts +18 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +32 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/errors.d.ts +21 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +75 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/platform.d.ts +11 -0
- package/dist/lib/platform.d.ts.map +1 -0
- package/dist/lib/platform.js +133 -0
- package/dist/lib/platform.js.map +1 -0
- package/dist/lib/schema.d.ts +24 -0
- package/dist/lib/schema.d.ts.map +1 -0
- package/dist/lib/schema.js +162 -0
- package/dist/lib/schema.js.map +1 -0
- package/dist/lib/types.d.ts +111 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +22 -0
- package/dist/lib/version.js.map +1 -0
- package/package.json +63 -12
- package/readme.md +92 -35
- package/bin/readme.md +0 -61
- package/index.js +0 -108
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render, Box, Text } from 'ink';
|
|
4
|
+
import { Spinner } from '../components/Spinner';
|
|
5
|
+
import { ApiClient } from '../lib/api';
|
|
6
|
+
import { AuthService } from '../lib/auth';
|
|
7
|
+
import { readSchemaFromConfig, compareVersions } from '../lib/schema';
|
|
8
|
+
import { isOnline } from '../lib/platform';
|
|
9
|
+
import { MESSAGES } from '../lib/constants';
|
|
10
|
+
function StatusApp() {
|
|
11
|
+
const [state, setState] = React.useState({
|
|
12
|
+
loading: true,
|
|
13
|
+
error: null
|
|
14
|
+
});
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
async function checkStatus() {
|
|
17
|
+
try {
|
|
18
|
+
// Check if online
|
|
19
|
+
if (!(await isOnline())) {
|
|
20
|
+
setState({
|
|
21
|
+
loading: false,
|
|
22
|
+
error: MESSAGES.OFFLINE,
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// Check authentication
|
|
27
|
+
const authService = AuthService.getInstance();
|
|
28
|
+
const token = await authService.getToken();
|
|
29
|
+
if (!token) {
|
|
30
|
+
setState({
|
|
31
|
+
loading: false,
|
|
32
|
+
error: MESSAGES.LOGGED_OUT,
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Read local schema
|
|
37
|
+
const localConfig = await readSchemaFromConfig();
|
|
38
|
+
if (!localConfig) {
|
|
39
|
+
setState({
|
|
40
|
+
loading: false,
|
|
41
|
+
error: null,
|
|
42
|
+
result: {
|
|
43
|
+
status: 'no-schema',
|
|
44
|
+
projectId: '',
|
|
45
|
+
localVersion: 0,
|
|
46
|
+
remoteVersion: 0,
|
|
47
|
+
message: ['No schema found in config files'],
|
|
48
|
+
suggestions: [
|
|
49
|
+
'Run \'basic init\' to create a new project or import an existing project',
|
|
50
|
+
'Make sure you\'re in a directory with a basic.config.ts/js file',
|
|
51
|
+
'Check if your config file has the correct name and format'
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Get remote schema
|
|
58
|
+
const apiClient = ApiClient.getInstance();
|
|
59
|
+
let remoteSchema = null;
|
|
60
|
+
try {
|
|
61
|
+
remoteSchema = await apiClient.getProjectSchema(localConfig.projectId);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
setState({
|
|
65
|
+
loading: false,
|
|
66
|
+
error: null,
|
|
67
|
+
result: {
|
|
68
|
+
status: 'invalid',
|
|
69
|
+
projectId: localConfig.projectId,
|
|
70
|
+
localVersion: localConfig.schema.version || 0,
|
|
71
|
+
remoteVersion: 0,
|
|
72
|
+
message: [
|
|
73
|
+
`Project ID: ${localConfig.projectId}`,
|
|
74
|
+
`Error fetching remote schema: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
75
|
+
],
|
|
76
|
+
suggestions: [
|
|
77
|
+
'Check if the project ID is correct',
|
|
78
|
+
'Ensure you have access to this project',
|
|
79
|
+
'Verify your internet connection',
|
|
80
|
+
'Try running \'basic login\' if authentication has expired'
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Create empty schema if none exists remotely
|
|
87
|
+
if (!remoteSchema) {
|
|
88
|
+
remoteSchema = {
|
|
89
|
+
project_id: localConfig.projectId,
|
|
90
|
+
version: 0,
|
|
91
|
+
tables: {}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Compare versions
|
|
95
|
+
const comparison = compareVersions(localConfig.schema, remoteSchema);
|
|
96
|
+
const result = await analyzeStatus(localConfig, remoteSchema, comparison);
|
|
97
|
+
setState({
|
|
98
|
+
loading: false,
|
|
99
|
+
error: null,
|
|
100
|
+
result
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
setState({
|
|
105
|
+
loading: false,
|
|
106
|
+
error: error instanceof Error ? error.message : 'Failed to check status'
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
checkStatus();
|
|
111
|
+
}, []);
|
|
112
|
+
if (state.loading) {
|
|
113
|
+
return _jsx(Spinner, { text: "Checking status..." });
|
|
114
|
+
}
|
|
115
|
+
if (state.error) {
|
|
116
|
+
return (_jsx(Box, { flexDirection: "column", children: _jsxs(Text, { color: "red", children: ["Error: ", state.error] }) }));
|
|
117
|
+
}
|
|
118
|
+
if (state.result) {
|
|
119
|
+
return _jsx(StatusDisplay, { result: state.result });
|
|
120
|
+
}
|
|
121
|
+
return _jsx(Text, { children: "Unknown status" });
|
|
122
|
+
}
|
|
123
|
+
async function analyzeStatus(localConfig, remoteSchema, comparison) {
|
|
124
|
+
const apiClient = ApiClient.getInstance();
|
|
125
|
+
const { schema: localSchema, projectId } = localConfig;
|
|
126
|
+
const baseResult = {
|
|
127
|
+
projectId,
|
|
128
|
+
localVersion: comparison.localVersion,
|
|
129
|
+
remoteVersion: comparison.remoteVersion,
|
|
130
|
+
message: [`Project ID: ${projectId}`],
|
|
131
|
+
suggestions: []
|
|
132
|
+
};
|
|
133
|
+
// Add version info
|
|
134
|
+
if (comparison.remoteVersion > 0) {
|
|
135
|
+
baseResult.message.push(`Remote schema version: ${comparison.remoteVersion}`);
|
|
136
|
+
}
|
|
137
|
+
switch (comparison.status) {
|
|
138
|
+
case 'behind':
|
|
139
|
+
return {
|
|
140
|
+
...baseResult,
|
|
141
|
+
status: 'behind',
|
|
142
|
+
message: [
|
|
143
|
+
...baseResult.message,
|
|
144
|
+
`Schema is out of date! Current: ${comparison.localVersion}, Latest: ${comparison.remoteVersion}`
|
|
145
|
+
],
|
|
146
|
+
suggestions: [
|
|
147
|
+
'Run \'basic pull\' to update your local schema',
|
|
148
|
+
'Review the changes before pulling if you have local modifications',
|
|
149
|
+
'Consider backing up your current schema if you have unsaved work'
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
case 'ahead':
|
|
153
|
+
// Validate the local schema since it's ahead
|
|
154
|
+
try {
|
|
155
|
+
const validation = await apiClient.validateSchema(localSchema);
|
|
156
|
+
if (validation.valid === false && validation.errors) {
|
|
157
|
+
return {
|
|
158
|
+
...baseResult,
|
|
159
|
+
status: 'invalid',
|
|
160
|
+
message: [
|
|
161
|
+
...baseResult.message,
|
|
162
|
+
`Changes found: Local schema version ${comparison.localVersion} is ahead of remote version ${comparison.remoteVersion}`,
|
|
163
|
+
'Errors found in schema! Please fix:'
|
|
164
|
+
],
|
|
165
|
+
validationErrors: validation.errors,
|
|
166
|
+
suggestions: [
|
|
167
|
+
'Fix the validation errors shown below',
|
|
168
|
+
'Run \'basic status\' again after fixing errors',
|
|
169
|
+
'Review your schema syntax and field definitions'
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
...baseResult,
|
|
175
|
+
status: 'ahead',
|
|
176
|
+
message: [
|
|
177
|
+
...baseResult.message,
|
|
178
|
+
`Changes found: Local schema version ${comparison.localVersion} is ahead of remote version ${comparison.remoteVersion}`,
|
|
179
|
+
'Schema changes are valid!'
|
|
180
|
+
],
|
|
181
|
+
suggestions: [
|
|
182
|
+
'Run \'basic push\' to publish your changes',
|
|
183
|
+
'Review your changes before publishing',
|
|
184
|
+
'Test your schema locally if possible'
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return {
|
|
190
|
+
...baseResult,
|
|
191
|
+
status: 'invalid',
|
|
192
|
+
message: [
|
|
193
|
+
...baseResult.message,
|
|
194
|
+
`Error validating schema: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
195
|
+
],
|
|
196
|
+
suggestions: [
|
|
197
|
+
'Check your schema for syntax errors',
|
|
198
|
+
'Ensure all required fields are present',
|
|
199
|
+
'Verify your basic.config file is valid JSON/JavaScript'
|
|
200
|
+
]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
case 'equal':
|
|
204
|
+
// Same version - check for conflicts
|
|
205
|
+
if (comparison.localVersion === 0 && comparison.remoteVersion === 0) {
|
|
206
|
+
// Both at version 0 - validate and suggest incrementing
|
|
207
|
+
try {
|
|
208
|
+
const validation = await apiClient.validateSchema(localSchema);
|
|
209
|
+
if (validation.valid === false && validation.errors) {
|
|
210
|
+
return {
|
|
211
|
+
...baseResult,
|
|
212
|
+
status: 'invalid',
|
|
213
|
+
message: [
|
|
214
|
+
...baseResult.message,
|
|
215
|
+
'Errors found in schema! Please fix:'
|
|
216
|
+
],
|
|
217
|
+
validationErrors: validation.errors,
|
|
218
|
+
suggestions: [
|
|
219
|
+
'Fix the validation errors shown below',
|
|
220
|
+
'Run \'basic status\' again after fixing errors'
|
|
221
|
+
]
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
// Schema is valid and ready to push
|
|
225
|
+
return {
|
|
226
|
+
...baseResult,
|
|
227
|
+
status: 'ahead',
|
|
228
|
+
message: [
|
|
229
|
+
...baseResult.message,
|
|
230
|
+
'',
|
|
231
|
+
'Schema changes are valid!',
|
|
232
|
+
'Please increment your version number to 1',
|
|
233
|
+
'and run \'basic push\' if you are ready to publish your changes.'
|
|
234
|
+
],
|
|
235
|
+
suggestions: [
|
|
236
|
+
'Update the version field in your schema from 0 to 1',
|
|
237
|
+
'Run \'basic push\' after incrementing the version',
|
|
238
|
+
'Ensure your schema changes are tested and ready for production'
|
|
239
|
+
]
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
return {
|
|
244
|
+
...baseResult,
|
|
245
|
+
status: 'invalid',
|
|
246
|
+
message: [
|
|
247
|
+
...baseResult.message,
|
|
248
|
+
`Error validating schema: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
249
|
+
],
|
|
250
|
+
suggestions: [
|
|
251
|
+
'Check your schema for syntax errors'
|
|
252
|
+
]
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Same non-zero version - check for conflicts
|
|
258
|
+
try {
|
|
259
|
+
const comparison = await apiClient.compareSchema(localSchema);
|
|
260
|
+
if (comparison.valid) {
|
|
261
|
+
return {
|
|
262
|
+
...baseResult,
|
|
263
|
+
status: 'current',
|
|
264
|
+
message: [
|
|
265
|
+
...baseResult.message,
|
|
266
|
+
'Schema is up to date!'
|
|
267
|
+
],
|
|
268
|
+
suggestions: [
|
|
269
|
+
'Continue working on your project',
|
|
270
|
+
'Make schema modifications if needed',
|
|
271
|
+
'Run \'basic status\' again after making changes'
|
|
272
|
+
]
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
return {
|
|
277
|
+
...baseResult,
|
|
278
|
+
status: 'conflict',
|
|
279
|
+
message: [
|
|
280
|
+
...baseResult.message,
|
|
281
|
+
'',
|
|
282
|
+
'Schema conflicts found! Your local schema is different from the remote schema.'
|
|
283
|
+
],
|
|
284
|
+
suggestions: [
|
|
285
|
+
'Run \'basic pull\' to override local changes with remote schema',
|
|
286
|
+
'Or increment the version number in your local schema',
|
|
287
|
+
'Compare your local changes with the remote version before deciding',
|
|
288
|
+
'Consider creating a backup of your local changes'
|
|
289
|
+
]
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
return {
|
|
295
|
+
...baseResult,
|
|
296
|
+
status: 'invalid',
|
|
297
|
+
message: [
|
|
298
|
+
...baseResult.message,
|
|
299
|
+
`Error checking schema conflict: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
300
|
+
],
|
|
301
|
+
suggestions: [
|
|
302
|
+
'Check your network connection',
|
|
303
|
+
'Ensure the project ID is correct'
|
|
304
|
+
]
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
default:
|
|
309
|
+
return {
|
|
310
|
+
...baseResult,
|
|
311
|
+
status: 'invalid',
|
|
312
|
+
message: [
|
|
313
|
+
...baseResult.message,
|
|
314
|
+
'Unknown schema status'
|
|
315
|
+
],
|
|
316
|
+
suggestions: [
|
|
317
|
+
'Try running \'basic status\' again'
|
|
318
|
+
]
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function StatusDisplay({ result }) {
|
|
323
|
+
const getStatusColor = () => {
|
|
324
|
+
switch (result.status) {
|
|
325
|
+
case 'current':
|
|
326
|
+
return 'green';
|
|
327
|
+
case 'ahead':
|
|
328
|
+
return 'blue';
|
|
329
|
+
case 'behind':
|
|
330
|
+
return 'yellow';
|
|
331
|
+
case 'conflict':
|
|
332
|
+
return 'magenta';
|
|
333
|
+
case 'invalid':
|
|
334
|
+
return 'red';
|
|
335
|
+
case 'no-schema':
|
|
336
|
+
return 'gray';
|
|
337
|
+
default:
|
|
338
|
+
return 'white';
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const getStatusIcon = () => {
|
|
342
|
+
switch (result.status) {
|
|
343
|
+
case 'current':
|
|
344
|
+
return '✅';
|
|
345
|
+
case 'ahead':
|
|
346
|
+
return '🚀';
|
|
347
|
+
case 'behind':
|
|
348
|
+
return '⬇️';
|
|
349
|
+
case 'conflict':
|
|
350
|
+
return '⚠️';
|
|
351
|
+
case 'invalid':
|
|
352
|
+
return '❌';
|
|
353
|
+
case 'no-schema':
|
|
354
|
+
return '📄';
|
|
355
|
+
default:
|
|
356
|
+
return '❓';
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const getStatusDescription = () => {
|
|
360
|
+
switch (result.status) {
|
|
361
|
+
case 'current':
|
|
362
|
+
return 'Schema is up to date';
|
|
363
|
+
case 'ahead':
|
|
364
|
+
return 'Schema is ready to push';
|
|
365
|
+
case 'behind':
|
|
366
|
+
return 'Schema is out of date';
|
|
367
|
+
case 'conflict':
|
|
368
|
+
return 'Schema conflicts detected';
|
|
369
|
+
case 'invalid':
|
|
370
|
+
return 'Schema has validation errors';
|
|
371
|
+
case 'no-schema':
|
|
372
|
+
return 'No schema file found';
|
|
373
|
+
default:
|
|
374
|
+
return 'Unknown status';
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
// Filter out project ID and version info from messages since we'll show them separately
|
|
378
|
+
const statusMessages = result.message.filter(msg => !msg.startsWith('Project ID:') &&
|
|
379
|
+
!msg.startsWith('Remote schema version:'));
|
|
380
|
+
return (_jsxs(Box, { flexDirection: "column", children: [result.projectId && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { color: "cyan", children: ["Project ID: ", result.projectId] }), _jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: ["Local version: ", result.localVersion] }), result.remoteVersion > 0 && (_jsxs(Text, { color: "gray", children: [" \u2022 Remote version: ", result.remoteVersion] }))] })] })), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { color: getStatusColor(), children: [getStatusIcon(), " ", getStatusDescription()] }) }), statusMessages.length > 0 && (_jsx(Box, { flexDirection: "column", children: statusMessages.map((line, index) => (_jsx(Text, { children: line }, index))) }))] }), result.validationErrors && result.validationErrors.length > 0 && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: "red", children: "Validation errors:" }), result.validationErrors.map((error, index) => (_jsxs(Text, { color: "red", children: ["\u2022 ", error.message, " at ", error.instancePath || 'root'] }, index)))] })), result.suggestions.length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: "blue", children: "Next steps:" }), result.suggestions.map((suggestion, index) => (_jsxs(Text, { color: "gray", children: ["\u2022 ", suggestion] }, index)))] }))] }));
|
|
381
|
+
}
|
|
382
|
+
export async function StatusCommand() {
|
|
383
|
+
render(_jsx(StatusApp, {}));
|
|
384
|
+
}
|
|
385
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAoB5C,SAAS,SAAS;IAChB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAc;QACpD,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,KAAK,UAAU,WAAW;YACxB,IAAI,CAAC;gBACH,kBAAkB;gBAClB,IAAI,CAAC,CAAC,M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AAC,KAAK,mCAA0B,EAC1C,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7C,MAAC,IAAI,IAAa,KAAK,EAAC,KAAK,wBACxB,KAAK,CAAC,OAAO,UAAM,KAAK,CAAC,YAAY,IAAI,MAAM,KADzC,KAAK,CAET,CACR,CAAC,IACE,CACP,EAGA,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CAChC,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,aACtC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,4BAAmB,EACpC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,CAC7C,MAAC,IAAI,IAAa,KAAK,EAAC,MAAM,wBACzB,UAAU,KADJ,KAAK,CAET,CACR,CAAC,IACE,CACP,IACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,CAAC,KAAC,SAAS,KAAG,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.d.ts","sourceRoot":"","sources":["../../src/commands/teams.tsx"],"names":[],"mappings":"AAoNA,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQjE"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render, Box, Text } from 'ink';
|
|
4
|
+
import { Table } from '../components/Table';
|
|
5
|
+
import { Spinner } from '../components/Spinner';
|
|
6
|
+
import { TeamForm } from '../components/TeamForm';
|
|
7
|
+
import { ApiClient } from '../lib/api';
|
|
8
|
+
import { AuthService } from '../lib/auth';
|
|
9
|
+
import { isOnline, openBrowser, copyToClipboard } from '../lib/platform';
|
|
10
|
+
import { MESSAGES } from '../lib/constants';
|
|
11
|
+
function TeamsApp() {
|
|
12
|
+
const [state, setState] = React.useState({
|
|
13
|
+
loading: true,
|
|
14
|
+
teams: [],
|
|
15
|
+
error: null
|
|
16
|
+
});
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
async function loadTeams() {
|
|
19
|
+
try {
|
|
20
|
+
// Check if online
|
|
21
|
+
if (!(await isOnline())) {
|
|
22
|
+
setState(prev => ({ ...prev, loading: false, error: MESSAGES.OFFLINE }));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Check if logged in
|
|
26
|
+
const authService = AuthService.getInstance();
|
|
27
|
+
const token = await authService.getToken();
|
|
28
|
+
if (!token) {
|
|
29
|
+
setState(prev => ({ ...prev, loading: false, error: MESSAGES.LOGGED_OUT }));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Fetch teams
|
|
33
|
+
const apiClient = ApiClient.getInstance();
|
|
34
|
+
const teams = await apiClient.getTeams();
|
|
35
|
+
setState({
|
|
36
|
+
loading: false,
|
|
37
|
+
teams,
|
|
38
|
+
error: null
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
setState({
|
|
43
|
+
loading: false,
|
|
44
|
+
teams: [],
|
|
45
|
+
error: error instanceof Error ? error.message : 'Failed to load teams'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
loadTeams();
|
|
50
|
+
}, []);
|
|
51
|
+
const handleCopy = async (row) => {
|
|
52
|
+
try {
|
|
53
|
+
await copyToClipboard(row.id);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
// Silent fail - notification already shown by Table component
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const handleOpen = async (row) => {
|
|
60
|
+
try {
|
|
61
|
+
await openBrowser(`https://app.basic.tech/team/${row.slug}`);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// Silent fail - browser opening is best effort
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleExit = () => {
|
|
68
|
+
process.exit(0);
|
|
69
|
+
};
|
|
70
|
+
const handleNew = () => {
|
|
71
|
+
// Re-render with the new team form
|
|
72
|
+
render(_jsx(NewTeamApp, {}));
|
|
73
|
+
};
|
|
74
|
+
if (state.loading) {
|
|
75
|
+
return _jsx(Spinner, { text: "Loading teams..." });
|
|
76
|
+
}
|
|
77
|
+
if (state.error) {
|
|
78
|
+
return _jsx(Text, { color: "red", children: state.error });
|
|
79
|
+
}
|
|
80
|
+
const columns = [
|
|
81
|
+
{ title: 'ID', width: 38, key: 'id' },
|
|
82
|
+
{ title: 'Name', width: 25, key: 'name' },
|
|
83
|
+
{ title: 'Role', width: 20, key: 'role_name' }
|
|
84
|
+
];
|
|
85
|
+
const rows = state.teams.map(team => ({
|
|
86
|
+
id: team.id,
|
|
87
|
+
name: team.name,
|
|
88
|
+
role_name: team.role_name || 'Member',
|
|
89
|
+
slug: team.slug
|
|
90
|
+
}));
|
|
91
|
+
return (_jsx(Table, { columns: columns, rows: rows, onCopy: handleCopy, onOpen: handleOpen, onExit: handleExit, onNew: handleNew, helpText: {
|
|
92
|
+
copyAction: "'c' to copy team ID",
|
|
93
|
+
openAction: "'o' to open in browser",
|
|
94
|
+
newAction: "'n' to create a new team"
|
|
95
|
+
} }));
|
|
96
|
+
}
|
|
97
|
+
function NewTeamApp() {
|
|
98
|
+
const [state, setState] = React.useState({
|
|
99
|
+
loading: false,
|
|
100
|
+
error: null,
|
|
101
|
+
success: false,
|
|
102
|
+
teamName: '',
|
|
103
|
+
teamSlug: ''
|
|
104
|
+
});
|
|
105
|
+
const handleSubmit = async (data) => {
|
|
106
|
+
setState(prev => ({ ...prev, loading: true, error: null }));
|
|
107
|
+
try {
|
|
108
|
+
// Check if online
|
|
109
|
+
if (!(await isOnline())) {
|
|
110
|
+
setState(prev => ({ ...prev, loading: false, error: MESSAGES.OFFLINE }));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
// Check if logged in
|
|
114
|
+
const authService = AuthService.getInstance();
|
|
115
|
+
const token = await authService.getToken();
|
|
116
|
+
if (!token) {
|
|
117
|
+
setState(prev => ({ ...prev, loading: false, error: MESSAGES.LOGGED_OUT }));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Create team
|
|
121
|
+
const apiClient = ApiClient.getInstance();
|
|
122
|
+
await apiClient.createTeam(data.teamName, data.teamSlug);
|
|
123
|
+
setState({
|
|
124
|
+
loading: false,
|
|
125
|
+
error: null,
|
|
126
|
+
success: true,
|
|
127
|
+
teamName: data.teamName,
|
|
128
|
+
teamSlug: data.teamSlug
|
|
129
|
+
});
|
|
130
|
+
// Exit after 2 seconds
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}, 2000);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
setState(prev => ({
|
|
137
|
+
...prev,
|
|
138
|
+
loading: false,
|
|
139
|
+
error: error instanceof Error ? error.message : 'Failed to create team'
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
if (state.loading) {
|
|
144
|
+
return _jsx(Spinner, { text: "Creating team..." });
|
|
145
|
+
}
|
|
146
|
+
if (state.success) {
|
|
147
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: "green", children: ["\u2705 Team \"", state.teamName, "\" created successfully!"] }), _jsxs(Text, { children: ["Team slug: ", state.teamSlug] })] }));
|
|
148
|
+
}
|
|
149
|
+
if (state.error) {
|
|
150
|
+
return _jsx(Text, { color: "red", children: state.error });
|
|
151
|
+
}
|
|
152
|
+
return (_jsx(TeamForm, { title: "Create New Team", onSubmit: handleSubmit, onCancel: () => process.exit(0) }));
|
|
153
|
+
}
|
|
154
|
+
export async function TeamsCommand(action) {
|
|
155
|
+
if (action === 'new') {
|
|
156
|
+
// Render team creation form
|
|
157
|
+
render(_jsx(NewTeamApp, {}));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Default: render teams list
|
|
161
|
+
render(_jsx(TeamsApp, {}));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teams.js","sourceRoot":"","sources":["../../src/commands/teams.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,KAAK,EAAyB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiB5C,SAAS,QAAQ;IACf,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAa;QACnD,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IAEH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,KAAK,UAAU,SAAS;YACtB,IAAI,CAAC;gBACH,kBAAkB;gBAClB,IAAI,CAAC,CAAC,MAAM,QAAQ,EAAE,CAAC,EAAE,CAAC;oBACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAA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