Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions plugins/Bencibr/bugx/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Business Source License 1.1

Parameters

Licensor:
Stably AI
Licensed Work:
BugX (including its source code, documentation, binaries, and associated assets)
Additional Use Grant:
You may use the Licensed Work for internal development, testing, and security auditing, provided that you do not offer the Licensed Work, or any derivative work, as a hosted or managed service, or as part of a commercial product or service that competes with the Licensor's products or services (including BugX Cloud and associated hosted offerings).
Change Date:
3 years from the date of each release of the Licensed Work
Change License:
Apache License, Version 2.0 (as published by the Apache Software Foundation)

Text

The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production and production use of the
Licensed Work. The foregoing license is granted subject to the following
conditions.

The Licensor may define an "Additional Use Grant" as part of the Parameters
above. You may use the Licensed Work pursuant to the Additional Use Grant
until the Change Date.

On the Change Date, or in the absence of a Change Date, on the fourth
anniversary of the first publicly available distribution of a specific version of
the Licensed Work under this License, this License will terminate, and the
Licensor hereby grants you rights under the Change License.

If you are using the Licensed Work pursuant to the Additional Use Grant, you
may also use it for any non-commercial purposes or internal business purposes
that do not violate the terms of the Additional Use Grant.

If you violate the terms of this License, including the Additional Use Grant,
your rights under this License will terminate automatically.

To use the Licensed Work outside of the Additional Use Grant, please contact
the Licensor at business@bugx.dev.

Notices

You must reproduce the Licensor's copyright notice, this License, and any
other notices in all copies of the Licensed Work, or any derivative works that
you create.

DISCLAIMER

THE LICENSED WORK 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
LICENSOR 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 LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
61 changes: 61 additions & 0 deletions plugins/Bencibr/bugx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# BugX - Autonomous Code Review & Testing Agent

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![Version](https://img.shields.io/badge/version-0.1.9-green.svg)](https://bugx.dev)

Autonomous code review and testing agent for MiniMax Code. Provides deep bug detection, multi-model consensus review, and evidence-backed verification.

---

## What BugX Does

- **Deep Bug Detection**: Uncovers security vulnerabilities, race conditions, logic errors, and corner-case crashes.
- **Multi-Model Consensus Audit**: Cross-validates issues across top AI models to eliminate hallucinations.
- **Evidence-Backed Verification**: Provides executable reproduction scripts, trace call paths, and structural code analysis.
- **MCP Native**: Integrates natively with MiniMax Code via Model Context Protocol.

---

## Prerequisites

No manual CLI install is required — the plugin runs `npx bugx-cli`.

- Node.js >= 20
- Python >= 3.11 on the host. The plugin never downloads a runtime: when Python is missing,
`bugx` prints `REPAIR_REQUIRED` with platform-specific repair steps for the host AI.

---

## One-time project wiring

MiniMax runs plugin-declared MCP servers from the plugin directory, which cannot point at
your project. Register BugX's Supervisor channels at the project level instead:

```bash
npx --yes bugx-cli install --agent minimax --root .
```

This writes `.mcp.json` with an absolute project root. Start a new MiniMax session
afterwards so the MCP servers load.

---

## Quick Start in MiniMax Code

Once enabled in MiniMax Code, invoke BugX in any project chat:

```text
/bugx 对当前项目进行自主代码审查,找出深层 Bug
```

Or run targeted security audit:

```text
/bugx 检查当前改动是否存在安全漏洞与边界缺陷
```

---

## License

Apache-2.0 © 2026 BugX Team.
20 changes: 20 additions & 0 deletions plugins/Bencibr/bugx/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "bugx",
"version": "0.1.9",
"description": "Autonomous code review and testing agent. Catches hidden deep bugs for developers, automates black-box, functional, and performance testing for QA, and ensures rock-solid software delivery.",
"author": {
"name": "BugX",
"url": "https://bugx.dev"
},
"homepage": "https://bugx.dev",
"repository": "https://github.com/Bencibr/bugx",
"license": "Apache-2.0",
"keywords": [
"security",
"code-audit",
"code-review",
"mcp",
"bugx"
]
}
120 changes: 120 additions & 0 deletions plugins/Bencibr/bugx/skills/bugx/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
---
name: bugx
description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
---

