@orcapt/cli 1.0.0 → 1.0.2
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/bin/orca.js +24 -24
- 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 +13 -13
- package/src/commands/ui.js +22 -22
- package/src/utils/index.js +1 -1
package/bin/orca.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Entry point for the
|
|
4
|
+
* orcapt CLI - Command Line Interface
|
|
5
|
+
* Entry point for the orcapt CLI tool
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const { program } = require('commander');
|
|
@@ -35,15 +35,15 @@ const packageJson = JSON.parse(
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
program
|
|
38
|
-
.name('
|
|
39
|
-
.description('CLI tool for managing
|
|
38
|
+
.name('orcapt')
|
|
39
|
+
.description('CLI tool for managing orcapt projects')
|
|
40
40
|
.version(packageJson.version);
|
|
41
41
|
|
|
42
42
|
// Middleware to check if user is logged in
|
|
43
43
|
function requireAuth(commandName) {
|
|
44
44
|
if (!isLoggedIn()) {
|
|
45
45
|
console.log(chalk.red('\n✗ You must be logged in to use this command'));
|
|
46
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
46
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
47
47
|
process.exit(1);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -51,7 +51,7 @@ function requireAuth(commandName) {
|
|
|
51
51
|
// Login command
|
|
52
52
|
program
|
|
53
53
|
.command('login')
|
|
54
|
-
.description('Authenticate with
|
|
54
|
+
.description('Authenticate with orcapt')
|
|
55
55
|
.action(login);
|
|
56
56
|
|
|
57
57
|
// Logout command
|
|
@@ -82,18 +82,18 @@ program
|
|
|
82
82
|
console.log(chalk.cyan('============================================================\n'));
|
|
83
83
|
} else {
|
|
84
84
|
console.log(chalk.red('\n✗ Not authenticated'));
|
|
85
|
-
console.log(chalk.cyan('Run:'), chalk.yellow('
|
|
85
|
+
console.log(chalk.cyan('Run:'), chalk.yellow('orcapt login'), chalk.cyan('to authenticate\n'));
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
// UI commands
|
|
90
90
|
const uiCmd = program
|
|
91
91
|
.command('ui')
|
|
92
|
-
.description('Manage
|
|
92
|
+
.description('Manage orcapt UI installation and execution');
|
|
93
93
|
|
|
94
94
|
uiCmd
|
|
95
95
|
.command('init')
|
|
96
|
-
.description('Install
|
|
96
|
+
.description('Install orcapt UI globally')
|
|
97
97
|
.action(() => {
|
|
98
98
|
requireAuth('ui init');
|
|
99
99
|
uiInit();
|
|
@@ -101,7 +101,7 @@ uiCmd
|
|
|
101
101
|
|
|
102
102
|
uiCmd
|
|
103
103
|
.command('start')
|
|
104
|
-
.description('Start the
|
|
104
|
+
.description('Start the orcapt UI')
|
|
105
105
|
.option('-p, --port <number>', 'Port for the frontend UI', '3000')
|
|
106
106
|
.option('-a, --agent-port <number>', 'Port for the agent backend', '5001')
|
|
107
107
|
.action((options) => {
|
|
@@ -111,7 +111,7 @@ uiCmd
|
|
|
111
111
|
|
|
112
112
|
uiCmd
|
|
113
113
|
.command('remove')
|
|
114
|
-
.description('Uninstall
|
|
114
|
+
.description('Uninstall orcapt UI')
|
|
115
115
|
.action(() => {
|
|
116
116
|
requireAuth('ui remove');
|
|
117
117
|
uiRemove();
|
|
@@ -150,27 +150,27 @@ dbCmd
|
|
|
150
150
|
// Kickstart command with subcommands for different languages
|
|
151
151
|
const kickstartCmd = program
|
|
152
152
|
.command('kickstart')
|
|
153
|
-
.description('Quick setup for a new
|
|
153
|
+
.description('Quick setup for a new orcapt project')
|
|
154
154
|
.action(() => {
|
|
155
155
|
requireAuth('kickstart');
|
|
156
|
-
console.log(chalk.cyan('\n📚 Usage:'), chalk.white('
|
|
156
|
+
console.log(chalk.cyan('\n📚 Usage:'), chalk.white('orcapt kickstart <language> [options]\n'));
|
|
157
157
|
console.log(chalk.cyan('Available languages:\n'));
|
|
158
158
|
console.log(chalk.green(' python'), ' - Python-based agent (FastAPI + OpenAI)', chalk.green('✓ Available'));
|
|
159
159
|
console.log(chalk.green(' node'), ' - Node.js-based agent (Express + OpenAI)', chalk.green('✓ Available'));
|
|
160
160
|
console.log(chalk.yellow(' go'), ' - Go-based agent', chalk.yellow('🚧 Coming soon'));
|
|
161
161
|
console.log();
|
|
162
162
|
console.log(chalk.cyan('Examples:'));
|
|
163
|
-
console.log(chalk.white('
|
|
164
|
-
console.log(chalk.white('
|
|
163
|
+
console.log(chalk.white(' orcapt kickstart python'));
|
|
164
|
+
console.log(chalk.white(' orcapt kickstart node'));
|
|
165
165
|
console.log();
|
|
166
|
-
console.log(chalk.cyan('Help:'), chalk.white('
|
|
166
|
+
console.log(chalk.cyan('Help:'), chalk.white('orcapt kickstart <language> --help\n'));
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
// Python starter kit
|
|
170
170
|
kickstartCmd
|
|
171
171
|
.command('python')
|
|
172
|
-
.description('Set up a Python-based
|
|
173
|
-
.option('-d, --directory <name>', 'Directory name for the project', '
|
|
172
|
+
.description('Set up a Python-based orcapt agent (FastAPI + OpenAI)')
|
|
173
|
+
.option('-d, --directory <name>', 'Directory name for the project', 'orcapt-kickstart')
|
|
174
174
|
.option('-p, --port <number>', 'Port for the frontend UI', '3000')
|
|
175
175
|
.option('-a, --agent-port <number>', 'Port for the agent backend', '5001')
|
|
176
176
|
.option('--no-start', 'Skip starting the servers after setup')
|
|
@@ -182,8 +182,8 @@ kickstartCmd
|
|
|
182
182
|
// Node.js starter kit
|
|
183
183
|
kickstartCmd
|
|
184
184
|
.command('node')
|
|
185
|
-
.description('Set up a Node.js-based
|
|
186
|
-
.option('-d, --directory <name>', 'Directory name for the project', '
|
|
185
|
+
.description('Set up a Node.js-based orcapt agent (Express + OpenAI)')
|
|
186
|
+
.option('-d, --directory <name>', 'Directory name for the project', 'orcapt-kickstart')
|
|
187
187
|
.option('-p, --port <number>', 'Port for the frontend UI', '3000')
|
|
188
188
|
.option('-a, --agent-port <number>', 'Port for the agent backend', '5001')
|
|
189
189
|
.option('--no-start', 'Skip starting the servers after setup')
|
|
@@ -194,10 +194,10 @@ kickstartCmd
|
|
|
194
194
|
|
|
195
195
|
kickstartCmd
|
|
196
196
|
.command('go')
|
|
197
|
-
.description('Set up a Go-based
|
|
197
|
+
.description('Set up a Go-based orcapt agent (Coming soon)')
|
|
198
198
|
.action(() => {
|
|
199
199
|
console.log(chalk.yellow('\n⚠ Go starter kit is coming soon!'));
|
|
200
|
-
console.log(chalk.cyan('For now, use:'), chalk.white('
|
|
200
|
+
console.log(chalk.cyan('For now, use:'), chalk.white('orcapt kickstart python\n'));
|
|
201
201
|
});
|
|
202
202
|
|
|
203
203
|
// Fetch commands
|
|
@@ -207,7 +207,7 @@ const fetchCmd = program
|
|
|
207
207
|
|
|
208
208
|
fetchCmd
|
|
209
209
|
.command('doc')
|
|
210
|
-
.description('Download
|
|
210
|
+
.description('Download orcapt SDK documentation')
|
|
211
211
|
.action(fetchDoc);
|
|
212
212
|
|
|
213
213
|
// Storage commands
|
|
@@ -392,7 +392,7 @@ lambdaCmd
|
|
|
392
392
|
// Handle unknown commands
|
|
393
393
|
program.on('command:*', () => {
|
|
394
394
|
console.error(chalk.red(`\n✗ Invalid command: ${program.args.join(' ')}\n`));
|
|
395
|
-
console.log(chalk.cyan('Run'), chalk.yellow('
|
|
395
|
+
console.log(chalk.cyan('Run'), chalk.yellow('orcapt --help'), chalk.cyan('to see available commands\n'));
|
|
396
396
|
process.exit(1);
|
|
397
397
|
});
|
|
398
398
|
|
package/package.json
CHANGED
package/src/commands/db.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Manage PostgreSQL databases via
|
|
2
|
+
* orcapt Database Commands
|
|
3
|
+
* Manage PostgreSQL databases via orcapt Deploy API
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const chalk = require('chalk');
|
|
@@ -11,7 +11,7 @@ const { getCredentials } = require('./login');
|
|
|
11
11
|
const { API_BASE_URL, API_ENDPOINTS } = require('../config');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Make API request to
|
|
14
|
+
* Make API request to orcapt Deploy API
|
|
15
15
|
*/
|
|
16
16
|
function makeApiRequest(method, path, credentials) {
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
@@ -73,7 +73,7 @@ async function dbCreate(options) {
|
|
|
73
73
|
const credentials = getCredentials();
|
|
74
74
|
if (!credentials) {
|
|
75
75
|
console.log(chalk.red('✗ Not authenticated'));
|
|
76
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
76
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
77
77
|
process.exit(1);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -112,7 +112,7 @@ async function dbCreate(options) {
|
|
|
112
112
|
|
|
113
113
|
if (error.statusCode === 401) {
|
|
114
114
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
115
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
115
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
116
116
|
} else if (error.response && error.response.detail) {
|
|
117
117
|
console.log(chalk.red(`\n✗ ${error.response.detail}\n`));
|
|
118
118
|
} else {
|
|
@@ -134,7 +134,7 @@ async function dbList() {
|
|
|
134
134
|
const credentials = getCredentials();
|
|
135
135
|
if (!credentials) {
|
|
136
136
|
console.log(chalk.red('✗ Not authenticated'));
|
|
137
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
137
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
138
138
|
process.exit(1);
|
|
139
139
|
}
|
|
140
140
|
|
|
@@ -152,7 +152,7 @@ async function dbList() {
|
|
|
152
152
|
|
|
153
153
|
if (response.count === 0) {
|
|
154
154
|
console.log(chalk.yellow('No databases found'));
|
|
155
|
-
console.log(chalk.cyan('\nCreate one with:'), chalk.white('
|
|
155
|
+
console.log(chalk.cyan('\nCreate one with:'), chalk.white('orcapt db create --postgres'));
|
|
156
156
|
} else {
|
|
157
157
|
console.log(chalk.green(`✓ Found ${response.count} database${response.count > 1 ? 's' : ''}`));
|
|
158
158
|
console.log(chalk.cyan('============================================================\n'));
|
|
@@ -172,7 +172,7 @@ async function dbList() {
|
|
|
172
172
|
|
|
173
173
|
if (error.statusCode === 401) {
|
|
174
174
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
175
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
175
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
176
176
|
} else if (error.response && error.response.detail) {
|
|
177
177
|
console.log(chalk.red(`\n✗ ${error.response.detail}\n`));
|
|
178
178
|
} else {
|
|
@@ -188,7 +188,7 @@ async function dbList() {
|
|
|
188
188
|
async function dbRemove(databaseName) {
|
|
189
189
|
if (!databaseName) {
|
|
190
190
|
console.log(chalk.red('\n✗ Database name is required'));
|
|
191
|
-
console.log(chalk.cyan('Usage:'), chalk.white('
|
|
191
|
+
console.log(chalk.cyan('Usage:'), chalk.white('orcapt db remove <database-name>\n'));
|
|
192
192
|
process.exit(1);
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -200,7 +200,7 @@ async function dbRemove(databaseName) {
|
|
|
200
200
|
const credentials = getCredentials();
|
|
201
201
|
if (!credentials) {
|
|
202
202
|
console.log(chalk.red('✗ Not authenticated'));
|
|
203
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
203
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
204
204
|
process.exit(1);
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -228,7 +228,7 @@ async function dbRemove(databaseName) {
|
|
|
228
228
|
|
|
229
229
|
if (error.statusCode === 401) {
|
|
230
230
|
console.log(chalk.red('\n✗ Authentication failed'));
|
|
231
|
-
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('
|
|
231
|
+
console.log(chalk.yellow('Your session may have expired. Please run:'), chalk.white('orcapt login\n'));
|
|
232
232
|
} else if (error.statusCode === 404) {
|
|
233
233
|
console.log(chalk.red(`\n✗ Database '${databaseName}' not found or doesn't belong to your workspace\n`));
|
|
234
234
|
} else if (error.response && error.response.detail) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Fetch Documentation Command
|
|
3
|
-
* Downloads
|
|
3
|
+
* Downloads orcapt SDK documentation based on project type
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const fs = require('fs').promises;
|
|
@@ -131,7 +131,7 @@ async function ensureDocsDirectory() {
|
|
|
131
131
|
* @returns {Promise<void>}
|
|
132
132
|
*/
|
|
133
133
|
async function downloadDocumentation(type) {
|
|
134
|
-
const spinner = ora(`Downloading
|
|
134
|
+
const spinner = ora(`Downloading orcapt ${type === 'python' ? 'Python' : 'Node.js'} SDK documentation...`).start();
|
|
135
135
|
|
|
136
136
|
try {
|
|
137
137
|
const docsPath = await ensureDocsDirectory();
|
|
@@ -163,7 +163,7 @@ async function downloadDocumentation(type) {
|
|
|
163
163
|
async function fetchDoc() {
|
|
164
164
|
try {
|
|
165
165
|
console.log(chalk.cyan('\n============================================================'));
|
|
166
|
-
console.log(chalk.cyan('📚
|
|
166
|
+
console.log(chalk.cyan('📚 orcapt - Fetch Documentation'));
|
|
167
167
|
console.log(chalk.cyan('============================================================\n'));
|
|
168
168
|
|
|
169
169
|
// Check if we're in a project root
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kickstart command for Node.js - Quick setup for a new
|
|
2
|
+
* Kickstart command for Node.js - Quick setup for a new Orcapt Node.js project
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const path = require('path');
|
|
@@ -85,7 +85,7 @@ async function checkPrerequisites() {
|
|
|
85
85
|
* Clone repository
|
|
86
86
|
*/
|
|
87
87
|
async function cloneRepository(directory) {
|
|
88
|
-
const spinner = ora('Cloning
|
|
88
|
+
const spinner = ora('Cloning Orcapt Node.js starter kit from GitHub...').start();
|
|
89
89
|
|
|
90
90
|
try {
|
|
91
91
|
const git = simpleGit();
|
|
@@ -105,9 +105,9 @@ async function fixPackageJson(projectPath) {
|
|
|
105
105
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
|
|
106
106
|
|
|
107
107
|
// Replace local file reference with npm package
|
|
108
|
-
if (packageJson.dependencies && packageJson.dependencies['@
|
|
109
|
-
if (packageJson.dependencies['@
|
|
110
|
-
packageJson.dependencies['@
|
|
108
|
+
if (packageJson.dependencies && packageJson.dependencies['@orcapt/sdk']) {
|
|
109
|
+
if (packageJson.dependencies['@orcapt/sdk'].startsWith('file:')) {
|
|
110
|
+
packageJson.dependencies['@orcapt/sdk'] = '^1.0.0';
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -254,16 +254,16 @@ async function startAgent(projectPath, agentPort) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
/**
|
|
257
|
-
* Start
|
|
257
|
+
* Start Orcapt-UI frontend server
|
|
258
258
|
*/
|
|
259
259
|
async function startUI(projectPath, port, agentPort) {
|
|
260
|
-
const spinner = ora(`Starting
|
|
260
|
+
const spinner = ora(`Starting Orcapt-UI server on port ${port}...`).start();
|
|
261
261
|
|
|
262
262
|
try {
|
|
263
263
|
const uiProcess = spawnBackground('npx', [
|
|
264
264
|
'-y',
|
|
265
|
-
'@
|
|
266
|
-
'
|
|
265
|
+
'@orcapt/ui',
|
|
266
|
+
'orcapt',
|
|
267
267
|
`--port=${port}`,
|
|
268
268
|
`--agent-port=${agentPort}`
|
|
269
269
|
], {
|
|
@@ -275,13 +275,13 @@ async function startUI(projectPath, port, agentPort) {
|
|
|
275
275
|
|
|
276
276
|
// Check if process is still running
|
|
277
277
|
if (uiProcess.exitCode !== null) {
|
|
278
|
-
throw new Error('
|
|
278
|
+
throw new Error('Orcapt-UI process exited immediately');
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
spinner.succeed(chalk.green(`
|
|
281
|
+
spinner.succeed(chalk.green(`Orcapt-UI started (PID: ${uiProcess.pid})`));
|
|
282
282
|
return uiProcess;
|
|
283
283
|
} catch (error) {
|
|
284
|
-
spinner.fail('Failed to start
|
|
284
|
+
spinner.fail('Failed to start Orcapt-UI');
|
|
285
285
|
throw error;
|
|
286
286
|
}
|
|
287
287
|
}
|
|
@@ -293,7 +293,7 @@ async function kickstartNode(options) {
|
|
|
293
293
|
try {
|
|
294
294
|
const { directory, port, agentPort, start } = options;
|
|
295
295
|
|
|
296
|
-
print.title('🚀
|
|
296
|
+
print.title('🚀 Orcapt Kickstart - Node.js');
|
|
297
297
|
|
|
298
298
|
// Check prerequisites
|
|
299
299
|
await checkPrerequisites();
|
|
@@ -342,7 +342,7 @@ async function kickstartNode(options) {
|
|
|
342
342
|
{
|
|
343
343
|
type: 'confirm',
|
|
344
344
|
name: 'start',
|
|
345
|
-
message: 'Do you want to start the agent and
|
|
345
|
+
message: 'Do you want to start the agent and Orcapt-UI servers now?',
|
|
346
346
|
default: true
|
|
347
347
|
}
|
|
348
348
|
]).then(answers => answers.start) : false;
|
|
@@ -353,7 +353,7 @@ async function kickstartNode(options) {
|
|
|
353
353
|
console.log(chalk.gray(` cd ${directory}`));
|
|
354
354
|
console.log(chalk.gray(` node main.js --dev`));
|
|
355
355
|
console.log(chalk.gray(` # In another terminal:`));
|
|
356
|
-
console.log(chalk.gray(` npx -y @
|
|
356
|
+
console.log(chalk.gray(` npx -y @orcapt/ui orcapt --port=${port} --agent-port=${agentPort}`));
|
|
357
357
|
console.log();
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
@@ -368,8 +368,8 @@ async function kickstartNode(options) {
|
|
|
368
368
|
const uiProcess = await startUI(projectPath, port, agentPort);
|
|
369
369
|
|
|
370
370
|
// Display success message
|
|
371
|
-
print.title('🎉
|
|
372
|
-
print.url('
|
|
371
|
+
print.title('🎉 Orcapt is running!');
|
|
372
|
+
print.url('Orcapt-UI', `http://localhost:${port}`);
|
|
373
373
|
print.url('Agent ', `http://localhost:${agentPort}`);
|
|
374
374
|
console.log();
|
|
375
375
|
print.warning('Press Ctrl+C to stop both servers');
|
|
@@ -409,7 +409,7 @@ async function kickstartNode(options) {
|
|
|
409
409
|
|
|
410
410
|
uiProcess.on('exit', (code) => {
|
|
411
411
|
if (code !== 0 && code !== null) {
|
|
412
|
-
print.error('
|
|
412
|
+
print.error('Orcapt-UI stopped unexpectedly');
|
|
413
413
|
if (agentProcess && !agentProcess.killed) {
|
|
414
414
|
agentProcess.kill();
|
|
415
415
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Kickstart command - Quick setup for a new
|
|
2
|
+
* Kickstart command - Quick setup for a new Orcapt project
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const path = require('path');
|
|
@@ -91,7 +91,7 @@ async function checkPrerequisites() {
|
|
|
91
91
|
* Clone repository
|
|
92
92
|
*/
|
|
93
93
|
async function cloneRepository(directory) {
|
|
94
|
-
const spinner = ora('Cloning
|
|
94
|
+
const spinner = ora('Cloning Orcapt starter kit from GitHub...').start();
|
|
95
95
|
|
|
96
96
|
try {
|
|
97
97
|
const git = simpleGit();
|
|
@@ -150,7 +150,6 @@ async function startBackend(projectPath, agentPort) {
|
|
|
150
150
|
try {
|
|
151
151
|
const venvPaths = getVenvPaths();
|
|
152
152
|
const pythonPath = path.join(projectPath, venvPaths.python);
|
|
153
|
-
|
|
154
153
|
const backendProcess = spawnBackground(pythonPath, ['main.py', '--dev'], {
|
|
155
154
|
cwd: projectPath,
|
|
156
155
|
env: { ...process.env, PORT: agentPort }
|
|
@@ -176,7 +175,7 @@ async function startBackend(projectPath, agentPort) {
|
|
|
176
175
|
* Start frontend server
|
|
177
176
|
*/
|
|
178
177
|
async function startFrontend(projectPath, port, agentPort) {
|
|
179
|
-
const spinner = ora(`Starting
|
|
178
|
+
const spinner = ora(`Starting Orcapt-UI server on port ${port}...`).start();
|
|
180
179
|
|
|
181
180
|
try {
|
|
182
181
|
const tryStart = async (pkgOrBin) => {
|
|
@@ -197,16 +196,16 @@ async function startFrontend(projectPath, port, agentPort) {
|
|
|
197
196
|
let frontendProcess;
|
|
198
197
|
try {
|
|
199
198
|
// Prefer new bin name
|
|
200
|
-
frontendProcess = await tryStart('
|
|
199
|
+
frontendProcess = await tryStart('orcapt-ui');
|
|
201
200
|
} catch (_) {
|
|
202
201
|
// Fallback to package name
|
|
203
|
-
frontendProcess = await tryStart('@
|
|
202
|
+
frontendProcess = await tryStart('@orcapt/ui');
|
|
204
203
|
}
|
|
205
204
|
|
|
206
|
-
spinner.succeed(chalk.green(`
|
|
205
|
+
spinner.succeed(chalk.green(`Orcapt-UI started (PID: ${frontendProcess.pid})`));
|
|
207
206
|
return frontendProcess;
|
|
208
207
|
} catch (error) {
|
|
209
|
-
spinner.fail('Failed to start
|
|
208
|
+
spinner.fail('Failed to start Orcapt-UI');
|
|
210
209
|
throw error;
|
|
211
210
|
}
|
|
212
211
|
}
|
|
@@ -218,7 +217,7 @@ async function kickstart(options) {
|
|
|
218
217
|
try {
|
|
219
218
|
const { directory, port, agentPort, start } = options;
|
|
220
219
|
|
|
221
|
-
print.title('🚀
|
|
220
|
+
print.title('🚀 Orcapt Kickstart - Python');
|
|
222
221
|
|
|
223
222
|
// Check prerequisites
|
|
224
223
|
const pythonCmd = await checkPrerequisites();
|
|
@@ -282,7 +281,7 @@ async function kickstart(options) {
|
|
|
282
281
|
console.log(chalk.gray(` ${getVenvPaths().activate}`));
|
|
283
282
|
console.log(chalk.gray(` python main.py --dev`));
|
|
284
283
|
console.log(chalk.gray(` # In another terminal:`));
|
|
285
|
-
console.log(chalk.gray(` npx -y @
|
|
284
|
+
console.log(chalk.gray(` npx -y @orcapt/ui orca --port=${port} --agent-port=${agentPort}`));
|
|
286
285
|
console.log();
|
|
287
286
|
return;
|
|
288
287
|
}
|
|
@@ -297,8 +296,8 @@ async function kickstart(options) {
|
|
|
297
296
|
const frontendProcess = await startFrontend(projectPath, port, agentPort);
|
|
298
297
|
|
|
299
298
|
// Display success message
|
|
300
|
-
print.title('🎉
|
|
301
|
-
print.url('
|
|
299
|
+
print.title('🎉 Orcapt is running!');
|
|
300
|
+
print.url('Orcapt-UI', `http://localhost:${port}`);
|
|
302
301
|
print.url('Agent ', `http://localhost:${agentPort}`);
|
|
303
302
|
console.log();
|
|
304
303
|
print.warning('Press Ctrl+C to stop both servers');
|
|
@@ -338,7 +337,7 @@ async function kickstart(options) {
|
|
|
338
337
|
|
|
339
338
|
frontendProcess.on('exit', (code) => {
|
|
340
339
|
if (code !== 0 && code !== null) {
|
|
341
|
-
print.error('
|
|
340
|
+
print.error('Orcapt-UI stopped unexpectedly');
|
|
342
341
|
if (backendProcess && !backendProcess.killed) {
|
|
343
342
|
backendProcess.kill();
|
|
344
343
|
}
|
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
|
|
package/src/commands/storage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Manage S3-like storage buckets and files via
|
|
2
|
+
* orcapt Storage Commands
|
|
3
|
+
* Manage S3-like storage buckets and files via orcapt Deploy API
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const chalk = require('chalk');
|
|
@@ -13,7 +13,7 @@ const { getCredentials } = require('./login');
|
|
|
13
13
|
const { API_BASE_URL, API_ENDPOINTS } = require('../config');
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Make API request to
|
|
16
|
+
* Make API request to orcapt Deploy API
|
|
17
17
|
*/
|
|
18
18
|
function makeApiRequest(method, endpoint, credentials, body = null) {
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
@@ -191,7 +191,7 @@ function requireAuth() {
|
|
|
191
191
|
const credentials = getCredentials();
|
|
192
192
|
if (!credentials) {
|
|
193
193
|
console.log(chalk.red('\n✗ Not authenticated'));
|
|
194
|
-
console.log(chalk.cyan('Please run:'), chalk.yellow('
|
|
194
|
+
console.log(chalk.cyan('Please run:'), chalk.yellow('orcapt login'), chalk.cyan('first\n'));
|
|
195
195
|
process.exit(1);
|
|
196
196
|
}
|
|
197
197
|
return credentials;
|
|
@@ -247,8 +247,8 @@ async function bucketCreate(bucketName, options = {}) {
|
|
|
247
247
|
console.log(chalk.white(' Encryption: '), chalk.yellow(response.bucket.encryption_enabled ? 'Enabled' : 'Disabled'));
|
|
248
248
|
|
|
249
249
|
console.log(chalk.cyan('\n💡 Next Steps:'));
|
|
250
|
-
console.log(chalk.white(' Upload file: '), chalk.yellow(`
|
|
251
|
-
console.log(chalk.white(' List files: '), chalk.yellow(`
|
|
250
|
+
console.log(chalk.white(' Upload file: '), chalk.yellow(`orcapt storage upload ${bucketName} <file-path>`));
|
|
251
|
+
console.log(chalk.white(' List files: '), chalk.yellow(`orcapt storage files ${bucketName}`));
|
|
252
252
|
console.log('');
|
|
253
253
|
|
|
254
254
|
} catch (error) {
|
|
@@ -294,7 +294,7 @@ async function bucketList() {
|
|
|
294
294
|
if (response.count === 0) {
|
|
295
295
|
console.log(chalk.yellow('\n📭 No buckets found'));
|
|
296
296
|
console.log(chalk.cyan('\n💡 Create your first bucket:'));
|
|
297
|
-
console.log(chalk.white(' '), chalk.yellow('
|
|
297
|
+
console.log(chalk.white(' '), chalk.yellow('orcapt storage bucket create my-bucket'));
|
|
298
298
|
console.log('');
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
@@ -408,8 +408,8 @@ async function fileUpload(bucketName, localPath, options = {}) {
|
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
console.log(chalk.cyan('\n💡 Next Steps:'));
|
|
411
|
-
console.log(chalk.white(' List files: '), chalk.yellow(`
|
|
412
|
-
console.log(chalk.white(' Download: '), chalk.yellow(`
|
|
411
|
+
console.log(chalk.white(' List files: '), chalk.yellow(`orcapt storage files ${bucketName}`));
|
|
412
|
+
console.log(chalk.white(' Download: '), chalk.yellow(`orcapt storage download ${bucketName} ${response.file.file_key}`));
|
|
413
413
|
console.log('');
|
|
414
414
|
|
|
415
415
|
} catch (error) {
|
|
@@ -612,7 +612,7 @@ async function bucketDelete(bucketName, options = {}) {
|
|
|
612
612
|
} else if (error.statusCode === 400 && error.response.file_count) {
|
|
613
613
|
console.log(chalk.yellow(` Bucket contains ${error.response.file_count} file(s)`));
|
|
614
614
|
console.log(chalk.cyan(' Use --force to delete anyway:'));
|
|
615
|
-
console.log(chalk.white(' '), chalk.yellow(`
|
|
615
|
+
console.log(chalk.white(' '), chalk.yellow(`orcapt storage bucket delete ${bucketName} --force`));
|
|
616
616
|
}
|
|
617
617
|
} else {
|
|
618
618
|
console.log(chalk.red(`\n✗ ${error.message}`));
|
|
@@ -664,7 +664,7 @@ async function fileList(bucketName, options = {}) {
|
|
|
664
664
|
if (response.pagination.total === 0) {
|
|
665
665
|
console.log(chalk.yellow('\n📭 No files found'));
|
|
666
666
|
console.log(chalk.cyan('\n💡 Upload a file:'));
|
|
667
|
-
console.log(chalk.white(' '), chalk.yellow(`
|
|
667
|
+
console.log(chalk.white(' '), chalk.yellow(`orcapt storage upload ${bucketName} <file-path>`));
|
|
668
668
|
console.log('');
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
@@ -705,7 +705,7 @@ async function fileList(bucketName, options = {}) {
|
|
|
705
705
|
if (response.pagination.last_page > 1) {
|
|
706
706
|
console.log(chalk.gray(`Page ${response.pagination.current_page} of ${response.pagination.last_page}`));
|
|
707
707
|
if (response.pagination.current_page < response.pagination.last_page) {
|
|
708
|
-
console.log(chalk.cyan('Next page: '), chalk.yellow(`
|
|
708
|
+
console.log(chalk.cyan('Next page: '), chalk.yellow(`orcapt storage files ${bucketName} --page ${response.pagination.current_page + 1}`));
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
|
|
@@ -861,7 +861,7 @@ async function permissionList(bucketName) {
|
|
|
861
861
|
if (response.count === 0) {
|
|
862
862
|
console.log(chalk.yellow('\n📭 No permissions found'));
|
|
863
863
|
console.log(chalk.cyan('\n💡 Add a permission:'));
|
|
864
|
-
console.log(chalk.white(' '), chalk.yellow(`
|
|
864
|
+
console.log(chalk.white(' '), chalk.yellow(`orcapt storage permission add ${bucketName} --target-type user --target-id USER_ID --read`));
|
|
865
865
|
console.log('');
|
|
866
866
|
return;
|
|
867
867
|
}
|
package/src/commands/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Manage
|
|
2
|
+
* orcapt UI Commands
|
|
3
|
+
* Manage orcapt UI installation and execution
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const chalk = require('chalk');
|
|
@@ -12,7 +12,7 @@ const os = require('os');
|
|
|
12
12
|
const { ensurePortAvailable } = require('../utils');
|
|
13
13
|
|
|
14
14
|
// Track UI installation status
|
|
15
|
-
const UI_CONFIG_FILE = path.join(os.homedir(), '.
|
|
15
|
+
const UI_CONFIG_FILE = path.join(os.homedir(), '.orcapt', 'ui-config.json');
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Check if npx is available (we'll use npx instead of global install to avoid conflicts)
|
|
@@ -88,17 +88,17 @@ function isUIInstalled() {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* UI Init Command - Install
|
|
91
|
+
* UI Init Command - Install orcapt UI globally
|
|
92
92
|
*/
|
|
93
93
|
async function uiInit() {
|
|
94
94
|
console.log(chalk.cyan('\n============================================================'));
|
|
95
|
-
console.log(chalk.cyan('📦
|
|
95
|
+
console.log(chalk.cyan('📦 orcapt UI - Global Installation'));
|
|
96
96
|
console.log(chalk.cyan('============================================================\n'));
|
|
97
97
|
|
|
98
98
|
// Check if already installed
|
|
99
99
|
if (isUIInstalled()) {
|
|
100
|
-
console.log(chalk.yellow('⚠
|
|
101
|
-
console.log(chalk.cyan('\nTo reinstall, run:'), chalk.white('
|
|
100
|
+
console.log(chalk.yellow('⚠ orcapt UI is already installed globally'));
|
|
101
|
+
console.log(chalk.cyan('\nTo reinstall, run:'), chalk.white('orcapt ui remove'), chalk.cyan('first\n'));
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -111,7 +111,7 @@ async function uiInit() {
|
|
|
111
111
|
});
|
|
112
112
|
|
|
113
113
|
if (result.status === 0) {
|
|
114
|
-
spinner.succeed(chalk.green('
|
|
114
|
+
spinner.succeed(chalk.green('orcapt UI installed successfully!'));
|
|
115
115
|
saveUIConfig(true);
|
|
116
116
|
|
|
117
117
|
console.log(chalk.cyan('\n============================================================'));
|
|
@@ -120,7 +120,7 @@ async function uiInit() {
|
|
|
120
120
|
console.log(chalk.white('\n📦 Package:'), chalk.yellow('@orcapt/ui'));
|
|
121
121
|
console.log(chalk.white('📁 Type:'), chalk.white('React component library with built UI'));
|
|
122
122
|
console.log(chalk.white('\nYou can now run:'));
|
|
123
|
-
console.log(chalk.yellow(' •
|
|
123
|
+
console.log(chalk.yellow(' • orcapt ui start --port 3000 --agent-port 5001'));
|
|
124
124
|
console.log(chalk.cyan('============================================================\n'));
|
|
125
125
|
} else {
|
|
126
126
|
spinner.fail(chalk.red('Installation failed'));
|
|
@@ -136,21 +136,21 @@ async function uiInit() {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* UI Start Command - Run the
|
|
139
|
+
* UI Start Command - Run the orcapt UI
|
|
140
140
|
*/
|
|
141
141
|
async function uiStart(options) {
|
|
142
142
|
const port = options.port || '3000';
|
|
143
143
|
const agentPort = options.agentPort || '5001';
|
|
144
144
|
|
|
145
145
|
console.log(chalk.cyan('\n============================================================'));
|
|
146
|
-
console.log(chalk.cyan('🚀 Starting
|
|
146
|
+
console.log(chalk.cyan('🚀 Starting orcapt UI'));
|
|
147
147
|
console.log(chalk.cyan('============================================================\n'));
|
|
148
148
|
|
|
149
149
|
const isInstalled = isUIInstalled();
|
|
150
150
|
|
|
151
151
|
if (!isInstalled && !isNpxAvailable()) {
|
|
152
|
-
console.log(chalk.red('✗
|
|
153
|
-
console.log(chalk.yellow('\nPlease run:'), chalk.white('
|
|
152
|
+
console.log(chalk.red('✗ orcapt UI is not installed and npx is not available'));
|
|
153
|
+
console.log(chalk.yellow('\nPlease run:'), chalk.white('orcapt ui init'), chalk.yellow('to install\n'));
|
|
154
154
|
process.exit(1);
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -180,11 +180,11 @@ async function uiStart(options) {
|
|
|
180
180
|
|
|
181
181
|
if (result.status === 0) {
|
|
182
182
|
const globalModulesPath = result.stdout.trim();
|
|
183
|
-
uiDistPath = path.join(globalModulesPath, '@
|
|
183
|
+
uiDistPath = path.join(globalModulesPath, '@orcapt', 'ui', 'dist');
|
|
184
184
|
|
|
185
185
|
if (!fs.existsSync(uiDistPath)) {
|
|
186
186
|
console.log(chalk.red(`\n✗ @orcapt/ui is installed but dist folder not found at: ${uiDistPath}`));
|
|
187
|
-
console.log(chalk.yellow('\nTry reinstalling:'), chalk.white('
|
|
187
|
+
console.log(chalk.yellow('\nTry reinstalling:'), chalk.white('orcapt ui remove && orcapt ui init\n'));
|
|
188
188
|
process.exit(1);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -192,7 +192,7 @@ async function uiStart(options) {
|
|
|
192
192
|
|
|
193
193
|
if (!uiDistPath) {
|
|
194
194
|
console.log(chalk.red('\n✗ Could not find @orcapt/ui installation'));
|
|
195
|
-
console.log(chalk.yellow('\nPlease run:'), chalk.white('
|
|
195
|
+
console.log(chalk.yellow('\nPlease run:'), chalk.white('orcapt ui init\n'));
|
|
196
196
|
process.exit(1);
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -221,7 +221,7 @@ async function uiStart(options) {
|
|
|
221
221
|
// Handle Ctrl+C gracefully
|
|
222
222
|
process.on('SIGINT', () => {
|
|
223
223
|
console.log(chalk.cyan('\n\n============================================================'));
|
|
224
|
-
console.log(chalk.yellow('⚠ Stopping
|
|
224
|
+
console.log(chalk.yellow('⚠ Stopping orcapt UI...'));
|
|
225
225
|
console.log(chalk.cyan('============================================================\n'));
|
|
226
226
|
uiProcess.kill('SIGINT');
|
|
227
227
|
process.exit(0);
|
|
@@ -234,16 +234,16 @@ async function uiStart(options) {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* UI Remove Command - Uninstall
|
|
237
|
+
* UI Remove Command - Uninstall orcapt UI
|
|
238
238
|
*/
|
|
239
239
|
async function uiRemove() {
|
|
240
240
|
console.log(chalk.cyan('\n============================================================'));
|
|
241
|
-
console.log(chalk.cyan('🗑️ Removing
|
|
241
|
+
console.log(chalk.cyan('🗑️ Removing orcapt UI'));
|
|
242
242
|
console.log(chalk.cyan('============================================================\n'));
|
|
243
243
|
|
|
244
244
|
// Check if installed
|
|
245
245
|
if (!isUIInstalled()) {
|
|
246
|
-
console.log(chalk.yellow('⚠
|
|
246
|
+
console.log(chalk.yellow('⚠ orcapt UI is not installed globally\n'));
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
|
|
@@ -256,14 +256,14 @@ async function uiRemove() {
|
|
|
256
256
|
});
|
|
257
257
|
|
|
258
258
|
if (result.status === 0) {
|
|
259
|
-
spinner.succeed(chalk.green('
|
|
259
|
+
spinner.succeed(chalk.green('orcapt UI removed successfully!'));
|
|
260
260
|
saveUIConfig(false);
|
|
261
261
|
|
|
262
262
|
console.log(chalk.cyan('\n============================================================'));
|
|
263
263
|
console.log(chalk.green('✓ Uninstallation Complete'));
|
|
264
264
|
console.log(chalk.cyan('============================================================'));
|
|
265
265
|
console.log(chalk.white('\n@orcapt/ui package has been removed.'));
|
|
266
|
-
console.log(chalk.white('\nTo reinstall, run:'), chalk.yellow('
|
|
266
|
+
console.log(chalk.white('\nTo reinstall, run:'), chalk.yellow('orcapt ui init'));
|
|
267
267
|
console.log(chalk.cyan('============================================================\n'));
|
|
268
268
|
} else {
|
|
269
269
|
spinner.fail(chalk.red('Uninstallation failed'));
|
package/src/utils/index.js
CHANGED