bugx-cli 0.1.1 → 0.1.2

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.
Files changed (82) hide show
  1. package/README.md +13 -9
  2. package/core/README.md +1 -1
  3. package/core/assets/README.md +3 -2
  4. package/core/assets/bugx-social-preview.svg +71 -0
  5. package/core/assets/bugx-wechat-group.png +0 -0
  6. package/core/audit_packs/README.md +2 -0
  7. package/core/audit_packs/pitfalls/auth_crypto.json +64 -0
  8. package/core/audit_packs/pitfalls/file_ssrf_cmd.json +64 -0
  9. package/core/audit_packs/pitfalls/go_backend.json +66 -0
  10. package/core/audit_packs/pitfalls/java_spring.json +64 -0
  11. package/core/audit_packs/pitfalls/js_ts_web.json +67 -0
  12. package/core/audit_packs/pitfalls/python_web.json +82 -0
  13. package/core/bugx.md +1 -1
  14. package/core/bugx_paths.py +2 -2
  15. package/core/cloud_sync/cloud_client.py +56 -5
  16. package/core/cloud_sync/consent.py +33 -3
  17. package/core/cloud_sync/flywheel_client.py +186 -24
  18. package/core/contracts/README.md +1 -1
  19. package/core/contracts/bugx-runtime-contract.md +1 -1
  20. package/core/contracts/bugx-worker.md +1 -1
  21. package/core/engine-integrity.json +122 -66
  22. package/core/infra/README.md +1 -1
  23. package/core/infra/build_info.py +2 -2
  24. package/core/launch_phases/README.md +6 -3
  25. package/core/launch_phases/finding_confirm_phase.py +168 -7
  26. package/core/launch_phases/post_phase.py +5 -5
  27. package/core/launch_phases/pre_recon_scout.py +13 -0
  28. package/core/launch_phases/report_sharing.py +3 -7
  29. package/core/launch_phases/round_orchestrator.py +114 -26
  30. package/core/launch_phases/semantic_recon.py +545 -0
  31. package/core/launch_phases/startup_version_gate.py +6 -2
  32. package/core/launch_phases/verify_loop.py +767 -0
  33. package/core/launch_phases/worker_prior.py +115 -0
  34. package/core/ledger/README.md +2 -1
  35. package/core/ledger/finding_verification.py +511 -2
  36. package/core/ledger/fp_ledger.py +255 -0
  37. package/core/metadata.txt +2 -2
  38. package/core/planning/README.md +2 -1
  39. package/core/planning/prompt_harness.py +50 -10
  40. package/core/planning/prompt_policy_engine.py +386 -0
  41. package/core/prompts/README.md +4 -2
  42. package/core/prompts/policies/prompt_policies.json +101 -0
  43. package/core/prompts/stages/stage_verify.defensive.md +42 -0
  44. package/core/prompts/stages/stage_verify.md +44 -0
  45. package/core/report_engine/report_share.py +0 -8
  46. package/core/retrieval/README.md +2 -1
  47. package/core/retrieval/pitfall_packs.py +277 -0
  48. package/core/runtime/README.md +1 -1
  49. package/core/runtime/global_telemetry.py +20 -0
  50. package/core/runtime/scenario_eval.py +1 -1
  51. package/core/supervisor/README.md +1 -1
  52. package/docs/07_distribution/01_README_NPM.md +13 -9
  53. package/ecosystem/integrations/dsh/mcp/package.json +1 -1
  54. package/ecosystem/integrations/dsh/ui/package.json +1 -1
  55. package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
  56. package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
  57. package/ecosystem/integrations/qoder/connector-meta.json +1 -1
  58. package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
  59. package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
  60. package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
  61. package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
  62. package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
  63. package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
  64. package/interfaces/bin/bugx.js +7 -7
  65. package/interfaces/cli/bugx_cli/__init__.py +2 -2
  66. package/interfaces/cli/bugx_cli/cli.py +163 -67
  67. package/interfaces/cli/bugx_cli/commands/agent.py +122 -61
  68. package/interfaces/cli/bugx_cli/commands/audit.py +8 -7
  69. package/interfaces/cli/bugx_cli/commands/cloud.py +27 -19
  70. package/interfaces/cli/bugx_cli/commands/knowledge.py +3 -4
  71. package/interfaces/cli/bugx_cli/commands/plugin.py +3 -3
  72. package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
  73. package/interfaces/cli/bugx_cli/commands/project.py +6 -13
  74. package/interfaces/cli/bugx_cli/commands/system.py +513 -158
  75. package/interfaces/cli/bugx_cli/common.py +6 -8
  76. package/interfaces/cli/bugx_cli/infra/engine_installer.py +21 -10
  77. package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
  78. package/package.json +29 -15
  79. package/pyproject.toml +40 -1
  80. package/scripts/sync-version.mjs +1 -1
  81. package/core/assets/bugx-hero-cn.png +0 -0
  82. package/core/assets/bugx-hero-en.png +0 -0