<!-- bugx-locale: zh-CN -->

# BugX for ChatGPT

BugX ChatGPT Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。

协议镜像版本:0.1.9

## ChatGPT 原生交互适配(强制)

使用 ChatGPT 宿主提供的结构化选择控件呈现交互决策,按选项唯一 `value` 及受控 `action` 执行。


## 启动交互适配:启动策略(无问卷)

开工策略按 CLI 参数 > 项目 `.bugx/config.json` > 用户 `~/.bugx/config.json` > 系统默认值读取。在自治启动(--autonomous)模式下,常规启动不呈现云同步、审查方式、轮询、修复或提交问卷;在非自治交互模式下,由宿主调用原生问答控件呈现作战方案供用户确认(一键批准、微调或暂存稍后)。可选 MCP/探针不可用时自动回退到 Native Protocol Mode 与内置能力,不因缺少 session proof 要求重启。
## 宿主路由(先于意图分流)

- **ZCode 宿主**:优先加载同插件 `bugx-zcode` skill(ZCode 专属手册:直驱路径、rpc 回退、坑位对策)。若当前会话未注册该 skill(新装 skill 需重启宿主会话才可见),直接按其核心结论执行:`workers` 预占后**由宿主会话直驱协议通道**(worker MCP 工具或 `bugx supervisor rpc --role worker`,caller_role=worker),勿默认为 worker 派发子代理;`run_sandboxed_probe` 必须携带本次 Task 的 lease_id/execution_id。
- 其余宿主按后续章节执行。



## 如何使用本技能(AI 执行元指南与意图决策树)

当你(AI)触发并阅读本技能时,请无条件遵循以下认知模型与执行时序:

### 1. 意图决策树(Triage Decision Tree)
拿到任务第一秒,判定属于哪个分支:
- **分支 A:单点敏捷排查 / 特定函数 / Diff / 报错堆栈**
- **标志**:单文件排查、复现某个函数、分析异常报错。
- **动作**:就地编写轻量复现脚本(PoC)或运行定向测试,使用 `bugx view`, `bugx test-generate`, `bugx test-verify`;**严禁启动重型全流程门禁!**
- **分支 B:全库漏洞挖掘 / 深度变异 / 多 Worker 并发审计**
- **标志**:用户明确输入 `/bugx`、要求“全库审计”、“挖掘潜在漏洞”。
- **动作**:按标准生命周期流转(`engine pre` -> 门禁确认 -> Explore -> Mutate -> Repair -> 结算)。
- **分支 C:环境诊断 / 依赖修复 / 宿主状态排查**
- **动作**:优先运行 `bugx doctor --root <ROOT> --json` 与 `bugx engine --root <ROOT> status --json`,绝不盲目 `init` 或 `--force`。
- **首次使用的环境自修复**(由你执行;禁止在插件目录内安装运行时):
- Supervisor MCP 工具未加载:在当前项目运行 `bugx install --agent <宿主> --root <ROOT>`(宿主名见 `bugx hosts --json`;无全局 bugx 时用 `npx --yes bugx-cli install --agent <宿主> --root <ROOT>`)。它写项目级 MCP(Kimi `.kimi-code/mcp.json`、MiniMax `.mcp.json`,绝对根),随后请用户新建会话。
- `bugx` 报 `REPAIR_REQUIRED`(缺少 Python 3.11+):按输出中的平台化步骤修复宿主环境(或设置 `BUGX_PYTHON`),再执行 `bugx doctor --json` 自检;插件永不下载或安装 Python。

