fixos 2.2.57__tar.gz → 2.2.59__tar.gz
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.
- {fixos-2.2.57 → fixos-2.2.59}/PKG-INFO +2 -2
- fixos-2.2.59/VERSION +1 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/autonomous_session.py +75 -32
- fixos-2.2.59/fixos/cli/_auto_cleanup.py +172 -0
- fixos-2.2.59/fixos/cli/_cleanup_free_target.py +310 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_space.py +887 -67
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/cleanup_cmd.py +280 -7
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/fix_cmd.py +243 -154
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/main.py +1 -0
- fixos-2.2.59/fixos/cli/mcp_cmd.py +68 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/constants.py +3 -2
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/dev_project_analyzer.py +100 -25
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/disk_analyzer.py +78 -20
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/project_scanner.py +2 -2
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/quick_snapshot.py +58 -11
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/service_cleanup.py +32 -23
- fixos-2.2.59/fixos/diagnostics/state_retention.py +214 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/venv_cleanup.py +15 -5
- fixos-2.2.59/fixos/mcp_server.py +763 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orchestrator/orchestrator.py +13 -1
- {fixos-2.2.57 → fixos-2.2.59}/fixos.egg-info/PKG-INFO +2 -2
- {fixos-2.2.57 → fixos-2.2.59}/fixos.egg-info/SOURCES.txt +16 -3
- {fixos-2.2.57 → fixos-2.2.59}/fixos.egg-info/requires.txt +1 -1
- fixos-2.2.59/fixos.egg-info/top_level.txt +1 -0
- {fixos-2.2.57 → fixos-2.2.59}/pyproject.toml +4 -3
- fixos-2.2.59/tests/unit/test_auto_cleanup.py +430 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_auto_no_llm.py +20 -1
- fixos-2.2.59/tests/unit/test_autonomous_reporting.py +199 -0
- fixos-2.2.59/tests/unit/test_cleanup_docker_buildcache.py +103 -0
- fixos-2.2.59/tests/unit/test_cleanup_free_target.py +418 -0
- fixos-2.2.59/tests/unit/test_cleanup_plan_contract.py +204 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_safety.py +17 -0
- fixos-2.2.59/tests/unit/test_cleanup_space.py +622 -0
- fixos-2.2.59/tests/unit/test_disk_analyzer_capacity.py +66 -0
- fixos-2.2.59/tests/unit/test_jetbrains_toolbox_v2.py +72 -0
- fixos-2.2.59/tests/unit/test_mcp_server.py +303 -0
- fixos-2.2.59/tests/unit/test_path_scope.py +48 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_project_scanner.py +215 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_quick_snapshot.py +120 -0
- fixos-2.2.59/tests/unit/test_standard_adoption_projection.py +30 -0
- fixos-2.2.59/tests/unit/test_state_retention.py +168 -0
- fixos-2.2.57/VERSION +0 -1
- fixos-2.2.57/docs/examples/advanced_usage.py +0 -6
- fixos-2.2.57/docs/examples/quickstart.py +0 -5
- fixos-2.2.57/fixos.egg-info/top_level.txt +0 -9
- fixos-2.2.57/scripts/pyqual-calibrate.py +0 -290
- fixos-2.2.57/tests/unit/test_cleanup_space.py +0 -304
- {fixos-2.2.57 → fixos-2.2.59}/.env.example +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/CHANGELOG.md +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/LICENSE +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/MANIFEST.in +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/README.md +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/README.md +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/TEST_RESULTS.md +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/TEST_RESULTS_V2.md +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/alpine/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/arch/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/base/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/broken-audio/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/broken-full/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/broken-network/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/broken-thumbnails/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/debian/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/docker-compose.multi-system.yml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/docker-compose.yml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/fedora/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/test-multi-system.sh +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/test-scenarios.sh +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/ubuntu/Dockerfile +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/docker/validate-scenario.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/__main__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/autonomous.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/hitl.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/hitl_session.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/session_core.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/session_handlers.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/agent/session_io.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/anonymizer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/__main__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_docker_volumes.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_flatpak.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_home.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_snap.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_system.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_utils.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/_cleanup_venvs.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/ask_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/config_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/dashboard.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/features_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/history_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/jetbrains_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/orchestrate_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/output_formatter.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/profile_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/projects_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/provider_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/quick_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/quickfix_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/report_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/rollback_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/scan_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/shared.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/shell_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/token_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli/watch_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/cli.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/config.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/config_interactive.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_flatpak_analysis_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_flatpak_execution_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_flatpak_recommendations_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_storage_container_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_storage_system_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/_storage_user_mixin.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/cache_discovery.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/_shared.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/audio.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/file_analysis.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/hardware.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/packages.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/resources.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/security.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/storage_optimization.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/system_core.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/checks/thumbnails.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/docker_network_cleanup.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/docker_startup_optimizer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/flatpak_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/jetbrains_ai.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/jetbrains_recovery.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/native_scan.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/orphaned_workloads.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/process_chains.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/service_details.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/service_scanner.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/storage_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/system_checks.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/diagnostics/utils.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/endpoint_refresh.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/auditor.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/catalog.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/data/packages.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/data/profiles/developer.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/data/profiles/office.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/data/profiles/sysadmin.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/installer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/profiles.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/features/renderer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/fixes/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/interactive/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/interactive/cleanup_planner.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/llm_shell.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orchestrator/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orchestrator/executor.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orchestrator/graph.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orchestrator/rollback.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/orphan_pins.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/platform_utils.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/base.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/audio.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/disk.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/hardware.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/resources.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/security.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/builtin/thumbnails.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/plugins/registry.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/profiles/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/profiles/desktop.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/profiles/developer.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/profiles/minimal.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/profiles/server.yaml +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/providers/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/providers/gemini_native.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/providers/llm.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/providers/llm_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/providers/schemas.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/system_checks.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/utils/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/utils/anonymizer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/utils/terminal.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/utils/timeout.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/utils/web_search.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos/watch.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos.egg-info/dependency_links.txt +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/fixos.egg-info/entry_points.txt +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/pytest.ini +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/requirements-dev.txt +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/requirements.txt +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/setup.cfg +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/setup.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/conftest.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_anonymization_layers.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_audio_broken.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_cli.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_diagnostics_integration.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_executor.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_multi_system.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_network_broken.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/e2e/test_thumbnails_broken.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/test_fixos.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/__init__.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_anonymizer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_ask_and_nl_group.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cache_discovery.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_docker_volumes.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_effectiveness.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_planner.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_retention.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_tmp.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cleanup_utils.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_cli_main.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_core.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_dashboard.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_dev_project_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_disk_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_docker_network_cleanup.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_docker_startup_optimizer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_endpoint_refresh.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_executor.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_gemini_native_client.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_jetbrains_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_jetbrains_recovery.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_llm_auth_stop.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_llm_provider.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_native_scan.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_ollama_endpoint.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_orchestrator.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_orphan_pins.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_orphaned_workloads.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_packaging_data.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_process_chains.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_projects_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_quick_cmd.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_resources_quick.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_security_quick.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_service_cleanup.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_service_scanner.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_shell_ux.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_storage_analyzer.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_system_checks_parallel.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_venv_cleanup.py +0 -0
- {fixos-2.2.57 → fixos-2.2.59}/tests/unit/test_version_parity.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fixos
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.59
|
|
4
4
|
Summary: AI-powered Linux/Windows diagnostics and repair – audio, hardware, system issues
|
|
5
5
|
Home-page: https://github.com/wronai/fixos
|
|
6
6
|
Author: fixos contributors
|
|
@@ -35,7 +35,7 @@ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
|
35
35
|
Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
|
|
36
36
|
Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
|
|
37
37
|
Requires-Dist: pytest-sugar>=0.9.7; extra == "dev"
|
|
38
|
-
Requires-Dist: goal>=2.
|
|
38
|
+
Requires-Dist: goal[publish]>=2.2.8; python_version >= "3.12" and extra == "dev"
|
|
39
39
|
Requires-Dist: costs>=0.1.20; extra == "dev"
|
|
40
40
|
Dynamic: home-page
|
|
41
41
|
Dynamic: license-file
|
fixos-2.2.59/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.2.59
|
|
@@ -94,18 +94,34 @@ class AgentReport:
|
|
|
94
94
|
|
|
95
95
|
def summary(self) -> str:
|
|
96
96
|
elapsed = int(time.time() - self.start_time)
|
|
97
|
+
successful = failed = simulated = 0
|
|
98
|
+
action_lines = []
|
|
99
|
+
for i, action in enumerate(self.fixes_applied, 1):
|
|
100
|
+
if action.result == "[DRY-RUN]":
|
|
101
|
+
simulated += 1
|
|
102
|
+
icon = "🧪"
|
|
103
|
+
elif action.success is True:
|
|
104
|
+
successful += 1
|
|
105
|
+
icon = "✅"
|
|
106
|
+
elif action.success is False:
|
|
107
|
+
failed += 1
|
|
108
|
+
icon = "❌"
|
|
109
|
+
else:
|
|
110
|
+
icon = "❔"
|
|
111
|
+
action_lines.append(f" {i}. {icon} `{action.command}`")
|
|
112
|
+
action_lines.append(f" Powód: {action.reason}")
|
|
113
|
+
|
|
97
114
|
lines = [
|
|
98
115
|
f" ⏱️ Czas: {elapsed}s",
|
|
99
|
-
f" 🔧
|
|
116
|
+
f" 🔧 Udane operacje: {successful}",
|
|
117
|
+
f" ❌ Nieudane operacje: {failed}",
|
|
118
|
+
f" 🧪 Symulacje: {simulated}",
|
|
100
119
|
f" 🔎 Wyszukiwania: {len(self.searches_done)}",
|
|
101
120
|
f" 🔴 Wykryte problemy: {len(self.problems_found)}",
|
|
102
121
|
]
|
|
103
|
-
if
|
|
104
|
-
lines.append("\n
|
|
105
|
-
|
|
106
|
-
icon = "✅" if a.success else "❌"
|
|
107
|
-
lines.append(f" {i}. {icon} `{a.command}`")
|
|
108
|
-
lines.append(f" Powód: {a.reason}")
|
|
122
|
+
if action_lines:
|
|
123
|
+
lines.append("\n Akcje sesji:")
|
|
124
|
+
lines.extend(action_lines)
|
|
109
125
|
return "\n".join(lines)
|
|
110
126
|
|
|
111
127
|
|
|
@@ -132,7 +148,15 @@ class AutonomousSession:
|
|
|
132
148
|
self.use_llm = use_llm
|
|
133
149
|
self.dry_run = dry_run
|
|
134
150
|
self._heuristic_queue: list[dict[str, Any]] | None = None
|
|
135
|
-
self.
|
|
151
|
+
if self.use_llm is False:
|
|
152
|
+
self.llm = None
|
|
153
|
+
else:
|
|
154
|
+
try:
|
|
155
|
+
self.llm = LLMClient(config)
|
|
156
|
+
except LLMError:
|
|
157
|
+
if self.use_llm is True:
|
|
158
|
+
raise
|
|
159
|
+
self.llm = None
|
|
136
160
|
self.report = AgentReport()
|
|
137
161
|
self.fix_count = 0
|
|
138
162
|
self.search_count = 0
|
|
@@ -180,7 +204,10 @@ class AutonomousSession:
|
|
|
180
204
|
else "heurystyki lokalne (bez LLM)"
|
|
181
205
|
)
|
|
182
206
|
print(f"\n{'═' * UI_BORDER_WIDTH}")
|
|
183
|
-
|
|
207
|
+
if self.dry_run:
|
|
208
|
+
print(" 🧪 TRYB SYMULACJI – komendy nie będą wykonywane.")
|
|
209
|
+
else:
|
|
210
|
+
print(" ⚠️ TRYB AUTONOMICZNY – agent sam wykonuje komendy!")
|
|
184
211
|
print(" Naciśnij Ctrl+C w dowolnym momencie aby przerwać.")
|
|
185
212
|
print("═" * UI_BORDER_WIDTH)
|
|
186
213
|
print(f"\n Max napraw: {self.max_fixes}")
|
|
@@ -285,18 +312,29 @@ class AutonomousSession:
|
|
|
285
312
|
|
|
286
313
|
diag = self.diagnostics if isinstance(self.diagnostics, dict) else {}
|
|
287
314
|
|
|
288
|
-
# 1. Inspect findings already present in diagnostics dict
|
|
315
|
+
# 1. Inspect findings and alerts already present in diagnostics dict
|
|
289
316
|
for key, val in diag.items():
|
|
290
317
|
if isinstance(val, dict):
|
|
291
318
|
for item in val.get("findings", []) or val.get("problems", []) or []:
|
|
292
|
-
if isinstance(item, dict)
|
|
319
|
+
if isinstance(item, dict):
|
|
293
320
|
sev = str(item.get("severity", "warning")).lower()
|
|
321
|
+
title = str(item.get("title") or item.get("description") or key)
|
|
294
322
|
if sev in ("critical", "warning", "high", "error"):
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
sev
|
|
299
|
-
|
|
323
|
+
if title and title not in self.report.problems_found:
|
|
324
|
+
self.report.problems_found.append(title)
|
|
325
|
+
if item.get("command"):
|
|
326
|
+
_add_candidate(str(item["command"]), title, sev)
|
|
327
|
+
if key == "quick" or "alerts" in val:
|
|
328
|
+
for alert in val.get("alerts", []):
|
|
329
|
+
if isinstance(alert, dict):
|
|
330
|
+
msg = alert.get("message") or alert.get("resource")
|
|
331
|
+
sev = str(alert.get("severity", "warning")).lower()
|
|
332
|
+
if (
|
|
333
|
+
sev in ("critical", "warning", "high", "error")
|
|
334
|
+
and msg
|
|
335
|
+
and msg not in self.report.problems_found
|
|
336
|
+
):
|
|
337
|
+
self.report.problems_found.append(msg)
|
|
300
338
|
|
|
301
339
|
# 2. Run offline diagnostic plugins if no findings were pre-populated
|
|
302
340
|
if not actions and diag.get("_run_plugins", True) is not False:
|
|
@@ -308,15 +346,19 @@ class AutonomousSession:
|
|
|
308
346
|
registry.discover()
|
|
309
347
|
for res in registry.run():
|
|
310
348
|
for finding in res.findings:
|
|
311
|
-
if finding.
|
|
349
|
+
if finding.severity in (
|
|
312
350
|
Severity.CRITICAL,
|
|
313
351
|
Severity.WARNING,
|
|
314
352
|
):
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
353
|
+
ftitle = f"{finding.title}: {finding.description}"
|
|
354
|
+
if ftitle not in self.report.problems_found:
|
|
355
|
+
self.report.problems_found.append(ftitle)
|
|
356
|
+
if finding.command:
|
|
357
|
+
_add_candidate(
|
|
358
|
+
finding.command,
|
|
359
|
+
ftitle,
|
|
360
|
+
finding.severity.value,
|
|
361
|
+
)
|
|
320
362
|
except Exception: # noqa: BLE001, S110
|
|
321
363
|
pass
|
|
322
364
|
|
|
@@ -358,18 +400,9 @@ class AutonomousSession:
|
|
|
358
400
|
action_data = self._heuristic_queue.pop(0)
|
|
359
401
|
analysis = action_data.get("analysis", "")
|
|
360
402
|
reason = action_data.get("reason", "")
|
|
361
|
-
cmd = action_data.get("command", "")
|
|
362
403
|
print(f"\n 📋 Analiza: {analysis}")
|
|
363
404
|
print(f" 🎯 Akcja: EXEC – {reason}")
|
|
364
405
|
|
|
365
|
-
if getattr(self, "dry_run", False):
|
|
366
|
-
print(f" [DRY-RUN] Pominięto wykonanie: {cmd}")
|
|
367
|
-
self.report.fixes_applied.append(
|
|
368
|
-
FixAction(command=cmd, reason=reason, result="[DRY-RUN]", success=True)
|
|
369
|
-
)
|
|
370
|
-
self.fix_count += 1
|
|
371
|
-
return True
|
|
372
|
-
|
|
373
406
|
self._handle_exec(action_data)
|
|
374
407
|
return True
|
|
375
408
|
|
|
@@ -387,6 +420,8 @@ class AutonomousSession:
|
|
|
387
420
|
def _query_llm(self) -> str | None:
|
|
388
421
|
"""Query LLM and return reply."""
|
|
389
422
|
try:
|
|
423
|
+
if self.llm is None:
|
|
424
|
+
self.llm = LLMClient(self.config)
|
|
390
425
|
return self.llm.chat(
|
|
391
426
|
self.messages, max_tokens=DEFAULT_TOKEN_LIMIT, temperature=0.1
|
|
392
427
|
)
|
|
@@ -523,6 +558,14 @@ class AutonomousSession:
|
|
|
523
558
|
|
|
524
559
|
cmd = deanonymize(cmd_raw)
|
|
525
560
|
cmd = self._add_sudo(cmd)
|
|
561
|
+
if getattr(self, "dry_run", False):
|
|
562
|
+
print(f" [DRY-RUN] Pominięto wykonanie: {cmd}")
|
|
563
|
+
self.report.fixes_applied.append(
|
|
564
|
+
FixAction(command=cmd, reason=reason, result="[DRY-RUN]", success=True)
|
|
565
|
+
)
|
|
566
|
+
self.fix_count += 1
|
|
567
|
+
return True
|
|
568
|
+
|
|
526
569
|
print(f" ▶️ Wykonuję: {cmd}")
|
|
527
570
|
|
|
528
571
|
ok, out = self._execute_command(cmd)
|
|
@@ -561,7 +604,7 @@ class AutonomousSession:
|
|
|
561
604
|
|
|
562
605
|
def _handle_done(self) -> None:
|
|
563
606
|
"""Handle DONE action - session complete."""
|
|
564
|
-
print("\n
|
|
607
|
+
print("\n ℹ️ Agent zakończył sesję.")
|
|
565
608
|
|
|
566
609
|
def _process_turn(self) -> bool:
|
|
567
610
|
"""Process one turn of the autonomous session.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""Additional regenerable leaf caches; never scan personal directories."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import click
|
|
11
|
+
|
|
12
|
+
# Keep installations, local repositories, model weights and application state out.
|
|
13
|
+
_CACHE_PATHS = (
|
|
14
|
+
".npm/_npx",
|
|
15
|
+
".npm/_logs",
|
|
16
|
+
".ccache",
|
|
17
|
+
".nv/ComputeCache",
|
|
18
|
+
".cargo/registry/cache",
|
|
19
|
+
".cache/pypoetry/cache",
|
|
20
|
+
".cache/pypoetry/artifacts",
|
|
21
|
+
".cache/Google/Chrome/Default/Cache",
|
|
22
|
+
".cache/go-build",
|
|
23
|
+
".cache/ruff",
|
|
24
|
+
".cache/mypy",
|
|
25
|
+
".cache/Flake8",
|
|
26
|
+
".cache/black",
|
|
27
|
+
)
|
|
28
|
+
_BROWSERS = ("google-chrome", "chromium", "BraveSoftware/Brave-Browser")
|
|
29
|
+
_BROWSER_LEAVES = ("Cache", "Code Cache", "GPUCache", "DawnCache", "ShaderCache")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def cache_path_allowed(home: Path, path: Path) -> bool:
|
|
33
|
+
"""Reject symlinked ancestors, nested mounts and paths outside this home.
|
|
34
|
+
|
|
35
|
+
Symlinks *inside* a cache are unlinked by rmtree, never followed. A mount
|
|
36
|
+
inside a cache must instead protect the entire candidate.
|
|
37
|
+
"""
|
|
38
|
+
try:
|
|
39
|
+
relative = path.relative_to(home)
|
|
40
|
+
current = home
|
|
41
|
+
for part in relative.parts:
|
|
42
|
+
current = current / part
|
|
43
|
+
if current.is_symlink() or current.is_mount():
|
|
44
|
+
return False
|
|
45
|
+
if not path.is_dir():
|
|
46
|
+
return False
|
|
47
|
+
device = path.stat().st_dev
|
|
48
|
+
for parent, dirs, _ in os.walk(
|
|
49
|
+
path, followlinks=False, onerror=_raise_os_error
|
|
50
|
+
):
|
|
51
|
+
for name in dirs:
|
|
52
|
+
child = Path(parent) / name
|
|
53
|
+
if not child.is_symlink() and (
|
|
54
|
+
child.is_mount() or child.stat().st_dev != device
|
|
55
|
+
):
|
|
56
|
+
return False
|
|
57
|
+
return True
|
|
58
|
+
except (OSError, ValueError):
|
|
59
|
+
return False
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _raise_os_error(error: OSError) -> None:
|
|
63
|
+
raise error
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def additional_cache_candidates(home: Path | None = None) -> list[dict]:
|
|
67
|
+
from fixos.cli._cleanup_space import _dir_sizes
|
|
68
|
+
|
|
69
|
+
home = home or Path.home()
|
|
70
|
+
paths = [home / relative for relative in _CACHE_PATHS]
|
|
71
|
+
for browser in _BROWSERS:
|
|
72
|
+
root = home / ".cache" / browser
|
|
73
|
+
# Only cache roots, never ~/.config or browser profile databases.
|
|
74
|
+
if root.is_symlink():
|
|
75
|
+
continue
|
|
76
|
+
try:
|
|
77
|
+
profiles = [
|
|
78
|
+
p
|
|
79
|
+
for p in root.iterdir()
|
|
80
|
+
if p.name == "Default" or p.name.startswith("Profile ")
|
|
81
|
+
]
|
|
82
|
+
except OSError:
|
|
83
|
+
profiles = []
|
|
84
|
+
for profile in [root, *profiles]:
|
|
85
|
+
paths.extend(profile / leaf for leaf in _BROWSER_LEAVES)
|
|
86
|
+
paths = sorted({p for p in paths if cache_path_allowed(home, p)})
|
|
87
|
+
sizes = _dir_sizes(paths)
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
"path": p,
|
|
91
|
+
"description": f"~/{p.relative_to(home)}",
|
|
92
|
+
"size_bytes": sizes.get(str(p), 0),
|
|
93
|
+
"note": "regenerowalny cache",
|
|
94
|
+
}
|
|
95
|
+
for p in paths
|
|
96
|
+
if sizes.get(str(p), 0) > 0
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def cleanup_additional_caches(*, dry_run: bool, yes: bool) -> None:
|
|
101
|
+
from fixos.cli._cleanup_space import (
|
|
102
|
+
_choose,
|
|
103
|
+
_confirm_remove,
|
|
104
|
+
_display_candidates,
|
|
105
|
+
_show_dry_run_commands,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
home = Path.home()
|
|
109
|
+
candidates = additional_cache_candidates(home)
|
|
110
|
+
if not candidates:
|
|
111
|
+
return
|
|
112
|
+
_display_candidates("DODATKOWE CACHE (bez danych użytkownika):", candidates)
|
|
113
|
+
selected = (
|
|
114
|
+
list(range(len(candidates)))
|
|
115
|
+
if yes
|
|
116
|
+
else _choose(candidates, "Numery cache do usunięcia")
|
|
117
|
+
)
|
|
118
|
+
if dry_run:
|
|
119
|
+
_show_dry_run_commands(
|
|
120
|
+
[["rm", "-rf", str(candidates[i]["path"])] for i in selected]
|
|
121
|
+
)
|
|
122
|
+
return
|
|
123
|
+
if not selected or (not yes and not _confirm_remove()):
|
|
124
|
+
return
|
|
125
|
+
for index in selected:
|
|
126
|
+
path = candidates[index]["path"]
|
|
127
|
+
# Revalidate immediately before deletion, including all ancestors.
|
|
128
|
+
if not cache_path_allowed(home, path):
|
|
129
|
+
click.echo(f" {path}: pominięto (zmiana ścieżki lub punkt montowania)")
|
|
130
|
+
continue
|
|
131
|
+
try:
|
|
132
|
+
shutil.rmtree(path)
|
|
133
|
+
click.echo(f" {path}: usunięto")
|
|
134
|
+
except OSError as error:
|
|
135
|
+
click.echo(f" {path}: pominięto ({error})")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def cleanup_docker_builder(*, dry_run: bool, yes: bool) -> None:
|
|
139
|
+
"""Prune only unused build cache older than seven days, with a hard timeout."""
|
|
140
|
+
import shlex
|
|
141
|
+
|
|
142
|
+
if not shutil.which("docker"):
|
|
143
|
+
return
|
|
144
|
+
command = [
|
|
145
|
+
"docker",
|
|
146
|
+
"builder",
|
|
147
|
+
"prune",
|
|
148
|
+
"--all",
|
|
149
|
+
"--force",
|
|
150
|
+
"--filter",
|
|
151
|
+
"until=168h",
|
|
152
|
+
]
|
|
153
|
+
if dry_run:
|
|
154
|
+
click.echo(f"[DRY-RUN] {shlex.join(command)}")
|
|
155
|
+
return
|
|
156
|
+
if not yes and not click.confirm(
|
|
157
|
+
"Usunąć nieużywany cache budowania Dockera starszy niż 7 dni?"
|
|
158
|
+
):
|
|
159
|
+
return
|
|
160
|
+
try:
|
|
161
|
+
result = subprocess.run(
|
|
162
|
+
command, capture_output=True, text=True, check=False, timeout=30
|
|
163
|
+
)
|
|
164
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
165
|
+
click.echo(
|
|
166
|
+
"Docker build cache: pominięto (niedostępny daemon lub timeout 30 s)."
|
|
167
|
+
)
|
|
168
|
+
return
|
|
169
|
+
if result.returncode:
|
|
170
|
+
click.echo("Docker build cache: pominięto (daemon odmówił wykonania).")
|
|
171
|
+
else:
|
|
172
|
+
click.echo(result.stdout.strip() or "Docker build cache: zakończono.")
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"""Target-driven cleanup ladder: reclaim disk until a free-space goal is met.
|
|
2
|
+
|
|
3
|
+
The NoLimits LIM-STORAGE-001 runbook wants "cleanup until N GB free".
|
|
4
|
+
``--threshold-gb`` cannot express that (it filters which *services* are
|
|
5
|
+
reported), so this module provides the goal-oriented pieces:
|
|
6
|
+
|
|
7
|
+
- :func:`free_bytes` — statvfs-based free space of a filesystem.
|
|
8
|
+
- :func:`find_stale_release_caches` — compatibility inventory of old persistent
|
|
9
|
+
releases/snapshots. Every entry is protected, regardless of write bits.
|
|
10
|
+
- :func:`remove_release_caches` — compatibility guard that never deletes
|
|
11
|
+
persistent deployment/rollback data or counts it as reclaimable space.
|
|
12
|
+
- :func:`docker_call` — batched ``docker`` subprocess with a hard timeout so a
|
|
13
|
+
busy daemon skips a tier instead of hanging the whole command.
|
|
14
|
+
- :func:`run_free_target_ladder` — generic runner that measures free space
|
|
15
|
+
before and after each tier and stops as soon as the goal is reached.
|
|
16
|
+
|
|
17
|
+
Nothing here deletes user documents, models, editor data, Docker volumes, or
|
|
18
|
+
anything that needs elevated privileges.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
import os
|
|
24
|
+
import subprocess
|
|
25
|
+
import time
|
|
26
|
+
from collections.abc import Callable, Iterable
|
|
27
|
+
from dataclasses import dataclass, field
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
DEFAULT_FREE_TARGET_GB = 10.0
|
|
31
|
+
DEFAULT_RELEASE_CACHE_MIN_DAYS = 7.0
|
|
32
|
+
DEFAULT_DOCKER_IMAGE_MIN_DAYS = 14.0
|
|
33
|
+
DOCKER_CALL_TIMEOUT_SECONDS = 30
|
|
34
|
+
_RELEASE_PARENT_NAMES = frozenset({"releases", "release", "snapshots"})
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass
|
|
38
|
+
class TierResult:
|
|
39
|
+
"""Outcome of one ladder tier."""
|
|
40
|
+
|
|
41
|
+
name: str
|
|
42
|
+
attempted: bool = True
|
|
43
|
+
skipped_reason: str | None = None
|
|
44
|
+
bytes_freed: int = 0
|
|
45
|
+
note: str = ""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass
|
|
49
|
+
class LadderReport:
|
|
50
|
+
"""Aggregated ladder outcome."""
|
|
51
|
+
|
|
52
|
+
goal_bytes: int
|
|
53
|
+
started_free_bytes: int
|
|
54
|
+
ended_free_bytes: int = 0
|
|
55
|
+
tiers: list[TierResult] = field(default_factory=list)
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def goal_reached(self) -> bool:
|
|
59
|
+
return self.ended_free_bytes >= self.goal_bytes
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def free_bytes(path: str | Path = "/") -> int:
|
|
63
|
+
"""Return free bytes on the filesystem containing ``path`` (0 on error)."""
|
|
64
|
+
try:
|
|
65
|
+
stat = os.statvfs(str(path))
|
|
66
|
+
except OSError:
|
|
67
|
+
return 0
|
|
68
|
+
return stat.f_bavail * stat.f_frsize
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def find_stale_release_caches(
|
|
72
|
+
share_root: Path | str | None = None,
|
|
73
|
+
min_days: float = DEFAULT_RELEASE_CACHE_MIN_DAYS,
|
|
74
|
+
*,
|
|
75
|
+
now: float | None = None,
|
|
76
|
+
) -> tuple[list[dict], list[dict]]:
|
|
77
|
+
"""Return ``([], protected)`` old persistent release/snapshot entries.
|
|
78
|
+
|
|
79
|
+
An entry is a directory directly below
|
|
80
|
+
``<share_root>/<owner>/releases|release|snapshots/`` whose own mtime is
|
|
81
|
+
older than ``min_days`` days. Neither age nor writable mode bits prove that
|
|
82
|
+
immutable deployed releases or rollback snapshots are disposable caches.
|
|
83
|
+
Preserve all of them: partial systemd/process reference discovery cannot
|
|
84
|
+
establish that an unreferenced entry is safe to delete either. The owning
|
|
85
|
+
deployment lifecycle must retire these trees. Do not traverse their payloads
|
|
86
|
+
merely to report protected entries; size_bytes=0 means unmeasured here.
|
|
87
|
+
"""
|
|
88
|
+
root = Path(share_root) if share_root is not None else Path.home() / ".local/share"
|
|
89
|
+
now = time.time() if now is None else now
|
|
90
|
+
cutoff = now - min_days * 86400.0
|
|
91
|
+
removable: list[dict] = []
|
|
92
|
+
protected: list[dict] = []
|
|
93
|
+
try:
|
|
94
|
+
owners = sorted(p for p in root.iterdir() if p.is_dir())
|
|
95
|
+
except OSError:
|
|
96
|
+
return removable, protected
|
|
97
|
+
for owner in owners:
|
|
98
|
+
for parent_name in sorted(_RELEASE_PARENT_NAMES):
|
|
99
|
+
parent = owner / parent_name
|
|
100
|
+
if not parent.is_dir():
|
|
101
|
+
continue
|
|
102
|
+
try:
|
|
103
|
+
children = sorted(parent.iterdir())
|
|
104
|
+
except OSError:
|
|
105
|
+
continue
|
|
106
|
+
for child in children:
|
|
107
|
+
try:
|
|
108
|
+
stat = child.stat(follow_symlinks=False)
|
|
109
|
+
except OSError:
|
|
110
|
+
continue
|
|
111
|
+
if not os.path.isdir(child) or child.is_symlink():
|
|
112
|
+
continue
|
|
113
|
+
if stat.st_mtime > cutoff:
|
|
114
|
+
continue
|
|
115
|
+
entry = {
|
|
116
|
+
"path": child,
|
|
117
|
+
"owner": owner.name,
|
|
118
|
+
"mtime": stat.st_mtime,
|
|
119
|
+
"size_bytes": 0,
|
|
120
|
+
"size_measured": False,
|
|
121
|
+
"reason": "persistent deployment/rollback data",
|
|
122
|
+
}
|
|
123
|
+
protected.append(entry)
|
|
124
|
+
return removable, protected
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def remove_release_caches(entries: Iterable[dict], *, dry_run: bool = False) -> int:
|
|
128
|
+
"""Preserve persistent releases/snapshots; always return zero bytes.
|
|
129
|
+
|
|
130
|
+
Retained for compatibility with callers holding a precomputed cleanup plan.
|
|
131
|
+
Reject every candidate, including stale or forged writable entries, without
|
|
132
|
+
inspecting or deleting its path. Dry-run must not promise this space either.
|
|
133
|
+
"""
|
|
134
|
+
return 0
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def docker_call(
|
|
138
|
+
args: list[str], timeout: int = DOCKER_CALL_TIMEOUT_SECONDS
|
|
139
|
+
) -> tuple[bool, str]:
|
|
140
|
+
"""Run ``docker <args>`` with a hard timeout.
|
|
141
|
+
|
|
142
|
+
Returns ``(ok, output)``. A missing binary, a timeout or a non-zero exit
|
|
143
|
+
is a skipped tier, never a crash of the whole ladder.
|
|
144
|
+
"""
|
|
145
|
+
try:
|
|
146
|
+
completed = subprocess.run(
|
|
147
|
+
["docker", *args],
|
|
148
|
+
capture_output=True,
|
|
149
|
+
text=True,
|
|
150
|
+
timeout=timeout,
|
|
151
|
+
check=False,
|
|
152
|
+
)
|
|
153
|
+
except FileNotFoundError:
|
|
154
|
+
return False, "docker not available"
|
|
155
|
+
except subprocess.TimeoutExpired:
|
|
156
|
+
return False, f"docker {args[0]} timed out after {timeout}s (busy daemon)"
|
|
157
|
+
output = (completed.stdout or "") + (completed.stderr or "")
|
|
158
|
+
return completed.returncode == 0, output.strip()
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _docker_used_image_refs(timeout: int) -> tuple[set[str], set[str]] | None:
|
|
162
|
+
"""Return ``(used_ids, used_names)`` from one cheap ``ps -a`` call.
|
|
163
|
+
|
|
164
|
+
Container→image resolution via ``docker inspect`` races with the daemon
|
|
165
|
+
on busy hosts (containers vanish mid-chunk); ``ps --format {{.Image}}``
|
|
166
|
+
already carries the reference (``repo:tag`` or ``sha256:…``).
|
|
167
|
+
"""
|
|
168
|
+
ok, out = docker_call(["ps", "-a", "--format", "{{.Image}}"], timeout)
|
|
169
|
+
if not ok:
|
|
170
|
+
return None
|
|
171
|
+
used_ids: set[str] = set()
|
|
172
|
+
used_names: set[str] = set()
|
|
173
|
+
for line in out.splitlines():
|
|
174
|
+
ref = line.strip()
|
|
175
|
+
if not ref:
|
|
176
|
+
continue
|
|
177
|
+
if ref.startswith("sha256:"):
|
|
178
|
+
used_ids.add(ref.split(":", 1)[1])
|
|
179
|
+
else:
|
|
180
|
+
used_names.add(ref)
|
|
181
|
+
return used_ids, used_names
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def docker_prune_dangling(timeout: int = DOCKER_CALL_TIMEOUT_SECONDS) -> TierResult:
|
|
185
|
+
"""Prune dangling images and old build cache (no volumes, no tagged data)."""
|
|
186
|
+
ok, out = docker_call(["image", "prune", "-f"], timeout)
|
|
187
|
+
if not ok:
|
|
188
|
+
return TierResult("docker-dangling", attempted=False, skipped_reason=out)
|
|
189
|
+
ok_cache, out_cache = docker_call(
|
|
190
|
+
["builder", "prune", "-f", "--filter", "until=168h"], timeout
|
|
191
|
+
)
|
|
192
|
+
note = out_cache if not ok_cache else ""
|
|
193
|
+
return TierResult("docker-dangling", note=note)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _parse_docker_created(value: str) -> float:
|
|
197
|
+
for fmt in ("%Y-%m-%d %H:%M:%S %z", "%Y-%m-%d %H:%M:%S"):
|
|
198
|
+
try:
|
|
199
|
+
return time.mktime(time.strptime(value.strip(), fmt))
|
|
200
|
+
except ValueError:
|
|
201
|
+
continue
|
|
202
|
+
return 0.0
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def docker_remove_unused_old_images(
|
|
206
|
+
min_days: float = DEFAULT_DOCKER_IMAGE_MIN_DAYS,
|
|
207
|
+
timeout: int = DOCKER_CALL_TIMEOUT_SECONDS,
|
|
208
|
+
) -> TierResult:
|
|
209
|
+
"""Remove images referenced by no container and older than ``min_days``."""
|
|
210
|
+
used = _docker_used_image_refs(timeout)
|
|
211
|
+
if used is None:
|
|
212
|
+
return TierResult(
|
|
213
|
+
"docker-unused-images", attempted=False, skipped_reason="docker unavailable"
|
|
214
|
+
)
|
|
215
|
+
used_ids, used_names = used
|
|
216
|
+
ok, out = docker_call(
|
|
217
|
+
["images", "--format", "{{.ID}}\t{{.Repository}}:{{.Tag}}\t{{.CreatedAt}}"],
|
|
218
|
+
timeout,
|
|
219
|
+
)
|
|
220
|
+
if not ok:
|
|
221
|
+
return TierResult("docker-unused-images", attempted=False, skipped_reason=out)
|
|
222
|
+
cutoff = time.time() - min_days * 86400.0
|
|
223
|
+
candidates: list[str] = []
|
|
224
|
+
for line in out.splitlines():
|
|
225
|
+
parts = [p.strip() for p in line.split("\t")]
|
|
226
|
+
if len(parts) != 3:
|
|
227
|
+
continue
|
|
228
|
+
image_id, name, created = parts
|
|
229
|
+
if image_id in used_ids or name in used_names or name.startswith("<none>:"):
|
|
230
|
+
continue
|
|
231
|
+
if (
|
|
232
|
+
_parse_docker_created(created) == 0.0
|
|
233
|
+
or _parse_docker_created(created) > cutoff
|
|
234
|
+
):
|
|
235
|
+
continue
|
|
236
|
+
candidates.append(image_id)
|
|
237
|
+
if not candidates:
|
|
238
|
+
return TierResult("docker-unused-images")
|
|
239
|
+
# Batched rmi: conflicting (multi-repo) images are skipped by the daemon.
|
|
240
|
+
ok, out = docker_call(["rmi", *candidates], timeout)
|
|
241
|
+
if not ok:
|
|
242
|
+
return TierResult(
|
|
243
|
+
"docker-unused-images", attempted=False, skipped_reason=out[:200]
|
|
244
|
+
)
|
|
245
|
+
return TierResult("docker-unused-images")
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def run_free_target_ladder(
|
|
249
|
+
goal_gb: float,
|
|
250
|
+
*,
|
|
251
|
+
tiers: list[Callable[[], TierResult]],
|
|
252
|
+
free_fn: Callable[[], int] = lambda: free_bytes("/"),
|
|
253
|
+
echo: Callable[[str], None] = print,
|
|
254
|
+
dry_run: bool = False,
|
|
255
|
+
) -> LadderReport:
|
|
256
|
+
"""Run tiers in order, stopping once free space reaches ``goal_gb``.
|
|
257
|
+
|
|
258
|
+
Tiers are callables returning :class:`TierResult`; the free-space delta
|
|
259
|
+
measured around each tier is authoritative (tier-reported byte counts are
|
|
260
|
+
advisory only).
|
|
261
|
+
"""
|
|
262
|
+
report = LadderReport(
|
|
263
|
+
goal_bytes=int(goal_gb * 1024**3),
|
|
264
|
+
started_free_bytes=free_fn(),
|
|
265
|
+
)
|
|
266
|
+
report.ended_free_bytes = report.started_free_bytes
|
|
267
|
+
if report.started_free_bytes >= report.goal_bytes:
|
|
268
|
+
echo(
|
|
269
|
+
f"Cel już osiągnięty: {report.started_free_bytes / 1024**3:.1f} GB wolnego "
|
|
270
|
+
f"(cel {goal_gb:.1f} GB)."
|
|
271
|
+
)
|
|
272
|
+
return report
|
|
273
|
+
for tier in tiers:
|
|
274
|
+
before = free_fn()
|
|
275
|
+
result = tier()
|
|
276
|
+
after = free_fn()
|
|
277
|
+
result.bytes_freed = max(0, after - before)
|
|
278
|
+
report.tiers.append(result)
|
|
279
|
+
report.ended_free_bytes = after
|
|
280
|
+
if result.attempted:
|
|
281
|
+
echo(
|
|
282
|
+
f" • {result.name}: zwolniono {result.bytes_freed / 1024**3:.2f} GB"
|
|
283
|
+
+ (f" ({result.skipped_reason})" if result.skipped_reason else "")
|
|
284
|
+
)
|
|
285
|
+
else:
|
|
286
|
+
echo(f" • {result.name}: pominięto ({result.skipped_reason})")
|
|
287
|
+
if dry_run:
|
|
288
|
+
continue
|
|
289
|
+
if after >= report.goal_bytes:
|
|
290
|
+
break
|
|
291
|
+
return report
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def print_privileged_hints(goal_gb: float, report: LadderReport) -> None:
|
|
295
|
+
"""Print exact next steps needing privileges when the goal is unmet."""
|
|
296
|
+
if report.goal_reached:
|
|
297
|
+
return
|
|
298
|
+
gap_gb = (report.goal_bytes - report.ended_free_bytes) / 1024**3
|
|
299
|
+
print()
|
|
300
|
+
print(
|
|
301
|
+
f"Brakuje ~{gap_gb:.1f} GB do celu {goal_gb:.1f} GB. "
|
|
302
|
+
"Kolejne pule wymagają uprawnień — wykonaj ręcznie:"
|
|
303
|
+
)
|
|
304
|
+
print(" sudo snap set system refresh.retain=2 # ogranicz przyszłe rewizje")
|
|
305
|
+
print(
|
|
306
|
+
" snap list --all | awk '/disabled/{print $1, $3}' | "
|
|
307
|
+
'while read n r; do sudo snap remove "$n" --revision="$r"; done'
|
|
308
|
+
)
|
|
309
|
+
print(" sudo journalctl --vacuum-size=500M # przycięcie dziennika")
|
|
310
|
+
print(" sudo rm /var/log/syslog.[0-9].gz # stare rotacje sysloga")
|