@observeone/cli 1.0.3 ā 1.2.0
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 +51 -58
- package/dist/README.md +51 -58
- package/dist/commands/ai-check.d.ts.map +1 -1
- package/dist/commands/ai-check.js +35 -28
- package/dist/commands/ai-check.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +30 -21
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +30 -225
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +3 -3
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/heartbeat.d.ts +1 -1
- package/dist/commands/heartbeat.d.ts.map +1 -1
- package/dist/commands/heartbeat.js +39 -234
- package/dist/commands/heartbeat.js.map +1 -1
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +68 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +10 -58
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/monitor.d.ts +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +32 -235
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/resource-command.factory.d.ts +31 -0
- package/dist/commands/resource-command.factory.d.ts.map +1 -0
- package/dist/commands/resource-command.factory.js +208 -0
- package/dist/commands/resource-command.factory.js.map +1 -0
- package/dist/commands/signup.d.ts +9 -0
- package/dist/commands/signup.d.ts.map +1 -0
- package/dist/commands/signup.js +54 -0
- package/dist/commands/signup.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/api-client.interface.d.ts +9 -6
- package/dist/interfaces/api-client.interface.d.ts.map +1 -1
- package/dist/interfaces/config.interface.d.ts +5 -10
- package/dist/interfaces/config.interface.d.ts.map +1 -1
- package/dist/interfaces/output.interface.d.ts +20 -3
- package/dist/interfaces/output.interface.d.ts.map +1 -1
- package/dist/interfaces/sse-client.interface.d.ts +3 -3
- package/dist/interfaces/sse-client.interface.d.ts.map +1 -1
- package/dist/package.json +1 -1
- package/dist/services/api-client.service.d.ts +7 -4
- package/dist/services/api-client.service.d.ts.map +1 -1
- package/dist/services/api-client.service.js +46 -20
- package/dist/services/api-client.service.js.map +1 -1
- package/dist/services/config.service.d.ts +7 -12
- package/dist/services/config.service.d.ts.map +1 -1
- package/dist/services/config.service.js +47 -18
- package/dist/services/config.service.js.map +1 -1
- package/dist/services/output.service.d.ts +20 -3
- package/dist/services/output.service.d.ts.map +1 -1
- package/dist/services/output.service.js +11 -10
- package/dist/services/output.service.js.map +1 -1
- package/dist/services/sse-client.service.d.ts +1 -1
- package/dist/services/sse-client.service.d.ts.map +1 -1
- package/dist/services/sse-client.service.js +2 -1
- package/dist/services/sse-client.service.js.map +1 -1
- package/dist/services/update.service.d.ts +13 -0
- package/dist/services/update.service.d.ts.map +1 -0
- package/dist/services/update.service.js +57 -0
- package/dist/services/update.service.js.map +1 -0
- package/dist/types/index.d.ts +37 -35
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/deep-equal.d.ts +2 -2
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +6 -4
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/live-progress.d.ts +10 -1
- package/dist/utils/live-progress.d.ts.map +1 -1
- package/dist/utils/live-progress.js +5 -5
- package/dist/utils/live-progress.js.map +1 -1
- package/dist/utils/log-writer.d.ts +15 -2
- package/dist/utils/log-writer.d.ts.map +1 -1
- package/dist/utils/log-writer.js +1 -1
- package/dist/utils/log-writer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"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AU,EAAE,KAAK;gBACjB,gBAAgB,EAAE,IAAI;aACvB,CAAC;QACJ,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;YAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAA0B,CAAC;YAChD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAyB,CAAC;YAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,MAA4B,CAAC;YAEpD,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC7B,aAAa,CAAC,KAAK,CACjB,2EAA2E,CAC5E,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;gBAC3B,GAAG,EAAE,GAAG,IAAI,QAAQ,CAAC,GAAG;gBACxB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,IAAI,KAAK;gBAChE,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,KAAK;gBACxC,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,IAAI;aACpD,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAWnE,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,cAAc,GAC5B,OAAO,CAqGT"}
|
package/dist/commands/export.js
CHANGED
|
@@ -6,7 +6,7 @@ export function createExportCommand(configService, apiClient, outputService) {
|
|
|
6
6
|
.option('-f, --file <path>', 'Path to save the JSON configuration file', 'obs.json')
|
|
7
7
|
.option('-j, --json', 'Output in JSON format')
|
|
8
8
|
.action(async (options) => {
|
|
9
|
-
const isJson = process.env.OBS_JSON_OUTPUT === 'true' || options.json;
|
|
9
|
+
const isJson = process.env.OBS_JSON_OUTPUT === 'true' || options.json === true;
|
|
10
10
|
if (isJson) {
|
|
11
11
|
outputService.enableJsonMode();
|
|
12
12
|
}
|
|
@@ -30,7 +30,7 @@ export function createExportCommand(configService, apiClient, outputService) {
|
|
|
30
30
|
config.monitors = monitors.map((m) => ({
|
|
31
31
|
name: m.name,
|
|
32
32
|
url: m.url,
|
|
33
|
-
|
|
33
|
+
cron_expression: m.cron_expression,
|
|
34
34
|
timeout_ms: m.timeout_ms,
|
|
35
35
|
alert_on_failure: m.alert_on_failure,
|
|
36
36
|
}));
|
|
@@ -50,7 +50,7 @@ export function createExportCommand(configService, apiClient, outputService) {
|
|
|
50
50
|
config.heartbeats = heartbeats.map((h) => ({
|
|
51
51
|
name: h.name,
|
|
52
52
|
period: h.period,
|
|
53
|
-
|
|
53
|
+
grace_period: h.grace_period,
|
|
54
54
|
description: h.description,
|
|
55
55
|
}));
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAUnC,MAAM,UAAU,mBAAmB,CACjC,aAA6B,EAC7B,SAAqB,EACrB,aAA6B;IAE7B,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;SACpC,WAAW,CAAC,+DAA+D,CAAC;SAC5E,MAAM,CAAC,mBAAmB,EAAE,0CAA0C,EAAE,UAAU,CAAC;SACnF,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC;SAC7C,MAAM,CAAC,KAAK,EAAE,OAAgC,EAAE,EAAE;QACjD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC;QAC/E,IAAI,MAAM,EAAE,CAAC;YACX,aAAa,CAAC,cAAc,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;YACzC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,aAAa,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;gBACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,aAAa,CAAC,QAAQ,CAAC,6CAA6C,CAAC,CAAC;YAEtE,sBAAsB;YACtB,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;gBACpE,SAAS,CAAC,cAAc,EAAE,CAAC,KA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;gBAChD,OAAO,CAAC,GAAG,CAAC,iBAAiB,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;gBACjD,OAAO,CAAC,GAAG,CAAC,iBAAiB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;gBAClD,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { IConfigService } from '../interfaces/config.interface.js';
|
|
|
3
3
|
import { IApiClient } from '../interfaces/api-client.interface.js';
|
|
4
4
|
import { IOutputService } from '../interfaces/output.interface.js';
|
|
5
5
|
/**
|
|
6
|
-
* Factory function to create heartbeat command
|
|
6
|
+
* Factory function to create heartbeat command using the generic resource factory
|
|
7
7
|
*/
|
|
8
8
|
export declare function createHeartbeatCommand(configService: IConfigService, apiClient: IApiClient, outputService: IOutputService): Command;
|
|
9
9
|
//# sourceMappingURL=heartbeat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../src/commands/heartbeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../../src/commands/heartbeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAInE;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,cAAc,GAC5B,OAAO,CA2ET"}
|
|
@@ -1,94 +1,28 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
1
|
import inquirer from 'inquirer';
|
|
2
|
+
import { createResourceCommand } from './resource-command.factory.js';
|
|
4
3
|
/**
|
|
5
|
-
* Factory function to create heartbeat command
|
|
4
|
+
* Factory function to create heartbeat command using the generic resource factory
|
|
6
5
|
*/
|
|
7
6
|
export function createHeartbeatCommand(configService, apiClient, outputService) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.format === 'json') {
|
|
28
|
-
outputService.formatJsonOutput(heartbeats);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
outputService.formatHeartbeatList(heartbeats, process.env.OBS_VERBOSE === 'true');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
outputService.error(outputService.formatError(error));
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
// GET
|
|
40
|
-
heartbeat
|
|
41
|
-
.command('get <id>')
|
|
42
|
-
.description('Get details of a heartbeat')
|
|
43
|
-
.option('-j, --json', 'Output in JSON format')
|
|
44
|
-
.action(async (id, options) => {
|
|
45
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
46
|
-
outputService.enableJsonMode();
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
const apiKey = configService.getApiKey();
|
|
50
|
-
if (!apiKey) {
|
|
51
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
52
|
-
process.exit(1);
|
|
53
|
-
}
|
|
54
|
-
const hbId = parseInt(id);
|
|
55
|
-
if (isNaN(hbId)) {
|
|
56
|
-
outputService.error('Invalid heartbeat ID.');
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
outputService.progress(`Fetching heartbeat ${hbId}...`);
|
|
60
|
-
const hbData = await apiClient.getHeartbeat(hbId);
|
|
61
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
62
|
-
outputService.formatJsonOutput(hbData);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
outputService.formatHeartbeatList([hbData], true);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
outputService.error(outputService.formatError(error));
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
// CREATE
|
|
74
|
-
heartbeat
|
|
75
|
-
.command('create')
|
|
76
|
-
.description('Create a new heartbeat')
|
|
77
|
-
.option('-n, --name <name>', 'Heartbeat name')
|
|
78
|
-
.option('-p, --period <seconds>', 'Expected period in seconds')
|
|
79
|
-
.option('-g, --grace <seconds>', 'Grace period in seconds')
|
|
80
|
-
.option('-j, --json', 'Output in JSON format')
|
|
81
|
-
.action(async (options) => {
|
|
82
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
83
|
-
outputService.enableJsonMode();
|
|
84
|
-
}
|
|
85
|
-
try {
|
|
86
|
-
const apiKey = configService.getApiKey();
|
|
87
|
-
if (!apiKey) {
|
|
88
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
let { name, period, grace } = options;
|
|
7
|
+
return createResourceCommand(configService, apiClient, outputService, {
|
|
8
|
+
resourceName: 'heartbeat',
|
|
9
|
+
pluralName: 'heartbeats',
|
|
10
|
+
description: 'Manage heartbeats',
|
|
11
|
+
apiMethods: {
|
|
12
|
+
list: () => apiClient.getHeartbeats(),
|
|
13
|
+
get: (id) => apiClient.getHeartbeat(id),
|
|
14
|
+
create: (data) => apiClient.createHeartbeat(data),
|
|
15
|
+
update: (id, data) => apiClient.updateHeartbeat(id, data),
|
|
16
|
+
delete: (id) => apiClient.deleteHeartbeat(id),
|
|
17
|
+
toggle: (id) => apiClient.toggleHeartbeat(id),
|
|
18
|
+
},
|
|
19
|
+
formatters: {
|
|
20
|
+
list: (items, verbose) => outputService.formatHeartbeatList(items, verbose),
|
|
21
|
+
},
|
|
22
|
+
createPrompts: async (options) => {
|
|
23
|
+
let name = options.name;
|
|
24
|
+
let period = options.period;
|
|
25
|
+
let grace = options.grace;
|
|
92
26
|
if (!name) {
|
|
93
27
|
const answers = await inquirer.prompt([
|
|
94
28
|
{
|
|
@@ -110,164 +44,35 @@ export function createHeartbeatCommand(configService, apiClient, outputService)
|
|
|
110
44
|
default: 60,
|
|
111
45
|
},
|
|
112
46
|
]);
|
|
113
|
-
name = answers.name;
|
|
114
|
-
period = answers.period;
|
|
115
|
-
grace = answers.grace;
|
|
47
|
+
name = name || answers.name;
|
|
48
|
+
period = period || answers.period;
|
|
49
|
+
grace = grace || answers.grace;
|
|
116
50
|
}
|
|
117
|
-
|
|
118
|
-
const newHb = await apiClient.createHeartbeat({
|
|
51
|
+
return {
|
|
119
52
|
name,
|
|
120
|
-
period: parseInt(period) || 300,
|
|
121
|
-
grace_period: parseInt(grace) || 60,
|
|
53
|
+
period: typeof period === 'string' ? parseInt(period) : period || 300,
|
|
54
|
+
grace_period: typeof grace === 'string' ? parseInt(grace) : grace || 60,
|
|
122
55
|
description: 'Created via CLI',
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
outputService.success(`Heartbeat "${newHb.name}" created! UUID: ${newHb.ping_key}`);
|
|
129
|
-
console.log(`\nTo ping this heartbeat, send a GET or POST request to:`);
|
|
130
|
-
console.log(chalk.cyan(`${configService.getApiUrl()}/heartbeats/ping/${newHb.ping_key}`));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
outputService.error(outputService.formatError(error));
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
// UPDATE
|
|
139
|
-
heartbeat
|
|
140
|
-
.command('update <id>')
|
|
141
|
-
.description('Update a heartbeat')
|
|
142
|
-
.option('-n, --name <name>', 'New heartbeat name')
|
|
143
|
-
.option('-p, --period <seconds>', 'New expected period in seconds')
|
|
144
|
-
.option('-j, --json', 'Output in JSON format')
|
|
145
|
-
.action(async (id, options) => {
|
|
146
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
147
|
-
outputService.enableJsonMode();
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
const apiKey = configService.getApiKey();
|
|
151
|
-
if (!apiKey) {
|
|
152
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
const hbId = parseInt(id);
|
|
156
|
-
if (isNaN(hbId)) {
|
|
157
|
-
outputService.error('Invalid heartbeat ID.');
|
|
158
|
-
process.exit(1);
|
|
159
|
-
}
|
|
160
|
-
const { name, period } = options;
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
updatePrompts: async (id, options, existing) => {
|
|
59
|
+
const name = options.name;
|
|
60
|
+
const period = options.period;
|
|
161
61
|
if (!name && !period) {
|
|
162
62
|
outputService.error('Please provide at least one field to update (--name or --period).');
|
|
163
63
|
process.exit(1);
|
|
164
64
|
}
|
|
165
|
-
|
|
166
|
-
const existing = await apiClient.getHeartbeat(hbId);
|
|
167
|
-
const payload = {
|
|
65
|
+
return {
|
|
168
66
|
name: name || existing.name,
|
|
169
|
-
period: period
|
|
67
|
+
period: period
|
|
68
|
+
? typeof period === 'string'
|
|
69
|
+
? parseInt(period)
|
|
70
|
+
: period
|
|
71
|
+
: existing.period,
|
|
170
72
|
description: existing.description || 'Updated via CLI',
|
|
171
73
|
grace_period: existing.grace_period || 60,
|
|
172
74
|
};
|
|
173
|
-
|
|
174
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
175
|
-
outputService.formatJsonOutput(updatedHb);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
outputService.success(`Heartbeat ${hbId} updated successfully.`);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
outputService.error(outputService.formatError(error));
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
// DELETE
|
|
187
|
-
heartbeat
|
|
188
|
-
.command('delete <id>')
|
|
189
|
-
.description('Delete a heartbeat')
|
|
190
|
-
.option('-y, --yes', 'Skip confirmation prompt')
|
|
191
|
-
.option('-j, --json', 'Output in JSON format')
|
|
192
|
-
.action(async (id, options) => {
|
|
193
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
194
|
-
outputService.enableJsonMode();
|
|
195
|
-
}
|
|
196
|
-
try {
|
|
197
|
-
const apiKey = configService.getApiKey();
|
|
198
|
-
if (!apiKey) {
|
|
199
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
200
|
-
process.exit(1);
|
|
201
|
-
}
|
|
202
|
-
const hbId = parseInt(id);
|
|
203
|
-
if (isNaN(hbId)) {
|
|
204
|
-
outputService.error('Invalid heartbeat ID.');
|
|
205
|
-
process.exit(1);
|
|
206
|
-
}
|
|
207
|
-
if (!options.yes) {
|
|
208
|
-
const { confirm } = await inquirer.prompt([
|
|
209
|
-
{
|
|
210
|
-
type: 'confirm',
|
|
211
|
-
name: 'confirm',
|
|
212
|
-
message: `Are you sure you want to delete heartbeat ${hbId}?`,
|
|
213
|
-
default: false,
|
|
214
|
-
},
|
|
215
|
-
]);
|
|
216
|
-
if (!confirm)
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
outputService.progress(`Deleting heartbeat ${hbId}...`);
|
|
220
|
-
await apiClient.deleteHeartbeat(hbId);
|
|
221
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
222
|
-
outputService.formatJsonOutput({ success: true, id: hbId });
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
outputService.success(`Heartbeat ${hbId} deleted successfully.`);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
outputService.error(outputService.formatError(error));
|
|
230
|
-
process.exit(1);
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
// TOGGLE
|
|
234
|
-
heartbeat
|
|
235
|
-
.command('toggle <id>')
|
|
236
|
-
.description('Pause or resume a heartbeat')
|
|
237
|
-
.option('-j, --json', 'Output in JSON format')
|
|
238
|
-
.action(async (id, options) => {
|
|
239
|
-
const isJson = process.env.OBS_JSON_OUTPUT === 'true' || options.json;
|
|
240
|
-
if (isJson) {
|
|
241
|
-
outputService.enableJsonMode();
|
|
242
|
-
}
|
|
243
|
-
try {
|
|
244
|
-
const apiKey = configService.getApiKey();
|
|
245
|
-
if (!apiKey) {
|
|
246
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
247
|
-
process.exit(1);
|
|
248
|
-
}
|
|
249
|
-
const hbId = parseInt(id);
|
|
250
|
-
if (isNaN(hbId)) {
|
|
251
|
-
outputService.error('Invalid heartbeat ID.');
|
|
252
|
-
process.exit(1);
|
|
253
|
-
}
|
|
254
|
-
outputService.progress(`Toggling heartbeat ${hbId}...`);
|
|
255
|
-
const isActive = await apiClient.toggleHeartbeat(hbId);
|
|
256
|
-
if (isJson) {
|
|
257
|
-
outputService.formatJsonOutput({
|
|
258
|
-
id: hbId,
|
|
259
|
-
is_active: isActive,
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
outputService.success(`Heartbeat ${hbId} is now ${isActive ? 'ACTIVE' : 'PAUSED'}.`);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
outputService.error(outputService.formatError(error));
|
|
268
|
-
process.exit(1);
|
|
269
|
-
}
|
|
75
|
+
},
|
|
270
76
|
});
|
|
271
|
-
return heartbeat;
|
|
272
77
|
}
|
|
273
78
|
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../src/commands/heartbeat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../../src/commands/heartbeat.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAIhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,aAA6B,EAC7B,SAAqB,EACrB,aAA6B;IAE7B,OAAO,qBAAqB,CAAY,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE;QAC/E,YAAY,EAAE,WAAW;QACzB,UAAU,EAAE,YAAY;QACxB,WAAW,EAAE,mBAAmB;QAChC,UAAU,EAAE;YACV,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE;YACrC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC;YACjD,MAAM,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC;YACzD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAA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AI;gBACJ,MAAM,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,MAAiB,IAAI,GAAG;gBACjF,YAAY,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAgB,IAAI,EAAE;gBACnF,WAAW,EAAE,iBAAiB;aAC/B,CAAC;QACJ,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;YAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAA0B,CAAC;YAChD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAqC,CAAC;YAE7D,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrB,aAAa,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;gBACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;gBAC3B,MAAM,EAAE,MAAM;oBACZ,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ;wBAC1B,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;wBAClB,CAAC,CAAE,MAAiB;oBACtB,CAAC,CAAC,QAAQ,CAAC,MAAM;gBACnB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,iBAAiB;gBACtD,YAAY,EAAE,QAAQ,CAAC,YAAY,IAAI,EAAE;aAC1C,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { IConfigService } from '../interfaces/config.interface.js';
|
|
3
|
+
import { IOutputService } from '../interfaces/output.interface.js';
|
|
4
|
+
export declare function createInitCommand(configService: IConfigService, outputService: IOutputService): Command;
|
|
5
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,cAAc,EAC7B,aAAa,EAAE,cAAc,GAC5B,OAAO,CAsET"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { existsSync, writeFileSync } from 'fs';
|
|
5
|
+
export function createInitCommand(configService, outputService) {
|
|
6
|
+
return new Command('init')
|
|
7
|
+
.description('Initialize project configuration in the current directory')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
try {
|
|
10
|
+
const configPath = '.obs.config.json';
|
|
11
|
+
if (existsSync(configPath)) {
|
|
12
|
+
outputService.warning('Project configuration already exists in this directory.');
|
|
13
|
+
const { overwrite } = await inquirer.prompt([
|
|
14
|
+
{
|
|
15
|
+
type: 'confirm',
|
|
16
|
+
name: 'overwrite',
|
|
17
|
+
message: 'Do you want to overwrite it?',
|
|
18
|
+
default: false,
|
|
19
|
+
},
|
|
20
|
+
]);
|
|
21
|
+
if (!overwrite) {
|
|
22
|
+
console.log(chalk.gray('Operations aborted.'));
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
console.log(chalk.bold('\nš Setting up project configuration...'));
|
|
27
|
+
const projectAnswers = await inquirer.prompt([
|
|
28
|
+
{
|
|
29
|
+
type: 'input',
|
|
30
|
+
name: 'projectName',
|
|
31
|
+
message: 'Project name:',
|
|
32
|
+
default: process.cwd().split(/[/\\]/).pop() || 'My Project',
|
|
33
|
+
validate: (input) => (input.trim() ? true : 'Project name is required'),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'input',
|
|
37
|
+
name: 'projectDescription',
|
|
38
|
+
message: 'Project description:',
|
|
39
|
+
default: 'AI-powered test automation project',
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
42
|
+
const projectConfig = {
|
|
43
|
+
project: {
|
|
44
|
+
name: projectAnswers.projectName,
|
|
45
|
+
description: projectAnswers.projectDescription,
|
|
46
|
+
},
|
|
47
|
+
defaultOptions: {
|
|
48
|
+
timeout: 600000,
|
|
49
|
+
retries: 3,
|
|
50
|
+
verbose: false,
|
|
51
|
+
pollIntervalMs: 2000,
|
|
52
|
+
maxAttempts: 300,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
writeFileSync(configPath, JSON.stringify(projectConfig, null, 2));
|
|
56
|
+
configService.setProjectConfig(projectConfig.project);
|
|
57
|
+
configService.setDefaultOptions(projectConfig.defaultOptions);
|
|
58
|
+
outputService.success('Project configuration created!');
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const err = error;
|
|
63
|
+
outputService.error(`Failed to initialize project: ${err.message}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAI/C,MAAM,UAAU,iBAAiB,CAC/B,aAA6B,EAC7B,aAA6B;IAE7B,OAAO,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BAC9C;aACF,CAAC,CAAC;YAEH,MAAM,aAAa,GAAG;gBACpB,OAAO,EAAE;oBACP,IAAI,EAAE,cAAc,CAAC,WAAW;oBAChC,WAAW,EAAE,cAAc,CAAC,kBAAkB;iBAC/C;gBACD,cAAc,EAAE;oBACd,OAAO,EAAE,MAAM;oBACf,OAAO,EAAE,CAAC;oBACV,OAAO,EAAE,KAAK;oBACd,cAAc,EAAE,IAAI;oBACpB,WAAW,EAAE,GAAG;iBACjB;aACF,CAAC;YAEF,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAClE,aAAa,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACtD,aAAa,CAAC,iBAAiB,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;YAC9D,aAAa,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;YACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,KAAc,CAAC;YAC3B,aAAa,CAAC,KAAK,CAAC,iCAAiC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,cAAc,GAC5B,OAAO,CAoKT"}
|