Skip to content

Commit a365ff0

Browse files
committed
Add Regex Lab Mini App (regex-lab)
A live regular-expression workbench for MiniMax Code: test patterns against sample text, inspect capture groups and named groups, and preview replacements. Computed entirely in the Mini App's Node backend; nothing leaves the machine. Built with the assistance of an AI coding agent (WorkBuddy).
1 parent c3850b0 commit a365ff0

14 files changed

Lines changed: 804 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ The MiniMax Code Agent communicates through the host MCP client. Business reques
7575
| [Anatomy Gallery](plugins/zch0227/anatomy-gallery/) | A gallery for interactive isometric figures made with the anatomy skill: hang them in rooms you organize, view light and dark editions full screen, keep every version, and have an Agent create or edit figures from the gallery with a per-run process log. The anatomy skill is bundled. Requires MiniMax Code 3.1.2 or later | [zch0227](https://github.com/zch0227) |
7676
| [仓库透视 / Repo X-Ray](plugins/yujiachen-y/repo-xray/) | Understand a codebase from its Git history: a code map you can drill into, hotspots and bug magnets, high-risk files, owners and knowledge loss, commit rhythm and firefighting, and the tech stack. Works with GitHub, GitLab, and local repositories; analysis runs on your machine | [yujiachen-y](https://github.com/yujiachen-y) |
7777
| [Disk Insight](plugins/zch0227/disk-insight/) | See where disk space went on macOS and Windows with a sunburst space map, find junk files sorted into three safety tiers, large and duplicate files, and how much code repositories and Git worktrees take; ask an Agent about any item, and permanently delete what you select after a confirmation that lists every item. Requires MiniMax Code 3.1.2 or later | [zch0227](https://github.com/zch0227) |
78+
| [Regex Lab](plugins/lym308758/regex-lab/) | A live regular-expression workbench: test patterns against sample text, inspect every match with capture groups and named groups, and preview replacements — computed entirely in the Mini App, so nothing leaves your machine. | [lym308758](https://github.com/lym308758) |
7879

7980
<details>
8081
<summary>Preview: Token Usage Board</summary>

‎README.zh-CN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ MiniMax Code Agent 通过宿主 MCP 客户端与 MiniApp 协作。业务请求
7575
| [Anatomy 画廊](plugins/zch0227/anatomy-gallery/README.zh-CN.md) | 集中展示 anatomy 技能做出的交互式等距图解:按自建展区挂墙,全屏查看明暗两版,保留全部历史版本;在画廊里让 Agent 新建或修改作品,每次运行都有过程记录。自带 anatomy 技能。需要 MiniMax Code 3.1.2 或更高版本 | [zch0227](https://github.com/zch0227) |
7676
| [仓库透视](plugins/yujiachen-y/repo-xray/README.zh-CN.md) | 从 Git 历史看懂一个代码仓库:可逐层下钻的代码地图、热点与 Bug 磁铁、高风险文件、负责人与知识流失、提交节奏与救火记录、技术栈;支持 GitHub、GitLab 和本机仓库,全部在本机分析 | [yujiachen-y](https://github.com/yujiachen-y) |
7777
| [磁盘透视](plugins/zch0227/disk-insight/README.zh-CN.md) | 查看 macOS 和 Windows 的磁盘空间去向:旭日图空间地图,按三档风险分类的垃圾文件,大文件和重复文件,代码仓库和 Git worktree 的占用;任何条目都可以问 Agent,选中的条目在确认框里逐一列出,确认后直接永久删除。需要 MiniMax Code 3.1.2 或更高版本 | [zch0227](https://github.com/zch0227) |
78+
| [Regex Lab](plugins/lym308758/regex-lab/) | 实时正则工作台:用样例文本测试正则,逐条查看匹配与捕获组 / 命名组,并预览替换结果;计算全部在 Mini App 内完成,数据不出本机 | [lym308758](https://github.com/lym308758) |
7879

7980
<details>
8081
<summary>预览:Token 用量看板</summary>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"schemaVersion": 1,
3+
"name": "regex-lab",
4+
"displayName": "Regex Lab · 正则实验室",
5+
"version": "1.0.0",
6+
"description": "A live regular-expression workbench inside MiniMax Code: test patterns against sample text, inspect every match with capture groups and named groups, and preview replacements. Runs entirely in the Mini App — no data leaves your machine.",
7+
"author": "lym308758",
8+
"icon": "icon.png",
9+
"category": "Code",
10+
"exampleQueries": [
11+
"打开 Regex Lab 正则测试器",
12+
"Open Regex Lab"
13+
],
14+
"apps": [],
15+
"mcpServers": [],
16+
"skills": []
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 lym308758
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Regex Lab (`regex-lab`)
2+
3+
A live regular-expression workbench that runs inside MiniMax Code. Type a pattern and some
4+
sample text, watch every match appear with its capture groups and named groups, and preview a
5+
replacement — all computed by the Mini App's own Node backend. Nothing is sent anywhere; the text
6+
never leaves the app.
7+
8+
## What it does
9+
10+
- **Live matching** against the sample text, with match position (`index`–`end`), the matched
11+
substring, numbered capture groups, and named capture groups.
12+
- **Replacement preview** using the standard `$1`, `$<name>`, `$$`, `$&`, `` $` ``, `$'` tokens.
13+
- **Flag toggles** for `g` / `i` / `m` / `s` / `u` / `y`, with a plain-text flag box if you prefer
14+
to type them.
15+
- **Invalid-pattern feedback** — a bad regex shows the engine's error instead of failing silently.
16+
17+
The computation lives in `miniapp/node/regex-engine.mjs` (pure functions, no DOM), shared by the
18+
Node HTTP API and the unit tests, so the logic you see is the logic that runs.
19+
20+
## Install
21+
22+
Copy this directory, including the hidden `.minimax-plugin/`, into the MiniMax Code plugins
23+
directory as `regex-lab/` (`~/.minimax/plugins/regex-lab/` by default). Restart MiniMax Code and
24+
ask the Agent to "Open Regex Lab" (or "打开 Regex Lab 正则测试器").
25+
26+
## Tested environment
27+
28+
- Validated locally with Node.js 22: `node scripts/validate.mjs plugins/lym308758/regex-lab` reports
29+
no errors, and `node --test plugins/lym308758/regex-lab/tests/` passes (engine + HTTP handler).
30+
- **Not verified in the MiniMax Code host UI**: this environment has no MiniMax Code desktop client,
31+
so the page was not opened inside the side panel and the in-app rendering/click-through was not
32+
exercised end to end. The Node backend (page serving + `/api/match` + `/api/replace`) is covered
33+
by `tests/server.test.mjs` against a real `node:http` server, and the regex engine by
34+
`tests/regex-engine.test.mjs`.
35+
36+
## Data & access
37+
38+
- **Files:** reads only its own `miniapp/client/index.html` to serve the page. Writes nothing.
39+
- **Network:** none beyond the Host loopback that serves the page and the JSON API to the page.
40+
- **Processes:** none spawned.
41+
- **Agent turns:** none; the Mini App declares no `agentAccess`.
42+
- **State:** none stored. Each evaluation runs on the text you paste into the page.
43+
44+
## Files
45+
46+
```text
47+
.minimax-plugin/plugin.json Plugin manifest
48+
package.json Mini App declaration
49+
miniapp/miniapp.json Payload roots, Node entry, page route
50+
miniapp/client/index.html The page served at /dashboard
51+
miniapp/node/server.mjs Node entry: start(context) -> { dispose } and the JSON API
52+
miniapp/node/regex-engine.mjs Pure regex functions (match / replace), shared with the tests
53+
icon.png Plugin icon
54+
tests/regex-engine.test.mjs Engine unit tests
55+
tests/server.test.mjs HTTP handler + start() lifecycle tests
56+
README.md This file
57+
README.zh-CN.md Chinese README
58+
LICENSE MIT
59+
```
60+
61+
## License
62+
63+
[MIT](./LICENSE)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Regex Lab · 正则实验室(`regex-lab`)
2+
3+
运行在 MiniMax Code 内部的实时正则工作台。输入正则和样例文本,逐条查看匹配结果及其捕获组、
4+
命名组,并预览替换效果——全部由 Mini App 自带的 Node 后端完成,文本不会发往任何外部地址。
5+
6+
## 功能
7+
8+
- **实时匹配**:显示每处匹配的位置(`index`–`end`)、匹配内容、编号捕获组与命名捕获组。
9+
- **替换预览**:支持标准 `$1`、`$<name>`、`$$`、`$&`、`` $` ``、`$'` 等替换符。
10+
- **修饰符开关**:`g` / `i` / `m` / `s` / `u` / `y`,也可在文本框直接输入。
11+
- **非法正则提示**:正则无效时显示引擎报错,而不是静默失败。
12+
13+
计算逻辑位于 `miniapp/node/regex-engine.mjs`(纯函数、无 DOM),同时被 Node 接口与单元测试复用,
14+
所见即所跑。
15+
16+
## 安装
17+
18+
将本目录(含隐藏目录 `.minimax-plugin/`)整体复制到 MiniMax Code 的插件目录,命名为
19+
`regex-lab/`(`~/.minimax/plugins/regex-lab/`)。重启 MiniMax Code,请 Agent 打开
20+
「Regex Lab 正则测试器」。
21+
22+
## 验证环境
23+
24+
- 本机使用 Node.js 22 校验通过:`node scripts/validate.mjs plugins/lym308758/regex-lab` 无错误,
25+
`node --test plugins/lym308758/regex-lab/tests/` 全部通过(引擎 + HTTP 接口)。
26+
- **未在 MiniMax Code 宿主界面内验证**:当前环境没有 MiniMax Code 桌面端,因此未把页面真正在侧边栏
27+
中打开,也未做端到端的界面点击验证。Node 后端(页面托管 + `/api/match` + `/api/replace`)由
28+
`tests/server.test.mjs` 在真实 `node:http` 服务上覆盖,正则引擎由 `tests/regex-engine.test.mjs` 覆盖。
29+
30+
## 数据访问
31+
32+
- **文件**:仅读取自身的 `miniapp/client/index.html` 以托管页面,不写入任何文件。
33+
- **网络**:除宿主回环(页面与 JSON 接口)外无任何外部网络访问。
34+
- **进程**:不创建子进程。
35+
- **Agent 回合**:无;本 Mini App 未声明 `agentAccess`。
36+
- **状态**:不存储任何状态,每次计算仅针对你粘贴的文本。
37+
38+
## 许可证
39+
40+
[MIT](./LICENSE)
317 Bytes
Loading

0 commit comments

Comments
 (0)