@@ -0,0 +1,277 @@
1
+ #!/usr/bin/env python3
2
+ """core/retrieval/pitfall_packs.py — 按技术栈按需挂载的冷启动漏洞先验包检索引擎(P1 / T-005)。
3
+
4
+ 零第三方依赖实现:
5
+ 1. 加载并校验 ``core/audit_packs/pitfalls/*.json``;
6
+ 2. 基于 ``project_profile``(``languages`` / ``frameworks`` / ``surfaces``)及可选文件扩展名
7
+ 执行技术栈硬过滤,杜绝跨语言噪声污染;
8
+ 3. 双路倒数排名融合(RRF):通道 A(技术栈与严重度先验)+ 通道 B(源码反模式信号命中度);
9
+ 4. 严格按 ``char_budget`` 渲染紧凑引导块供 ``worker_prior`` 注入。
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import json
15
+ from dataclasses import dataclass
16
+ from pathlib import Path
17
+ from typing import Any, Mapping, Sequence
18
+
19
+ DEFAULT_PITFALLS_DIR = Path(__file__).resolve().parents[1] / "audit_packs" / "pitfalls"
20
+ RRF_K = 60.0
21
+
22
+ _REQUIRED_FIELDS = (
23
+ "pitfall_id",
24
+ "cwe",
25
+ "severity",
26
+ "languages",
27
+ "frameworks",
28
+ "surfaces",
29
+ "title",
30
+ "anti_pattern_signals",
31
+ "false_positive_guards",
32
+ "poc_skeleton",
33
+ )
34
+
35
+ _SEVERITY_WEIGHT = {
36
+ "critical": 4.0,
37
+ "high": 3.0,
38
+ "medium": 2.0,
39
+ "low": 1.0,
40
+ }
41
+
42
+ _EXT_TO_LANGUAGE = {
43
+ ".py": "python",
44
+ ".pyi": "python",
45
+ ".js": "javascript",
46
+ ".mjs": "javascript",
47
+ ".cjs": "javascript",
48
+ ".jsx": "javascript",
49
+ ".ts": "typescript",
50
+ ".tsx": "typescript",
51
+ ".go": "go",
52
+ ".java": "java",
53
+ ".kt": "kotlin",
54
+ ".kts": "kotlin",
55
+ }
56
+
57
+
58
+ class PitfallPackError(ValueError):
59
+ """Raised when a pitfall pack JSON violates schema requirements."""
60
+
61
+
62
+ @dataclass(frozen=True)
63
+ class PitfallEntry:
64
+ pack_id: str
65
+ pitfall_id: str
66
+ cwe: str
67
+ severity: str
68
+ languages: tuple[str, ...]
69
+ frameworks: tuple[str, ...]
70
+ surfaces: tuple[str, ...]
71
+ title: str
72
+ anti_pattern_signals: tuple[str, ...]
73
+ false_positive_guards: tuple[str, ...]
74
+ poc_skeleton: str
75
+
76
+ def to_dict(self) -> dict[str, Any]:
77
+ return {
78
+ "pack_id": self.pack_id,
79
+ "pitfall_id": self.pitfall_id,
80
+ "cwe": self.cwe,
81
+ "severity": self.severity,
82
+ "languages": list(self.languages),
83
+ "frameworks": list(self.frameworks),
84
+ "surfaces": list(self.surfaces),
85
+ "title": self.title,
86
+ "anti_pattern_signals": list(self.anti_pattern_signals),
87
+ "false_positive_guards": list(self.false_positive_guards),
88
+ "poc_skeleton": self.poc_skeleton,
89
+ }
90
+
91
+
92
+ def _norm_tokens(values: object) -> tuple[str, ...]:
93
+ if isinstance(values, str):
94
+ values = [values]
95
+ if not isinstance(values, Sequence) or isinstance(values, (str, bytes)):
96
+ return ()
97
+ out: list[str] = []
98
+ for item in values:
99
+ if isinstance(item, str) and item.strip():
100
+ norm = item.strip().lower()
101
+ if norm not in out:
102
+ out.append(norm)
103
+ return tuple(out)
104
+
105
+
106
+ def load_pitfall_packs(packs_dir: Path | None = None) -> tuple[PitfallEntry, ...]:
107
+ """Load and strictly validate all cold-start pitfall JSON packs."""
108
+ root = Path(packs_dir) if packs_dir is not None else DEFAULT_PITFALLS_DIR
109
+ if not root.is_dir():
110
+ raise PitfallPackError(f"pitfall packs directory not found: {root}")
111
+ entries: list[PitfallEntry] = []
112
+ seen_ids: set[str] = set()
113
+ for path in sorted(root.glob("*.json")):
114
+ try:
115
+ payload = json.loads(path.read_text(encoding="utf-8"))
116
+ except (OSError, ValueError) as exc:
117
+ raise PitfallPackError(f"invalid pitfall pack JSON {path.name}: {exc}") from exc
118
+ if not isinstance(payload, Mapping) or not isinstance(payload.get("pitfalls"), list):
119
+ raise PitfallPackError(f"{path.name} must contain a 'pitfalls' list")
120
+ pack_id = str(payload.get("pack_id") or path.stem).strip()
121
+ for raw in payload["pitfalls"]:
122
+ if not isinstance(raw, Mapping):
123
+ raise PitfallPackError(f"{path.name} contains non-object pitfall entry")
124
+ missing = [f for f in _REQUIRED_FIELDS if not raw.get(f)]
125
+ if missing:
126
+ raise PitfallPackError(f"{path.name} entry missing required fields: {missing}")
127
+ pid = str(raw["pitfall_id"]).strip()
128
+ if pid in seen_ids:
129
+ raise PitfallPackError(f"duplicate pitfall_id detected: {pid}")
130
+ seen_ids.add(pid)
131
+ entries.append(
132
+ PitfallEntry(
133
+ pack_id=pack_id,
134
+ pitfall_id=pid,
135
+ cwe=str(raw["cwe"]).strip(),
136
+ severity=str(raw["severity"]).strip().lower(),
137
+ languages=_norm_tokens(raw["languages"]),
138
+ frameworks=_norm_tokens(raw["frameworks"]),
139
+ surfaces=_norm_tokens(raw["surfaces"]),
140
+ title=str(raw["title"]).strip(),
141
+ anti_pattern_signals=tuple(
142
+ str(s) for s in raw["anti_pattern_signals"] if isinstance(s, str) and s.strip()
143
+ ),
144
+ false_positive_guards=tuple(
145
+ str(g).strip() for g in raw["false_positive_guards"] if isinstance(g, str) and g.strip()
146
+ ),
147
+ poc_skeleton=str(raw["poc_skeleton"]).strip(),
148
+ )
149
+ )
150
+ return tuple(entries)
151
+
152
+
153
+ def _infer_languages_from_path(file_path: str) -> set[str]:
154
+ if not file_path:
155
+ return set()
156
+ ext = Path(file_path).suffix.lower()
157
+ lang = _EXT_TO_LANGUAGE.get(ext)
158
+ return {lang} if lang else set()
159
+
160
+
161
+ def match_pitfalls(
162
+ profile: Mapping[str, Any] | None = None,
163
+ *,
164
+ code_text: str = "",
165
+ file_path: str = "",
166
+ limit: int = 6,
167
+ packs_dir: Path | None = None,
168
+ ) -> list[dict[str, Any]]:
169
+ """Retrieve Top-K stack-matched cold-start pitfalls via dual-channel RRF."""
170
+ if limit <= 0:
171
+ return []
172
+ entries = load_pitfall_packs(packs_dir=packs_dir)
173
+ prof = profile if isinstance(profile, Mapping) else {}
174
+ langs = set(_norm_tokens(prof.get("languages"))) | _infer_languages_from_path(file_path)
175
+ frameworks = set(_norm_tokens(prof.get("frameworks")))
176
+ surfaces = set(_norm_tokens(prof.get("surfaces")))
177
+ code_lower = (code_text or "").lower()
178
+
179
+ # 1. Hard stack filter (prevent cross-language contamination)
180
+ eligible: list[tuple[PitfallEntry, float, int, list[str]]] = []
181
+ for entry in entries:
182
+ is_generic = "*" in entry.languages
183
+ if not is_generic:
184
+ if langs and not (langs & set(entry.languages)):
185
+ continue
186
+ if not langs and frameworks and not (frameworks & set(entry.frameworks)):
187
+ continue
188
+
189
+ matched_signals = [
190
+ sig for sig in entry.anti_pattern_signals
191
+ if sig.lower() in code_lower
192
+ ]
193
+ # Generic cross-language packs require surface or signal match to avoid noise
194
+ if is_generic and not matched_signals and not (surfaces & set(entry.surfaces)):
195
+ continue
196
+
197
+ fw_overlap = len(frameworks & set(entry.frameworks)) if "*" not in entry.frameworks else 0
198
+ surf_overlap = len(surfaces & set(entry.surfaces))
199
+ lang_bonus = 2.0 if (not is_generic and (langs & set(entry.languages))) else 0.5
200
+ prior_score = (
201
+ _SEVERITY_WEIGHT.get(entry.severity, 1.0)
202
+ + lang_bonus
203
+ + (fw_overlap * 2.5)
204
+ + (surf_overlap * 1.0)
205
+ )
206
+ eligible.append((entry, prior_score, len(matched_signals), matched_signals))
207
+
208
+ if not eligible:
209
+ return []
210
+
211
+ # 2. Dual-channel RRF fusion (Channel A: stack prior, Channel B: code signal hits)
212
+ rank_prior = {
213
+ item[0].pitfall_id: idx
214
+ for idx, item in enumerate(
215
+ sorted(eligible, key=lambda x: (-x[1], x[0].pitfall_id)), 1
216
+ )
217
+ }
218
+ rank_signal = {
219
+ item[0].pitfall_id: idx
220
+ for idx, item in enumerate(
221
+ sorted(eligible, key=lambda x: (-x[2], -x[1], x[0].pitfall_id)), 1
222
+ )
223
+ }
224
+
225
+ fused: list[tuple[float, PitfallEntry, list[str]]] = []
226
+ for entry, _prior, sig_hits, matched_signals in eligible:
227
+ pid = entry.pitfall_id
228
+ # Give signal hits higher fusion weight when code_text is supplied
229
+ w_sig = 1.6 if sig_hits > 0 else 0.6
230
+ rrf_score = (1.0 / (RRF_K + rank_prior[pid])) + (w_sig / (RRF_K + rank_signal[pid]))
231
+ fused.append((rrf_score, entry, matched_signals))
232
+
233
+ fused.sort(key=lambda x: (-x[0], x[1].pitfall_id))
234
+ results: list[dict[str, Any]] = []
235
+ for score, entry, matched_signals in fused[:limit]:
236
+ item = entry.to_dict()
237
+ item["rrf_score"] = round(score, 6)
238
+ item["matched_signals"] = matched_signals
239
+ results.append(item)
240
+ return results
241
+
242
+
243
+ def render_pitfall_guidance(
244
+ matches: Sequence[Mapping[str, Any]],
245
+ *,
246
+ char_budget: int = 1800,
247
+ ) -> str:
248
+ """Render compact, budget-bounded cold-start pitfall guidance for Worker prompts."""
249
+ if not matches or char_budget <= 0:
250
+ return ""
251
+ lines: list[str] = ["[冷启动漏洞先验雷达 (Cold-Start Pitfalls)]"]
252
+ used = len(lines[0]) + 1
253
+ for item in matches:
254
+ signals = ", ".join(item.get("matched_signals") or ())
255
+ sig_note = f" | 命中信号: {signals}" if signals else ""
256
+ guard = (item.get("false_positive_guards") or [""])[0]
257
+ block = (
258
+ f"- [{item.get('pitfall_id')} / {item.get('cwe')} / {str(item.get('severity', '')).upper()}] "
259
+ f"{item.get('title')}{sig_note}\n"
260
+ f" 排除条件: {guard}\n"
261
+ f" PoC思路: {item.get('poc_skeleton')}"
262
+ )
263
+ if used + len(block) + 1 > char_budget:
264
+ break
265
+ lines.append(block)
266
+ used += len(block) + 1
267
+ return "\n".join(lines) if len(lines) > 1 else ""
268
+
269
+
270
+ __all__ = [
271
+ "DEFAULT_PITFALLS_DIR",
272
+ "PitfallPackError",
273
+ "PitfallEntry",
274
+ "load_pitfall_packs",
275
+ "match_pitfalls",
276
+ "render_pitfall_guidance",
277
+ ]
@@ -1,6 +1,6 @@
1
1
  # BugX Core Runtime Subsystem (核心运行时、环境与基础设施)
2
2
 
3
- > **版本契约**: `0.1.1` | **所属分层**: `Layer 0: 基础设施与操作系统抽象`
3
+ > **版本契约**: `0.1.2` | **所属分层**: `Layer 0: 基础设施与操作系统抽象`
4
4
  > **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
5
5
  > **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
6
6
 
@@ -26,6 +26,22 @@ TELEMETRY_SCHEMA_VERSION = 3
26
26
  logger = logging.getLogger("bugx.telemetry")
27
27
 
28
28
 
29
+ def _telemetry_allowed() -> bool:
30
+ """Use the same user/process gate as remote telemetry.
31
+
32
+ Local statistics are still queryable after opt-out, but no new rows are
33
+ written once the unified telemetry switch is disabled. A missing gate is
34
+ treated as disabled here: recording telemetry must never bypass an
35
+ explicit privacy boundary because an optional import failed.
36
+ """
37
+ try:
38
+ from core.cloud_sync.consent import telemetry_enabled
39
+
40
+ return bool(telemetry_enabled())
41
+ except Exception: # noqa: BLE001 - privacy gate fails closed
42
+ return False
43
+
44
+
29
45
  def _get_db_path(override_path: Path | str | None = None) -> Path:
30
46
  if override_path:
31
47
  return Path(override_path).expanduser().resolve()
@@ -216,6 +232,8 @@ def record_round_telemetry(round_data: Mapping[str, Any], db_path: Path | str |
216
232
  """写入单轮次细粒度遥测记录,并原子累加当日消耗 (fail-open,不抛出异常打断审计)。"""
217
233
  if not isinstance(round_data, Mapping) or not round_data:
218
234
  return False
235
+ if not _telemetry_allowed():
236
+ return False
219
237
  try:
220
238
  init_db(db_path)
221
239
  session_id = str(round_data.get("session_id") or round_data.get("run_id") or "standalone")
@@ -288,6 +306,8 @@ def record_session_telemetry(session_data: Mapping[str, Any], db_path: Path | st
288
306
  """写入 Session 级最终汇总记录,并原子更新当日汇总 daily_rollup (fail-open)。"""
289
307
  if not isinstance(session_data, Mapping) or not session_data:
290
308
  return False
309
+ if not _telemetry_allowed():
310
+ return False
291
311
  try:
292
312
  init_db(db_path)
293
313
  session_id = str(session_data.get("session_id") or f"sess-{dt.datetime.now().strftime('%Y%m%d%H%M%S')}")
@@ -141,7 +141,7 @@ def _run(argv: list[str], *, cwd: Path, timeout: float = 120.0,
141
141
  # L3 等场景验证当前 checkout;不让已安装的旧引擎成为量具。
142
142
  merged["BUGX_DEV_MODE"] = "1"
143
143
  # 源码树里的版本声明是构建模板;开发态启动门禁需要同一解析值。
144
- merged["BUGX_VERSION"] = os.environ.get("BUGX_VERSION", "0.1.1")
144
+ merged["BUGX_VERSION"] = os.environ.get("BUGX_VERSION", "0.1.2")
145
145
  merged["HOME"] = str(_sandbox_home())
146
146
  try:
147
147
  proc = subprocess.run(
@@ -1,6 +1,6 @@
1
1
  # BugX Supervisor (并发协调与智能体调度仲裁中心)
2
2
 
3
- > **版本契约**: `0.1.1` | **所属分层**: `Layer 3: 并发协调、智能体编排与账本`
3
+ > **版本契约**: `0.1.2` | **所属分层**: `Layer 3: 并发协调、智能体编排与账本`
4
4
  > **工程规范**: 参见 [`docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md`](../../docs/02_architecture/05_ARCH_NOMENCLATURE_GUIDE.md)
5
5
  > **守卫机制**: `scripts/verify_directory_indices.py` (100% 物理条目索引覆盖)
6
6
 
@@ -2,11 +2,11 @@
2
2
  <img src="https://raw.githubusercontent.com/Bencibr/bugx/main/core/assets/bugx-hero-en.svg" alt="BugX — effortless audits of AI-written code" width="1000">
3
3
  </p>
4
4
 
5
- # BugX — AI Code Audit Agent for Claude Code, Codex, Cline, OpenCode, and ZCode
5
+ # BugX — AI Code Audit & Code Review Agent for Claude Code, Codex, Cline, OpenCode, and ZCode
6
6
 
7
- BugX is an autonomous code-audit agent that runs inside your AI coding assistant or on the command line. It audits AI-written code end to end: it builds a coverage list of your project, dispatches concurrent audit workers, verifies every candidate finding with real executions, and produces a report where each finding ships with a command you can run yourself to reproduce it.
7
+ BugX is an autonomous code-audit and automated code review agent that runs inside your AI coding assistant or on the command line. It audits AI-written code end to end: it builds a coverage list of your project, dispatches concurrent audit workers, verifies every candidate finding with real executions, and produces an actionable report where each finding ships with a command you can run yourself to reproduce it.
8
8
 
9
- If you use AI coding tools to write production code, BugX is the security audit and code review layer that checks what the model actually delivered — not what it claims to have delivered.
9
+ If you use AI coding tools to write production code, BugX is the automated code review and security audit agent that checks what the model actually delivered — not what it claims to have delivered.
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/bugx-cli"><img src="https://img.shields.io/npm/v/bugx-cli.svg?style=flat&color=0284c7&label=npm" alt="npm version"></a>
@@ -42,7 +42,8 @@ BugX counters this with a ledger and four hard rules: a per-unit coverage list (
42
42
  - **Functionality review** — a behavior diff: the same inputs go to your implementation and a reference implementation, and the differences are reported.
43
43
  - **Performance and memory checks** — performance and resource defects, plus dedicated memory inspection for native, Python, JVM, Electron, Android, and Apple targets.
44
44
  - **UI audit** — layout, contrast, keyboard paths, and design tokens on a running web page (`bugx probe ui`).
45
- - **Reproducible findings** — every vulnerability ships with a command or input you can run yourself; all three verification runs (two positive, one negative control) stay on record.
45
+ - **Reproducible findings & blind verification** — every vulnerability is blind-reviewed by an independent verifier with a reproduction command or PoC; verified with AST negative control assertions; refuted cases are logged to the FP Ledger.
46
+ - **Prompt Policy Engine** — declarative prompt profiles adapt to model-specific safety filters (e.g. OpenAI Cyber Risk / Daybreak) without losing code fidelity.
46
47
  - **Mutation-verified tests** — `bugx test-verify` mutates your code to check whether the tests actually catch the bugs.
47
48
  - **Patch bundles** — `bugx patch-forge` builds a patch with static checks and hands it to you for review; it never commits on its own.
48
49
  - **Lessons base and unattended runs** — `bugx lesson` / `bugx knowledge` accumulate project and global experience; `bugx autonomous` and `bugx goal` run end-to-end audits without supervision.
@@ -174,7 +175,10 @@ DeepSeek Harness (DSH), WorkBuddy, Cursor / Windsurf, and more are being adapted
174
175
  An autonomous code-audit agent for AI-written code. It runs inside AI coding assistants (via MCP) or as a CLI, tracks audit coverage per unit, and verifies every finding by executing it.
175
176
 
176
177
  **How does BugX verify a vulnerability?**
177
- Every candidate runs through the engine's verification channel: the same attack input must reproduce the finding twice, and a clean input must produce nothing. All three executions are recorded with commands, exit codes, and artifact hashes.
178
+ Rather than trusting the proposing model's self-report, findings are independently blind-reviewed: an attack input must reliably trigger the vulnerability twice, and a clean input must trigger zero times (two positive runs, one negative control) recorded with command, exit code, and artifact hashes, verified by AST syntax assertions. Refuted findings are recorded in the FP Ledger.
179
+
180
+ **Does BugX trigger AI model cyber-security risk blocks?**
181
+ BugX includes a declarative Prompt Policy Engine with adaptive prompt profiles (e.g., defensive QA phrasing for OpenAI Codex / GPT-4o) that prevents models from triggering platform Daybreak / Cyber Risk safety blocks, while preserving 100% of the underlying code and CWE details.
178
182
 
179
183
  **Does BugX send my code to the cloud?**
180
184
  The audit itself runs locally. Cloud sync of lessons and experience is an explicit opt-in; nothing is uploaded unless you run it.
@@ -187,7 +191,7 @@ Multi-language static and behavioral analysis (Python, JavaScript/TypeScript, Ja
187
191
 
188
192
  ### Keywords
189
193
 
190
- ai code audit · ai code review · code review agent · security audit · vulnerability scanner · sast · static analysis · mcp server · mcp security · claude code · openai codex · opencode · cline · roo code · zcode · coding agent · llm code review · autonomous audit · behavior diff · memory leak detection · python security · javascript security · devsecops
194
+ vibe coding · vibe coding security · pr review · pull request review · zero false positive · poc generator · mcp security · automated code audit · ai code audit · automated code review · code review agent · ai agent · security audit · vulnerability scanner · vulnerability mining · sast · static analysis · mcp server · claude code · openai codex · opencode · cline · roo code · zcode · coding agent · llm code review · autonomous audit · behavior diff · memory leak detection · python security · javascript security · devsecops
191
195
 
192
196
  ---
193
197
 
@@ -195,9 +199,9 @@ ai code audit · ai code review · code review agent · security audit · vulner
195
199
 
196
200
  ### 什么是 BugX?
197
201
 
198
- BugX 是装进 AI 编程助手的代码审计 Agent。它对 AI 写出的代码做端到端审计:把项目拆成覆盖清单、派发并发审计 Worker、对每条候选漏洞做真实执行验证,最终产出一份报告——每条漏洞都附带一条你可以亲手运行的复现命令。
202
+ BugX 是装进 AI 编程助手的**自动代码审计与自动化 Code Review 智能体(Agent)**。它对 AI 写出的代码做端到端自动化审计与代码审查:把项目拆成覆盖清单、派发并发审计 Worker、对每条候选漏洞做真实执行验证,最终产出一份详实的审计报告——每条漏洞都附带一条你可以亲手运行的复现命令。
199
203
 
200
- 如果你的生产代码来自 AI 编程工具,BugX 就是那个安全审计与代码审查层:它核查模型**实际交付了什么**,而不是模型**声称交付了什么**。
204
+ 如果你的生产代码来自 AI 编程工具,BugX 就是那个专注于**自动代码审计**、**Code Review** 与安全加固的智能体层:它核查模型**实际交付了什么**,而不是模型**声称交付了什么**。
201
205
 
202
206
  ### 为什么 AI 代码需要审计
203
207
 
@@ -278,7 +282,7 @@ DeepSeek Harness(DSH)、WorkBuddy、Cursor / Windsurf 等持续适配中。
278
282
 
279
283
  ### 关键词
280
284
 
281
- AI 代码审计 · AI 代码审查 · 代码审查 Agent · 安全审计 · 漏洞扫描 · 静态分析 · MCP 服务 · Claude Code 审计 · Codex 审计 · 编程助手安全 · 自主审计 · 行为差分 · 内存泄漏检测 · Python 安全 · JavaScript 安全
285
+ 自动代码审计 · AI 代码审计 · 自动化 Code Review · Code Review · 代码审查 Agent · 代码审计智能体 · AI Agent · Vibe Coding 安全 · 氛围编程审计 · PR 自动审查 · 零误报 · 真实 PoC 复现 · 盲审验证 · 安全审计 · 漏洞扫描 · 漏洞挖掘 · 静态分析 · MCP 服务 · MCP 安全 · Claude Code 审计 · Codex 审计 · 编程助手安全 · 自主审计 · 行为差分 · 内存泄漏检测 · Python 安全 · JavaScript 安全 · DevSecOps
282
286
 
283
287
  ## License
284
288
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bencibro/bugx-dsh-mcp-client",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Session-aware BugX MCP bridge for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bencibro/bugx-dsh-ui",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "BugX branding and Sidebar icon for DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "name": "bugx-built-in-mcp",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "servers": {
6
6
  "bugx-supervisor": {
7
7
  "type": "builtin",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "name": "bugx-pi",
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "host": "pi",
6
6
  "kind": "extension",
7
7
  "entry": "index.ts",
@@ -7,7 +7,7 @@
7
7
  "description_en": "An autonomous agent dedicated to code review, vulnerability hunting, and automated bug fixing. Built for deep investigations, BugX steps in when you are wrapping up a feature, opening a pull request, or hunting down an elusive bug. It analyzes code logic, automatically writes test cases to uncover and reproduce hidden flaws, and delivers verified patches that resolve root causes. Always safeguarding your code quality and security.",
8
8
  "source": "bugx-agent",
9
9
  "type": "mcp-connector",
10
- "version": "0.1.1",
10
+ "version": "0.1.2",
11
11
  "homepage": "https://bugx.dev",
12
12
  "website": "https://bugx.dev",
13
13
  "examples_zh": [
@@ -7,7 +7,7 @@
7
7
  "description_en": "Use BugX to discover, reproduce, verify, and report real bugs.",
8
8
  "source": "bugx-agent",
9
9
  "type": "skill-only",
10
- "version": "0.1.1",
10
+ "version": "0.1.2",
11
11
  "examples_zh": [
12
12
  "检查这个项目中是否存在真实漏洞",
13
13
  "复现并验证这个 BugX 发现的问题"
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: bugx
3
3
  description: Use BugX to find, reproduce, verify, fix, and report bugs in an app or codebase.
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  author: BugX
6
6
  ---
7
7
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "bugx_build_id": 98,
5
5
  "description": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
6
6
  "author": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
5
5
  "skills": "./skills/",
6
6
  "homepage": "https://bugx.dev",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bugx",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Autonomous code review and vulnerability hunting agent that uncovers, reproduces, and fixes deep bugs.",
5
5
  "homepage": "https://bugx.dev",
6
6
  "author": {
@@ -2,7 +2,7 @@
2
2
  name: bugx
3
3
  description: 专注于代码质量与安全的自主审查智能体。专为深层缺陷排查而生——在功能写完、提 PR 或排查疑难 Bug 时,它能深入分析代码逻辑,自动编写测试用例,挖掘、复现Bug和漏洞,生成经过验证的修复补丁。随时为您的代码质量和代码安全把关。
4
4
  metadata:
5
- bugx_version: "0.1.1"
5
+ bugx_version: "0.1.2"
6
6
  ---
7
7
  <!-- bugx-locale: zh-CN -->
8
8
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  BugX ChatGPT Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。
12
12
 
13
- 协议镜像版本:0.1.1
13
+ 协议镜像版本:0.1.2
14
14
 
15
15
  ## ChatGPT 原生交互适配(强制)
16
16
 
@@ -58,16 +58,16 @@ function resolvePython() {
58
58
  // 直接读 metadata.txt 应 <50ms,耗时账目 W-001)
59
59
  {
60
60
  const argv = process.argv.slice(2);
61
- if (argv.some((a) => a === '--version' || a === '-V')) {
61
+ if (argv.length === 1 && argv[0] === '--version') {
62
62
  try {
63
63
  const meta = readFileSync(join(pkgRoot, 'core', 'metadata.txt'), 'utf8');
64
- const ver = (meta.match(/^bugx_version:\s*"([^"]+)"/m) || [])[1] || '0.1.0';
64
+ const ver = (meta.match(/^bugx_version:\s*"([^"]+)"/m) || [])[1];
65
65
  const bid = (meta.match(/^build_id:\s*(\d+)/m) || [])[1];
66
- console.log(`bugx ${ver}${bid ? `+build.${bid}` : ''}`);
67
- } catch {
68
- console.log('bugx 0.1.0');
69
- }
70
- process.exit(0);
66
+ if (ver && bid) {
67
+ console.log(`bugx ${ver}+build.${bid}`);
68
+ process.exit(0);
69
+ }
70
+ } catch { /* let the Python entry point report its authoritative version */ }
71
71
  }
72
72
  }
73
73
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  import os
4
4
 
5
- __version__ = os.environ.get("BUGX_VERSION", "0.1.1")
6
- __build_id__: int = 9
5
+ __version__ = os.environ.get("BUGX_VERSION", "0.1.2")
6
+ __build_id__: int = 11