@tooldeck/cli 1.1.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.
@@ -0,0 +1,49 @@
1
+ {
2
+ "plugin.name": "正则表达式工具",
3
+ "plugin.description": "用于测试、提取、替换和转义正则表达式的工具。",
4
+ "commands.test.title": "测试正则",
5
+ "commands.test.description": "检查正则表达式是否匹配文本。",
6
+ "commands.extract.title": "提取正则匹配",
7
+ "commands.extract.description": "提取匹配文本、位置、分组和摘要信息。",
8
+ "commands.replace.title": "替换正则匹配",
9
+ "commands.replace.description": "使用替换字符串替换正则匹配。",
10
+ "commands.escape.title": "转义正则文本",
11
+ "commands.escape.description": "转义普通文本,使其可安全用在正则表达式中。",
12
+ "schema.common.pattern.title": "模式",
13
+ "schema.common.pattern.placeholder": "\\bword\\b",
14
+ "schema.common.text.title": "文本",
15
+ "schema.common.text.placeholder": "粘贴要检查的文本",
16
+ "schema.common.flags.title": "标志",
17
+ "schema.test.mode.title": "匹配模式",
18
+ "schema.test.mode.options.contains": "包含匹配",
19
+ "schema.test.mode.options.full": "完整匹配",
20
+ "schema.extract.maxMatches.title": "最大匹配数",
21
+ "schema.extract.maxMatches.placeholder": "50",
22
+ "schema.extract.includeGroups.title": "包含分组",
23
+ "schema.extract.sections.title": "输出部分",
24
+ "schema.extract.sections.placeholder": "选择输出部分",
25
+ "schema.replace.replacement.title": "替换内容",
26
+ "schema.replace.replacement.placeholder": "$&",
27
+ "schema.replace.scope.title": "替换范围",
28
+ "schema.replace.scope.options.first": "首次",
29
+ "schema.replace.scope.options.all": "全部",
30
+ "schema.escape.text.placeholder": "例如 a+b?(c)",
31
+ "schema.escape.target.title": "输出目标",
32
+ "schema.escape.target.options.pattern": "正则模式",
33
+ "schema.escape.target.options.javascriptString": "JavaScript 字符串",
34
+ "schema.escape.target.options.javascriptRegexp": "JavaScript 正则",
35
+ "schema.escape.target.placeholder": "选择输出目标",
36
+ "schema.escape.wrapWithSlashes.title": "包裹斜杠",
37
+ "output.properties.matched": "是否匹配",
38
+ "output.properties.mode": "匹配模式",
39
+ "output.properties.flags": "标志",
40
+ "output.properties.index": "位置",
41
+ "output.properties.match": "匹配内容",
42
+ "output.properties.matches": "匹配数",
43
+ "output.properties.maxMatches": "最大匹配数",
44
+ "output.properties.truncated": "已截断",
45
+ "output.properties.replacements": "替换次数",
46
+ "output.properties.scope": "替换范围",
47
+ "output.properties.target": "输出目标",
48
+ "output.properties.wrapped": "已包裹"
49
+ }
@@ -0,0 +1,407 @@
1
+ {
2
+ "$schema": "../../packages/protocol/schema/manifest-v1.schema.json",
3
+ "schemaVersion": "1.0",
4
+ "id": "dev.tooldeck.regex-tools",
5
+ "name": {
6
+ "key": "plugin.name",
7
+ "default": "Regex Tools"
8
+ },
9
+ "description": {
10
+ "key": "plugin.description",
11
+ "default": "Tools for testing, extracting, replacing, and escaping regular expressions."
12
+ },
13
+ "version": "1.1.0",
14
+ "runtime": {
15
+ "kind": "node",
16
+ "entry": "./dist/index.js"
17
+ },
18
+ "defaultLocale": "en",
19
+ "locales": {
20
+ "en": "./locales/en.json",
21
+ "zh-CN": "./locales/zh-CN.json"
22
+ },
23
+ "contributes": {
24
+ "commands": [
25
+ {
26
+ "id": "regex.test",
27
+ "title": {
28
+ "key": "commands.test.title",
29
+ "default": "Test Regex"
30
+ },
31
+ "description": {
32
+ "key": "commands.test.description",
33
+ "default": "Check whether a regular expression matches text."
34
+ },
35
+ "x-ui": {
36
+ "layout": "split"
37
+ },
38
+ "inputSchema": {
39
+ "type": "object",
40
+ "required": ["pattern", "text"],
41
+ "additionalProperties": false,
42
+ "x-ui": {
43
+ "fieldOrder": ["pattern", "text", "flags", "mode"]
44
+ },
45
+ "properties": {
46
+ "pattern": {
47
+ "type": "string",
48
+ "title": "Pattern",
49
+ "minLength": 1,
50
+ "x-i18n": {
51
+ "title": "schema.common.pattern.title"
52
+ },
53
+ "x-ui": {
54
+ "control": "text",
55
+ "placeholder": {
56
+ "key": "schema.common.pattern.placeholder",
57
+ "default": "\\bword\\b"
58
+ }
59
+ }
60
+ },
61
+ "text": {
62
+ "type": "string",
63
+ "title": "Text",
64
+ "minLength": 1,
65
+ "x-i18n": {
66
+ "title": "schema.common.text.title"
67
+ },
68
+ "x-ui": {
69
+ "control": "textarea",
70
+ "rows": 8,
71
+ "placeholder": {
72
+ "key": "schema.common.text.placeholder",
73
+ "default": "Paste text to inspect"
74
+ }
75
+ }
76
+ },
77
+ "flags": {
78
+ "type": "array",
79
+ "title": "Flags",
80
+ "default": [],
81
+ "uniqueItems": true,
82
+ "items": {
83
+ "type": "string",
84
+ "enum": ["g", "i", "m", "s", "u", "y"]
85
+ },
86
+ "x-i18n": {
87
+ "title": "schema.common.flags.title"
88
+ },
89
+ "x-ui": {
90
+ "control": "checkboxGroup"
91
+ }
92
+ },
93
+ "mode": {
94
+ "type": "string",
95
+ "title": "Match Mode",
96
+ "default": "contains",
97
+ "enum": ["contains", "full"],
98
+ "x-i18n": {
99
+ "title": "schema.test.mode.title",
100
+ "enumLabels": {
101
+ "contains": "schema.test.mode.options.contains",
102
+ "full": "schema.test.mode.options.full"
103
+ }
104
+ },
105
+ "x-ui": {
106
+ "control": "radio"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ },
112
+ {
113
+ "id": "regex.extract",
114
+ "title": {
115
+ "key": "commands.extract.title",
116
+ "default": "Extract Regex Matches"
117
+ },
118
+ "description": {
119
+ "key": "commands.extract.description",
120
+ "default": "Extract matching text, indexes, groups, and summary details."
121
+ },
122
+ "x-ui": {
123
+ "layout": "split"
124
+ },
125
+ "inputSchema": {
126
+ "type": "object",
127
+ "required": ["pattern", "text"],
128
+ "additionalProperties": false,
129
+ "x-ui": {
130
+ "fieldOrder": ["pattern", "text", "flags", "maxMatches", "includeGroups", "sections"]
131
+ },
132
+ "properties": {
133
+ "pattern": {
134
+ "type": "string",
135
+ "title": "Pattern",
136
+ "minLength": 1,
137
+ "x-i18n": {
138
+ "title": "schema.common.pattern.title"
139
+ },
140
+ "x-ui": {
141
+ "control": "text",
142
+ "placeholder": {
143
+ "key": "schema.common.pattern.placeholder",
144
+ "default": "\\bword\\b"
145
+ }
146
+ }
147
+ },
148
+ "text": {
149
+ "type": "string",
150
+ "title": "Text",
151
+ "minLength": 1,
152
+ "x-i18n": {
153
+ "title": "schema.common.text.title"
154
+ },
155
+ "x-ui": {
156
+ "control": "textarea",
157
+ "rows": 10,
158
+ "placeholder": {
159
+ "key": "schema.common.text.placeholder",
160
+ "default": "Paste text to inspect"
161
+ }
162
+ }
163
+ },
164
+ "flags": {
165
+ "type": "array",
166
+ "title": "Flags",
167
+ "default": ["g"],
168
+ "uniqueItems": true,
169
+ "items": {
170
+ "type": "string",
171
+ "enum": ["g", "i", "m", "s", "u", "y"]
172
+ },
173
+ "x-i18n": {
174
+ "title": "schema.common.flags.title"
175
+ },
176
+ "x-ui": {
177
+ "control": "checkboxGroup"
178
+ }
179
+ },
180
+ "maxMatches": {
181
+ "type": "integer",
182
+ "title": "Max Matches",
183
+ "default": 50,
184
+ "minimum": 1,
185
+ "maximum": 500,
186
+ "x-i18n": {
187
+ "title": "schema.extract.maxMatches.title"
188
+ },
189
+ "x-ui": {
190
+ "control": "number",
191
+ "placeholder": {
192
+ "key": "schema.extract.maxMatches.placeholder",
193
+ "default": "50"
194
+ }
195
+ }
196
+ },
197
+ "includeGroups": {
198
+ "type": "boolean",
199
+ "title": "Include Groups",
200
+ "default": true,
201
+ "x-i18n": {
202
+ "title": "schema.extract.includeGroups.title"
203
+ },
204
+ "x-ui": {
205
+ "control": "checkbox"
206
+ }
207
+ },
208
+ "sections": {
209
+ "type": "array",
210
+ "title": "Output Sections",
211
+ "default": ["match", "index", "groups", "stats"],
212
+ "uniqueItems": true,
213
+ "items": {
214
+ "type": "string",
215
+ "enum": ["match", "index", "groups", "namedGroups", "context", "stats", "json"]
216
+ },
217
+ "x-i18n": {
218
+ "title": "schema.extract.sections.title"
219
+ },
220
+ "x-ui": {
221
+ "control": "multiSelect",
222
+ "placeholder": {
223
+ "key": "schema.extract.sections.placeholder",
224
+ "default": "Choose output sections"
225
+ }
226
+ }
227
+ }
228
+ }
229
+ }
230
+ },
231
+ {
232
+ "id": "regex.replace",
233
+ "title": {
234
+ "key": "commands.replace.title",
235
+ "default": "Replace Regex Matches"
236
+ },
237
+ "description": {
238
+ "key": "commands.replace.description",
239
+ "default": "Replace regex matches with a replacement string."
240
+ },
241
+ "x-ui": {
242
+ "layout": "split"
243
+ },
244
+ "inputSchema": {
245
+ "type": "object",
246
+ "required": ["pattern", "replacement", "text"],
247
+ "additionalProperties": false,
248
+ "x-ui": {
249
+ "fieldOrder": ["pattern", "replacement", "text", "flags", "scope"]
250
+ },
251
+ "properties": {
252
+ "pattern": {
253
+ "type": "string",
254
+ "title": "Pattern",
255
+ "minLength": 1,
256
+ "x-i18n": {
257
+ "title": "schema.common.pattern.title"
258
+ },
259
+ "x-ui": {
260
+ "control": "text",
261
+ "placeholder": {
262
+ "key": "schema.common.pattern.placeholder",
263
+ "default": "\\bword\\b"
264
+ }
265
+ }
266
+ },
267
+ "replacement": {
268
+ "type": "string",
269
+ "title": "Replacement",
270
+ "default": "",
271
+ "x-i18n": {
272
+ "title": "schema.replace.replacement.title"
273
+ },
274
+ "x-ui": {
275
+ "control": "text",
276
+ "placeholder": {
277
+ "key": "schema.replace.replacement.placeholder",
278
+ "default": "$&"
279
+ }
280
+ }
281
+ },
282
+ "text": {
283
+ "type": "string",
284
+ "title": "Text",
285
+ "minLength": 1,
286
+ "x-i18n": {
287
+ "title": "schema.common.text.title"
288
+ },
289
+ "x-ui": {
290
+ "control": "textarea",
291
+ "rows": 10,
292
+ "placeholder": {
293
+ "key": "schema.common.text.placeholder",
294
+ "default": "Paste text to inspect"
295
+ }
296
+ }
297
+ },
298
+ "flags": {
299
+ "type": "array",
300
+ "title": "Flags",
301
+ "default": [],
302
+ "uniqueItems": true,
303
+ "items": {
304
+ "type": "string",
305
+ "enum": ["g", "i", "m", "s", "u", "y"]
306
+ },
307
+ "x-i18n": {
308
+ "title": "schema.common.flags.title"
309
+ },
310
+ "x-ui": {
311
+ "control": "checkboxGroup"
312
+ }
313
+ },
314
+ "scope": {
315
+ "type": "string",
316
+ "title": "Replacement Scope",
317
+ "default": "all",
318
+ "enum": ["first", "all"],
319
+ "x-i18n": {
320
+ "title": "schema.replace.scope.title",
321
+ "enumLabels": {
322
+ "first": "schema.replace.scope.options.first",
323
+ "all": "schema.replace.scope.options.all"
324
+ }
325
+ },
326
+ "x-ui": {
327
+ "control": "radio"
328
+ }
329
+ }
330
+ }
331
+ }
332
+ },
333
+ {
334
+ "id": "regex.escape",
335
+ "title": {
336
+ "key": "commands.escape.title",
337
+ "default": "Escape Regex Text"
338
+ },
339
+ "description": {
340
+ "key": "commands.escape.description",
341
+ "default": "Escape literal text so it can be used safely in a regular expression."
342
+ },
343
+ "x-ui": {
344
+ "layout": "split"
345
+ },
346
+ "inputSchema": {
347
+ "type": "object",
348
+ "required": ["text"],
349
+ "additionalProperties": false,
350
+ "x-ui": {
351
+ "fieldOrder": ["text", "target", "wrapWithSlashes"]
352
+ },
353
+ "properties": {
354
+ "text": {
355
+ "type": "string",
356
+ "title": "Text",
357
+ "minLength": 1,
358
+ "x-i18n": {
359
+ "title": "schema.common.text.title"
360
+ },
361
+ "x-ui": {
362
+ "control": "textarea",
363
+ "rows": 8,
364
+ "placeholder": {
365
+ "key": "schema.escape.text.placeholder",
366
+ "default": "Text such as a+b?(c)"
367
+ }
368
+ }
369
+ },
370
+ "target": {
371
+ "type": "string",
372
+ "title": "Output Target",
373
+ "default": "pattern",
374
+ "enum": ["pattern", "javascript-string", "javascript-regexp"],
375
+ "x-i18n": {
376
+ "title": "schema.escape.target.title",
377
+ "enumLabels": {
378
+ "pattern": "schema.escape.target.options.pattern",
379
+ "javascript-string": "schema.escape.target.options.javascriptString",
380
+ "javascript-regexp": "schema.escape.target.options.javascriptRegexp"
381
+ }
382
+ },
383
+ "x-ui": {
384
+ "control": "select",
385
+ "placeholder": {
386
+ "key": "schema.escape.target.placeholder",
387
+ "default": "Choose output target"
388
+ }
389
+ }
390
+ },
391
+ "wrapWithSlashes": {
392
+ "type": "boolean",
393
+ "title": "Wrap With Slashes",
394
+ "default": false,
395
+ "x-i18n": {
396
+ "title": "schema.escape.wrapWithSlashes.title"
397
+ },
398
+ "x-ui": {
399
+ "control": "checkbox"
400
+ }
401
+ }
402
+ }
403
+ }
404
+ }
405
+ ]
406
+ }
407
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@tooldeck/regex-tools",
3
+ "version": "1.1.0",
4
+ "private": true,
5
+ "description": "Regex tools plugin for Tooldeck.",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "generate:types": "pnpm --dir ../.. --filter @tooldeck/plugin-tools build && node ../../packages/plugin-tools/dist/generate-command-types.js manifest.json src/generated/commands.ts",
12
+ "build": "pnpm generate:types && vite build --configLoader runner",
13
+ "typecheck": "pnpm generate:types && tsc --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "@tooldeck/plugin-tools": "workspace:*",
17
+ "@tooldeck/sdk-node": "workspace:*"
18
+ }
19
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@tooldeck/cli",
3
+ "version": "1.1.0",
4
+ "description": "Command-line interface for Tooldeck.",
5
+ "bin": {
6
+ "tooldeck": "dist/index.js"
7
+ },
8
+ "type": "module",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": "./dist/index.js"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "dependencies": {
19
+ "citty": "^0.2.2",
20
+ "cli-table3": "^0.6.5",
21
+ "consola": "^3.4.2",
22
+ "picocolors": "^1.1.1"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.9.1",
26
+ "@tooldeck/host-node": "1.1.0",
27
+ "@tooldeck/regex-tools": "1.1.0",
28
+ "@tooldeck/core": "1.1.0",
29
+ "@tooldeck/protocol": "1.1.0",
30
+ "@tooldeck/json-tools": "1.1.0",
31
+ "@tooldeck/shared": "1.1.0",
32
+ "@tooldeck/storage": "1.1.0",
33
+ "@tooldeck/hello-world": "1.1.0"
34
+ },
35
+ "scripts": {
36
+ "dev": "tsx src/index.ts",
37
+ "prebuild": "pnpm --filter @tooldeck/shared --filter @tooldeck/storage build && pnpm --dir ../.. builtin-plugins:build -- --mode production",
38
+ "build": "vite build",
39
+ "postbuild": "pnpm --dir ../.. builtin-plugins:stage -- --out apps/cli/dist/plugins --skip-build",
40
+ "smoke:built": "node scripts/smoke-built.mjs",
41
+ "pretypecheck": "pnpm --filter @tooldeck/shared --filter @tooldeck/storage build",
42
+ "typecheck": "tsc --noEmit",
43
+ "pretest": "pnpm --filter @tooldeck/shared --filter @tooldeck/storage build && pnpm --dir ../.. builtin-plugins:build",
44
+ "test": "vitest run test"
45
+ }
46
+ }