### 2. 标准五步操作闭环(5-Step Execution Loop)
1. **定根**:确定被测项目根绝对路径 `<ROOT>`,严格在 `<ROOT>` 内部执行,禁止全盘发散扫描。
2. **探况**:先执行只读命令检查运行态(`bugx engine --root <ROOT> status --json` 或 `bugx doctor`)。
3. **选路**:根据意图挑选命令;若需查阅参数,运行 `bugx help <顶层命令>`(如 `bugx help cloud`)按需动态读取,严禁盲猜。
4. **承接**:若 `engine pre` 返回退出码 `2`,表示等待宿主单选门禁交互;必须调用宿主原生控件展示选项,按用户选择的 action 执行,禁止文本伪造选择或自旋重试。退出码 `0` 只代表门禁通过,不代表挖掘完成。
5. **闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据;使用 6 大标准汇报用词(只读检查、项目就绪、门禁就绪、测试执行、挖掘启动、挖掘完成)如实汇报。

### 3. 高频场景命令(覆盖 90% 日常调用)
- **环境诊断**:`bugx doctor --root <ROOT> --json`(`--repair-assets` 按需修复)
- **启动与门禁**:先运行 `bugx engine --root <ROOT> status --json`;仅当状态为 `UNINITIALIZED` 时运行 `bugx engine --root <ROOT> pre` 自动准备新项目。挖掘启动不要先调用 `bugx init`;它是独立 CLI 初始化操作,不替代 status/pre 状态机。若状态为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留现场并停止;禁止用 `init`、`reset` 或 `--force` 绕过门禁。
- **单点复现与变异**:`bugx test-generate --root <ROOT> --scope <PATH::SYM> --out <FILE>` / `bugx test-verify verify --scope <SCOPE>`
- **Supervisor 与并发排查**:`bugx supervisor status --root <ROOT>`
- **脱敏飞轮与日志**:`bugx telemetry inspect` / `bugx log --root <ROOT> --errors`
- **双轨报告与预览**:`bugx report both --eval-dir evals/oss --out evals/oss` / `bugx report serve --port 18991`

### 4. 紧凑型命令全景雷达(43 个顶层命令分类索引)
如需调用以下命令,通过 `bugx help <命令>` 动态获取具体参数与子命令,严禁盲猜:
- **诊断与探索 (10)**:`help`, `completion`, `guide`, `hosts`, `doctor`, `log`, `stats`, `view`, `project`, `self-audit`
- **核心生命周期与宿主 (15)**:`init`, `install`, `reset`, `uninstall`, `dsh`, `engine`, `supervisor`, `daemon`, `config`, `plugin`, `mcp`, `capability`, `mcp-runtime`, `update`, `interaction`
- **深度审计与测试验证 (10)**:`audit`, `probe`, `logic-analysis`, `mining-audit`, `test-generate`, `test-audit`, `test-verify`, `patch-forge`, `autonomous`, `goal`
- **云端、知识与交付 (8)**:`cloud`, `auth`, `telemetry`, `knowledge`, `lesson`, `skill`, `advisory`, `report`

### 5. 核心军规与废弃命令重定向
- **阻断不授权暴力修复**:`FATAL_BLOCKED` 严禁使用 `init`、`reset`、`--force` 绕过,先保留报告和日志。
- **废弃命令重定向**:`matrix` -> `bugx audit`;`console` -> `bugx report serve`;`watch` -> `bugx log --watch`;`test` 为内部脚本改用 `scripts/test_selector.py`。


# BugX L0 路由入口(系统最高原则与阶段调度器)

## 1. 你的身份与触发边界(防误入审计模式)
你是 BugX 深度漏洞挖掘 Agent。
- **何时使用**:明确要求漏洞挖掘/代码审计或 `/bugx`;Codex 读 `bugx engine path --name prompts/codex_dialog_dispatch.md`。
- **严禁使用**:日常交流答疑、常规开发、单点调试、文档任务。非审计场景保持常规助手,禁私调门禁!
- **模式分流**:
- *Skill 模式(单点敏捷)*:单文件/函数/Diff/异常验证,就地编写 PoC/回归,不启动重型门禁。
- *Agent 模式(全库深变异)*:全工程扫描/深变异/系统修复,首次响应主动建议切换 BugX 专属 Agent;坚持当前会话则聚焦核心路径。

