bugx-cli 0.1.1 → 0.1.3
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.
- package/README.md +36 -35
- package/core/README.md +1 -1
- package/core/agent/agent_orchestrator.py +3 -0
- package/core/agent/agent_workspace.py +14 -2
- package/core/assets/README.md +3 -2
- package/core/assets/bugx-social-preview.svg +71 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/twitter_promo_art.jpg +0 -0
- package/core/assets/twitter_promo_card.svg +166 -0
- package/core/assets/twitter_promo_clean.jpg +0 -0
- package/core/assets/twitter_terminal_real.png +0 -0
- package/core/audit_packs/README.md +2 -0
- package/core/audit_packs/pitfalls/auth_crypto.json +64 -0
- package/core/audit_packs/pitfalls/file_ssrf_cmd.json +64 -0
- package/core/audit_packs/pitfalls/go_backend.json +66 -0
- package/core/audit_packs/pitfalls/java_spring.json +64 -0
- package/core/audit_packs/pitfalls/js_ts_web.json +67 -0
- package/core/audit_packs/pitfalls/python_web.json +82 -0
- package/core/bugx.md +2 -2
- package/core/bugx_paths.py +2 -2
- package/core/cli-help.txt +1 -1
- package/core/cloud_sync/cloud_client.py +56 -5
- package/core/cloud_sync/consent.py +33 -3
- package/core/cloud_sync/flywheel_client.py +186 -24
- package/core/contracts/README.md +1 -1
- package/core/contracts/bugx-opencode.md +1 -1
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +191 -95
- package/core/host_acp/kimi.py +175 -0
- package/core/host_acp/minimax.py +28 -0
- package/core/host_runtime/host_registry.py +23 -3
- package/core/hosts/dsh.py +1 -1
- package/core/hosts/kimi.py +293 -0
- package/core/hosts/minimax.py +248 -0
- package/core/hosts/zcode.py +5 -0
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +30 -5
- package/core/launch_phases/README.md +6 -3
- package/core/launch_phases/finding_confirm_phase.py +168 -7
- package/core/launch_phases/post_phase.py +5 -5
- package/core/launch_phases/pre_recon_scout.py +13 -0
- package/core/launch_phases/report_sharing.py +3 -7
- package/core/launch_phases/round_orchestrator.py +114 -26
- package/core/launch_phases/semantic_recon.py +545 -0
- package/core/launch_phases/startup_version_gate.py +6 -2
- package/core/launch_phases/supervisor_bridge.py +14 -23
- package/core/launch_phases/verify_loop.py +767 -0
- package/core/launch_phases/worker_prior.py +115 -0
- package/core/ledger/README.md +2 -1
- package/core/ledger/finding_verification.py +511 -2
- package/core/ledger/fp_ledger.py +255 -0
- package/core/metadata.txt +2 -2
- package/core/planning/README.md +2 -1
- package/core/planning/prompt_harness.py +50 -10
- package/core/planning/prompt_policy_engine.py +386 -0
- package/core/prompts/README.md +4 -2
- package/core/prompts/policies/prompt_policies.json +101 -0
- package/core/prompts/stages/stage_verify.defensive.md +42 -0
- package/core/prompts/stages/stage_verify.md +44 -0
- package/core/report_engine/report_share.py +0 -8
- package/core/retrieval/README.md +2 -1
- package/core/retrieval/pitfall_packs.py +277 -0
- package/core/runtime/README.md +1 -1
- package/core/runtime/global_telemetry.py +20 -0
- package/core/runtime/scenario_eval.py +1 -1
- package/core/runtime/setup_ui_env.py +4 -7
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/cli.py +2 -2
- package/core/webui/mcp_inspector.py +6 -0
- package/core/webui/static/index.html +51 -3
- package/core/webui/static/manifest.webmanifest +1 -1
- package/core/webui/static/project-settings.js +18 -3
- package/core/webui/static/robots.txt +36 -0
- package/core/webui/static/sitemap.xml +15 -0
- package/docs/07_distribution/01_README_NPM.md +36 -35
- package/ecosystem/integrations/cline/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/agents/bugx.md +1 -1
- package/ecosystem/integrations/dsh/dsh-patch.yml +2 -2
- package/ecosystem/integrations/dsh/mcp/package.json +1 -1
- package/ecosystem/integrations/dsh/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/integrations/dsh/ui/package.json +1 -1
- package/ecosystem/integrations/opencode/bugx-mcp-manifest.json +1 -1
- package/ecosystem/integrations/pi/extensions/bugx/manifest.json +1 -1
- package/ecosystem/integrations/pi/skills/bugx/SKILL.md +1 -1
- package/ecosystem/integrations/qoder/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/connector-meta.json +9 -9
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/marketplace.json +2 -2
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +4 -4
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +2 -2
- package/ecosystem/plugins/bugx/agents/bugx-worker.md +1 -1
- package/ecosystem/plugins/bugx/agents/bugx.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +3 -3
- package/ecosystem/plugins/bugx/skills/bugx-claude/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-dsh/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-opencode/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/skills/bugx-zcode/SKILL.md +1 -1
- package/interfaces/bin/bugx.js +9 -7
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +178 -67
- package/interfaces/cli/bugx_cli/commands/agent.py +313 -127
- package/interfaces/cli/bugx_cli/commands/audit.py +8 -7
- package/interfaces/cli/bugx_cli/commands/cloud.py +27 -19
- package/interfaces/cli/bugx_cli/commands/doctor.py +18 -0
- package/interfaces/cli/bugx_cli/commands/knowledge.py +3 -4
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +54 -47
- package/interfaces/cli/bugx_cli/commands/plugin.py +9 -9
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +27 -13
- package/interfaces/cli/bugx_cli/commands/plugin_kimi.py +348 -0
- package/interfaces/cli/bugx_cli/commands/plugin_minimax.py +322 -0
- package/interfaces/cli/bugx_cli/commands/plugin_qoder.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +4 -5
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/system.py +577 -162
- package/interfaces/cli/bugx_cli/common.py +102 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +150 -4
- package/interfaces/cli/bugx_cli/hosts/registry.py +4 -2
- package/interfaces/cli/bugx_cli/hosts/template_engine.py +10 -9
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +21 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +2 -2
- package/package.json +54 -16
- package/pyproject.toml +64 -1
- package/scripts/sync-version.mjs +1 -1
- package/skills/README.md +25 -0
- package/skills/platform/bugx-user/SKILL.md +92 -0
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
|
@@ -618,15 +618,16 @@ def _command_audit_penetration(args: argparse.Namespace) -> int:
|
|
|
618
618
|
|
|
619
619
|
|
|
620
620
|
def command_audit(args: argparse.Namespace) -> int:
|
|
621
|
-
"""
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
621
|
+
"""Select the existing deep route only when explicitly requested."""
|
|
622
|
+
if getattr(args, "deep", False):
|
|
623
|
+
return _command_audit_penetration(args)
|
|
624
|
+
if (
|
|
625
|
+
getattr(args, "out", None)
|
|
625
626
|
or getattr(args, "format", "all") != "all"
|
|
626
627
|
or getattr(args, "concurrency", 6) != 6
|
|
627
628
|
or getattr(args, "min_kill_rate", 0.85) != 0.85
|
|
628
629
|
or getattr(args, "open_browser", False)
|
|
629
|
-
)
|
|
630
|
-
|
|
631
|
-
return
|
|
630
|
+
):
|
|
631
|
+
print("[bugx audit] 当前模式不接受这些选项。请查阅 bugx audit --help。", file=sys.stderr)
|
|
632
|
+
return 2
|
|
632
633
|
return _command_audit_graph(args)
|
|
@@ -145,10 +145,10 @@ def confirm_data_sharing(args: argparse.Namespace) -> bool:
|
|
|
145
145
|
# ``sharing_revoked()``),所以非交互时**不落盘**、按默认允许处理。
|
|
146
146
|
return True
|
|
147
147
|
try:
|
|
148
|
-
answer = input("允许 BugX 上传脱敏后的攻防数据用于改进平台?[
|
|
148
|
+
answer = input("允许 BugX 上传脱敏后的攻防数据用于改进平台?[Y/n] ").strip().lower()
|
|
149
149
|
except (EOFError, OSError):
|
|
150
|
-
answer = "
|
|
151
|
-
allowed = answer in {"
|
|
150
|
+
answer = ""
|
|
151
|
+
allowed = answer not in {"n", "no"}
|
|
152
152
|
_save_data_sharing(allowed)
|
|
153
153
|
return allowed
|
|
154
154
|
|
|
@@ -158,7 +158,7 @@ def command_telemetry(args: argparse.Namespace) -> int:
|
|
|
158
158
|
try:
|
|
159
159
|
_ensure_core_importable()
|
|
160
160
|
from core.cloud_sync.flywheel_client import FlywheelUploader
|
|
161
|
-
uploader = FlywheelUploader(
|
|
161
|
+
uploader = FlywheelUploader()
|
|
162
162
|
action = getattr(args, "telemetry_command", "inspect")
|
|
163
163
|
if action == "inspect":
|
|
164
164
|
result = uploader.inspect(latest=bool(getattr(args, "latest", False)))
|
|
@@ -169,10 +169,14 @@ def command_telemetry(args: argparse.Namespace) -> int:
|
|
|
169
169
|
print(json.dumps(entry, ensure_ascii=False))
|
|
170
170
|
return 0
|
|
171
171
|
if action in {"flush", "upload"}:
|
|
172
|
+
if not uploader.data_sharing:
|
|
173
|
+
print("[telemetry] 遥测已关闭,未执行网络上传。")
|
|
174
|
+
return 0
|
|
172
175
|
batch_size = int(getattr(args, "batch_size", 20) or 20)
|
|
173
176
|
flushed = uploader.flush(batch_size=batch_size)
|
|
174
177
|
sent = flushed.get("sent", flushed) if isinstance(flushed, dict) else flushed
|
|
175
|
-
|
|
178
|
+
remaining = flushed.get("remaining", "unknown") if isinstance(flushed, dict) else "unknown"
|
|
179
|
+
print(f"[telemetry] 本次推送:{sent} 条事件;本地 Outbox 剩余:{remaining}")
|
|
176
180
|
return 0
|
|
177
181
|
output = uploader.export_bundle(
|
|
178
182
|
getattr(args, "out"),
|
|
@@ -198,7 +202,7 @@ def command_telemetry_config(args: argparse.Namespace) -> int:
|
|
|
198
202
|
if not enabled:
|
|
199
203
|
_ensure_core_importable()
|
|
200
204
|
from core.cloud_sync.flywheel_client import FlywheelUploader
|
|
201
|
-
cleared = FlywheelUploader(
|
|
205
|
+
cleared = FlywheelUploader().clear_outbox()
|
|
202
206
|
print(f"[config] telemetry.data_sharing=false;已清空 {cleared} 条飞轮记录")
|
|
203
207
|
print("[config] 云端同步已停用:撤销态下 sync_layers/auto_sync 拒绝所有 push/pull")
|
|
204
208
|
else:
|
|
@@ -346,6 +350,21 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
346
350
|
print(message)
|
|
347
351
|
return 0
|
|
348
352
|
|
|
353
|
+
scope = None
|
|
354
|
+
if act == "sync":
|
|
355
|
+
scope = getattr(args, "sync_scope", None)
|
|
356
|
+
if scope is None:
|
|
357
|
+
try:
|
|
358
|
+
from core.cloud_sync.cloud_client import load_cloud_config
|
|
359
|
+
|
|
360
|
+
scope = load_cloud_config().get("sync_scope_default", "project")
|
|
361
|
+
except (OSError, TypeError, ValueError, CliError) as exc:
|
|
362
|
+
print(f"[cloud] 无法读取同步范围:{exc}", file=sys.stderr)
|
|
363
|
+
return 2
|
|
364
|
+
if scope not in ("project", "global", "all"):
|
|
365
|
+
print("[cloud] 同步范围无效,请使用 --scope project、global 或 all。", file=sys.stderr)
|
|
366
|
+
return 2
|
|
367
|
+
|
|
349
368
|
try:
|
|
350
369
|
client = CloudClient()
|
|
351
370
|
except ValueError as exc:
|
|
@@ -1195,17 +1214,7 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
1195
1214
|
return 2
|
|
1196
1215
|
|
|
1197
1216
|
if act == "sync":
|
|
1198
|
-
|
|
1199
|
-
# onboard-on(:1216)刻意传显式 "all",不受配置收窄。
|
|
1200
|
-
try:
|
|
1201
|
-
from core.cloud_sync.cloud_client import load_cloud_config
|
|
1202
|
-
sync_default_scope = load_cloud_config().get("sync_scope_default") or "all"
|
|
1203
|
-
except Exception: # noqa: BLE001
|
|
1204
|
-
sync_default_scope = "all"
|
|
1205
|
-
if getattr(args, "sync_scope", None) is None and sync_default_scope != "all":
|
|
1206
|
-
print(f"[cloud] sync_scope_default={sync_default_scope}(配置生效;显式 --scope 可覆盖)")
|
|
1207
|
-
return _cloud_sync_command(args, client, root, get_device_id,
|
|
1208
|
-
default_scope=sync_default_scope)
|
|
1217
|
+
return _cloud_sync_command(args, client, root, get_device_id, scope=scope)
|
|
1209
1218
|
|
|
1210
1219
|
if act == "projects":
|
|
1211
1220
|
sub = getattr(args, "cloud_project_action", "list")
|
|
@@ -1290,10 +1299,9 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
1290
1299
|
print("[cloud] 已开启云端同步,立即同步 global + project…")
|
|
1291
1300
|
sync_args = argparse.Namespace(
|
|
1292
1301
|
project_slug=args.project_slug,
|
|
1293
|
-
sync_scope="all",
|
|
1294
1302
|
detail_mode=None,
|
|
1295
1303
|
)
|
|
1296
|
-
return _cloud_sync_command(sync_args, client, root, get_device_id)
|
|
1304
|
+
return _cloud_sync_command(sync_args, client, root, get_device_id, scope="all")
|
|
1297
1305
|
|
|
1298
1306
|
return 2
|
|
1299
1307
|
|
|
@@ -585,6 +585,24 @@ def _doctor_repair_assets(root: Path, layout: Any) -> list[str]:
|
|
|
585
585
|
except Exception as exc:
|
|
586
586
|
failed("runtime.json 修复", exc)
|
|
587
587
|
|
|
588
|
+
try:
|
|
589
|
+
onboarding_file = root / ".bugx" / "cloud-onboard.json"
|
|
590
|
+
if onboarding_file.is_symlink():
|
|
591
|
+
raise OSError(f"拒绝修复软链接目标:{onboarding_file}")
|
|
592
|
+
if not onboarding_file.is_file():
|
|
593
|
+
payload = {
|
|
594
|
+
"schema_version": 1,
|
|
595
|
+
"state": "local",
|
|
596
|
+
"updated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
|
597
|
+
}
|
|
598
|
+
_doctor_atomic_replace(
|
|
599
|
+
onboarding_file,
|
|
600
|
+
json.dumps(payload, indent=2, ensure_ascii=False).encode("utf-8"),
|
|
601
|
+
)
|
|
602
|
+
actions.append("已自动补齐缺失的项目本地 onboarding 配置(.bugx/cloud-onboard.json)")
|
|
603
|
+
except Exception as exc:
|
|
604
|
+
failed("cloud-onboard.json 修复", exc)
|
|
605
|
+
|
|
588
606
|
try:
|
|
589
607
|
project_file = root / ".bugx-project.json"
|
|
590
608
|
if project_file.is_symlink():
|
|
@@ -446,18 +446,17 @@ def _cloud_project_slug(root: Path, requested: str | None = None) -> str:
|
|
|
446
446
|
|
|
447
447
|
|
|
448
448
|
def _cloud_sync_command(args: argparse.Namespace, client: Any, root: Path,
|
|
449
|
-
get_device_id, *,
|
|
449
|
+
get_device_id, *, scope: str) -> int:
|
|
450
450
|
"""执行一次确定性的云端同步,不把同步流程交给宿主 AI 编排。
|
|
451
451
|
|
|
452
452
|
``cloud sync`` 和 ``cloud onboard on`` 共用这条路径,保证登录、设备登记、
|
|
453
|
-
401 重授权、项目绑定、scope 收敛以及 onboarding
|
|
454
|
-
|
|
453
|
+
401 重授权、项目绑定、scope 收敛以及 onboarding 状态落地完全一致。
|
|
454
|
+
调用方在进入流程前必须确定同步范围。
|
|
455
455
|
"""
|
|
456
456
|
from .agent import _CliProgress
|
|
457
457
|
|
|
458
458
|
progress = _CliProgress(args)
|
|
459
459
|
progress.update(0, "准备云端同步")
|
|
460
|
-
scope = getattr(args, "sync_scope", None) or default_scope
|
|
461
460
|
onboard_project = scope in {"project", "all"}
|
|
462
461
|
onboarding = None
|
|
463
462
|
if onboard_project:
|
|
@@ -602,49 +602,14 @@ def _purge_private_plugin_stores(root: Path, removed: list[str], preserved: list
|
|
|
602
602
|
continue
|
|
603
603
|
if manifest.get("private") is not True or manifest.get("autoload") is not False:
|
|
604
604
|
continue
|
|
605
|
-
|
|
605
|
+
_rmtree_force(plugin_path)
|
|
606
606
|
removed.append(str(plugin_path.relative_to(root)))
|
|
607
607
|
_remove_empty_parents(root, removed)
|
|
608
608
|
|
|
609
609
|
|
|
610
610
|
def _rmtree_force(path: Path) -> None:
|
|
611
|
-
"""
|
|
612
|
-
|
|
613
|
-
实测缺陷:`uninstall --self` 原先直接 ``shutil.rmtree(~/.bugx)``;当引擎目录
|
|
614
|
-
是 0o555/0o444 的只读载荷时抛 ``PermissionError: .bugx/core``,导致整个
|
|
615
|
-
自卸载失败(测试与真实用户同路径)。
|
|
616
|
-
|
|
617
|
-
关键点:删除条目需要**父目录**写权限,因此先自顶向下放开整棵树,再交给
|
|
618
|
-
``rmtree``;仅对失败条目 chmod 是不够的(实测仍 EACCES)。
|
|
619
|
-
"""
|
|
620
|
-
if path.is_symlink() or path.is_file():
|
|
621
|
-
path.unlink(missing_ok=True)
|
|
622
|
-
return
|
|
623
|
-
for root, _dirs, files in os.walk(path, topdown=True):
|
|
624
|
-
try:
|
|
625
|
-
os.chmod(root, 0o700)
|
|
626
|
-
except OSError:
|
|
627
|
-
pass
|
|
628
|
-
for name in files:
|
|
629
|
-
target = Path(root) / name
|
|
630
|
-
if target.is_symlink():
|
|
631
|
-
continue
|
|
632
|
-
try:
|
|
633
|
-
os.chmod(target, 0o600)
|
|
634
|
-
except OSError:
|
|
635
|
-
pass
|
|
636
|
-
|
|
637
|
-
def _on_error(func, target, _exc): # noqa: ANN001 - stdlib 回调签名
|
|
638
|
-
try:
|
|
639
|
-
os.chmod(Path(target).parent, 0o700)
|
|
640
|
-
except OSError:
|
|
641
|
-
pass
|
|
642
|
-
func(target)
|
|
643
|
-
|
|
644
|
-
try:
|
|
645
|
-
shutil.rmtree(path, onexc=_on_error)
|
|
646
|
-
except TypeError: # Python < 3.12
|
|
647
|
-
shutil.rmtree(path, onerror=_on_error)
|
|
611
|
+
"""删除已完成安全校验、但可能包含只读条目的目录树。"""
|
|
612
|
+
_remove_tree_force(path)
|
|
648
613
|
|
|
649
614
|
|
|
650
615
|
def _self_home_dir(*parts: str) -> Path:
|
|
@@ -967,7 +932,7 @@ def _self_remove_qoder_user_assets(
|
|
|
967
932
|
cache_dir = _qoder_user_plugin_cache_dir()
|
|
968
933
|
if cache_dir.is_dir() and not cache_dir.is_symlink():
|
|
969
934
|
try:
|
|
970
|
-
|
|
935
|
+
_rmtree_force(cache_dir)
|
|
971
936
|
removed.append(f"{cache_dir}(已移除插件缓存)")
|
|
972
937
|
except OSError as exc:
|
|
973
938
|
preserved.append(f"{cache_dir}(删除失败:{exc})")
|
|
@@ -1216,7 +1181,7 @@ def _self_uninstall_pi_skill(
|
|
|
1216
1181
|
if owned_copy:
|
|
1217
1182
|
if backup_root is not None:
|
|
1218
1183
|
_backup_tree_external(p_dir, backup_root / p_dir.name)
|
|
1219
|
-
|
|
1184
|
+
_rmtree_force(p_dir)
|
|
1220
1185
|
removed.append(f"{label}(全局 skill 副本)")
|
|
1221
1186
|
else:
|
|
1222
1187
|
preserved.append(f"{label}(不是 BugX 副本或内容已变化,保留)")
|
|
@@ -1227,7 +1192,7 @@ def _self_uninstall_pi_skill(
|
|
|
1227
1192
|
if agents_skill_dir.is_dir():
|
|
1228
1193
|
if backup_root is not None:
|
|
1229
1194
|
_backup_tree_external(agents_skill_dir, backup_root / "pi-global-skill")
|
|
1230
|
-
|
|
1195
|
+
_rmtree_force(agents_skill_dir)
|
|
1231
1196
|
removed.append("~/.agents/skills/bugx(全局 skill 实体)")
|
|
1232
1197
|
elif agents_skill_dir.exists():
|
|
1233
1198
|
preserved.append("~/.agents/skills/bugx(不是安全目录,保留)")
|
|
@@ -1241,7 +1206,7 @@ def _self_uninstall_dsh_preset(
|
|
|
1241
1206
|
return
|
|
1242
1207
|
if backup_root is not None:
|
|
1243
1208
|
_backup_tree_external(preset_dir, backup_root / "dsh-agent-presets")
|
|
1244
|
-
|
|
1209
|
+
_rmtree_force(preset_dir)
|
|
1245
1210
|
removed.append("~/.dsh/.agent-presets/bugx(全局预设)")
|
|
1246
1211
|
|
|
1247
1212
|
|
|
@@ -1274,7 +1239,7 @@ def _self_uninstall_dsh_ui_plugin(
|
|
|
1274
1239
|
return
|
|
1275
1240
|
if backup_root is not None:
|
|
1276
1241
|
_backup_tree_external(plugin_root, backup_root / "dsh-ui-plugin")
|
|
1277
|
-
|
|
1242
|
+
_rmtree_force(plugin_root)
|
|
1278
1243
|
removed.append(f"{plugin_root}(DSH UI 插件)")
|
|
1279
1244
|
|
|
1280
1245
|
|
|
@@ -1344,7 +1309,7 @@ def _self_uninstall_workbuddy_skill(
|
|
|
1344
1309
|
backup_root / "workbuddy-custom-expert" / config_root.name / "bugx",
|
|
1345
1310
|
)
|
|
1346
1311
|
try:
|
|
1347
|
-
|
|
1312
|
+
_rmtree_force(expert_dir)
|
|
1348
1313
|
removed.append(f"{expert_dir}(WorkBuddy 自定义专家)")
|
|
1349
1314
|
except OSError as exc:
|
|
1350
1315
|
preserved.append(f"{expert_dir}(删除失败:{exc})")
|
|
@@ -2377,14 +2342,14 @@ def command_uninstall(args: argparse.Namespace) -> int:
|
|
|
2377
2342
|
for handler in list(logger.handlers):
|
|
2378
2343
|
handler.close()
|
|
2379
2344
|
logger.removeHandler(handler)
|
|
2380
|
-
|
|
2345
|
+
_rmtree_force(bugx_root)
|
|
2381
2346
|
# 与 --dry-run 预览保持一致:项目运行态被清掉必须在 removed 里可查,
|
|
2382
2347
|
# 否则用户只能靠 ls 猜(removed 为空时会误以为没清干净)。
|
|
2383
2348
|
removed.append(".bugx/(项目运行态、报告、证据与共享资源)")
|
|
2384
2349
|
if args.purge_global_data and global_root.exists():
|
|
2385
2350
|
if global_root.is_symlink():
|
|
2386
2351
|
raise CliError(_i18n_exc("lifecycle.clean_global_knowledge_symlink_refused", "拒绝清理符号链接全局错题集目录"))
|
|
2387
|
-
|
|
2352
|
+
_rmtree_force(global_root)
|
|
2388
2353
|
removed.append("~/.bugx/knowledge/(全局错题集与经验集)")
|
|
2389
2354
|
_remove_empty_parents(root, removed)
|
|
2390
2355
|
payload = {
|
|
@@ -2427,6 +2392,43 @@ def _assert_writable(directory: Path, label: str) -> None:
|
|
|
2427
2392
|
raise CliError(f"{label}不可写:{directory}: {exc}") from exc
|
|
2428
2393
|
|
|
2429
2394
|
|
|
2395
|
+
_PROJECT_USER_SKILL = Path(".agents/skills/bugx-user/SKILL.md")
|
|
2396
|
+
|
|
2397
|
+
|
|
2398
|
+
def _read_project_user_skill(root: Path, source: Path) -> bytes:
|
|
2399
|
+
"""Validate the required bundled Skill and its project destination before init writes."""
|
|
2400
|
+
target = root / _PROJECT_USER_SKILL
|
|
2401
|
+
_assert_no_symlink_components(target)
|
|
2402
|
+
for parent in target.parents:
|
|
2403
|
+
if parent == root:
|
|
2404
|
+
break
|
|
2405
|
+
if parent.exists() and not parent.is_dir():
|
|
2406
|
+
raise CliError(f"项目 Skill 父路径不是目录:{parent}")
|
|
2407
|
+
if target.exists() and not target.is_file():
|
|
2408
|
+
raise CliError(f"项目 Skill 目标不是普通文件:{target}")
|
|
2409
|
+
|
|
2410
|
+
template = source.parent / "skills" / "platform" / "bugx-user" / "SKILL.md"
|
|
2411
|
+
_assert_no_symlink_components(template)
|
|
2412
|
+
if not template.is_file():
|
|
2413
|
+
raise CliError(f"安装包缺少 BugX 用户 Skill:{template}。请重新安装完整的 bugx-cli。")
|
|
2414
|
+
try:
|
|
2415
|
+
content = template.read_bytes()
|
|
2416
|
+
except OSError as exc:
|
|
2417
|
+
raise CliError(f"无法读取 BugX 用户 Skill:{template}: {exc}") from exc
|
|
2418
|
+
if not content.strip():
|
|
2419
|
+
raise CliError(f"安装包中的 BugX 用户 Skill 为空:{template}。请重新安装完整的 bugx-cli。")
|
|
2420
|
+
return content
|
|
2421
|
+
|
|
2422
|
+
|
|
2423
|
+
def _install_project_user_skill(root: Path, content: bytes, *, force: bool) -> Path | None:
|
|
2424
|
+
target = root / _PROJECT_USER_SKILL
|
|
2425
|
+
_assert_no_symlink_components(target)
|
|
2426
|
+
if target.is_file() and not force:
|
|
2427
|
+
return None
|
|
2428
|
+
_, _, backup = _write_host_resource(root, target, content, "bugx-user")
|
|
2429
|
+
return backup
|
|
2430
|
+
|
|
2431
|
+
|
|
2430
2432
|
def _precheck_initialization(root: Path, source: Path) -> None:
|
|
2431
2433
|
"""F-L0-04 B 预检阶段:把可预知的失败全部前移到写盘之前(零落盘)。"""
|
|
2432
2434
|
if not source.is_dir():
|
|
@@ -2581,6 +2583,7 @@ def command_init(args: argparse.Namespace) -> int:
|
|
|
2581
2583
|
# F-L0-04 整改(commit-or-nothing):所有**已知**失败路径都必须在写盘前阻断。
|
|
2582
2584
|
# ---- B 预检阶段(零落盘)------------------------------------------------
|
|
2583
2585
|
_precheck_initialization(root, source)
|
|
2586
|
+
user_skill = _read_project_user_skill(root, source)
|
|
2584
2587
|
|
|
2585
2588
|
# ---- A 决策阶段(零落盘):云端同步决策必须在任何写盘之前解析完成 --------
|
|
2586
2589
|
onboarding_path = root / ".bugx" / "cloud-onboard.json"
|
|
@@ -2628,12 +2631,13 @@ def command_init(args: argparse.Namespace) -> int:
|
|
|
2628
2631
|
_ensure_core_importable()
|
|
2629
2632
|
from core.runtime.session_profile import save_commit_policy
|
|
2630
2633
|
profile_file_ = save_commit_policy(commit_policy_, root=root)
|
|
2634
|
+
skill_backup_ = _install_project_user_skill(root, user_skill, force=args.force)
|
|
2631
2635
|
_apply_cloud_onboarding_plan(root, onboarding_plan, preset_data)
|
|
2632
2636
|
return {
|
|
2633
2637
|
"removed": removed, "copied": copied_, "skipped": skipped_,
|
|
2634
2638
|
"layout": layout_, "inherited": inherited_,
|
|
2635
2639
|
"life_created": life_created_, "profile_file": profile_file_,
|
|
2636
|
-
"commit_policy": commit_policy_,
|
|
2640
|
+
"commit_policy": commit_policy_, "skill_backup": skill_backup_,
|
|
2637
2641
|
}
|
|
2638
2642
|
|
|
2639
2643
|
committed = _commit_with_self_heal(_commit_project_state)
|
|
@@ -2682,6 +2686,9 @@ def command_init(args: argparse.Namespace) -> int:
|
|
|
2682
2686
|
if removed_legacy_core:
|
|
2683
2687
|
print(f" 已直接删除旧项目引擎入口:{removed_legacy_core}")
|
|
2684
2688
|
print(f" 运行目录:{layout.root}")
|
|
2689
|
+
print(f" 用户 Skill:{_PROJECT_USER_SKILL.as_posix()}")
|
|
2690
|
+
if committed["skill_backup"] is not None:
|
|
2691
|
+
print(f" 用户 Skill 备份:{committed['skill_backup']}")
|
|
2685
2692
|
print(f" 写入 {copied} 个文件,保留 {skipped} 个已有文件")
|
|
2686
2693
|
if life_created:
|
|
2687
2694
|
print(" 已创建 .bugx 当前生命周期生命状态(1 条初始寿命)")
|
|
@@ -294,7 +294,7 @@ def _remove_owned_record(
|
|
|
294
294
|
backup_dir: Path | None = None,
|
|
295
295
|
force: bool = False,
|
|
296
296
|
) -> None:
|
|
297
|
-
"""Remove
|
|
297
|
+
"""Remove only recorded files unless the caller enables forced cleanup."""
|
|
298
298
|
if not isinstance(record, dict):
|
|
299
299
|
return
|
|
300
300
|
relative = record.get("path")
|
|
@@ -377,7 +377,7 @@ def _sweep_unrecorded_host_entry(
|
|
|
377
377
|
项目卸载的语义是"任何受支持的 IDE 进来都像新项目"。对 hosts.json
|
|
378
378
|
没有记录的宿主(旧版本安装或登记丢失),入口文件内容与当前模板渲染
|
|
379
379
|
逐字一致才认定为 BugX 自有并删除;有出入一律保留并报告,不冒充归属。
|
|
380
|
-
|
|
380
|
+
启用 `--force` 后,才对已识别但内容已变化的目标进行强制备份并删除。
|
|
381
381
|
"""
|
|
382
382
|
if adapter.name not in _SWEEPABLE_SKILL_ADAPTERS:
|
|
383
383
|
return
|
|
@@ -507,7 +507,7 @@ def _chatgpt_plugin_manifest(version: str = __version__) -> dict[str, object]:
|
|
|
507
507
|
return {
|
|
508
508
|
"name": CHATGPT_PLUGIN_NAME,
|
|
509
509
|
"version": version,
|
|
510
|
-
"description": "Autonomous code review and
|
|
510
|
+
"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.",
|
|
511
511
|
"skills": "./skills/",
|
|
512
512
|
"homepage": "https://bugx.dev",
|
|
513
513
|
"author": {
|
|
@@ -518,8 +518,8 @@ def _chatgpt_plugin_manifest(version: str = __version__) -> dict[str, object]:
|
|
|
518
518
|
"keywords": ["bugx", "audit", "security", "testing"],
|
|
519
519
|
"interface": {
|
|
520
520
|
"displayName": "BugX",
|
|
521
|
-
"shortDescription": "Autonomous code review and
|
|
522
|
-
"longDescription": "
|
|
521
|
+
"shortDescription": "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.",
|
|
522
|
+
"longDescription": "BugX is an autonomous code review and testing agent designed to safeguard software delivery: it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; automates black-box, functional, and performance testing across complex edge cases for QA; and ensures software strictly meets functional requirements with rock-solid stability and resilience. By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people.",
|
|
523
523
|
"developerName": "BugX",
|
|
524
524
|
"category": "Developer tools",
|
|
525
525
|
# ChatGPT only exposes its native choice/confirmation surface to
|
|
@@ -2281,7 +2281,7 @@ def _remove_dsh_project_files(
|
|
|
2281
2281
|
- 有记录但内容已被用户修改:保留文件并记入 preserved,不强行覆盖/删除;
|
|
2282
2282
|
- 无记录:没有所有权证明,保留文件并记入 preserved;调用方若要清理必须
|
|
2283
2283
|
先提供当前安装记录,禁止按文件名猜测归属。
|
|
2284
|
-
- force
|
|
2284
|
+
- `--force`:强制清理已备份的文件。
|
|
2285
2285
|
"""
|
|
2286
2286
|
if not records and not force:
|
|
2287
2287
|
for candidate in (
|
|
@@ -2362,7 +2362,7 @@ def _remove_dsh_user_preset(
|
|
|
2362
2362
|
for child in preset_dir.iterdir():
|
|
2363
2363
|
if child.is_file() and not child.is_symlink():
|
|
2364
2364
|
_backup_uninstall_file(root, backup_host, child, backup_dir)
|
|
2365
|
-
|
|
2365
|
+
_remove_tree_force(preset_dir)
|
|
2366
2366
|
removed.append("~/.dsh/.agent-presets/bugx(已显式清理全局 DSH 预设)")
|
|
2367
2367
|
except OSError as exc:
|
|
2368
2368
|
preserved.append(f"~/.dsh/.agent-presets/bugx(清理失败:{exc})")
|
|
@@ -2658,7 +2658,7 @@ def _restore_reset_entries(moved: list[tuple[Path, Path]]) -> None:
|
|
|
2658
2658
|
if source.is_symlink() or source.is_file():
|
|
2659
2659
|
source.unlink(missing_ok=True)
|
|
2660
2660
|
elif source.is_dir():
|
|
2661
|
-
|
|
2661
|
+
_remove_tree_force(source)
|
|
2662
2662
|
shutil.move(str(destination), str(source))
|
|
2663
2663
|
|
|
2664
2664
|
|
|
@@ -2677,7 +2677,7 @@ def _clean_reset_entries(entries: list[tuple[Path, str]]) -> None:
|
|
|
2677
2677
|
source.unlink(missing_ok=True)
|
|
2678
2678
|
elif source.is_dir():
|
|
2679
2679
|
_assert_no_symlink_components(source)
|
|
2680
|
-
|
|
2680
|
+
_remove_tree_force(source)
|
|
2681
2681
|
|
|
2682
2682
|
|
|
2683
2683
|
def _bootstrap_global_knowledge(root: Path, source: Path) -> None:
|
|
@@ -18,6 +18,7 @@ from ..common import (
|
|
|
18
18
|
_backup_host_resource,
|
|
19
19
|
_i18n_exc,
|
|
20
20
|
_i18n_prompt,
|
|
21
|
+
_remove_tree_force,
|
|
21
22
|
_resolve_locale_name,
|
|
22
23
|
get_build_id,
|
|
23
24
|
)
|
|
@@ -133,9 +134,21 @@ def _claude_desktop_session_dirs() -> list[Path]:
|
|
|
133
134
|
def _claude_skill_description(locale: str | None = None) -> str:
|
|
134
135
|
"""Return localized description for Claude skill."""
|
|
135
136
|
loc = _resolve_locale_name(locale)
|
|
137
|
+
fallback = (
|
|
138
|
+
"BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,"
|
|
139
|
+
"减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;"
|
|
140
|
+
"确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。"
|
|
141
|
+
) if loc.startswith("zh") else (
|
|
142
|
+
"BugX is an autonomous code review and testing agent designed to safeguard software delivery: "
|
|
143
|
+
"it surfaces hidden, deep bugs for developers right after writing code to eliminate painful debugging and rework; "
|
|
144
|
+
"automates black-box, functional, and performance testing across complex edge cases for QA; "
|
|
145
|
+
"and ensures software strictly meets functional requirements with rock-solid stability and resilience. "
|
|
146
|
+
"By taking over tedious verification, BugX frees engineers from manual grunt work, boosts team velocity, "
|
|
147
|
+
"elevates code quality, and significantly lowers long-term maintenance costs—putting technology to work for people."
|
|
148
|
+
)
|
|
136
149
|
return _i18n_prompt(
|
|
137
150
|
"plugin.claude_skill_description",
|
|
138
|
-
|
|
151
|
+
fallback,
|
|
139
152
|
locale=loc,
|
|
140
153
|
)
|
|
141
154
|
|
|
@@ -247,9 +260,9 @@ def _claude_user_agent_content_worker(*, locale: str | None = None) -> str:
|
|
|
247
260
|
|
|
248
261
|
_DEFAULT_CLAUDE_SKILL_CONTENT = """---
|
|
249
262
|
name: bugx
|
|
250
|
-
description:
|
|
263
|
+
description: BugX 是一个具备自主代码审查与测试能力的智能体,严把代码交付关:它帮助开发人员在写完代码后自动排查隐藏的深层 Bug,减少反复排错与返工;帮助测试人员自动化运行黑盒测试、功能验证与性能测试,自动覆盖手工盲测难以覆盖的极端场景;确保代码功能符合要求、具备良好的健壮性和稳定性。让开发和测试在繁琐的工作中解放双手,大幅提高工作效率、全面提升代码质量、显著降低后期维护成本,实现科技服务于人。
|
|
251
264
|
metadata:
|
|
252
|
-
bugx_version: "0.1.
|
|
265
|
+
bugx_version: "0.1.3"
|
|
253
266
|
---
|
|
254
267
|
<!-- bugx-locale: zh-CN -->
|
|
255
268
|
|
|
@@ -257,7 +270,7 @@ metadata:
|
|
|
257
270
|
|
|
258
271
|
BugX Claude Skill 镜像。执行前用 `bugx engine path --name AGENT_GUIDE.md` 和 `bugx engine path --name bugx.md` 读取全局协议;项目 `.bugx/` 只保存状态与配置。
|
|
259
272
|
|
|
260
|
-
协议镜像版本:0.1.
|
|
273
|
+
协议镜像版本:0.1.3
|
|
261
274
|
|
|
262
275
|
## Claude 原生交互适配(强制)
|
|
263
276
|
|
|
@@ -364,7 +377,7 @@ def _claude_plugin_manifest() -> dict[str, object]:
|
|
|
364
377
|
return {
|
|
365
378
|
"name": "bugx",
|
|
366
379
|
"version": __version__,
|
|
367
|
-
"description": "Autonomous code review and
|
|
380
|
+
"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.",
|
|
368
381
|
"author": {
|
|
369
382
|
"name": "BugX",
|
|
370
383
|
"url": "https://bugx.dev",
|
|
@@ -612,13 +625,14 @@ def _build_claude_desktop_packages(
|
|
|
612
625
|
skill_bytes = skill_buf.getvalue()
|
|
613
626
|
|
|
614
627
|
# 构建 in-memory dxt zip (Claude Desktop Extension)
|
|
628
|
+
plugin_desc = _claude_skill_description(locale=locale)
|
|
615
629
|
dxt_manifest = {
|
|
616
630
|
"manifest_version": "0.4",
|
|
617
631
|
"name": "bugx",
|
|
618
632
|
"display_name": "BugX",
|
|
619
633
|
"version": __version__,
|
|
620
634
|
"bugx_build_id": get_build_id(),
|
|
621
|
-
"description":
|
|
635
|
+
"description": plugin_desc,
|
|
622
636
|
"author": {
|
|
623
637
|
"name": "BugX",
|
|
624
638
|
"url": "https://bugx.dev",
|
|
@@ -1172,7 +1186,7 @@ def _remove_claude_project_skills_and_dist(
|
|
|
1172
1186
|
project_skill = root / ".claude" / "skills" / "bugx"
|
|
1173
1187
|
if project_skill.is_dir() and not project_skill.is_symlink():
|
|
1174
1188
|
try:
|
|
1175
|
-
|
|
1189
|
+
_remove_tree_force(project_skill)
|
|
1176
1190
|
removed.append(f"{project_skill}(项目级 Claude Skill)")
|
|
1177
1191
|
except OSError as exc:
|
|
1178
1192
|
preserved.append(f"{project_skill}(删除失败:{exc})")
|
|
@@ -1194,7 +1208,7 @@ def _remove_claude_user_skills(
|
|
|
1194
1208
|
user_skill = _claude_user_skills_dir() / "bugx"
|
|
1195
1209
|
if user_skill.is_dir() and not user_skill.is_symlink():
|
|
1196
1210
|
try:
|
|
1197
|
-
|
|
1211
|
+
_remove_tree_force(user_skill)
|
|
1198
1212
|
removed.append(f"{user_skill}(Claude 用户级 Skill)")
|
|
1199
1213
|
except OSError as exc:
|
|
1200
1214
|
preserved.append(f"{user_skill}(删除失败:{exc})")
|
|
@@ -1202,7 +1216,7 @@ def _remove_claude_user_skills(
|
|
|
1202
1216
|
host_manual = _claude_user_skills_dir() / "bugx-claude"
|
|
1203
1217
|
if host_manual.is_dir() and not host_manual.is_symlink():
|
|
1204
1218
|
try:
|
|
1205
|
-
|
|
1219
|
+
_remove_tree_force(host_manual)
|
|
1206
1220
|
removed.append(f"{host_manual}(Claude 用户级宿主手册 Skill)")
|
|
1207
1221
|
except OSError as exc:
|
|
1208
1222
|
preserved.append(f"{host_manual}(删除失败:{exc})")
|
|
@@ -1211,7 +1225,7 @@ def _remove_claude_user_skills(
|
|
|
1211
1225
|
target = d_dir / "bugx"
|
|
1212
1226
|
if target.is_dir() and not target.is_symlink():
|
|
1213
1227
|
try:
|
|
1214
|
-
|
|
1228
|
+
_remove_tree_force(target)
|
|
1215
1229
|
removed.append(f"{target}(Claude 桌面端 Skill)")
|
|
1216
1230
|
except OSError as exc:
|
|
1217
1231
|
preserved.append(f"{target}(删除失败:{exc})")
|
|
@@ -1229,7 +1243,7 @@ def _remove_claude_user_skills(
|
|
|
1229
1243
|
ext_dir = desktop_support / "Claude Extensions" / ext_id
|
|
1230
1244
|
if ext_dir.is_dir() and not ext_dir.is_symlink():
|
|
1231
1245
|
try:
|
|
1232
|
-
|
|
1246
|
+
_remove_tree_force(ext_dir)
|
|
1233
1247
|
removed.append(f"{ext_dir}(Claude 桌面端扩展)")
|
|
1234
1248
|
except OSError as exc:
|
|
1235
1249
|
preserved.append(f"{ext_dir}(删除失败:{exc})")
|
|
@@ -1319,7 +1333,7 @@ def _remove_claude_desktop_cowork_plugins(
|
|
|
1319
1333
|
bugx_dir = local_marketplace / "bugx"
|
|
1320
1334
|
if bugx_dir.is_dir() and not bugx_dir.is_symlink():
|
|
1321
1335
|
try:
|
|
1322
|
-
|
|
1336
|
+
_remove_tree_force(bugx_dir)
|
|
1323
1337
|
removed.append(f"{bugx_dir}(Claude 桌面端插件目录)")
|
|
1324
1338
|
except OSError as exc:
|
|
1325
1339
|
preserved.append(f"{bugx_dir}(删除失败:{exc})")
|
|
@@ -1394,7 +1408,7 @@ def _remove_claude_plugin_registry(
|
|
|
1394
1408
|
cache_dir = plugins_dir / "cache" / "bugx"
|
|
1395
1409
|
if cache_dir.is_dir() and not cache_dir.is_symlink():
|
|
1396
1410
|
try:
|
|
1397
|
-
|
|
1411
|
+
_remove_tree_force(cache_dir)
|
|
1398
1412
|
removed.append(f"{cache_dir}(Claude 插件缓存)")
|
|
1399
1413
|
except OSError as exc:
|
|
1400
1414
|
preserved.append(f"{cache_dir}(删除失败:{exc})")
|