@thinremote/thinr-cli 1.3.4 → 1.4.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/CHANGELOG.md +86 -0
- package/README.md +117 -123
- package/bin/thinr.js +43 -105
- package/commands/_shared.js +10 -90
- package/commands/device/_shared.js +2 -2
- package/commands/device/exec.js +2 -2
- package/commands/device/fs.js +2 -2
- package/commands/device/index.js +5 -19
- package/commands/device/logs.js +4 -4
- package/commands/device/status.js +1 -1
- package/commands/device/transfer.js +2 -2
- package/commands/device/update.js +8 -2
- package/commands/fleet/upgrade.js +3 -3
- package/commands/playbook/run.js +2 -2
- package/commands/playbook/validate.js +2 -2
- package/commands/product/_shared.js +1 -1
- package/commands/product/exec.js +2 -2
- package/commands/product/fs.js +2 -2
- package/commands/product/index.js +4 -11
- package/commands/product/logs.js +2 -2
- package/commands/product/metric.js +2 -2
- package/commands/product/playbook.js +5 -5
- package/commands/product/property.js +4 -4
- package/commands/product/push.js +2 -2
- package/commands/product/resource.js +4 -4
- package/commands/product/status.js +3 -3
- package/dist/dashboard.js +12 -12
- package/docs/guides/thinremote-metrics-logs.md +59 -0
- package/docs/guides/thinremote-playbooks.md +133 -0
- package/docs/guides/thinremote-scripts.md +115 -0
- package/docs/guides/thinremote.md +116 -0
- package/lib/command-stream.js +3 -2
- package/lib/console.js +6 -6
- package/lib/constants.js +1 -19
- package/lib/dashboard/event-stream.js +5 -5
- package/lib/device-api.js +4 -4
- package/lib/guides.js +41 -0
- package/lib/identity.js +75 -0
- package/lib/local-files.js +54 -0
- package/lib/mcp/{tools-install.js → agent-install.js} +12 -61
- package/lib/mcp/helpers.js +5 -25
- package/lib/mcp/playbook-ops.js +393 -0
- package/lib/mcp/registry.js +9 -43
- package/lib/mcp/resource-hooks.js +53 -0
- package/lib/mcp/resource-types.js +857 -0
- package/lib/mcp/tools-exec.js +217 -177
- package/lib/monitoring.js +3 -3
- package/lib/playbook/actions.js +30 -18
- package/lib/playbook/expression.js +1 -4
- package/lib/playbook/fleet.js +4 -1
- package/lib/playbook/loader.js +16 -8
- package/lib/playbook/runner.js +40 -8
- package/lib/playbook/schema.js +108 -34
- package/lib/product/log-presets.js +1 -1
- package/lib/product/logs.js +2 -2
- package/lib/product-orchestrator.js +14 -9
- package/lib/product.js +29 -227
- package/lib/proxy.js +4 -4
- package/lib/status.js +13 -5
- package/package.json +4 -2
- package/commands/device/delete.js +0 -53
- package/commands/device/list.js +0 -55
- package/commands/device/property.js +0 -52
- package/commands/device/resource.js +0 -52
- package/commands/logout.js +0 -47
- package/commands/product/list.js +0 -86
- package/commands/product/props.js +0 -125
- package/commands/profile.js +0 -173
- package/lib/alarms.js +0 -223
- package/lib/api.js +0 -89
- package/lib/auth.js +0 -428
- package/lib/bucket.js +0 -82
- package/lib/concurrency.js +0 -52
- package/lib/config.js +0 -230
- package/lib/devices.js +0 -60
- package/lib/errors.js +0 -65
- package/lib/format.js +0 -114
- package/lib/mcp/server.js +0 -67
- package/lib/mcp/tools-alarms.js +0 -507
- package/lib/mcp/tools-buckets.js +0 -99
- package/lib/mcp/tools-devices.js +0 -235
- package/lib/mcp/tools-filesystem.js +0 -281
- package/lib/mcp/tools-logs.js +0 -225
- package/lib/mcp/tools-playbook.js +0 -210
- package/lib/mcp/tools-products.js +0 -1557
- package/lib/mcp/tools-profile.js +0 -635
- package/lib/mcp/tools-profiles.js +0 -30
- package/lib/mcp/tools-properties.js +0 -79
- package/lib/mcp/tools-resources.js +0 -78
- package/lib/mcp/tools-scripts.js +0 -212
- package/lib/mcp/tools-tokens.js +0 -369
- package/lib/output.js +0 -114
- package/lib/paths.js +0 -32
- package/lib/profile.js +0 -657
- package/lib/property.js +0 -75
- package/lib/resource.js +0 -151
- package/lib/storage.js +0 -117
- package/lib/tokens.js +0 -366
package/commands/_shared.js
CHANGED
|
@@ -1,44 +1,15 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { InvalidArgumentError } from 'commander';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export function ensureConfigured() {
|
|
14
|
-
if (!configExists()) {
|
|
15
|
-
printErr('Not configured. Run thinr without parameters to set up.', {
|
|
16
|
-
code: 'not_configured',
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function applyJsonFlag(opts) {
|
|
22
|
-
if (opts.json) setJsonMode(true);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Walks up to the root program so subcommands can read `--user` regardless
|
|
26
|
-
// of nesting depth.
|
|
27
|
-
export function getGlobalUser(cmd) {
|
|
28
|
-
let root = cmd;
|
|
29
|
-
while (root.parent) root = root.parent;
|
|
30
|
-
return root.opts().user || null;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function parsePositiveInt(label) {
|
|
34
|
-
return (value) => {
|
|
35
|
-
const n = Number(value);
|
|
36
|
-
if (!Number.isInteger(n) || n <= 0) {
|
|
37
|
-
throw new InvalidArgumentError(`${label} must be a positive integer`);
|
|
38
|
-
}
|
|
39
|
-
return n;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
3
|
+
// Helpers shared with every CLI on @thinger-io/cli-core; `runDeviceCommand`
|
|
4
|
+
// is the name thinr's subcommands have always used for its `runCommand`.
|
|
5
|
+
export {
|
|
6
|
+
applyJsonFlag,
|
|
7
|
+
ensureConfigured,
|
|
8
|
+
extractField,
|
|
9
|
+
getGlobalUser,
|
|
10
|
+
parsePositiveInt,
|
|
11
|
+
runCommand as runDeviceCommand,
|
|
12
|
+
} from '@thinger-io/cli-core/commands/_shared';
|
|
42
13
|
|
|
43
14
|
// Collect repeatable `-i key=value` / `-v key=value` pairs into a single
|
|
44
15
|
// object. Uses Commander's InvalidArgumentError so a bad value prints a
|
|
@@ -54,14 +25,6 @@ export function collectKeyValue(value, previous = {}) {
|
|
|
54
25
|
export const collectInput = collectKeyValue;
|
|
55
26
|
export const collectVar = collectKeyValue;
|
|
56
27
|
|
|
57
|
-
// Resolve a dot-path against a nested object. Returns `undefined` as soon
|
|
58
|
-
// as any intermediate hop is missing — matching the previous inline
|
|
59
|
-
// `reduce((o, k) => o && o[k], obj)` behaviour across the CLI.
|
|
60
|
-
export function extractField(obj, path) {
|
|
61
|
-
if (!path) return obj;
|
|
62
|
-
return path.split('.').reduce((o, k) => (o == null ? o : o[k]), obj);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
28
|
/**
|
|
66
29
|
* Live counter for fan-out spinners. Wraps an ora spinner and rewrites
|
|
67
30
|
* its text as work enters/leaves the pool and completes. Use it to avoid
|
|
@@ -109,46 +72,3 @@ export class ProgressSpinner {
|
|
|
109
72
|
this.spinner.stop();
|
|
110
73
|
}
|
|
111
74
|
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* One-shot command skeleton shared by read-only device subcommands
|
|
115
|
-
* (status, list, property, resource…). Handles the spinner start,
|
|
116
|
-
* try/catch, `classifyError`+`printErr` on failure, and the
|
|
117
|
-
* `isJsonMode() ? printOk : console.log` default for the success path.
|
|
118
|
-
*
|
|
119
|
-
* Shape:
|
|
120
|
-
* await runDeviceCommand({
|
|
121
|
-
* start: 'Fetching devices…', // spinner label
|
|
122
|
-
* fn: () => getDevices(filter), // async unit of work
|
|
123
|
-
* success: n => `Found ${n} device(s)`,// string | (result) => string | null
|
|
124
|
-
* failure: 'Failed to list devices', // string on failure
|
|
125
|
-
* onSuccess: (result) => { … }, // optional full render override
|
|
126
|
-
* });
|
|
127
|
-
*
|
|
128
|
-
* When `success` is `null` the spinner just stops (no checkmark), which
|
|
129
|
-
* matches the idiom used by commands whose output block already speaks
|
|
130
|
-
* for the "found" state. When `onSuccess` is omitted the result is
|
|
131
|
-
* printed verbatim (`printOk` in JSON mode, `console.log` otherwise).
|
|
132
|
-
*/
|
|
133
|
-
export async function runDeviceCommand({ start, fn, success, failure, onSuccess }) {
|
|
134
|
-
const spinner = createSpinner(start).start();
|
|
135
|
-
try {
|
|
136
|
-
const result = await fn();
|
|
137
|
-
if (success === null) {
|
|
138
|
-
spinner.stop();
|
|
139
|
-
} else {
|
|
140
|
-
spinner.succeed(typeof success === 'function' ? success(result) : success);
|
|
141
|
-
}
|
|
142
|
-
if (onSuccess) {
|
|
143
|
-
await onSuccess(result);
|
|
144
|
-
} else if (isJsonMode()) {
|
|
145
|
-
printOk(result);
|
|
146
|
-
} else {
|
|
147
|
-
console.log(result);
|
|
148
|
-
}
|
|
149
|
-
} catch (error) {
|
|
150
|
-
spinner.fail(typeof failure === 'function' ? failure(error) : failure);
|
|
151
|
-
const { message, code } = classifyError(error);
|
|
152
|
-
printErr(message, { code });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { classifyError } from '
|
|
3
|
-
import { error as errorStyle } from '
|
|
2
|
+
import { classifyError } from '@thinger-io/cli-core/output';
|
|
3
|
+
import { error as errorStyle } from '@thinger-io/cli-core/format';
|
|
4
4
|
|
|
5
5
|
export {
|
|
6
6
|
ensureConfigured,
|
package/commands/device/exec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { createDeviceAPI } from '../../lib/device-api.js';
|
|
3
|
-
import { isJsonMode, printOk, printErr, classifyError } from '
|
|
4
|
-
import { error as errorStyle, warning } from '
|
|
3
|
+
import { isJsonMode, printOk, printErr, classifyError } from '@thinger-io/cli-core/output';
|
|
4
|
+
import { error as errorStyle, warning } from '@thinger-io/cli-core/format';
|
|
5
5
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from './_shared.js';
|
|
6
6
|
|
|
7
7
|
export function registerExecCommand(device) {
|
package/commands/device/fs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { createDeviceAPI } from '../../lib/device-api.js';
|
|
3
|
-
import { isJsonMode, printOk, printErr, createSpinner, classifyError } from '
|
|
4
|
-
import { success, hint, muted, label } from '
|
|
3
|
+
import { isJsonMode, printOk, printErr, createSpinner, classifyError } from '@thinger-io/cli-core/output';
|
|
4
|
+
import { success, hint, muted, label } from '@thinger-io/cli-core/format';
|
|
5
5
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from './_shared.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/commands/device/index.js
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { registerListCommand } from './list.js';
|
|
3
2
|
import { registerProxyCommands } from './proxy.js';
|
|
4
3
|
import { registerConsoleCommand } from './console.js';
|
|
5
4
|
import { registerStatusCommand } from './status.js';
|
|
6
|
-
import { registerPropertyCommand } from './property.js';
|
|
7
|
-
import { registerResourceCommand } from './resource.js';
|
|
8
5
|
import { registerExecCommand } from './exec.js';
|
|
9
6
|
import { registerUpdateCommand } from './update.js';
|
|
10
7
|
import { registerTransferCommands } from './transfer.js';
|
|
11
8
|
import { registerFsCommands } from './fs.js';
|
|
12
9
|
import { registerLogsCommand } from './logs.js';
|
|
13
|
-
import { registerDeleteCommand } from './delete.js';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
|
-
* `thinr device <subcommand> [<deviceId>] …` —
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* fleet, not a single device).
|
|
12
|
+
* `thinr device <subcommand> [<deviceId>] …` — the agent-backed actions
|
|
13
|
+
* (console, proxies, exec, files, logs, status, agent updates), added to
|
|
14
|
+
* the generic `device` group of @thinger-io/cli-core, which already holds
|
|
15
|
+
* list, info, create, delete, set-product, property and resource.
|
|
21
16
|
*/
|
|
22
|
-
export function
|
|
23
|
-
const device = program
|
|
24
|
-
.command('device')
|
|
25
|
-
.helpGroup('Operations:')
|
|
26
|
-
.description('Device commands (subcommand-first: thinr device <action> <deviceId>)');
|
|
27
|
-
|
|
28
|
-
registerListCommand(device);
|
|
17
|
+
export function registerDeviceCommands(device) {
|
|
29
18
|
registerProxyCommands(device);
|
|
30
19
|
registerConsoleCommand(device);
|
|
31
20
|
registerStatusCommand(device);
|
|
32
|
-
registerPropertyCommand(device);
|
|
33
|
-
registerResourceCommand(device);
|
|
34
21
|
registerExecCommand(device);
|
|
35
22
|
registerUpdateCommand(device);
|
|
36
23
|
registerTransferCommands(device);
|
|
37
24
|
registerFsCommands(device);
|
|
38
25
|
registerLogsCommand(device);
|
|
39
|
-
registerDeleteCommand(device);
|
|
40
26
|
}
|
package/commands/device/logs.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { createDeviceAPI } from '../../lib/device-api.js';
|
|
3
|
-
import { getDevice } from '
|
|
3
|
+
import { getDevice } from '@thinger-io/cli-core/devices';
|
|
4
4
|
import { getProductLogs } from '../../lib/product/logs.js';
|
|
5
|
-
import { inputError } from '
|
|
6
|
-
import { isJsonMode, printOk, printErr, classifyError } from '
|
|
7
|
-
import { error as errorStyle, muted, warning } from '
|
|
5
|
+
import { inputError } from '@thinger-io/cli-core/errors';
|
|
6
|
+
import { isJsonMode, printOk, printErr, classifyError } from '@thinger-io/cli-core/output';
|
|
7
|
+
import { error as errorStyle, muted, warning } from '@thinger-io/cli-core/format';
|
|
8
8
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from './_shared.js';
|
|
9
9
|
|
|
10
10
|
// Single-quote for /bin/sh: wrap in '…' and escape embedded single quotes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { getDeviceStatus, formatDeviceStatus } from '../../lib/status.js';
|
|
3
3
|
import { getMonitoringData } from '../../lib/monitoring.js';
|
|
4
|
-
import { isJsonMode, printOk } from '
|
|
4
|
+
import { isJsonMode, printOk } from '@thinger-io/cli-core/output';
|
|
5
5
|
import { applyJsonFlag, ensureConfigured, runDeviceCommand } from './_shared.js';
|
|
6
6
|
|
|
7
7
|
export function registerStatusCommand(device) {
|
|
@@ -5,8 +5,8 @@ import { Transform } from 'node:stream';
|
|
|
5
5
|
import { basename } from 'path';
|
|
6
6
|
import cliProgress from 'cli-progress';
|
|
7
7
|
import { createDeviceAPI } from '../../lib/device-api.js';
|
|
8
|
-
import { isJsonMode, printOk, printErr, classifyError } from '
|
|
9
|
-
import { success, hint, formatBytes, formatETA } from '
|
|
8
|
+
import { isJsonMode, printOk, printErr, classifyError } from '@thinger-io/cli-core/output';
|
|
9
|
+
import { success, hint, formatBytes, formatETA } from '@thinger-io/cli-core/format';
|
|
10
10
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from './_shared.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { createDeviceAPI } from '../../lib/device-api.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
isJsonMode,
|
|
5
|
+
printOk,
|
|
6
|
+
printErr,
|
|
7
|
+
createSpinner,
|
|
8
|
+
classifyError,
|
|
9
|
+
} from '@thinger-io/cli-core/output';
|
|
10
|
+
import { label as labelText, accent } from '@thinger-io/cli-core/format';
|
|
5
11
|
import { TIMEOUTS } from '../../lib/constants.js';
|
|
6
12
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from './_shared.js';
|
|
7
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { confirm } from '@inquirer/prompts';
|
|
3
|
-
import { getDevices } from '
|
|
3
|
+
import { getDevices } from '@thinger-io/cli-core/devices';
|
|
4
4
|
import { getMonitoringData } from '../../lib/monitoring.js';
|
|
5
5
|
import { fetchLatestAgentVersion } from '../../lib/agent-releases.js';
|
|
6
6
|
import { runFleetUpgrade, summarize } from '../../lib/fleet-upgrade.js';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
printErr,
|
|
12
12
|
createSpinner,
|
|
13
13
|
classifyError,
|
|
14
|
-
} from '
|
|
14
|
+
} from '@thinger-io/cli-core/output';
|
|
15
15
|
import {
|
|
16
16
|
success,
|
|
17
17
|
error as errorStyle,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
label,
|
|
21
21
|
muted,
|
|
22
22
|
accent,
|
|
23
|
-
} from '
|
|
23
|
+
} from '@thinger-io/cli-core/format';
|
|
24
24
|
import {
|
|
25
25
|
applyJsonFlag,
|
|
26
26
|
ensureConfigured,
|
package/commands/playbook/run.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
printErr,
|
|
9
9
|
createSpinner,
|
|
10
10
|
classifyError,
|
|
11
|
-
} from '
|
|
12
|
-
import { success, error as errorStyle, warning, hint, label, muted } from '
|
|
11
|
+
} from '@thinger-io/cli-core/output';
|
|
12
|
+
import { success, error as errorStyle, warning, hint, label, muted } from '@thinger-io/cli-core/format';
|
|
13
13
|
import {
|
|
14
14
|
applyJsonFlag,
|
|
15
15
|
ensureConfigured,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { loadPlaybookFile } from '../../lib/playbook/loader.js';
|
|
3
|
-
import { isJsonMode, printOk, printErr, classifyError } from '
|
|
4
|
-
import { success, label, hint } from '
|
|
3
|
+
import { isJsonMode, printOk, printErr, classifyError } from '@thinger-io/cli-core/output';
|
|
4
|
+
import { success, label, hint } from '@thinger-io/cli-core/format';
|
|
5
5
|
import { applyJsonFlag } from './_shared.js';
|
|
6
6
|
|
|
7
7
|
export function registerValidateCommand(playbook) {
|
package/commands/product/exec.js
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
success,
|
|
11
11
|
error as errorStyle,
|
|
12
12
|
warning,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@thinger-io/cli-core/format';
|
|
14
14
|
import {
|
|
15
15
|
isJsonMode,
|
|
16
16
|
printOk,
|
|
17
17
|
printErr,
|
|
18
18
|
createSpinner,
|
|
19
19
|
classifyError,
|
|
20
|
-
} from '
|
|
20
|
+
} from '@thinger-io/cli-core/output';
|
|
21
21
|
import {
|
|
22
22
|
applyJsonFlag,
|
|
23
23
|
ensureConfigured,
|
package/commands/product/fs.js
CHANGED
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
success,
|
|
10
10
|
error as errorStyle,
|
|
11
11
|
warning,
|
|
12
|
-
} from '
|
|
12
|
+
} from '@thinger-io/cli-core/format';
|
|
13
13
|
import {
|
|
14
14
|
isJsonMode,
|
|
15
15
|
printOk,
|
|
16
16
|
printErr,
|
|
17
17
|
createSpinner,
|
|
18
18
|
classifyError,
|
|
19
|
-
} from '
|
|
19
|
+
} from '@thinger-io/cli-core/output';
|
|
20
20
|
import {
|
|
21
21
|
applyJsonFlag,
|
|
22
22
|
ensureConfigured,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { registerProductListCommand } from './list.js';
|
|
3
2
|
import { registerProductPropertyCommand } from './property.js';
|
|
4
|
-
import { registerProductPropertyAdminCommands } from './props.js';
|
|
5
3
|
import { registerProductMetricCommands } from './metric.js';
|
|
6
4
|
import { registerProductResourceCommand } from './resource.js';
|
|
7
5
|
import { registerProductExecCommand } from './exec.js';
|
|
@@ -13,18 +11,13 @@ import { registerProductLogsCommand } from './logs.js';
|
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* `thinr product <subcommand> <productId> …` — fan-out commands across
|
|
16
|
-
* every device that belongs to a product
|
|
14
|
+
* every device that belongs to a product, plus metrics, scripts and
|
|
15
|
+
* playbooks, added to the generic `product` group of @thinger-io/cli-core
|
|
16
|
+
* (list, info, create, delete, property-list/get/set/delete).
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
19
|
-
const product = program
|
|
20
|
-
.command('product')
|
|
21
|
-
.helpGroup('Operations:')
|
|
22
|
-
.description('Product commands (subcommand-first: thinr product <action> <productId>)');
|
|
23
|
-
|
|
24
|
-
registerProductListCommand(product);
|
|
18
|
+
export function registerProductCommands(product) {
|
|
25
19
|
registerProductStatusCommand(product);
|
|
26
20
|
registerProductPropertyCommand(product);
|
|
27
|
-
registerProductPropertyAdminCommands(product);
|
|
28
21
|
registerProductMetricCommands(product);
|
|
29
22
|
registerProductResourceCommand(product);
|
|
30
23
|
registerProductExecCommand(product);
|
package/commands/product/logs.js
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
removeLogSource,
|
|
8
8
|
setDefaultLogSource,
|
|
9
9
|
} from '../../lib/product/logs.js';
|
|
10
|
-
import { hint, info, label, muted, success } from '
|
|
11
|
-
import { classifyError, isJsonMode, printErr, printOk } from '
|
|
10
|
+
import { hint, info, label, muted, success } from '@thinger-io/cli-core/format';
|
|
11
|
+
import { classifyError, isJsonMode, printErr, printOk } from '@thinger-io/cli-core/output';
|
|
12
12
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from '../_shared.js';
|
|
13
13
|
|
|
14
14
|
function truncate(value, max = 60) {
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
upsertDashboardMetric,
|
|
5
5
|
removeDashboardMetric,
|
|
6
6
|
} from '../../lib/product.js';
|
|
7
|
-
import { info, success } from '
|
|
8
|
-
import { isJsonMode, printOk, printErr, classifyError } from '
|
|
7
|
+
import { info, success } from '@thinger-io/cli-core/format';
|
|
8
|
+
import { isJsonMode, printOk, printErr, classifyError } from '@thinger-io/cli-core/output';
|
|
9
9
|
import { applyJsonFlag, ensureConfigured, getGlobalUser } from '../_shared.js';
|
|
10
10
|
|
|
11
11
|
function stringifyMetricLine(m) {
|
|
@@ -15,9 +15,9 @@ import { parsePlaybook } from '../../lib/playbook/loader.js';
|
|
|
15
15
|
import { buildDryRunPlan, runPlaybook } from '../../lib/playbook/runner.js';
|
|
16
16
|
import { DEFAULT_FAILURE_THRESHOLD, runFleetPlaybook } from '../../lib/playbook/fleet.js';
|
|
17
17
|
import { coerceCliVarValue, listVariables, resolveVarScope } from '../../lib/playbook/vars.js';
|
|
18
|
-
import { filterActiveDevices, getDevices } from '
|
|
19
|
-
import { requireConfig } from '
|
|
20
|
-
import { inputError } from '
|
|
18
|
+
import { filterActiveDevices, getDevices } from '@thinger-io/cli-core/devices';
|
|
19
|
+
import { requireConfig } from '@thinger-io/cli-core/config';
|
|
20
|
+
import { inputError } from '@thinger-io/cli-core/errors';
|
|
21
21
|
import {
|
|
22
22
|
accent,
|
|
23
23
|
error as errorStyle,
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
muted,
|
|
28
28
|
success,
|
|
29
29
|
warning,
|
|
30
|
-
} from '
|
|
31
|
-
import { classifyError, createSpinner, isJsonMode, printErr, printOk } from '
|
|
30
|
+
} from '@thinger-io/cli-core/format';
|
|
31
|
+
import { classifyError, createSpinner, isJsonMode, printErr, printOk } from '@thinger-io/cli-core/output';
|
|
32
32
|
import {
|
|
33
33
|
applyJsonFlag,
|
|
34
34
|
collectKeyValue,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { formatDeviceProperty, getDeviceProperty } from '
|
|
3
|
-
import { filterActiveDevices } from '
|
|
4
|
-
import { error as errorStyle, info } from '
|
|
2
|
+
import { formatDeviceProperty, getDeviceProperty } from '@thinger-io/cli-core/property';
|
|
3
|
+
import { filterActiveDevices } from '@thinger-io/cli-core/devices';
|
|
4
|
+
import { error as errorStyle, info } from '@thinger-io/cli-core/format';
|
|
5
5
|
import {
|
|
6
6
|
isJsonMode,
|
|
7
7
|
printOk,
|
|
8
8
|
printErr,
|
|
9
9
|
createSpinner,
|
|
10
10
|
classifyError,
|
|
11
|
-
} from '
|
|
11
|
+
} from '@thinger-io/cli-core/output';
|
|
12
12
|
import {
|
|
13
13
|
applyJsonFlag,
|
|
14
14
|
ensureConfigured,
|
package/commands/product/push.js
CHANGED
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
success,
|
|
11
11
|
error as errorStyle,
|
|
12
12
|
warning,
|
|
13
|
-
} from '
|
|
13
|
+
} from '@thinger-io/cli-core/format';
|
|
14
14
|
import {
|
|
15
15
|
isJsonMode,
|
|
16
16
|
printOk,
|
|
17
17
|
printErr,
|
|
18
18
|
createSpinner,
|
|
19
19
|
classifyError,
|
|
20
|
-
} from '
|
|
20
|
+
} from '@thinger-io/cli-core/output';
|
|
21
21
|
import {
|
|
22
22
|
applyJsonFlag,
|
|
23
23
|
ensureConfigured,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { callDeviceResource } from '
|
|
3
|
-
import { filterActiveDevices } from '
|
|
4
|
-
import { error as errorStyle, info } from '
|
|
2
|
+
import { callDeviceResource } from '@thinger-io/cli-core/resource';
|
|
3
|
+
import { filterActiveDevices } from '@thinger-io/cli-core/devices';
|
|
4
|
+
import { error as errorStyle, info } from '@thinger-io/cli-core/format';
|
|
5
5
|
import {
|
|
6
6
|
isJsonMode,
|
|
7
7
|
printOk,
|
|
8
8
|
printErr,
|
|
9
9
|
createSpinner,
|
|
10
10
|
classifyError,
|
|
11
|
-
} from '
|
|
11
|
+
} from '@thinger-io/cli-core/output';
|
|
12
12
|
import {
|
|
13
13
|
applyJsonFlag,
|
|
14
14
|
collectInput,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import Table from 'cli-table3';
|
|
3
3
|
import { InvalidArgumentError } from 'commander';
|
|
4
|
-
import { runPool } from '
|
|
4
|
+
import { runPool } from '@thinger-io/cli-core/concurrency';
|
|
5
5
|
import { getMonitoringData } from '../../lib/monitoring.js';
|
|
6
6
|
import {
|
|
7
7
|
formatUptime,
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
hint,
|
|
12
12
|
success,
|
|
13
13
|
error as errorStyle,
|
|
14
|
-
} from '
|
|
14
|
+
} from '@thinger-io/cli-core/format';
|
|
15
15
|
import {
|
|
16
16
|
isJsonMode,
|
|
17
17
|
printOk,
|
|
18
18
|
printErr,
|
|
19
19
|
createSpinner,
|
|
20
20
|
classifyError,
|
|
21
|
-
} from '
|
|
21
|
+
} from '@thinger-io/cli-core/output';
|
|
22
22
|
import {
|
|
23
23
|
applyJsonFlag,
|
|
24
24
|
ensureConfigured,
|