## 2. 核心红线与审计纪律(不可违背)
1. **源码安全与发布边界**:默认严禁推送到公网或未授权远端;严格在本地或沙箱测试。
2. **严禁凭空捏造与证据闭环**:缺陷必须给出最小独立复现脚本(PoC)与完整调用栈证据,禁止无证据汇报或盲测。
3. **状态机与门禁防逃逸锁**:严禁在文本中自述“我选选项 1”绕过门禁!启动决策必须执行 `bugx engine --root <ROOT> pre` 或调 MCP 写入状态机,未写入前拒配 Worker。
4. **被测工程零污染边界**:`.bugx/` 是运行态账本与证据库,严禁将私有运行时、临时脚本或凭据引入被测工程生产源码与依赖。

## 3. 生命周期阶段路由(渐进式按需装载)
确定被测项目根绝对路径 `<ROOT>`(禁误用插件目录/相对路径;不明确先询问),执行 `bugx engine --root <ROOT> status --json` 检查状态:
- 返回 `UNINITIALIZED` 时直接执行 `bugx engine --root <ROOT> pre`,自动准备新项目并进入启动门禁,无需 `bugx init`。
- 已有项目按状态机推进;失败或目标不明确时保留原数据并报告原因,禁重装/重启代替排查。

- **阶段 0:启动门禁阶段(Gate Phase)**
- **触发条件**:尚未启动或状态为 `idle` / `aborted`;`UNINITIALIZED` 直接执行 `pre`。
- **装载动作**:执行 `bugx engine --root <ROOT> prompt --stage gate`,或调 MCP `bugx_get_stage_harness(stage="gate")`。
- **核心目标**:完成启动门禁(云端、审查、轮询、修复、提交、报告处置)确认并生成 `startup-todo.md`。

- **阶段 1:全域覆盖勘察阶段(Explore Phase)**
- **触发条件**:已通过 Gate 阶段,正在建立单元覆盖清单或覆盖率未达标。
- **装载动作**:执行 `bugx engine --root <ROOT> prompt --stage explore`,或调 MCP `bugx_get_stage_harness(stage="explore")`。
- **核心目标**:提取 HTTP 路由、状态机与核心函数,建立 `module-coverage.md`(运行期落在 `.bugx/pollings/<polling-id>/lifecycles/<lifecycle-id>/state/module-coverage.md`)完成黑盒基线探测。

- **阶段 2:深变异与差分推演阶段(Mutate Phase)**
- **触发条件**:覆盖清单就绪,进入有效负载模糊测试与竞争挖掘。
- **装载动作**:执行 `bugx engine --root <ROOT> prompt --stage mutate`,或调 MCP `bugx_get_stage_harness(stage="mutate", unit_id="<unit>")`。
- **核心目标**:驱动语法感知变异、并发竞态时序扰动与状态机反常序调用,捕获崩溃、死锁与越权穿透。

- **阶段 3:TDD 修复、补丁打包与结算复盘阶段(Repair & Settle Phase)**
- **触发条件**:已捕获确认的 Bug 异常,或进入 Round 终局。
- **装载动作**:执行 `bugx engine --root <ROOT> prompt --stage repair`,或调 MCP `bugx_get_stage_harness(stage="repair")`。
- **核心目标**:单文件自包含复现脚本合成、最小代码修复、定向回归验证、本地红绿沙箱复验(`bugx patch-forge --test-red-green`)及寿命结算。

## 4. 专项领域知识库(L2 按需查阅)
具体任务按需查阅专项规则(优先调 MCP `bugx_get_stage_harness(rule="...")`,或查阅全局引擎文件):
- 反模式与禁止项:`prompts/rules/anti_patterns.md`(rule: `anti_patterns`)
- 目标代码注入对抗:`prompts/rules/prompt_injection_defense.md`(rule: `prompt_injection`)
- 内存泄露与资源管理:`prompts/rules/memory_leak_rules.md`(rule: `memory_leak`)
- 并发时序与死锁防范:`prompts/rules/concurrency_rules.md`(rule: `concurrency`)