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.
- package/README.md +13 -9
- package/core/README.md +1 -1
- 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/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 +1 -1
- package/core/bugx_paths.py +2 -2
- 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-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/engine-integrity.json +122 -66
- package/core/infra/README.md +1 -1
- package/core/infra/build_info.py +2 -2
- 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/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/supervisor/README.md +1 -1
- package/docs/07_distribution/01_README_NPM.md +13 -9
- package/ecosystem/integrations/dsh/mcp/package.json +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/qoder/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/connector-meta.json +1 -1
- package/ecosystem/integrations/workbuddy/skills/bugx/SKILL.md +1 -1
- package/ecosystem/plugins/bugx/.claude-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.codex-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/.zcode-plugin/plugin.json +1 -1
- package/ecosystem/plugins/bugx/skills/bugx/SKILL.md +2 -2
- package/interfaces/bin/bugx.js +7 -7
- package/interfaces/cli/bugx_cli/__init__.py +2 -2
- package/interfaces/cli/bugx_cli/cli.py +163 -67
- package/interfaces/cli/bugx_cli/commands/agent.py +122 -61
- 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/knowledge.py +3 -4
- package/interfaces/cli/bugx_cli/commands/plugin.py +3 -3
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +2 -2
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/system.py +513 -158
- package/interfaces/cli/bugx_cli/common.py +6 -8
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +21 -10
- package/interfaces/cli/bugx_cli/infra/host_sync.py +1 -1
- package/package.json +29 -15
- package/pyproject.toml +40 -1
- package/scripts/sync-version.mjs +1 -1
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
|
@@ -569,6 +569,10 @@ def _defer_command_logging_until_authorized(args: argparse.Namespace) -> bool:
|
|
|
569
569
|
not create/open the project log until authorization has succeeded.
|
|
570
570
|
"""
|
|
571
571
|
command = getattr(args, "command", None)
|
|
572
|
+
if getattr(args, "dry_run", False) or command == "hosts":
|
|
573
|
+
return True
|
|
574
|
+
if command == "project" and getattr(args, "project_action", None) == "show":
|
|
575
|
+
return True
|
|
572
576
|
if command == "completion":
|
|
573
577
|
# Shell setup must be observationally read-only: emitting a script must
|
|
574
578
|
# not create a project log merely because it was run from a repository.
|
|
@@ -599,14 +603,8 @@ def _defer_command_logging_until_authorized(args: argparse.Namespace) -> bool:
|
|
|
599
603
|
and not getattr(args, "yes", False)
|
|
600
604
|
)
|
|
601
605
|
if command == "engine":
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
forwarded = forwarded[1:]
|
|
605
|
-
# 裸 ``bugx engine`` 会被 command_engine 默认成 status,是真实调度,
|
|
606
|
-
# 必须留日志;只有转发里出现帮助词时引擎才只打印帮助、不碰运行态。
|
|
607
|
-
return bool(forwarded) and any(
|
|
608
|
-
token in ENGINE_HELP_TOKENS for token in forwarded
|
|
609
|
-
)
|
|
606
|
+
# Engine actions own their own logging after argument validation.
|
|
607
|
+
return True
|
|
610
608
|
return False
|
|
611
609
|
|
|
612
610
|
|
|
@@ -11,6 +11,7 @@ import json
|
|
|
11
11
|
import os
|
|
12
12
|
import re
|
|
13
13
|
import shutil
|
|
14
|
+
import stat
|
|
14
15
|
import sys
|
|
15
16
|
import sysconfig
|
|
16
17
|
import tempfile
|
|
@@ -415,12 +416,22 @@ def _asset_candidates() -> list[Path]:
|
|
|
415
416
|
try:
|
|
416
417
|
resolved = candidate.resolve(strict=True)
|
|
417
418
|
mode = resolved.stat().st_mode
|
|
419
|
+
# ``st_mode`` permission bits are an authoritative write-safety
|
|
420
|
+
# signal only on POSIX. On Windows Python commonly reports a
|
|
421
|
+
# synthesized directory mode such as ``0o40777``; it does not
|
|
422
|
+
# expose the directory ACL through this field. Applying the
|
|
423
|
+
# POSIX ``0o022`` test there rejects valid npm-installed assets
|
|
424
|
+
# before the package's own integrity and entry checks can run.
|
|
425
|
+
posix_mode_safe = (
|
|
426
|
+
os.name != "posix"
|
|
427
|
+
or not bool(stat.S_IMODE(mode) & 0o022)
|
|
428
|
+
)
|
|
418
429
|
safe_files = all(
|
|
419
430
|
(resolved / name).is_file() and not (resolved / name).is_symlink()
|
|
420
431
|
for name in ("bugx.md", "launch_bugx.py")
|
|
421
432
|
)
|
|
422
433
|
if resolved.is_dir() and not candidate.is_symlink() \
|
|
423
|
-
and
|
|
434
|
+
and posix_mode_safe and safe_files:
|
|
424
435
|
candidates.insert(index, resolved)
|
|
425
436
|
return True
|
|
426
437
|
except OSError:
|
|
@@ -1057,7 +1068,7 @@ def _installed_engine_version(destination: Path) -> str | None:
|
|
|
1057
1068
|
except (OSError, ValueError):
|
|
1058
1069
|
payload = None
|
|
1059
1070
|
version = payload.get("bugx_version") if isinstance(payload, dict) else None
|
|
1060
|
-
if version == "0.1.
|
|
1071
|
+
if version == "0.1.2":
|
|
1061
1072
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
1062
1073
|
if isinstance(version, str) and version.strip():
|
|
1063
1074
|
return _full_engine_version(version.strip(), destination)
|
|
@@ -1070,7 +1081,7 @@ def _installed_engine_version(destination: Path) -> str | None:
|
|
|
1070
1081
|
match = re.search(r'bugx_version:\s*"([^"]+)"', content)
|
|
1071
1082
|
if match:
|
|
1072
1083
|
version = match.group(1)
|
|
1073
|
-
if version == "0.1.
|
|
1084
|
+
if version == "0.1.2":
|
|
1074
1085
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
1075
1086
|
return _full_engine_version(version, destination)
|
|
1076
1087
|
return None
|
|
@@ -1133,10 +1144,10 @@ def _install_engine(
|
|
|
1133
1144
|
and source.resolve() == repository_core.resolve():
|
|
1134
1145
|
print(
|
|
1135
1146
|
f"[bugx] 警告:拒绝从项目源码树安装引擎:{source.resolve()};"
|
|
1136
|
-
"
|
|
1147
|
+
"仅显式传入 --force 才允许该开发操作。",
|
|
1137
1148
|
file=sys.stderr,
|
|
1138
1149
|
)
|
|
1139
|
-
raise CliError("拒绝从项目源码树安装引擎;请确认来源后显式使用 force
|
|
1150
|
+
raise CliError("拒绝从项目源码树安装引擎;请确认来源后显式使用 --force。")
|
|
1140
1151
|
if destination is None:
|
|
1141
1152
|
override = os.environ.get("BUGX_GLOBAL_ENGINE_ROOT")
|
|
1142
1153
|
raw_destination = (Path(override).expanduser() if override
|
|
@@ -1188,16 +1199,16 @@ def _install_engine(
|
|
|
1188
1199
|
if installed_build_id is None:
|
|
1189
1200
|
raise CliError(
|
|
1190
1201
|
"已安装全局引擎缺少 Build ID 标记(可能损坏或来源未知),拒绝静默覆盖;"
|
|
1191
|
-
"如确需覆盖请显式传入 force
|
|
1202
|
+
"如确需覆盖请显式传入 --force。"
|
|
1192
1203
|
)
|
|
1193
1204
|
if source_build_id is None:
|
|
1194
1205
|
raise CliError(
|
|
1195
|
-
"安装源缺少 Build ID 标记,拒绝安装;请检查安装资源或显式传入 force
|
|
1206
|
+
"安装源缺少 Build ID 标记,拒绝安装;请检查安装资源或显式传入 --force。"
|
|
1196
1207
|
)
|
|
1197
1208
|
if installed_build_id > source_build_id:
|
|
1198
1209
|
raise CliError(
|
|
1199
1210
|
f"拒绝降级全局引擎:已安装 build_id={installed_build_id},"
|
|
1200
|
-
f"安装源 build_id={source_build_id};如确需回退请显式传入 force
|
|
1211
|
+
f"安装源 build_id={source_build_id};如确需回退请显式传入 --force。"
|
|
1201
1212
|
)
|
|
1202
1213
|
expected = _engine_file_manifest(source)
|
|
1203
1214
|
healthy, detail = _engine_integrity_status(source, destination)
|
|
@@ -1790,7 +1801,7 @@ def _version_marker(path: Path, pattern: re.Pattern[str], *, allow_symlink: bool
|
|
|
1790
1801
|
except (OSError, UnicodeError, CliError):
|
|
1791
1802
|
return None
|
|
1792
1803
|
value = match.group(1) if match else None
|
|
1793
|
-
if value == "0.1.
|
|
1804
|
+
if value == "0.1.2":
|
|
1794
1805
|
value = os.environ.get("BUGX_VERSION", __version__)
|
|
1795
1806
|
return value if value and _CONTRACT_VERSION_RE.fullmatch(value) else None
|
|
1796
1807
|
|
|
@@ -1804,7 +1815,7 @@ def _json_version_marker(path: Path, key: str) -> str | None:
|
|
|
1804
1815
|
except (OSError, UnicodeError, json.JSONDecodeError, CliError):
|
|
1805
1816
|
return None
|
|
1806
1817
|
value = payload.get(key) if isinstance(payload, dict) else None
|
|
1807
|
-
if value == "0.1.
|
|
1818
|
+
if value == "0.1.2":
|
|
1808
1819
|
value = os.environ.get("BUGX_VERSION", __version__)
|
|
1809
1820
|
return value if isinstance(value, str) and _CONTRACT_VERSION_RE.fullmatch(value) else None
|
|
1810
1821
|
|
|
@@ -123,7 +123,7 @@ def _plugin_manifest(
|
|
|
123
123
|
if not isinstance(name, str) or not re.fullmatch(r"[a-z][a-z0-9-]{1,63}", name):
|
|
124
124
|
raise CliError(_i18n_exc("common.plugin_name_invalid", f"插件名称无效: {path}", path=path))
|
|
125
125
|
version = payload.get("version")
|
|
126
|
-
if version == "0.1.
|
|
126
|
+
if version == "0.1.2":
|
|
127
127
|
version = os.environ.get("BUGX_VERSION", __version__)
|
|
128
128
|
payload["version"] = version
|
|
129
129
|
if not isinstance(version, str) or not PLUGIN_VERSION_RE.fullmatch(version):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bugx-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Host-neutral adversarial white-box and black-box auditing agent CLI wrapper",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,16 +55,8 @@
|
|
|
55
55
|
"core/supervisor_types/**/*.py",
|
|
56
56
|
"core/webui/**/*.py",
|
|
57
57
|
"core/webui/adapters/*.py",
|
|
58
|
-
"core
|
|
58
|
+
"core/**/*.json",
|
|
59
59
|
"core/webui/static/",
|
|
60
|
-
"core/engine-integrity.json",
|
|
61
|
-
"core/lesson-ledger.json",
|
|
62
|
-
"core/ledger/lesson-replay-cases.json",
|
|
63
|
-
"core/adapters/*.json",
|
|
64
|
-
"core/locales/*.json",
|
|
65
|
-
"core/schemas/*.json",
|
|
66
|
-
"core/audit_packs/*/manifest.json",
|
|
67
|
-
"core/rules/*/*.json",
|
|
68
60
|
"core/**/*.md",
|
|
69
61
|
"core/**/*.txt",
|
|
70
62
|
"core/**/*.yaml",
|
|
@@ -83,12 +75,34 @@
|
|
|
83
75
|
"LICENSE"
|
|
84
76
|
],
|
|
85
77
|
"keywords": [
|
|
86
|
-
"
|
|
78
|
+
"agent",
|
|
79
|
+
"ai-agent",
|
|
80
|
+
"ai-code-audit",
|
|
81
|
+
"automated-code-audit",
|
|
87
82
|
"code-audit",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
83
|
+
"code-review",
|
|
84
|
+
"code-review-agent",
|
|
85
|
+
"automated-code-review",
|
|
86
|
+
"vibe-coding",
|
|
87
|
+
"vibe-coding-security",
|
|
88
|
+
"pr-review",
|
|
89
|
+
"pull-request-review",
|
|
90
|
+
"zero-false-positive",
|
|
91
|
+
"poc-generator",
|
|
92
|
+
"security-audit",
|
|
93
|
+
"vulnerability-scanner",
|
|
94
|
+
"vulnerability-mining",
|
|
95
|
+
"sast",
|
|
96
|
+
"static-analysis",
|
|
97
|
+
"mcp",
|
|
98
|
+
"mcp-server",
|
|
99
|
+
"mcp-security",
|
|
100
|
+
"claude-code",
|
|
101
|
+
"codex",
|
|
102
|
+
"opencode",
|
|
103
|
+
"zcode",
|
|
104
|
+
"devsecops",
|
|
105
|
+
"cli"
|
|
92
106
|
],
|
|
93
107
|
"engines": {
|
|
94
108
|
"node": ">=18.0.0"
|
package/pyproject.toml
CHANGED
|
@@ -5,10 +5,49 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bugx-cli"
|
|
7
7
|
dynamic = ["version"]
|
|
8
|
-
description = "Host-neutral adversarial white-box and black-box auditing agent"
|
|
8
|
+
description = "Host-neutral adversarial white-box and black-box auditing agent and automated code review engine"
|
|
9
9
|
readme = "docs/07_distribution/02_README_PYPI.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
license = "BUSL-1.1"
|
|
12
|
+
keywords = [
|
|
13
|
+
"agent",
|
|
14
|
+
"ai-agent",
|
|
15
|
+
"ai-code-audit",
|
|
16
|
+
"automated-code-audit",
|
|
17
|
+
"code-audit",
|
|
18
|
+
"code-review",
|
|
19
|
+
"code-review-agent",
|
|
20
|
+
"automated-code-review",
|
|
21
|
+
"vibe-coding",
|
|
22
|
+
"vibe-coding-security",
|
|
23
|
+
"pr-review",
|
|
24
|
+
"pull-request-review",
|
|
25
|
+
"zero-false-positive",
|
|
26
|
+
"poc-generator",
|
|
27
|
+
"security-audit",
|
|
28
|
+
"vulnerability-scanner",
|
|
29
|
+
"vulnerability-mining",
|
|
30
|
+
"sast",
|
|
31
|
+
"static-analysis",
|
|
32
|
+
"mcp",
|
|
33
|
+
"mcp-server",
|
|
34
|
+
"mcp-security",
|
|
35
|
+
"claude-code",
|
|
36
|
+
"openai-codex",
|
|
37
|
+
"opencode",
|
|
38
|
+
"zcode",
|
|
39
|
+
"devsecops",
|
|
40
|
+
]
|
|
41
|
+
classifiers = [
|
|
42
|
+
"Development Status :: 4 - Beta",
|
|
43
|
+
"Intended Audience :: Developers",
|
|
44
|
+
"Topic :: Security",
|
|
45
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
46
|
+
"Programming Language :: Python :: 3",
|
|
47
|
+
"Programming Language :: Python :: 3.11",
|
|
48
|
+
"Programming Language :: Python :: 3.12",
|
|
49
|
+
"Programming Language :: Python :: 3.13",
|
|
50
|
+
]
|
|
12
51
|
dependencies = []
|
|
13
52
|
|
|
14
53
|
[project.urls]
|
package/scripts/sync-version.mjs
CHANGED
|
@@ -15,7 +15,7 @@ if (!version || !/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(version)) {
|
|
|
15
15
|
// temporary/build tree before npm reads the manifest.
|
|
16
16
|
const pkgJsonPath = join(pkgRoot, 'package.json');
|
|
17
17
|
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
18
|
-
if (pkgJson.version === '0.1.
|
|
18
|
+
if (pkgJson.version === '0.1.2') {
|
|
19
19
|
console.error('[bugx] ✗ 源码 package.json 是模板;请先在临时构建树运行 scripts/render_version.py 或 scripts/package_dist.py');
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
Binary file
|
|
Binary file
|