@dxos/cli 0.5.3-main.6621d8f → 0.5.3-main.6f2dfea
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/src/commands/function/dev.d.ts.map +1 -1
- package/dist/src/commands/function/dev.js +10 -18
- package/dist/src/commands/function/dev.js.map +1 -1
- package/dist/src/commands/function/exec.d.ts +13 -0
- package/dist/src/commands/function/exec.d.ts.map +1 -0
- package/dist/src/commands/function/exec.js +48 -0
- package/dist/src/commands/function/exec.js.map +1 -0
- package/dist/src/commands/function/list.d.ts.map +1 -1
- package/dist/src/commands/function/list.js +6 -8
- package/dist/src/commands/function/list.js.map +1 -1
- package/oclif.manifest.json +125 -2
- package/package.json +23 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW,CAAC,OAAO,GAAG,CAAC;IACtD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAmC;IAC9D,OAAgB,OAAO,WAA2B;IAClD,OAAgB,QAAQ;;;QAKtB;IAEF,OAAgB,KAAK;;;;;;;;;;;;;;;;;MAMnB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAsD1B"}
|
|
@@ -11,7 +11,6 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
11
11
|
const js_yaml_1 = require("js-yaml");
|
|
12
12
|
const promises_1 = require("node:fs/promises");
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
|
-
const async_1 = require("@dxos/async");
|
|
15
14
|
const client_protocol_1 = require("@dxos/client-protocol");
|
|
16
15
|
const config_1 = require("@dxos/config");
|
|
17
16
|
const functions_1 = require("@dxos/functions");
|
|
@@ -28,44 +27,37 @@ class Dev extends base_command_1.BaseCommand {
|
|
|
28
27
|
// TODO(dmaretskyi): Move into system service?
|
|
29
28
|
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
30
29
|
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
31
|
-
// Local files.
|
|
32
30
|
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
33
31
|
const manifest = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
34
32
|
const directory = (_g = this.flags.baseDir) !== null && _g !== void 0 ? _g : (0, node_path_1.join)((0, node_path_1.dirname)(file), 'src/functions');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const server = new functions_1.DevServer(client, registry, {
|
|
33
|
+
const server = new functions_1.DevServer(client, {
|
|
34
|
+
manifest,
|
|
38
35
|
baseDir: directory,
|
|
39
36
|
reload: this.flags.reload,
|
|
40
37
|
dataDir: (0, client_protocol_1.getProfilePath)(client_protocol_1.DX_DATA, this.flags.profile),
|
|
41
38
|
});
|
|
39
|
+
await server.initialize();
|
|
42
40
|
await server.start();
|
|
43
|
-
// TODO(burdon): Move to
|
|
44
|
-
const
|
|
45
|
-
const scheduler = new functions_1.Scheduler(registry, triggerRegistry, { endpoint: server.proxy });
|
|
41
|
+
// TODO(burdon): Move to plugin (make independent of runtime).
|
|
42
|
+
const scheduler = new functions_1.Scheduler(client, manifest, { endpoint: server.proxy });
|
|
46
43
|
await scheduler.start();
|
|
47
|
-
// TODO(burdon): Register for all spaces; add import command.
|
|
48
|
-
client.addSchema(functions_1.FunctionTrigger);
|
|
49
|
-
const space = client.spaces.default;
|
|
50
|
-
await registry.register(space, manifest);
|
|
51
|
-
await scheduler.register(space, manifest);
|
|
52
44
|
this.log(`DevServer running: ${chalk_1.default.blue(server.endpoint)} (ctrl-c to exit)`);
|
|
53
|
-
const run = new async_1.Trigger();
|
|
54
45
|
process.on('SIGINT', async () => {
|
|
55
46
|
await scheduler.stop();
|
|
56
47
|
await server.stop();
|
|
57
|
-
|
|
48
|
+
process.exit();
|
|
58
49
|
});
|
|
50
|
+
// TODO(burdon): Command to print table.
|
|
51
|
+
// TODO(burdon): Get from server API.
|
|
59
52
|
if (this.flags.verbose) {
|
|
60
|
-
// TODO(burdon): Get list of functions from plugin API endpoint.
|
|
61
53
|
this.log(`Plugin proxy: ${chalk_1.default.blue(server.proxy)}`);
|
|
62
54
|
this.log('Functions:\n' +
|
|
63
55
|
server.functions
|
|
64
|
-
.map(({ def: {
|
|
56
|
+
.map(({ def: { id, path } }) => (0, chalk_1.default) `- ${id.padEnd(40)} {blue ${(0, node_path_1.join)(server.proxy, path)}}`)
|
|
65
57
|
.join('\n'));
|
|
66
58
|
}
|
|
67
59
|
// Wait until exit (via SIGINT).
|
|
68
|
-
await
|
|
60
|
+
await new Promise(() => { });
|
|
69
61
|
});
|
|
70
62
|
}
|
|
71
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;AAEF,sCAAoC;AACpC,kDAA0B;AAC1B,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../../src/commands/function/dev.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC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AA,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,IAAA,gBAAI,EAAC,MAAM,CAAC,KAAM,EAAE,IAAI,CAAC,GAAG,CAAC;yBAC7F,IAAI,CAAC,IAAI,CAAC,CAChB,CAAC;aACH;YAED,gCAAgC;YAChC,MAAM,IAAI,OAAO,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;;AAvEe,kBAAc,GAAG,IAAI,CAAC;AACtB,eAAW,GAAG,+BAA+B,CAAC;AAC9C,WAAO,GAAG,CAAC,qBAAqB,CAAC,CAAC;AAClC,YAAQ,GAAG;IACzB;QACE,WAAW,EAAE,8BAA8B;QAC3C,OAAO,EAAE,+CAA+C;KACzD;CACF,CAAC;AAEc,SAAK,GAAG;IACtB,GAAG,0BAAW,CAAC,KAAK;IACpB,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACxF,QAAQ,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAC;IACnE,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAC/E,MAAM,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;CACtE,CAAC;kBAjBiB,GAAG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
*/
|
|
5
|
+
export default class Exec extends BaseCommand<typeof Exec> {
|
|
6
|
+
static enableJsonFlag: boolean;
|
|
7
|
+
static description: string;
|
|
8
|
+
static args: {
|
|
9
|
+
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<any>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/exec.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAsB;IAEjD,OAAgB,IAAI;;MAElB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CA8B1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//
|
|
3
|
+
// Copyright 2023 DXOS.org
|
|
4
|
+
//
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
7
|
+
const js_yaml_1 = require("js-yaml");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const config_1 = require("@dxos/config");
|
|
11
|
+
const base_command_1 = require("../../base-command");
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
class Exec extends base_command_1.BaseCommand {
|
|
16
|
+
async run() {
|
|
17
|
+
return await this.execWithClient(async (client) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
// TODO(dmaretskyi): Move into system service?
|
|
20
|
+
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
21
|
+
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
22
|
+
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
23
|
+
const { functions } = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
24
|
+
const fn = functions.find((fn) => fn.id === this.args.name);
|
|
25
|
+
if (!fn) {
|
|
26
|
+
this.warn(`Function not found: ${this.args.name}`);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const { handler } = fn;
|
|
30
|
+
// TODO(burdon): Get endpoint.
|
|
31
|
+
const url = `http:/localhost:7100/dev/${handler}`;
|
|
32
|
+
this.log(`Calling: ${url}`);
|
|
33
|
+
const { status, statusText } = await fetch(url, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
});
|
|
36
|
+
if (status !== 200) {
|
|
37
|
+
this.warn(`Error(${status}): ${statusText}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
Exec.enableJsonFlag = true;
|
|
43
|
+
Exec.description = 'Invoke function.';
|
|
44
|
+
Exec.args = {
|
|
45
|
+
name: core_1.Args.string({ required: true, description: 'Function name.' }),
|
|
46
|
+
};
|
|
47
|
+
exports.default = Exec;
|
|
48
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../../src/commands/function/exec.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;AAEF,sCAAmC;AACnC,qCAA+B;AAC/B,+CAA4C;AAC5C,yCAAiC;AAEjC,yCAAsC;AAGtC,qDAAiD;AAEjD;;GAEG;AACH,MAAqB,IAAK,SAAQ,0BAAwB;IAQxD,KA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GAAG,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;YAC5B,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAC9C,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;YAEH,IAAI,MAAM,KAAK,GAAG,EAAE;gBAClB,IAAI,CAAC,IAAI,CAAC,SAAS,MAAM,MAAM,UAAU,EAAE,CAAC,CAAC;aAC9C;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AApCe,mBAAc,GAAG,IAAI,CAAC;AACtB,gBAAW,GAAG,kBAAkB,CAAC;AAEjC,SAAI,GAAG;IACrB,IAAI,EAAE,WAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;CACrE,CAAC;kBANiB,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD,eAAO,MAAM,cAAc,cAAe,WAAW,EAAE,qBAqBtD,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,WAAW,CAAC,OAAO,IAAI,CAAC;IACxD,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAqB;IAE1C,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;CAe1B"}
|
|
@@ -11,12 +11,11 @@ const node_path_1 = require("node:path");
|
|
|
11
11
|
const config_1 = require("@dxos/config");
|
|
12
12
|
const base_command_1 = require("../../base-command");
|
|
13
13
|
// TODO(burdon): List stats.
|
|
14
|
+
// TODO(burdon): List triggers.
|
|
14
15
|
const printFunctions = (functions, flags = {}) => {
|
|
15
|
-
core_1.ux.table(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
uri: {
|
|
19
|
-
header: 'uri',
|
|
16
|
+
core_1.ux.table(functions, {
|
|
17
|
+
id: {
|
|
18
|
+
header: 'id',
|
|
20
19
|
},
|
|
21
20
|
path: {
|
|
22
21
|
header: 'path',
|
|
@@ -39,11 +38,10 @@ class List extends base_command_1.BaseCommand {
|
|
|
39
38
|
// TODO(dmaretskyi): Move into system service?
|
|
40
39
|
const config = new config_1.Config(JSON.parse((await client.services.services.DevtoolsHost.getConfig()).config));
|
|
41
40
|
const functionsConfig = (_c = (_b = (_a = config.values.runtime) === null || _a === void 0 ? void 0 : _a.agent) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.find((plugin) => plugin.id === 'dxos.org/agent/plugin/functions');
|
|
42
|
-
// TODO(burdon): ???
|
|
43
41
|
const file = (_f = (_d = this.flags.manifest) !== null && _d !== void 0 ? _d : (_e = functionsConfig === null || functionsConfig === void 0 ? void 0 : functionsConfig.config) === null || _e === void 0 ? void 0 : _e.manifest) !== null && _f !== void 0 ? _f : (0, node_path_1.join)(process.cwd(), 'functions.yml');
|
|
44
42
|
const manifest = (0, js_yaml_1.load)(await (0, promises_1.readFile)(file, 'utf8'));
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const { functions } = manifest;
|
|
44
|
+
(0, exports.printFunctions)(functions);
|
|
47
45
|
return manifest;
|
|
48
46
|
});
|
|
49
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/function/list.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;A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AC;YAEF,MAAM,IAAI,GAAG,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,mCAAI,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,0CAAE,QAAQ,mCAAI,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;YAC9G,MAAM,QAAQ,GAAG,IAAA,cAAI,EAAC,MAAM,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,CAAqB,CAAC;YACxE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;YAC/B,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC;YAC1B,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;;AAjBe,mBAAc,GAAG,IAAI,CAAC;AACtB,gBAAW,GAAG,iBAAiB,CAAC;kBAF7B,IAAI"}
|
package/oclif.manifest.json
CHANGED
|
@@ -2794,6 +2794,129 @@
|
|
|
2794
2794
|
"dev.js"
|
|
2795
2795
|
]
|
|
2796
2796
|
},
|
|
2797
|
+
"function:exec": {
|
|
2798
|
+
"aliases": [],
|
|
2799
|
+
"args": {
|
|
2800
|
+
"name": {
|
|
2801
|
+
"description": "Function name.",
|
|
2802
|
+
"name": "name",
|
|
2803
|
+
"required": true
|
|
2804
|
+
}
|
|
2805
|
+
},
|
|
2806
|
+
"description": "Invoke function.",
|
|
2807
|
+
"flags": {
|
|
2808
|
+
"json": {
|
|
2809
|
+
"description": "Output as JSON.",
|
|
2810
|
+
"name": "json",
|
|
2811
|
+
"allowNo": false,
|
|
2812
|
+
"type": "boolean"
|
|
2813
|
+
},
|
|
2814
|
+
"dry-run": {
|
|
2815
|
+
"description": "Dry run.",
|
|
2816
|
+
"name": "dry-run",
|
|
2817
|
+
"allowNo": false,
|
|
2818
|
+
"type": "boolean"
|
|
2819
|
+
},
|
|
2820
|
+
"verbose": {
|
|
2821
|
+
"char": "v",
|
|
2822
|
+
"description": "Verbose output",
|
|
2823
|
+
"name": "verbose",
|
|
2824
|
+
"allowNo": false,
|
|
2825
|
+
"type": "boolean"
|
|
2826
|
+
},
|
|
2827
|
+
"profile": {
|
|
2828
|
+
"description": "User profile.",
|
|
2829
|
+
"env": "DX_PROFILE",
|
|
2830
|
+
"name": "profile",
|
|
2831
|
+
"default": "default",
|
|
2832
|
+
"hasDynamicHelp": false,
|
|
2833
|
+
"multiple": false,
|
|
2834
|
+
"type": "option"
|
|
2835
|
+
},
|
|
2836
|
+
"config": {
|
|
2837
|
+
"aliases": [
|
|
2838
|
+
"c"
|
|
2839
|
+
],
|
|
2840
|
+
"dependsOn": [
|
|
2841
|
+
"profile"
|
|
2842
|
+
],
|
|
2843
|
+
"description": "Config file.",
|
|
2844
|
+
"env": "DX_CONFIG",
|
|
2845
|
+
"name": "config",
|
|
2846
|
+
"default": "/home/runner/.config/dx/profile/default.yml",
|
|
2847
|
+
"hasDynamicHelp": false,
|
|
2848
|
+
"helpValue": "path",
|
|
2849
|
+
"multiple": false,
|
|
2850
|
+
"type": "option"
|
|
2851
|
+
},
|
|
2852
|
+
"target": {
|
|
2853
|
+
"description": "Target websocket server.",
|
|
2854
|
+
"name": "target",
|
|
2855
|
+
"hasDynamicHelp": false,
|
|
2856
|
+
"multiple": false,
|
|
2857
|
+
"type": "option"
|
|
2858
|
+
},
|
|
2859
|
+
"no-agent": {
|
|
2860
|
+
"description": "Run command without using an agent.",
|
|
2861
|
+
"name": "no-agent",
|
|
2862
|
+
"allowNo": false,
|
|
2863
|
+
"type": "boolean"
|
|
2864
|
+
},
|
|
2865
|
+
"no-start-agent": {
|
|
2866
|
+
"description": "Do not automatically start an agent if one is not running.",
|
|
2867
|
+
"name": "no-start-agent",
|
|
2868
|
+
"allowNo": false,
|
|
2869
|
+
"type": "boolean"
|
|
2870
|
+
},
|
|
2871
|
+
"timeout": {
|
|
2872
|
+
"aliases": [
|
|
2873
|
+
"t"
|
|
2874
|
+
],
|
|
2875
|
+
"description": "Timeout (ms).",
|
|
2876
|
+
"name": "timeout",
|
|
2877
|
+
"default": 60000,
|
|
2878
|
+
"hasDynamicHelp": false,
|
|
2879
|
+
"multiple": false,
|
|
2880
|
+
"type": "option"
|
|
2881
|
+
},
|
|
2882
|
+
"no-wait": {
|
|
2883
|
+
"description": "Do not wait for space to be ready.",
|
|
2884
|
+
"name": "no-wait",
|
|
2885
|
+
"allowNo": false,
|
|
2886
|
+
"type": "boolean"
|
|
2887
|
+
},
|
|
2888
|
+
"json-log": {
|
|
2889
|
+
"description": "When running in foreground, log JSON format",
|
|
2890
|
+
"name": "json-log",
|
|
2891
|
+
"allowNo": false,
|
|
2892
|
+
"type": "boolean"
|
|
2893
|
+
},
|
|
2894
|
+
"json-logfile": {
|
|
2895
|
+
"description": "JSON log file destination, or 'stdout' or 'stderr'",
|
|
2896
|
+
"name": "json-logfile",
|
|
2897
|
+
"default": "stderr",
|
|
2898
|
+
"hasDynamicHelp": false,
|
|
2899
|
+
"multiple": false,
|
|
2900
|
+
"type": "option"
|
|
2901
|
+
}
|
|
2902
|
+
},
|
|
2903
|
+
"hasDynamicHelp": false,
|
|
2904
|
+
"hiddenAliases": [],
|
|
2905
|
+
"id": "function:exec",
|
|
2906
|
+
"pluginAlias": "@dxos/cli",
|
|
2907
|
+
"pluginName": "@dxos/cli",
|
|
2908
|
+
"pluginType": "core",
|
|
2909
|
+
"strict": true,
|
|
2910
|
+
"enableJsonFlag": true,
|
|
2911
|
+
"isESM": false,
|
|
2912
|
+
"relativePath": [
|
|
2913
|
+
"dist",
|
|
2914
|
+
"src",
|
|
2915
|
+
"commands",
|
|
2916
|
+
"function",
|
|
2917
|
+
"exec.js"
|
|
2918
|
+
]
|
|
2919
|
+
},
|
|
2797
2920
|
"function:list": {
|
|
2798
2921
|
"aliases": [],
|
|
2799
2922
|
"args": {},
|
|
@@ -5595,7 +5718,7 @@
|
|
|
5595
5718
|
"name": {
|
|
5596
5719
|
"description": "Tunnel name",
|
|
5597
5720
|
"name": "name",
|
|
5598
|
-
"default": "
|
|
5721
|
+
"default": "winter-saturn-may-coffee",
|
|
5599
5722
|
"hasDynamicHelp": false,
|
|
5600
5723
|
"multiple": false,
|
|
5601
5724
|
"type": "option"
|
|
@@ -6067,5 +6190,5 @@
|
|
|
6067
6190
|
]
|
|
6068
6191
|
}
|
|
6069
6192
|
},
|
|
6070
|
-
"version": "0.5.3-main.
|
|
6193
|
+
"version": "0.5.3-main.6f2dfea"
|
|
6071
6194
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/cli",
|
|
3
|
-
"version": "0.5.3-main.
|
|
3
|
+
"version": "0.5.3-main.6f2dfea",
|
|
4
4
|
"description": "DXOS CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dxos",
|
|
@@ -49,28 +49,28 @@
|
|
|
49
49
|
"uuid": "^8.3.2",
|
|
50
50
|
"ws": "^8.14.2",
|
|
51
51
|
"wtfnode": "^0.9.1",
|
|
52
|
-
"@dxos/agent": "0.5.3-main.
|
|
53
|
-
"@dxos/async": "0.5.3-main.
|
|
54
|
-
"@dxos/bare-template": "0.5.3-main.
|
|
55
|
-
"@dxos/client
|
|
56
|
-
"@dxos/client": "0.5.3-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/debug": "0.5.3-main.
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/log": "0.5.3-main.
|
|
65
|
-
"@dxos/network-manager": "0.5.3-main.
|
|
66
|
-
"@dxos/observability": "0.5.3-main.
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/random": "0.5.3-main.
|
|
70
|
-
"@dxos/protocols": "0.5.3-main.
|
|
71
|
-
"@dxos/rpc": "0.5.3-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
52
|
+
"@dxos/agent": "0.5.3-main.6f2dfea",
|
|
53
|
+
"@dxos/async": "0.5.3-main.6f2dfea",
|
|
54
|
+
"@dxos/bare-template": "0.5.3-main.6f2dfea",
|
|
55
|
+
"@dxos/client": "0.5.3-main.6f2dfea",
|
|
56
|
+
"@dxos/client-protocol": "0.5.3-main.6f2dfea",
|
|
57
|
+
"@dxos/client-services": "0.5.3-main.6f2dfea",
|
|
58
|
+
"@dxos/context": "0.5.3-main.6f2dfea",
|
|
59
|
+
"@dxos/config": "0.5.3-main.6f2dfea",
|
|
60
|
+
"@dxos/debug": "0.5.3-main.6f2dfea",
|
|
61
|
+
"@dxos/hello-template": "0.5.3-main.6f2dfea",
|
|
62
|
+
"@dxos/invariant": "0.5.3-main.6f2dfea",
|
|
63
|
+
"@dxos/functions": "0.5.3-main.6f2dfea",
|
|
64
|
+
"@dxos/log": "0.5.3-main.6f2dfea",
|
|
65
|
+
"@dxos/network-manager": "0.5.3-main.6f2dfea",
|
|
66
|
+
"@dxos/observability": "0.5.3-main.6f2dfea",
|
|
67
|
+
"@dxos/process": "0.5.3-main.6f2dfea",
|
|
68
|
+
"@dxos/plate": "0.5.3-main.6f2dfea",
|
|
69
|
+
"@dxos/random": "0.5.3-main.6f2dfea",
|
|
70
|
+
"@dxos/protocols": "0.5.3-main.6f2dfea",
|
|
71
|
+
"@dxos/rpc": "0.5.3-main.6f2dfea",
|
|
72
|
+
"@dxos/util": "0.5.3-main.6f2dfea",
|
|
73
|
+
"@dxos/tasks-template": "0.5.3-main.6f2dfea"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@oclif/test": "^3.2.15",
|
|
@@ -109,9 +109,6 @@
|
|
|
109
109
|
"plugins": [
|
|
110
110
|
"@oclif/plugin-help"
|
|
111
111
|
],
|
|
112
|
-
"devPlugins": [
|
|
113
|
-
"@oclif/plugin-help"
|
|
114
|
-
],
|
|
115
112
|
"helpClass": "./dist/src/help",
|
|
116
113
|
"topicSeparator": " ",
|
|
117
114
|
"topics": {
|