@edgible-team/cli 1.2.8 ā 1.2.9
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/ai/teardown.js +24 -23
- package/dist/commands/application/api-keys/create.d.ts.map +1 -1
- package/dist/commands/application/api-keys/create.js +5 -20
- package/dist/commands/application/api-keys/delete.d.ts.map +1 -1
- package/dist/commands/application/api-keys/delete.js +5 -20
- package/dist/commands/application/api-keys/list.d.ts.map +1 -1
- package/dist/commands/application/api-keys/list.js +5 -21
- package/dist/commands/application/delete.d.ts.map +1 -1
- package/dist/commands/application/delete.js +7 -23
- package/dist/commands/application/get.d.ts.map +1 -1
- package/dist/commands/application/get.js +9 -4
- package/dist/commands/application/short-codes/create.d.ts.map +1 -1
- package/dist/commands/application/short-codes/create.js +5 -20
- package/dist/commands/application/short-codes/delete.d.ts.map +1 -1
- package/dist/commands/application/short-codes/delete.js +5 -20
- package/dist/commands/application/short-codes/list.d.ts.map +1 -1
- package/dist/commands/application/short-codes/list.js +5 -21
- package/dist/commands/application/short-codes/toggle.d.ts.map +1 -1
- package/dist/commands/application/short-codes/toggle.js +5 -20
- package/dist/commands/base/command-wrapper.d.ts +0 -4
- package/dist/commands/base/command-wrapper.d.ts.map +1 -1
- package/dist/commands/base/command-wrapper.js +0 -16
- package/dist/commands/utils/application-prompt.d.ts +23 -0
- package/dist/commands/utils/application-prompt.d.ts.map +1 -0
- package/dist/commands/utils/application-prompt.js +79 -0
- package/dist/commands/utils/output-formatter.d.ts +1 -0
- package/dist/commands/utils/output-formatter.d.ts.map +1 -1
- package/dist/commands/utils/output-formatter.js +1 -1
- package/dist/validation/validator.d.ts +0 -4
- package/dist/validation/validator.d.ts.map +1 -1
- package/dist/validation/validator.js +0 -9
- package/package.json +1 -1
- package/dist/commands/base/BaseCommand.d.ts +0 -53
- package/dist/commands/base/BaseCommand.d.ts.map +0 -1
- package/dist/commands/base/BaseCommand.js +0 -93
- package/dist/commands/base/CommandHandler.d.ts +0 -28
- package/dist/commands/base/CommandHandler.d.ts.map +0 -1
- package/dist/commands/base/CommandHandler.js +0 -7
- package/dist/commands/base/middleware.d.ts +0 -34
- package/dist/commands/base/middleware.d.ts.map +0 -1
- package/dist/commands/base/middleware.js +0 -77
- package/dist/utils/PathMigration.d.ts +0 -45
- package/dist/utils/PathMigration.d.ts.map +0 -1
- package/dist/utils/PathMigration.js +0 -219
- package/dist/utils/progress.d.ts +0 -74
- package/dist/utils/progress.d.ts.map +0 -1
- package/dist/utils/progress.js +0 -167
|
@@ -7,33 +7,34 @@ exports.handleAiTeardown = handleAiTeardown;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const instances_1 = require("../../services/instances");
|
|
9
9
|
const config_validator_1 = require("../utils/config-validator");
|
|
10
|
-
const helpers_1 = require("./helpers");
|
|
11
10
|
async function handleAiTeardown(options) {
|
|
12
11
|
instances_1.logger.info('Tearing down AI services');
|
|
13
12
|
console.log(chalk_1.default.blue('\nš AI Services Teardown\n'));
|
|
14
13
|
// Stop local Open WebUI if running
|
|
15
|
-
const composeDir =
|
|
16
|
-
const isRunning = await
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
else {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
14
|
+
// const composeDir = getComposeDirectory();
|
|
15
|
+
// const isRunning = await checkOpenWebUIRunning();
|
|
16
|
+
//
|
|
17
|
+
// if (!isRunning) {
|
|
18
|
+
// console.log(chalk.gray(' Local Open WebUI is not running\n'));
|
|
19
|
+
// } else {
|
|
20
|
+
// console.log(chalk.yellow('Stopping local Open WebUI...\n'));
|
|
21
|
+
// await stopOpenWebUI(composeDir, options.removeVolumes || false);
|
|
22
|
+
// console.log(chalk.green('ā Local Open WebUI stopped\n'));
|
|
23
|
+
// }
|
|
24
|
+
//
|
|
25
|
+
// // Optionally stop Ollama
|
|
26
|
+
// if (options.stopOllama) {
|
|
27
|
+
// console.log(chalk.yellow('Stopping Ollama service...\n'));
|
|
28
|
+
// const isOllamaRunning = await checkOllamaRunning();
|
|
29
|
+
//
|
|
30
|
+
// if (isOllamaRunning) {
|
|
31
|
+
// await stopOllama();
|
|
32
|
+
// console.log(chalk.green('ā Ollama stopped\n'));
|
|
33
|
+
// } else {
|
|
34
|
+
// console.log(chalk.gray('Ollama is not running\n'));
|
|
35
|
+
// }
|
|
36
|
+
// }
|
|
37
|
+
//
|
|
37
38
|
// Optionally remove platform applications
|
|
38
39
|
console.log(chalk_1.default.yellow('\nRemoving platform applications...\n'));
|
|
39
40
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/create.ts"],"names":[],"mappings":"AAMA,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CrH"}
|
|
@@ -8,31 +8,16 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
12
|
async function handleApiKeysCreate(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
36
21
|
if (!appId) {
|
|
37
22
|
throw new Error('Application ID is required');
|
|
38
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/delete.ts"],"names":[],"mappings":"AAMA,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DrH"}
|
|
@@ -8,31 +8,16 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
12
|
async function handleApiKeysDelete(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
36
21
|
if (!appId) {
|
|
37
22
|
throw new Error('Application ID is required');
|
|
38
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/list.ts"],"names":[],"mappings":"AAKA,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/api-keys/list.ts"],"names":[],"mappings":"AAKA,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ClG"}
|
|
@@ -4,35 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.handleApiKeysList = handleApiKeysList;
|
|
7
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
8
|
const instances_1 = require("../../../services/instances");
|
|
10
9
|
const config_validator_1 = require("../../utils/config-validator");
|
|
10
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
11
|
async function handleApiKeysList(options) {
|
|
12
12
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
13
|
requireAuth: true,
|
|
14
14
|
requireOrganization: true,
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
16
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
17
|
+
message: 'Select application:',
|
|
18
|
+
required: true,
|
|
19
|
+
});
|
|
36
20
|
if (!appId) {
|
|
37
21
|
throw new Error('Application ID is required');
|
|
38
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/application/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/application/delete.ts"],"names":[],"mappings":"AAOA,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuDhI"}
|
|
@@ -8,35 +8,19 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../utils/application-prompt");
|
|
11
12
|
async function handleApplicationDelete(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
let appId = options.appId;
|
|
17
17
|
// Interactive mode: prompt for application if not provided
|
|
18
|
-
|
|
19
|
-
instances_1.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const choices = applications.map((app) => ({
|
|
27
|
-
name: `${app.name} (${app.id})${app.description ? ` - ${app.description}` : ''}`,
|
|
28
|
-
value: app.id,
|
|
29
|
-
}));
|
|
30
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
31
|
-
{
|
|
32
|
-
type: 'list',
|
|
33
|
-
name: 'selectedAppId',
|
|
34
|
-
message: 'Select application to delete:',
|
|
35
|
-
choices,
|
|
36
|
-
},
|
|
37
|
-
]);
|
|
38
|
-
appId = selectedAppId;
|
|
39
|
-
}
|
|
18
|
+
const appId = options.interactive !== false
|
|
19
|
+
? await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
20
|
+
message: 'Select application to delete:',
|
|
21
|
+
required: true,
|
|
22
|
+
})
|
|
23
|
+
: options.appId;
|
|
40
24
|
if (!appId) {
|
|
41
25
|
throw new Error('--app-id is required in non-interactive mode. Usage: edgible application delete --app-id <id>');
|
|
42
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/application/get.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/application/get.ts"],"names":[],"mappings":"AAMA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCrG"}
|
|
@@ -4,16 +4,21 @@ exports.handleApplicationGet = handleApplicationGet;
|
|
|
4
4
|
const instances_1 = require("../../services/instances");
|
|
5
5
|
const config_validator_1 = require("../utils/config-validator");
|
|
6
6
|
const output_formatter_1 = require("../utils/output-formatter");
|
|
7
|
+
const application_prompt_1 = require("../utils/application-prompt");
|
|
7
8
|
async function handleApplicationGet(options) {
|
|
8
9
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
9
10
|
requireAuth: true,
|
|
10
11
|
requireOrganization: true,
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
14
|
+
message: 'Select application to view:',
|
|
15
|
+
required: true,
|
|
16
|
+
});
|
|
17
|
+
if (!appId) {
|
|
18
|
+
throw new Error('Application ID is required');
|
|
14
19
|
}
|
|
15
|
-
instances_1.logger.debug('Getting application', { appId
|
|
16
|
-
const app = await instances_1.applicationService.getApplication(
|
|
20
|
+
instances_1.logger.debug('Getting application', { appId });
|
|
21
|
+
const app = await instances_1.applicationService.getApplication(appId);
|
|
17
22
|
if (options.json) {
|
|
18
23
|
console.log(JSON.stringify({
|
|
19
24
|
id: app.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/create.ts"],"names":[],"mappings":"AAMA,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgD1I"}
|
|
@@ -8,31 +8,16 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
12
|
async function handleShortCodesCreate(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
36
21
|
if (!appId) {
|
|
37
22
|
throw new Error('Application ID is required');
|
|
38
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/delete.ts"],"names":[],"mappings":"AAMA,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DzH"}
|
|
@@ -8,31 +8,16 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
12
|
async function handleShortCodesDelete(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
36
21
|
if (!appId) {
|
|
37
22
|
throw new Error('Application ID is required');
|
|
38
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/list.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/list.ts"],"names":[],"mappings":"AAKA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCrG"}
|
|
@@ -4,35 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.handleShortCodesList = handleShortCodesList;
|
|
7
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
8
|
const instances_1 = require("../../../services/instances");
|
|
10
9
|
const config_validator_1 = require("../../utils/config-validator");
|
|
10
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
11
|
async function handleShortCodesList(options) {
|
|
12
12
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
13
|
requireAuth: true,
|
|
14
14
|
requireOrganization: true,
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
16
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
17
|
+
message: 'Select application:',
|
|
18
|
+
required: true,
|
|
19
|
+
});
|
|
36
20
|
if (!appId) {
|
|
37
21
|
throw new Error('Application ID is required');
|
|
38
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/toggle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../src/commands/application/short-codes/toggle.ts"],"names":[],"mappings":"AAMA,wBAAsB,sBAAsB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDxG"}
|
|
@@ -8,31 +8,16 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const instances_1 = require("../../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../../utils/config-validator");
|
|
11
|
+
const application_prompt_1 = require("../../utils/application-prompt");
|
|
11
12
|
async function handleShortCodesToggle(options) {
|
|
12
13
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
13
14
|
requireAuth: true,
|
|
14
15
|
requireOrganization: true,
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const { selectedAppId } = await inquirer_1.default.prompt([
|
|
24
|
-
{
|
|
25
|
-
type: 'list',
|
|
26
|
-
name: 'selectedAppId',
|
|
27
|
-
message: 'Select application:',
|
|
28
|
-
choices: applications.map((app) => ({
|
|
29
|
-
name: `${app.name} (${app.id})`,
|
|
30
|
-
value: app.id,
|
|
31
|
-
})),
|
|
32
|
-
},
|
|
33
|
-
]);
|
|
34
|
-
appId = selectedAppId;
|
|
35
|
-
}
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
36
21
|
if (!appId) {
|
|
37
22
|
throw new Error('Application ID is required');
|
|
38
23
|
}
|
|
@@ -10,8 +10,4 @@ export interface CommandWrapperOptions {
|
|
|
10
10
|
* Wrap a command action with standardized error handling and validation
|
|
11
11
|
*/
|
|
12
12
|
export declare function wrapCommand(action: (options: Record<string, unknown>) => Promise<void>, wrapperOptions?: CommandWrapperOptions): (options: Record<string, unknown>) => Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Create a command handler that automatically handles errors
|
|
15
|
-
*/
|
|
16
|
-
export declare function createCommandHandler(action: (options: Record<string, unknown>) => Promise<void>, options?: CommandWrapperOptions): (options: Record<string, unknown>) => void;
|
|
17
13
|
//# sourceMappingURL=command-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-wrapper.d.ts","sourceRoot":"","sources":["../../../src/commands/base/command-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"command-wrapper.d.ts","sourceRoot":"","sources":["../../../src/commands/base/command-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,EAC3D,cAAc,GAAE,qBAA0B,GACzC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CA8BrD"}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.wrapCommand = wrapCommand;
|
|
8
|
-
exports.createCommandHandler = createCommandHandler;
|
|
9
8
|
const errors_1 = require("../../utils/errors");
|
|
10
9
|
const instances_1 = require("../../services/instances");
|
|
11
10
|
/**
|
|
@@ -39,19 +38,4 @@ function wrapCommand(action, wrapperOptions = {}) {
|
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Create a command handler that automatically handles errors
|
|
44
|
-
*/
|
|
45
|
-
function createCommandHandler(action, options = {}) {
|
|
46
|
-
const wrapped = wrapCommand(action, options);
|
|
47
|
-
return (opts) => {
|
|
48
|
-
// Commander expects synchronous handlers, but we need async
|
|
49
|
-
// So we'll handle the promise and let ErrorHandler exit if needed
|
|
50
|
-
wrapped(opts).catch((error) => {
|
|
51
|
-
// This should not happen as wrapCommand handles errors,
|
|
52
|
-
// but just in case:
|
|
53
|
-
errors_1.ErrorHandler.handleError(error);
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
41
|
//# sourceMappingURL=command-wrapper.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared application selection utilities
|
|
3
|
+
* Eliminates duplication across commands
|
|
4
|
+
*/
|
|
5
|
+
import { ApplicationService } from '../../services/application/ApplicationService';
|
|
6
|
+
export interface ApplicationSelectionOptions {
|
|
7
|
+
allowNone?: boolean;
|
|
8
|
+
message?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Prompt user to select an application from available applications
|
|
13
|
+
*/
|
|
14
|
+
export declare function promptApplicationSelection(applicationService: ApplicationService, options?: ApplicationSelectionOptions): Promise<string | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Get application ID, or prompt if not provided
|
|
17
|
+
*/
|
|
18
|
+
export declare function getApplicationId(applicationService: ApplicationService, providedId: string | undefined, options?: ApplicationSelectionOptions): Promise<string | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Validate application exists
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateApplicationExists(applicationService: ApplicationService, applicationId: string): Promise<boolean>;
|
|
23
|
+
//# sourceMappingURL=application-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-prompt.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/application-prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAGnF,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CxB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMxB;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared application selection utilities
|
|
4
|
+
* Eliminates duplication across commands
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.promptApplicationSelection = promptApplicationSelection;
|
|
11
|
+
exports.getApplicationId = getApplicationId;
|
|
12
|
+
exports.validateApplicationExists = validateApplicationExists;
|
|
13
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
14
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
15
|
+
/**
|
|
16
|
+
* Prompt user to select an application from available applications
|
|
17
|
+
*/
|
|
18
|
+
async function promptApplicationSelection(applicationService, options = {}) {
|
|
19
|
+
const { allowNone = false, message = 'Select application:', required = true } = options;
|
|
20
|
+
try {
|
|
21
|
+
const applications = await applicationService.getApplications();
|
|
22
|
+
if (applications.length === 0) {
|
|
23
|
+
if (allowNone) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk_1.default.yellow('ā No applications configured'));
|
|
27
|
+
console.log(chalk_1.default.gray('Use "edgible application create" to create an application'));
|
|
28
|
+
if (required) {
|
|
29
|
+
throw new Error('No applications available');
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const applicationChoices = applications.map((app) => ({
|
|
34
|
+
name: `${app.name} (${app.id})${app.description ? ` - ${app.description}` : ''}`,
|
|
35
|
+
value: app.id,
|
|
36
|
+
}));
|
|
37
|
+
if (allowNone) {
|
|
38
|
+
applicationChoices.push({
|
|
39
|
+
name: 'None',
|
|
40
|
+
value: '',
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const answer = await inquirer_1.default.prompt([
|
|
44
|
+
{
|
|
45
|
+
type: 'list',
|
|
46
|
+
name: 'applicationId',
|
|
47
|
+
message,
|
|
48
|
+
choices: applicationChoices,
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
51
|
+
return answer.applicationId === '' ? null : answer.applicationId;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error(chalk_1.default.red('Error listing applications:'), error instanceof Error ? error.message : 'Unknown error');
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get application ID, or prompt if not provided
|
|
60
|
+
*/
|
|
61
|
+
async function getApplicationId(applicationService, providedId, options = {}) {
|
|
62
|
+
if (providedId) {
|
|
63
|
+
return providedId;
|
|
64
|
+
}
|
|
65
|
+
return await promptApplicationSelection(applicationService, options);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validate application exists
|
|
69
|
+
*/
|
|
70
|
+
async function validateApplicationExists(applicationService, applicationId) {
|
|
71
|
+
try {
|
|
72
|
+
await applicationService.getApplication(applicationId);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=application-prompt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-formatter.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/output-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"output-formatter.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/output-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAqBT;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,WAAW,CAAC,EAAE;QACZ,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAuBT;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,KAAK,EAAE,CAAC,EAAE,EACV,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,EAC9C,MAAM,CAAC,EAAE,MAAM,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -35,7 +35,7 @@ function formatApplication(app) {
|
|
|
35
35
|
if (app.description) {
|
|
36
36
|
output += chalk_1.default.gray(` Description: ${app.description}\n`);
|
|
37
37
|
}
|
|
38
|
-
output += chalk_1.default.cyan(` URL: ${app.
|
|
38
|
+
output += chalk_1.default.cyan(` URL: ${app.url}\n`);
|
|
39
39
|
return output;
|
|
40
40
|
}
|
|
41
41
|
/**
|