@atomicsolutions/proton5-cli 5.0.1

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.
Files changed (77) hide show
  1. package/README.md +590 -0
  2. package/bin/dev.cmd +3 -0
  3. package/bin/dev.js +5 -0
  4. package/bin/run.cmd +3 -0
  5. package/bin/run.js +5 -0
  6. package/dist/commands/config/add.d.ts +14 -0
  7. package/dist/commands/config/add.js +122 -0
  8. package/dist/commands/config/edit.d.ts +15 -0
  9. package/dist/commands/config/edit.js +63 -0
  10. package/dist/commands/config/list.d.ts +6 -0
  11. package/dist/commands/config/list.js +31 -0
  12. package/dist/commands/config/remove.d.ts +9 -0
  13. package/dist/commands/config/remove.js +35 -0
  14. package/dist/commands/connect.d.ts +9 -0
  15. package/dist/commands/connect.js +41 -0
  16. package/dist/commands/disconnect.d.ts +9 -0
  17. package/dist/commands/disconnect.js +30 -0
  18. package/dist/commands/runner/list-run.d.ts +6 -0
  19. package/dist/commands/runner/list-run.js +71 -0
  20. package/dist/commands/runner/status.d.ts +6 -0
  21. package/dist/commands/runner/status.js +24 -0
  22. package/dist/commands/runner/stop-run.d.ts +9 -0
  23. package/dist/commands/runner/stop-run.js +34 -0
  24. package/dist/commands/settings/index.d.ts +6 -0
  25. package/dist/commands/settings/index.js +25 -0
  26. package/dist/commands/settings/set.d.ts +10 -0
  27. package/dist/commands/settings/set.js +39 -0
  28. package/dist/commands/settings/unset.d.ts +10 -0
  29. package/dist/commands/settings/unset.js +35 -0
  30. package/dist/core/fileSystem/index.d.ts +10 -0
  31. package/dist/core/fileSystem/index.js +107 -0
  32. package/dist/core/manager/index.d.ts +31 -0
  33. package/dist/core/manager/index.js +287 -0
  34. package/dist/core/proton/api.d.ts +7 -0
  35. package/dist/core/proton/api.js +122 -0
  36. package/dist/core/proton/maven.d.ts +5 -0
  37. package/dist/core/proton/maven.js +74 -0
  38. package/dist/core/proton/npm.d.ts +1 -0
  39. package/dist/core/proton/npm.js +22 -0
  40. package/dist/core/proton/playwright.d.ts +5 -0
  41. package/dist/core/proton/playwright.js +47 -0
  42. package/dist/core/proton/pyTest.d.ts +5 -0
  43. package/dist/core/proton/pyTest.js +52 -0
  44. package/dist/core/proton/vbs.d.ts +5 -0
  45. package/dist/core/proton/vbs.js +46 -0
  46. package/dist/core/runner/index.d.ts +16 -0
  47. package/dist/core/runner/index.js +76 -0
  48. package/dist/core/services/api.d.ts +2 -0
  49. package/dist/core/services/api.js +20 -0
  50. package/dist/core/socket/index.d.ts +2 -0
  51. package/dist/core/socket/index.js +99 -0
  52. package/dist/core/store/index.d.ts +14 -0
  53. package/dist/core/store/index.js +212 -0
  54. package/dist/core/system/index.d.ts +12 -0
  55. package/dist/core/system/index.js +48 -0
  56. package/dist/daemon/index.d.ts +1 -0
  57. package/dist/daemon/index.js +5 -0
  58. package/dist/daemon/server.d.ts +1 -0
  59. package/dist/daemon/server.js +40 -0
  60. package/dist/daemon/state.d.ts +7 -0
  61. package/dist/daemon/state.js +15 -0
  62. package/dist/index.d.ts +1 -0
  63. package/dist/index.js +1 -0
  64. package/dist/ipc/client.d.ts +1 -0
  65. package/dist/ipc/client.js +16 -0
  66. package/dist/ipc/ensureDaemon.d.ts +1 -0
  67. package/dist/ipc/ensureDaemon.js +42 -0
  68. package/dist/ipc/protocol.d.ts +14 -0
  69. package/dist/ipc/protocol.js +1 -0
  70. package/dist/shared/constants.d.ts +4 -0
  71. package/dist/shared/constants.js +4 -0
  72. package/dist/shared/socketPath.d.ts +1 -0
  73. package/dist/shared/socketPath.js +5 -0
  74. package/dist/shared/types.d.ts +130 -0
  75. package/dist/shared/types.js +1 -0
  76. package/oclif.manifest.json +409 -0
  77. package/package.json +86 -0
