Repository navigation
Add Regex Lab Mini App (regex-lab) #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lym308758
wants to merge
1
commit into
MiniMax-AI:main
Choose a base branch
from
Lym308758:feat/regex-lab
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "schemaVersion": 1, | ||
| "name": "regex-lab", | ||
| "displayName": "Regex Lab · 正则实验室", | ||
| "version": "1.0.0", | ||
| "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.", | ||
| "author": "lym308758", | ||
| "icon": "icon.png", | ||
| "category": "Code", | ||
| "exampleQueries": [ | ||
| "打开 Regex Lab 正则测试器", | ||
| "Open Regex Lab" | ||
| ], | ||
| "apps": [], | ||
| "mcpServers": [], | ||
| "skills": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 lym308758 | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Regex Lab (`regex-lab`) | ||
|
|
||
| A live regular-expression workbench that runs inside MiniMax Code. Type a pattern and some | ||
| sample text, watch every match appear with its capture groups and named groups, and preview a | ||
| replacement — all computed by the Mini App's own Node backend. Nothing is sent anywhere; the text | ||
| never leaves the app. | ||
|
|
||
| ## What it does | ||
|
|
||
| - **Live matching** against the sample text, with match position (`index`–`end`), the matched | ||
| substring, numbered capture groups, and named capture groups. | ||
| - **Replacement preview** using the standard `$1`, `$<name>`, `$$`, `$&`, `` $` ``, `$'` tokens. | ||
| - **Flag toggles** for `g` / `i` / `m` / `s` / `u` / `y`, with a plain-text flag box if you prefer | ||
| to type them. | ||
| - **Invalid-pattern feedback** — a bad regex shows the engine's error instead of failing silently. | ||
|
|
||
| The computation lives in `miniapp/node/regex-engine.mjs` (pure functions, no DOM), shared by the | ||
| Node HTTP API and the unit tests, so the logic you see is the logic that runs. | ||
|
|
||
| ## Install | ||
|
|
||
| Copy this directory, including the hidden `.minimax-plugin/`, into the MiniMax Code plugins | ||
| directory as `regex-lab/` (`~/.minimax/plugins/regex-lab/` by default). Restart MiniMax Code and | ||
| ask the Agent to "Open Regex Lab" (or "打开 Regex Lab 正则测试器"). | ||
|
|
||
| ## Tested environment | ||
|
|
||
| - Validated locally with Node.js 22: `node scripts/validate.mjs plugins/lym308758/regex-lab` reports | ||
| no errors, and `node --test plugins/lym308758/regex-lab/tests/` passes (engine + HTTP handler). | ||
| - **Not verified in the MiniMax Code host UI**: this environment has no MiniMax Code desktop client, | ||
| so the page was not opened inside the side panel and the in-app rendering/click-through was not | ||
| exercised end to end. The Node backend (page serving + `/api/match` + `/api/replace`) is covered | ||
| by `tests/server.test.mjs` against a real `node:http` server, and the regex engine by | ||
| `tests/regex-engine.test.mjs`. | ||
|
|
||
| ## Data & access | ||
|
|
||
| - **Files:** reads only its own `miniapp/client/index.html` to serve the page. Writes nothing. | ||
| - **Network:** none beyond the Host loopback that serves the page and the JSON API to the page. | ||
| - **Processes:** none spawned. | ||
| - **Agent turns:** none; the Mini App declares no `agentAccess`. | ||
| - **State:** none stored. Each evaluation runs on the text you paste into the page. | ||
|
|
||
| ## Files | ||
|
|
||
| ```text | ||
| .minimax-plugin/plugin.json Plugin manifest | ||
| package.json Mini App declaration | ||
| miniapp/miniapp.json Payload roots, Node entry, page route | ||
| miniapp/client/index.html The page served at /dashboard | ||
| miniapp/node/server.mjs Node entry: start(context) -> { dispose } and the JSON API | ||
| miniapp/node/regex-engine.mjs Pure regex functions (match / replace), shared with the tests | ||
| icon.png Plugin icon | ||
| tests/regex-engine.test.mjs Engine unit tests | ||
| tests/server.test.mjs HTTP handler + start() lifecycle tests | ||
| README.md This file | ||
| README.zh-CN.md Chinese README | ||
| LICENSE MIT | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| [MIT](./LICENSE) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Regex Lab · 正则实验室(`regex-lab`) | ||
|
|
||
| 运行在 MiniMax Code 内部的实时正则工作台。输入正则和样例文本,逐条查看匹配结果及其捕获组、 | ||
| 命名组,并预览替换效果——全部由 Mini App 自带的 Node 后端完成,文本不会发往任何外部地址。 | ||
|
|
||
| ## 功能 | ||
|
|
||
| - **实时匹配**:显示每处匹配的位置(`index`–`end`)、匹配内容、编号捕获组与命名捕获组。 | ||
| - **替换预览**:支持标准 `$1`、`$<name>`、`$$`、`$&`、`` $` ``、`$'` 等替换符。 | ||
| - **修饰符开关**:`g` / `i` / `m` / `s` / `u` / `y`,也可在文本框直接输入。 | ||
| - **非法正则提示**:正则无效时显示引擎报错,而不是静默失败。 | ||
|
|
||
| 计算逻辑位于 `miniapp/node/regex-engine.mjs`(纯函数、无 DOM),同时被 Node 接口与单元测试复用, | ||
| 所见即所跑。 | ||
|
|
||
| ## 安装 | ||
|
|
||
| 将本目录(含隐藏目录 `.minimax-plugin/`)整体复制到 MiniMax Code 的插件目录,命名为 | ||
| `regex-lab/`(`~/.minimax/plugins/regex-lab/`)。重启 MiniMax Code,请 Agent 打开 | ||
| 「Regex Lab 正则测试器」。 | ||
|
|
||
| ## 验证环境 | ||
|
|
||
| - 本机使用 Node.js 22 校验通过:`node scripts/validate.mjs plugins/lym308758/regex-lab` 无错误, | ||
| `node --test plugins/lym308758/regex-lab/tests/` 全部通过(引擎 + HTTP 接口)。 | ||
| - **未在 MiniMax Code 宿主界面内验证**:当前环境没有 MiniMax Code 桌面端,因此未把页面真正在侧边栏 | ||
| 中打开,也未做端到端的界面点击验证。Node 后端(页面托管 + `/api/match` + `/api/replace`)由 | ||
| `tests/server.test.mjs` 在真实 `node:http` 服务上覆盖,正则引擎由 `tests/regex-engine.test.mjs` 覆盖。 | ||
|
|
||
| ## 数据访问 | ||
|
|
||
| - **文件**:仅读取自身的 `miniapp/client/index.html` 以托管页面,不写入任何文件。 | ||
| - **网络**:除宿主回环(页面与 JSON 接口)外无任何外部网络访问。 | ||
| - **进程**:不创建子进程。 | ||
| - **Agent 回合**:无;本 Mini App 未声明 `agentAccess`。 | ||
| - **状态**:不存储任何状态,每次计算仅针对你粘贴的文本。 | ||
|
|
||
| ## 许可证 | ||
|
|
||
| [MIT](./LICENSE) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: the other rows link to the plugin's
README.zh-CN.md. Please useplugins/lym308758/regex-lab/README.zh-CN.md.