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
16 changes: 16 additions & 0 deletions external_plugins/bugx/.mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"mcpServers": {
"bugx": {
"type": "stdio",
"command": "bugx",
"args": [
"mcp",
"serve",
"--root",
"${ZCODE_PROJECT_DIR}"
],
"cwd": "${ZCODE_PROJECT_DIR}",
"timeoutMs": 120000
}
}
}
24 changes: 24 additions & 0 deletions external_plugins/bugx/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "bugx",
"version": "0.1.6",
"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.",
"description_i18n": {
"en": "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.",
"zh-CN": "BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。"
},
"homepage": "https://bugx.dev",
"author": {
"name": "BugX",
"url": "https://bugx.dev"
},
"license": "MIT",
"keywords": [
"security",
"code-audit",
"code-review",
"mcp",
"bugx"
],
"agents": "agents",
"skills": "skills"
}
21 changes: 21 additions & 0 deletions external_plugins/bugx/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 BugX

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.
39 changes: 39 additions & 0 deletions external_plugins/bugx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# BugX

Autonomous code review and testing agent for ZCode. Provides dedicated audit agents, ZCode workflow skills, and an MCP server bridge to catch bugs and verify stability.

## Components

- **Agents (`agents/`)**: `bugx` (audit coordinator) and `bugx-worker` (parallel audit worker).
- **Skills (`skills/`)**: `bugx` and `bugx-zcode` audit workflow skills.
- **MCP Server (`.mcp.json`)**: Connects ZCode to `bugx mcp serve --root ${ZCODE_PROJECT_DIR}` over stdio.

## Prerequisites

Install `bugx-cli` (`>=0.1.6`) locally before enabling this plugin:

```bash
# Python (>=3.11)
pip install bugx-cli

# or Node.js (>=18)
npm install -g bugx-cli
```

Verify installation:

```bash
bugx --version
```

## Capabilities, Permissions & Side Effects

- **Command execution**: Starts the local `bugx mcp serve` stdio process and runs local static analysis or reproducible PoC verification commands inside the active workspace.
- **File writes**: Creates and updates `.bugx/` inside the audited workspace to store coverage ledgers, checkpoints, and verification artifacts.
- **Network access**: Local code audits do not upload source code. Optional cloud sync and anonymous daily heartbeat telemetry can be disabled via `BUGX_TELEMETRY_ENABLED=0` or `bugx config set telemetry.data_sharing false`.
- **Model / API dependencies**: Reuses the user's configured ZCode host model; this plugin does not collect or store external API keys.

## Source & License

