@mininglamp-oss/octo-runtime 1.1.4 → 1.1.5
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 +61 -37
- package/apps/cli/README.md +58 -22
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/cli-entrypoint.d.ts +2 -0
- package/apps/cli/dist/cli-entrypoint.js +16 -0
- package/apps/cli/dist/command-tree.d.ts +20 -0
- package/apps/cli/dist/command-tree.js +402 -0
- package/apps/cli/dist/extra-command-config.d.ts +4 -0
- package/apps/cli/dist/extra-command-config.js +50 -0
- package/apps/cli/dist/extra-commands.d.ts +15 -0
- package/apps/cli/dist/extra-commands.js +275 -0
- package/apps/cli/dist/extras.js +14 -2
- package/apps/cli/dist/global-extras.d.ts +16 -0
- package/apps/cli/dist/global-extras.js +201 -0
- package/apps/cli/dist/help.d.ts +4 -1
- package/apps/cli/dist/help.js +31 -79
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +27 -63
- package/apps/cli/dist/manifest.json +48 -3
- package/apps/cli/dist/module-manifest.d.ts +1 -1
- package/apps/cli/dist/module-manifest.js +3 -2
- package/apps/cli/dist/output.js +13 -2
- package/apps/cli/dist/service-control.js +2 -2
- package/apps/cli/dist/state.js +48 -19
- package/dist/public/channel-gateway-commands.d.ts +1 -0
- package/dist/public/channel-gateway-commands.js +1 -0
- package/dist/public/channel-wecom-commands.d.ts +1 -0
- package/dist/public/channel-wecom-commands.js +1 -0
- package/dist/public/extra.d.ts +1 -0
- package/dist/public/extra.js +1 -0
- package/dist/public/host.d.ts +2 -4
- package/dist/public/host.js +1 -2
- package/dist/public/webui-commands.d.ts +1 -0
- package/dist/public/webui-commands.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +16 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +402 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +50 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +275 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +14 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +201 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +31 -79
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +27 -63
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +48 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +13 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/service-control.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -19
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +25 -24
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +124 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +44 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +8 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +10 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +128 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +51 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +7 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +70 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +1 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1172 -0
- package/node_modules/commander/index.js +21 -0
- package/node_modules/commander/lib/argument.js +147 -0
- package/node_modules/commander/lib/command.js +2790 -0
- package/node_modules/commander/lib/error.js +36 -0
- package/node_modules/commander/lib/help.js +731 -0
- package/node_modules/commander/lib/option.js +377 -0
- package/node_modules/commander/lib/suggestSimilar.js +99 -0
- package/node_modules/commander/package-support.json +19 -0
- package/node_modules/commander/package.json +64 -0
- package/node_modules/commander/typings/index.d.ts +1113 -0
- package/package.json +41 -27
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.d.ts +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.js +0 -22
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.d.ts +0 -16
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.js +0 -160
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Argument } from './lib/argument.js';
|
|
2
|
+
import { Command } from './lib/command.js';
|
|
3
|
+
import { CommanderError, InvalidArgumentError } from './lib/error.js';
|
|
4
|
+
import { Help } from './lib/help.js';
|
|
5
|
+
import { Option } from './lib/option.js';
|
|
6
|
+
|
|
7
|
+
export const program = new Command();
|
|
8
|
+
|
|
9
|
+
export const createCommand = (name) => new Command(name);
|
|
10
|
+
export const createOption = (flags, description) =>
|
|
11
|
+
new Option(flags, description);
|
|
12
|
+
export const createArgument = (name, description) =>
|
|
13
|
+
new Argument(name, description);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Expose classes
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export { Command, Option, Argument, Help };
|
|
20
|
+
export { CommanderError, InvalidArgumentError };
|
|
21
|
+
export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { InvalidArgumentError } from './error.js';
|
|
2
|
+
|
|
3
|
+
export class Argument {
|
|
4
|
+
/**
|
|
5
|
+
* Initialize a new command argument with the given name and description.
|
|
6
|
+
* The default is that the argument is required, and you can explicitly
|
|
7
|
+
* indicate this with <> around the name. Put [] around the name for an optional argument.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} name
|
|
10
|
+
* @param {string} [description]
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
constructor(name, description) {
|
|
14
|
+
this.description = description || '';
|
|
15
|
+
this.variadic = false;
|
|
16
|
+
this.parseArg = undefined;
|
|
17
|
+
this.defaultValue = undefined;
|
|
18
|
+
this.defaultValueDescription = undefined;
|
|
19
|
+
this.argChoices = undefined;
|
|
20
|
+
|
|
21
|
+
switch (name[0]) {
|
|
22
|
+
case '<': // e.g. <required>
|
|
23
|
+
this.required = true;
|
|
24
|
+
this._name = name.slice(1, -1);
|
|
25
|
+
break;
|
|
26
|
+
case '[': // e.g. [optional]
|
|
27
|
+
this.required = false;
|
|
28
|
+
this._name = name.slice(1, -1);
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
this.required = true;
|
|
32
|
+
this._name = name;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (this._name.endsWith('...')) {
|
|
37
|
+
this.variadic = true;
|
|
38
|
+
this._name = this._name.slice(0, -3);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Return argument name.
|
|
44
|
+
*
|
|
45
|
+
* @return {string}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
name() {
|
|
49
|
+
return this._name;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @package
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
_collectValue(value, previous) {
|
|
57
|
+
if (previous === this.defaultValue || !Array.isArray(previous)) {
|
|
58
|
+
return [value];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
previous.push(value);
|
|
62
|
+
return previous;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
67
|
+
*
|
|
68
|
+
* @param {*} value
|
|
69
|
+
* @param {string} [description]
|
|
70
|
+
* @return {Argument}
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
default(value, description) {
|
|
74
|
+
this.defaultValue = value;
|
|
75
|
+
this.defaultValueDescription = description;
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Set the custom handler for processing CLI command arguments into argument values.
|
|
81
|
+
*
|
|
82
|
+
* @param {Function} [fn]
|
|
83
|
+
* @return {Argument}
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
argParser(fn) {
|
|
87
|
+
this.parseArg = fn;
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Only allow argument value to be one of choices.
|
|
93
|
+
*
|
|
94
|
+
* @param {string[]} values
|
|
95
|
+
* @return {Argument}
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
choices(values) {
|
|
99
|
+
this.argChoices = values.slice();
|
|
100
|
+
this.parseArg = (arg, previous) => {
|
|
101
|
+
if (!this.argChoices.includes(arg)) {
|
|
102
|
+
throw new InvalidArgumentError(
|
|
103
|
+
`Allowed choices are ${this.argChoices.join(', ')}.`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
if (this.variadic) {
|
|
107
|
+
return this._collectValue(arg, previous);
|
|
108
|
+
}
|
|
109
|
+
return arg;
|
|
110
|
+
};
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Make argument required.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Argument}
|
|
118
|
+
*/
|
|
119
|
+
argRequired() {
|
|
120
|
+
this.required = true;
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Make argument optional.
|
|
126
|
+
*
|
|
127
|
+
* @returns {Argument}
|
|
128
|
+
*/
|
|
129
|
+
argOptional() {
|
|
130
|
+
this.required = false;
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Takes an argument and returns its human readable equivalent for help usage.
|
|
137
|
+
*
|
|
138
|
+
* @param {Argument} arg
|
|
139
|
+
* @return {string}
|
|
140
|
+
* @private
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
export function humanReadableArgName(arg) {
|
|
144
|
+
const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');
|
|
145
|
+
|
|
146
|
+
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
|
|
147
|
+
}
|