@orcapt/cli 1.0.1 → 1.0.3
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/README.md +0 -16
- package/bin/orca.js +30 -61
- package/package.json +1 -1
- package/src/commands/db.js +11 -11
- package/src/commands/fetch-doc.js +3 -3
- package/src/commands/kickstart-node.js +18 -18
- package/src/commands/kickstart-python.js +12 -13
- package/src/commands/lambda.js +24 -24
- package/src/commands/login.js +6 -6
- package/src/commands/storage.js +54 -183
- package/src/commands/ui.js +21 -21
- package/src/utils/index.js +1 -1
package/src/commands/lambda.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Orcapt Lambda Commands
|
|
3
3
|
* Deploy and manage Docker images on AWS Lambda
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ const {
|
|
|
19
19
|
} = require('../utils/docker-helper');
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Make API request to
|
|
22
|
+
* Make API request to Orcapt Deploy API
|
|
23
23
|
*/
|
|
24
24
|
function makeApiRequest(method, endpoint, credentials, body = null) {
|
|
25
25
|
return new Promise((resolve, reject) => {
|
|
@@ -80,7 +80,7 @@ function requireAuth() {
|
|
|
80
80
|
const credentials = getCredentials();
|
|
81
81
|
if (!credentials) {
|
|
82
82
|
console.log(chalk.red('\n✗ Not authenticated'));
|
|
83
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
83
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
84
84
|
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
return credentials;
|
|
@@ -98,7 +98,7 @@ async function lambdaDeploy(functionName, options = {}) {
|
|
|
98
98
|
|
|
99
99
|
if (!options.image) {
|
|
100
100
|
console.log(chalk.red('✗ Docker image is required'));
|
|
101
|
-
console.log(chalk.cyan('Usage:'), chalk.white('
|
|
101
|
+
console.log(chalk.cyan('Usage:'), chalk.white('orcapt lambda deploy <function-name> --image <docker-image>\n'));
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -207,7 +207,7 @@ async function lambdaDeploy(functionName, options = {}) {
|
|
|
207
207
|
console.log();
|
|
208
208
|
console.log(chalk.yellow('💡 Troubleshooting tips:'));
|
|
209
209
|
console.log(chalk.white(' 1. Check if backend is running'));
|
|
210
|
-
console.log(chalk.white(' 2. Verify your authentication:
|
|
210
|
+
console.log(chalk.white(' 2. Verify your authentication: orcapt whoami'));
|
|
211
211
|
console.log(chalk.white(' 3. Check backend logs for errors'));
|
|
212
212
|
console.log(chalk.white(' 4. Ensure AWS credentials are configured in backend .env'));
|
|
213
213
|
console.log();
|
|
@@ -276,7 +276,7 @@ async function lambdaDeploy(functionName, options = {}) {
|
|
|
276
276
|
console.log(chalk.white(' '), chalk.yellow(confirmResponse.invoke_url));
|
|
277
277
|
console.log(chalk.cyan('\nTry it:'));
|
|
278
278
|
console.log(chalk.white(' curl'), chalk.cyan(confirmResponse.invoke_url));
|
|
279
|
-
console.log(chalk.white('
|
|
279
|
+
console.log(chalk.white(' orcapt lambda invoke'), chalk.cyan(functionName));
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
if (confirmResponse.sqs_queue_url) {
|
|
@@ -292,14 +292,14 @@ async function lambdaDeploy(functionName, options = {}) {
|
|
|
292
292
|
|
|
293
293
|
if (error.statusCode === 401) {
|
|
294
294
|
console.log(chalk.red('Authentication failed'));
|
|
295
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
295
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
296
296
|
} else if (error.statusCode === 404) {
|
|
297
297
|
console.log(chalk.red('Endpoint not found'));
|
|
298
298
|
console.log(chalk.yellow('The Lambda API may not be implemented yet.'));
|
|
299
299
|
console.log(chalk.cyan('See STORAGE_LAMBDA_ARCHITECTURE.md for details\n'));
|
|
300
300
|
} else if (error.code === 'ECONNREFUSED') {
|
|
301
301
|
console.log(chalk.red('Connection refused'));
|
|
302
|
-
console.log(chalk.yellow('Cannot connect to
|
|
302
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
303
303
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
304
304
|
} else {
|
|
305
305
|
console.log(chalk.red(`Error: ${error.message}\n`));
|
|
@@ -332,7 +332,7 @@ async function lambdaList() {
|
|
|
332
332
|
|
|
333
333
|
if (response.count === 0) {
|
|
334
334
|
console.log(chalk.yellow('No Lambda functions found'));
|
|
335
|
-
console.log(chalk.cyan('\nCreate one with:'), chalk.white('
|
|
335
|
+
console.log(chalk.cyan('\nCreate one with:'), chalk.white('orcapt lambda deploy <function-name> --image <docker-image>'));
|
|
336
336
|
} else {
|
|
337
337
|
console.log(chalk.green(`✓ Found ${response.count} function${response.count > 1 ? 's' : ''}`));
|
|
338
338
|
console.log(chalk.cyan('============================================================\n'));
|
|
@@ -363,13 +363,13 @@ async function lambdaList() {
|
|
|
363
363
|
|
|
364
364
|
if (error.statusCode === 401) {
|
|
365
365
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
366
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
366
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
367
367
|
} else if (error.statusCode === 404) {
|
|
368
368
|
console.log(chalk.red('\n✗ Endpoint not found'));
|
|
369
369
|
console.log(chalk.yellow('The Lambda API may not be implemented yet.\n'));
|
|
370
370
|
} else if (error.code === 'ECONNREFUSED') {
|
|
371
371
|
console.log(chalk.red('\n✗ Connection refused'));
|
|
372
|
-
console.log(chalk.yellow('Cannot connect to
|
|
372
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
373
373
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
374
374
|
} else {
|
|
375
375
|
console.log(chalk.red(`\n✗ ${error.message}\n`));
|
|
@@ -442,7 +442,7 @@ async function lambdaInvoke(functionName, options = {}) {
|
|
|
442
442
|
|
|
443
443
|
if (error.statusCode === 401) {
|
|
444
444
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
445
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
445
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
446
446
|
} else if (error.statusCode === 404) {
|
|
447
447
|
console.log(chalk.red('\n✗ Function not found'));
|
|
448
448
|
console.log(chalk.yellow(`Function '${functionName}' does not exist or doesn't belong to your workspace.\n`));
|
|
@@ -454,7 +454,7 @@ async function lambdaInvoke(functionName, options = {}) {
|
|
|
454
454
|
console.log();
|
|
455
455
|
} else if (error.code === 'ECONNREFUSED') {
|
|
456
456
|
console.log(chalk.red('\n✗ Connection refused'));
|
|
457
|
-
console.log(chalk.yellow('Cannot connect to
|
|
457
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
458
458
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
459
459
|
} else {
|
|
460
460
|
console.log(chalk.red(`\n✗ ${error.message}\n`));
|
|
@@ -501,7 +501,7 @@ async function lambdaLogs(functionName, options = {}) {
|
|
|
501
501
|
if (!response.logs || response.logs.length === 0) {
|
|
502
502
|
console.log(chalk.yellow('No logs found'));
|
|
503
503
|
console.log(chalk.cyan('\nTry invoking the function first:'));
|
|
504
|
-
console.log(chalk.white('
|
|
504
|
+
console.log(chalk.white(' orcapt lambda invoke'), chalk.cyan(functionName));
|
|
505
505
|
} else {
|
|
506
506
|
console.log(chalk.green(`✓ Found ${response.logs.length} log entries`));
|
|
507
507
|
console.log(chalk.cyan('============================================================\n'));
|
|
@@ -537,13 +537,13 @@ async function lambdaLogs(functionName, options = {}) {
|
|
|
537
537
|
|
|
538
538
|
if (error.statusCode === 401) {
|
|
539
539
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
540
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
540
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
541
541
|
} else if (error.statusCode === 404) {
|
|
542
542
|
console.log(chalk.red('\n✗ Function not found'));
|
|
543
543
|
console.log(chalk.yellow(`Function '${functionName}' does not exist or doesn't belong to your workspace.\n`));
|
|
544
544
|
} else if (error.code === 'ECONNREFUSED') {
|
|
545
545
|
console.log(chalk.red('\n✗ Connection refused'));
|
|
546
|
-
console.log(chalk.yellow('Cannot connect to
|
|
546
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
547
547
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
548
548
|
} else {
|
|
549
549
|
console.log(chalk.red(`\n✗ ${error.message}\n`));
|
|
@@ -598,7 +598,7 @@ async function lambdaRemove(functionName) {
|
|
|
598
598
|
|
|
599
599
|
if (error.statusCode === 401) {
|
|
600
600
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
601
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
601
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
602
602
|
} else if (error.statusCode === 404) {
|
|
603
603
|
console.log(chalk.red('\n✗ Function not found'));
|
|
604
604
|
console.log(chalk.yellow(`Function '${functionName}' does not exist or doesn't belong to your workspace.\n`));
|
|
@@ -607,7 +607,7 @@ async function lambdaRemove(functionName) {
|
|
|
607
607
|
console.log(chalk.yellow('Function may be currently in use. Please try again later.\n'));
|
|
608
608
|
} else if (error.code === 'ECONNREFUSED') {
|
|
609
609
|
console.log(chalk.red('\n✗ Connection refused'));
|
|
610
|
-
console.log(chalk.yellow('Cannot connect to
|
|
610
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
611
611
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
612
612
|
} else {
|
|
613
613
|
console.log(chalk.red(`\n✗ ${error.message}\n`));
|
|
@@ -698,10 +698,10 @@ async function lambdaInfo(functionName) {
|
|
|
698
698
|
|
|
699
699
|
console.log(chalk.cyan('\n============================================================'));
|
|
700
700
|
console.log(chalk.gray('\nCommands:'));
|
|
701
|
-
console.log(chalk.white(' Invoke: '), chalk.cyan(`
|
|
702
|
-
console.log(chalk.white(' Logs: '), chalk.cyan(`
|
|
703
|
-
console.log(chalk.white(' Update: '), chalk.cyan(`
|
|
704
|
-
console.log(chalk.white(' Remove: '), chalk.cyan(`
|
|
701
|
+
console.log(chalk.white(' Invoke: '), chalk.cyan(`orcapt lambda invoke ${functionName}`));
|
|
702
|
+
console.log(chalk.white(' Logs: '), chalk.cyan(`orcapt lambda logs ${functionName}`));
|
|
703
|
+
console.log(chalk.white(' Update: '), chalk.cyan(`orcapt lambda update ${functionName} --image new-image:tag`));
|
|
704
|
+
console.log(chalk.white(' Remove: '), chalk.cyan(`orcapt lambda remove ${functionName}`));
|
|
705
705
|
console.log();
|
|
706
706
|
|
|
707
707
|
} catch (error) {
|
|
@@ -709,13 +709,13 @@ async function lambdaInfo(functionName) {
|
|
|
709
709
|
|
|
710
710
|
if (error.statusCode === 401) {
|
|
711
711
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
712
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
712
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
713
713
|
} else if (error.statusCode === 404) {
|
|
714
714
|
console.log(chalk.red('\n✗ Function not found'));
|
|
715
715
|
console.log(chalk.yellow(`Function '${functionName}' does not exist or doesn't belong to your workspace.\n`));
|
|
716
716
|
} else if (error.code === 'ECONNREFUSED') {
|
|
717
717
|
console.log(chalk.red('\n✗ Connection refused'));
|
|
718
|
-
console.log(chalk.yellow('Cannot connect to
|
|
718
|
+
console.log(chalk.yellow('Cannot connect to Orcapt API:'), chalk.white(API_BASE_URL));
|
|
719
719
|
console.log(chalk.cyan('Make sure the backend is running.\n'));
|
|
720
720
|
} else {
|
|
721
721
|
console.log(chalk.red(`\n✗ ${error.message}\n`));
|
package/src/commands/login.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* orcapt Login Command
|
|
3
3
|
* Authenticates users before using kickstart commands
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -14,7 +14,7 @@ const http = require('http');
|
|
|
14
14
|
const { API_BASE_URL, API_ENDPOINTS } = require('../config');
|
|
15
15
|
|
|
16
16
|
// Config file location in user's home directory
|
|
17
|
-
const CONFIG_DIR = path.join(os.homedir(), '.
|
|
17
|
+
const CONFIG_DIR = path.join(os.homedir(), '.orcapt');
|
|
18
18
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -83,7 +83,7 @@ function authenticate(mode, workspace, token) {
|
|
|
83
83
|
*/
|
|
84
84
|
function saveCredentials(mode, workspace, token) {
|
|
85
85
|
try {
|
|
86
|
-
// Create .
|
|
86
|
+
// Create .orcapt directory if it doesn't exist
|
|
87
87
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
88
88
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
89
89
|
}
|
|
@@ -109,7 +109,7 @@ function saveCredentials(mode, workspace, token) {
|
|
|
109
109
|
*/
|
|
110
110
|
async function login() {
|
|
111
111
|
console.log(chalk.cyan('\n============================================================'));
|
|
112
|
-
console.log(chalk.cyan('🔐
|
|
112
|
+
console.log(chalk.cyan('🔐 orcapt Login'));
|
|
113
113
|
console.log(chalk.cyan('============================================================\n'));
|
|
114
114
|
|
|
115
115
|
let authenticated = false;
|
|
@@ -123,7 +123,7 @@ async function login() {
|
|
|
123
123
|
{
|
|
124
124
|
type: 'list',
|
|
125
125
|
name: 'mode',
|
|
126
|
-
message: 'Select your
|
|
126
|
+
message: 'Select your orcapt mode:',
|
|
127
127
|
choices: [
|
|
128
128
|
{ name: 'Sandbox/Pro mode', value: 'dev' },
|
|
129
129
|
{ name: 'Team mode', value: 'team' }
|
|
@@ -183,7 +183,7 @@ async function login() {
|
|
|
183
183
|
|
|
184
184
|
if (saved) {
|
|
185
185
|
console.log(chalk.green('\n✓ Credentials saved successfully'));
|
|
186
|
-
console.log(chalk.cyan('\nYou can now use:'), chalk.white('
|
|
186
|
+
console.log(chalk.cyan('\nYou can now use:'), chalk.white('orcapt kickstart <language>'));
|
|
187
187
|
console.log(chalk.cyan('============================================================\n'));
|
|
188
188
|
}
|
|
189
189
|
|