koishi-plugin-spawn-modified 1.1.2

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/LICENSE ADDED
@@ -0,0 +1,212 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License.
67
+
68
+ Subject to the terms and conditions of this License, each Contributor
69
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
70
+ royalty-free, irrevocable copyright license to reproduce, prepare
71
+ Derivative Works of, publicly display, publicly perform, sublicense,
72
+ and distribute the Work and such Derivative Works in Source or Object
73
+ form.
74
+
75
+ 3. Grant of Patent License.
76
+
77
+ Subject to the terms and conditions of this License, each Contributor
78
+ hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
79
+ royalty-free, irrevocable (except as stated in this section) patent
80
+ license to make, have made, use, offer to sell, sell, import, and
81
+ otherwise transfer the Work, where such license applies only to those
82
+ patent claims licensable by such Contributor that are necessarily
83
+ infringed by their Contribution(s) alone or by combination of their
84
+ Contribution(s) with the Work to which such Contribution(s) was
85
+ submitted. If You institute patent litigation against any entity
86
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
87
+ the Work or a Contribution incorporated within the Work constitutes
88
+ direct or contributory patent infringement, then any patent licenses
89
+ granted to You under this License for that Work shall terminate
90
+ as of the date such litigation is filed.
91
+
92
+ 4. Redistribution.
93
+
94
+ You may reproduce and distribute copies of the Work or Derivative
95
+ Works thereof in any medium, with or without modifications, and in
96
+ Source or Object form, provided that You meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions.
135
+
136
+ Unless You explicitly state otherwise, any Contribution intentionally
137
+ submitted for inclusion in the Work by You to the Licensor shall be
138
+ under the terms and conditions of this License, without any additional
139
+ terms or conditions. Notwithstanding the above, nothing herein shall
140
+ supersede or modify the terms of any separate license agreement you
141
+ may have executed with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks.
144
+
145
+ This License does not grant permission to use the trade names,
146
+ trademarks, service marks, or product names of the Licensor, except as
147
+ required for reasonable and customary use in describing the origin of
148
+ the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty.
151
+
152
+ Unless required by applicable law or agreed to in writing, Licensor
153
+ provides the Work (and each Contributor provides its Contributions)
154
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
155
+ KIND, either express or implied, including, without limitation, any
156
+ warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY,
157
+ or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
158
+ determining the appropriateness of using or redistributing the Work
159
+ and assume any risks associated with Your exercise of permissions
160
+ under this License.
161
+
162
+ 8. Limitation of Liability.
163
+
164
+ In no event and under no legal theory, whether in tort (including
165
+ negligence), contract, or otherwise, unless required by applicable
166
+ law (such as deliberate and grossly negligent acts) or agreed to in
167
+ writing, shall any Contributor be liable to You for damages, including
168
+ any direct, indirect, special, incidental, or consequential damages of
169
+ any character arising as a result of this License or out of the use or
170
+ inability to use the Work (including but not limited to damages for
171
+ loss of goodwill, work stoppage, computer failure or malfunction, or
172
+ any and all other commercial damages or losses), even if such
173
+ Contributor has been advised of the possibility of such damages.
174
+
175
+ 9. Accepting Warranty or Additional Liability.
176
+
177
+ While redistributing the Work or Derivative Works thereof, You may choose
178
+ to offer, and charge a fee for, acceptance of support, warranty, indemnity,
179
+ or other liability obligations and/or rights consistent with this License.
180
+ However, in accepting such obligations, You may act only on Your own behalf
181
+ and on Your sole responsibility, not on behalf of any other Contributor,
182
+ and only if You agree to indemnify, defend, and hold each Contributor
183
+ harmless for any liability incurred by, or claims asserted against, such
184
+ Contributor by reason of your accepting any such warranty or additional
185
+ liability.
186
+
187
+ END OF TERMS AND CONDITIONS
188
+
189
+ APPENDIX: How to apply the Apache License to your work.
190
+
191
+ To apply the Apache License to your work, attach the following
192
+ boilerplate notice, with the fields enclosed by brackets "[]"
193
+ replaced with your own identifying information. (Don't include
194
+ the brackets!) The text should be enclosed in the appropriate
195
+ comment syntax for the file format. We also recommend that a
196
+ file or class name and description of purpose be included on the
197
+ same "printed page" as the copyright notice for easier
198
+ identification within third-party archives.
199
+
200
+ Copyright [yyyy] [name of copyright owner]
201
+
202
+ Licensed under the Apache License, Version 2.0 (the "License");
203
+ you may not use this file except in compliance with the License.
204
+ You may obtain a copy of the License at
205
+
206
+ http://www.apache.org/licenses/LICENSE-2.0
207
+
208
+ Unless required by applicable law or agreed to in writing, software
209
+ distributed under the License is distributed on an "AS IS" BASIS,
210
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
211
+ See the License for the specific language governing permissions and
212
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # [koishi-plugin-spawn](https://common.koishi.chat/plugins/spawn.html)
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-spawn?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-spawn)
4
+
5
+ Run shell commands with Koishi. | 使用 Koishi 运行终端命令。
6
+
7
+ ## 文档
8
+
9
+ <https://common.koishi.chat/plugins/spawn.html>
Binary file
package/lib/index.d.ts ADDED
@@ -0,0 +1,33 @@
1
+ import { Context, Schema } from 'koishi';
2
+ declare module 'koishi' {
3
+ interface Context {
4
+ puppeteer?: {
5
+ page(): Promise<any>;
6
+ };
7
+ }
8
+ }
9
+ declare const encodings: readonly ["utf8", "utf16le", "latin1", "ucs2"];
10
+ export interface Config {
11
+ root?: string;
12
+ shell?: string;
13
+ encoding?: typeof encodings[number];
14
+ timeout?: number;
15
+ renderImage?: boolean;
16
+ blockedCommands?: string[];
17
+ restrictDirectory?: boolean;
18
+ }
19
+ export declare const Config: Schema<Config>;
20
+ export interface State {
21
+ command: string;
22
+ timeout: number;
23
+ output: string;
24
+ code?: number;
25
+ signal?: NodeJS.Signals;
26
+ timeUsed?: number;
27
+ }
28
+ export declare const name = "spawn";
29
+ export declare const inject: {
30
+ optional: string[];
31
+ };
32
+ export declare function apply(ctx: Context, config: Config): void;
33
+ export {};
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "koishi-plugin-spawn-modified",
3
+ "version": "1.1.2",
4
+ "description": "Run shell commands with Koishi",
5
+ "keywords": [
6
+ "bot",
7
+ "chatbot",
8
+ "koishi",
9
+ "plugin",
10
+ "spawn",
11
+ "exec",
12
+ "process",
13
+ "shell",
14
+ "command",
15
+ "terminal",
16
+ "common"
17
+ ],
18
+ "homepage": "https://github.com/MuxYang/koishi-plugin-spawn-modified#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/MuxYang/koishi-plugin-spawn-modified/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/MuxYang/koishi-plugin-spawn-modified.git"
25
+ },
26
+ "license": "Apache-2.0",
27
+ "author": "MuxYang <tlnkmc.b@gmail.com>",
28
+ "contributors": [
29
+ {
30
+ "name": "Shigma",
31
+ "email": "shigma10826@gmail.com"
32
+ },
33
+ {
34
+ "name": "Dragon-Fish",
35
+ "email": "dragon-fish@qq.com"
36
+ },
37
+ {
38
+ "name": "MuxYang",
39
+ "email": "tlnkmc.b@gmail.com"
40
+ }
41
+ ],
42
+ "type": "commonjs",
43
+ "main": "lib/index.js",
44
+ "directories": {
45
+ "lib": "lib",
46
+ "test": "tests"
47
+ },
48
+ "files": [
49
+ "lib",
50
+ "src",
51
+ "fonts"
52
+ ],
53
+ "scripts": {
54
+ "build": "tsc -b",
55
+ "clean": "rimraf lib"
56
+ },
57
+ "devDependencies": {
58
+ "@koishijs/plugin-help": "^2.4.3",
59
+ "@koishijs/plugin-mock": "^2.6.5",
60
+ "koishi": "^4.17.2",
61
+ "typescript": "^5.9.3"
62
+ },
63
+ "peerDependencies": {
64
+ "koishi": "^4.17.2"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "koishi-plugin-puppeteer": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "typings": "lib/index.d.ts",
72
+ "koishi": {
73
+ "description": {
74
+ "en": "Run shell commands with Koishi",
75
+ "zh": "使用 Koishi 运行终端命令"
76
+ }
77
+ }
78
+ }
package/src/index.ts ADDED
@@ -0,0 +1,291 @@
1
+ import { exec } from 'child_process'
2
+ import { Context, h, Schema, Time } from 'koishi'
3
+ import path from 'path'
4
+ import { pathToFileURL } from 'url'
5
+
6
+ declare module 'koishi' {
7
+ interface Context {
8
+ puppeteer?: {
9
+ page(): Promise<any>
10
+ }
11
+ }
12
+ }
13
+
14
+ const encodings = ['utf8', 'utf16le', 'latin1', 'ucs2'] as const
15
+
16
+ export interface Config {
17
+ root?: string
18
+ shell?: string
19
+ encoding?: typeof encodings[number]
20
+ timeout?: number
21
+ renderImage?: boolean
22
+ blockedCommands?: string[]
23
+ restrictDirectory?: boolean
24
+ }
25
+
26
+ export const Config: Schema<Config> = Schema.object({
27
+ root: Schema.string().description('工作路径。').default(''),
28
+ shell: Schema.string().description('运行命令的程序。'),
29
+ encoding: Schema.union(encodings).description('输出内容编码。').default('utf8'),
30
+ timeout: Schema.number().description('最长运行时间。').default(Time.minute),
31
+ renderImage: Schema.boolean().description('是否将命令执行结果渲染为图片(需要安装 puppeteer 插件)。').default(false),
32
+ blockedCommands: Schema.array(String).description('违禁命令列表(命令的开头部分)。').default([]),
33
+ restrictDirectory: Schema.boolean().description('是否限制在当前目录及子目录内执行命令(禁止 cd 到上级或其他目录)。').default(false),
34
+ })
35
+
36
+ export interface State {
37
+ command: string
38
+ timeout: number
39
+ output: string
40
+ code?: number
41
+ signal?: NodeJS.Signals
42
+ timeUsed?: number
43
+ }
44
+
45
+ export const name = 'spawn'
46
+
47
+ export const inject = {
48
+ optional: ['puppeteer'],
49
+ }
50
+
51
+ // 当前工作目录状态管理
52
+ const sessionDirs = new Map<string, string>()
53
+
54
+ // 验证命令是否被禁止
55
+ function isCommandBlocked(command: string, blockedCommands: string[]): boolean {
56
+ const trimmedCommand = command.trim().toLowerCase()
57
+ return blockedCommands.some(blocked => trimmedCommand.startsWith(blocked.toLowerCase()))
58
+ }
59
+
60
+ // 解析 cd 命令并验证路径
61
+ function validateCdCommand(command: string, currentDir: string, rootDir: string, restrictDirectory: boolean): { valid: boolean; newDir?: string; error?: string } {
62
+ const cdMatch = command.trim().match(/^cd\s+(.+)$/i)
63
+ if (!cdMatch) return { valid: true }
64
+
65
+ if (!restrictDirectory) return { valid: true }
66
+
67
+ const targetPath = cdMatch[1].trim().replace(/['"]/g, '')
68
+ const absolutePath = path.resolve(currentDir, targetPath)
69
+ const normalizedRoot = path.resolve(rootDir)
70
+
71
+ // 检查目标路径是否在根目录内
72
+ if (!absolutePath.startsWith(normalizedRoot)) {
73
+ return { valid: false, error: 'restricted-directory' }
74
+ }
75
+
76
+ return { valid: true, newDir: absolutePath }
77
+ }
78
+
79
+ // 渲染终端输出为图片
80
+ async function renderTerminalImage(ctx: Context, workingDir: string, command: string, output: string): Promise<h> {
81
+ if (!ctx.puppeteer) {
82
+ throw new Error('Puppeteer plugin is not available')
83
+ }
84
+
85
+ const fontPath = pathToFileURL(path.resolve(__dirname, '../fonts/JetBrainsMono-Regular.ttf')).href
86
+
87
+ const html = `
88
+ <!DOCTYPE html>
89
+ <html>
90
+ <head>
91
+ <meta charset="UTF-8">
92
+ <style>
93
+ @font-face {
94
+ font-family: 'JetBrains Mono';
95
+ src: url('${fontPath}') format('truetype');
96
+ }
97
+
98
+ * {
99
+ margin: 0;
100
+ padding: 0;
101
+ box-sizing: border-box;
102
+ }
103
+
104
+ body {
105
+ background: #1e1e1e;
106
+ color: #cccccc;
107
+ font-family: 'JetBrains Mono', 'Courier New', monospace;
108
+ font-size: 14px;
109
+ padding: 0;
110
+ display: inline-block;
111
+ min-width: 600px;
112
+ max-width: 1200px;
113
+ }
114
+
115
+ .terminal {
116
+ background: #1e1e1e;
117
+ border: 1px solid #3c3c3c;
118
+ border-radius: 8px;
119
+ overflow: hidden;
120
+ }
121
+
122
+ .title-bar {
123
+ background: #2d2d2d;
124
+ height: 35px;
125
+ display: flex;
126
+ align-items: center;
127
+ justify-content: space-between;
128
+ padding: 0 12px;
129
+ border-bottom: 1px solid #3c3c3c;
130
+ }
131
+
132
+ .title {
133
+ color: #cccccc;
134
+ font-size: 13px;
135
+ font-weight: 500;
136
+ }
137
+
138
+ .buttons {
139
+ display: flex;
140
+ gap: 8px;
141
+ }
142
+
143
+ .button {
144
+ width: 12px;
145
+ height: 12px;
146
+ border-radius: 50%;
147
+ }
148
+
149
+ .button.minimize { background: #ffbd2e; }
150
+ .button.maximize { background: #28c940; }
151
+ .button.close { background: #ff5f56; }
152
+
153
+ .content {
154
+ padding: 16px;
155
+ white-space: pre-wrap;
156
+ word-break: break-all;
157
+ line-height: 1.5;
158
+ }
159
+
160
+ .prompt {
161
+ color: #4ec9b0;
162
+ margin-bottom: 8px;
163
+ }
164
+
165
+ .command {
166
+ color: #dcdcaa;
167
+ margin-bottom: 12px;
168
+ }
169
+
170
+ .output {
171
+ color: #cccccc;
172
+ }
173
+ </style>
174
+ </head>
175
+ <body>
176
+ <div class="terminal">
177
+ <div class="title-bar">
178
+ <div class="title">Terminal</div>
179
+ <div class="buttons">
180
+ <div class="button minimize"></div>
181
+ <div class="button maximize"></div>
182
+ <div class="button close"></div>
183
+ </div>
184
+ </div>
185
+ <div class="content">
186
+ <div class="prompt">${escapeHtml(workingDir)}$</div>
187
+ <div class="command">${escapeHtml(command)}</div>
188
+ <div class="output">${escapeHtml(output)}</div>
189
+ </div>
190
+ </div>
191
+ </body>
192
+ </html>
193
+ `
194
+
195
+ const page = await ctx.puppeteer.page()
196
+ try {
197
+ await page.setContent(html)
198
+ await page.waitForNetworkIdle({ timeout: 5000 })
199
+
200
+ const element = await page.$('.terminal')
201
+ const clip = await element.boundingBox()
202
+ const screenshot = await page.screenshot({ clip }) as Buffer
203
+
204
+ return h.image(screenshot, 'image/png')
205
+ } finally {
206
+ await page.close()
207
+ }
208
+ }
209
+
210
+ function escapeHtml(text: string): string {
211
+ return text
212
+ .replace(/&/g, '&amp;')
213
+ .replace(/</g, '&lt;')
214
+ .replace(/>/g, '&gt;')
215
+ .replace(/"/g, '&quot;')
216
+ .replace(/'/g, '&#039;')
217
+ }
218
+
219
+ export function apply(ctx: Context, config: Config) {
220
+ ctx.i18n.define('zh-CN', require('./locales/zh-CN'))
221
+
222
+ ctx.command('exec <command:text>', { authority: 4 })
223
+ .action(async ({ session }, command) => {
224
+ if (!command) return session.text('.expect-text')
225
+
226
+ command = h('', h.parse(command)).toString(true)
227
+
228
+ // 检查违禁命令
229
+ if (isCommandBlocked(command, config.blockedCommands)) {
230
+ return session.text('.blocked-command')
231
+ }
232
+
233
+ const sessionId = session.uid || session.channelId
234
+ const rootDir = path.resolve(ctx.baseDir, config.root)
235
+ const currentDir = sessionDirs.get(sessionId) || rootDir
236
+
237
+ // 验证 cd 命令
238
+ const cdValidation = validateCdCommand(command, currentDir, rootDir, config.restrictDirectory)
239
+ if (!cdValidation.valid) {
240
+ return session.text('.restricted-directory')
241
+ }
242
+
243
+ const { timeout } = config
244
+ const state: State = { command, timeout, output: '' }
245
+
246
+ if (!config.renderImage) {
247
+ await session.send(session.text('.started', state))
248
+ }
249
+
250
+ return new Promise((resolve) => {
251
+ const start = Date.now()
252
+ const child = exec(command, {
253
+ timeout,
254
+ cwd: currentDir,
255
+ encoding: config.encoding,
256
+ shell: config.shell,
257
+ windowsHide: true,
258
+ })
259
+ child.stdout.on('data', (data) => {
260
+ state.output += data.toString()
261
+ })
262
+ child.stderr.on('data', (data) => {
263
+ state.output += data.toString()
264
+ })
265
+ child.on('close', async (code, signal) => {
266
+ state.code = code
267
+ state.signal = signal
268
+ state.timeUsed = Date.now() - start
269
+ state.output = state.output.trim()
270
+
271
+ // 更新当前目录(如果是 cd 命令且执行成功)
272
+ if (cdValidation.newDir && code === 0) {
273
+ sessionDirs.set(sessionId, cdValidation.newDir)
274
+ }
275
+
276
+ // 渲染为图片或返回文本
277
+ if (config.renderImage && ctx.puppeteer) {
278
+ try {
279
+ const image = await renderTerminalImage(ctx, currentDir, command, state.output || '(no output)')
280
+ resolve(image)
281
+ } catch (error) {
282
+ ctx.logger.error('Failed to render terminal image:', error)
283
+ resolve(session.text('.finished', state))
284
+ }
285
+ } else {
286
+ resolve(session.text('.finished', state))
287
+ }
288
+ })
289
+ })
290
+ })
291
+ }
@@ -0,0 +1,11 @@
1
+ commands:
2
+ exec:
3
+ description: 执行命令
4
+ messages:
5
+ expect-input: 请输入要运行的命令。
6
+ started: '[运行开始] {command}'
7
+ finished: |-
8
+ [运行完毕] {command}
9
+ {output}
10
+ blocked-command: 该命令已被禁止执行。
11
+ restricted-directory: 不允许切换到上级或其他目录。