bugx-cli 0.1.0 → 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 +193 -185
- package/core/README.md +2 -2
- package/core/agent/README.md +2 -1
- package/core/agent/agent_artifacts.py +8 -6
- package/core/agent/agent_eval.py +136 -54
- package/core/agent/agent_execution.py +218 -52
- package/core/agent/agent_orchestrator.py +14 -8
- package/core/agent/agent_targets.py +8 -2
- package/core/agent/feature_baseline.py +150 -0
- package/core/assets/README.md +3 -2
- package/core/assets/axe-core/LICENSE-3RD-PARTY.txt +66 -0
- package/core/assets/axe-core/LICENSE.txt +362 -0
- package/core/assets/axe-core/UPSTREAM.md +10 -0
- package/core/assets/axe-core/axe.min.js +12 -0
- package/core/assets/bugx-hero-en.svg +74 -0
- package/core/assets/bugx-hero-zh.svg +74 -0
- package/core/assets/bugx-social-preview.svg +71 -0
- package/core/assets/bugx-wechat-group.png +0 -0
- package/core/assets/codex.png +0 -0
- package/core/assets/dsh.png +0 -0
- package/core/assets/webui-chatgpt.jpg +0 -0
- package/core/assets/webui-session.jpg +0 -0
- package/core/assets/webui-skills.jpg +0 -0
- package/core/assets/webui-studio.jpg +0 -0
- package/core/assets/webui-zcode.jpg +0 -0
- package/core/assets/zcode.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/autonomous_cve/SPEC.md +1 -1
- package/core/autonomous_cve/attack_graph_store.py +152 -106
- package/core/autonomous_cve/behavior_graph.py +8 -2
- package/core/autonomous_cve/verifier.py +4 -1
- package/core/bugx.md +1 -1
- package/core/bugx_paths.py +43 -8
- package/core/cli-help.txt +66 -0
- package/core/cloud_sync/SPEC.md +1 -1
- package/core/cloud_sync/cloud_client.py +81 -11
- package/core/cloud_sync/cloud_onboard.py +42 -1
- package/core/cloud_sync/consent.py +33 -3
- package/core/cloud_sync/flywheel_client.py +186 -15
- package/core/cloud_sync/network_transport.py +24 -3
- package/core/cloud_sync/sensitive_filter.py +2 -2
- package/core/cloud_sync/sync_push.py +12 -10
- package/core/contracts/AGENT_GUIDE.md +6 -9
- package/core/contracts/README.md +2 -2
- package/core/contracts/bugx-runtime-contract.md +1 -1
- package/core/contracts/bugx-worker.md +1 -1
- package/core/contracts/engine_gap_contracts.py +86 -3
- package/core/coverage/coverage_discovery.py +599 -29
- package/core/coverage/coverage_evidence.py +47 -0
- package/core/coverage/coverage_forensics.py +9 -0
- package/core/coverage/coverage_validate.py +6 -1
- package/core/dev_harness/SPEC.md +1 -1
- package/core/engine-integrity.json +670 -442
- package/core/fuzzing/concurrency_fuzzer.py +53 -0
- package/core/fuzzing/differential_oracle.py +562 -27
- package/core/fuzzing/fuzz_input.py +109 -6
- package/core/fuzzing/stateful_fuzzer.py +72 -0
- package/core/governance/secret_redactor.py +22 -10
- package/core/host_acp/SPEC.md +1 -1
- package/core/host_acp/__init__.py +4 -4
- package/core/host_acp/claude.py +59 -1
- package/core/host_acp/cline.py +64 -1
- package/core/host_acp/codex.py +56 -1
- package/core/host_acp/dsh.py +59 -1
- package/core/host_acp/opencode.py +56 -1
- package/core/host_acp/pi.py +59 -1
- package/core/host_acp/zcode.py +59 -1
- package/core/host_runtime/SPEC.md +1 -1
- package/core/host_runtime/adapters.py +1 -1
- package/core/host_runtime/cline.py +13 -0
- package/core/host_runtime/host_evaluators.py +44 -4
- package/core/host_runtime/host_probe.py +1 -1
- package/core/host_runtime/host_provider_arbitrator.py +116 -62
- package/core/host_runtime/host_registry.py +15 -8
- package/core/host_runtime/mcp_registry_gate.py +12 -1
- package/core/host_runtime/pi.py +102 -0
- package/core/host_runtime/provider_facts.py +66 -0
- package/core/hosts/SPEC.md +1 -1
- package/core/hosts/__init__.py +6 -2
- package/core/hosts/_dsh_usage.py +1 -1
- package/core/hosts/base.py +32 -4
- package/core/hosts/claude.py +55 -0
- package/core/hosts/cline.py +6 -2
- package/core/hosts/codex.py +58 -0
- package/core/hosts/dsh.py +9 -1
- package/core/hosts/opencode.py +6 -6
- package/core/hosts/pi.py +159 -2
- package/core/infra/README.md +4 -2
- package/core/infra/__init__.py +2 -0
- package/core/infra/build_info.py +22 -3
- package/core/infra/client_metadata.py +1 -1
- package/core/infra/json_utils.py +22 -0
- package/core/launch_phases/README.md +6 -3
- package/core/launch_phases/SPEC.md +1 -1
- package/core/launch_phases/common.py +21 -2
- package/core/launch_phases/finding_confirm_phase.py +170 -5
- package/core/launch_phases/finding_settlement.py +188 -1
- package/core/launch_phases/judge_phase.py +69 -12
- package/core/launch_phases/orchestrator_controls.py +11 -7
- package/core/launch_phases/post_coverage_sync.py +9 -2
- package/core/launch_phases/post_phase.py +144 -8
- package/core/launch_phases/post_receipt.py +12 -1
- package/core/launch_phases/pre_phase.py +3 -3
- package/core/launch_phases/pre_recon_scout.py +66 -36
- package/core/launch_phases/pre_state_builder.py +23 -176
- package/core/launch_phases/report_sharing.py +3 -7
- package/core/launch_phases/round_orchestrator.py +129 -58
- package/core/launch_phases/semantic_recon.py +545 -0
- package/core/launch_phases/session_runtime.py +56 -9
- package/core/launch_phases/startup_gates.py +36 -8
- package/core/launch_phases/startup_interaction.py +68 -12
- package/core/launch_phases/startup_version_gate.py +13 -3
- package/core/launch_phases/supervisor_bridge.py +46 -17
- package/core/launch_phases/supervisor_coverage.py +8 -2
- package/core/launch_phases/supervisor_degraded.py +1 -9
- package/core/launch_phases/verify_loop.py +767 -0
- package/core/launch_phases/worker_barriers.py +15 -5
- package/core/launch_phases/worker_orchestrator.py +105 -25
- package/core/launch_phases/worker_prior.py +115 -0
- package/core/ledger/README.md +2 -1
- package/core/ledger/SPEC.md +1 -1
- package/core/ledger/_facade.py +2 -1
- package/core/ledger/archive_ops.py +60 -2
- package/core/ledger/cli.py +6 -1
- package/core/ledger/export_ops.py +6 -1
- package/core/ledger/finding_confirmation.py +48 -6
- package/core/ledger/finding_lifecycle.py +428 -5
- package/core/ledger/finding_verification.py +555 -10
- package/core/ledger/fp_ledger.py +255 -0
- package/core/ledger/incidents.py +10 -4
- package/core/ledger/patterns.py +10 -7
- package/core/ledger/receipt_contract.py +17 -1
- package/core/ledger/sync_ops.py +21 -16
- package/core/ledger/tool_experience.py +2 -1
- package/core/ledger/verify_life.py +88 -17
- package/core/locales/en-US.json +2 -2
- package/core/locales/zh-CN.json +2 -2
- package/core/mcp_handlers/SPEC.md +1 -1
- package/core/mcp_handlers/base.py +23 -3
- package/core/mcp_handlers/channel_lifecycle.py +85 -30
- package/core/mcp_handlers/retrieval_handlers.py +11 -1
- package/core/mcp_handlers/rpc_server.py +6 -1
- package/core/mcp_handlers/supervisor_handlers.py +32 -6
- package/core/mcp_handlers/tool_table.py +15 -0
- package/core/mcp_runtime_support/environment.py +0 -38
- package/core/mcp_runtime_support/verifier.py +0 -52
- package/core/metadata.txt +2 -3
- package/core/planning/README.md +2 -1
- package/core/planning/domain_router.py +4 -2
- package/core/planning/dynamic_flow_analyzer.py +219 -14
- package/core/planning/judge_pipeline.py +87 -4
- package/core/planning/prompt_harness.py +57 -15
- package/core/planning/prompt_policy_engine.py +386 -0
- package/core/planning/spec_harvester.py +4 -4
- package/core/probes/INTERFACE.md +11 -1
- package/core/probes/SPEC.md +11 -1
- package/core/probes/__init__.py +46 -40
- package/core/probes/android_probe.py +177 -9
- package/core/probes/codebase_memory_probe.py +57 -0
- package/core/probes/desktop_probe.py +104 -0
- package/core/probes/differential_probe.py +99 -21
- package/core/probes/efficiency_probe.py +64 -0
- package/core/probes/ios_binary_probe.py +105 -1
- package/core/probes/memory_probe.py +66 -0
- package/core/probes/miniprogram_probe.py +75 -13
- package/core/probes/mobile_probe.py +215 -30
- package/core/probes/native_probe.py +88 -0
- package/core/probes/openwiki_probe.py +70 -0
- package/core/probes/pattern_probe.py +106 -0
- package/core/probes/platform_probe.py +81 -0
- package/core/probes/probe_registry.py +108 -7
- package/core/probes/sast_fixture_corpus.py +340 -0
- package/core/probes/sast_probe.py +553 -52
- package/core/probes/sast_rules.py +668 -28
- package/core/probes/sca_scanner.py +48 -0
- package/core/probes/ui_accessibility.py +149 -0
- package/core/probes/ui_audit.py +513 -0
- package/core/probes/ui_contract.py +273 -0
- package/core/probes/ui_evidence.py +212 -0
- package/core/probes/ui_measurements.py +314 -0
- package/core/probes/ui_repair.py +250 -0
- package/core/probes/ui_review.py +133 -0
- package/core/probes/ui_storybook.py +107 -0
- package/core/probes/ui_tokens.py +185 -0
- package/core/probes/ui_visual_diff.py +131 -0
- package/core/probes/web_probe.py +373 -18
- package/core/project_profiler/SPEC.md +1 -1
- package/core/project_profiler/arbitrator.py +6 -1
- package/core/project_profiler/detector.py +8 -1
- package/core/project_profiler/strategy.py +51 -15
- package/core/prompts/README.md +4 -2
- package/core/prompts/command_routing_en.md +2 -2
- package/core/prompts/command_routing_zh.md +2 -2
- package/core/prompts/policies/prompt_policies.json +101 -0
- package/core/prompts/stages/stage_repair.md +1 -1
- package/core/prompts/stages/stage_verify.defensive.md +42 -0
- package/core/prompts/stages/stage_verify.md +44 -0
- package/core/repair/README.md +1 -1
- package/core/repair/l7_repair_loop.py +1 -4
- package/core/repair/rsi_fixer.py +4 -4
- package/core/repair/rsi_loop.py +1 -3
- package/core/repair/rsi_repair.py +7 -7
- package/core/repair/rsi_scope.py +27 -8
- package/core/report_engine/SPEC.md +1 -1
- package/core/report_engine/attestation.py +8 -4
- package/core/report_engine/finding_report.py +2 -1
- package/core/report_engine/models.py +7 -9
- package/core/report_engine/report_share.py +0 -8
- package/core/report_engine/sast_bridge.py +2 -2
- package/core/report_engine/server.py +18 -8
- package/core/report_engine/web-conformance.md +123 -18
- package/core/report_engine/web_conformance.py +21 -52
- package/core/retrieval/README.md +2 -1
- package/core/retrieval/SPEC.md +1 -1
- package/core/retrieval/code_analyzer.py +50 -14
- package/core/retrieval/context_assembler.py +7 -1
- package/core/retrieval/knowledge_sync.py +108 -14
- package/core/retrieval/pitfall_packs.py +277 -0
- package/core/retrieval/symbol_index.py +25 -6
- package/core/retrieval/universal_code_matcher.py +234 -49
- package/core/runtime/README.md +1 -1
- package/core/runtime/bugx_logging.py +78 -7
- package/core/runtime/fixture_solidify.py +5 -10
- package/core/runtime/global_telemetry.py +20 -0
- package/core/runtime/incident_eval.py +1 -1
- package/core/runtime/model_runner.py +4 -41
- package/core/runtime/platform_adapter.py +2 -2
- package/core/runtime/prep_validate.py +4 -2
- package/core/runtime/project_settings.py +2 -1
- package/core/runtime/scenario_eval.py +50 -8
- package/core/skills/bugx_docs_mcp_server.py +3 -1
- package/core/skills/bugx_mcp_server.py +29 -2
- package/core/skills/tools_kb.py +1 -1
- package/core/supervisor/README.md +1 -1
- package/core/supervisor/SPEC.md +1 -1
- package/core/supervisor/budget_governor.py +503 -9
- package/core/supervisor/checkpoint_pipeline.py +248 -6
- package/core/supervisor/checkpoint_sync.py +13 -0
- package/core/supervisor/claim_events.py +1 -1
- package/core/supervisor/finding_workflow.py +22 -5
- package/core/supervisor/lease_manager.py +1 -1
- package/core/supervisor/lifecycle_blocks.py +6 -1
- package/core/supervisor/rejection_remedies.py +52 -5
- package/core/supervisor/serial_authorization.py +48 -4
- package/core/supervisor/task_scheduler.py +2 -2
- package/core/supervisor/worker_checkpoint.py +8 -1
- package/core/supervisor/worker_runtime.py +8 -2
- package/core/supervisor_types/worker_claim.py +9 -0
- package/core/webui/README.md +1 -1
- package/core/webui/SPEC.md +2 -1
- package/core/webui/adapters/claude.py +5 -1
- package/core/webui/adapters/cline.py +10 -2
- package/core/webui/adapters/codex.py +5 -1
- package/core/webui/adapters/dsh.py +5 -1
- package/core/webui/docs_session_service.py +2 -2
- package/core/webui/mcp_inspector.py +11 -7
- package/core/webui/static/00-base.css +1060 -0
- package/core/webui/static/01-monitoring.css +802 -0
- package/core/webui/static/02-header-actions.css +321 -0
- package/core/webui/static/03-trigger-popover.css +697 -0
- package/core/webui/static/04-composer.css +628 -0
- package/core/webui/static/05-skills-center.css +878 -0
- package/core/webui/static/06-mcp-center.css +623 -0
- package/core/webui/static/07-skill-detail.css +265 -0
- package/core/webui/static/08-files-management.css +167 -0
- package/core/webui/static/09-files-center.css +386 -0
- package/core/webui/static/10-icons.css +105 -0
- package/core/webui/static/11-project-options.css +185 -0
- package/core/webui/static/12-profile-tab.css +383 -0
- package/core/webui/static/design-tokens.css +113 -0
- package/core/webui/static/index.html +14 -1
- package/core/webui/workspace_service.py +1 -1
- package/docs/07_distribution/01_README_NPM.md +193 -185
- package/ecosystem/integrations/README.md +1 -1
- package/ecosystem/integrations/dsh/mcp/package.json +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 +4 -4
- package/ecosystem/integrations/opencode/mcp-lock.json +14 -6
- package/ecosystem/integrations/opencode/opencode.json +23 -12
- 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/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 +37 -0
- package/interfaces/cli/bugx_cli/__init__.py +4 -2
- package/interfaces/cli/bugx_cli/cli.py +172 -69
- package/interfaces/cli/bugx_cli/commands/advisory.py +1 -1
- package/interfaces/cli/bugx_cli/commands/agent.py +461 -134
- package/interfaces/cli/bugx_cli/commands/audit.py +10 -9
- package/interfaces/cli/bugx_cli/commands/autonomous.py +1 -1
- package/interfaces/cli/bugx_cli/commands/cloud.py +31 -22
- package/interfaces/cli/bugx_cli/commands/doctor.py +449 -204
- package/interfaces/cli/bugx_cli/commands/interaction.py +5 -1
- package/interfaces/cli/bugx_cli/commands/knowledge.py +5 -4
- package/interfaces/cli/bugx_cli/commands/lifecycle.py +3 -3
- package/interfaces/cli/bugx_cli/commands/plugin.py +58 -23
- package/interfaces/cli/bugx_cli/commands/plugin_claude.py +7 -7
- package/interfaces/cli/bugx_cli/commands/plugin_funide.py +2 -1
- package/interfaces/cli/bugx_cli/commands/plugin_zcode.py +1 -1
- package/interfaces/cli/bugx_cli/commands/project.py +6 -13
- package/interfaces/cli/bugx_cli/commands/report.py +2 -6
- package/interfaces/cli/bugx_cli/commands/system.py +524 -169
- package/interfaces/cli/bugx_cli/common.py +21 -15
- package/interfaces/cli/bugx_cli/host_adapters.py +29 -54
- package/interfaces/cli/bugx_cli/hosts/registry.py +8 -6
- package/interfaces/cli/bugx_cli/infra/ai_advisor.py +157 -27
- package/interfaces/cli/bugx_cli/infra/engine_installer.py +35 -16
- package/interfaces/cli/bugx_cli/infra/host_sync.py +11 -8
- package/interfaces/cli/bugx_cli/infra/mcp_advisor.py +76 -5
- package/interfaces/cli/bugx_cli/infra/security.py +13 -6
- package/package.json +30 -15
- package/pyproject.toml +60 -9
- package/scripts/ensure-python.mjs +7 -7
- package/scripts/sync-version.mjs +10 -21
- package/scripts/test-npm-wrapper.mjs +1 -1
- package/core/assets/bugx-hero-cn.png +0 -0
- package/core/assets/bugx-hero-en.png +0 -0
- package/core/webui/static/project-settings.css +0 -6458
- package/docs/07_distribution/README.md +0 -16
- package/docs/README.md +0 -121
- package/interfaces/README.md +0 -143
- package/interfaces/bin/README.md +0 -35
- package/interfaces/cli/README.md +0 -90
- package/scripts/README.md +0 -118
|
@@ -230,7 +230,7 @@ def _command_audit_graph(args: argparse.Namespace) -> int:
|
|
|
230
230
|
result: dict[str, object] | None = None
|
|
231
231
|
exit_code = 1
|
|
232
232
|
try:
|
|
233
|
-
from
|
|
233
|
+
from ..infra.security import _find_repo_root
|
|
234
234
|
repo_root = _find_repo_root(Path(__file__))
|
|
235
235
|
workspace_module, targets_module, orchestrator_module = _engine_modules(repo_root)
|
|
236
236
|
runtime_root = _private_runtime_root()
|
|
@@ -327,7 +327,7 @@ def _command_audit_penetration(args: argparse.Namespace) -> int:
|
|
|
327
327
|
|
|
328
328
|
try:
|
|
329
329
|
_ensure_core_importable()
|
|
330
|
-
from
|
|
330
|
+
from ..infra.security import _find_repo_root
|
|
331
331
|
repo_root = _find_repo_root(Path(__file__))
|
|
332
332
|
core_root = repo_root / "core"
|
|
333
333
|
scripts_root = repo_root / "scripts"
|
|
@@ -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)
|
|
@@ -47,7 +47,7 @@ def _estimate_complexity_baseline(root: Path, manifest_path: Path | None = None)
|
|
|
47
47
|
|
|
48
48
|
def _install_host(root: Path, host: str, *, timeout: float = 180.0) -> dict[str, object]:
|
|
49
49
|
"""Repair the selected host entry before starting the no-prompt run."""
|
|
50
|
-
from
|
|
50
|
+
from ..infra.security import _find_repo_root
|
|
51
51
|
repo = _find_repo_root(Path(__file__))
|
|
52
52
|
source_cli = repo / "interfaces" / "cli" / "bugx_cli" / "cli.py"
|
|
53
53
|
if not source_cli.is_file():
|
|
@@ -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:
|
|
@@ -378,12 +397,13 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
378
397
|
if act == "upload":
|
|
379
398
|
try:
|
|
380
399
|
bundle = _read_sync_bundle(Path(args.input).expanduser().absolute())
|
|
381
|
-
# DOC-211:upload 与 sync
|
|
400
|
+
# DOC-211:upload 与 sync 同吃一档敏感策略;配置缺失/非法取
|
|
401
|
+
# 安全默认 redact(F-025:原样出网必须显式 allow)。
|
|
382
402
|
try:
|
|
383
403
|
from core.cloud_sync.cloud_client import load_cloud_config
|
|
384
|
-
upload_policy = load_cloud_config().get("sensitive_policy") or "
|
|
404
|
+
upload_policy = load_cloud_config().get("sensitive_policy") or "redact"
|
|
385
405
|
except Exception: # noqa: BLE001
|
|
386
|
-
upload_policy = "
|
|
406
|
+
upload_policy = "redact"
|
|
387
407
|
result = client.import_knowledge_bundle(
|
|
388
408
|
bundle, mode=args.mode, sensitive_policy=upload_policy)
|
|
389
409
|
except (OSError, ValueError, RuntimeError) as exc:
|
|
@@ -1194,17 +1214,7 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
1194
1214
|
return 2
|
|
1195
1215
|
|
|
1196
1216
|
if act == "sync":
|
|
1197
|
-
|
|
1198
|
-
# onboard-on(:1216)刻意传显式 "all",不受配置收窄。
|
|
1199
|
-
try:
|
|
1200
|
-
from core.cloud_sync.cloud_client import load_cloud_config
|
|
1201
|
-
sync_default_scope = load_cloud_config().get("sync_scope_default") or "all"
|
|
1202
|
-
except Exception: # noqa: BLE001
|
|
1203
|
-
sync_default_scope = "all"
|
|
1204
|
-
if getattr(args, "sync_scope", None) is None and sync_default_scope != "all":
|
|
1205
|
-
print(f"[cloud] sync_scope_default={sync_default_scope}(配置生效;显式 --scope 可覆盖)")
|
|
1206
|
-
return _cloud_sync_command(args, client, root, get_device_id,
|
|
1207
|
-
default_scope=sync_default_scope)
|
|
1217
|
+
return _cloud_sync_command(args, client, root, get_device_id, scope=scope)
|
|
1208
1218
|
|
|
1209
1219
|
if act == "projects":
|
|
1210
1220
|
sub = getattr(args, "cloud_project_action", "list")
|
|
@@ -1289,10 +1299,9 @@ def command_cloud(args: argparse.Namespace) -> int:
|
|
|
1289
1299
|
print("[cloud] 已开启云端同步,立即同步 global + project…")
|
|
1290
1300
|
sync_args = argparse.Namespace(
|
|
1291
1301
|
project_slug=args.project_slug,
|
|
1292
|
-
sync_scope="all",
|
|
1293
1302
|
detail_mode=None,
|
|
1294
1303
|
)
|
|
1295
|
-
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")
|
|
1296
1305
|
|
|
1297
1306
|
return 2
|
|
1298
1307
|
|