@@ -0,0 +1,122 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { getStoreValue, setStoreValue } from '../../core/store/index.js';
3
+ import { Buffer } from 'buffer';
4
+ import inquirer from 'inquirer';
5
+ import ora from 'ora';
6
+ export default class ConfigAdd extends Command {
7
+ static description = 'Add a new Proton server connection';
8
+ static examples = [
9
+ '<%= config.bin %> <%= command.id %>',
10
+ ];
11
+ static flags = {
12
+ name: Flags.string({
13
+ description: 'Nome da configuração',
14
+ required: false
15
+ }),
16
+ server: Flags.string({
17
+ description: 'Endereço do servidor',
18
+ required: false
19
+ }),
20
+ email: Flags.string({
21
+ description: 'E-mail de acesso',
22
+ required: false
23
+ }),
24
+ password: Flags.string({
25
+ description: 'Senha de acesso',
26
+ required: false
27
+ })
28
+ };
29
+ async run() {
30
+ const { flags } = await this.parse(ConfigAdd);
31
+ const input = {
32
+ name: flags.name,
33
+ server: flags.server,
34
+ email: flags.email,
35
+ password: flags.password
36
+ };
37
+ const missing = this.getMissingFields(input);
38
+ if (missing.length > 0) {
39
+ const answers = await inquirer.prompt(missing.map((field) => this.questionFor(field)));
40
+ Object.assign(input, answers);
41
+ }
42
+ const spinner = ora('Creating new connection').start();
43
+ try {
44
+ const configList = getStoreValue('config');
45
+ const newConfig = {
46
+ name: input.name,
47
+ server: input.server,
48
+ email: input.email,
49
+ password: Buffer.from(input.password).toString('base64'),
50
+ privateMode: false,
51
+ statusNotification: false,
52
+ token: '',
53
+ order: configList.length > 0 ? Math.max(...configList.map(c => c.order)) + 1 : 1,
54
+ };
55
+ setStoreValue('config', [...configList, newConfig]);
56
+ spinner.succeed('Connection added successfully');
57
+ }
58
+ catch (err) {
59
+ spinner.fail('Failed to create connection');
60
+ }
61
+ // this.log('Follow the instructions to create a new Proton Connection.');
62
+ // const answers = await inquirer.prompt([
63
+ // {
64
+ // type: 'input',
65
+ // name: 'name',
66
+ // message: 'Digite o nome da configuração:',
67
+ // validate: (v) => v ? true : 'Nome é obrigatório',
68
+ // },
69
+ // {
70
+ // type: 'input',
71
+ // name: 'server',
72
+ // message: 'Digite o endereço do servidor:',
73
+ // validate: (v) => v ? true : 'Servidor é obrigatório',
74
+ // },
75
+ // {
76
+ // type: 'input',
77
+ // name: 'email',
78
+ // message: 'Digite seu e-mail:',
79
+ // },
80
+ // {
81
+ // type: 'password',
82
+ // name: 'password',
83
+ // message: 'Digite a senha de acesso:',
84
+ // mask: '*',
85
+ // },
86
+ // ]);
87
+ }
88
+ getMissingFields(input) {
89
+ return ['name', 'server', 'email', 'password']
90
+ .filter((key) => !input[key]);
91
+ }
92
+ questionFor(field) {
93
+ const questions = {
94
+ name: {
95
+ type: 'input',
96
+ name: 'name',
97
+ message: 'Digite o nome da configuração:',
98
+ validate: (v) => v ? true : 'Nome é obrigatório',
99
+ },
100
+ server: {
101
+ type: 'input',
102
+ name: 'server',
103
+ message: 'Digite o endereço do servidor:',
104
+ validate: (v) => v ? true : 'Servidor é obrigatório',
105
+ },
106
+ email: {
107
+ type: 'input',
108
+ name: 'email',
109
+ message: 'Digite seu e-mail:',
110
+ validate: (v) => v ? true : 'E-mail é obrigatório',
111
+ },
112
+ password: {
113
+ type: 'password',
114
+ name: 'password',
115
+ message: 'Digite a senha de acesso:',
116
+ mask: '*',
117
+ validate: (v) => v ? true : 'Senha é obrigatória',
118
+ },
119
+ };
120
+ return questions[field];
121
+ }
122
+ }
@@ -0,0 +1,15 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class ConfigEdit extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ server: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ static args: {
12
+ name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,63 @@
1
+ import { Command, Flags, Args } from '@oclif/core';
2
+ import { getStoreValue, setStoreValue } from '../../core/store/index.js';
3
+ import { Buffer } from 'buffer';
4
+ import ora from 'ora';
5
+ export default class ConfigEdit extends Command {
6
+ static description = 'Edit an existing Proton server connection';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ static flags = {
11
+ name: Flags.string({
12
+ description: 'Nome da configuração',
13
+ required: false
14
+ }),
15
+ server: Flags.string({
16
+ description: 'Endereço do servidor',
17
+ required: false
18
+ }),
19
+ email: Flags.string({
20
+ description: 'E-mail de acesso',
21
+ required: false
22
+ }),
23
+ password: Flags.string({
24
+ description: 'Senha de acesso',
25
+ required: false
26
+ })
27
+ };
28
+ static args = {
29
+ name: Args.string()
30
+ };
31
+ async run() {
32
+ const { flags, args } = await this.parse(ConfigEdit);
33
+ const input = {
34
+ name: flags.name,
35
+ server: flags.server,
36
+ email: flags.email,
37
+ password: flags.password
38
+ };
39
+ const spinner = ora('Editing existing connection').start();
40
+ try {
41
+ const configList = getStoreValue('config');
42
+ const index = configList.findIndex(c => c.name === args.name);
43
+ if (index === -1) {
44
+ spinner.fail(`Connection ${args.name} not found`);
45
+ return;
46
+ }
47
+ const editConfig = configList.splice(index, 1)[0];
48
+ if (input.name)
49
+ editConfig.name = input.name;
50
+ if (input.server)
51
+ editConfig.server = input.server;
52
+ if (input.email)
53
+ editConfig.email = input.email;
54
+ if (input.password)
55
+ editConfig.password = Buffer.from(input.password).toString('base64');
56
+ setStoreValue('config', [...configList, editConfig].sort((a, b) => a.order - b.order));
57
+ spinner.succeed('Connection edited successfully');
58
+ }
59
+ catch (err) {
60
+ spinner.fail('Failed to edit connection');
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class ConfigList extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,31 @@
1
+ import { Command } from '@oclif/core';
2
+ import { getStoreValue } from '../../core/store/index.js';
3
+ import Table from 'cli-table3';
4
+ import clc from 'cli-color';
5
+ export default class ConfigList extends Command {
6
+ static description = 'Display a list of configured connections';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ async run() {
11
+ const { args, flags } = await this.parse(ConfigList);
12
+ const configList = getStoreValue('config');
13
+ if (configList.length > 0) {
14
+ const table = new Table({
15
+ head: [
16
+ clc.blue('order'),
17
+ clc.blue('name'),
18
+ clc.blue('server'),
19
+ clc.blue('username'),
20
+ ]
21
+ });
22
+ for (const connection of configList) {
23
+ table.push([String(connection.order), connection.name, connection.server, connection.email]);
24
+ }
25
+ this.log(table.toString());
26
+ }
27
+ else {
28
+ this.log('No connections found.');
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class ConfigRemove extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,35 @@
1
+ import { Command, Args } from '@oclif/core';
2
+ import { getStoreValue, setStoreValue } from '../../core/store/index.js';
3
+ import ora from 'ora';
4
+ export default class ConfigRemove extends Command {
5
+ static description = 'Remove an existing Proton server connection';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %>',
8
+ ];
9
+ static args = {
10
+ name: Args.string()
11
+ };
12
+ async run() {
13
+ const { args } = await this.parse(ConfigRemove);
14
+ const spinner = ora('Removing existing connection').start();
15
+ try {
16
+ const configList = getStoreValue('config');
17
+ const index = configList.findIndex(c => c.name === args.name);
18
+ if (index === -1) {
19
+ spinner.fail(`Connection ${args.name} not found`);
20
+ return;
21
+ }
22
+ const activeConnection = getStoreValue('activeConnection');
23
+ if (activeConnection && activeConnection.name === args.name) {
24
+ spinner.fail(`Cannot remove active connection ${args.name}\nPlease disconnect before removing this one.`);
25
+ return;
26
+ }
27
+ configList.splice(index, 1);
28
+ setStoreValue('config', configList);
29
+ spinner.succeed(`Connection ${args.name} removed successfully`);
30
+ }
31
+ catch (err) {
32
+ spinner.fail(`Failed to remove connection ${args.name}`);
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Connect extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,41 @@
1
+ import { Command, Args } from '@oclif/core';
2
+ import { getStoreValue } from '../core/store/index.js';
3
+ import ora from 'ora';
4
+ import { sendToDaemon } from '../ipc/client.js';
5
+ export default class Connect extends Command {
6
+ static description = 'Connect to a Proton server using a saved configuration';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ static args = {
11
+ name: Args.string()
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(Connect);
15
+ const spinner = ora('Connecting to server...').start();
16
+ const runnerStatus = getStoreValue('runnerStatus');
17
+ if (runnerStatus !== 'Offline') {
18
+ const activeConnection = getStoreValue('activeConnection');
19
+ spinner.fail(`Already connected to server ${activeConnection.name}. Please disconnect first.`);
20
+ return;
21
+ }
22
+ try {
23
+ if (!args.name) {
24
+ spinner.fail('Please provide a connection name');
25
+ return;
26
+ }
27
+ const configList = getStoreValue('config');
28
+ const index = configList.findIndex(c => c.name === args.name);
29
+ if (index === -1) {
30
+ spinner.fail(`Connection ${args.name} not found`);
31
+ return;
32
+ }
33
+ await sendToDaemon({ type: 'connect', data: configList[index] });
34
+ spinner.succeed(`Connected to ${args.name} successfully`);
35
+ }
36
+ catch (err) {
37
+ console.log(err);
38
+ spinner.fail(`Failed to connect to ${args.name}`);
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Disconnect extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ name: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,30 @@
1
+ import { Command, Args } from '@oclif/core';
2
+ import ora from 'ora';
3
+ import { sendToDaemon } from '../ipc/client.js';
4
+ import { getStoreValue } from '../core/store/index.js';
5
+ export default class Disconnect extends Command {
6
+ static description = 'Disconnect from a Proton server';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ static args = {
11
+ name: Args.string()
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(Disconnect);
15
+ const spinner = ora('Disconnecting from server...').start();
16
+ const runnerStatus = getStoreValue('runnerStatus');
17
+ if (runnerStatus === 'Offline') {
18
+ spinner.warn(`Already disconnected from server. Please connect first.`);
19
+ return;
20
+ }
21
+ try {
22
+ await sendToDaemon({ type: 'shutdown' });
23
+ spinner.succeed(`Runner is disconnected`);
24
+ }
25
+ catch (err) {
26
+ console.log(err);
27
+ spinner.fail(`Failed to disconnect from ${args.name}`);
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class RunnerListRun extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,71 @@
1
+ import { Command } from '@oclif/core';
2
+ import { getStoreValue } from '../../core/store/index.js';
3
+ import Table from 'cli-table3';
4
+ import clc from 'cli-color';
5
+ export default class RunnerListRun extends Command {
6
+ static description = 'Retrieve the list of runs executed by the Proton runner';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ async run() {
11
+ const {} = await this.parse(RunnerListRun);
12
+ const runList = getStoreValue('runList');
13
+ if (runList.length > 0) {
14
+ const table = new Table({
15
+ head: [
16
+ clc.blue('#id'),
17
+ clc.blue('automation'),
18
+ clc.blue('version'),
19
+ clc.blue('status'),
20
+ ]
21
+ });
22
+ console.log(runList[0].status.length);
23
+ console.log(getStatus(runList[0].status).length);
24
+ for (const run of runList) {
25
+ table.push([String(run.id), run.dataset.automation.name, String(run.dataset.datasetVersion), getStatus(run.status).trim()]);
26
+ }
27
+ this.log("🏁 Running List:");
28
+ this.log(table.toString());
29
+ }
30
+ else {
31
+ this.log('🏁 No active runs found.');
32
+ }
33
+ const waitList = getStoreValue('waitList');
34
+ if (waitList.length > 0) {
35
+ const table = new Table({
36
+ head: [
37
+ clc.blue('#id'),
38
+ clc.blue('automation'),
39
+ clc.blue('version'),
40
+ clc.blue('status'),
41
+ ]
42
+ });
43
+ for (const run of waitList) {
44
+ table.push([String(run.id), run.dataset.automation.name, String(run.dataset.datasetVersion), getStatus(run.status)]);
45
+ }
46
+ this.log("🚧 Waiting List:");
47
+ this.log(table.toString());
48
+ }
49
+ else {
50
+ this.log('🚧 No runs on the waiting list.');
51
+ }
52
+ }
53
+ }
54
+ function getStatus(status) {
55
+ switch (status) {
56
+ case 'Loading':
57
+ return '⌛' + clc.blue(status);
58
+ case 'Running':
59
+ return '🔄 ' + clc.blue(status);
60
+ case 'Waiting':
61
+ return '🕒 ' + clc.yellow(status);
62
+ case 'Stopped':
63
+ return '⛔ ' + clc.red(status);
64
+ case 'Failed':
65
+ return '❌ ' + clc.red(status);
66
+ case 'Passed':
67
+ return '✅ ' + clc.green(status);
68
+ default:
69
+ return status;
70
+ }
71
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class RunnerStatus extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,24 @@
1
+ import { Command } from '@oclif/core';
2
+ import { getStoreValue } from '../../core/store/index.js';
3
+ import ora from 'ora';
4
+ export default class RunnerStatus extends Command {
5
+ static description = 'Retrieve the status of the Proton runner';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %>',
8
+ ];
9
+ async run() {
10
+ const {} = await this.parse(RunnerStatus);
11
+ const spinner = ora("Retrieving runner status...").start();
12
+ try {
13
+ const status = getStoreValue('runnerStatus');
14
+ if (!status) {
15
+ spinner.fail('No runner status found');
16
+ return;
17
+ }
18
+ spinner.succeed(`Runner status: ${status}`);
19
+ }
20
+ catch (err) {
21
+ spinner.fail('Failed to retrieve runner status');
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class RunnerStopRun extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,34 @@
1
+ import { Command, Args } from '@oclif/core';
2
+ import { getStoreValue } from '../../core/store/index.js';
3
+ import { manager } from '../../core/manager/index.js';
4
+ import ora from 'ora';
5
+ export default class RunnerStopRun extends Command {
6
+ static description = 'Stop selected run';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ ];
10
+ static args = {
11
+ id: Args.string()
12
+ };
13
+ async run() {
14
+ const { args } = await this.parse(RunnerStopRun);
15
+ if (!args.id) {
16
+ this.log('Please provide a run ID');
17
+ return;
18
+ }
19
+ const spinner = ora("Stopping run...").start();
20
+ try {
21
+ const runList = getStoreValue('runList');
22
+ const index = runList.findIndex(r => r.id === Number(args.id));
23
+ if (index === -1) {
24
+ spinner.fail(`Run #${args.id} not found`);
25
+ return;
26
+ }
27
+ await manager.stopRun(runList[index].id);
28
+ spinner.succeed(`Run #${args.id} stopped successfully`);
29
+ }
30
+ catch (err) {
31
+ spinner.fail(`Failed to stop run #${args.id}`);
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,6 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class SettingsDisplay extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ }
@@ -0,0 +1,25 @@
1
+ import { Command } from '@oclif/core';
2
+ import { getStoreValue } from '../../core/store/index.js';
3
+ import ora from 'ora';
4
+ export default class SettingsDisplay extends Command {
5
+ static description = 'Retrieve the settings of the Proton runner';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %>'
8
+ ];
9
+ async run() {
10
+ const {} = await this.parse(SettingsDisplay);
11
+ const spinner = ora('Retrieving settings...').start();
12
+ try {
13
+ const settings = getStoreValue('settings');
14
+ if (!settings) {
15
+ spinner.fail('No settings found');
16
+ return;
17
+ }
18
+ spinner.succeed(`Maven Path: ${settings.mavenPath ? settings.mavenPath : 'Not set'}`);
19
+ spinner.succeed(`Parallel Runs: ${settings.parallelRuns}`);
20
+ }
21
+ catch (err) {
22
+ spinner.fail('Failed to retrieve settings');
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class SettingsSet extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ mavenPath: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ parallelRuns: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,39 @@
1
+ import { Command, Flags } from '@oclif/core';
2
+ import { getStoreValue, setStoreValue } from '../../core/store/index.js';
3
+ import ora from 'ora';
4
+ export default class SettingsSet extends Command {
5
+ static description = 'Set Proton server settings';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %>',
8
+ ];
9
+ static flags = {
10
+ mavenPath: Flags.string({
11
+ description: 'Caminho do Maven (ex: C:\\maven\\bin\\mvn.cmd)',
12
+ required: false
13
+ }),
14
+ parallelRuns: Flags.string({
15
+ description: 'Número de execuções paralelas',
16
+ required: false
17
+ })
18
+ };
19
+ async run() {
20
+ const { flags } = await this.parse(SettingsSet);
21
+ const input = {
22
+ mavenPath: flags.mavenPath,
23
+ parallelRuns: Number(flags.parallelRuns)
24
+ };
25
+ const spinner = ora('Updating settings...').start();
26
+ try {
27
+ const settings = getStoreValue('settings');
28
+ const newSettings = {
29
+ mavenPath: input.mavenPath || settings.mavenPath,
30
+ parallelRuns: input.parallelRuns || settings.parallelRuns,
31
+ };
32
+ setStoreValue('settings', newSettings);
33
+ spinner.succeed('Settings updated successfully');
34
+ }
35
+ catch (err) {
36
+ spinner.fail('Failed to update settings');
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class SettingsUnset extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ mavenPath: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ parallelRuns: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ };
9
+ run(): Promise<void>;
10
+ }