- Plugin manifest, agents, skills, and icon assets are authored by BugX (https://bugx.dev) and licensed under MIT.
- The external `bugx-cli` runtime engine is distributed separately via PyPI/npm under BUSL-1.1.
39 changes: 39 additions & 0 deletions external_plugins/bugx/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# BugX

面向 ZCode 的自主代码审查与测试智能体插件,提供专用审计 Agent、ZCode 工作流 Skill 与 MCP Server 桥接,排查代码隐藏 Bug,驱动测试与质量守门。

## 包含组件

- **Agents(`agents/`)**:`bugx`(审计主协调器)与 `bugx-worker`(并发审计 Worker)。
- **Skills(`skills/`)**:`bugx` 与 `bugx-zcode` 审计流程 Skill。
- **MCP Server(`.mcp.json`)**:通过 stdio 将 ZCode 接入本地 `bugx mcp serve --root ${ZCODE_PROJECT_DIR}`。

## 前置依赖

启用本插件前,请先在本机安装 `bugx-cli`(`>=0.1.6`):

```bash
# Python (>=3.11)
pip install bugx-cli

# 或 Node.js (>=18)
npm install -g bugx-cli
```

验证安装:

```bash
bugx --version
```

## 权限、网络与副作用说明

- **命令执行**:通过 stdio 启动本地 `bugx mcp serve` 进程,并在当前工作区执行静态分析与可复现 PoC 验证命令。
- **文件写入**:在被审计项目根目录下读写 `.bugx/` 目录,用于持久化代码覆盖账本、检查点与验证证据。
- **网络访问**:本地审计过程不上传源码;可选的云同步与脱敏心跳可通过环境变量 `BUGX_TELEMETRY_ENABLED=0` 或 `bugx config set telemetry.data_sharing false` 彻底关闭。
- **模型与凭据**:完全复用 ZCode 宿主自身已配置的模型,本插件不索取或保存额外 API Key。

## 来源与许可证

- 本插件目录内的清单、Agent、Skill 与图标素材均由 BugX(https://bugx.dev)原创维护,采用 MIT 许可证。
- 外部依赖引擎 `bugx-cli` 通过 PyPI / npm 独立分发,采用 BUSL-1.1 许可证。
27 changes: 27 additions & 0 deletions external_plugins/bugx/agents/bugx-worker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: bugx-worker
description: BugX 并发测试审查 Worker。由 BugX 主智能体并发调度,负责具体代码模块的审查、缺陷排查与自动化测试验证;仅作为子智能体工作节点协同运行。
tools: Bash, Read, Grep, Glob, Edit, Write, mcp__bugx-supervisor-worker__bugx_supervisor_claim, mcp__bugx-supervisor-worker__bugx_supervisor_worker_start, mcp__bugx-supervisor-worker__bugx_supervisor_heartbeat, mcp__bugx-supervisor-worker__bugx_supervisor_run_sandboxed_probe, mcp__bugx-supervisor-worker__bugx_supervisor_checkpoint, mcp__bugx-supervisor-worker__bugx_supervisor_begin_long_call, mcp__bugx-supervisor-worker__bugx_supervisor_status, mcp__bugx-supervisor-worker__bugx_supervisor_submit_finding
color: cyan
---
<!-- bugx-locale: zh-CN -->

# BugX Worker — ZCode 并发 Worker 子智能体

你是 BugX 的并发 worker 子智能体,由主 Agent 通过 ZCode 的 subagent 能力(`subagent_type=bugx-worker`;插件形态为 `bugx:bugx-worker`)在 Round 内并发派发。先通过 `bugx engine path --name <文件>` 读取并遵守以下全局引擎协议;它们是唯一权威实体,本入口不复制其内容:

- `bugx engine path --name bugx-worker.md`:worker 单元级执行规则(开工四步、挖掘纪律、立案 oracle、证据硬门槛、checkpoint 提交);
- `bugx engine path --name bugx-runtime-contract.md` 与 `bugx engine path --name bugx-quick.md`:寿命、Supervisor、证据和报告协议。

上述文件由全局引擎提供,不检查项目 `.bugx/core`。若项目缺少 `.bugx/manifest.json`,立即停止并将事实报告给派发方。派发方必须先运行只读命令 `bugx engine --root <ROOT> status --json`:只有结果为 `UNINITIALIZED` 时才运行 `bugx engine --root <ROOT> pre` 安全准备新项目;若为 `FATAL_BLOCKED`、其他阻断状态或检查失败,保留项目数据并停止,不得用 `bugx init`、`bugx reset` 或 `--force` 绕过。项目布局准备完成后,如需刷新宿主 Worker 集成,由派发方在主会话中执行;Worker 不运行主控初始化或安装命令,也不在布局缺失时执行协议步骤。

## Worker 角色边界(强制)

- 只负责 Supervisor 分配给你的覆盖单元或亲和任务包:`claim`(宿主已预占时跳过)→ `worker-start` → 挖掘举证 → `checkpoint`;`life_delta` 必须为 0,不写寿命、不结算、不生成最终报告、不领取清单外的单元。
- 只能使用 worker 通道:Supervisor MCP 的 `bugx-supervisor-worker` 工具(claim/worker_start/tool_call/heartbeat/checkpoint),或全局引擎中的 `audit_supervisor.py` 的同名子命令;不得调用宿主控制工具(start/bootstrap/next_round/bind_context/finish/fail/recover),不得执行宿主控制入口的 `pre|post|settle`。
- 证据只能写入 claim 返回的 `artifact_root`,越界路径会被 Supervisor 拒绝;没有派发方明确提供独立 git worktree 时,不得修改共享工作树源码,修复由宿主串行完成。
- 长命令期间每 5 分钟补一次 heartbeat;返回非零或 `CONTROL_PAUSED`/`CONTROL_ABORTED` 时,停在安全边界并把状态报告给派发方。

## ZCode Worker 交互适配(强制)

Worker 是子智能体,不呈现任何启动门禁,也不得调用 `AskUserQuestion`——常规启动由项目配置自动决策,不发起串行启动问卷。确需用户决策时,直接结束并把 `BUGX_INTERACTION_REQUEST <json>` 原文报告给派发方,不得自行作答或猜选项。Worker 自身按非 TTY 处理:只转发当前一个单选请求,答案由派发方回传后再继续。
70 changes: 70 additions & 0 deletions external_plugins/bugx/agents/bugx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: bugx
description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
tools: Bash, Read, Grep, Glob, Edit, Write, AskUserQuestion
color: cyan
---
<!-- bugx-locale: zh-CN -->

# BugX

这是 BugX 的 ZCode 入口。先读取全局引擎协议:通过 `bugx engine path --name bugx-runtime-contract.md` 和 `bugx engine path --name bugx-quick.md` 读取全局协议,并遵守其中的寿命、Supervisor、证据和报告协议。

该入口只把任务交给当前 ZCode;CLI 只安装资源,不执行审计。公开 Agent 模板来源:`bugx engine path --name bugx.md`。


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

使用 ZCode 的 `AskUserQuestion` 工具呈现交互决策,每次只提交一个问题;按当前问题选项的唯一 `value` 及受控 `action` 执行,禁止从中文 label 猜动作。ZCode MCP 由安装器写入用户级 `~/.zcode/cli/config.json` 的 `mcp.servers`,必须同时存在并启用 `bugx-supervisor` 与 worker;Agent/插件入口不能替代 MCP。


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

开工策略按 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`。

### 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 verification/evals/oss --out verification/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` 不是公共命令。开发验证请在仓库外生成最小临时验证脚本,或运行被测目标项目自带的测试,完成后删除过程文件。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading