@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.
- package/README.md +590 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +5 -0
- package/dist/commands/config/add.d.ts +14 -0
- package/dist/commands/config/add.js +122 -0
- package/dist/commands/config/edit.d.ts +15 -0
- package/dist/commands/config/edit.js +63 -0
- package/dist/commands/config/list.d.ts +6 -0
- package/dist/commands/config/list.js +31 -0
- package/dist/commands/config/remove.d.ts +9 -0
- package/dist/commands/config/remove.js +35 -0
- package/dist/commands/connect.d.ts +9 -0
- package/dist/commands/connect.js +41 -0
- package/dist/commands/disconnect.d.ts +9 -0
- package/dist/commands/disconnect.js +30 -0
- package/dist/commands/runner/list-run.d.ts +6 -0
- package/dist/commands/runner/list-run.js +71 -0
- package/dist/commands/runner/status.d.ts +6 -0
- package/dist/commands/runner/status.js +24 -0
- package/dist/commands/runner/stop-run.d.ts +9 -0
- package/dist/commands/runner/stop-run.js +34 -0
- package/dist/commands/settings/index.d.ts +6 -0
- package/dist/commands/settings/index.js +25 -0
- package/dist/commands/settings/set.d.ts +10 -0
- package/dist/commands/settings/set.js +39 -0
- package/dist/commands/settings/unset.d.ts +10 -0
- package/dist/commands/settings/unset.js +35 -0
- package/dist/core/fileSystem/index.d.ts +10 -0
- package/dist/core/fileSystem/index.js +107 -0
- package/dist/core/manager/index.d.ts +31 -0
- package/dist/core/manager/index.js +287 -0
- package/dist/core/proton/api.d.ts +7 -0
- package/dist/core/proton/api.js +122 -0
- package/dist/core/proton/maven.d.ts +5 -0
- package/dist/core/proton/maven.js +74 -0
- package/dist/core/proton/npm.d.ts +1 -0
- package/dist/core/proton/npm.js +22 -0
- package/dist/core/proton/playwright.d.ts +5 -0
- package/dist/core/proton/playwright.js +47 -0
- package/dist/core/proton/pyTest.d.ts +5 -0
- package/dist/core/proton/pyTest.js +52 -0
- package/dist/core/proton/vbs.d.ts +5 -0
- package/dist/core/proton/vbs.js +46 -0
- package/dist/core/runner/index.d.ts +16 -0
- package/dist/core/runner/index.js +76 -0
- package/dist/core/services/api.d.ts +2 -0
- package/dist/core/services/api.js +20 -0
- package/dist/core/socket/index.d.ts +2 -0
- package/dist/core/socket/index.js +99 -0
- package/dist/core/store/index.d.ts +14 -0
- package/dist/core/store/index.js +212 -0
- package/dist/core/system/index.d.ts +12 -0
- package/dist/core/system/index.js +48 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.js +5 -0
- package/dist/daemon/server.d.ts +1 -0
- package/dist/daemon/server.js +40 -0
- package/dist/daemon/state.d.ts +7 -0
- package/dist/daemon/state.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ipc/client.d.ts +1 -0
- package/dist/ipc/client.js +16 -0
- package/dist/ipc/ensureDaemon.d.ts +1 -0
- package/dist/ipc/ensureDaemon.js +42 -0
- package/dist/ipc/protocol.d.ts +14 -0
- package/dist/ipc/protocol.js +1 -0
- package/dist/shared/constants.d.ts +4 -0
- package/dist/shared/constants.js +4 -0
- package/dist/shared/socketPath.d.ts +1 -0
- package/dist/shared/socketPath.js +5 -0
- package/dist/shared/types.d.ts +130 -0
- package/dist/shared/types.js +1 -0
- package/oclif.manifest.json +409 -0
- package/package.json +86 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import * as $ from '../../shared/constants.js';
|
|
3
|
+
export async function getOS() {
|
|
4
|
+
let opSys = "";
|
|
5
|
+
switch (process.platform) {
|
|
6
|
+
case 'darwin':
|
|
7
|
+
opSys = $.CST_OS_MAC;
|
|
8
|
+
break;
|
|
9
|
+
case 'win32':
|
|
10
|
+
opSys = $.CST_OS_WIN;
|
|
11
|
+
break;
|
|
12
|
+
case 'linux':
|
|
13
|
+
opSys = $.CST_OS_LINUX;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
hostname: os.hostname(),
|
|
18
|
+
ip: getLocalIpAddress(),
|
|
19
|
+
macAddress: getFirstMacAddress(),
|
|
20
|
+
operatingSystem: opSys,
|
|
21
|
+
architecture: process.arch,
|
|
22
|
+
availableProcessors: os.cpus().length,
|
|
23
|
+
freeMemory: os.freemem() / 1024,
|
|
24
|
+
totalMemory: os.totalmem() / 1024
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function getLocalIpAddress() {
|
|
28
|
+
const interfaces = os.networkInterfaces();
|
|
29
|
+
for (const name of Object.keys(interfaces)) {
|
|
30
|
+
for (const net of interfaces[name] || []) {
|
|
31
|
+
if (net.family === 'IPv4' && !net.internal) {
|
|
32
|
+
return net.address;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
export function getFirstMacAddress() {
|
|
39
|
+
const interfaces = os.networkInterfaces();
|
|
40
|
+
for (const name of Object.keys(interfaces)) {
|
|
41
|
+
for (const net of interfaces[name] || []) {
|
|
42
|
+
if (net.mac && net.mac !== '00:00:00:00:00:00') {
|
|
43
|
+
return net.mac;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startIpcServer(): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
console.log('Daemon starting...');
|
|
2
|
+
import net from 'net';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import { SOCKET_PATH } from '../shared/socketPath.js';
|
|
5
|
+
import { handleRequest } from './state.js';
|
|
6
|
+
import { runner } from '../core/runner/index.js';
|
|
7
|
+
export function startIpcServer() {
|
|
8
|
+
if (process.platform !== 'win32' && fs.existsSync(SOCKET_PATH)) {
|
|
9
|
+
fs.unlinkSync(SOCKET_PATH);
|
|
10
|
+
}
|
|
11
|
+
const server = net.createServer(socket => {
|
|
12
|
+
socket.on('data', async (data) => {
|
|
13
|
+
const msg = JSON.parse(data.toString());
|
|
14
|
+
if (msg.type === 'shutdown') {
|
|
15
|
+
await runner.setDisconnected();
|
|
16
|
+
socket.write(JSON.stringify({ ok: true }));
|
|
17
|
+
socket.end();
|
|
18
|
+
console.log('Daemon shutting down...');
|
|
19
|
+
server.close(() => {
|
|
20
|
+
process.exit(0);
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const req = JSON.parse(data.toString());
|
|
26
|
+
const res = await handleRequest(req);
|
|
27
|
+
socket.write(JSON.stringify({ ok: true, data: res }));
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
socket.write(JSON.stringify({ ok: false, error: err.message }));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
server.listen(SOCKET_PATH, () => {
|
|
35
|
+
console.log('Daemon listening');
|
|
36
|
+
});
|
|
37
|
+
server.on('error', err => {
|
|
38
|
+
console.error('Daemon server error:', err);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { runner } from '../core/runner/index.js';
|
|
2
|
+
export async function handleRequest(req) {
|
|
3
|
+
switch (req.type) {
|
|
4
|
+
case 'status':
|
|
5
|
+
return runner.getStatus();
|
|
6
|
+
case 'connect':
|
|
7
|
+
await runner.connect(req.data);
|
|
8
|
+
return { ok: true };
|
|
9
|
+
case 'disconnect':
|
|
10
|
+
await runner.setDisconnected();
|
|
11
|
+
return { ok: true };
|
|
12
|
+
default:
|
|
13
|
+
return { error: 'Comando desconhecido' };
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from '@oclif/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sendToDaemon(message: any): Promise<any>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import net from 'net';
|
|
2
|
+
import { SOCKET_PATH } from '../shared/socketPath.js';
|
|
3
|
+
import { ensureDaemonRunning } from './ensureDaemon.js';
|
|
4
|
+
export async function sendToDaemon(message) {
|
|
5
|
+
await ensureDaemonRunning();
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
const client = net.createConnection(SOCKET_PATH, () => {
|
|
8
|
+
client.write(JSON.stringify(message));
|
|
9
|
+
});
|
|
10
|
+
client.on('data', data => {
|
|
11
|
+
resolve(JSON.parse(data.toString()));
|
|
12
|
+
client.end();
|
|
13
|
+
});
|
|
14
|
+
client.on('error', reject);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ensureDaemonRunning(): Promise<void>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import net from 'node:net';
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { SOCKET_PATH } from '../shared/socketPath.js';
|
|
5
|
+
const isDev = process.env.NODE_ENV !== 'production';
|
|
6
|
+
function tryConnect() {
|
|
7
|
+
return new Promise(resolve => {
|
|
8
|
+
const socket = net.createConnection(SOCKET_PATH);
|
|
9
|
+
socket.once('connect', () => {
|
|
10
|
+
socket.end();
|
|
11
|
+
resolve(true);
|
|
12
|
+
});
|
|
13
|
+
socket.once('error', () => {
|
|
14
|
+
resolve(false);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export async function ensureDaemonRunning() {
|
|
19
|
+
const isRunning = await tryConnect();
|
|
20
|
+
if (isRunning)
|
|
21
|
+
return;
|
|
22
|
+
// daemon não existe → iniciar
|
|
23
|
+
const daemonEntry = isDev
|
|
24
|
+
? path.resolve(process.cwd(), 'src/daemon/index.ts')
|
|
25
|
+
: path.resolve(process.cwd(), 'dist/daemon/index.js');
|
|
26
|
+
const cmd = isDev
|
|
27
|
+
? ['node_modules/tsx/dist/cli.mjs', daemonEntry]
|
|
28
|
+
: [daemonEntry];
|
|
29
|
+
spawn(process.execPath, cmd, {
|
|
30
|
+
detached: true,
|
|
31
|
+
stdio: 'ignore',
|
|
32
|
+
windowsHide: true
|
|
33
|
+
}).unref();
|
|
34
|
+
// aguarda o daemon subir
|
|
35
|
+
const timeout = Date.now() + 3000;
|
|
36
|
+
while (Date.now() < timeout) {
|
|
37
|
+
if (await tryConnect())
|
|
38
|
+
return;
|
|
39
|
+
await new Promise(r => setTimeout(r, 100));
|
|
40
|
+
}
|
|
41
|
+
throw new Error('Não foi possível iniciar o daemon');
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SOCKET_PATH: string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export interface ISettings {
|
|
2
|
+
mavenPath: string;
|
|
3
|
+
parallelRuns: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IConnection {
|
|
6
|
+
name: string;
|
|
7
|
+
server: string;
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
privateMode: boolean;
|
|
11
|
+
statusNotification: boolean;
|
|
12
|
+
token: string;
|
|
13
|
+
order: number;
|
|
14
|
+
}
|
|
15
|
+
export type ConfigInput = {
|
|
16
|
+
name: string;
|
|
17
|
+
server: string;
|
|
18
|
+
email: string;
|
|
19
|
+
password: string;
|
|
20
|
+
};
|
|
21
|
+
export interface IRunConfig {
|
|
22
|
+
dir: string;
|
|
23
|
+
idDatasetRun: number;
|
|
24
|
+
reference: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface IProtonRunProcess {
|
|
27
|
+
idDatasetRun: number;
|
|
28
|
+
processId: number;
|
|
29
|
+
}
|
|
30
|
+
export interface IProtonRunPackage {
|
|
31
|
+
datasetRun: Array<IDatasetRun>;
|
|
32
|
+
system: Array<ISystem>;
|
|
33
|
+
}
|
|
34
|
+
export type RunnerStatus = 'Offline' | 'Connecting' | 'Idle' | 'Busy';
|
|
35
|
+
export type RunnerUpdateStatus = 'checking' | 'available' | 'notAvailable';
|
|
36
|
+
export interface IAppStoreData {
|
|
37
|
+
settings: ISettings;
|
|
38
|
+
config: IConnection[];
|
|
39
|
+
activeConnection: IConnection | null;
|
|
40
|
+
headerStyle: string;
|
|
41
|
+
process: IProtonRunProcess[];
|
|
42
|
+
hasUpdate: string;
|
|
43
|
+
connected: boolean;
|
|
44
|
+
runnerStatus: "Offline" | "Connecting" | "Idle" | "Busy";
|
|
45
|
+
runList: IDatasetRun[];
|
|
46
|
+
waitList: IDatasetRun[];
|
|
47
|
+
msgPanel: string;
|
|
48
|
+
alertMsg: IAlertMsg | null;
|
|
49
|
+
}
|
|
50
|
+
export interface IAlertMsg {
|
|
51
|
+
type: 'info' | 'warning' | 'error' | 'success';
|
|
52
|
+
msg: string;
|
|
53
|
+
}
|
|
54
|
+
export interface IDatasetRun {
|
|
55
|
+
id: number;
|
|
56
|
+
idDataset: number;
|
|
57
|
+
idCycle: number;
|
|
58
|
+
idScheduleRun: number;
|
|
59
|
+
idRunner: number;
|
|
60
|
+
idUser: number;
|
|
61
|
+
idStatus: number;
|
|
62
|
+
idPriority: number;
|
|
63
|
+
device: string | null;
|
|
64
|
+
app: string | null;
|
|
65
|
+
executionDate: string;
|
|
66
|
+
idErrorStrategy: number | null;
|
|
67
|
+
externalId: string | null;
|
|
68
|
+
status: string;
|
|
69
|
+
system: ISystem[];
|
|
70
|
+
isRunning: boolean;
|
|
71
|
+
isComplete: boolean;
|
|
72
|
+
isUploadingResults: boolean;
|
|
73
|
+
dataset: {
|
|
74
|
+
id: number;
|
|
75
|
+
idCategory: number;
|
|
76
|
+
idAutomation: number;
|
|
77
|
+
datasetVersion: number;
|
|
78
|
+
description: string;
|
|
79
|
+
automation: {
|
|
80
|
+
id: number;
|
|
81
|
+
name: string;
|
|
82
|
+
idBusinessProcess: number;
|
|
83
|
+
mobile: boolean;
|
|
84
|
+
reference: string;
|
|
85
|
+
description: string;
|
|
86
|
+
private: boolean;
|
|
87
|
+
createdBy: number;
|
|
88
|
+
createdAt: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface ISystem {
|
|
93
|
+
id: number;
|
|
94
|
+
idGitRepository: number;
|
|
95
|
+
name: string;
|
|
96
|
+
gitRepository: IRepoData;
|
|
97
|
+
}
|
|
98
|
+
export interface IRepoData {
|
|
99
|
+
id: number;
|
|
100
|
+
platform: string;
|
|
101
|
+
owner: string;
|
|
102
|
+
repository: string;
|
|
103
|
+
defaultBranch: string;
|
|
104
|
+
remoteAuthorization: string;
|
|
105
|
+
description: string | null;
|
|
106
|
+
repoId: string;
|
|
107
|
+
bddRepo: boolean;
|
|
108
|
+
branches: string[];
|
|
109
|
+
headerHash?: string;
|
|
110
|
+
}
|
|
111
|
+
export type TSocketData = {
|
|
112
|
+
server: string;
|
|
113
|
+
email: string;
|
|
114
|
+
password: string;
|
|
115
|
+
privateMode: boolean;
|
|
116
|
+
statusNotification: boolean;
|
|
117
|
+
};
|
|
118
|
+
export type TSocketAuthorization = {
|
|
119
|
+
authorized: boolean;
|
|
120
|
+
token?: string;
|
|
121
|
+
msg: string;
|
|
122
|
+
};
|
|
123
|
+
export type TUpdateRunData = {
|
|
124
|
+
idDatasetRun: number;
|
|
125
|
+
status: string;
|
|
126
|
+
};
|
|
127
|
+
export interface InitiateProcessOptions {
|
|
128
|
+
cwd: string;
|
|
129
|
+
args: string[];
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|